From 2e37c7f9837a6209781dafc1d21c735180c4e036 Mon Sep 17 00:00:00 2001 From: Li Haoyi Date: Sat, 28 Mar 2015 22:21:24 +0800 Subject: . --- index.html | 1042 ++++++++++++++++++++++++++++++++---------------------------- scripts.js | 701 +++++++++++++++++++++++++++++++++++++++- styles.css | 64 +--- 3 files changed, 1252 insertions(+), 555 deletions(-) diff --git a/index.html b/index.html index 4d0fce3..c263af8 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,63 @@ -Hands-on Scala.jsHands-on Scala.js
-

Hands-on Scala.js


Writing client-side web applications in Scala

+
+

Hands-on Scala.js


Writing client-side web applications in Scala

-
var x = 0.0
+      
var x = 0.0
 type Graph = (String, Double => Double)
 val graphs = Seq[Graph](
   ("red", sin),
@@ -34,7 +84,7 @@ dom.setInterval(() => {
     brush.fillStyle = color
     brush.fillRect(x, y + offset, 3, 3)
   }
-}, 20)
+}, 20)
@@ -67,14 +117,14 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth

Feel free to jump ahead to either of them if you have some prior exposure to Scala.js. If not, it is best to start with the introduction...

-

Intro to Scala.js


+

Intro to Scala.js


Scala.js compiles Scala code to equivalent, executable Javascript. Here's the compilation of a trivial hello-world example:

-
object Main extends js.JSApp{
+    
object Main extends js.JSApp{
   def main() = {
     var x = 0
     while(x < 10) x += 3
@@ -84,7 +134,7 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth
 }
 
-
ScalaJS.c.LMain$.prototype.main__V = (function() {
+    
ScalaJS.c.LMain$.prototype.main__V = (function() {
   var x = 0;
   while ((x < 10)) {
     x = ((x + 3) | 0)
@@ -95,7 +145,7 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth
 });
 

- As you can see, both of the above programs do identical things: they'll count the variable x from 0, 3, 9, and 12 before finally printing it out. It's just that the first is written in Scala and the second is in Javascript. + As you can see, both of the above programs do identical things: they'll count the variable x from 0, 3, 9, and 12 before finally printing it out. It's just that the first is written in Scala and the second is in Javascript.

Traditionally, Scala has been a language which runs on the JVM. This eliminates it from consideration in many cases, e.g. when you need to build interactive web apps, the browser-client only runs Javascript. Even if your back-end is all written in Scala, you need to fall back to Javascript to run your client-side code, at a great loss in terms of toolability and maintainability. Scala.js lets you to develop web applications with the safety and toolability that comes with a statically typed language: @@ -116,11 +166,11 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth

I won't spend time on a detailed discussion on why Scala is good or why Javascript is bad; people's opinions on both sides can be found on the internet. The assumption is, going in, that you either already know and like Scala, or you are familiar with Javascript and are willing to try something new.

-

About Javascript


+

About Javascript


Javascript is the language supported by web browsers, and is the only language available if you wish to write interactive web applications. As more and more activity moves online, the importance of web apps will only increase over time. Adobe Flash, Java Applets and Silverlight (which have historically allowed browser-client development in other languages) are all but dead: historically they have been the source of security vulnerabilities, none of them are available on the mobile browsers of Android or iOS or Windows8+. That leaves Javascript.

-

Javascript-the-language

+

Javascript-the-language

Javascript is an OK language to do small-scale development: an animation here, an on-click transition there. There are a number of warts in the language, e.g. its verbosity, and a large amount of surprising behavior, but while your code-base doesn't extend past a few hundred lines of code, you often will not mind or care.

@@ -141,7 +191,7 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth

Even if you manage to do so, what constitutes a pitfall and what constitutes a clever-language-feature changes yearly, making it difficult to maintain cohesiveness over time. This is compounded by the fact that refactoring is difficult, and so removing "unwanted" patterns from a large code-base a difficult (often multi-year) process.

-

Javascript-the-platform

+

Javascript-the-platform

However, even though Javascript-the-language is pretty bad, Javascript-the-platform has some very nice properties that make it a good target for application developers:

@@ -170,19 +220,19 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth

Despite the problems with Javascript (and other tools like HTML an CSS, which have their own problems) the Web platform got a lot of things right, and the Desktop and Mobile platforms have a lot of catching up to do. If only we could improve upon the parts that aren't so great. This is where Scala.js comes in.

-

About Scala.js


+

About Scala.js


With Scala.js, you can cross compile your Scala code to a Javascript executable that can run on all major web browsers. You get all the benefits of the web platform in terms of deployability, security, and hyperlinking, with none of the problems of writing your software in Javascript. Scala.js provides a better language to do your work in, but also provides some other goodies that have in-so-far never been seen in mainstream web development: shared-code and client-server integration.

-

The Language

+

The Language

At a first approximation, Scala.js provides you a sane language to do development in the web browser. This saves you from an endless stream of Javascript warts like this one:

-
javascript> ["10", "10", "10", "10"].map(parseInt)
+    
javascript> ["10", "10", "10", "10"].map(parseInt)
 [10, NaN, 2, 3] // WTF
 
-
scala> List("10", "10", "10", "10").map(parseInt)
+    
scala> List("10", "10", "10", "10").map(parseInt)
 List(10, 10, 10, 10) // Yay!
 
 
@@ -195,7 +245,7 @@ List(10, 10, 10, 10) // Yay!

At this point, all of Google, Facebook, and Microsoft have all announced work on a typed variant of Javascript. These are not academic exercises: Dart/AtScript/Flow/Typescript are all problems that solve a real need, that these large companies have all faced once they've grown beyond a certain size. Clearly, Javascript isn't cutting it anymore, and the convenience and "native-ness" of the language is more than made up for in the constant barrage of self-inflicted problems. Scala.js takes this idea and runs with it!

-

Sharing Code

+

Sharing Code

Shared code is one of the holy-grails of web development. Traditionally the client-side code and server-side code has been written in separate languages: PHP or Perl or Python or Ruby or Java on the server, with only Javascript on the client. This means that algorithms were often implemented twice, constants copied-&-pasted, or awkward Ajax calls are made in an attempt to centralize the logic in one place (the server). With the advent of Node.js in the last few years, you can finally re-use the same code on the server as you can on the client, but with the cost of having all the previously client-only problems with Javascript now inflicted upon your server code base. Node.js expanded your range-of-options for writing shared client/server logic from "Write everything twice" to "Write everything twice, or write everything in Javascript". More options is always good, but it's not clear which of the two choices is more painful!

@@ -228,7 +278,7 @@ List(10, 10, 10, 10) // Yay!

Shared code has long been the holy-grail of web development. Even now, people speak of shared code as if it were a myth. With Scala.js, shared code is the simple, boring reality. And all this while, just as importantly, you don't need to re-write your large enterprise back-end systems in a language that doesn't scale well beyond 100s of lines of code.

-

Client-Server Integration

+

Client-Server Integration

There is an endless supply of new platforms which have promised to change-the-way-we-do-web-development-forever. From old-timers like Ur-Web, to GWT, to Asana's LunaScript, to more recently things like Meteor.js.

@@ -249,13 +299,13 @@ List(10, 10, 10, 10) // Yay! Scala.js provides all these things, and much more. If you're interested enough to want to make use of Scala.js, read on!

-

Hands On


Writing your first Scala.js programs

+

Hands On


Writing your first Scala.js programs

This half of the book is a set of tutorials that walks you through getting started with Scala.js. You'll build a range of small projects, from Making a Canvas App to Interactive Web Pages to Integrating Client-Server, and in the process will get a good overview of both Scala.js's use cases as well as the development experience

-

Getting Started


+

Getting Started


@@ -279,7 +329,7 @@ is a set of tutorials that walks you through getting started with Scala.js. You'

The quickest way to get started with Scala.js is to git clone workbench-example-app, go into the repository root, and run sbt ~fastOptJS

-
git clone https://github.com/lihaoyi/workbench-example-app
+
git clone https://github.com/lihaoyi/workbench-example-app
 cd workbench-example-app
 sbt ~fastOptJS
 
@@ -324,7 +374,7 @@ sbt ~fastOptJS

Congratulations, you just built and ran your first Scala.js application! If something here does not happen as expected, it means that one of the steps did not complete successfully. Make sure you can get this working before you proceed onward.

-

Opening up the Project

+

Opening up the Project

The next thing to do once you have the project built and running in your browser is to load it into your editor. Both IntelliJ and Eclipse should let you import the Scala.js project without any hassle. Opening it and navigating to ScalaJSExample.scala would look like this: @@ -334,7 +384,7 @@ sbt ~fastOptJS

Let's try changing one line to change the background fill from black to white:

-
- ctx.fillStyle = "black"
+  
- ctx.fillStyle = "black"
 + ctx.fillStyle = "white"
 

@@ -348,14 +398,14 @@ sbt ~fastOptJS

- Apart from the SBT log output (which is handled by Workbench) any printlns in your Scala.js code will also end up in the browser console (the main you see in the console is printed inside the Scala.js application, see if you can find it!) and so will the stack traces for any thrown exceptions. + Apart from the SBT log output (which is handled by Workbench) any printlns in your Scala.js code will also end up in the browser console (the main you see in the console is printed inside the Scala.js application, see if you can find it!) and so will the stack traces for any thrown exceptions.

-

The Application Code

+

The Application Code

We've downloaded, compiled, ran, and made changes to our first Scala.js application. Let's now take a closer look at the code that we just ran:

-
package example
+  
package example
 import scala.scalajs.js.annotation.JSExport
 import org.scalajs.dom
 import org.scalajs.dom.html
@@ -398,46 +448,46 @@ object ScalaJSExample {
 
     dom.setInterval(() => run, 50)
   }
-}
+}

- It's a good chunk of code, though not a huge amount. To someone who didn't know about Scala.js, they would just think it's normal Scala, albeit with this unusual dom library and a few weird annotations. Let's pick it apart starting from the top: + It's a good chunk of code, though not a huge amount. To someone who didn't know about Scala.js, they would just think it's normal Scala, albeit with this unusual dom library and a few weird annotations. Let's pick it apart starting from the top:

-
case class Point(x: Int, y: Int){
+  
case class Point(x: Int, y: Int){
   def +(p: Point) = Point(x + p.x, y + p.y)
   def /(d: Int) = Point(x / d, y / d)
-}
+}

- Here we are defining a Point case class which represents a X/Y position, with some basic operators defined on it. This is done mostly for convenience later on, when we want to manipulate these two-dimensional points. Scala.js is Scala, and supports the entirety of the Scala language. Point here behaves identically as it would if you had run Scala on the JVM. + Here we are defining a Point case class which represents a X/Y position, with some basic operators defined on it. This is done mostly for convenience later on, when we want to manipulate these two-dimensional points. Scala.js is Scala, and supports the entirety of the Scala language. Point here behaves identically as it would if you had run Scala on the JVM.

-
@JSExport
+  
@JSExport
 object ScalaJSExample {
   @JSExport
-  def main(canvas: html.Canvas): Unit = {
+ def main(canvas: html.Canvas): Unit = {

- This @JSExport annotation is used to tell Scala.js that you want this method to be visible and callable from Javascript. By default, Scala.js does dead code elimination and removes any methods or classes which are not used. This is done to keep the compiled executables a reasonable size, since most projects use only a small fraction of e.g. the standard library. @JSExport is used to tell Scala.js that the ScalaJSExample object and its def main method are entry points to the program. Even if they aren't called anywhere internally, they are called externally by Javascript that the Scala.js compiler is not aware of, and should not be removed. In this case, we are going to call this method from Javascript to start the Scala.js program. + This @JSExport annotation is used to tell Scala.js that you want this method to be visible and callable from Javascript. By default, Scala.js does dead code elimination and removes any methods or classes which are not used. This is done to keep the compiled executables a reasonable size, since most projects use only a small fraction of e.g. the standard library. @JSExport is used to tell Scala.js that the ScalaJSExample object and its def main method are entry points to the program. Even if they aren't called anywhere internally, they are called externally by Javascript that the Scala.js compiler is not aware of, and should not be removed. In this case, we are going to call this method from Javascript to start the Scala.js program.

- Apart from this annotation, ScalaJSExample is just a normal Scala object, and behaves like one in every way. Note that the main-method in this case takes a html.Canvas: your exported methods can have any signature, with arbitrary arity or types for parameters or the return value. This is in contrast to the main method on the JVM which always takes an Array[String] and returns Unit. In fact, there's nothing special about this method at all! It's like any other exported method, we just happen to attribute it the "main" entry point. It is entirely possible to define multiple exported classes and methods, and build a "library" using Scala.js of methods that are intended for external Javascript to use. + Apart from this annotation, ScalaJSExample is just a normal Scala object, and behaves like one in every way. Note that the main-method in this case takes a html.Canvas: your exported methods can have any signature, with arbitrary arity or types for parameters or the return value. This is in contrast to the main method on the JVM which always takes an Array[String] and returns Unit. In fact, there's nothing special about this method at all! It's like any other exported method, we just happen to attribute it the "main" entry point. It is entirely possible to define multiple exported classes and methods, and build a "library" using Scala.js of methods that are intended for external Javascript to use.

-
val ctx = canvas.getContext("2d")
-                .asInstanceOf[dom.CanvasRenderingContext2D]
+
val ctx = canvas.getContext("2d")
+                .asInstanceOf[dom.CanvasRenderingContext2D]

- Here we are retrieving a handle to the canvas we will draw on using document.getElementById, and from it we can get a CanvasRenderingContext2D which we actually use to draw on it. + Here we are retrieving a handle to the canvas we will draw on using document.getElementById, and from it we can get a CanvasRenderingContext2D which we actually use to draw on it.

- We need to perform the asInstanceOf call because depending on what you pass to getElementById and getContext, you could be returned elements and contexts of different types. Hence we need to tell the compiler explicitly that we're expecting a html.Canvas and CanvasRenderingContext2D back from these methods for the strings we passed in. + We need to perform the asInstanceOf call because depending on what you pass to getElementById and getContext, you could be returned elements and contexts of different types. Hence we need to tell the compiler explicitly that we're expecting a html.Canvas and CanvasRenderingContext2D back from these methods for the strings we passed in.

- Note how the html.Canvas comes from the html namespace, while the CanvasRenderingContext2D comes from the dom namespace. Traditionally, these types are imported via their qualified names: e.g. html.Canvas rather than just Canvas. + Note how the html.Canvas comes from the html namespace, while the CanvasRenderingContext2D comes from the dom namespace. Traditionally, these types are imported via their qualified names: e.g. html.Canvas rather than just Canvas.

- In general, scala-js-dom provides org.scalajs.dom.html to access the HTML element types of the browser, an org.scalajs.dom to access other things. There are a number of other namespaces (dom.svg, dom.idb, etc.) accessible inside org.scalajs.dom: read the scala-js-dom docs to learn more. + In general, scala-js-dom provides org.scalajs.dom.html to access the HTML element types of the browser, an org.scalajs.dom to access other things. There are a number of other namespaces (dom.svg, dom.idb, etc.) accessible inside org.scalajs.dom: read the scala-js-dom docs to learn more.

-
def run = for (i <- 0 until 10){
+  
def run = for (i <- 0 until 10){
   if (count % 3000 == 0) clear()
   count += 1
   p = (p + corners(Random.nextInt(3))) / 2
@@ -449,7 +499,7 @@ object ScalaJSExample {
   ctx.fillStyle = s"rgb($g, $r, $b)"
 
   ctx.fillRect(p.x, p.y, 1, 1)
-}
+}

This is the part of the Scala.js program which does the real work. It runs 10 iterations of a small algorithm that generates a Sierpinski Triangle point-by-point. The steps, as described by the linked article, are roughly: @@ -458,7 +508,7 @@ object ScalaJSExample {

  • Pick a random corner of the large-triangle
  • - Move your current-position p halfway between its current location and that corner
  • + Move your current-position p halfway between its current location and that corner
  • Draw a dot
  • @@ -467,20 +517,20 @@ object ScalaJSExample {

    In this example, the triangle is hard-coded to be 255 pixels high by 255 pixels wide, and some math is done to pick a color for each dot which will give the triangle a pretty gradient.

    -
    dom.setInterval(() => run, 50)
    +
    dom.setInterval(() => run, 50)

    - Now this is the call that actually does the useful work. All this method does is call dom.setInterval, which tells the browser to run the run method every 50 milliseconds. As mentioned earlier, the dom.* methods are simply facades to their native Javascript equivalents, and dom.setInterval is no different. Note how you can pass a Scala lambda to setInterval to have it called by the browser, where in Javascript you'd need to pass a Javascript function(){...} + Now this is the call that actually does the useful work. All this method does is call dom.setInterval, which tells the browser to run the run method every 50 milliseconds. As mentioned earlier, the dom.* methods are simply facades to their native Javascript equivalents, and dom.setInterval is no different. Note how you can pass a Scala lambda to setInterval to have it called by the browser, where in Javascript you'd need to pass a Javascript function(){...}

    -

    The Project Code

    +

    The Project Code

    We've already taken a look at the application code for a simple, self-contained Scala.js application, but this application is not entirely self contained. It's wrapped in a small SBT project that sets up the necessary dependencies and infrastructure for this application to work.

    -

    project/build.sbt

    -
    addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.0")
    +  

    project/build.sbt

    +
    addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.0")
     
    -addSbtPlugin("com.lihaoyi" % "workbench" % "0.2.3")
    +addSbtPlugin("com.lihaoyi" % "workbench" % "0.2.3")

    This is the list of SBT plugins used by this small example application. There are two of them: the Scala.js plugin (which contains the Scala.js compiler and other things, e.g. tasks such as fastOptJS) and the Workbench plugin, which is used to provide the auto-reload-on-change behavior and the forwarding of SBT logspam to the browser console. @@ -489,8 +539,8 @@ addSbtPlugin("com.lihaoyi" % "workbench" % "0.2.3" Of the two, only the Scala.js plugin is really necessary. The Workbench plugin is a convenience that makes development easier. Without it you'd need to keep a terminal open to view the SBT logspam, and manually refresh the page when compilation finished. Not the end of the world.

    -

    build.sbt

    -
    import com.lihaoyi.workbench.Plugin._
    +  

    build.sbt

    +
    import com.lihaoyi.workbench.Plugin._
     
     enablePlugins(ScalaJSPlugin)
     
    @@ -508,19 +558,19 @@ libraryDependencies ++= Seq(
     
     bootSnippet := "example.ScalaJSExample().main(document.getElementById('canvas'));"
     
    -updateBrowsers <<= updateBrowsers.triggeredBy(fastOptJS in Compile)
    +updateBrowsers <<= updateBrowsers.triggeredBy(fastOptJS in Compile)

    - The build.sbt project file for this application is similarly unremarkable: It includes the settings for the two SBT plugins we saw earlier, as well as boilerplate name/version/scalaVersion values common to all projects. + The build.sbt project file for this application is similarly unremarkable: It includes the settings for the two SBT plugins we saw earlier, as well as boilerplate name/version/scalaVersion values common to all projects.

    - Of interest is the libraryDependencies. In Scala-JVM, this key is used to declare dependencies on libraries from Maven Central, so you can use them in your Scala-JVM projects. In Scala.js, the same key is used to declare dependencies on libraries so you can use them in your Scala.js projects! Re-usable libraries can be built and published with Scala.js just as you do on Scala-JVM, and here we make use of one which provides the typed facades with which we used to access the DOM in the application code. + Of interest is the libraryDependencies. In Scala-JVM, this key is used to declare dependencies on libraries from Maven Central, so you can use them in your Scala-JVM projects. In Scala.js, the same key is used to declare dependencies on libraries so you can use them in your Scala.js projects! Re-usable libraries can be built and published with Scala.js just as you do on Scala-JVM, and here we make use of one which provides the typed facades with which we used to access the DOM in the application code.

    - Lastly, we have two Workbench related settings: bootSnippet basically tells Workbench how to restart your application when a new compilation run finishes, and updateBrowsers actually tells it to perform this application-restarting. + Lastly, we have two Workbench related settings: bootSnippet basically tells Workbench how to restart your application when a new compilation run finishes, and updateBrowsers actually tells it to perform this application-restarting.

    -

    src/main/resources/index-dev.html

    -
    <!DOCTYPE html>
    +  

    src/main/resources/index-dev.html

    +
    <!DOCTYPE html>
     <html>
     <head>
       <title>Example Scala.js application</title>
    @@ -538,26 +588,26 @@ updateBrowsers <<= updateBrowsers.triggeredBy(fastOptJS in Compile)
         example.ScalaJSExample().main(document.getElementById('canvas'));
     </script>
     </body>
    -</html>
    +</html>

    - This is the HTML page which our toy app lives in, and the same page that we have so far been using to view the app in the browser. To anyone who has used HTML, most of it is probably familiar. Things of note are the <script> tags: "../example-fastopt.js" Is the executable blob spat out by the compiler, which we need to include in the HTML page for anything to happen. This is where the results of your compiled Scala code appear. "workbench.js" is the client for the Workbench plugin that connects to SBT, reloads the browser and forwards logspam to the browser console. + This is the HTML page which our toy app lives in, and the same page that we have so far been using to view the app in the browser. To anyone who has used HTML, most of it is probably familiar. Things of note are the <script> tags: "../example-fastopt.js" Is the executable blob spat out by the compiler, which we need to include in the HTML page for anything to happen. This is where the results of your compiled Scala code appear. "workbench.js" is the client for the Workbench plugin that connects to SBT, reloads the browser and forwards logspam to the browser console.

    - The example.ScalaJSExample().main() call is what kicks off the Scala.js application and starts its execution. Scala.js follows Scala semantics in that objects are evaluated lazily, with no top-level code allowed. This is in contrast to Javascript, where you can include top-level statements and object-literals in your code which execute immediately. In Scala.js, nothing happens when ../example-fastopt.js is imported! We have to call the main-method first. In this case, we're passing the canvas object (attained using getElementById) to it so it knows where to do its thing. + The example.ScalaJSExample().main() call is what kicks off the Scala.js application and starts its execution. Scala.js follows Scala semantics in that objects are evaluated lazily, with no top-level code allowed. This is in contrast to Javascript, where you can include top-level statements and object-literals in your code which execute immediately. In Scala.js, nothing happens when ../example-fastopt.js is imported! We have to call the main-method first. In this case, we're passing the canvas object (attained using getElementById) to it so it knows where to do its thing.

    - document.getElementById is the exact same API that's used in normal Javascript, as documented here. In fact, the entire org.scalajs.dom namespace (imported at the top of the file) comprises statically typed facades for the javascript APIs provided by the browser. + document.getElementById is the exact same API that's used in normal Javascript, as documented here. In fact, the entire org.scalajs.dom namespace (imported at the top of the file) comprises statically typed facades for the javascript APIs provided by the browser.

    - Lastly, only @JSExported objects and methods can be called from Javascript. Also, although this example only exports the main method which is called once, there is nothing stopping you from exporting any number of objects and methods and calling them whenever you need to. In this way, you can easily make a Scala.js "library" which is available to external Javascript as an API. + Lastly, only @JSExported objects and methods can be called from Javascript. Also, although this example only exports the main method which is called once, there is nothing stopping you from exporting any number of objects and methods and calling them whenever you need to. In this way, you can easily make a Scala.js "library" which is available to external Javascript as an API.

    -

    Publishing

    +

    Publishing

    The last thing that we'll do with our toy application is to publish it. If you look in the target/scala-2.11 folder, you'll see the output of everything we've done so far:

    -
    target/scala-2.11
    +  
    target/scala-2.11
     ├── classes
     │   ├── JS_DEPENDENCIES
     │   ├── example
    @@ -581,13 +631,13 @@ updateBrowsers <<= updateBrowsers.triggeredBy(fastOptJS in Compile)
       

    These two files can be extracted and published as-is: you can put them on Github-Pages, Amazon Web Services, or a hundred other places. However, one thing of note is the fact that the generated Javascript file is quite large:

    -
    haoyi-mbp:temp haoyi$ du -h target/scala-2.11/example-fastopt.js
    +  
    haoyi-mbp:temp haoyi$ du -h target/scala-2.11/example-fastopt.js
     656K  target/scala-2.11/example-fastopt.js
     

    656 Kilobytes for a hello world app! That is clearly too large. If you examine the contents of the file, you'll see that your code has been translated into something like this:

    -
    var v1 = i;
    +  
    var v1 = i;
     if (((count$1.elem$1 % 3000) === 0)) {
       ScalaJS.m.Lexample_ScalaJSExample$().example$ScalaJSExample$$clear$1__Lorg_scalajs_dom_CanvasRenderingContext2D__V(ctx$1)
     };
    @@ -600,19 +650,19 @@ var r = ((ScalaJS.as.Lexample_Point(p$1.elem$1).x$1 * height) | 0);
     var g = ((((255 - ScalaJS.as.Lexample_Point(p$1.elem$1).x$1) | 0) * height) | 0);
     

    - As you can see, this code is still very verbose, with lots of unnecessarily long identifiers such as Lexample_ScalaJSExample$ in it. This is because we've only performed the Fast Optimization on this file, to try and keep the time taken to edit -> compile while developing reasonably short. + As you can see, this code is still very verbose, with lots of unnecessarily long identifiers such as Lexample_ScalaJSExample$ in it. This is because we've only performed the Fast Optimization on this file, to try and keep the time taken to edit -> compile while developing reasonably short.

    -

    Optimization

    +

    Optimization

    If we're planning on publishing the app for real, we can run the Full Optimization. This takes several seconds longer than the Fast Optimization, but results in a significantly smaller and leaner output file example-opt.js.

    -
    haoyi-mbp:temp haoyi$ du -h target/scala-2.11/example-opt.js
    +    
    haoyi-mbp:temp haoyi$ du -h target/scala-2.11/example-opt.js
     104K  target/scala-2.11/example-opt.js
     

    104 Kilobytes! Better. Not great, though! In general, Scala.js does not produce tiny executables, although the output size of the compiled executables is dropping all the time. If you look inside that file, you'll see all of the long identifiers have been replaced by short ones by the Google Closure Compiler.

    -
      y=fb(gb((new F).Ya(["rgb(",", ",", ",")"])),(new F).Ya([(255-c.l.Db|0)*y|0,c.l.Db*y|0,c.l.Eb]));a.fillStyle=y;a.fillRect(c.l.Db,c.l.Eb,1,1);w=1+w|0}}}(a,b,c,e),50)}Xa.prototype.main=function(a){Ya(a)};Xa.prototype.a=new x({$g:0},!1,"example.ScalaJSExample$",B,{$g:1,b:1});var hb=void 0;function bb(){hb||(hb=(new Xa).c());return hb}ba.example=ba.example||{};ba.example.ScalaJSExample=bb;function Da(){this.Pb=null}Da.prototype=new A;
    +    
      y=fb(gb((new F).Ya(["rgb(",", ",", ",")"])),(new F).Ya([(255-c.l.Db|0)*y|0,c.l.Db*y|0,c.l.Eb]));a.fillStyle=y;a.fillRect(c.l.Db,c.l.Eb,1,1);w=1+w|0}}}(a,b,c,e),50)}Xa.prototype.main=function(a){Ya(a)};Xa.prototype.a=new x({$g:0},!1,"example.ScalaJSExample$",B,{$g:1,b:1});var hb=void 0;function bb(){hb||(hb=(new Xa).c());return hb}ba.example=ba.example||{};ba.example.ScalaJSExample=bb;function Da(){this.Pb=null}Da.prototype=new A;
     

    @@ -621,7 +671,7 @@ var g = ((((255 - ScalaJS.as.Lexample_Point(p$1.elem$1).x$1) | 0) * height) | 0)

    This means you can develop and debug using fastOptJS, and only spend the extra time (and increased debugging-difficulty) on the fullOptJS version just as you're going to publish it, with the assurance that although the code is much more compact, its behavior will not change.

    -

    Blob Size

    +

    Blob Size

    Even the fully-optimized version of our toy Scala.js app are pretty large. There are some factors that mitigate the large size of these executables:

    @@ -644,7 +694,7 @@ var g = ((((255 - ScalaJS.as.Lexample_Point(p$1.elem$1).x$1) | 0) * height) | 0)

    More advanced users would want to integrate them into their build process or serve them from a web server, all of which is entirely possible. You just need to run the Scala.js compiler and place the output .js file somewhere your web server can pick it up, e.g. in some static-resource folder. We cover an example setup of this with a Scala webserver in our chapter Integrating Client-Server.

    -

    Recap

    +

    Recap

    If you've made it this far, you've downloaded, made modifications to, and published a toy Scala.js application. At the same time, we've gone over many of the key concepts in the Scala.js development process: @@ -683,7 +733,7 @@ var g = ((((255 - ScalaJS.as.Lexample_Point(p$1.elem$1).x$1) | 0) * height) | 0) When you're done poking around our toy web application, read on to the next chapter, where we will explore making something more meaty using the Scala.js toolchain!

    -

    Making a Canvas App


    +

    Making a Canvas App


    By this point, you've already cloned and got your hands dirty fiddling around with the toy workbench-example-app. You have your editor set up, SBT installed, and have published the example application in a way you can host online for other people to see. Maybe you've even made some changes to the application to see what happens. Hopefully you're curious, and want to learn more. @@ -702,12 +752,12 @@ var g = ((((255 - ScalaJS.as.Lexample_Point(p$1.elem$1).x$1) | 0) * height) | 0)

    In general, while the previous chapter was mostly set-up and exploring the Scala.js project, this chapter will walk you through actually writing a non-trivial, self-contained Scala.js application. Throughout this chapter, we will only be making modifications to ScalaJSExample.scala; the rest of the project will remain unchanged.

    -

    Making a Sketchpad using Mouse Input

    +

    Making a Sketchpad using Mouse Input

    - To begin with, lets remove all the existing stuff in our .scala file and leave only the object and the main method. Let's start off with some necessary boilerplate: + To begin with, lets remove all the existing stuff in our .scala file and leave only the object and the main method. Let's start off with some necessary boilerplate:

    -
    /*setup*/
    +  
    /*setup*/
     val renderer = canvas.getContext("2d")
                          .asInstanceOf[dom.CanvasRenderingContext2D]
     
    @@ -715,7 +765,7 @@ canvas.width = canvas.parentElement.clientWidth
     canvas.height = canvas.parentElement.clientHeight
     
     renderer.fillStyle = "#f8f8f8"
    -renderer.fillRect(0, 0, canvas.width, canvas.height)
    +renderer.fillRect(0, 0, canvas.width, canvas.height)

    As described earlier, this code uses the document.getElementById function to fish out the canvas element that we interested in from the DOM. It then gets a rendering context from that canvas, and sets the height and width of the canvas to completely fill its containing element. Lastly, it fills out the canvas light-gray, so that we can see it on the page. @@ -725,7 +775,7 @@ renderer.fillRect(0, 0, canvas.width, canvas.height)

    @@ -752,14 +802,14 @@ canvas.onmousemove = { This code sets up the mousedown and mouseup events to keep track of whether or not the mouse has currently been clicked. It then draws black squares any time you move the mouse while the button is down. This lets you basically click-and-drag to draw pictures on the canvas. Try it out!

    - In general, you have access to all the DOM APIs through the dom package as well as through Javascript objects such as the html.Canvas. Setting the onmouseXXX callbacks is just one way of interacting with the DOM. With Scala.js, you also get a very handy autocomplete in the editor, which you can use to browse the various other APIs that are available for use: + In general, you have access to all the DOM APIs through the dom package as well as through Javascript objects such as the html.Canvas. Setting the onmouseXXX callbacks is just one way of interacting with the DOM. With Scala.js, you also get a very handy autocomplete in the editor, which you can use to browse the various other APIs that are available for use:

    Apart from mouse events, keyboard events, scroll events, input events, etc. are all usable from Scala.js as you'd expect. If you have problems getting this to work, feel free to click on the link icon below the code snippet to see what the full code for the example looks like

    -

    Making a Clock using setInterval

    +

    Making a Clock using setInterval

    You've already seen this in the previous example, but WindowTimers.setInterval can be used to schedule recurring, periodic events in your program. Common use cases include running the event loop for a game, making smooth animations, and other tasks of that sort which require some work to happen over a period of time. @@ -767,7 +817,7 @@ canvas.onmousemove = {

    Again, we need roughly the same boilerplate as just now to set up the canvas:

    -
    /*setup*/
    +  
    /*setup*/
     val renderer = canvas.getContext("2d")
                          .asInstanceOf[dom.CanvasRenderingContext2D]
     
    @@ -784,17 +834,17 @@ renderer.fillStyle = gradient
     //renderer.fillStyle = "black"
     
     renderer.textAlign = "center"
    -renderer.textBaseline = "middle"
    +renderer.textBaseline = "middle"

    - The only thing unusual here is that I'm going to create a linearGradient in order to make the stopwatch look pretty. This is by no means necessary, and you could simply make the fillStyle "black" if you want to keep things simple. + The only thing unusual here is that I'm going to create a linearGradient in order to make the stopwatch look pretty. This is by no means necessary, and you could simply make the fillStyle "black" if you want to keep things simple.

    Once that's done, it's only a few lines of code to set up a nice, live clock:

    -
    /*code*/
    +      
    /*code*/
     def render() = {
       val date = new js.Date()
       renderer.clearRect(
    @@ -812,15 +862,15 @@ def render() = {
         canvas.height / 2
       )
     }
    -dom.setInterval(render _, 1000)
    +dom.setInterval(render _, 1000)

    - As you can see, we're using more Canvas APIs, in this case dealing with rendering text on the canvas. Another thing we're using is the Javascript Date class, in Scala.js under the full name scala.scalajs.js.Date, here imported as js.Date. Again, click on the link icon to view the full-code if you're having trouble here. + As you can see, we're using more Canvas APIs, in this case dealing with rendering text on the canvas. Another thing we're using is the Javascript Date class, in Scala.js under the full name scala.scalajs.js.Date, here imported as js.Date. Again, click on the link icon to view the full-code if you're having trouble here.

    -

    Tying it together: Flappy Box

    +

    Tying it together: Flappy Box

    You've just seen two examples of how to use Scala.js, together with the Javascript DOM APIs, to make simple applications. However, we've only used the "Scala" in Scala.js in the most rudimentary fashion: setting a few primitives here and there, defining some methods, mainly just gluing together a few Javascript APIs @@ -843,8 +893,8 @@ dom.setInterval(render _, 1000)Setting Up the Canvas -

    /*setup*/
    +  

    Setting Up the Canvas

    +
    /*setup*/
     val renderer = canvas.getContext("2d")
                          .asInstanceOf[dom.CanvasRenderingContext2D]
     
    @@ -853,16 +903,16 @@ canvas.height = 400
     
     renderer.font = "50px sans-serif"
     renderer.textAlign = "center"
    -renderer.textBaseline = "middle"
    +renderer.textBaseline = "middle"

    - This section of the code is peripherally necessary, but not core to the implementation or logic of Flappy Box. We see the same canvas/renderer logic we've seen in all our examples, along with some logic to make the canvas a reasonable size, and some configuration of how we will render text to the canvas. + This section of the code is peripherally necessary, but not core to the implementation or logic of Flappy Box. We see the same canvas/renderer logic we've seen in all our examples, along with some logic to make the canvas a reasonable size, and some configuration of how we will render text to the canvas.

    In general, code like this will usually end up being necessary in a Scala.js program: the Javascript APIs that the browser provides to do things often ends up being somewhat roundabout and verbose. It's somewhat annoying to have to do for a small program such as this one, but in a larger application, the cost is both spread out over thousands of lines of code and also typically hidden away in helper functions, so the verbosity and non-idiomatic-scala-ness doesn't bother you much.

    -

    Defining our State

    -
    /*variables*/
    +  

    Defining our State

    +
    /*variables*/
     val obstacleGap = 200 // Gap between the approaching obstacles
     val holeSize = 50     // Size of the hole in each obstacle you must go through
     val gravity = 0.1     // Y acceleration of the player
    @@ -878,7 +928,7 @@ var frame = -50
     // List of each obstacle, storing only the Y position of the hole.
     // The X position of the obstacle is calculated by its position in the
     // queue and in the current frame.
    -val obstacles = collection.mutable.Queue.empty[Int]
    +val obstacles = collection.mutable.Queue.empty[Int]

    This is where we start defining things that are relevant to Flappy Box. There are roughly two groups of values here: immutable constants in the top group, and mutable variables in the bottom. The rough meaning of each variable is documented in the comments, and we'll see exactly how we use them later. @@ -886,8 +936,8 @@ val obstacles = collection.mutable.Queue.empty[Int]collection.mutable.Queue to store the list of obstacles. This is defined in the Scala standard library; in general, all the collections in the Scala standard library can be used without issue in Scala.js.

    -

    Game Logic

    -
    def runLive() = {
    +  

    Game Logic

    +
    def runLive() = {
       frame += 2
     
       // Create new obstacles, or kill old ones as necessary
    @@ -929,10 +979,10 @@ val obstacles = collection.mutable.Queue.empty[Int]
    +}

    - The runLive function is the meat of Flappy Box. In it, we + The runLive function is the meat of Flappy Box. In it, we

    - This is the function that handles what happens when you're dead. Essentially, we reset all the mutable variables to their initial state, and just count down the dead counter until it reaches zero and we're considered alive again. + This is the function that handles what happens when you're dead. Essentially, we reset all the mutable variables to their initial state, and just count down the dead counter until it reaches zero and we're considered alive again.

    -

    A Working Product

    -
    def run() = {
    +  

    A Working Product

    +
    def run() = {
       renderer.clearRect(0, 0, canvas.width, canvas.height)
       if (dead > 0) runDead()
       else runLive()
    @@ -973,10 +1023,10 @@ dom.setInterval(run _, 20)
     
     canvas.onclick = (e: dom.MouseEvent) => {
       playerV -= 5
    -}
    +}

    - And finally, this is the code that kicks everything off: we define the run function to swap between runLive and runDead, register an onclick handler to make the player jump by tweaking his velocity, and we call WindowTimers.setInterval to run the run function every 20 milliseconds. + And finally, this is the code that kicks everything off: we define the run function to swap between runLive and runDead, register an onclick handler to make the player jump by tweaking his velocity, and we call WindowTimers.setInterval to run the run function every 20 milliseconds.

    At almost 100 lines of code, this is quite a meaty example! Nonetheless, when all is said and done, you will find that the example actually works! Try it out! @@ -984,41 +1034,41 @@ canvas.onclick = (e: dom.MouseEvent) => {

    -

    Canvas Recap

    +

    Canvas Recap

    We've now gone through the workings of building a handful of toy applications using Scala.js. What have we learnt in the process?

    -

    Development Speed

    +

    Development Speed

    We've by now written a good chunk of Scala.js code, and perhaps debugged some mysterious errors, and tried some new things. One thing you've probably noticed is the efficiency of the process: you make a change in your editor, the browser reloads itself, and life goes on. There is a compile cycle, but after a few runs the compiler warms up and the compilation cycle drops to less than a second.

    Apart from the compilation/reload speed, you've probably noticed the benefit of tooling around Scala.js. Unlike Javascript editors, your existing Scala IDEs like IntelliJ or Eclipse can give very useful help when you're working with Scala.js. Autocomplete, error-highlighting, jump-to-definition, and a myriad other modern conveniences that are missing when working in dynamically-typed languages are present when working in Scala.js. This makes the code much less mysterious: you're no longer trying to guess what methods a value has, or what a method returns: it's all laid out in front of you in plain sight.

    -

    Full Scala

    +

    Full Scala

    All of the examples so far have been very self-contained: they do not touch the HTML DOM, they do not make Ajax calls, or try to access web services. They don't push the limits of the browser's API.

    Nevertheless, these examples have exercised a good amount of the Scala language. List comprehensions, collections, the math library, and more. In general, most of the Scala standard library works under Scala.js, as well as a large number of third-party libraries. Unlike many other compile-to-Javascript languages out there, this isn't a language-that-looks-like-Scala: it is Scala through and through, with a tiny number of semantic differences.

    -

    Seamless Javascript Interop

    +

    Seamless Javascript Interop

    Even if we take some time to read through the code we've written, it is not immediately obvious which bits of code are Scala and which bits are Javascript! It all kind of meshes together, for example if we take the Flappy Box source code:

    • - obstacles is a Scala mutable.Queue, as we defined it earlier, and all the methods on it are Scala method calls
    • + obstacles is a Scala mutable.Queue, as we defined it earlier, and all the methods on it are Scala method calls
    • - renderer is a Javascript CanvasRenderingContext2D, and all the methods on it are Javascript method calls directly on the Javascript object
    • + renderer is a Javascript CanvasRenderingContext2D, and all the methods on it are Javascript method calls directly on the Javascript object
    • - frame is a Scala Int, and obeys Scala semantics, though it is implemented as a Javascript Number under the hood.
    • + frame is a Scala Int, and obeys Scala semantics, though it is implemented as a Javascript Number under the hood.
    • - playerY and playerV are Scala Doubles, implemented directly as Javascript Numbers + playerY and playerV are Scala Doubles, implemented directly as Javascript Numbers

    This reveals something pretty interesting about Scala.js: even though Scala at-first-glance is a very different language from Javascript, the interoperation with Javascript is so seamless that you can't even tell from the code which values/methods are defined in Scala and which values/methods come from Javascript!

    - These two classes of values/methods are treated very differently by the compiler when it comes to emitting the executable Javascript blob, but the compiler does not need extra syntax telling it which things belong to Scala and which to Javascript: the types are sufficient. renderer, for example is of type CanvasRenderingContext2D which is a subtype of scalajs.js.Object, indicating to the compiler that it needs special treatment. Primitives like Doubles and Ints have similar treatment + These two classes of values/methods are treated very differently by the compiler when it comes to emitting the executable Javascript blob, but the compiler does not need extra syntax telling it which things belong to Scala and which to Javascript: the types are sufficient. renderer, for example is of type CanvasRenderingContext2D which is a subtype of scalajs.js.Object, indicating to the compiler that it needs special treatment. Primitives like Doubles and Ints have similar treatment

    Overall, this seamless mix of Scala and Javascript values/methods/functions is a common theme in Scala.js applications, so you should expect to see more of it in later chapters of the book. @@ -1042,7 +1092,7 @@ canvas.onclick = (e: dom.MouseEvent) => { By this point you've some experience building stand-alone, single-canvas Scala.js applications, which has hopefully given you a feel for how Scala.js works. The problem is that few web applications satisfy the criteria of being stand-alone single-page canvas applications! Most web applications need to deal with the DOM of the HTML page, need to fetch data from web services, and generally need to do a lot of other messy things. We'll go into that in the next chapter

    -

    Interactive Web Pages


    +

    Interactive Web Pages


    @@ -1053,14 +1103,14 @@ canvas.onclick = (e: dom.MouseEvent) => {

    -

    Hello World: HTML

    +

    Hello World: HTML

    - The most basic way of building interactive web pages using Scala.js is to use the Javascript APIs to blat HTML strings directly into some container <div> or <body>. This approach works, as the following code snippet demonstrates: + The most basic way of building interactive web pages using Scala.js is to use the Javascript APIs to blat HTML strings directly into some container <div> or <body>. This approach works, as the following code snippet demonstrates:

    -
    package webpage
    +      
    package webpage
     import org.scalajs.dom
     import dom.html
     import scalajs.js.annotation.JSExport
    @@ -1079,38 +1129,38 @@ object HelloWorld0 extends{
         </div>
         """
       }
    -}
    +}

    - Remember that we're now requiring a html.Div instead of a html.Canvas to be passed in when the Javascript calls webpage.HelloWorld0().main(...). If you're coming to this point from the previous chapter, you'll need to update the on-page Javascript's document.getElementById to pick a <div> rather than the <canvas> we were using in the previous chapter. + Remember that we're now requiring a html.Div instead of a html.Canvas to be passed in when the Javascript calls webpage.HelloWorld0().main(...). If you're coming to this point from the previous chapter, you'll need to update the on-page Javascript's document.getElementById to pick a <div> rather than the <canvas> we were using in the previous chapter.

    This approach works, as the above example shows, but has a couple of disadvantages:

    • - It is untyped: it is easy to accidentally mistype something, and result in malformed HTML. A typo such as <dvi> would go un-noticed at build-time. Depending on where the typo happens, it could go un-noticed until the application is deployed, causing subtle bugs that only get resolved much later.
    • + It is untyped: it is easy to accidentally mistype something, and result in malformed HTML. A typo such as <dvi> would go un-noticed at build-time. Depending on where the typo happens, it could go un-noticed until the application is deployed, causing subtle bugs that only get resolved much later.
    • - It is insecure: Cross-site Scripting is a real thing, and it is easy to forget to escape the values you are putting into your HTML strings. Above they're constants like "dog", but if they're user-defined, you may not notice there is a problem until something like "<script>...</script>" sneaks through and your users' accounts & data is compromised. + It is insecure: Cross-site Scripting is a real thing, and it is easy to forget to escape the values you are putting into your HTML strings. Above they're constants like "dog", but if they're user-defined, you may not notice there is a problem until something like "<script>...</script>" sneaks through and your users' accounts & data is compromised.

    There are more, but we won't go deep into the intricacies of these problems. Suffice to say it makes mistakes easy to make and hard to catch, and we have something better...

    -

    Scalatags

    +

    Scalatags

    Scalatags is a cross-platform Scala.js/Scala-JVM library that is designed to generate HTML. To use Scalatags, you need to add it as a dependency to your Scala.js SBT project, in the build.sbt file:

    -
    libraryDependencies += "com.lihaoyi" %%% "scalatags" % "0.4.6"
    +
    libraryDependencies += "com.lihaoyi" %%% "scalatags" % "0.4.6"

    With that, the above snippet of code re-written using Scalatags looks as follows:

    -
    package webpage
    +      
    package webpage
     import org.scalajs.dom
     import dom.html
     import scalajs.js.annotation.JSExport
    @@ -1131,21 +1181,21 @@ object HelloWorld1 extends{
           ).render
         )
       }
    -}
    +}

    - Scalatags has some nice advantages over plain HTML: it's type-safe, so typos like dvi get caught at compile-time. It's also secure, such that you don't need to worry about script-tags in strings or similar. The Scalatags Readme elaborates on these points and other advantages. As you can see, it takes just 1 import at the top of the file to bring it in scope, and then you can use all of Scalatags' functionality. + Scalatags has some nice advantages over plain HTML: it's type-safe, so typos like dvi get caught at compile-time. It's also secure, such that you don't need to worry about script-tags in strings or similar. The Scalatags Readme elaborates on these points and other advantages. As you can see, it takes just 1 import at the top of the file to bring it in scope, and then you can use all of Scalatags' functionality.

    The Scalatags github page has comprehensive documentation on how to express all manner of HTML fragments using Scalatags, so anyone who's familiar with how HTML works can quickly get up to speed. Instead of a detailed listing, we'll walk through some interactive examples to show Scalatags in action!

    -

    User Input

    +

    User Input

    -
    val box = input(
    +        
    val box = input(
       `type`:="text",
       placeholder:="Type here!"
     ).render
    @@ -1167,51 +1217,51 @@ target.appendChild(
         div(box),
         div(output)
       ).render
    -)
    +)

    - In Scalatags, you build up fragments of type Frag using functions like div, h1, etc., and call .render on it to turn it into a real Element. Different fragments render to different things: e.g. input.render gives you a html.Input, span.render gives you a html.Span. You can then access the properties of these elements: adding callbacks, checking their value, anything you want. + In Scalatags, you build up fragments of type Frag using functions like div, h1, etc., and call .render on it to turn it into a real Element. Different fragments render to different things: e.g. input.render gives you a html.Input, span.render gives you a html.Span. You can then access the properties of these elements: adding callbacks, checking their value, anything you want.

    - In this example, we render and input element and a span, wire up the input to set the value of the span whenever you press a key in the input, and then stuff both of them into a larger HTML fragment that forms the contents of our target element. + In this example, we render and input element and a span, wire up the input to set the value of the span whenever you press a key in the input, and then stuff both of them into a larger HTML fragment that forms the contents of our target element.

    -

    Re-rendering

    +

    Re-rendering

    Let's look at a slightly longer example. While above we spliced small snippets of text into the DOM, here we are going to re-render entire sections of HTML! The goal of this little exercise is to make a filtering search-box: starting from a default list of items, narrow it down as the user enters text into the box.

    To begin with, let's define our list of items: Fruits!

    -
    val listings = Seq(
    +    
    val listings = Seq(
       "Apple", "Apricot", "Banana", "Cherry",
       "Mango", "Mangosteen", "Mandarin",
       "Grape", "Grapefruit", "Guava"
    -)
    +)

    - Next, let's think about how we want to render these fruits. One natural way would be as a list, which in HTML is represented by a <ul> with <li>s inside of it if we wanted the list to be unordered. We'll make it a def, because we know up-front we're going to need to re-render this listing as the search query changes. Lastly, we know we want 1 list item for each fruit, but only if the fruit starts with the search query. + Next, let's think about how we want to render these fruits. One natural way would be as a list, which in HTML is represented by a <ul> with <li>s inside of it if we wanted the list to be unordered. We'll make it a def, because we know up-front we're going to need to re-render this listing as the search query changes. Lastly, we know we want 1 list item for each fruit, but only if the fruit starts with the search query.

    -
    def renderListings = ul(
    +    
    def renderListings = ul(
       for {
         fruit <- listings
         if fruit.toLowerCase.startsWith(
           box.value.toLowerCase
         )
       } yield li(fruit)
    -).render
    +).render

    - Using a for-loop with a filter inside the Scalatags fragment is just normal Scala, since you can nest arbitrary Scala expressions inside a Scalatags snippet. In this case, we're converting both the fruit and the search query to lower case so we can compare them case-insensitively. + Using a for-loop with a filter inside the Scalatags fragment is just normal Scala, since you can nest arbitrary Scala expressions inside a Scalatags snippet. In this case, we're converting both the fruit and the search query to lower case so we can compare them case-insensitively.

    Lastly, we just need to define the input box and output-container (as we did earlier), set the onkeyup event handler, and place it in a larger fragment, and then into our target:

    -
    val output = div(renderListings).render
    +        
    val output = div(renderListings).render
     
     box.onkeyup = (e: dom.Event) => {
       output.innerHTML = ""
    @@ -1228,17 +1278,17 @@ target.appendChild(
         div(box),
         output
       ).render
    -)
    +)

    - And there you have it! A working search box. This is a relatively self-contained example: all the items its searching are available locally, no Ajax calls, and there's no fancy handling of the searched items. If we want to, for example, highlight the matched section of each fruit's name, we can modify the def renderListings call to do so: + And there you have it! A working search box. This is a relatively self-contained example: all the items its searching are available locally, no Ajax calls, and there's no fancy handling of the searched items. If we want to, for example, highlight the matched section of each fruit's name, we can modify the def renderListings call to do so:

    -
    def renderListings = ul(
    +        
    def renderListings = ul(
       for {
         fruit <- listings
         if fruit.toLowerCase.startsWith(
    @@ -1256,13 +1306,13 @@ target.appendChild(
           last
         )
       }
    -).render
    +).render

    - Here, instead of sticking the name of the matched fruits directly into the li, we instead first split off the part which matches the query, and then highlght the first section yellow. Easy! + Here, instead of sticking the name of the matched fruits directly into the li, we instead first split off the part which matches the query, and then highlght the first section yellow. Easy!


    @@ -1275,20 +1325,20 @@ target.appendChild(
  • It's composable! You can easily define fragments and assign them to variables, to be used later. You can break apart large Scalatags fragments the same way you break apart normal code, avoiding the huge monolithic HTML templates that are common in other templating systems.
  • - It's Scala! You have the full power of the Scala language to write your fragments. No need to learn special syntax/cases for conditionals or repetitions: you can use plain-old-Scala if-elses, for-loops, etc. + It's Scala! You have the full power of the Scala language to write your fragments. No need to learn special syntax/cases for conditionals or repetitions: you can use plain-old-Scala if-elses, for-loops, etc.
  • Now that you've gotten a quick overview of the kinds of things you can do with Scalatags, let's move on to the next section of our hands-on tutorial...

    -

    Using Web Services

    +

    Using Web Services

    One half of the web application faces forwards towards the user, managing and rendering HTML or Canvas for the user to view and interact with. Another half faces backwards, talking to various web-services or databases which turn the application from a standalone-widget into part of a greater whole. We've already seen how to make the front half, let's now talk about working with the back half.

    -

    Raw Javascript

    +

    Raw Javascript

    -
    val xhr = new dom.XMLHttpRequest()
    +        
    val xhr = new dom.XMLHttpRequest()
     xhr.open("GET",
       "http://api.openweathermap.org/" +
       "data/2.5/weather?q=Singapore"
    @@ -1300,19 +1350,19 @@ xhr.onload = (e: dom.Event) => {
         )
       }
     }
    -xhr.send()
    +xhr.send()

    - The above snippet of code uses the raw Javascript Ajax API in order to make a request to openweathermap.org, to get the weather data for the city of Singapore as a JSON blob. The part of the API that we'll be using is documented here, and if you're interested you can read all about the various options that they provide. For now, we're unceremoniously dumping it in a pre so you can see the raw response data. + The above snippet of code uses the raw Javascript Ajax API in order to make a request to openweathermap.org, to get the weather data for the city of Singapore as a JSON blob. The part of the API that we'll be using is documented here, and if you're interested you can read all about the various options that they provide. For now, we're unceremoniously dumping it in a pre so you can see the raw response data.

    As you can see, using the raw Javascript API to make the Ajax call looks almost identical to actually doing this in Javascript, shown below:

    -
    var xhr = new XMLHttpRequest()
    +        
    var xhr = new XMLHttpRequest()
     
     xhr.open("GET",
         "http://api.openweathermap.org/data/" +
    @@ -1326,7 +1376,7 @@ xhr.onload = function (e) {
             target.appendChild(pre);
         }
     };
    -xhr.send();
    +xhr.send();
    @@ -1336,23 +1386,23 @@ xhr.send();
    vals for immutable data v.s. mutable vars.
  • + vals for immutable data v.s. mutable vars.
  • - => v.s. function to define the callback.
  • + => v.s. function to define the callback.
  • - Scalatags' pre v.s. document.createElement("pre") + Scalatags' pre v.s. document.createElement("pre")
  • Overall, they're pretty close, which is a common theme in Scala.js: using Javascript APIs in Scala.js is often as seamless and easy as using them in Javascript itself, and it often looks almost identical.

    -

    dom.extensions

    +

    dom.extensions

    Although the Javascript XMLHttpRequest API is workable, it's kind of awkward and clunky compared to what you're used to in Scala. We create a half-baked object, set some magic properties, and call a magic function, which all has to be done in the correct order or it won't work.

    With Scala.js, we provide a simpler API that is more clearly functional. First, you need to import some things into scope:

    -
    import dom.html
    +    
    import dom.html
     @JSExport
     object Weather1 extends{
       @JSExport
    @@ -1362,17 +1412,17 @@ object Weather1 extends{
                     .concurrent
                     .JSExecutionContext
                     .Implicits
    -                .runNow
    + .runNow

    - The first import brings in Scala adapters to several DOM APIs, which allow you to use them more idiomatically from Scala. The second brings in an implicit scala.concurrent.ExecutionContext that we'll need to run our asynchronous operations. + The first import brings in Scala adapters to several DOM APIs, which allow you to use them more idiomatically from Scala. The second brings in an implicit scala.concurrent.ExecutionContext that we'll need to run our asynchronous operations.

    Then we need the code itself:

    -
    val url =
    +        
    val url =
       "http://api.openweathermap.org/" +
       "data/2.5/weather?q=Singapore"
     
    @@ -1380,15 +1430,15 @@ Ajax.get(url).onSuccess{ case xhr =>
       target.appendChild(
         pre(xhr.responseText).render
       )
    -}
    +}

    - A single call to Ajax.get(...), with the URL, and we receive a scala.concurrent.Future that we can use to get access to the result when ready. Here we're just using it's onSuccess, but we could use it in a for-comprehension, with Scala Async, or however else we can use normal Futures + A single call to Ajax.get(...), with the URL, and we receive a scala.concurrent.Future that we can use to get access to the result when ready. Here we're just using it's onSuccess, but we could use it in a for-comprehension, with Scala Async, or however else we can use normal Futures

    -

    Parsing the Data

    +

    Parsing the Data

    We've taken the data-dump from OpenWeatherMap in three different ways, but there's still something missing: we need to actually parse the JSON data to make use of it! Most people don't use their JSON data as strings but as structured documents, querying and extracting only the bits we need.

    @@ -1397,7 +1447,7 @@ Ajax.get(url).onSuccess{ case xhr =>

    -
    Ajax.get(url).onSuccess{ case xhr =>
    +        
    Ajax.get(url).onSuccess{ case xhr =>
       target.appendChild(
         pre(
           js.JSON.stringify(
    @@ -1406,20 +1456,20 @@ Ajax.get(url).onSuccess{ case xhr =>
           )
         ).render
       )
    -}
    +}

    - We do this by taking xhr.responseText and putting it through both JSON.parse and JSON.stringify, passing in a space argument to tell JSON.stringify to spread it out nicely. + We do this by taking xhr.responseText and putting it through both JSON.parse and JSON.stringify, passing in a space argument to tell JSON.stringify to spread it out nicely.

    - Now that we've pretty-printed it, we can immediately see what data it contains and which part of the data we want. Let's change the previous example's onSuccess call to extract the weather, temp and humidity and put them in a nice, human-friendly format for us to enjoy: + Now that we've pretty-printed it, we can immediately see what data it contains and which part of the data we want. Let's change the previous example's onSuccess call to extract the weather, temp and humidity and put them in a nice, human-friendly format for us to enjoy:

    -
    Ajax.get(url).onSuccess{ case xhr =>
    +        
    Ajax.get(url).onSuccess{ case xhr =>
       if (xhr.status == 200) {
         val json = js.JSON.parse(
           xhr.responseText
    @@ -1448,22 +1498,22 @@ Ajax.get(url).onSuccess{ case xhr =>
           ).render
         )
       }
    -}
    +}

    - First we parse the incoming response, extract a bunch of values from it, and then stick it in a Scalatags fragment for us to see. Note how we can use the names of the attributes e.g. json.name even though name is a dynamic property which you can't be sure exists: this is because json is of type js.Dynamic, which allows us to refer to arbitrary parameters and methods on the underlying object without type-checking. + First we parse the incoming response, extract a bunch of values from it, and then stick it in a Scalatags fragment for us to see. Note how we can use the names of the attributes e.g. json.name even though name is a dynamic property which you can't be sure exists: this is because json is of type js.Dynamic, which allows us to refer to arbitrary parameters and methods on the underlying object without type-checking.

    - Calls on js.Dynamic resolve directly to javascript property/method references, and will fail at run-time with an exception if used wrongly. This is also why we need to call .toString or .asInstanceOfon the values before use: without these casts, the compiler can't be sure what kind of value is underneath the js.Dynamic type, and so we have to provide it the guarantee that it is what it needs. + Calls on js.Dynamic resolve directly to javascript property/method references, and will fail at run-time with an exception if used wrongly. This is also why we need to call .toString or .asInstanceOfon the values before use: without these casts, the compiler can't be sure what kind of value is underneath the js.Dynamic type, and so we have to provide it the guarantee that it is what it needs.

    -

    Tying it together: Weather Search

    +

    Tying it together: Weather Search

    At this point we've made a small app that allows us to search from a pre-populated list of words, as well as a small app that lets us query a remote web-service to find the weather in Singapore. The natural thing to do is to put these things together to make a app that will let us search from a list of countries and query the weather in any country we desire. Let's start!

    -
    lazy val box = input(
    +  
    lazy val box = input(
       `type`:="text",
       placeholder:="Type here!"
     ).render
    @@ -1488,12 +1538,12 @@ target.appendChild(
         p(box),
         hr, output, hr
       ).render
    -)
    +)

    - This sets up the basics: an input box, an output div, and sets an onkeyup that fetches the weather data each time you hit a key. It then renders all these components and sticks them into the target div. This is basically the same stuff we saw in the early examples, with minor tweaks e.g. adding a maxHeight and overflowY:="scroll" to the output box in case the output is too large. Whenever we enter something in the box, we call the function fetchWeather, which is defined as: + This sets up the basics: an input box, an output div, and sets an onkeyup that fetches the weather data each time you hit a key. It then renders all these components and sticks them into the target div. This is basically the same stuff we saw in the early examples, with minor tweaks e.g. adding a maxHeight and overflowY:="scroll" to the output box in case the output is too large. Whenever we enter something in the box, we call the function fetchWeather, which is defined as:

    -
    def fetchWeather(query: String) = {
    +  
    def fetchWeather(query: String) = {
       val searchUrl =
         "http://api.openweathermap.org/data/" +
         "2.5/find?type=like&mode=json&q=" +
    @@ -1509,15 +1559,15 @@ target.appendChild(
         case _ =>
           output.innerHTML = "No Results"
       }
    -}
    +}

    - This is where the actual data fetching happens. It's relatively straightforward: we make an Ajax.get request, JSON.parse the response, and feed it into the callback function. We're using a slightly different API from earlier: we now have the "type=like" flag, which is documented in the OpenWeatherMap API docs to return multiple results for each city whose name matches your query. + This is where the actual data fetching happens. It's relatively straightforward: we make an Ajax.get request, JSON.parse the response, and feed it into the callback function. We're using a slightly different API from earlier: we now have the "type=like" flag, which is documented in the OpenWeatherMap API docs to return multiple results for each city whose name matches your query.

    - Notably, before we re-render the results, we check whether the query that was passed in is the same value that's in the box. This is to prevent a particularly slow ajax call from finishing out-of-order, potentially stomping over the results of more recent searches. We also check whether the .list: js.Dynamic property we want is an instance of js.Array: if it isn't, it means we don't have any results to show, and we can skip the whole render-output step. + Notably, before we re-render the results, we check whether the query that was passed in is the same value that's in the box. This is to prevent a particularly slow ajax call from finishing out-of-order, potentially stomping over the results of more recent searches. We also check whether the .list: js.Dynamic property we want is an instance of js.Array: if it isn't, it means we don't have any results to show, and we can skip the whole render-output step.

    -
    def showResults(jsonlist: js.Array[js.Dynamic], query: String) = {
    +  
    def showResults(jsonlist: js.Array[js.Dynamic], query: String) = {
       for (json <- jsonlist) {
         val name = json.name.toString
         val country = json.sys.country.toString
    @@ -1543,17 +1593,17 @@ target.appendChild(
         )
       }
     
    -}
    +}

    - Here is the meat and potatoes of this program: every time it gets called with an array of weather-data, we iterate over the cities in that array. It then does a similar sort of data-extraction that we did earlier, putting the results into the output div we defined above, including highlighting. + Here is the meat and potatoes of this program: every time it gets called with an array of weather-data, we iterate over the cities in that array. It then does a similar sort of data-extraction that we did earlier, putting the results into the output div we defined above, including highlighting.

    And that's the working example! Try searching for cities like "Singapore" or "New York" or "San Francisco" and watch as the search narrows as you enter more characters into the text box. Note that the OpenWeatherMap API limits ambiguous searches to about a dozen results, so if a city doesn't turn up in a partial-search, try entering more characters to narrow it down.

    -

    Interactive Web Pages Recap

    +

    Interactive Web Pages Recap

    In this chapter, we've explored the basics of how you can use Scala.js to build interactive web pages. The two main contributions are using Scalatags to render HTML in a concise, safe way, and making Ajax calls to external web services. We combined these two capabilities in a small weather-search app that let a user interactively search for the weather in different cities around the world.

    @@ -1563,15 +1613,15 @@ target.appendChild(

  • Using Scalatags to render HTML fragments, and managing them at runtime with callbacks and getting/setting properties, is really quite nice
  • - Using new dom.XMLHttpRequest to make web requests feels just like the Javascript code to do so
  • + Using new dom.XMLHttpRequest to make web requests feels just like the Javascript code to do so
  • - Using Ajax.get(...) and working with the resultant : Future feels a lot cleaner than directly using the Javascript API + Using Ajax.get(...) and working with the resultant : Future feels a lot cleaner than directly using the Javascript API
  • You're at this point reasonably pro

    -

    The Command Line


    +

    The Command Line


    @@ -1603,22 +1653,22 @@ target.appendChild(

    Now, let's open up your SBT console in your Scala.js app

    -
    >
    +
    >
     

    And let's get started!

    -

    Commands

    +

    Commands

    The most fundamental thing you can do in the Scala.js CLI is to compile your code. Let's go through the various mechanisms of "compiling" things:

    -

    The compile Command

    -
    > compile
    +  

    The compile Command

    +
    > compile
     

    Just as you can compile Scala-JVM projects, you can also compile Scala.js projects. Like compiling Scala-JVM projects, this leaves a bunch of .class files in your target directory. Unlike Scala-JVM projects, this also leaves a bunch of .sjsir files, which correspond to your Scala.js output files:

    -
    classes
    +    
    classes
     └── example
         ├── Point$.class
         ├── Point$.sjsir
    @@ -1633,12 +1683,12 @@ target.appendChild(
         

    However, unlike on Scala-JVM, you cannot directly run the .sjsir files spat out by the Scala.js compiler. These files are an Intermediate Representation, which needs to go through the next step in the compilation pipeline before being turned into Javascript.

    -

    The package Command

    -
    > package
    +

    The package Command

    +
    > package

    Also like on Scala-JVM, Scala.js also supports the package command. This command generates a .jar like it does in Scala-JVM, except this version appends this weird _sjs0.6 suffix.

    -
    target/scala-2.11/
    +    
    target/scala-2.11/
     └── example_sjs0.6_2.11-0.1-SNAPSHOT.jar
     

    @@ -1647,27 +1697,27 @@ target.appendChild(

    Again, unlike Scala-JVM, these .jar files are not directly executable: the .sjsir files need further processing to turn into runnable Javascript. Instead, their sole purpose is to hold bundles of .sjsir files to be published and depended-upon: they can be publishLocaled to be used by other projects on your computer, or publishSigneded to Maven Central, just like any Scala-JVM project.

    -

    The fastOptJS Command

    -
    > fastOptJS
    +

    The fastOptJS Command

    +
    > fastOptJS

    - fastOptJS is a command we've used in earlier chapters. It basically runs the Fast Optimization stage of the compilation pipeline. This results in a moderately-sized executable, which you can then load in the browser with a <script> tag and run. + fastOptJS is a command we've used in earlier chapters. It basically runs the Fast Optimization stage of the compilation pipeline. This results in a moderately-sized executable, which you can then load in the browser with a <script> tag and run.

    This is the first phase which actually results in an executable blob of Javascript. I won't go into much detail about this command: you've used it before, and more details about the particular kind of optimization and how it fits into the large process is available in the chapter on The Compilation Pipeline. Nonetheless, it's fast, produces not-too-huge output code, and is what you typically use for iterative development in the browser.

    -

    The fullOptJS Command

    -
    > fullOptJS
    +

    The fullOptJS Command

    +
    > fullOptJS

    - fullOptJS is another command that we've seen before: it performs an aggressive, somewhat slower Full Optimization pass on the generated Javascript. This results in a much smaller executable Javascript blob, which you can also load via a <script> tag and run.

    + fullOptJS is another command that we've seen before: it performs an aggressive, somewhat slower Full Optimization pass on the generated Javascript. This results in a much smaller executable Javascript blob, which you can also load via a <script> tag and run.

    Again, I won't go into much details, as exactly what this optimization does is described in the chapter on the Compilation Pipeline. This command is somewhat too-slow to be running during iterative development, and is instead typically used just before deployment to minimize the size of the file your users have to download.

    -

    The run Command

    -
    > run
    +

    The run Command

    +
    > run

    - Here's something you haven't seen before: the run command gives you the ability to run a Scala.js program from the command line. This prints its output to standard output (i.e. the terminal). Like Scala-JVM, you need a main method to run to kick off your program. Unlike Scala-JVM, the main method is marked on an object which extends scala.scalajs.js.JSApp, e.g. + Here's something you haven't seen before: the run command gives you the ability to run a Scala.js program from the command line. This prints its output to standard output (i.e. the terminal). Like Scala-JVM, you need a main method to run to kick off your program. Unlike Scala-JVM, the main method is marked on an object which extends scala.scalajs.js.JSApp, e.g.

    -
    // src/main/scala/RunMe.scala
    +    
    // src/main/scala/RunMe.scala
     object RunMe extends scala.scalajs.js.JSApp{
       def main(): Unit = {
         println("Hello World!")
    @@ -1678,22 +1728,22 @@ object RunMe extends scala.scalajs.js.JSApp{
         

    Running sbt run with the above Scala.js code will print out

    -
    Hello World!
    +    
    Hello World!
     In Scala.js, (1.0).toString is 1!
     

    - This exhibits the weirdness of Double.toString in Scala.js, which is one of the few ways in which Scala.js deviates from Scala-JVM. This also shows us we're really running on Scala.js: on Scala-JVM, (1.0).toString returns "1.0" rather than "1"! + This exhibits the weirdness of Double.toString in Scala.js, which is one of the few ways in which Scala.js deviates from Scala-JVM. This also shows us we're really running on Scala.js: on Scala-JVM, (1.0).toString returns "1.0" rather than "1"!

    One thing you may be wondering is: when you run a Scala.js program in the terminal, how does it execute the output Javascript? What about the DOM? and Ajax calls? Can it access the filesystem? The answer to all these questions is "it depends": it turns out there are multiple ways you can run Scala.js from the command-line, dictated by the stage and the environment.

    - By default, runs are done in the PreLinkStage, which uses the Rhino environment. With the sbt setting jsDependencies += RuntimeDOM, the Scala.js runner will automatically set up env.js in Rhino so that you have access to an emulation of the DOM API. + By default, runs are done in the PreLinkStage, which uses the Rhino environment. With the sbt setting jsDependencies += RuntimeDOM, the Scala.js runner will automatically set up env.js in Rhino so that you have access to an emulation of the DOM API.

    You can enable a different stage, FastOptStage or FullOptStage, with the following sbt command:

    -
    > set scalaJSStage in Global := FastOptStage
    +    
    > set scalaJSStage in Global := FastOptStage
     

    In FastOptStage and FullOptStage, the environment can be one of Node.js or PhantomJS. These JavaScript VMs must be installed separately. @@ -1702,13 +1752,13 @@ In Scala.js, (1.0).toString is 1!

  • By default, Node.js is used.
  • - With the sbt setting jsDependencies += RuntimeDOM, PhantomJS is used instead, so that a headless DOM is available. + With the sbt setting jsDependencies += RuntimeDOM, PhantomJS is used instead, so that a headless DOM is available.
  • Typically, the best way to get started is using Rhino, since it's setup-free, and setting up Node.js or PhantomJS later as necessary. The next two sections elaborate on the differences between these ways of running your code. Check out the later sections on Headless Runtimes and Stages to learn more about the other settings and why you would want to use them.

    -

    The test Command

    -
    > test
    +  

    The test Command

    +
    > test
     

    The sbt test command behaves very similarly to sbt run. It also runs on Rhino, Node.js or PhantomJS, dependending of the stage and the dependency on the DOM.

    @@ -1717,18 +1767,18 @@ In Scala.js, (1.0).toString is 1!

    We won't spend much time talking about sbt test here. Not because it's not important: it most certainly is! Rather, we will be spending a good amount of time setting up tests in the next chapter, so feel free to jump ahead if you want to see an example usage of sbt test.

    -

    Headless Runtimes

    +

    Headless Runtimes

    • Rhino is the default way of running Scala.js applications. The upside of using Rhino is that it is pure-Java, and doesn't need any additional binaries or installation. The downside of using Rhino is that it is slow: maybe a hundred times slower than the alternatives, making it not suitable for running long-running, compute-intensive programs.
    • Node.js, a relatively new Javascript runtime based on Google's V8 Javascript engine, Node.js lets you run your Scala.js application from the command line much faster than in Rhino, with performance that matches that of modern browsers. However, you need to separately install Node.js in order to use it. Node.js does not have DOM or browser-related functionality. You need to set the stage with set scalaJSStage in Global := FastOptStage to run using Node.js.
    • - PhantomJS is a headless Webkit browser. This means that unlike Node.js, PhantomJS provides you with a full DOM and all its APIs to use in your tests, if you wish to e.g. test interactions with the HTML of the web page. On the other hand, it is somewhat slower than Node.js, though still much faster than Rhino. Like Node.js, it needs to be installed separately. You need to set the stage with set scalaJSStage in Global := FastOptStage, as well as setting the jsDependencies += RuntimeDOM flag in your SBT configuration, to use PhantomJS.
    + PhantomJS is a headless Webkit browser. This means that unlike Node.js, PhantomJS provides you with a full DOM and all its APIs to use in your tests, if you wish to e.g. test interactions with the HTML of the web page. On the other hand, it is somewhat slower than Node.js, though still much faster than Rhino. Like Node.js, it needs to be installed separately. You need to set the stage with set scalaJSStage in Global := FastOptStage, as well as setting the jsDependencies += RuntimeDOM flag in your SBT configuration, to use PhantomJS.

    These are your three options to run your Scala.js code via the command-line. Generally, it's easiest to get started with Rhino since it's the default and requires no setup, though you will quickly find it worthwhile to setup Node.js or PhantomJS to speed up your runs and tests.

    -

    Stages

    +

    Stages

    Let us recap the three different stages of execution, and what they mean.

    @@ -1745,7 +1795,7 @@ In Scala.js, (1.0).toString is 1!

    Hopefully by this point you more-or-less know your way around the Scala.js command-line tools. As mentioned earlier, command line tools make it much easier to run a bunch of Scala.js code, e.g. unit tests, without having to muck around with HTML pages or refreshing the browser. That will come in handy soon, as we're next going to learn to publish a standalone, distributable Scala.js module. And what's a module without tests...

    -

    Cross Publishing Libraries


    +

    Cross Publishing Libraries


    We've spent several chapters exploring the experience of making web apps using Scala.js, but any large application (web or not!) likely relies on a host of libraries in order to implement large chunks of its functionality. Ideally these libraries would be re-usable, and can be shared among different projects, teams or even companies. @@ -1754,12 +1804,12 @@ In Scala.js, (1.0).toString is 1! Not all code is developed in the browser. Maybe you want to run simple snippets of Scala.js which don't interact with the browser at all, and having to keep a browser open is an overkill. Maybe you want to write unit tests for your browser-destined code, so you can verify that it works without firing up Chrome. Maybe it's not a simple script but a re-distributable library, and you want to run the same command-line unit tests on both Scala.js and Scala-JVM to verify that the behavior is identical. This chapter will go through all these cases.

    -

    A Simple Cross-Built Library

    +

    A Simple Cross-Built Library

    As always, we will start with an example: in this case a toy library whose sole purpose in life is to take a series of timestamps (milliseconds UTC) and format them into a single, newline-delimited string. This is what the project layout looks like:

    -
    $ tree
    +  
    $ tree
     .
     ├── build.sbt
     ├── project/build.sbt
    @@ -1771,17 +1821,17 @@ In Scala.js, (1.0).toString is 1!
       

    As you can see, we have three main places where code lives: js/ is where Scala-JS specific code lives, jvm/ for Scala-JVM specific code, and shared/ for code that is common between both platforms. Depending on your project, you may have more or less code in the shared/ folder: a mostly-the-same cross-compiled module may have most or all its code in shared/ while a client-server web application would have lots of client/server js/jvm-specific code.

    -

    Build Configuration

    +

    Build Configuration

    From the bash shell in the project root. Let's take a look at the various files that make up this project. First, the build.sbt files:

    -
    /*project/build.sbt*/
    -addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.0")
    +
    /*project/build.sbt*/
    +addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.0")

    The project/build.sbt file is uneventful: it simply includes the Scala.js SBT plugin. However, the build.sbt file is a bit more interesting:

    -
    
    +    
    
     val library = crossProject.settings(
       libraryDependencies += "com.lihaoyi" %%% "utest" % "0.3.0",
       testFrameworks += new TestFramework("utest.runner.Framework")
    @@ -1793,33 +1843,33 @@ val library = crossProject.settings(
     
     lazy val js = library.js
     
    -lazy val jvm = library.jvm
    +lazy val jvm = library.jvm

    - Unlike the equivalent build.sbt files you saw in earlier chapters, this does not simply enable the ScalaJSPlugin to the root project. Rather, it uses the crossProject function provided by the Scala.js plugin to set up two projects: one in the app/js/ folder and one in the jvm/ folder. We also have places to put settings related to either the JS side, the JVM side, or both. In this case, we add a dependency on uTest, which we will use as the test framework for our library. Note how we use triple %%% to indicate that we're using the platform-specific version of uTest, such that the Scala.js or Scala-JVM version will be properly pulled in when compiling for each platform. + Unlike the equivalent build.sbt files you saw in earlier chapters, this does not simply enable the ScalaJSPlugin to the root project. Rather, it uses the crossProject function provided by the Scala.js plugin to set up two projects: one in the app/js/ folder and one in the jvm/ folder. We also have places to put settings related to either the JS side, the JVM side, or both. In this case, we add a dependency on uTest, which we will use as the test framework for our library. Note how we use triple %%% to indicate that we're using the platform-specific version of uTest, such that the Scala.js or Scala-JVM version will be properly pulled in when compiling for each platform.

    -

    Source Files

    +

    Source Files

    Now, let's look at the contents of the .scala files that make up the meat of this project:

    -
    // library/shared/src/main/scala/simple/Simple.scala
    +    
    // library/shared/src/main/scala/simple/Simple.scala
     package simple
     object Simple{
       def formatTimes(timestamps: Seq[Long]): Seq[String] = {
         timestamps.map(Platform.format).map(_.dropRight(5))
       }
    -}
    +}

    - In Simple.scala we have the shared, cross-platform API of our library: a single object with a single method def which does what we want, which can then be used in either Scala.js or Scala-JVM. In general, you can put as much shared logic here as you want: classes, objects, methods, anything that can run on both Javascript and on the JVM. We're chopping off the last 5 characters (the milliseconds) to keep the formatted dates slightly less verbose. + In Simple.scala we have the shared, cross-platform API of our library: a single object with a single method def which does what we want, which can then be used in either Scala.js or Scala-JVM. In general, you can put as much shared logic here as you want: classes, objects, methods, anything that can run on both Javascript and on the JVM. We're chopping off the last 5 characters (the milliseconds) to keep the formatted dates slightly less verbose.

    - However, when it comes to actually formatting the date, we have a problem: Javascript and Java provide different utilities for formatting dates! They both let you format them, but they provide different APIs. Thus, to do the formatting of each individual date, we call out to the Platform.format function, which is implemented twice: once in js/ and once in jvm/: + However, when it comes to actually formatting the date, we have a problem: Javascript and Java provide different utilities for formatting dates! They both let you format them, but they provide different APIs. Thus, to do the formatting of each individual date, we call out to the Platform.format function, which is implemented twice: once in js/ and once in jvm/:

    -
    // library/js/src/main/scala/simple/Platform.scala
    +        
    // library/js/src/main/scala/simple/Platform.scala
     package simple
     import scalajs.js
     
    @@ -1827,10 +1877,10 @@ object Platform{
       def format(ts: Long) = {
         new js.Date(ts).toISOString()
       }
    -}
    +}
    -
    // library/jvm/src/main/scala/simple/Platform.scala
    +        
    // library/jvm/src/main/scala/simple/Platform.scala
     package simple
     import java.text.SimpleDateFormat
     import java.util.TimeZone
    @@ -1843,16 +1893,16 @@ object Platform{
         fmt.setTimeZone(TimeZone.getTimeZone("UTC"))
         fmt.format(new java.util.Date(ts))
       }
    -}
    +}

    - In the js/ version, we are using the Javascript Date object to take the millis and do what we want. In the jvm/ version, we instead use java.text.SimpleDateFormat with a custom formatter (The syntax is defined here). + In the js/ version, we are using the Javascript Date object to take the millis and do what we want. In the jvm/ version, we instead use java.text.SimpleDateFormat with a custom formatter (The syntax is defined here).

    Again, you can put as much platform-specific logic in these files as you want, to account for differences in the available APIs. Maybe you want to use Json.parse for parsing JSON blobs in js/, but Jackson or GSON for parsing them in jvm/.

    -

    Running the Module

    -
    > ;libraryJS/test ;libraryJVM/test
    +  

    Running the Module

    +
    > ;libraryJS/test ;libraryJVM/test
     [info] Compiling 1 Scala source to library/js/target/scala-2.10/test-classes...
     [info] ---------------------------Results---------------------------
     [info] simple.SimpleTest		Success
    @@ -1900,7 +1950,7 @@ object Platform{
         

    Apart from running each sub-project manually as we did above, you can also simply hit test and SBT will run tests for both

    -

    Further Work

    +

    Further Work

    You've by this point set up a basic cross-building Scala.js/Scala-JVM project! If you wish, you can do more things with this project you've set up:

    @@ -1910,12 +1960,12 @@ object Platform{
  • Publish it! Both sbt publishLocal and sbt publishSigned work on this module, for publishing either locally, Maven Central via Sonatype, or Bintray. Running the command bare should be sufficient to publish both the js or jvm projects, or you can also specify which one e.g. jvm/publishLocal to publish only one subproject.
  • - Cross-cross build it! You can use crossScalaVersions in your crossProject to build a library that works across all of {Scala.js, Scala-JVM} X {2.10, 2.11}. Many existing libraries, such as Scalatags or uTest are published like that. + Cross-cross build it! You can use crossScalaVersions in your crossProject to build a library that works across all of {Scala.js, Scala-JVM} X {2.10, 2.11}. Many existing libraries, such as Scalatags or uTest are published like that.
  • Now that you've gotten your code cross-compiling to Scala.js/Scala-JVM, the sky's the limit in what you can do. In general, although a large amount of your Scala-JVM code does deal with files or networks or other Scala-JVM-speciic functionality, in most applications there is a large library of helpers which don't. These could easily be packaged up into a cross-platform library and shared with your front-end Scala.js (or even pure-Javascript!) code.

    -

    Other Testing Libraries

    +

    Other Testing Libraries

    You can also try using a different testing library. While uTest was the first Scala.js testing library, it is definitely not the last! Here are a few alternatives worth trying:

    @@ -1936,7 +1986,7 @@ object Platform{ Note that you cannot use Scalatest or Specs2 in Scala.js. Despite the popularity of those libraries, they depend on too many Java-specific details of Scala-JVM to be easily ported to Scala.js. Thus you'll have to use one of the (relatively new) libraries which supports Scala.js, such as uTest or those above.

    -

    Integrating Client-Server


    +

    Integrating Client-Server


    @@ -1956,11 +2006,11 @@ object Platform{

    -

    A Client-Server Setup

    +

    A Client-Server Setup

    Getting started with client-server integration, let's go with the simplest configuration possible: a Spray server and a Scala.js client. Most of the other web-frameworks (Play, Scalatra, etc.) will have more complex configurations, but the basic mechanism of wiring up Scala.js to your web framework will be the same. Just like our project in Cross Publishing Libraries, our project will look like this:

    -
    $ tree
    +  
    $ tree
     .
     ├── build.sbt
     ├── project/build.sbt
    @@ -1974,7 +2024,7 @@ object Platform{
       

    First, let's do the wiring in build.sbt:

    -
    import NativePackagerKeys._
    +  
    import NativePackagerKeys._
     
     val app = crossProject.settings(
       unmanagedSourceDirectories in Compile +=
    @@ -1999,10 +2049,10 @@ val app = crossProject.settings(
     lazy val appJS = app.js
     lazy val appJVM = app.jvm.settings(
       (resources in Compile) += (fastOptJS in (appJS, Compile)).value.data
    -)
    +)

    - Again, we are using crossProject to define our js/ and jvm/ sub-projects. Both projects share a number of settings: the settings to add Scalatags and uPickle to the build. Note that those two dependencies use the triple %%% instead of the double %% to declare: this means that for each dependency, we will pull in the Scala-JVM or Scala.js version depending on whether it's being used in a Scala.js project. Note also the packageArchetype.java_application setting, which isn't strictly necessary depending on what you want to do with the application, but this example needs it as part of the deployment to Heroku. + Again, we are using crossProject to define our js/ and jvm/ sub-projects. Both projects share a number of settings: the settings to add Scalatags and uPickle to the build. Note that those two dependencies use the triple %%% instead of the double %% to declare: this means that for each dependency, we will pull in the Scala-JVM or Scala.js version depending on whether it's being used in a Scala.js project. Note also the packageArchetype.java_application setting, which isn't strictly necessary depending on what you want to do with the application, but this example needs it as part of the deployment to Heroku.

    The js/ sub-project is uneventful, with a dependency on the by-now-familiar scalajs-dom library. The jvm/ project, on the other hand, is interesting: it contains the dependencies required for us to set up out Spray server, and one additional thing: we add the output of fastOptJS from the client to the resources on the server. This will allow the server to serve the compiled-javascript from our client project from its resources. @@ -2011,7 +2061,7 @@ lazy val appJVM = app.jvm.settings( Next, let's kick off the Spray server in our Scala-JVM main method:

    -
    package simple
    +  
    package simple
     
     import akka.actor.ActorSystem
     import spray.http.{HttpEntity, MediaTypes}
    @@ -2056,15 +2106,15 @@ object Server extends SimpleRoutingApp{
           if f.getName.startsWith(last)
         } yield FileData(f.getName, f.length())
       }
    -}
    +}

    This is a not-very-interesting spray-routing application: we set up a server on localhost:8080, have the root URL serve the main page on GET, and have other GET URLs serve resources. This includes the js-fastopt.js file that is now in our resources because of our build.sbt config earlier! We also add a POST route to allow the client ask the server to list files various directories.

    - The HTML template Page.skeleton is not shown above; I put it in a separate file for neatness: + The HTML template Page.skeleton is not shown above; I put it in a separate file for neatness:

    -
    package simple
    +  
    package simple
     import scalatags.Text.all._
     
     object Page{
    @@ -2084,14 +2134,14 @@ object Page{
             div(id:="contents")
           )
         )
    -}
    +}

    This is a typical Scalatags HTML snippet. Note that since we're serving it directly from the server in Scala code, we do not need to leave a .html file somewhere on the filesystem! We can declare all HTML, including the skeleton of the page, in Scalatags. Otherwise it's the same as what we saw in earlier chapters: A simple HTML page which includes a script tag to run our Scala.js application.

    - Lastly, we'll set up the Scala.js main method, which we are calling in the <script> tag above to kick off the client-side application. + Lastly, we'll set up the Scala.js main method, which we are calling in the <script> tag above to kick off the client-side application.

    -
    package simple
    +  
    package simple
     
     import scalatags.JsDom.all._
     import scalajs.concurrent.JSExecutionContext.Implicits.runNow
    @@ -2127,18 +2177,18 @@ object Client extends{
           ).render
         )
       }
    -}
    +}

    Again this is a simple Scala.js application, not unlike what we saw in earlier chapters. However, there is one difference: earlier, we made our Ajax calls to api.openweathermap.org/.... Here, we're making it to /ajax: the same server the page is served from!

    - You may have noticed in both client and server, we have made reference to a mysterious FileData type which holds the name and size of each file. FileData is defined in the shared/ folder, so it can be accessed from both Scala-JVM and Scala.js: + You may have noticed in both client and server, we have made reference to a mysterious FileData type which holds the name and size of each file. FileData is defined in the shared/ folder, so it can be accessed from both Scala-JVM and Scala.js:

    -
    package simple
    +  
    package simple
     
    -case class FileData(name: String, size: Long)
    +case class FileData(name: String, size: Long)

    Now, if we go to the browser at localhost:8080, we should see our web-page! @@ -2154,105 +2204,105 @@ case class FileData(name: String, size: Long)Heroku server. Feel free to poke around and explore the filesystem on the server, just to convince yourself that this actually works and is not just a mock up.

    -

    Client-Server Reflections

    +

    Client-Server Reflections

    By now you've already set up your first client-server application. However, it might not be immediately clear what we've done and why it's interesting! Here are some points to consider.

    -

    Shared Templating

    +

    Shared Templating

    In both the client code and the server code, we made use of the same Scalatags HTML generation library. This is pretty neat: transferring rendering logic between client and server no longer means an annoying/messy rewrite! You can simply C&P the Scalatags snippet over. That means it's easy if you want to e.g. shift the logic from one side to the other in order to optimize for performance or time-to-load or other things.

    - One thing to take note of is that we're actually using subtly different implementations of Scalatags on both sides: on the server, we're importing from scalatags.Text, while on the client we're using scalatags.JsDom. The Text backend renders directly to Strings, and is available on both Scala-JVM and Scala.js. The JsDom backend, on the other hand, renders to html.Element-s which only exist on Scala.js. Thus while on the client you can do things like attach event listeners to the rendered html.Element objects, or checking their runtime .value, on the server you can't. And that's exactly what you want! + One thing to take note of is that we're actually using subtly different implementations of Scalatags on both sides: on the server, we're importing from scalatags.Text, while on the client we're using scalatags.JsDom. The Text backend renders directly to Strings, and is available on both Scala-JVM and Scala.js. The JsDom backend, on the other hand, renders to html.Element-s which only exist on Scala.js. Thus while on the client you can do things like attach event listeners to the rendered html.Element objects, or checking their runtime .value, on the server you can't. And that's exactly what you want!

    -

    Shared Code

    +

    Shared Code

    - One thing that we skimmed over is the fact that we could easily define our case class FileData(name: String, size: Long) in the shared/ folder, and have it instantly and consistently available on both client and server. This perhaps does not seem so amazing: we've already done many similar things earlier when we were building Cross-platform Modules. Nevertheless, in the context of web development, it is a relatively novel idea to be able to ad-hoc share bits of code between client and server.

    + One thing that we skimmed over is the fact that we could easily define our case class FileData(name: String, size: Long) in the shared/ folder, and have it instantly and consistently available on both client and server. This perhaps does not seem so amazing: we've already done many similar things earlier when we were building Cross-platform Modules. Nevertheless, in the context of web development, it is a relatively novel idea to be able to ad-hoc share bits of code between client and server.

    Sharing code is not limited to class definitions: anything can be shared. Objects, classes, interfaces/traits, functions and algorithms, constants: all of these are things that you will likely want to share at some point or another. Traditionally, people have simply re-implemented the same code twice in two languages, or have resorted to awkward Ajax calls to push the logic to the server. With Scala.js, you no longer need to do so: you can easily, create ad-hoc bits of code which are available on both platforms.

    -

    Boilerplate-free Serialization

    +

    Boilerplate-free Serialization

    The Ajax/RPC layer is one of the more fragile parts of web applications. Often, you have your various Ajax endpoints written once on the server, have a set of routes written to connect those Ajax endpoints to URLs, and client code (traditionally Javascript) made calls to those URLs with "raw" data: basically whatever you wanted, packed in an ad-hoc mix of CSV and JSON and raw-strings.

    - This has always been annoying boilerplate, and Scala.js removes it. With uPickle, you can simply call upickle.write(...) and upickle.read[T](...) to convert your collections, primitives or case-classes to and from JSON. This means you do not need to constantly re-invent different ways of making Ajax calls: you can just fling the data right across the network from client to server and back again. + This has always been annoying boilerplate, and Scala.js removes it. With uPickle, you can simply call upickle.write(...) and upickle.read[T](...) to convert your collections, primitives or case-classes to and from JSON. This means you do not need to constantly re-invent different ways of making Ajax calls: you can just fling the data right across the network from client to server and back again.

    -

    What's Left?

    +

    What's Left?

    We've built a small client-server web application with a Scala.js web-client that makes Ajax calls to a Scala-JVM web-server running on Spray. We performed these Ajax calls using uPickle to serialize the data back and forth, so serializing the arguments and return-value was boilerplate-free and correct.

    However, there is still some amount of duplication in the code. In particular, the definition of the endpoint name "list" is duplicated 4 times:

    -
    path("ajax" / "list"){
    -
    upickle.write(list(e))
    -
    def list(path: String) = {
    -
    def update() = Ajax.post("/ajax/list", inputBox.value).foreach{ xhr =>
    +
    path("ajax" / "list"){
    +
    upickle.write(list(e))
    +
    def list(path: String) = {
    +
    def update() = Ajax.post("/ajax/list", inputBox.value).foreach{ xhr =>

    - Three times on the server and once on the client! What's worse, two of the appearances of "list" are in string literals, which are not checked by the compiler to match up with themselves or the name of the method list. Apart from this, there is one other piece of duplication that is unchecked: the type being returned from list (Seq[FileData]) is being repeated on the client in upickle.read[Seq[FileData]] in order to de-serialize the serialized data. This leaves three opportunities for error wide-open: + Three times on the server and once on the client! What's worse, two of the appearances of "list" are in string literals, which are not checked by the compiler to match up with themselves or the name of the method list. Apart from this, there is one other piece of duplication that is unchecked: the type being returned from list (Seq[FileData]) is being repeated on the client in upickle.read[Seq[FileData]] in order to de-serialize the serialized data. This leaves three opportunities for error wide-open:

    • - You could change the string literals "list" and forget to change the method-name list, thus confusing future maintainers of the code.
    • + You could change the string literals "list" and forget to change the method-name list, thus confusing future maintainers of the code.
    • - You could change one of literal "list"s but forget to change the other, thus causing an error at run-time (e.g. a 404 NOT FOUND response)
    • + You could change one of literal "list"s but forget to change the other, thus causing an error at run-time (e.g. a 404 NOT FOUND response)
    • - You could update the return type of the list method and forget to update the upickle.read deserialization call on the client, resulting in a deserialization failure at runtime. + You could update the return type of the list method and forget to update the upickle.read deserialization call on the client, resulting in a deserialization failure at runtime.

    Neither of these scenarios is great! Although we've already made great progress in making our client-server application type-safe (via Scala.js on the client) and DRY (via shared code in shared/) we still have this tiny bit of annoying, un-checked duplication and danger lurking in the code-base. The basic problem is that what is normally called the "routing layer" in the web application is still unsafe, and so these silly errors can go un-caught and blow up on unsuspecting developers at run-time. Let's see how we can fix it.

    -

    Autowire

    +

    Autowire

    Autowire is a library that turns your request routing layer from a fragile, hand-crafted mess into a solid, type-checked, boilerplate-free experience. Autowire basically turns what was previously a stringly-typed, hand-crafted Ajax call and route:

    -
    def update() = Ajax.post("/ajax/list", inputBox.value).foreach{ xhr =>
    +
    def update() = Ajax.post("/ajax/list", inputBox.value).foreach{ xhr =>

    Into a safe, type-checked function call:

    -
    def update() = Ajaxer[Api].list(inputBox.value).call().foreach{ data =>
    +
    def update() = Ajaxer[Api].list(inputBox.value).call().foreach{ data =>

    Let's see how we can do that.

    -

    Setting up Autowire

    +

    Setting up Autowire

    To begin with, Autowire requires you to provide three things:

    • - An autowire.Server on the Server, set up to feed the incoming request into Autowire's routing logic
    • + An autowire.Server on the Server, set up to feed the incoming request into Autowire's routing logic
    • - An autowire.Client on the Client, set up to take a serialized request and send it across the network to the server.
    • + An autowire.Client on the Client, set up to take a serialized request and send it across the network to the server.
    • - An interface (A Scala trait) which defines the interface between these two + An interface (A Scala trait) which defines the interface between these two

    Let's start with our client-server interface definition

    -
    package simple
    +    
    package simple
     
     case class FileData(name: String, size: Long)
     
     trait Api{
       def list(path: String): Seq[FileData]
    -}
    +}

    - Here, you can see that in addition to sharing the FileData class, we are also creating an Api trait which contains the signature of our list method. The exact name of the trait doesn't matter. We need it to be in shared/ so that the code in both client and server can reference it. + Here, you can see that in addition to sharing the FileData class, we are also creating an Api trait which contains the signature of our list method. The exact name of the trait doesn't matter. We need it to be in shared/ so that the code in both client and server can reference it.

    Next, let's look at modifying our server code to make use of Autowire:

    -
    package simple
    +    
    package simple
     
     import akka.actor.ActorSystem
     import spray.http.{HttpEntity, MediaTypes}
    @@ -2305,12 +2355,12 @@ object Server extends SimpleRoutingApp with Api{
           if f.getName.startsWith(last)
         } yield FileData(f.getName, f.length())
       }
    -}
    +}

    - Now, instead of hard-coding the route "ajax" / "list", we now take in any route matching "ajax" / Segments, feeding the resultant path segments into the Router object: + Now, instead of hard-coding the route "ajax" / "list", we now take in any route matching "ajax" / Segments, feeding the resultant path segments into the Router object:

    -
    path("ajax" / Segments){ s =>
    +    
    path("ajax" / Segments){ s =>
       extract(_.request.entity.asString) { e =>
         complete {
           Router.route[Api](Server)(
    @@ -2321,22 +2371,22 @@ object Server extends SimpleRoutingApp with Api{
           )
         }
       }
    -}
    +}

    - The Router object in turn simply defines how you intend the objects to be serialized and deserialized: + The Router object in turn simply defines how you intend the objects to be serialized and deserialized:

    -
    object Router extends autowire.Server[String, upickle.Reader, upickle.Writer]{
    +    
    object Router extends autowire.Server[String, upickle.Reader, upickle.Writer]{
       def read[Result: upickle.Reader](p: String) = upickle.read[Result](p)
       def write[Result: upickle.Writer](r: Result) = upickle.write(r)
    -}
    +}

    - In this case using uPickle. Note how the route call explicitly states the type (here Api) that it is to generate routes against; this ensures that only methods which you explicitly put in your public interface Api are publically reachable. + In this case using uPickle. Note how the route call explicitly states the type (here Api) that it is to generate routes against; this ensures that only methods which you explicitly put in your public interface Api are publically reachable.

    Next, let's look at the modified client code:

    -
    package simple
    +    
    package simple
     import scalatags.JsDom.all._
     import org.scalajs.dom
     import dom.html
    @@ -2382,12 +2432,12 @@ object Client extends{
           ).render
         )
       }
    -}
    +}

    - There are two main modifications here: the existence of the new Ajaxer object, and the modification to the Ajax call-site. Let's first look at Ajaxer: + There are two main modifications here: the existence of the new Ajaxer object, and the modification to the Ajax call-site. Let's first look at Ajaxer:

    -
    object Ajaxer extends autowire.Client[String, upickle.Reader, upickle.Writer]{
    +    
    object Ajaxer extends autowire.Client[String, upickle.Reader, upickle.Writer]{
       override def doCall(req: Request) = {
         dom.ext.Ajax.post(
           url = "/ajax/" + req.path.mkString("/"),
    @@ -2397,24 +2447,24 @@ object Client extends{
     
       def read[Result: upickle.Reader](p: String) = upickle.read[Result](p)
       def write[Result: upickle.Writer](r: Result) = upickle.write(r)
    -}
    +}

    - Like the Router object, Ajaxer also defines how you perform the serialization and deserialization of data-structures, again using uPickle. Unlike the Router object, Ajaxer also defines how the out-going Ajax call gets sent over the network. Here we're doing it using the Ajax.post method. + Like the Router object, Ajaxer also defines how you perform the serialization and deserialization of data-structures, again using uPickle. Unlike the Router object, Ajaxer also defines how the out-going Ajax call gets sent over the network. Here we're doing it using the Ajax.post method.

    Lastly, let's look at the modified callsite for the ajax call itself:

    -
    def update() = Ajaxer[Api].list(inputBox.value).call().foreach{ data =>
    +
    def update() = Ajaxer[Api].list(inputBox.value).call().foreach{ data =>

    There are a few things of note here:

    • - The previous call to Ajax.post with the path as a string has been replaced by calling Ajaxer[Api].list(...).call(), since the logic of actually performing the POST is specified once-and-only-once in the Ajaxer object.
    • + The previous call to Ajax.post with the path as a string has been replaced by calling Ajaxer[Api].list(...).call(), since the logic of actually performing the POST is specified once-and-only-once in the Ajaxer object.
    • - While Ajax.post returned a Future[dom.XMLHttpRequest] and left us to call upickle.read and deserialize the data ourselves, Ajaxer[Api].list(...).call() now returns a Future[Seq[FileData]]! Thus we don't need to worry about making a mistake in the deserialization logic when we write it by hand. + While Ajax.post returned a Future[dom.XMLHttpRequest] and left us to call upickle.read and deserialize the data ourselves, Ajaxer[Api].list(...).call() now returns a Future[Seq[FileData]]! Thus we don't need to worry about making a mistake in the deserialization logic when we write it by hand.

    Other than that, nothing much has changed. If you've done this correctly, the web application will look and behave exactly as it did earlier! @@ -2430,16 +2480,16 @@ object Client extends{

    So why did we do this in the first place?

    -

    Why Autowire?

    +

    Why Autowire?

    - Overall, this set up requires some boilerplate to define the Ajaxer and Router objects, as well as the Api trait. However, these can be defined just once and used over and over; while it might be wasteful/unnecessary for making a single Ajax call, the cost is much less amortized over a number of Ajax calls. In a non-trivial web application with dozens of routes being called all over the place, spending a dozen lines setting up things up-front isn't a huge cost. + Overall, this set up requires some boilerplate to define the Ajaxer and Router objects, as well as the Api trait. However, these can be defined just once and used over and over; while it might be wasteful/unnecessary for making a single Ajax call, the cost is much less amortized over a number of Ajax calls. In a non-trivial web application with dozens of routes being called all over the place, spending a dozen lines setting up things up-front isn't a huge cost.

    What have we gotten in exchange? It turns out that by using Autowire, we have eliminated the three failure modes described earlier, that could:

    • - It is impossible for the route and the endpoint method-name to diverge accidentally: if the endpoint is called list, the requests will go through the /list URL. No room for discussion, or to make a mistake
    • + It is impossible for the route and the endpoint method-name to diverge accidentally: if the endpoint is called list, the requests will go through the /list URL. No room for discussion, or to make a mistake
    • You cannot accidentally rename the route on the server without changing the client, or vice versa. Attempts to do so will cause a compilation error, and even your IDE should highlight it as red. Try it out!
    • @@ -2465,13 +2515,13 @@ object Client extends{
    • What if you wanted to use another server rather than Spray? How about trying to set up a Play or Scalatra server to serve our Scala.js application code?
    -

    In Depth


    Exploring Scala.js

    +

    In Depth


    Exploring Scala.js

    This half of the book is a set of detailed expositions on various parts of the Scala.js platform. Nothing in here is necessary for you to make your first demos, but as you dig deeper into the platform, you will likely need or want to care about these things so you can properly understand what's going on "under the hood"

    -

    Advanced Techniques


    +

    Advanced Techniques


    Getting Started walks you through how to set up some basic Scala.js applications, but that only scratches the surface of the things you can do with Scala.js. Apart from being able to use the same techniques you're used to in Scala-JVM in the browser, Scala.js opens up a whole range of possibilities and novel techniques that are not found in typical Scala-JVM applications. @@ -2492,7 +2542,7 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth

    -

    Functional-Reactive UIs

    +

    Functional-Reactive UIs

    Functional-reactive Programming (FRP) is a field with encompasses several things:

    @@ -2502,7 +2552,7 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth
  • Continuous: Handling of first-class signals, like in Elmhttp://elm-lang.org/learn/What-is-FRP.elm
  • -

    Why FRP

    +

    Why FRP

    The value proposition of FRP is that in a "traditional" program, when an event occurs, events and changes propagate throughout the program in an ad-hoc manner. An event-listener may trigger additional events, call some callbacks, or set some mutable variables that subsequent code will read and react to.

    @@ -2513,13 +2563,13 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth Furthermore, because the propagation is ad-hoc, there is no way for the code to help ensure that you are propagating changes in a "valid" manner: it is thus easy for programmer errors to result in changes or events being incorrectly propagated. This most often results in data falling out of sync: a UI widget may forget to update when an action is taken, resulting in an inconsistent state being shown to the user, ultimately resulting in confused users.

    - FRP basically structures these event- or change-propagations as first-class values within the program, either as an EventSource[T] type that represents a discrete source of individual T events, or as a Signal[T] type which represents a continuous time-varying value T. This comes at some cost within the program: you now have to program using these EventSources or Signals, rather than just ad-hoc running callbacks or listening-to/triggering events all over the place. In exchange, you get more powerful tools to work with these values, making it easy for the library to e.g. ensure that changes always propagate correctly throughout your program, and that all values are always kept in sync. + FRP basically structures these event- or change-propagations as first-class values within the program, either as an EventSource[T] type that represents a discrete source of individual T events, or as a Signal[T] type which represents a continuous time-varying value T. This comes at some cost within the program: you now have to program using these EventSources or Signals, rather than just ad-hoc running callbacks or listening-to/triggering events all over the place. In exchange, you get more powerful tools to work with these values, making it easy for the library to e.g. ensure that changes always propagate correctly throughout your program, and that all values are always kept in sync.

    -

    FRP with Scala.Rx

    +

    FRP with Scala.Rx

    Scala.Rx is a change-propagation library that implements the Continuous style of FRP. To begin with, we need to include it in our build.sbt dependencies:

    -
    libraryDependencies += "com.lihaoyi" %%% "scalarx" % "0.2.8"
    +
    libraryDependencies += "com.lihaoyi" %%% "scalarx" % "0.2.8"

    Scala.Rx provides you with smart variables that automatically track dependencies with each other, such that if one smart variable changes, the rest re-compute immediately and automatically. The main primitives in Scala.Rx are: @@ -2533,27 +2583,27 @@ is a set of detailed expositions on various parts of the Scala.js platform. Noth Obss: Observers on either an Rx or a Var, which performs some action when it changes

    - Vars and Rxs roughly correspond to the idea of a Signal described earlier. The documentation for Scala.Rx goes into this in much more detail, so if you're curious you should read it. This section will jump straight into how to use Scala.Rx with Scala.js. + Vars and Rxs roughly correspond to the idea of a Signal described earlier. The documentation for Scala.Rx goes into this in much more detail, so if you're curious you should read it. This section will jump straight into how to use Scala.Rx with Scala.js.

    To begin with, let's set up our imports:

    -
    package advanced
    +    
    package advanced
     
     import org.scalajs.dom
     import scalajs.js
     import scalajs.js.annotation.JSExport
     import rx._
     import scalatags.JsDom.all._
    -import dom.html
    +import dom.html

    - Here we are seeing the same dom and scalatags, imports we saw in the hands-on tutorial, as well a new import rx._ which bring all the Scala.Rx names into the local namespace. + Here we are seeing the same dom and scalatags, imports we saw in the hands-on tutorial, as well a new import rx._ which bring all the Scala.Rx names into the local namespace.

    Scala.Rx does not "natively" bind to Scalatags, but integrating them yourself is simple enough that it's not worth putting into a separate library. He's a simple integration:

    -
    implicit def rxFrag[T <% Frag](r: Rx[T]): Frag = {
    +    
    implicit def rxFrag[T <% Frag](r: Rx[T]): Frag = {
       def rSafe: dom.Node = span(r()).render
       var last = rSafe
       Obs(r, skipInitial = true){
    @@ -2563,17 +2613,17 @@ import dom.html
    +}

    - Scalatags requires that anything you want to embed in a Scalatags fragment be implicitly convertible to Frag; here we are providing one for any Scala.Rx Rx[T]s, as long as the T provided is itself convertible to a Frag. We call r().render to extract the "current" value of the Rx, and then set up an Obs that watches the Rx, replacing the previous value with the current one every time its value changes. + Scalatags requires that anything you want to embed in a Scalatags fragment be implicitly convertible to Frag; here we are providing one for any Scala.Rx Rx[T]s, as long as the T provided is itself convertible to a Frag. We call r().render to extract the "current" value of the Rx, and then set up an Obs that watches the Rx, replacing the previous value with the current one every time its value changes.

    - Now that the set-up is out of the way, let's consider a simple HTML widget that lets you enter text in a <textarea>, and keeps track of the number of words, characters, and counts how long each word is. + Now that the set-up is out of the way, let's consider a simple HTML widget that lets you enter text in a <textarea>, and keeps track of the number of words, characters, and counts how long each word is.

    -
    val txt = Var("")
    +        
    val txt = Var("")
     val numChars = Rx{txt().length}
     val numWords = Rx{
       txt().split(' ')
    @@ -2599,31 +2649,31 @@ container.appendChild(
           li("Word Length: ", avgWordLength)
         )
       ).render
    -)
    +)

    - This snippet sets up a basic data-flow graph. We have our txt Var, and a bunch of Rxs (numChars, numWords, avgWordLength) that are computed based on txt. + This snippet sets up a basic data-flow graph. We have our txt Var, and a bunch of Rxs (numChars, numWords, avgWordLength) that are computed based on txt.

    - Next, we construct our Scalatags fragment: a textarea tag with a listener that updates txt, and a div containing the textarea and a list containing the bound values of our Rxs. + Next, we construct our Scalatags fragment: a textarea tag with a listener that updates txt, and a div containing the textarea and a list containing the bound values of our Rxs.

    That's all we need to end up with a live-updating widget, which re-renders the necessary bits of the page when the contents of the text box changes! Note how the code basically flows top-to-bottom, like a batch-rendering program, but at the end of it we get a live widget. The code is much simpler than a similar widget built up using jQuery or Backbone.

    - Furthermore, there is no chance for the parts of the DOM which are "live" to fall out of sync. There is no visible logic that handles the individual re-calulations and re-renders: that is all done by Scala.Rx and by our rxFrag implicit. Because we do not need to write code for each site to keep each individual Rx and each DOM fragment in sync, that means there is no chance of the developer screwing it up and resulting in an out-of-sync page. + Furthermore, there is no chance for the parts of the DOM which are "live" to fall out of sync. There is no visible logic that handles the individual re-calulations and re-renders: that is all done by Scala.Rx and by our rxFrag implicit. Because we do not need to write code for each site to keep each individual Rx and each DOM fragment in sync, that means there is no chance of the developer screwing it up and resulting in an out-of-sync page.

    -

    More Rx

    +

    More Rx

    That was a pretty simple example to get you started with a simple Scala.Rx application. Let's look at a more meaty example to see how we can use Scala.Rx to help structure our interactive web application:

    -
    val fruits = Seq(
    +        
    val fruits = Seq(
       "Apple", "Apricot", "Banana", "Cherry",
       "Mango", "Mangosteen", "Mandarin",
       "Grape", "Grapefruit", "Guava"
    @@ -2647,13 +2697,13 @@ container.appendChild(
         txtInput,
         ul(fragments)
       ).render
    -)
    +)

    - This is a basic re-implementation of the autocomplete widget we created in the chapter Interactive Web Pages, except done using Scala.Rx. Note that unlike the original implementation, we don't need to manage the clearing of the output area via innerHTML = "" and the re-rendering via appendChild(...). All this is handled by the same rxFrag code we wrote earlier. + This is a basic re-implementation of the autocomplete widget we created in the chapter Interactive Web Pages, except done using Scala.Rx. Note that unlike the original implementation, we don't need to manage the clearing of the output area via innerHTML = "" and the re-rendering via appendChild(...). All this is handled by the same rxFrag code we wrote earlier.

    Furthermore, this implementation is more efficient than the original: In the original, everything is always re-rendered every time, which can be a problem if the number of things being rendered is large. In this implementation, only when a fruit appears-in/disappears-from the list does re-rendering happen, and only for that particular fruit. For the bulk of the fruits which did not experience any change in appearance, the DOM is left entirely untouched. @@ -2666,7 +2716,7 @@ container.appendChild(

    Hopefully this has given you a sense of how you can use Scala.Rx to help build complex, interactive web applications. The implementation is tricky, but the basic value proposition is clear: you get to write your code top-to-bottom, like the most old-fashioned static pages, and have it transformed by Scala.Rx into an interactive, always-consistent web app. By abstracting away the whole event-propagation, manual-updating process inside the library, we have ensured that there is no place where the developer can screw it up, and the application's UI will forever be in sync with its data.

    -

    Asynchronous Workflows

    +

    Asynchronous Workflows

    In a traditional setting, Scala applications tend to have a mix of concurrency models: some spawn multiple threads and use thread-blocking operations or libraries, others do things with Actors or Futures, trying hard to stay non-blocking throughout, while most are a mix of these two paradigms.

    @@ -2676,7 +2726,7 @@ container.appendChild(

    However, Scala.js has much more powerful tools to work with than your typical Javascript libraries. The Scala standard library comes with a rich API for Futures & Promises, which are thankfully 100% asynchronous. Though this design was chosen for performance on the JVM, it perfectly fits our 100% asynchronous Javascript APIs. We have tools like Scala-Async, which works perfectly with Scala.js, and lets you create asynchronous computations in a much less confusing manner.

    -

    Futures & Promises

    +

    Futures & Promises

    A Future represents an in-progress computation that may or may not have completed. It may encapsulate a web request, or an RPC, or a task happening on another thread. They are not a novel concept, and Scala provides a good in-built implementation of Futures that works well with Scala.js.

    @@ -2697,7 +2747,7 @@ container.appendChild(

    To begin with, let's write the scaffolding code, that will display the input box, deal with the listeners, and all that:

    -
    val myInput = input(value:="London,Singapore,Berlin,New York").render
    +    
    val myInput = input(value:="London,Singapore,Berlin,New York").render
     val output = div.render
     myInput.onkeyup = (e: dom.KeyboardEvent) => {
       if (e.keyCode == KeyCode.enter){
    @@ -2710,21 +2760,21 @@ container.appendChild(
         myInput,
         output
       ).render
    -)
    +)

    - So far so good. The only thing that's missing here is the mysterious handle function, which is given the list of names and the output div, and must handle the Ajax requests, aggregating the results, and displaying them in output. Let's also define a small number of helper functions that we'll use later: + So far so good. The only thing that's missing here is the mysterious handle function, which is given the list of names and the output div, and must handle the Ajax requests, aggregating the results, and displaying them in output. Let's also define a small number of helper functions that we'll use later:

    -
    def urlFor(name: String) = {
    +    
    def urlFor(name: String) = {
       "http://api.openweathermap.org/data/" +
       "2.5/find?mode=json&q=" +
       name
    -}
    +}

    - urlFor encapsulates the messy URL-construction logic that we need to make the Ajax call to the right place. + urlFor encapsulates the messy URL-construction logic that we need to make the Ajax call to the right place.

    -
    def parseTemp(text: String) = {
    +    
    def parseTemp(text: String) = {
       val data = js.JSON.parse(text)
       val kelvins = data.list
                         .pop()
    @@ -2732,12 +2782,12 @@ container.appendChild(
                         .temp
                         .asInstanceOf[Double]
       kelvins - 272.15
    -}
    +}

    - parseTemp encapsulates the messy result-extraction logic that we need to get the data we want (current temperature, in celsius) out of the structured JSON return blob. + parseTemp encapsulates the messy result-extraction logic that we need to get the data we want (current temperature, in celsius) out of the structured JSON return blob.

    -
    def formatResults(output: html.Element, results: Seq[(String, Double)]) = {
    +    
    def formatResults(output: html.Element, results: Seq[(String, Double)]) = {
       output.innerHTML = ""
       output.appendChild(ul(
         for((name, temp) <- results) yield li(
    @@ -2745,19 +2795,19 @@ container.appendChild(
         )
       ).render)
     }
    -@JSExport
    +@JSExport

    - formatResults encapsulates the conversion of the final (name, celsius) data back into readable HTML. + formatResults encapsulates the conversion of the final (name, celsius) data back into readable HTML.

    - Overall, these helper functions do nothing special, btu we're defining them first to avoid having to copy-&-paste code throughout the subsequent examples. Now that we've defined all the relevant scaffolding, let's walk through a few ways that we can implement the all-important handle method. + Overall, these helper functions do nothing special, btu we're defining them first to avoid having to copy-&-paste code throughout the subsequent examples. Now that we've defined all the relevant scaffolding, let's walk through a few ways that we can implement the all-important handle method.

    -

    Direct Use of XMLHttpRequest

    +

    Direct Use of XMLHttpRequest

    -
    def handle0(names: Seq[String], output: html.Div) = {
    +      
    def handle0(names: Seq[String], output: html.Div) = {
       val results = mutable.Buffer.empty[(String, Double)]
       for(name <- names){
         val xhr = new XMLHttpRequest
    @@ -2771,19 +2821,19 @@ container.appendChild(
         }
         xhr.send()
       }
    -}
    +}

    - This is a simple solution that directly uses the XMLHttpRequest class that is available in Javascript in order to perform the Ajax call. Every Ajax call that returns, we aggregate in a results buffer, and when the results buffer is full we then append the formatted results to the output div.

    + This is a simple solution that directly uses the XMLHttpRequest class that is available in Javascript in order to perform the Ajax call. Every Ajax call that returns, we aggregate in a results buffer, and when the results buffer is full we then append the formatted results to the output div.

    - This is relatively straightforward, though maybe knottier than people would be used to. For example, we have to "construct" the Ajax call via calling mutating methods and setting properties on the XMLHttpRequest object, where it's easy to make a mistake. Furthermore, we need to manually aggregate the results and keep track ourselves whether or not the calls have all completed, which again is messy and error-prone. + This is relatively straightforward, though maybe knottier than people would be used to. For example, we have to "construct" the Ajax call via calling mutating methods and setting properties on the XMLHttpRequest object, where it's easy to make a mistake. Furthermore, we need to manually aggregate the results and keep track ourselves whether or not the calls have all completed, which again is messy and error-prone.

    - This solution is basically equivalent to the initial code given in the Raw Javascript section of Interactive Web Pages, with the additional code necessary for aggregation. As described in dom.extensions, we can make use of the Ajax object to make it slightly tidier. + This solution is basically equivalent to the initial code given in the Raw Javascript section of Interactive Web Pages, with the additional code necessary for aggregation. As described in dom.extensions, we can make use of the Ajax object to make it slightly tidier.

    -

    Using dom.extensions.Ajax

    +

    Using dom.extensions.Ajax

    -
    def handle1(names: Seq[String], output: html.Div) = {
    +      
    def handle1(names: Seq[String], output: html.Div) = {
       val results = mutable.Buffer.empty[(String, Double)]
       for{
         name <- names
    @@ -2795,16 +2845,16 @@ container.appendChild(
           formatResults(output, results)
         }
       }
    -}
    +}

    - This solution uses the dom.extensions.Ajax object, as described in dom.extensions. This basically wraps the messy XMLHttpRequest interface in a single function that returns a scala.concurrent.Future, which you can then map/foreach over to perform the action when the Future is complete.

    + This solution uses the dom.extensions.Ajax object, as described in dom.extensions. This basically wraps the messy XMLHttpRequest interface in a single function that returns a scala.concurrent.Future, which you can then map/foreach over to perform the action when the Future is complete.

    - However, we still have the messiness inherent in the result aggregation: we don't actually want to perform our action (writing to the output div) when one Future is complete, but only when all the Futures are complete. Thus we still need to do some amount of manual book-keeping in the results buffer. + However, we still have the messiness inherent in the result aggregation: we don't actually want to perform our action (writing to the output div) when one Future is complete, but only when all the Futures are complete. Thus we still need to do some amount of manual book-keeping in the results buffer.

    -

    Future Combinators

    +

    Future Combinators

    -
    def handle2(names: Seq[String], output: html.Div) = {
    +      
    def handle2(names: Seq[String], output: html.Div) = {
       val futures = for(name <- names) yield{
         Ajax.get(urlFor(name)).map( xhr =>
           (name, parseTemp(xhr.responseText))
    @@ -2814,12 +2864,12 @@ container.appendChild(
       for(results <- Future.sequence(futures)){
         formatResults(output, results)
       }
    -}
    +}

    - Since we're using Scala's Futures, we aren't limited to just map/foreach-ing over them. scala.concurrent.Future provides a rich api that can be used to deal with common tasks like working with lists of futures in parallel, or aggregating the result of futures together.

    + Since we're using Scala's Futures, we aren't limited to just map/foreach-ing over them. scala.concurrent.Future provides a rich api that can be used to deal with common tasks like working with lists of futures in parallel, or aggregating the result of futures together.

    - Here, instead of manually counting until all the Futures are complete, we instead create the Futures which will contain what we want (name and temperature) and store them in a list. Then we can use the Future.sequence function to invert the Seq[Future[T]] into a Future[Seq[T]], a single Future that will provide all the results in a single list when every Future is complete. We can then simply foreach- over the single Future to get the data we need to feed to formatResults/appendChild. + Here, instead of manually counting until all the Futures are complete, we instead create the Futures which will contain what we want (name and temperature) and store them in a list. Then we can use the Future.sequence function to invert the Seq[Future[T]] into a Future[Seq[T]], a single Future that will provide all the results in a single list when every Future is complete. We can then simply foreach- over the single Future to get the data we need to feed to formatResults/appendChild.

    This approach is significantly neater than the previous two examples: we no longer have any mutation going on, and the logic is expressed in a very high-level, simple manner. "Make a bunch of Futures, join them, use the result" is much less error-prone than the imperative result-aggregation-and-counting logic used in the previous examples. @@ -2827,9 +2877,9 @@ container.appendChild(


    - scala.concurrent.Future isn't limited to just calling .sequence on lists. It provides the ability to .zip two Futures of different types together to get their result, or .recover in the case where Futures fail. Although these tools were originally built for Scala-JVM, all of them work unchanged on Scala.js, and serve their purpose well in simplifying messy asynchronous computations. + scala.concurrent.Future isn't limited to just calling .sequence on lists. It provides the ability to .zip two Futures of different types together to get their result, or .recover in the case where Futures fail. Although these tools were originally built for Scala-JVM, all of them work unchanged on Scala.js, and serve their purpose well in simplifying messy asynchronous computations.

    -

    Scala-Async

    +

    Scala-Async

    Let's look at how to use Scala-Async. To motivate us, let's consider a simple paint-like canvas application similar to the one we built in the section Making a Sketchpad using Mouse Input. This application will have a few properties:

    @@ -2846,7 +2896,7 @@ container.appendChild(

    This is a toy example, but is enough to bring out the difficulty of doing things the "traditional" way, and why using Scala-Async with Scala.js is superior. To begin with, let's set the stage:

    -
    val renderer = canvas.getContext("2d")
    +    
    val renderer = canvas.getContext("2d")
       .asInstanceOf[dom.CanvasRenderingContext2D]
     
     canvas.style.backgroundColor = "#f8f8f8"
    @@ -2856,18 +2906,18 @@ canvas.width = canvas.parentElement.clientWidth
     renderer.lineWidth = 5
     renderer.strokeStyle = "red"
     renderer.fillStyle = "cyan"
    -renderer
    +renderer

    To initialize the canvas with the part of the code which will remain the same, so we can look more closely at the code which differs.

    -

    Traditional Asynchrony

    +

    Traditional Asynchrony

    - Let's look at a traditional implementation, using Scala.js but no special features. We'll just use the Javascript canvas.onmouveXXX operations directly. + Let's look at a traditional implementation, using Scala.js but no special features. We'll just use the Javascript canvas.onmouveXXX operations directly.

    -
    // traditional
    +          
    // traditional
     def rect = canvas.getBoundingClientRect()
     
     var dragState = 0
    @@ -2899,7 +2949,7 @@ canvas.onmousedown ={(e: dom.MouseEvent) =>
           e.clientY - rect.top
         )
       }
    -}
    +}
    @@ -2908,31 +2958,31 @@ canvas.onmousedown ={(e: dom.MouseEvent) =>

    • - canvas.onmousemove
    • + canvas.onmousemove
    • - canvas.onmousedown
    • + canvas.onmousedown
    • - canvas.onmouseup + canvas.onmouseup

    And each listener is in charge of deciding what to do when it is it's turn to fire.

    - This code is pretty tricky and hard to follow. It's not immediately clear what it is doing. One thing you may notice is the presence of this dragState variable, which seems to add a lot to the confusion with branches all over the place. At first you may think you can simplify the code to do without it, but attempts to do so will reveal why it is necessary. + This code is pretty tricky and hard to follow. It's not immediately clear what it is doing. One thing you may notice is the presence of this dragState variable, which seems to add a lot to the confusion with branches all over the place. At first you may think you can simplify the code to do without it, but attempts to do so will reveal why it is necessary.

    - This variable is necessary because each mouse event could mean different things at different times. For example, canvas.onmousemove should do nothing it occurs between an canvas.onmousedown and canvas.onmouseup. canvas.onmouseup itself has two tasks: it either ends the dragging phase (which necessitates the fill-current-shape call) or it serves to clear the canvas if happening after a drag. And canvas.onmousedown should not start a new drag if the previous drawing hasn't been cleared from the canvas. + This variable is necessary because each mouse event could mean different things at different times. For example, canvas.onmousemove should do nothing it occurs between an canvas.onmousedown and canvas.onmouseup. canvas.onmouseup itself has two tasks: it either ends the dragging phase (which necessitates the fill-current-shape call) or it serves to clear the canvas if happening after a drag. And canvas.onmousedown should not start a new drag if the previous drawing hasn't been cleared from the canvas.

    This is a pretty simple workflow for the user, and yet the code is already tricky enough it's not obvious that it's correct at first glance. More complex tools will have correspondingly more complex workflows, and it is easy to see how just another 1 or 2 more states can get out of hand.

    -

    Using Scala-Async

    +

    Using Scala-Async

    Now we've seen what a "traditional" approach looks like, let's look at how we would do this using Scala-Async.

    -
    // async
    +          
    // async
     def rect = canvas.getBoundingClientRect()
     
     type ME = dom.MouseEvent
    @@ -2967,20 +3017,20 @@ async{
         await(mouseup())
         renderer.clearRect(0, 0, 1000, 1000)
       }
    -}
    +}

    - We have an async block, which contains a while loop. Each round around the loop, we wait for the mousedown channel to start the path, waiting for either mousemove or mouseup (which continues the path or ends it respectively), fill the shape, and then wait for another mousedown before clearing the canvas and going again. + We have an async block, which contains a while loop. Each round around the loop, we wait for the mousedown channel to start the path, waiting for either mousemove or mouseup (which continues the path or ends it respectively), fill the shape, and then wait for another mousedown before clearing the canvas and going again.

    Hopefully you'd agree that this code is much simpler to read and understand than the previous version. In particular, the control-flow of the code goes from top to bottom in a "natural" fashion, rather than jumping around ad-hoc like in the previous callback-based design.

    - You may be wondering what these Channel things are, and where they are coming from. Although these are not provided by Scala, they are pretty straightforward to define ourselves: + You may be wondering what these Channel things are, and where they are coming from. Although these are not provided by Scala, they are pretty straightforward to define ourselves:

    -
    class Channel[T](init: (T => Unit) => Unit){
    +      
    class Channel[T](init: (T => Unit) => Unit){
       init(update)
       private[this] var value: Promise[T] = null
       def apply(): Future[T] = {
    @@ -2998,46 +3048,46 @@ async{
         } p.trySuccess(t)
         p.future
       }
    -}
    +}

    - The point of Channel is to allow us to turn event-callbacks (like those provided by the DOM's onmouseXXX properties) into some kind of event-stream, that we can listen to asynchronously (via apply that returns a Future) or merge via |. This is a minimal implementation for what we need now, but it would be easy to provide more functionality (filter, map, etc.) as necessary. + The point of Channel is to allow us to turn event-callbacks (like those provided by the DOM's onmouseXXX properties) into some kind of event-stream, that we can listen to asynchronously (via apply that returns a Future) or merge via |. This is a minimal implementation for what we need now, but it would be easy to provide more functionality (filter, map, etc.) as necessary.


    - Scala-Async is a Macro; that means that it is both more flexible and more limited than normal Scala, e.g. you cannot put the await call inside a lambda or higher-order-function like .map. Like Futures, it doesn't provide any fundamentally new capabilities, but is a tool that can be used to simplify otherwise messy asynchronous workflows.

    + Scala-Async is a Macro; that means that it is both more flexible and more limited than normal Scala, e.g. you cannot put the await call inside a lambda or higher-order-function like .map. Like Futures, it doesn't provide any fundamentally new capabilities, but is a tool that can be used to simplify otherwise messy asynchronous workflows.

    -

    Deviations from Scala-JVM


    +

    Deviations from Scala-JVM


    Although Scala.js tries very hard to maintain compatibility with Scala-JVM, there are some parts where the two platforms differs. This can be roughly grouped into two things: differences in the libraries available, and differences in the language itself. This chapter will cover both of these facets.

    -

    Language Differences

    +

    Language Differences

    -

    Primitive data types

    +

    Primitive data types

    All primitive data types work exactly as on the JVM, with the three following exceptions.

    -

    Floats can behave as Doubles by default

    +

    Floats can behave as Doubles by default

    Scala.js underspecifies the behavior of Floats by default. Any Float value can be stored as a Double instead, and any operation on Floats can be computed with double precision. The choice of whether or not to behave as such, when and where, is left to the implementation.

    If exact single precision operations are important to your application, you can enable strict-floats semantics in Scala.js, with the following sbt setting:

    -
    scalaJSSemantics ~= { _.withStrictFloats(true) }
    +
    scalaJSSemantics ~= { _.withStrictFloats(true) }

    Note that this can have a major impact on performance of your application on JS interpreters that do not support the Math.fround function.

    -

    toString of Float, Double and Unit

    +

    toString of Float, Double and Unit

    x.toString() returns slightly different results for floating point numbers and () (Unit).

    -
    // Scala-JVM
    +          
    // Scala-JVM
     > println(())
     ()
     > println(1.0)
    @@ -3046,7 +3096,7 @@ async{
     1.4
     
    -
    // Scala.js
    +          
    // Scala.js
     > println(())
     undefined
     > println(1.0)
    @@ -3059,7 +3109,7 @@ undefined
           

    To get sensible and portable string representation of floating point numbers, use String.format() or related methods.

    -

    Runtime type tests are based on values

    +

    Runtime type tests are based on values

    Instance tests (and consequently pattern matching) on any of Byte, Short, Int, Float, Double are based on the value and not the type they were created with. The following are examples:

      @@ -3081,15 +3131,15 @@ undefined NaN, Infinity, -Infinity and -0.0 match Float, Double

    As a consequence, the following apparent subtyping relationships hold:

    -
    Byte <:< Short <:<  Int  <:< Double
    +      
    Byte <:< Short <:<  Int  <:< Double
                    <:< Float <:<

    if strict-floats are enabled, or

    -
    Byte <:< Short <:< Int <:< Float =:= Double
    +
    Byte <:< Short <:< Int <:< Float =:= Double

    otherwise.

    -

    Undefined behaviors

    +

    Undefined behaviors

    The JVM is a very well specified environment, which even specifies how some bugs are reported as exceptions. Some examples are:

      @@ -3124,18 +3174,18 @@ undefined UndefinedBehaviorErrors are fatal in the sense that they are not matched by case NonFatal(e) handlers. This makes sure that they always crash your program as early as possible, so that you can detect and fix the bug. It is never OK to catch an UndefinedBehaviorError (other than in a testing framework), since that means your program will behave differently in fullOpt stage than in fastOpt.

      If you need a particular kind of exception to be thrown in compliance with the JVM semantics, you can do so with an sbt setting. For example, this setting enables compliant asInstanceOfs:

      -
      scalaJSSemantics ~= { _.withAsInstanceOfs(
      +    
      scalaJSSemantics ~= { _.withAsInstanceOfs(
         org.scalajs.core.tools.sem.CheckedBehavior.Compliant) }

      Note that this will have (potentially major) performance impacts.

      For a more detailed rationale, see the section Why does error behavior differ?.

      -

      Reflection

      +

      Reflection

      Java reflection and, a fortiori, Scala reflection, are not supported. There is limited support for java.lang.Class, e.g., obj.getClass.getName will work for any Scala.js object (not for objects that come from JavaScript interop). Reflection makes it difficult to perform the optimizations that Scala.js heavily relies on. For a more detailed discussion on this topic, take a look at the section Why No Reflection?.

      -

      Regular expressions

      +

      Regular expressions

      JavaScript regular expressions are slightly different from Java regular expressions. The support for regular expressions in Scala.js is implemented on top of JavaScript regexes.

      @@ -3145,32 +3195,32 @@ undefined

    • StringLike.split(x: Array[Char])
    -

    Symbols

    +

    Symbols

    scala.Symbol is supported, but is a potential source of memory leaks in applications that make heavy use of symbols. The main reason is that JavaScript does not support weak references, causing all symbols created by Scala.js to remain in memory throughout the lifetime of the application.

    -

    Enumerations

    +

    Enumerations

    The methods Value() and Value(i: Int) on scala.Enumeration use reflection to retrieve a string representation of the member name and are therefore -- in principle -- unsupported. However, since Enumerations are an integral part of the Scala library, Scala.js adds limited support for these two methods:

    Calls to either of these two methods of the forms:

    -
    val <ident> = Value
    +    
    val <ident> = Value
     val <ident> = Value(<num>)

    are statically rewritten to (a slightly more complicated version of):

    -
    val <ident> = Value("<ident>")
    +    
    val <ident> = Value("<ident>")
     val <ident> = Value(<num>, "<ident>")

    Note that this also includes calls like

    -
    val A, B, C, D = Value
    +
    val A, B, C, D = Value

    since they are desugared into separate val definitions.

    Calls to either of these two methods which could not be rewritten, or calls to constructors of the protected <code>Val</code> class without an explicit name as parameter, will issue a warning.

    Note that the name rewriting honors the nextName iterator. Therefore, the full rewrite is:

    -
    val <ident> = Value(
    +    
    val <ident> = Value(
       if (nextName != null && nextName.hasNext)
         nextName.next()
       else
    @@ -3179,7 +3229,7 @@ val <ident> = Value(<num>, "<ident>")

    We believe that this covers most use cases of scala.Enumeration. Please let us know if another (generalized) rewrite would make your life easier.

    -

    Library Differences

    +

    Library Differences

    @@ -3221,7 +3271,7 @@ val <ident> = Value(<num>, "<ident>")

    We'll go into each section bit by bit

    -

    Standard Library

    +

    Standard Library

    @@ -3234,11 +3284,11 @@ val <ident> = Value(<num>, "<ident>")
    Can UseCan't Use
    Some of java.util.*org.omg.CORBA, sun.misc.*

    - You can use more-or-less the whole Scala standard library in Scala.js, sans some more esoteric components like the parallel collections or the tools. Furthermore, we've ported some subset of the Java standard library that many common Scala libraries depends on, including most of java.lang.* and some of java.util.*.

    + You can use more-or-less the whole Scala standard library in Scala.js, sans some more esoteric components like the parallel collections or the tools. Furthermore, we've ported some subset of the Java standard library that many common Scala libraries depends on, including most of java.lang.* and some of java.util.*.

    There isn't a full list of standard library library APIs which are available from Scala.js, but it should be enough to give you a rough idea of what is supported. The full list of classes that have been ported to Scala.js is available under Available Java APIs

    -

    Macros v.s. Reflection

    +

    Macros v.s. Reflection

    @@ -3250,7 +3300,7 @@ val <ident> = Value(<num>, "<ident>")

    On the other hand, Scala.js does support Macros, and macros can in many ways substitute many of the use cases that people have traditionally used reflection for (see here). For example, instead of using a reflection-based serialization library like scala-pickling, you can use a macro-based library such as uPickle.

    -

    Pure-Scala v.s. Java Libraries

    +

    Pure-Scala v.s. Java Libraries

    Can UseCan't Use
    @@ -3260,7 +3310,7 @@ val <ident> = Value(<num>, "<ident>")

    You cannot use any libraries which have a Java dependency. This means libraries like ScalaTest or Scalate, which depend on a number of external Java libraries or source files, cannot be used from Scala.js. You can only use libraries which have no dependency on Java libraries or sources.

    -

    Javascript APIs v.s. JVM APIs

    +

    Javascript APIs v.s. JVM APIs

    Can UseCan't Use
    @@ -3272,12 +3322,12 @@ val <ident> = Value(<num>, "<ident>")

    Apart from depending on Java sources, the other thing that you can't use in Scala.js are JVM-specific APIs. This means that anything which goes down to the underlying operating system, filesystem, GUI or network are unavailable in Scala.js. This makes sense when you consider that these capabilities are no provided by the browser which Scala.js runs in, and it's impossible to re-implement them ourselves.

    - In exchange for this, Scala.js provides you access to Browser APIs that do related things. Although you can't set up a HTTP server to take in-bound requests, you can make out-bound requests using XMLHttpRequest to other servers. You can't write to the filesystem or databases directly, but you can write to the dom.localStorage provided by the browser. You can't use Swing or AWT or WebGL but instead work with the DOM and Canvas and WebGL.

    + In exchange for this, Scala.js provides you access to Browser APIs that do related things. Although you can't set up a HTTP server to take in-bound requests, you can make out-bound requests using XMLHttpRequest to other servers. You can't write to the filesystem or databases directly, but you can write to the dom.localStorage provided by the browser. You can't use Swing or AWT or WebGL but instead work with the DOM and Canvas and WebGL.

    Naturally, none of these are an exact replacement, as the browser environment is fundamentally different from that of a desktop application running on the JVM. Nonetheless, there are many analogues, and if so desired you can write code to abstract away these differences and run on both Scala.js and Scala-JVM

    -

    Scala/Browser tooling v.s. Java tooling

    +

    Scala/Browser tooling v.s. Java tooling

    Can UseCan't Use
    @@ -3292,13 +3342,13 @@ val <ident> = Value(<num>, "<ident>") Lastly, you gain access to browser tools that don't work with normal Scala: you can use the Chrome or Firefox consoles to poke at your Scala.js application from the command line, or their profilers/debuggers. With source maps set up, you can even step-through debug your Scala.js application directly in Chrome.

    -

    The Compilation Pipeline


    +

    The Compilation Pipeline


    Scala.js is implemented as a compiler plugin in the Scala compiler. Despite this, the overall process looks very different from that of a normal Scala application. This is because Scala.js optimizes for the size of the compiled executable, which is something that Scala-JVM does not usually do.

    -

    Whole Program Optimizaton

    +

    Whole Program Optimizaton

    At a first approximation, Scala.js achieves its tiny executables by using whole-program optimization. Scala-JVM, like Java, allows for separate compilation: this means that after compilation, you can combine your compiled code with code compiled separately, which can interact with the code you already compiled in an ad-hoc basis: code from both sides can call each others methods, instantiate each others classes, etc. without any limits.

    @@ -3314,7 +3364,7 @@ val <ident> = Value(<num>, "<ident>")

    It's worth noting that such optimizations exist as an option on the JVM aswell: Proguard is a well known library for doing similar DCE/optimization for Java/Scala applications, and is extensively used in developing mobile applications which face similar "minimize-code-size" constraints that web-apps do. However, the bulk of Scala code which runs on the server does not use these tools.

    -

    How Compilation Works

    +

    How Compilation Works

    The Scala.js compilation pipeline is roughly split into multiple stages:

    @@ -3341,7 +3391,7 @@ val <ident> = Value(<num>, "<ident>")

    But produced far larger (20mb) and slower executables. This section will explore each stage and we'll learn what these stages do, starting with a small example program:

    -
    def main() = {
    +  
    def main() = {
       var x = 0
       while(x < 999){
         x = x + "2".toInt
    @@ -3349,7 +3399,7 @@ val <ident> = Value(<num>, "<ident>")
    println(x) }
    -

    Compilation

    +

    Compilation

    As described earlier, the Scala.js compiler is implemented as a Scala compiler plugin, and lives in the main repository in compiler/. The bulk of the plugin runs after the mixin phase in the Scala compilation pipeline. By this point:

    @@ -3359,9 +3409,9 @@ val <ident> = Value(<num>, "<ident>")
  • Pattern-matches have been compiled to imperative code
  • - @tailrec functions have been translated to while-loops, lazy vals have been replaced by vars.
  • + @tailrec functions have been translated to while-loops, lazy vals have been replaced by vars.
  • - traits have been replaced by interfaces and classes + traits have been replaced by interfaces and classes
  • Overall, by the time the Scala.js compiler plugin takes action, most of the high-level features of the Scala language have already been removed. Compared to a hypothetical, alternative "from scratch" implementation, this approach has several advantages: @@ -3382,15 +3432,15 @@ val <ident> = Value(<num>, "<ident>") The .sjsir files, destined for further compilation in the Scala.js pipeline.

    - The ASTs defined in the .sjsir files is at about the same level of abstraction as the Trees that the Scala compiler is working with at this stage. However, the Trees within the Scala compiler contain a lot of cruft related to the compiler internals, and are also not easily serializable. This phase cleans them up into a "purer" format, (defined in the ir/ folder) which is also serializable. + The ASTs defined in the .sjsir files is at about the same level of abstraction as the Trees that the Scala compiler is working with at this stage. However, the Trees within the Scala compiler contain a lot of cruft related to the compiler internals, and are also not easily serializable. This phase cleans them up into a "purer" format, (defined in the ir/ folder) which is also serializable.

    This is the only phase in the Scala.js compilation pipeline that separate compilation is possible: you can compile many different sets of Scala.js .scala files separately, only to combine them later. This is used e.g. for distributing Scala.js libraries as Maven Jars, which are compiled separately by library authors to be combined into a final executable later.

    -

    Fast Optimization

    +

    Fast Optimization

    Without optimizations, the actual JavaScript code emitted for the above snippet would look like this:

    -
    ScalaJS.c.Lexample_ScalaJSExample$.prototype.main__V = (function() {
    +    
    ScalaJS.c.Lexample_ScalaJSExample$.prototype.main__V = (function() {
       var x = 0;
       while ((x < 999)) {
         x = ((x + new ScalaJS.c.sci_StringOps().init___T(
    @@ -3403,17 +3453,17 @@ val <ident> = Value(<num>, "<ident>")

    • - Scala-style method defs become Javascript-style prototype-function-assignment
    • + Scala-style method defs become Javascript-style prototype-function-assignment
    • - Scala vals and vars become Javascript vars
    • + Scala vals and vars become Javascript vars
    • - Scala whiles become Javascript whiles
    • + Scala whiles become Javascript whiles
    • - Implicits are materialized, hence all the StringOps and augmentString extensions are present in the output
    • + Implicits are materialized, hence all the StringOps and augmentString extensions are present in the output
    • - Classes and methods are fully-qualified, e.g. println becomes Predef().println
    • + Classes and methods are fully-qualified, e.g. println becomes Predef().println
    • - Method names are qualified by their types, e.g. __O__V means that println takes Object and returns void + Method names are qualified by their types, e.g. __O__V means that println takes Object and returns void

    This is an incomplete description of the translation, but it should give a good sense of how the translation from Scala to Javascript looks like. In general, the output is verbose but straightforward. @@ -3423,7 +3473,7 @@ val <ident> = Value(<num>, "<ident>")

    • - Dead-code elimination: entry-points to the program such as @JSExported methods/classes are kept, as are any methods/classes that these reference. All others are removed. This reduces the potentially 20mb of Javascript generated by a naive compilation to a more manageable 400kb-1mb for a typical application
    • + Dead-code elimination: entry-points to the program such as @JSExported methods/classes are kept, as are any methods/classes that these reference. All others are removed. This reduces the potentially 20mb of Javascript generated by a naive compilation to a more manageable 400kb-1mb for a typical application
    • Inlining: under some circumstances, the optimizer inlines the implementation of methods at call sites. For example, it does so for all "small enough" methods. This typically reduces the code size by a small amount, but offers a several-times speedup of the generated code by inlining away much of the overhead from the abstractions (implicit-conversions, higher-order-functions, etc.) in Scala's standard library.
    • @@ -3433,7 +3483,7 @@ val <ident> = Value(<num>, "<ident>")

      Applying these optimizations on our examples results in the following JavaScript code instead, which is what you typically execute in fastOpt stage:

      -
      ScalaJS.c.Lexample_ScalaJSExample$.prototype.main__V = (function() {
      +    
      ScalaJS.c.Lexample_ScalaJSExample$.prototype.main__V = (function() {
         var x = 0;
         while ((x < 999)) {
           var jsx$1 = x;
      @@ -3449,13 +3499,13 @@ val <ident> = Value(<num>, "<ident>")
      });

      - As a whole-program optimization, it tightly ties together the code it is compiling and does not let you e.g. inject additional classes later. This does not mean you cannot interact with external code at all: you can, but it has to go through explicitly @JSExported methods and classes via Javascript Interop, and not on ad-hoc classes/methods within the module. Thus it's entirely possible to have multiple "whole-programs" running in the same browser; they just will likely have duplicate copies of e.g. standard library classes inside of them, since they cannot share the code as it's not exported. + As a whole-program optimization, it tightly ties together the code it is compiling and does not let you e.g. inject additional classes later. This does not mean you cannot interact with external code at all: you can, but it has to go through explicitly @JSExported methods and classes via Javascript Interop, and not on ad-hoc classes/methods within the module. Thus it's entirely possible to have multiple "whole-programs" running in the same browser; they just will likely have duplicate copies of e.g. standard library classes inside of them, since they cannot share the code as it's not exported.

      While the input for this phase is the aggregate .sjsir files from your project and all your dependencies, the output is executable Javascript. This phase usually runs in less than a second, outputs a Javascript blob in the 400kb-1mb range, and is suitable for repeated use during development. This corresponds to the fastOptJS command in SBT.

      -

      Full Optimization

      -
      Fd.prototype.main = function() {
      +  

      Full Optimization

      +
      Fd.prototype.main = function() {
         for(var a = 0;999 > a;) {
           var b = (new D).j("2");
           E();
      @@ -3470,7 +3520,7 @@ val <ident> = Value(<num>, "<ident>")
      The Google Closure Compiler (GCC) is a set of tools that work with Javascript. It has multiple levels of optimization, doing everything from basic whitespace-removal to heavy optimization. It is an old, relatively mature project that is relied on both inside and outside Google to optimize the delivery of Javascript to the browser.

      - Scala.js uses GCC in its most aggressive mode: Advanced Optimization. GCC spits out a compressed, minified version of the Javascript (above) that Fast Optimization spits out: e.g. in the example above, all identifiers have been renamed to short strings, the while-loop has been replaced by a for-loop, and the println function has been inlined. + Scala.js uses GCC in its most aggressive mode: Advanced Optimization. GCC spits out a compressed, minified version of the Javascript (above) that Fast Optimization spits out: e.g. in the example above, all identifiers have been renamed to short strings, the while-loop has been replaced by a for-loop, and the println function has been inlined.

      As described in the linked documentation, GCC performs optimizations such as: @@ -3500,14 +3550,14 @@ val <ident> = Value(<num>, "<ident>")

      This whole chapter has been focused on the what but not the why. The chapter on Scala.js' Design Space contains a section which talks about why we care so much about small executables.

      -

      Scala.js' Design Space


      +

      Scala.js' Design Space


      Scala.js is a relatively large project, and is the result of both an enormous amount of hard work as well as a number of decisions that craft what it's like to program in Scala.js today. Many of these decisions result in marked differences from the behavior of the same code running on the JVM. This chapter explores the reasoning and rationale behind these decisions.

      -

      Why No Reflection?

      +

      Why No Reflection?

      Scala.js prohibits reflection as it makes dead-code elimination difficult, and the compiler relies heavily on dead-code elimination to generate reasonably-sized executables. The chapter on The Compilation Pipeline goes into more detail of why, but a rough estimate of the effect of various optimizations on a small application is:

      @@ -3524,11 +3574,11 @@ val <ident> = Value(<num>, "<ident>")

      The default output size of 20mb makes the executables difficult to work with. Even though browsers can deal with 20mb Javascript blobs, it takes the browser several seconds to even load it, and up to a minute after that for the JIT to optimize the whole thing.

      -

      Dead Code Elimination

      +

      Dead Code Elimination

      To illustrate why reflection makes things difficult, consider a tiny application:

      -
      @JSExport
      +    
      @JSExport
       object App extends js.JSApp{
         @JSExport
         def main() = {
      @@ -3546,22 +3596,22 @@ object Dead{
       

      • - App and App.main are exported via @JSExport, and thus can't be considered dead code.
      • + App and App.main are exported via @JSExport, and thus can't be considered dead code.
      • - App.foo is called from App.main, and so has to be kept around
      • + App.foo is called from App.main, and so has to be kept around
      • - App.bar is never called from App.main or App.foo, and so can be eliminated
      • + App.bar is never called from App.main or App.foo, and so can be eliminated
      • - Dead, including Dead.complexFunction, are not called from any live code, and can be eliminated. + Dead, including Dead.complexFunction, are not called from any live code, and can be eliminated.

      - The actual process is a bit more involved than this, but this is a first-approximation of how the dead-code-elimination works: you start with a small set of live code (e.g. @JSExported things), search out to find the things which are recursively reachable from that set, and eliminate all the rest. This means that the Scala.js compiler can eliminate, e.g., parts of the Scala standard library that you are not using. The standard library is not small, and makes up the bulk of the 20mb of the uncompressed blob. + The actual process is a bit more involved than this, but this is a first-approximation of how the dead-code-elimination works: you start with a small set of live code (e.g. @JSExported things), search out to find the things which are recursively reachable from that set, and eliminate all the rest. This means that the Scala.js compiler can eliminate, e.g., parts of the Scala standard library that you are not using. The standard library is not small, and makes up the bulk of the 20mb of the uncompressed blob.

      -

      Whither Reflection?

      +

      Whither Reflection?

      - To imagine why reflection makes this difficult, imagine a slightly modified program which includes some reflective calls in App.main + To imagine why reflection makes this difficult, imagine a slightly modified program which includes some reflective calls in App.main

      -
      @JSExport
      +    
      @JSExport
       object App extends js.JSApp{
         @JSExport
         def main() = {
      @@ -3575,9 +3625,9 @@ object Dead{
       }
       

      - Here, we're assuming userInput() is some method which returns a String that was input by the user or otherwise somehow decided at runtime.

      + Here, we're assuming userInput() is some method which returns a String that was input by the user or otherwise somehow decided at runtime.

      - We can start the same process: App.main is live since we @JSExported it, but what objects or methods are reachable from App.main? The answer is: it depends on the values of userInput(), which we don't know. And hence we don't know which classes or methods are reachable! Depending on what userInput() returns, any or all methods and classes could be used by App.main().

      + We can start the same process: App.main is live since we @JSExported it, but what objects or methods are reachable from App.main? The answer is: it depends on the values of userInput(), which we don't know. And hence we don't know which classes or methods are reachable! Depending on what userInput() returns, any or all methods and classes could be used by App.main().

      This leaves us a few options:

      @@ -3590,7 +3640,7 @@ object Dead{ Allow the user to annotate methods/classes that should be kept, and eliminate the rest.

    - All three are possible options: Scala.js started off with #1. #3 is the approach used by Proguard, which lets you annotate things e.g. @KeepApplication to preserve things for reflection and preventing Proguard from eliminating them as dead code. + All three are possible options: Scala.js started off with #1. #3 is the approach used by Proguard, which lets you annotate things e.g. @KeepApplication to preserve things for reflection and preventing Proguard from eliminating them as dead code.

    In the end, Scala.js chose #2. This is helped by the fact that overall, Scala code tends not to use reflection as heavily as Java, or dynamic languages which use it heavily. Scala uses techniques such as lambdas or implicits to satisfy many use cases which Java has traditionally used reflection for, while friendly to the optimizer. @@ -3598,7 +3648,7 @@ object Dead{

    There are a range of use-cases for reflection where you want to inspect an object's structure or methods, where lambdas or implicits don't help. People use reflection to serialize objects, or for routing messages to methods. However, both these cases can be satisfied by...

    -

    Macros

    +

    Macros

    The Scala programming language, since the 2.10.x series, has support for Macros in the language. Although experimental, these are heavily used in many projects such as Play and Slick and Akka, and allow a developer to perform compile-time computations and generate code where-ever the macros are used. @@ -3609,7 +3659,7 @@ object Dead{

    Practically, this means that you can use macros to do things such as inspecting the methods, fields and other type-level properties of a typed value. This allows us to do things like serialize objects with no boilerplate:

    -
    import upickle._
    +    
    import upickle._
     
     case class Thing(a: Int, b: String)
     write(Thing(1, "gg"))
    @@ -3624,44 +3674,44 @@ write(Thing(1, "gg"))
         

    Using macros here also plays well with the Scala.js optimizer: the macros are fully expanded before the optimizer is run, so by the time the optimizer sees the code, there is no more magic left: it is then free to do dead-code-elimination/inlining/other-optimizations without worrying about reflection causing the code to do weird things at runtime. Thus, we've managed to substitute most of the main use-cases of reflection, and so can do without it.

    -

    Why does error behavior differ?

    +

    Why does error behavior differ?

    Scala.js deviates from the semantics of Scala-JVM in several ways. Many of these ways revolve around the edge-conditions of a program: what happens when something goes wrong? An array index is out of bounds? An integer is divided-by-zero? These differences cause some amount of annoyance when debugging, since when you mess up an array index, you expect an exception, not silently-invalid-data!

    In most of these cases, it was a trade-off between performance and correctness. These are situations where the default semantics of Scala deviate from that of Javascript, and Scala.js would have to perform extra work to emulate the desired behavior. For example, compare the division behavior of the JVM and Javascript.

    -

    Divide-by-zero: a case study

    -
    /*JVM*/
    +  

    Divide-by-zero: a case study

    +
    /*JVM*/
     15 / 4              // 3
    -
    /*JS*/
    +    
    /*JS*/
     15 / 4              // 3.25

    - On the JVM, integer division is a primitive, and dividing 15 / 4 gives 3. However, in Javascript, it gives 3.25, since all numbers of double-precision floating points. + On the JVM, integer division is a primitive, and dividing 15 / 4 gives 3. However, in Javascript, it gives 3.25, since all numbers of double-precision floating points.

    - Scala.js works around this in the general case by adding a | 0 to the translation, e.g. + Scala.js works around this in the general case by adding a | 0 to the translation, e.g.

    -
    /*JVM*/
    +    
    /*JVM*/
     15 / 4              // 3
    -
    /*JS*/
    +    
    /*JS*/
     (15 / 4) | 0        // 3
     

    This gives the correct result for most numbers, and is reasonably efficient (actually, it tends to be more efficient on modern VMs). However, what about dividing-by-zero?

    -
    /*JVM*/
    +    
    /*JVM*/
     15 / 0              // ArithmeticException
    -
    /*JS*/
    +    
    /*JS*/
     15 / 0              // Infinity
     (15 / 0) | 0        // 0
     

    - On the JVM, the JVM is kind enough to throw an exception for you. However, in Javascript, the integer simply wraps around to Infinity, which then gets truncated down to zero.

    + On the JVM, the JVM is kind enough to throw an exception for you. However, in Javascript, the integer simply wraps around to Infinity, which then gets truncated down to zero.

    So that's the current behavior of integers in Scala.js. One may ask: can we fix it? And the answer is, we can:

    -
    /*JVM*/
    +    
    /*JVM*/
     1 / 0               // ArithmeticException
    -
    /*JS*/
    +    
    /*JS*/
     function intDivide(x, y){
       var z = x / y
       if (z == Infinity) throw new ArithmeticException("Divide by Zero")
    @@ -3669,19 +3719,19 @@ function intDivide(x, y){
     }
     intDivide(1, 0)     // ArithmeticException

    - This translation fixes the problem, and enforces that the ArithmeticException is thrown at the correct time. However, this approach causes some overhead: what was previously two primitive operations is now a function call, a local variable assignment, and a conditional. That is a lot more expensive than two primitive operations! + This translation fixes the problem, and enforces that the ArithmeticException is thrown at the correct time. However, this approach causes some overhead: what was previously two primitive operations is now a function call, a local variable assignment, and a conditional. That is a lot more expensive than two primitive operations!

    -

    The Performance/Correctness Tradeoff

    +

    The Performance/Correctness Tradeoff

    In the end, a lot of the semantic differences listed here come down to the same tradeoff: we could make the code behave more-like-Scala, but at a cost of adding overhead via function calls and other checks. Furthermore, the cost is paid regardless of whether the "exceptional case" is triggered or not: in the example above, every division in the program pays the cost!

    - The decision to not support these exceptional cases comes down to a value judgement: how often do people actually depend on an exception being thrown as part of their program semantics, e.g. by catching it and performing actions? And how often are they just a way of indicating bugs? It turns out that very few ArithmeticExceptions, ArrayIndexOutOfBoundsExceptions, or similar are actually a necessary part of the program! They exist during debugging, but after that, these code paths are never relied upon "in production".

    + The decision to not support these exceptional cases comes down to a value judgement: how often do people actually depend on an exception being thrown as part of their program semantics, e.g. by catching it and performing actions? And how often are they just a way of indicating bugs? It turns out that very few ArithmeticExceptions, ArrayIndexOutOfBoundsExceptions, or similar are actually a necessary part of the program! They exist during debugging, but after that, these code paths are never relied upon "in production".

    Thus Scala.js goes for a compromise: in the Fast Optimization mode, we run the code with all these checks in place (this is work in progress; currently only asInstanceOfs are thus checked), so as to catch cases where these errors occur close-to-the-source and make it easy for you to debug them. In Full Optimization mode, on the other hand, we remove these checks, assuming you've already ran through these cases and found any bugs during development.

    This is a common pattern in situations where there's a tradeoff between debuggability and speed. In Scala.js' case, it allows us to get good debuggability in development, as well as good performance in production. There's some loss in debuggability in development, sacrificed in exchange for greater performance.

    -

    Small Executables

    +

    Small Executables

    Why do we care so much about how big our executables are in Scala.js? Why don't we care about how big they are on Scala-JVM? This is mostly due to three reasons:
      @@ -3695,17 +3745,17 @@ intDivide(1, 0) // ArithmeticException

    These factors combined means that Scala.js has to put in extra effort to optimize the code to reduce it's size at compile-time.

    -

    Raw Verbosity

    +

    Raw Verbosity

    Scala.js compiles to Javascript source code, while Scala-JVM compiles to Java bytecode. Java bytecode is a binary format and thus somewhat optimized for size, while Javascript is textual and is designed to be easy to read and write by hand.

    - What does these mean, concretely? This means that a symbol marking something, e.g. the start of a function, is often a single byte in Java bytecode. Even more, it may not have any delimiter at all, instead the meaning of the binary data being inferred from its position in the file! On the other hand, in Javascript, declaring a function takes a long-and-verbose function keyword, which together with peripheral punctuation (., = , etc.) often adds up to tens of bytes to express a single idea.

    + What does these mean, concretely? This means that a symbol marking something, e.g. the start of a function, is often a single byte in Java bytecode. Even more, it may not have any delimiter at all, instead the meaning of the binary data being inferred from its position in the file! On the other hand, in Javascript, declaring a function takes a long-and-verbose function keyword, which together with peripheral punctuation (., = , etc.) often adds up to tens of bytes to express a single idea.

    What does this mean concretely? This means that expressing the same meaning in Javascript usually takes more "raw code" than expressing the same meaning in Java bytecode. Even though Java bytecode is relatively verbose for a binary format, it still is significantly more concise the Javascript, and it shows: the Scala standard library weighs in at a cool 6mb on Scala-JVM, while it weighs 20mb on Scala.js.

    All things being equal, this would mean that Scala.js would have to work harder to keep down code-size than Scala-JVM would have to. Alas, not all other things are equal.

    -

    Browsers Performance

    +

    Browsers Performance

    Without any optimization, a naive compilation to Scala.js results in an executable (Including the standard library) weighing around 20mb. On the surface, this isn't a problem: runtimes like the JVM have no issue with loading 20mb of Java bytecode to execute; many large desktop applications weigh in the 100s of megabytes while still loading and executing fine.

    @@ -3713,7 +3763,7 @@ intDivide(1, 0) // ArithmeticException

    Overall, this means that you probably do not want to work with un-optimized Scala.js executables. Even for development, the slow load times and initial sluggishness make testing the results of your hard-work in the browser a frustrating experience. But that's not all...

    -

    Deployment Size

    +

    Deployment Size

    Scala.js applications often run in the browser. Not just any browser, but the browsers of your users, who had come to your website or web-app to try and accomplish some task. This is in stark contrast the Scala-JVM applications, which most often run on servers: servers that you own and control, and can deploy code to at your leisure.

    @@ -3733,15 +3783,15 @@ intDivide(1, 0) // ArithmeticException
    Thus, while on Scala-JVM you typically have executables that (including dependencies) end up weighing 10s to 100s of megabytes, Scala.js has a much tighter budget. A hello world Scala.js application weighs in at around 100kb, and as you write more code and use more libraries (and parts of the standard library) this number rises to the 100s of kb. This isn't tiny, especially compared to the many small Javascript libraries out there, but it definitely is much smaller than what you'd be used to on the JVM.

    -

    Java APIs


    +

    Java APIs


    - Below is a list of classes from the Java Standard Library that are available from Scala.js. In general, much of java.lang, and parts of java.io, java.util and java.net have been ported over. This means that all these classes are available for use in Scala.js applications despite being part of the Java standard library.

    + Below is a list of classes from the Java Standard Library that are available from Scala.js. In general, much of java.lang, and parts of java.io, java.util and java.net have been ported over. This means that all these classes are available for use in Scala.js applications despite being part of the Java standard library.

    - There are many reasons you may want to port a Java class to Scala.js: you want to use it directly, you may be trying to port a library which uses it. In general, we haven't been porting things "for fun", and obscure classes like org.omg.corba will likely never be ported: we've been porting things as the need arises in order to support libraries (e.g. Scala.Rx that need them. + There are many reasons you may want to port a Java class to Scala.js: you want to use it directly, you may be trying to port a library which uses it. In general, we haven't been porting things "for fun", and obscure classes like org.omg.corba will likely never be ported: we've been porting things as the need arises in order to support libraries (e.g. Scala.Rx that need them.

    -

    Available Java APIs

    +

    Available Java APIs

      @@ -4039,7 +4089,7 @@ intDivide(1, 0) // ArithmeticException
  • java.util.regex.Pattern
  • -

    Porting Java APIs

    +

    Porting Java APIs

    The process for making Java library classes available in Scala.js is relatively straightforward:

      @@ -4061,12 +4111,12 @@ intDivide(1, 0) // ArithmeticException
  • Network APIs
  • - sun.misc.Unsafe + sun.misc.Unsafe
  • - And other similar APIs will either need to be rewritten to not-use them. For example, AtomicXXXs can be written without threading/unsafe APIs because Javascript is single-threaded, making the implementation for e.g. an AtomicBoolean pretty trivial: + And other similar APIs will either need to be rewritten to not-use them. For example, AtomicXXXs can be written without threading/unsafe APIs because Javascript is single-threaded, making the implementation for e.g. an AtomicBoolean pretty trivial:

    -
    package java.util.concurrent.atomic
    +  
    package java.util.concurrent.atomic
     
     class AtomicBoolean(private[this] var value: Boolean) extends Serializable {
       def this() = this(false)
    @@ -4098,10 +4148,22 @@ class AtomicBoolean(private[this] var value: Boolean) extends Serializable {
     
       override def toString(): String =
         value.toString()
    -}
    +}

    Others can't be ported at all (e.g. java.io.File) simply because the API capabilities they provide (blocking reads & writes to files) do not exist in the Javascript runtime.

    - \ No newline at end of file + \ No newline at end of file diff --git a/scripts.js b/scripts.js index 6ed5300..9abf203 100644 --- a/scripts.js +++ b/scripts.js @@ -1,9 +1,706 @@ var hljs=new function(){function j(v){return v.replace(/&/gm,"&").replace(//gm,">")}function t(v){return v.nodeName.toLowerCase()}function h(w,x){var v=w&&w.exec(x);return v&&v.index==0}function r(w){var v=(w.className+" "+(w.parentNode?w.parentNode.className:"")).split(/\s+/);v=v.map(function(x){return x.replace(/^lang(uage)?-/,"")});return v.filter(function(x){return i(x)||/no(-?)highlight/.test(x)})[0]}function o(x,y){var v={};for(var w in x){v[w]=x[w]}if(y){for(var w in y){v[w]=y[w]}}return v}function u(x){var v=[];(function w(y,z){for(var A=y.firstChild;A;A=A.nextSibling){if(A.nodeType==3){z+=A.nodeValue.length}else{if(A.nodeType==1){v.push({event:"start",offset:z,node:A});z=w(A,z);if(!t(A).match(/br|hr|img|input/)){v.push({event:"stop",offset:z,node:A})}}}}return z})(x,0);return v}function q(w,y,C){var x=0;var F="";var z=[];function B(){if(!w.length||!y.length){return w.length?w:y}if(w[0].offset!=y[0].offset){return(w[0].offset"}function E(G){F+=""}function v(G){(G.event=="start"?A:E)(G.node)}while(w.length||y.length){var D=B();F+=j(C.substr(x,D[0].offset-x));x=D[0].offset;if(D==w){z.reverse().forEach(E);do{v(D.splice(0,1)[0]);D=B()}while(D==w&&D.length&&D[0].offset==x);z.reverse().forEach(A)}else{if(D[0].event=="start"){z.push(D[0].node)}else{z.pop()}v(D.splice(0,1)[0])}}return F+j(C.substr(x))}function m(y){function v(z){return(z&&z.source)||z}function w(A,z){return RegExp(v(A),"m"+(y.cI?"i":"")+(z?"g":""))}function x(D,C){if(D.compiled){return}D.compiled=true;D.k=D.k||D.bK;if(D.k){var z={};var E=function(G,F){if(y.cI){F=F.toLowerCase()}F.split(" ").forEach(function(H){var I=H.split("|");z[I[0]]=[G,I[1]?Number(I[1]):1]})};if(typeof D.k=="string"){E("keyword",D.k)}else{Object.keys(D.k).forEach(function(F){E(F,D.k[F])})}D.k=z}D.lR=w(D.l||/\b[A-Za-z0-9_]+\b/,true);if(C){if(D.bK){D.b="\\b("+D.bK.split(" ").join("|")+")\\b"}if(!D.b){D.b=/\B|\b/}D.bR=w(D.b);if(!D.e&&!D.eW){D.e=/\B|\b/}if(D.e){D.eR=w(D.e)}D.tE=v(D.e)||"";if(D.eW&&C.tE){D.tE+=(D.e?"|":"")+C.tE}}if(D.i){D.iR=w(D.i)}if(D.r===undefined){D.r=1}if(!D.c){D.c=[]}var B=[];D.c.forEach(function(F){if(F.v){F.v.forEach(function(G){B.push(o(F,G))})}else{B.push(F=="self"?D:F)}});D.c=B;D.c.forEach(function(F){x(F,D)});if(D.starts){x(D.starts,C)}var A=D.c.map(function(F){return F.bK?"\\.?("+F.b+")\\.?":F.b}).concat([D.tE,D.i]).map(v).filter(Boolean);D.t=A.length?w(A.join("|"),true):{exec:function(F){return null}}}x(y)}function c(T,L,J,R){function v(V,W){for(var U=0;U";V+=aa+'">';return V+Y+Z}function N(){if(!I.k){return j(C)}var U="";var X=0;I.lR.lastIndex=0;var V=I.lR.exec(C);while(V){U+=j(C.substr(X,V.index-X));var W=E(I,V);if(W){H+=W[1];U+=w(W[0],j(V[0]))}else{U+=j(V[0])}X=I.lR.lastIndex;V=I.lR.exec(C)}return U+j(C.substr(X))}function F(){if(I.sL&&!f[I.sL]){return j(C)}var U=I.sL?c(I.sL,C,true,S):e(C);if(I.r>0){H+=U.r}if(I.subLanguageMode=="continuous"){S=U.top}return w(U.language,U.value,false,true)}function Q(){return I.sL!==undefined?F():N()}function P(W,V){var U=W.cN?w(W.cN,"",true):"";if(W.rB){D+=U;C=""}else{if(W.eB){D+=j(V)+U;C=""}else{D+=U;C=V}}I=Object.create(W,{parent:{value:I}})}function G(U,Y){C+=U;if(Y===undefined){D+=Q();return 0}var W=v(Y,I);if(W){D+=Q();P(W,Y);return W.rB?0:Y.length}var X=z(I,Y);if(X){var V=I;if(!(V.rE||V.eE)){C+=Y}D+=Q();do{if(I.cN){D+=""}H+=I.r;I=I.parent}while(I!=X.parent);if(V.eE){D+=j(Y)}C="";if(X.starts){P(X.starts,"")}return V.rE?0:Y.length}if(A(Y,I)){throw new Error('Illegal lexeme "'+Y+'" for mode "'+(I.cN||"")+'"')}C+=Y;return Y.length||1}var M=i(T);if(!M){throw new Error('Unknown language: "'+T+'"')}m(M);var I=R||M;var S;var D="";for(var K=I;K!=M;K=K.parent){if(K.cN){D=w(K.cN,"",true)+D}}var C="";var H=0;try{var B,y,x=0;while(true){I.t.lastIndex=x;B=I.t.exec(L);if(!B){break}y=G(L.substr(x,B.index-x),B[0]);x=B.index+y}G(L.substr(x));for(var K=I;K.parent;K=K.parent){if(K.cN){D+=""}}return{r:H,value:D,language:T,top:I}}catch(O){if(O.message.indexOf("Illegal")!=-1){return{r:0,value:j(L)}}else{throw O}}}function e(y,x){x=x||b.languages||Object.keys(f);var v={r:0,value:j(y)};var w=v;x.forEach(function(z){if(!i(z)){return}var A=c(z,y,false);A.language=z;if(A.r>w.r){w=A}if(A.r>v.r){w=v;v=A}});if(w.language){v.second_best=w}return v}function g(v){if(b.tabReplace){v=v.replace(/^((<[^>]+>|\t)+)/gm,function(w,z,y,x){return z.replace(/\t/g,b.tabReplace)})}if(b.useBR){v=v.replace(/\n/g,"
    ")}return v}function p(A){var B=r(A);if(/no(-?)highlight/.test(B)){return}var y;if(b.useBR){y=document.createElementNS("http://www.w3.org/1999/xhtml","div");y.innerHTML=A.innerHTML.replace(/\n/g,"").replace(//g,"\n")}else{y=A}var z=y.textContent;var v=B?c(B,z,true):e(z);var x=u(y);if(x.length){var w=document.createElementNS("http://www.w3.org/1999/xhtml","div");w.innerHTML=v.value;v.value=q(x,u(w),z)}v.value=g(v.value);A.innerHTML=v.value;A.className+=" hljs "+(!B&&v.language||"");A.result={language:v.language,re:v.r};if(v.second_best){A.second_best={language:v.second_best.language,re:v.second_best.r}}}var b={classPrefix:"hljs-",tabReplace:null,useBR:false,languages:undefined};function s(v){b=o(b,v)}function l(){if(l.called){return}l.called=true;var v=document.querySelectorAll("pre code");Array.prototype.forEach.call(v,p)}function a(){addEventListener("DOMContentLoaded",l,false);addEventListener("load",l,false)}var f={};var n={};function d(v,x){var w=f[v]=x(this);if(w.aliases){w.aliases.forEach(function(y){n[y]=v})}}function k(){return Object.keys(f)}function i(v){return f[v]||f[n[v]]}this.highlight=c;this.highlightAuto=e;this.fixMarkup=g;this.highlightBlock=p;this.configure=s;this.initHighlighting=l;this.initHighlightingOnLoad=a;this.registerLanguage=d;this.listLanguages=k;this.getLanguage=i;this.inherit=o;this.IR="[a-zA-Z][a-zA-Z0-9_]*";this.UIR="[a-zA-Z_][a-zA-Z0-9_]*";this.NR="\\b\\d+(\\.\\d+)?";this.CNR="(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)";this.BNR="\\b(0b[01]+)";this.RSR="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~";this.BE={b:"\\\\[\\s\\S]",r:0};this.ASM={cN:"string",b:"'",e:"'",i:"\\n",c:[this.BE]};this.QSM={cN:"string",b:'"',e:'"',i:"\\n",c:[this.BE]};this.PWM={b:/\b(a|an|the|are|I|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such)\b/};this.CLCM={cN:"comment",b:"//",e:"$",c:[this.PWM]};this.CBCM={cN:"comment",b:"/\\*",e:"\\*/",c:[this.PWM]};this.HCM={cN:"comment",b:"#",e:"$",c:[this.PWM]};this.NM={cN:"number",b:this.NR,r:0};this.CNM={cN:"number",b:this.CNR,r:0};this.BNM={cN:"number",b:this.BNR,r:0};this.CSSNM={cN:"number",b:this.NR+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",r:0};this.RM={cN:"regexp",b:/\//,e:/\/[gim]*/,i:/\n/,c:[this.BE,{b:/\[/,e:/\]/,r:0,c:[this.BE]}]};this.TM={cN:"title",b:this.IR,r:0};this.UTM={cN:"title",b:this.UIR,r:0}}();hljs.registerLanguage("coffeescript",function(c){var b={keyword:"in if for while finally new do return else break catch instanceof throw try this switch continue typeof delete debugger super then unless until loop of by when and or is isnt not",literal:"true false null undefined yes no on off",reserved:"case default function var void with const let enum export import native __hasProp __extends __slice __bind __indexOf",built_in:"npm require console print module global window document"};var a="[A-Za-z$_][0-9A-Za-z$_]*";var f=c.inherit(c.TM,{b:a});var e={cN:"subst",b:/#\{/,e:/}/,k:b};var d=[c.BNM,c.inherit(c.CNM,{starts:{e:"(\\s*/)?",r:0}}),{cN:"string",v:[{b:/'''/,e:/'''/,c:[c.BE]},{b:/'/,e:/'/,c:[c.BE]},{b:/"""/,e:/"""/,c:[c.BE,e]},{b:/"/,e:/"/,c:[c.BE,e]}]},{cN:"regexp",v:[{b:"///",e:"///",c:[e,c.HCM]},{b:"//[gim]*",r:0},{b:/\/(?![ *])(\\\/|.)*?\/[gim]*(?=\W|$)/}]},{cN:"property",b:"@"+a},{b:"`",e:"`",eB:true,eE:true,sL:"javascript"}];e.c=d;return{aliases:["coffee","cson","iced"],k:b,i:/\/\*/,c:d.concat([{cN:"comment",b:"###",e:"###"},c.HCM,{cN:"function",b:"(^\\s*|\\B)("+a+"\\s*=\\s*)?(\\(.*\\))?\\s*\\B[-=]>",e:"[-=]>",rB:true,c:[f,{cN:"params",b:"\\([^\\(]",rB:true,c:[{b:/\(/,e:/\)/,k:b,c:["self"].concat(d)}]}]},{cN:"class",bK:"class",e:"$",i:/[:="\[\]]/,c:[{bK:"extends",eW:true,i:/[:="\[\]]/,c:[f]},f]},{cN:"attribute",b:a+":",e:":",rB:true,eE:true,r:0}])}});hljs.registerLanguage("nginx",function(c){var b={cN:"variable",v:[{b:/\$\d+/},{b:/\$\{/,e:/}/},{b:"[\\$\\@]"+c.UIR}]};var a={eW:true,l:"[a-z/_]+",k:{built_in:"on off yes no true false none blocked debug info notice warn error crit select break last permanent redirect kqueue rtsig epoll poll /dev/poll"},r:0,i:"=>",c:[c.HCM,{cN:"string",c:[c.BE,b],v:[{b:/"/,e:/"/},{b:/'/,e:/'/}]},{cN:"url",b:"([a-z]+):/",e:"\\s",eW:true,eE:true,c:[b]},{cN:"regexp",c:[c.BE,b],v:[{b:"\\s\\^",e:"\\s|{|;",rE:true},{b:"~\\*?\\s+",e:"\\s|{|;",rE:true},{b:"\\*(\\.[a-z\\-]+)+"},{b:"([a-z\\-]+\\.)+\\*"}]},{cN:"number",b:"\\b\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(:\\d{1,5})?\\b"},{cN:"number",b:"\\b\\d+[kKmMgGdshdwy]*\\b",r:0},b]};return{aliases:["nginxconf"],c:[c.HCM,{b:c.UIR+"\\s",e:";|{",rB:true,c:[{cN:"title",b:c.UIR,starts:a}],r:0}],i:"[^\\s\\}]"}});hljs.registerLanguage("json",function(a){var e={literal:"true false null"};var d=[a.QSM,a.CNM];var c={cN:"value",e:",",eW:true,eE:true,c:d,k:e};var b={b:"{",e:"}",c:[{cN:"attribute",b:'\\s*"',e:'"\\s*:\\s*',eB:true,eE:true,c:[a.BE],i:"\\n",starts:c}],i:"\\S"};var f={b:"\\[",e:"\\]",c:[a.inherit(c,{cN:null})],i:"\\S"};d.splice(d.length,0,b,f);return{c:d,k:e,i:"\\S"}});hljs.registerLanguage("http",function(a){return{i:"\\S",c:[{cN:"status",b:"^HTTP/[0-9\\.]+",e:"$",c:[{cN:"number",b:"\\b\\d{3}\\b"}]},{cN:"request",b:"^[A-Z]+ (.*?) HTTP/[0-9\\.]+$",rB:true,e:"$",c:[{cN:"string",b:" ",e:" ",eB:true,eE:true}]},{cN:"attribute",b:"^\\w",e:": ",eE:true,i:"\\n|\\s|=",starts:{cN:"string",e:"$"}},{b:"\\n\\n",starts:{sL:"",eW:true}}]}});hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBCM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBCM,a.RM,{b:/;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:true,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBCM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}});hljs.registerLanguage("sql",function(a){var b={cN:"comment",b:"--",e:"$"};return{cI:true,i:/[<>]/,c:[{cN:"operator",bK:"begin end start commit rollback savepoint lock alter create drop rename call delete do handler insert load replace select truncate update set show pragma grant merge describe use explain help declare prepare execute deallocate savepoint release unlock purge reset change stop analyze cache flush optimize repair kill install uninstall checksum restore check backup",e:/;/,eW:true,k:{keyword:"abs absolute acos action add adddate addtime aes_decrypt aes_encrypt after aggregate all allocate alter analyze and any are as asc ascii asin assertion at atan atan2 atn2 authorization authors avg backup before begin benchmark between bin binlog bit_and bit_count bit_length bit_or bit_xor both by cache call cascade cascaded case cast catalog ceil ceiling chain change changed char_length character_length charindex charset check checksum checksum_agg choose close coalesce coercibility collate collation collationproperty column columns columns_updated commit compress concat concat_ws concurrent connect connection connection_id consistent constraint constraints continue contributors conv convert convert_tz corresponding cos cot count count_big crc32 create cross cume_dist curdate current current_date current_time current_timestamp current_user cursor curtime data database databases datalength date_add date_format date_sub dateadd datediff datefromparts datename datepart datetime2fromparts datetimeoffsetfromparts day dayname dayofmonth dayofweek dayofyear deallocate declare decode default deferrable deferred degrees delayed delete des_decrypt des_encrypt des_key_file desc describe descriptor diagnostics difference disconnect distinct distinctrow div do domain double drop dumpfile each else elt enclosed encode encrypt end end-exec engine engines eomonth errors escape escaped event eventdata events except exception exec execute exists exp explain export_set extended external extract fast fetch field fields find_in_set first first_value floor flush for force foreign format found found_rows from from_base64 from_days from_unixtime full function get get_format get_lock getdate getutcdate global go goto grant grants greatest group group_concat grouping grouping_id gtid_subset gtid_subtract handler having help hex high_priority hosts hour ident_current ident_incr ident_seed identified identity if ifnull ignore iif ilike immediate in index indicator inet6_aton inet6_ntoa inet_aton inet_ntoa infile initially inner innodb input insert install instr intersect into is is_free_lock is_ipv4 is_ipv4_compat is_ipv4_mapped is_not is_not_null is_used_lock isdate isnull isolation join key kill language last last_day last_insert_id last_value lcase lead leading least leaves left len lenght level like limit lines ln load load_file local localtime localtimestamp locate lock log log10 log2 logfile logs low_priority lower lpad ltrim make_set makedate maketime master master_pos_wait match matched max md5 medium merge microsecond mid min minute mod mode module month monthname mutex name_const names national natural nchar next no no_write_to_binlog not now nullif nvarchar oct octet_length of old_password on only open optimize option optionally or ord order outer outfile output pad parse partial partition password patindex percent_rank percentile_cont percentile_disc period_add period_diff pi plugin position pow power pragma precision prepare preserve primary prior privileges procedure procedure_analyze processlist profile profiles public publishingservername purge quarter query quick quote quotename radians rand read references regexp relative relaylog release release_lock rename repair repeat replace replicate reset restore restrict return returns reverse revoke right rlike rollback rollup round row row_count rows rpad rtrim savepoint schema scroll sec_to_time second section select serializable server session session_user set sha sha1 sha2 share show sign sin size slave sleep smalldatetimefromparts snapshot some soname soundex sounds_like space sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sql_variant_property sqlstate sqrt square start starting status std stddev stddev_pop stddev_samp stdev stdevp stop str str_to_date straight_join strcmp string stuff subdate substr substring subtime subtring_index sum switchoffset sysdate sysdatetime sysdatetimeoffset system_user sysutcdatetime table tables tablespace tan temporary terminated tertiary_weights then time time_format time_to_sec timediff timefromparts timestamp timestampadd timestampdiff timezone_hour timezone_minute to to_base64 to_days to_seconds todatetimeoffset trailing transaction translation trigger trigger_nestlevel triggers trim truncate try_cast try_convert try_parse ucase uncompress uncompressed_length unhex unicode uninstall union unique unix_timestamp unknown unlock update upgrade upped upper usage use user user_resources using utc_date utc_time utc_timestamp uuid uuid_short validate_password_strength value values var var_pop var_samp variables variance varp version view warnings week weekday weekofyear weight_string when whenever where with work write xml xor year yearweek zon",literal:"true false null",built_in:"array bigint binary bit blob boolean char character date dec decimal float int integer interval number numeric real serial smallint varchar varying int8 serial8 text"},c:[{cN:"string",b:"'",e:"'",c:[a.BE,{b:"''"}]},{cN:"string",b:'"',e:'"',c:[a.BE,{b:'""'}]},{cN:"string",b:"`",e:"`",c:[a.BE]},a.CNM,a.CBCM,b]},a.CBCM,b]}});hljs.registerLanguage("php",function(b){var e={cN:"variable",b:"(\\$|->)+[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*"};var a={cN:"preprocessor",b:/<\?(php)?|\?>/};var c={cN:"string",c:[b.BE,a],v:[{b:'b"',e:'"'},{b:"b'",e:"'"},b.inherit(b.ASM,{i:null}),b.inherit(b.QSM,{i:null})]};var d={v:[b.BNM,b.CNM]};return{aliases:["php3","php4","php5","php6"],cI:true,k:"and include_once list abstract global private echo interface as static endswitch array null if endwhile or const for endforeach self var while isset public protected exit foreach throw elseif include __FILE__ empty require_once do xor return parent clone use __CLASS__ __LINE__ else break print eval new catch __METHOD__ case exception default die require __FUNCTION__ enddeclare final try switch continue endfor endif declare unset true false trait goto instanceof insteadof __DIR__ __NAMESPACE__ yield finally",c:[b.CLCM,b.HCM,{cN:"comment",b:"/\\*",e:"\\*/",c:[{cN:"phpdoc",b:"\\s@[A-Za-z]+"},a]},{cN:"comment",b:"__halt_compiler.+?;",eW:true,k:"__halt_compiler",l:b.UIR},{cN:"string",b:"<<<['\"]?\\w+['\"]?$",e:"^\\w+;",c:[b.BE]},a,e,{cN:"function",bK:"function",e:/[;{]/,eE:true,i:"\\$|\\[|%",c:[b.UTM,{cN:"params",b:"\\(",e:"\\)",c:["self",e,b.CBCM,c,d]}]},{cN:"class",bK:"class interface",e:"{",eE:true,i:/[:\(\$"]/,c:[{bK:"extends implements"},b.UTM]},{bK:"namespace",e:";",i:/[\.']/,c:[b.UTM]},{bK:"use",e:";",c:[b.UTM]},{b:"=>"},c,d]}});hljs.registerLanguage("makefile",function(a){var b={cN:"variable",b:/\$\(/,e:/\)/,c:[a.BE]};return{aliases:["mk","mak"],c:[a.HCM,{b:/^\w+\s*\W*=/,rB:true,r:0,starts:{cN:"constant",e:/\s*\W*=/,eE:true,starts:{e:/$/,r:0,c:[b]}}},{cN:"title",b:/^[\w]+:\s*$/},{cN:"phony",b:/^\.PHONY:/,e:/$/,k:".PHONY",l:/[\.\w]+/},{b:/^\t+/,e:/$/,r:0,c:[a.QSM,b]}]}});hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}});hljs.registerLanguage("cpp",function(a){var b={keyword:"false int float while private char catch export virtual operator sizeof dynamic_cast|10 typedef const_cast|10 const struct for static_cast|10 union namespace unsigned long throw volatile static protected bool template mutable if public friend do return goto auto void enum else break new extern using true class asm case typeid short reinterpret_cast|10 default double register explicit signed typename try this switch continue wchar_t inline delete alignof char16_t char32_t constexpr decltype noexcept nullptr static_assert thread_local restrict _Bool complex _Complex _Imaginary",built_in:"std string cin cout cerr clog stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap array shared_ptr abort abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf"};return{aliases:["c","h","c++","h++"],k:b,i:""]',k:"include",i:"\\n"},a.CLCM]},{cN:"stl_container",b:"\\b(deque|list|queue|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array)\\s*<",e:">",k:b,c:["self"]},{b:a.IR+"::"}]}});hljs.registerLanguage("perl",function(c){var d="getpwent getservent quotemeta msgrcv scalar kill dbmclose undef lc ma syswrite tr send umask sysopen shmwrite vec qx utime local oct semctl localtime readpipe do return format read sprintf dbmopen pop getpgrp not getpwnam rewinddir qqfileno qw endprotoent wait sethostent bless s|0 opendir continue each sleep endgrent shutdown dump chomp connect getsockname die socketpair close flock exists index shmgetsub for endpwent redo lstat msgctl setpgrp abs exit select print ref gethostbyaddr unshift fcntl syscall goto getnetbyaddr join gmtime symlink semget splice x|0 getpeername recv log setsockopt cos last reverse gethostbyname getgrnam study formline endhostent times chop length gethostent getnetent pack getprotoent getservbyname rand mkdir pos chmod y|0 substr endnetent printf next open msgsnd readdir use unlink getsockopt getpriority rindex wantarray hex system getservbyport endservent int chr untie rmdir prototype tell listen fork shmread ucfirst setprotoent else sysseek link getgrgid shmctl waitpid unpack getnetbyname reset chdir grep split require caller lcfirst until warn while values shift telldir getpwuid my getprotobynumber delete and sort uc defined srand accept package seekdir getprotobyname semop our rename seek if q|0 chroot sysread setpwent no crypt getc chown sqrt write setnetent setpriority foreach tie sin msgget map stat getlogin unless elsif truncate exec keys glob tied closedirioctl socket readlink eval xor readline binmode setservent eof ord bind alarm pipe atan2 getgrent exp time push setgrent gt lt or ne m|0 break given say state when";var f={cN:"subst",b:"[$@]\\{",e:"\\}",k:d};var g={b:"->{",e:"}"};var a={cN:"variable",v:[{b:/\$\d/},{b:/[\$\%\@](\^\w\b|#\w+(\:\:\w+)*|{\w+}|\w+(\:\:\w*)*)/},{b:/[\$\%\@][^\s\w{]/,r:0}]};var e={cN:"comment",b:"^(__END__|__DATA__)",e:"\\n$",r:5};var h=[c.BE,f,a];var b=[a,c.HCM,e,{cN:"comment",b:"^\\=\\w",e:"\\=cut",eW:true},g,{cN:"string",c:h,v:[{b:"q[qwxr]?\\s*\\(",e:"\\)",r:5},{b:"q[qwxr]?\\s*\\[",e:"\\]",r:5},{b:"q[qwxr]?\\s*\\{",e:"\\}",r:5},{b:"q[qwxr]?\\s*\\|",e:"\\|",r:5},{b:"q[qwxr]?\\s*\\<",e:"\\>",r:5},{b:"qw\\s+q",e:"q",r:5},{b:"'",e:"'",c:[c.BE]},{b:'"',e:'"'},{b:"`",e:"`",c:[c.BE]},{b:"{\\w+}",c:[],r:0},{b:"-?\\w+\\s*\\=\\>",c:[],r:0}]},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{b:"(\\/\\/|"+c.RSR+"|\\b(split|return|print|reverse|grep)\\b)\\s*",k:"split return print reverse grep",r:0,c:[c.HCM,e,{cN:"regexp",b:"(s|tr|y)/(\\\\.|[^/])*/(\\\\.|[^/])*/[a-z]*",r:10},{cN:"regexp",b:"(m|qr)?/",e:"/[a-z]*",c:[c.BE],r:0}]},{cN:"sub",bK:"sub",e:"(\\s*\\(.*?\\))?[;{]",r:5},{cN:"operator",b:"-\\w\\b",r:0}];f.c=b;g.c=b;return{aliases:["pl"],k:d,c:b}});hljs.registerLanguage("ini",function(a){return{cI:true,i:/\S/,c:[{cN:"comment",b:";",e:"$"},{cN:"title",b:"^\\[",e:"\\]"},{cN:"setting",b:"^[a-z0-9\\[\\]_-]+[ \\t]*=[ \\t]*",e:"$",c:[{cN:"value",eW:true,k:"on off true false yes no",c:[a.QSM,a.NM],r:0}]}]}});hljs.registerLanguage("apache",function(a){var b={cN:"number",b:"[\\$%]\\d+"};return{aliases:["apacheconf"],cI:true,c:[a.HCM,{cN:"tag",b:""},{cN:"keyword",b:/\w+/,r:0,k:{common:"order deny allow setenv rewriterule rewriteengine rewritecond documentroot sethandler errordocument loadmodule options header listen serverroot servername"},starts:{e:/$/,r:0,k:{literal:"on off all"},c:[{cN:"sqbracket",b:"\\s\\[",e:"\\]$"},{cN:"cbracket",b:"[\\$%]\\{",e:"\\}",c:["self",b]},b,a.QSM]}}],i:/\S/}});hljs.registerLanguage("java",function(c){var b=c.UIR+"(<"+c.UIR+">)?";var a="false synchronized int abstract float private char boolean static null if const for true while long throw strictfp finally protected import native final return void enum else break transient new catch instanceof byte super volatile case assert short package default double public try this switch continue throws protected public private";return{aliases:["jsp"],k:a,i:/<\//,c:[{cN:"javadoc",b:"/\\*\\*",e:"\\*/",r:0,c:[{cN:"javadoctag",b:"(^|\\s)@[A-Za-z]+"}]},c.CLCM,c.CBCM,c.ASM,c.QSM,{cN:"class",bK:"class interface",e:/[{;=]/,eE:true,k:"class interface",i:/[:"\[\]]/,c:[{bK:"extends implements"},c.UTM]},{bK:"new",e:/\s/,r:0},{cN:"function",b:"("+b+"\\s+)+"+c.UIR+"\\s*\\(",rB:true,e:/[{;=]/,eE:true,k:a,c:[{b:c.UIR+"\\s*\\(",rB:true,c:[c.UTM]},{cN:"params",b:/\(/,e:/\)/,k:a,c:[c.ASM,c.QSM,c.CNM,c.CBCM]},c.CLCM,c.CBCM]},c.CNM,{cN:"annotation",b:"@[A-Za-z]+"}]}});hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:true,c:[{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"title",b:/[^ \/><\n\t]+/,r:0},b]}]}});hljs.registerLanguage("markdown",function(a){return{aliases:["md","mkdown","mkd"],c:[{cN:"header",v:[{b:"^#{1,6}",e:"$"},{b:"^.+?\\n[=-]{2,}$"}]},{b:"<",e:">",sL:"xml",r:0},{cN:"bullet",b:"^([*+-]|(\\d+\\.))\\s+"},{cN:"strong",b:"[*_]{2}.+?[*_]{2}"},{cN:"emphasis",v:[{b:"\\*.+?\\*"},{b:"_.+?_",r:0}]},{cN:"blockquote",b:"^>\\s+",e:"$"},{cN:"code",v:[{b:"`.+?`"},{b:"^( {4}|\t)",e:"$",r:0}]},{cN:"horizontal_rule",b:"^[-\\*]{3,}",e:"$"},{b:"\\[.+?\\][\\(\\[].*?[\\)\\]]",rB:true,c:[{cN:"link_label",b:"\\[",e:"\\]",eB:true,rE:true,r:0},{cN:"link_url",b:"\\]\\(",e:"\\)",eB:true,eE:true},{cN:"link_reference",b:"\\]\\[",e:"\\]",eB:true,eE:true}],r:10},{b:"^\\[.+\\]:",rB:true,c:[{cN:"link_reference",b:"\\[",e:"\\]:",eB:true,eE:true,starts:{cN:"link_url",e:"$"}}]}]}});hljs.registerLanguage("cs",function(c){var b="abstract as base bool break byte case catch char checked const continue decimal default delegate do double else enum event explicit extern false finally fixed float for foreach goto if implicit in int interface internal is lock long new null object operator out override params private protected public readonly ref return sbyte sealed short sizeof stackalloc static string struct switch this throw true try typeof uint ulong unchecked unsafe ushort using virtual volatile void while async await protected public private internal ascending descending from get group into join let orderby partial select set value var where yield";var a=c.IR+"(<"+c.IR+">)?";return{aliases:["csharp"],k:b,i:/::/,c:[{cN:"comment",b:"///",e:"$",rB:true,c:[{cN:"xmlDocTag",v:[{b:"///",r:0},{b:""},{b:""}]}]},c.CLCM,c.CBCM,{cN:"preprocessor",b:"#",e:"$",k:"if else elif endif define undef warning error line region endregion pragma checksum"},{cN:"string",b:'@"',e:'"',c:[{b:'""'}]},c.ASM,c.QSM,c.CNM,{bK:"class namespace interface",e:/[{;=]/,i:/[^\s:]/,c:[c.TM,c.CLCM,c.CBCM]},{bK:"new",e:/\s/,r:0},{cN:"function",b:"("+a+"\\s+)+"+c.IR+"\\s*\\(",rB:true,e:/[{;=]/,eE:true,k:b,c:[{b:c.IR+"\\s*\\(",rB:true,c:[c.TM]},{cN:"params",b:/\(/,e:/\)/,k:b,c:[c.ASM,c.QSM,c.CNM,c.CBCM]},c.CLCM,c.CBCM]}]}});hljs.registerLanguage("ruby",function(f){var j="[a-zA-Z_]\\w*[!?=]?|[-+~]\\@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?";var i="and false then defined module in return redo if BEGIN retry end for true self when next until do begin unless END rescue nil else break undef not super class case require yield alias while ensure elsif or include attr_reader attr_writer attr_accessor";var b={cN:"yardoctag",b:"@[A-Za-z]+"};var c={cN:"value",b:"#<",e:">"};var k={cN:"comment",v:[{b:"#",e:"$",c:[b]},{b:"^\\=begin",e:"^\\=end",c:[b],r:10},{b:"^__END__",e:"\\n$"}]};var d={cN:"subst",b:"#\\{",e:"}",k:i};var e={cN:"string",c:[f.BE,d],v:[{b:/'/,e:/'/},{b:/"/,e:/"/},{b:"%[qw]?\\(",e:"\\)"},{b:"%[qw]?\\[",e:"\\]"},{b:"%[qw]?{",e:"}"},{b:"%[qw]?<",e:">"},{b:"%[qw]?/",e:"/"},{b:"%[qw]?%",e:"%"},{b:"%[qw]?-",e:"-"},{b:"%[qw]?\\|",e:"\\|"},{b:/\B\?(\\\d{1,3}|\\x[A-Fa-f0-9]{1,2}|\\u[A-Fa-f0-9]{4}|\\?\S)\b/}]};var a={cN:"params",b:"\\(",e:"\\)",k:i};var h=[e,c,k,{cN:"class",bK:"class module",e:"$|;",i:/=/,c:[f.inherit(f.TM,{b:"[A-Za-z_]\\w*(::\\w+)*(\\?|\\!)?"}),{cN:"inheritance",b:"<\\s*",c:[{cN:"parent",b:"("+f.IR+"::)?"+f.IR}]},k]},{cN:"function",bK:"def",e:" |$|;",r:0,c:[f.inherit(f.TM,{b:j}),a,k]},{cN:"constant",b:"(::)?(\\b[A-Z]\\w*(::)?)+",r:0},{cN:"symbol",b:f.UIR+"(\\!|\\?)?:",r:0},{cN:"symbol",b:":",c:[e,{b:j}],r:0},{cN:"number",b:"(\\b0[0-7_]+)|(\\b0x[0-9a-fA-F_]+)|(\\b[1-9][0-9_]*(\\.[0-9_]+)?)|[0_]\\b",r:0},{cN:"variable",b:"(\\$\\W)|((\\$|\\@\\@?)(\\w+))"},{b:"("+f.RSR+")\\s*",c:[c,k,{cN:"regexp",c:[f.BE,d],i:/\n/,v:[{b:"/",e:"/[a-z]*"},{b:"%r{",e:"}[a-z]*"},{b:"%r\\(",e:"\\)[a-z]*"},{b:"%r!",e:"![a-z]*"},{b:"%r\\[",e:"\\][a-z]*"}]}],r:0}];d.c=h;a.c=h;var g=[{b:/^\s*=>/,cN:"status",starts:{e:"$",c:h}},{cN:"prompt",b:/^\S[^=>\n]*>+/,starts:{e:"$",c:h}}];return{aliases:["rb","gemspec","podspec","thor","irb"],k:i,c:[k].concat(g).concat(h)}});hljs.registerLanguage("diff",function(a){return{aliases:["patch"],c:[{cN:"chunk",r:10,v:[{b:/^\@\@ +\-\d+,\d+ +\+\d+,\d+ +\@\@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}});hljs.registerLanguage("objectivec",function(a){var d={keyword:"int float while char export sizeof typedef const struct for union unsigned long volatile static bool mutable if do return goto void enum else break extern asm case short default double register explicit signed typename this switch continue wchar_t inline readonly assign readwrite self @synchronized id typeof nonatomic super unichar IBOutlet IBAction strong weak copy in out inout bycopy byref oneway __strong __weak __block __autoreleasing @private @protected @public @try @property @end @throw @catch @finally @autoreleasepool @synthesize @dynamic @selector @optional @required",literal:"false true FALSE TRUE nil YES NO NULL",built_in:"NSString NSData NSDictionary CGRect CGPoint UIButton UILabel UITextView UIWebView MKMapView NSView NSViewController NSWindow NSWindowController NSSet NSUUID NSIndexSet UISegmentedControl NSObject UITableViewDelegate UITableViewDataSource NSThread UIActivityIndicator UITabbar UIToolBar UIBarButtonItem UIImageView NSAutoreleasePool UITableView BOOL NSInteger CGFloat NSException NSLog NSMutableString NSMutableArray NSMutableDictionary NSURL NSIndexPath CGSize UITableViewCell UIView UIViewController UINavigationBar UINavigationController UITabBarController UIPopoverController UIPopoverControllerDelegate UIImage NSNumber UISearchBar NSFetchedResultsController NSFetchedResultsChangeType UIScrollView UIScrollViewDelegate UIEdgeInsets UIColor UIFont UIApplication NSNotFound NSNotificationCenter NSNotification UILocalNotification NSBundle NSFileManager NSTimeInterval NSDate NSCalendar NSUserDefaults UIWindow NSRange NSArray NSError NSURLRequest NSURLConnection NSURLSession NSURLSessionDataTask NSURLSessionDownloadTask NSURLSessionUploadTask NSURLResponseUIInterfaceOrientation MPMoviePlayerController dispatch_once_t dispatch_queue_t dispatch_sync dispatch_async dispatch_once"};var c=/[a-zA-Z@][a-zA-Z0-9_]*/;var b="@interface @class @protocol @implementation";return{aliases:["m","mm","objc","obj-c"],k:d,l:c,i:""}]}]},{cN:"class",b:"("+b.split(" ").join("|")+")\\b",e:"({|$)",eE:true,k:b,l:c,c:[a.UTM]},{cN:"variable",b:"\\."+a.UIR,r:0}]}});hljs.registerLanguage("css",function(a){var b="[a-zA-Z-][a-zA-Z0-9_-]*";var c={cN:"function",b:b+"\\(",rB:true,eE:true,e:"\\("};return{cI:true,i:"[=/|']",c:[a.CBCM,{cN:"id",b:"\\#[A-Za-z0-9_-]+"},{cN:"class",b:"\\.[A-Za-z0-9_-]+",r:0},{cN:"attr_selector",b:"\\[",e:"\\]",i:"$"},{cN:"pseudo",b:":(:)?[a-zA-Z0-9\\_\\-\\+\\(\\)\\\"\\']+"},{cN:"at_rule",b:"@(font-face|page)",l:"[a-z-]+",k:"font-face page"},{cN:"at_rule",b:"@",e:"[{;]",c:[{cN:"keyword",b:/\S+/},{b:/\s/,eW:true,eE:true,r:0,c:[c,a.ASM,a.QSM,a.CSSNM]}]},{cN:"tag",b:b,r:0},{cN:"rules",b:"{",e:"}",i:"[^\\s]",r:0,c:[a.CBCM,{cN:"rule",b:"[^\\s]",rB:true,e:";",eW:true,c:[{cN:"attribute",b:"[A-Z\\_\\.\\-]+",e:":",eE:true,i:"[^\\s]",starts:{cN:"value",eW:true,eE:true,c:[c,a.CSSNM,a.QSM,a.ASM,a.CBCM,{cN:"hexcolor",b:"#[0-9A-Fa-f]+"},{cN:"important",b:"!important"}]}}]}]}]}});hljs.registerLanguage("python",function(a){var f={cN:"prompt",b:/^(>>>|\.\.\.) /};var b={cN:"string",c:[a.BE],v:[{b:/(u|b)?r?'''/,e:/'''/,c:[f],r:10},{b:/(u|b)?r?"""/,e:/"""/,c:[f],r:10},{b:/(u|r|ur)'/,e:/'/,r:10},{b:/(u|r|ur)"/,e:/"/,r:10},{b:/(b|br)'/,e:/'/},{b:/(b|br)"/,e:/"/},a.ASM,a.QSM]};var d={cN:"number",r:0,v:[{b:a.BNR+"[lLjJ]?"},{b:"\\b(0o[0-7]+)[lLjJ]?"},{b:a.CNR+"[lLjJ]?"}]};var e={cN:"params",b:/\(/,e:/\)/,c:["self",f,d,b]};var c={e:/:/,i:/[${=;\n]/,c:[a.UTM,e]};return{aliases:["py","gyp"],k:{keyword:"and elif is global as in if from raise for except finally print import pass return exec else break not with class assert yield try while continue del or def lambda nonlocal|10 None True False",built_in:"Ellipsis NotImplemented"},i:/(<\/|->|\?)/,c:[f,d,b,a.HCM,a.inherit(c,{cN:"function",bK:"def",r:10}),a.inherit(c,{cN:"class",bK:"class"}),{cN:"decorator",b:/@/,e:/$/},{b:/\b(print|exec)\(/}]}}); +hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:true,c:[{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"title",b:/[^ \/><\n\t]+/,r:0},b]}]}}); hljs.registerLanguage("scala",function(d){var b={cN:"annotation",b:"@[A-Za-z]+"};var c={cN:"string",b:'u?r?"""',e:'"""',r:10};var a={cN:"symbol",b:"'\\w[\\w\\d_]*(?!')"};var e={cN:"type",b:"\\b[A-Z][A-Za-z0-9_]*",r:0};var h={cN:"title",b:/[^0-9\n\t "'(),.`{}\[\]:;][^\n\t "'(),.`{}\[\]:;]+|[^0-9\n\t "'(),.`{}\[\]:;=]/,r:0};var i={cN:"class",bK:"class object trait type",e:/[:={\[(\n;]/,c:[{cN:"keyword",bK:"extends with",r:10},h]};var g={cN:"function",bK:"def val",e:/[:={\[(\n;]/,c:[h]};var f={cN:"javadoc",b:"/\\*\\*",e:"\\*/",c:[{cN:"javadoctag",b:"@[A-Za-z]+"}],r:10};return{k:{literal:"true false null",keyword:"type yield lazy override def with val var sealed abstract private trait object if forSome for while throw finally protected extends import final return else break new catch super class case package default try this match continue throws implicit"},c:[d.CLCM,d.CBCM,c,d.QSM,a,e,g,i,d.CNM,b]}}); hljs.registerLanguage("javascript",function(a){return{aliases:["js"],k:{keyword:"in if for while finally var new function do return void else break catch instanceof with throw case default try this switch continue typeof delete let yield const class",literal:"true false null undefined NaN Infinity",built_in:"eval isFinite isNaN parseFloat parseInt decodeURI decodeURIComponent encodeURI encodeURIComponent escape unescape Object Function Boolean Error EvalError InternalError RangeError ReferenceError StopIteration SyntaxError TypeError URIError Number Math Date String RegExp Array Float32Array Float64Array Int16Array Int32Array Int8Array Uint16Array Uint32Array Uint8Array Uint8ClampedArray ArrayBuffer DataView JSON Intl arguments require module console window document"},c:[{cN:"pi",b:/^\s*('|")use strict('|")/,r:10},a.ASM,a.QSM,a.CLCM,a.CBCM,a.CNM,{b:"("+a.RSR+"|\\b(case|return|throw)\\b)\\s*",k:"return throw case",c:[a.CLCM,a.CBCM,a.RM,{b:/;/,r:0,sL:"xml"}],r:0},{cN:"function",bK:"function",e:/\{/,eE:true,c:[a.inherit(a.TM,{b:/[A-Za-z$_][0-9A-Za-z$_]*/}),{cN:"params",b:/\(/,e:/\)/,c:[a.CLCM,a.CBCM],i:/["'\(]/}],i:/\[|%/},{b:/\$[(.]/},{b:"\\."+a.IR,r:0}]}}); -hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}}); hljs.registerLanguage("diff",function(a){return{aliases:["patch"],c:[{cN:"chunk",r:10,v:[{b:/^\@\@ +\-\d+,\d+ +\+\d+,\d+ +\@\@$/},{b:/^\*\*\* +\d+,\d+ +\*\*\*\*$/},{b:/^\-\-\- +\d+,\d+ +\-\-\-\-$/}]},{cN:"header",v:[{b:/Index: /,e:/$/},{b:/=====/,e:/=====$/},{b:/^\-\-\-/,e:/$/},{b:/^\*{3} /,e:/$/},{b:/^\+\+\+/,e:/$/},{b:/\*{5}/,e:/\*{5}$/}]},{cN:"addition",b:"^\\+",e:"$"},{cN:"deletion",b:"^\\-",e:"$"},{cN:"change",b:"^\\!",e:"$"}]}}); -hljs.registerLanguage("xml",function(a){var c="[A-Za-z0-9\\._:-]+";var d={b:/<\?(php)?(?!\w)/,e:/\?>/,sL:"php",subLanguageMode:"continuous"};var b={eW:true,i:/]+/}]}]}]};return{aliases:["html","xhtml","rss","atom","xsl","plist"],cI:true,c:[{cN:"doctype",b:"",r:10,c:[{b:"\\[",e:"\\]"}]},{cN:"comment",b:"",r:10},{cN:"cdata",b:"<\\!\\[CDATA\\[",e:"\\]\\]>",r:10},{cN:"tag",b:"|$)",e:">",k:{title:"style"},c:[b],starts:{e:"",rE:true,sL:"css"}},{cN:"tag",b:"|$)",e:">",k:{title:"script"},c:[b],starts:{e:"<\/script>",rE:true,sL:"javascript"}},{b:"<%",e:"%>",sL:"vbscript"},d,{cN:"pi",b:/<\?\w+/,e:/\?>/,r:10},{cN:"tag",b:"",c:[{cN:"title",b:/[^ \/><\n\t]+/,r:0},b]}]}}); +hljs.registerLanguage("bash",function(b){var a={cN:"variable",v:[{b:/\$[\w\d#@][\w\d_]*/},{b:/\$\{(.*?)\}/}]};var d={cN:"string",b:/"/,e:/"/,c:[b.BE,a,{cN:"variable",b:/\$\(/,e:/\)/,c:[b.BE]}]};var c={cN:"string",b:/'/,e:/'/};return{aliases:["sh","zsh"],l:/-?[a-z\.]+/,k:{keyword:"if then else elif fi for break continue while in do done exit return set declare case esac export exec",literal:"true false",built_in:"printf echo read cd pwd pushd popd dirs let eval unset typeset readonly getopts source shopt caller type hash bind help sudo",operator:"-ne -eq -lt -gt -f -d -e -s -l -a"},c:[{cN:"shebang",b:/^#![^\n]+sh\s*$/,r:10},{cN:"function",b:/\w[\w\d_]*\s*\(\s*\)\s*\{/,rB:true,c:[b.inherit(b.TM,{b:/\w[\w\d_]*/})],r:0},b.HCM,b.NM,d,c,a]}}); +(function(){'use strict';function aa(){return function(a){return a}}function ba(){return function(){}}function da(a){return function(b){this[a]=b}}function c(a){return function(){return this[a]}}function h(a){return function(){return a}}var l,ea="object"===typeof __ScalaJSEnv&&__ScalaJSEnv?__ScalaJSEnv:{},m="object"===typeof ea.global&&ea.global?ea.global:"object"===typeof global&&global&&global.Object===Object?global:this;ea.global=m;var fa="object"===typeof ea.exportsNamespace&&ea.exportsNamespace?ea.exportsNamespace:m; +ea.exportsNamespace=fa;m.Object.freeze(ea);var ga=0;function ha(a){return function(b,d){return!(!b||!b.a||b.a.Qh!==d||b.a.Oh!==a)}}function ia(a){var b,d;for(d in a)b=d;return b}function p(a,b){return ja(a,b,0)}function ja(a,b,d){var e=new a.ek(b[d]);if(d>24===b&&1/b!==1/-0?q(na):b<<16>>16===b&&1/b!==1/-0?q(oa):q(pa):a!==a||qa(a)===a?q(ra):q(sa);case "boolean":return q(ta);case "undefined":return q(ua);default:if(null===a)throw(new va).b();return wa(a)?q(xa):a&&a.a?q(a.a):null}}function ya(a,b){return a&&a.a||null===a?a.K(b):"number"===typeof a?"number"===typeof b&&(a===b?0!==a||1/a===1/b:a!==a&&b!==b):a===b} +function za(a){switch(typeof a){case "string":return Aa(Ba(),a);case "number":return Ca(Da(),a);case "boolean":return a?1231:1237;case "undefined":return 0;default:return a&&a.a||null===a?a.M():42}}function Ea(a,b,d){return"string"===typeof a?a.substring(b,d):a.Dp(b,d)}function Fa(a,b,d,e,f){a=a.d;d=d.d;if(a!==d||e>>16&65535)*e+d*(b>>>16&65535)<<16>>>0)|0},qa=m.Math.fround||function(a){return+a};var gb=new s({uf:0},!0,"upickle.Js$Value",{uf:1});function hb(){}function t(){}t.prototype=hb.prototype;hb.prototype.b=function(){return this};hb.prototype.K=function(a){return this===a};hb.prototype.o=function(){var a=ib(la(this)),b=(+(this.M()>>>0)).toString(16);return a+"@"+b};hb.prototype.M=function(){return Ga(this)};hb.prototype.toString=function(){return this.o()};function jb(a,b){var d=a&&a.a;if(d){var e=d.Qh||0;return!(eb||!d.Oh.isPrimitive)}return!1} +var u=new s({c:0},!1,"java.lang.Object",{c:1},void 0,function(a){return null!==a},jb);hb.prototype.a=u;function kb(){this.$j=this.pl=null}kb.prototype=new t;kb.prototype.b=function(){lb=this;var a=(new mb).h("^[a-z][\\w0-9-]*$"),b=x();this.pl=nb(a.f,b);a=(new mb).h("^[a-zA-Z_:][-a-zA-Z0-9_:.]*$");b=x();this.$j=nb(a.f,b);return this};kb.prototype.a=new s({wq:0},!1,"scalatags.Escaping$",{wq:1,c:1});var lb=void 0;function ob(){lb||(lb=(new kb).b());return lb}function qb(){this.oE=this.wk=null} +qb.prototype=new t;qb.prototype.b=function(){rb=this;this.wk=(new sb).b();this.oE=(new tb).b();return this};qb.prototype.a=new s({Pq:0},!1,"scalatags.generic.Namespace$",{Pq:1,c:1});var rb=void 0;function ub(){rb||(rb=(new qb).b());return rb}function vb(a){var b=(new wb).$d((new z).b());a.al(b.Cb(a.Eb,"auto"))} +function xb(a){var b=(new z).b();a.Co(A(new B,a,"start",b));b=(new z).b();a.yo(A(new B,a,"end",b));b=(new z).b();a.Ao(A(new B,a,"left",b));b=(new z).b();a.Bo(A(new B,a,"right",b));b=(new z).b();a.xo(A(new B,a,"center",b));b=(new z).b();a.zo(A(new B,a,"justify",b))}function yb(){this.W=this.yb=null}yb.prototype=new t; +function zb(a){var b=ub().wk,d=ob();if(!Ab(Bb(d.pl,a.yb)))throw(new Cb).h(Db((new Eb).La((new C).A(["Illegal tag name: "," is not a valid XML tag name"])),(new C).A([a.yb])));a.W;return Fb(new Gb,a.yb,x(),!0,b)}function D(a){var b=ub().wk,d=ob();if(!Ab(Bb(d.pl,a.yb)))throw(new Cb).h(Db((new Eb).La((new C).A(["Illegal tag name: "," is not a valid XML tag name"])),(new C).A([a.yb])));a.W;return Fb(new Gb,a.yb,x(),!1,b)}function Hb(a){return(new E).ia(Ib(Jb(),a.yb),a.yb)} +function F(a,b){var d=new yb;d.yb=b;if(null===a)throw G(H(),null);d.W=a;return d}function I(a){var b=ob();if(!Ab(Bb(b.$j,a.yb)))throw(new Cb).h(Db((new Eb).La((new C).A(["Illegal attribute name: "," is not a valid XML attribute name"])),(new C).A([a.yb])));return(new Lb).h(a.yb)}yb.prototype.a=new s({qr:0},!1,"scalatags.generic.Util$ExtendedString",{qr:1,c:1});function Mb(){}Mb.prototype=new t; +function Ib(a,b){function d(a){var b=65535&(a.charCodeAt(0)|0),b=Nb(Ob(),b),b=m.String.fromCharCode(b);a=(new mb).h(a);var d=a.f.length|0;return""+b+Pb(Qb(),a.f,1,d)}var e=Rb(Ba(),b,"-",0),f=J().N.$e();f.Ta(e.d.length);f.Ka((new Sb).me(e));if((f=f.pa())&&f.a&&f.a.t.el)e=f.Jf,f=f.Cd;else throw(new K).w(f);var g=J().N;if(g===J().N)if(f===x())f=x();else{for(var g=f.u(),k=g=Tb(new Ub,d(g),x()),f=f.s();f!==x();)var n=f.u(),n=Tb(new Ub,d(n),x()),k=k.Cd=n,f=f.s();f=g}else{for(g=Vb(f,g);!f.m();)k=f.u(),g.Da(d(k)), +f=f.s();f=g.pa()}return L(Tb(new Ub,e,f),"","","")}Mb.prototype.a=new s({tr:0},!1,"scalatags.package$",{tr:1,c:1});var Wb=void 0;function Jb(){Wb||(Wb=(new Mb).b());return Wb}function Xb(a){a=0===(1024&a.Q)?Yb(a):a.Tj;var b=M(function(a){return $b(a.Q?a.fg:ac(a),x())}),d=bc();return a.oe(b,d.N).fc("\n")}function cc(a,b){return"scalatex-scrollspy-Styles-"+a+b}function dc(){this.Wm=this.be=this.si=null;this.Bk=!1;this.pe=this.ch=this.Wi=this.Vn=this.Bj=null}dc.prototype=new t; +function ec(a){fc(a.si);gc(a.Bj);m.document.body.appendChild(a.pe);m.addEventListener("scroll",function(a){return function(){fc(a.si)}}(a))} +function hc(a){var b=new dc;ic();a=jc(kc(),a);var d=ic();lc();var e=(new mc).Fe(null),f=lc(),g=nc(function(a,b){return oc(new pc,a,b)}),k=qc(rc(),(new C).A(["value","children"]),sc(tc(),q(ma))),n=qc(rc(),(new C).A([null,null]),sc(tc(),q(gb))),r=ic().Ih,y=ic();uc();var S=vc().zb,y=wc(y,e,S),f=xc(f,g,k,n,r,y);e.Hj=yc(f);e=zc(f);Ac();d=wc(d,e,new Bc);b.si=(new Cc).La(yc(d).l(a));a=N().ul;d=N().Ji;e=N().Og;d=Dc(new Ec,d,"menu-item-list",e);e=Fc();e=N().Lc.Cb(e.Eb,0);f=N().ao;f=N().Lc.Cb(f.Eb,0);g=N(); +g=Hb(F(g,"flex"));k=N().qn;g=A(new B,g,1E4,k);k=N();n=Gc(b.si);r=M(function(a){return a.j.Zd});y=bc();n=n.oe(r,y.N);b.be=Hc(Jc(a,(new C).A([d,e,f,g,Kc(new Lc,k,n,M(function(a){var b=N();return Mc(b,a)}))])));a=Nc(function(a){return function(){var b=a.si;b.qe=!b.qe;if(b.qe){var d=Gc(b),e=new Oc;if(null===b)throw G(H(),null);e.ja=b;b=bc();d.oe(e,b.N)}else fc(b)}}(b));d=N().L;e=Pc().Fg;f=N().Lc;b.Wm=Hc(Rc("fa-caret-down","fa-caret-up",a,(new C).A([f.Cb(d.Eb,e)])));b.Bk=800<(m.innerWidth|0);b.Bj=Sc(new Tc, +b.Bk,Nc(function(a){return function(){return a.pe}}(b)),Nc(function(){return m.document.body}),Nc(function(a){return function(){return a.ch}}(b)));b.Bk?(a="fa-caret-left",d="fa-caret-right"):(a="fa-caret-right",d="fa-caret-left");a=Rc(a,d,Nc(function(a){return function(){var b=a.Bj;b.qe=!b.qe;gc(a.Bj)}}(b)),(new C).A([]));d=N().L;e=N().vh;b.Vn=Hc(Jc(a,(new C).A([e.Cb(d.Eb,"0px")])));a=N().Oi;N();d=Uc(Pc().tc);d=Vc(d);e=N().Ae;N();f=(new Wc).h("Published using Scalatex");g=N().Yi;k=N().Og;g=Dc(new Ec, +g,"https://lihaoyi.github.io/Scalatex",k);N();k=Xc(Pc().tc);b.Wi=Jc(a,(new C).A([d,Jc(e,(new C).A([f,g,Vc(k)]))]));a=N().Oi;d=Yc();e=N().Ia;d=A(new B,d,"flex",e);e=N();e=Hb(F(e,"flex-direction"));f=N().Ia;e=A(new B,e,"column",f);f=N().Mn;g=N().Ia;f=A(new B,f,"100%",g);g=N().Dj;k=N().Ia;g=A(new B,g,"opacity 0.2s ease-out",k);k=N();k=Mc(k,b.be);n=N();b.ch=Hc(Jc(a,(new C).A([d,e,f,g,k,Mc(n,b.Wm),b.Wi])));a=N().Oi;N();d=$c(Pc().tc);d=Vc(d);e=N();e=Mc(e,b.ch);f=N();b.pe=Hc(Jc(a,(new C).A([d,e,Mc(f,b.Vn)]))); +return b} +function Rc(a,b,d,e){var f=N().ln,g=N().Ji,k="fa "+a,n=N().Og,g=Dc(new Ec,g,k,n),k=ad(),n=N().Ia,n=Hc(Jc(f,(new C).A([g,A(new B,k,"white",n)]))),f=N().Ae,g=N(),g=Mc(g,n),k=N().Yi,r=N().Og,k=Dc(new Ec,k,"javascript:",r);N();var r=bd(Pc().tc),r=Vc(r),y=N().Un;a=M(function(a,b,d,e){return function(){e.classList.toggle(a);e.classList.toggle(b);cd(d)}}(a,b,d,n));N();a=Dc(new Ec,y,a,dd(new ed,M(function(a){return function(a){return function(b){return a.l(b)}}(a)})));b=N();d=Ac().ui;return Jc(f,(new C).A([g, +k,r,a,fd(b,e,d)]))}dc.prototype.a=new s({Ar:0},!1,"scalatex.scrollspy.Controller",{Ar:1,c:1});function gd(){this.wi=null;this.Q=!1}gd.prototype=new t;gd.prototype.b=function(){hd=this;m.document.head.appendChild(this.Q?this.wi:id(this));var a=this.Q?this.wi:id(this),b=(this.Q?this.wi:id(this)).textContent,d=Pc().tc;a.textContent=""+b+Xb(d);return this};function id(a){a.Q||(jd||(jd=(new kd).b()),a.wi=Hc(jd.xj),a.Q=!0);return a.wi}gd.prototype.main=function(a){ec(hc(a))}; +gd.prototype.a=new s({Br:0},!1,"scalatex.scrollspy.Controller$",{Br:1,c:1});var hd=void 0;function ld(){hd||(hd=(new gd).b());return hd}fa.scalatex=fa.scalatex||{};fa.scalatex.scrollspy=fa.scalatex.scrollspy||{};fa.scalatex.scrollspy.Controller=ld;function Cc(){this.ik=this.fg=null;this.Q=this.qe=!1}Cc.prototype=new t;function md(a,b){var d=m.document.body;return O(P(),b,d)?0:+b.offsetTop+md(a,b.offsetParent)} +function nd(a){if(!a.Q){var b=(new od).Oa(-1),d=a.fg,b=M(function(a,b){return function(d){return pd(a,d,0,b)}}(a,b)),e=bc();a.ik=d.oe(b,e.N);a.Q=!0}return a.ik}function fc(a){var b=+m.document.body.scrollTop;qd(a,Gc(a),b);Gc(a).R(M(function(){return function(a){var b=a.j.ae.classList;rd(a.j);b.remove(sd(Pc().tc).Ha);a.j.Zd.classList.remove(td(Pc().tc).Ha);b.add(ud(Pc().tc).Ha)}}(a)))}function Gc(a){return a.Q?a.ik:nd(a)} +function qd(a,b,d){var e=bc();b.Yg(e.N).Kd(M(function(a){return null!==a})).R(M(function(a,b,d,e){return function(r){if(null!==r){var y=r.Ua;r=r.$a|0;md(a,y.j.df)<=b+e?(1+r|0)>=d.q()||md(a,d.ma(1+r|0).j.df)>b+e?(y.j.ae.classList.remove(sd(Pc().tc).Ha),y.j.ae.classList.add(ud(Pc().tc).Ha),rd(y.j),qd(a,y.Bc,b),y.j.Zd.classList.remove(td(Pc().tc).Ha)):(vd(a,y),y.j.Zd.classList.add(td(Pc().tc).Ha)):(y.j.Zd.classList.remove(td(Pc().tc).Ha),vd(a,y))}else throw(new K).w(r);}}(a,d,b,10)))} +Cc.prototype.La=function(a){this.fg=a;this.qe=!1;return this}; +function pd(a,b,d,e){var f=N().Ae;N();var g=(new Wc).h(b.j),k=N().Yi;ld();var n="#"+b.j.split(" ").join(""),r=N().Og,k=Dc(new Ec,k,n,r),n=N().Ji,r=N().Og,n=Dc(new Ec,n,"menu-item",r);N();r=wd(Pc().tc);f=Hc(Jc(f,(new C).A([g,k,n,Vc(r)])));g=e.v;n=b.Bc;uc();k=vc().zb;k=Vb(n,k);for(n=xd(n);n.Oe;)r=n.wa(),k.Da(pd(a,r,1+d|0,e));a=k.pa();d=N().ul;N();k=yd(Pc().tc);k=Vc(k);n=N();uc();for(var r=vc().zb,r=Vb(a,r),y=xd(a);y.Oe;){var S=y.wa();r.Da(S.j.Zd)}r=r.pa();d=Hc(Jc(d,(new C).A([k,Kc(new Lc,n,r,M(function(a){var b= +N();return Mc(b,a)}))])));k=N().Gn;n=Yc().Gi;r=N();r=Mc(r,f);y=N();k=Hc(Jc(k,(new C).A([n,r,Mc(y,d)])));e.v=1+e.v|0;e=m.document;ld();e=e.getElementById(b.j.split(" ").join(""));ld();b=b.j.split(" ").join("");if(0>24}),d=M(function(a){a=(new mb).h(a);Se||(Se=(new Te).b());a=a.f;var b=Ue(Ve(),a,10);if(-128>b||127>24});Xe||(Xe=(new Ye).b());a.bq=ye(b,d,Xe);b=M(function(a){return+a<<16>>16});d=M(function(a){a=(new mb).h(a);Ze||(Ze=(new $e).b());a=a.f;var b=Ue(Ve(),a,10);if(-32768>b||32767>16});af||(af=(new bf).b());a.Hs=ye(b,d,af);b=M(function(a){return+a|0});d=M(function(a){a=(new mb).h(a);return Ue(Ve(),a.f,10)});cf||(cf=(new df).b());a.pq=ye(b,d,cf);a.Kl=Qe(M(function(a){a=(new mb).h(a);return ef(ff(),a.f,10)}));b=M(function(a){return qa(+a)});d=M(function(a){a=(new mb).h(a).f;return qa(gf(hf(),a))});jf||(jf=(new kf).b());a.kq=ye(b,d,jf);b=M(function(a){return+a});d=M(function(a){a=(new mb).h(a);return gf(hf(),a.f)});lf||(lf=(new mf).b());a.eq= +ye(b,d,lf);ne().Kh;a.Ij=He(new Ie,M(function(a){return function(b){var d=nf().Jj;if(null===d?null===b:d.K(b))return of(a.Ih).l("inf");d=nf().Qj;if(null===d?null===b:d.K(b))return of(a.Ih).l("-inf");if(b===nf().Sj)return of(a.Ih).l("undef");b=b.Jp();return of(a.Kl).l(b)}}(a)));ne().Kh;b=of(a.Ij);a.oq=He(new Ie,b);ne().sg;a.Il=(new qe).Fe((new pf).Pd(a));ne().Kh;b=of(a.Ij);a.jq=He(new Ie,b);ne().sg;a.Hl=(new qe).Fe((new qf).Pd(a));ne().sg;b=lc();d=yc(a.Hl);b=b.ye("DurationString",d.lf(yc(a.Il)));a.fq= +(new qe).Fe(b)}function Qe(a){ne().tg;var b=M(function(a){return(new ze).h(ka(a))});a=lc().ye("Number",rf(a));return De(new Ee,b,a)}function wc(a,b,d){ne().sg;a=lc().ye("Array(n)",sf(a,b,d));return(new qe).Fe(a)}function le(){}le.prototype=new t;le.prototype.a=new s({hs:0},!1,"upickle.ReadWriter$",{hs:1,c:1});var ke=void 0;function he(){}he.prototype=new t;he.prototype.a=new s({js:0},!1,"upickle.Reader$",{js:1,c:1});var ge=void 0;function yc(a){return tf(new uf,new vf,a.Rk())}function je(){} +je.prototype=new t;je.prototype.a=new s({os:0},!1,"upickle.Writer$",{os:1,c:1});var ie=void 0;function of(a){return M(function(a){return function(d){return null===d?wf():a.Up().l(d)}}(a))}function xf(){}xf.prototype=new t; +function jc(a,b){if(yf(b))return(new ze).h(b);if("number"===typeof b)return Ae(new Be,+b);if(O(P(),!0,b))return Ke();if(O(P(),!1,b))return Le();if(null===b)return wf();if(b instanceof m.Array){var d=[];b.length|0;for(var e=0,f=b.length|0;ea?-1:1):0:bd||36(36d?-1:48<=f&&57>=f&&(-48+f|0)=f&&(-65+f|0)<(-10+d|0)?-55+f|0:97<=f&&122>=f&&(-97+f|0)<(-10+d|0)?-87+f|0:65313<=f&&65338>=f&&(-65313+f|0)<(-10+d|0)?-65303+f|0:65345<=f&&65370>= +f&&(-65345+f|0)<(-10+d|0)?-65303+f|0:-1)&&a.Bg(b),e=1+e|0;else break}d=+m.parseInt(b,d);return d!==d||2147483647d?a.Bg(b):d|0}}}function Mf(a,b,d){return b<>>(-d|0)|0}function Nf(a,b){var d=b-(1431655765&b>>1)|0,d=(858993459&d)+(858993459&d>>2)|0;return w(16843009,252645135&(d+(d>>4)|0))>>24}function Of(a,b){var d=b,d=d|d>>>1|0,d=d|d>>>2|0,d=d|d>>>4|0,d=d|d>>>8|0;return 32-Nf(0,d|d>>>16|0)|0}function Pf(a,b){return Nf(0,-1+(b&(-b|0))|0)} +Lf.prototype.a=new s({mw:0},!1,"java.lang.Integer$",{mw:1,c:1});var Qf=void 0;function Ve(){Qf||(Qf=(new Lf).b());return Qf}function Rf(){this.Jh=null;this.Oj=Sf();this.Nj=Sf();this.Hh=0}Rf.prototype=new t; +function ef(a,b,d){if(null===b)throw(new va).b();if(""===b)a.Bg(b);else{if(45===(65535&(b.charCodeAt(0)|0)))return Tf(ef(a,b.substring(1),d));try{var e=b,f=Sf();for(;;)if(0<(e.length|0)){var g=e.substring(0,9),k=f,n=d,r=g.length|0,y=1;b:{var S;for(;;)if(0===r){S=y;break b}else if(0===r%2)var Oa=w(n,n),pb=r/2|0,n=Oa,r=pb;else var pb=-1+r|0,Rd=w(y,n),r=pb,y=Rd}var Zc=Uf(k,(new T).Oa(S)),Ic=Ue(Ve(),g,d),Ii=(new T).Oa(Ic),Ji=e.substring(9),Ki=Vf(Zc,Ii),e=Ji,f=Ki}else return f}catch(Li){if(Wf(Li))a.Bg(b); +else throw Li;}}}Rf.prototype.Bg=function(a){throw(new We).h(Db((new Eb).La((new C).A(['For input string: "','"'])),(new C).A([a])));};Rf.prototype.a=new s({qw:0},!1,"java.lang.Long$",{qw:1,c:1});var Xf=void 0;function ff(){Xf||(Xf=(new Rf).b());return Xf}function Yf(){}Yf.prototype=new t;function Zf(){}Zf.prototype=Yf.prototype;function $f(a){return!!(a&&a.a&&a.a.t.Gg||"number"===typeof a)}function $e(){this.Jh=null;this.Hh=0}$e.prototype=new t; +$e.prototype.a=new s({tw:0},!1,"java.lang.Short$",{tw:1,c:1});var Ze=void 0;function ag(){this.ov=this.Gv=this.Nm=this.Wn=null}ag.prototype=new t; +ag.prototype.b=function(){bg=this;this.Wn=cg(!1);this.Nm=cg(!0);this.Gv=null;this.ov=m.performance?m.performance.now?function(){return function(){return+m.performance.now()}}(this):m.performance.webkitNow?function(){return function(){return+m.performance.webkitNow()}}(this):function(){return function(){return+(new m.Date).getTime()}}(this):function(){return function(){return+(new m.Date).getTime()}}(this);return this};ag.prototype.a=new s({vw:0},!1,"java.lang.System$",{vw:1,c:1});var bg=void 0; +function dg(){bg||(bg=(new ag).b());return bg}function eg(){this.Za=this.uk=null}eg.prototype=new t;function fg(){}fg.prototype=eg.prototype;eg.prototype.b=function(){this.uk=!1;return this};eg.prototype.Wc=function(){this.uk||(this.Za=this.xl.vo,this.uk=!0);return this.Za};function gg(){}gg.prototype=new t;gg.prototype.a=new s({xw:0},!1,"java.lang.reflect.Array$",{xw:1,c:1});var hg=void 0;function ig(){}ig.prototype=new t;ig.prototype.a=new s({yw:0},!1,"java.util.Arrays$",{yw:1,c:1});var jg=void 0; +function kg(){this.un=this.tn=this.sn=this.vn=null}kg.prototype=new t;kg.prototype.b=function(){lg=this;this.vn=mg(new ng,new m.RegExp("^[^\\x25]+"));this.sn=mg(new ng,new m.RegExp("^\\x25{2}"));this.tn=mg(new ng,new m.RegExp("^\\x25n"));this.un=mg(new ng,new m.RegExp("^\\x25(?:([1-9]\\d*)\\$)?([-#+ 0,\\(\x3c]*)(\\d*)(?:\\.(\\d+))?([A-Za-z])"));return this};kg.prototype.a=new s({Bw:0},!1,"java.util.Formatter$",{Bw:1,c:1});var lg=void 0;function og(){lg||(lg=(new kg).b());return lg} +function ng(){this.Kg=null}ng.prototype=new t;function pg(a,b){qg||(qg=(new rg).b());var d=a.Kg.exec(b);return null===d?sg():(new tg).w(d)}function mg(a,b){a.Kg=b;return a}ng.prototype.a=new s({Cw:0},!1,"java.util.Formatter$RegExpExtractor",{Cw:1,c:1});function ug(){}ug.prototype=new t;function vg(){}vg.prototype=ug.prototype;function wg(){}wg.prototype=new t;function xg(){}xg.prototype=wg.prototype; +function yg(a){return M(function(a){return function(d){if(null!==d)return zg(a,d.Ua,d.$a);throw(new K).w(d);}}(a))}function Ag(){this.ck=null}Ag.prototype=new t;function Bg(){}Bg.prototype=Ag.prototype;Ag.prototype.b=function(){this.ck=Cg();return this};Ag.prototype.Xj=function(a){var b=this.ck,d=Dg().oh.call(b,a)?(new tg).w(b[a]):sg();if(Eg(d))return d.ig;if(sg()===d)return d=(new Fg).h(a),b[a]=d;throw(new K).w(d);};function Gg(){}Gg.prototype=new t;function Hg(){}Hg.prototype=Gg.prototype; +function Ig(){this.Lm=this.qB=this.rj=null}Ig.prototype=new t;Ig.prototype.b=function(){Jg=this;this.rj=(new Kg).b();this.qB=M(function(){return h(!1)}(this));this.Lm=(new Lg).b();return this};Ig.prototype.a=new s({Oz:0},!1,"scala.PartialFunction$",{Oz:1,c:1});var Jg=void 0;function Mg(){Jg||(Jg=(new Ig).b());return Jg}function Ng(a,b,d){return a.Va(b)?a.l(b):d.l(b)}function Og(){}Og.prototype=new t;Og.prototype.a=new s({Wz:0},!1,"scala.Predef$any2stringadd$",{Wz:1,c:1});var Pg=void 0; +function Qg(a,b){switch(b){case 0:return a.Zg;case 1:return a.$g;case 2:return a.ah;case 3:return a.bh;default:throw(new Rg).h(""+b);}}function Sg(){}Sg.prototype=new t;Sg.prototype.a=new s({oA:0},!1,"scala.math.Ordered$",{oA:1,c:1});var Tg=void 0;function Ug(){this.Es=this.tq=this.gq=this.Bs=this.As=this.zs=this.qq=this.lq=this.iq=this.oF=this.nF=this.Cs=this.Js=this.Ss=this.Yp=this.Is=this.Xp=this.zl=this.Wp=this.vs=this.uq=this.sq=this.nq=this.Fs=this.rq=this.Qs=this.ng=null;this.Q=0} +Ug.prototype=new t; +Ug.prototype.b=function(){Vg=this;this.ng=(new Wg).b();Xg||(Xg=(new Yg).b());this.Qs=Xg;this.rq=Zg();this.Fs=bc();this.nq=vc();this.sq=$g();this.uq=J();this.vs=x();fh||(fh=(new gh).b());this.Wp=fh;hh||(hh=(new ih).b());this.zl=hh;jh||(jh=(new kh).b());this.Xp=jh;this.Is=lh();mh||(mh=(new nh).b());this.Yp=mh;this.Ss=uc();oh||(oh=(new ph).b());this.Js=oh;this.Cs=qh();rh||(rh=(new sh).b());this.iq=rh;th||(th=(new uh).b());this.lq=th;vh||(vh=(new wh).b());this.qq=vh;xh||(xh=(new yh).b());this.zs=xh;Tg|| +(Tg=(new Sg).b());this.As=Tg;zh||(zh=(new Ah).b());this.Bs=zh;Bh||(Bh=(new Ch).b());this.gq=Bh;Dh||(Dh=(new Eh).b());this.tq=Dh;Fh||(Fh=(new Gh).b());this.Es=Fh;return this};Ug.prototype.a=new s({tA:0},!1,"scala.package$",{tA:1,c:1});var Vg=void 0;function Hh(){Vg||(Vg=(new Ug).b());return Vg}function Ih(){this.wf=this.vf=this.og=this.We=this.mg=this.Ye=this.Pe=this.Se=this.Te=this.Ve=this.Ue=this.Re=this.Xe=this.Qe=null}Ih.prototype=new t; +Ih.prototype.b=function(){Jh=this;this.Qe=Kh().Qe;this.Xe=Kh().Xe;this.Re=Kh().Re;this.Ue=Kh().Ue;this.Ve=Kh().Ve;this.Te=Kh().Te;this.Se=Kh().Se;this.Pe=Kh().Pe;this.Ye=Kh().Ye;this.mg=Kh().mg;this.We=Kh().We;this.og=Kh().og;this.vf=Kh().vf;this.wf=Kh().wf;return this};Ih.prototype.a=new s({vA:0},!1,"scala.reflect.ClassManifestFactory$",{vA:1,c:1});var Jh=void 0;function Lh(a,b){return b.Ed.isArrayClass?Db((new Eb).La((new C).A(["Array[","]"])),(new C).A([Lh(a,Mh(U(),b))])):ib(b)} +function Nh(){this.vf=this.wf=this.og=this.ng=this.We=this.mg=this.uo=this.to=this.tj=this.Ye=this.Pe=this.Se=this.Te=this.Ve=this.Ue=this.Re=this.Xe=this.Qe=null}Nh.prototype=new t; +Nh.prototype.b=function(){Oh=this;this.Qe=(new Ph).b();this.Xe=(new Qh).b();this.Re=(new Rh).b();this.Ue=(new Sh).b();this.Ve=(new Th).b();this.Te=(new Uh).b();this.Se=(new Vh).b();this.Pe=(new Wh).b();this.Ye=(new Xh).b();this.tj=q(u);this.to=q(Yh);this.uo=q(Zh);this.mg=(new $h).b();this.ng=this.We=(new ai).b();this.og=(new bi).b();this.wf=(new ci).b();this.vf=(new di).b();return this};Nh.prototype.a=new s({yA:0},!1,"scala.reflect.ManifestFactory$",{yA:1,c:1});var Oh=void 0; +function Kh(){Oh||(Oh=(new Nh).b());return Oh}function ei(){this.Gc=this.Gl=null}ei.prototype=new t;ei.prototype.b=function(){fi=this;Jh||(Jh=(new Ih).b());this.Gl=Jh;this.Gc=Kh();return this};ei.prototype.a=new s({OA:0},!1,"scala.reflect.package$",{OA:1,c:1});var fi=void 0;function gi(){fi||(fi=(new ei).b());return fi}function hi(){}hi.prototype=new t;function ii(a,b){throw G(H(),(new ji).h(b));}hi.prototype.a=new s({PA:0},!1,"scala.sys.package$",{PA:1,c:1});var ki=void 0; +function li(){ki||(ki=(new hi).b());return ki}function mi(){this.wh=this.vo=null}mi.prototype=new t;mi.prototype.o=function(){return"DynamicVariable("+this.wh.Wc()+")"};mi.prototype.w=function(a){this.vo=a;a=new ni;if(null===this)throw G(H(),null);a.xl=this;oi.prototype.b.call(a);this.wh=a;return this};mi.prototype.a=new s({QA:0},!1,"scala.util.DynamicVariable",{QA:1,c:1});function Ch(){}Ch.prototype=new t;Ch.prototype.a=new s({SA:0},!1,"scala.util.Either$",{SA:1,c:1});var Bh=void 0; +function pi(){this.sB=null}pi.prototype=new t;pi.prototype.b=function(){this.sB=(new qi).b();return this};pi.prototype.a=new s({WA:0},!1,"scala.util.control.Breaks",{WA:1,c:1});function ri(){}ri.prototype=new t;function si(){}si.prototype=ri.prototype;ri.prototype.ej=function(a,b){var d;d=w(-862048943,b);d=Mf(Ve(),d,15);d=w(461845907,d);return a^d};ri.prototype.Nc=function(a,b){var d=this.ej(a,b),d=Mf(Ve(),d,13);return-430675100+w(5,d)|0}; +function ti(a,b,d){var e=(new od).Oa(0),f=(new od).Oa(0),g=(new od).Oa(0),k=(new od).Oa(1);b.R(M(function(a,b,d,e,f){return function(a){a=ui(U(),a);b.v=b.v+a|0;d.v^=a;0!==a&&(f.v=w(f.v,a));e.v=1+e.v|0}}(a,e,f,g,k)));b=a.Nc(d,e.v);b=a.Nc(b,f.v);b=a.ej(b,k.v);return a.Cg(b,g.v)}function vi(a){var b=wi(),d=a.hb();if(0===d)return a=a.jb(),Aa(Ba(),a);for(var e=-889275714,f=0;f>>16|0)),d=d^(d>>>13|0),d=w(-1028477387,d);return d^=d>>>16|0};function xi(a,b,d){var e=(new od).Oa(0);d=(new od).Oa(d);b.R(M(function(a,b,d){return function(e){d.v=a.Nc(d.v,ui(U(),e));b.v=1+b.v|0}}(a,e,d)));return a.Cg(d.v,e.v)}function yi(){}yi.prototype=new t;yi.prototype.a=new s({ZA:0},!1,"scala.util.hashing.package$",{ZA:1,c:1});var zi=void 0;function kh(){}kh.prototype=new t; +kh.prototype.a=new s({bB:0},!1,"scala.collection.$colon$plus$",{bB:1,c:1});var jh=void 0;function ih(){}ih.prototype=new t;function Ai(a,b){if(b.m())return sg();var d=b.u(),e=b.s();return(new tg).w((new V).ha(d,e))}ih.prototype.a=new s({cB:0},!1,"scala.collection.$plus$colon$",{cB:1,c:1});var hh=void 0; +function Bi(a,b){var d;if(b&&b.a&&b.a.t.Oc){var e;if(!(e=a===b)&&(e=a.U()===b.U()))try{d=a.X();for(var f=!0;f&&d.Ca();){var g=d.wa();if(null!==g){var k=g.$a,n=b.Xc(g.Ua);b:{if(Eg(n)){var r=n.ig;if(O(P(),k,r)){f=!0;break b}}f=!1}}else throw(new K).w(g);}e=f}catch(y){if(y&&y.a&&y.a.t.fw)Ci("class cast "),e=!1;else throw y;}d=e}else d=!1;return d}function Di(a,b){return 0<=b&&bb)d=1;else a:{d=a;var e=0;for(;;){if(e===b){d=d.m()?0:1;break a}if(d.m()){d=-1;break a}e=1+e|0;d=d.s()}d=void 0}return d} +function qj(a,b,d){for(;!a.m();)b=zg(d,b,a.u()),a=a.s();return b}function rj(a,b){var d=a.Jm(b);if(0>b||d.m())throw(new Rg).h(""+b);return d.u()}function sj(a){for(var b=0;!a.m();)b=1+b|0,a=a.s();return b}function tj(a){if(a.m())throw(new uj).b();for(var b=a.s();!b.m();)a=b,b=b.s();return a.u()}function vj(a,b){if(b&&b.a&&b.a.t.pi){if(a===b)return!0;for(var d=a,e=b;!d.m()&&!e.m()&&O(P(),d.u(),e.u());)d=d.s(),e=e.s();return d.m()&&e.m()}return Vi(a,b)} +function wj(a,b){if(a.m())throw(new xj).h("empty.reduceLeft");return a.s().le(a.u(),b)}function yj(a,b){var d=a.Xc(b);if(sg()===d)throw(new uj).h("key not found: "+b);if(Eg(d))return d.ig;throw(new K).w(d);}function zj(a,b,d,e,f){var g=a.X();a=(new Aj).Zi(g,M(function(){return function(a){if(null!==a){var b=a.Ua;a=a.$a;Pg||(Pg=(new Og).b());return""+(""+Bj(Ba(),b)+" -\x3e ")+a}throw(new K).w(a);}}(a)));return Cj(a,b,d,e,f)}function Cf(a){var b=(new Dj).Oa(a.U());a=a.Ba();Ej(b,a);return b} +function Fj(a,b,d){d=d.Tc(a.Pb());d.Da(b);d.Ka(a.bc());return d.pa()}function Gj(a){var b=x(),d=(new Hj).w(b);a.R(M(function(a,b){return function(a){b.v=Tb(new Ub,a,b.v)}}(a,d)));b=a.na();Ij(a)&&b.Ta(a.U());for(a=d.v;!a.m();)d=a.u(),b.Da(d),a=a.s();return b.pa()}function Jj(a,b,d){d=d.Tc(a.Pb());d.Ka(a.bc());d.Da(b);return d.pa()}function Kj(a,b){var d=b.$e();Ij(a)&&d.Ta(a.U());d.Ka(a.Ja());return d.pa()}function Lj(a){return a.Ec(a.Wb()+"(",", ",")")} +function Mj(a,b,d){d=d.Tc(a.Pb());a.R(M(function(a,b,d){return function(a){return b.Ka(d.l(a).Ba())}}(a,d,b)));return d.pa()}function Nj(a,b,d){d=Vb(a,d);a.R(M(function(a,b,d){return function(a){return b.Da(d.l(a))}}(a,d,b)));return d.pa()}function Zi(a){if(a.m())throw(new xj).h("empty.init");var b=a.u(),b=(new Hj).w(b),d=Oj(!1),e=a.na();Pj(e,a,-1);a.R(M(function(a,b,d,e){return function(a){d.v?e.Da(b.v):d.v=!0;b.v=a}}(a,b,d,e)));return e.pa()} +function bj(a){if(a.m())throw(new xj).h("empty.tail");return a.Zb(1)}function Qj(a,b,d){d=d.Tc(a.Pb());if(Ij(b)){var e=b.Ba().U();Pj(d,a,e)}d.Ka(a.Ja());d.Ka(b.Ba());return d.pa()}function Vb(a,b){var d=b.Tc(a.Pb());Ij(a)&&d.Ta(a.U());return d}function Rj(a){a=ib(la(a.Pb()));var b;Ba();b=a;var d=Sj(46);b=b.lastIndexOf(d)|0;-1!==b&&(a=a.substring(1+b|0));b=Tj(Ba(),a,36);-1!==b&&(a=a.substring(0,b));return a} +function Hi(a){var b=a.u(),b=(new Hj).w(b);a.R(M(function(a,b){return function(a){b.v=a}}(a,b)));return b.v}function Uj(a,b){var d=b.$e();d.Ka(a.Ba());return d.pa()}function Vj(a,b){var d=Wj(new Xj,Yj());a.R(M(function(a,b){return function(a){return b.Da(a)}}(a,d,b)));return d.ob}function Cj(a,b,d,e,f){var g=Oj(!0);Zj(b,d);a.R(M(function(a,b,d,e){return function(a){if(b.v)ak(d,a),b.v=!1;else return Zj(d,e),ak(d,a)}}(a,g,b,e)));Zj(b,f);return b} +function Oi(a,b){if(a.m())throw(new xj).h("empty.reduceLeft");var d=Oj(!0),e=(new Hj).w(0);a.R(M(function(a,b,d,e){return function(a){b.v?(d.v=a,b.v=!1):d.v=zg(e,d.v,a)}}(a,d,e,b)));return e.v}function bk(a,b,d){b=(new Hj).w(b);a.R(M(function(a,b,d){return function(a){b.v=zg(d,b.v,a)}}(a,b,d)));return b.v}function ck(a,b){if(a.m())throw(new xj).h("empty.max");return a.Kb(nc(function(a,b){return function(a,d){return b.Dg(a,d)?a:d}}(a,b)))}function L(a,b,d,e){return a.rc((new dk).b(),b,d,e).Sc.Ob} +function ek(a){var b=(new od).Oa(0);a.R(M(function(a,b){return function(){b.v=1+b.v|0}}(a,b)));return b.v}function fk(){}fk.prototype=new t;function gk(){}gk.prototype=fk.prototype;function hk(){}hk.prototype=new t;function ik(){}ik.prototype=hk.prototype;function jk(a,b){if(b.m())return a.Ef();var d=a.na();d.Ka(b);return d.pa()}hk.prototype.Ef=function(){return this.na().pa()};function kk(a,b){a:b:for(;;){if(!b.m()){a.tb(b.u());b=b.s();continue b}break a}} +function lk(a,b){b&&b.a&&b.a.t.pi?kk(a,b):b.R(M(function(a){return function(b){return a.tb(b)}}(a)));return a}function mk(){}mk.prototype=new t;function nk(){}nk.prototype=mk.prototype;function ok(a,b){return Wj(new Xj,a.Mm(b))}function pk(a,b){var d=Wj(new Xj,Yj());lk(d,a);qk(d,(new V).ha(b.Ua,b.$a));return d.ob}function rk(){}rk.prototype=new t;function sk(){}sk.prototype=rk.prototype;function tk(){}tk.prototype=new t; +function uk(a,b,d,e){if(vk(d)){if(vk(e))return d=d.zf(),e=e.zf(),Y(new wk,a,b,d,e);if(vk(d.E)){var f=d.ka,g=d.j,k=d.E.zf();e=Y(new xk,a,b,d.L,e);return Y(new wk,f,g,k,e)}return vk(d.L)?(f=d.L.ka,g=d.L.j,k=Y(new xk,d.ka,d.j,d.E,d.L.E),e=Y(new xk,a,b,d.L.L,e),Y(new wk,f,g,k,e)):Y(new xk,a,b,d,e)}if(vk(e)){if(vk(e.L))return f=e.ka,g=e.j,a=Y(new xk,a,b,d,e.E),e=e.L.zf(),Y(new wk,f,g,a,e);if(vk(e.E))return f=e.E.ka,g=e.E.j,a=Y(new xk,a,b,d,e.E.E),e=Y(new xk,e.ka,e.j,e.E.L,e.L),Y(new wk,f,g,a,e)}return Y(new xk, +a,b,d,e)}function yk(a){return zk(a)?a.kj():ii(li(),"Defect: invariance violation; expected black, got "+a)}function Ak(a){return null===a?null:a.zf()}function Bk(a,b){return null===b?0:b.fk}function Fk(a,b,d){return Ak(Gk(a,b,d))}function Hk(a,b,d,e,f,g){if(null===b)return Y(new wk,e,f,null,null);var k=1+Bk(0,b.E)|0;return dk?Jk(zk(b),b.ka,b.j,b.E,Hk(a,b.L,d-k|0,e,f,g)):g?Kk(zk(b),e,f,b.E,b.L):b} +function Lk(a,b,d){if(null===b)return d;if(null===d)return b;if(vk(b)&&vk(d)){a=Lk(a,b.L,d.E);if(vk(a)){var e=a.ka,f=a.j;b=Y(new wk,b.ka,b.j,b.E,a.E);d=Y(new wk,d.ka,d.j,a.L,d.L);return Y(new wk,e,f,b,d)}e=b.ka;f=b.j;b=b.E;d=Y(new wk,d.ka,d.j,a,d.L);return Y(new wk,e,f,b,d)}if(zk(b)&&zk(d))return f=Lk(a,b.L,d.E),vk(f)?(a=f.ka,e=f.j,b=Y(new xk,b.ka,b.j,b.E,f.E),d=Y(new xk,d.ka,d.j,f.L,d.L),Y(new wk,a,e,b,d)):Mk(b.ka,b.j,b.E,Y(new xk,d.ka,d.j,f,d.L));if(vk(d))return e=d.ka,f=d.j,b=Lk(a,b,d.E),Y(new wk, +e,f,b,d.L);if(vk(b)){var e=b.ka,f=b.j,g=b.E;d=Lk(a,b.L,d);return Y(new wk,e,f,g,d)}ii(li(),"unmatched tree on append: "+b+", "+d)}function Nk(a,b){if(null===b)throw(new uj).h("empty map");for(var d=b;null!==d.E;)d=d.E;return d}function Ok(a,b,d,e,f,g){if(null===b)return Y(new wk,d,e,null,null);var k=g.sc(d,b.ka);return 0>k?Ik(zk(b),b.ka,b.j,Ok(a,b.E,d,e,f,g),b.L):0=d)return b;if(d>=Bk(0,b))return null;var e=Bk(0,b.E);if(d>e)return Gk(a,b.L,-1+(d-e|0)|0);var f=Gk(a,b.E,d);if(f!==b.E)if(null===f)b=Hk(a,b.L,-1+(d-e|0)|0,b.ka,b.j,!1);else{a=b.L;f=Ak(f);d=Ak(a);var g=Pk(f,d);if(null!==g){var k=g.Zg,e=!!g.$g;a=!!g.ah;g=g.bh|0}else throw(new K).w(g);a=!!a;g|=0;if(e)b=Y(new xk,b.ka,b.j,f,d);else{b:{e=k;for(;;)if(null===e)ii(li(),"Defect: unexpected empty zipper while computing range");else{if(zk(e.cf)){if(1===g)break b;g=-1+g|0}e=e.yi}e=void 0}f= +a?Y(new wk,b.ka,b.j,f,e.cf):Y(new wk,b.ka,b.j,e.cf,d);for(b=e.yi;null!==b;)d=b.cf,f=a?Ik(zk(d),d.ka,d.j,f,d.L):Jk(zk(d),d.ka,d.j,d.E,f),b=b.yi;b=f}}return b}function Qk(a,b,d,e){return Ak(Rk(a,b,d,e))} +function Rk(a,b,d,e){if(null===b)return null;var f=e.sc(d,b.ka);if(0>f)if(zk(b.E))b=Mk(b.ka,b.j,Rk(a,b.E,d,e),b.L);else{var f=b.ka,g=b.j;a=Rk(a,b.E,d,e);b=Y(new wk,f,g,a,b.L)}else if(0e)a=a.E;else if(0=e)return a.na().pa();d=a.na();a=a.o().substring(b,e);return d.Ka((new mb).h(a)).pa()}function kl(){}kl.prototype=new t;kl.prototype.nk=function(a,b){return b&&b.a&&b.a.t.Oo?a===(null===b?null:b.f):!1};function Pb(a,b,d,e){a=0>d?0:d;return e<=a||a>=(b.length|0)?"":b.substring(a,e>(b.length|0)?b.length|0:e)}kl.prototype.a=new s({JC:0},!1,"scala.collection.immutable.StringOps$",{JC:1,c:1});var ll=void 0; +function Qb(){ll||(ll=(new kl).b());return ll}function ml(a,b,d){if(32>d)return a.nb().d[31&b];if(1024>d)return a.P().d[31&b>>5].d[31&b];if(32768>d)return a.aa().d[31&b>>10].d[31&b>>5].d[31&b];if(1048576>d)return a.Aa().d[31&b>>15].d[31&b>>10].d[31&b>>5].d[31&b];if(33554432>d)return a.Ra().d[31&b>>20].d[31&b>>15].d[31&b>>10].d[31&b>>5].d[31&b];if(1073741824>d)return a.Ic().d[31&b>>25].d[31&b>>20].d[31&b>>15].d[31&b>>10].d[31&b>>5].d[31&b];throw(new Cb).b();} +function nl(a,b){var d=-1+a.Hb()|0;switch(d){case 5:a.Df(Z(a.Ic()));a.vc(Z(a.Ra()));a.eb(Z(a.Aa()));a.Fa(Z(a.aa()));a.va(Z(a.P()));a.Ic().d[31&b>>25]=a.Ra();a.Ra().d[31&b>>20]=a.Aa();a.Aa().d[31&b>>15]=a.aa();a.aa().d[31&b>>10]=a.P();a.P().d[31&b>>5]=a.nb();break;case 4:a.vc(Z(a.Ra()));a.eb(Z(a.Aa()));a.Fa(Z(a.aa()));a.va(Z(a.P()));a.Ra().d[31&b>>20]=a.Aa();a.Aa().d[31&b>>15]=a.aa();a.aa().d[31&b>>10]=a.P();a.P().d[31&b>>5]=a.nb();break;case 3:a.eb(Z(a.Aa()));a.Fa(Z(a.aa()));a.va(Z(a.P()));a.Aa().d[31& +b>>15]=a.aa();a.aa().d[31&b>>10]=a.P();a.P().d[31&b>>5]=a.nb();break;case 2:a.Fa(Z(a.aa()));a.va(Z(a.P()));a.aa().d[31&b>>10]=a.P();a.P().d[31&b>>5]=a.nb();break;case 1:a.va(Z(a.P()));a.P().d[31&b>>5]=a.nb();break;case 0:break;default:throw(new K).w(d);}}function ol(a,b){var d=a.d[b];a.d[b]=null;return Z(d)} +function pl(a,b,d){a.Md(d);d=-1+d|0;switch(d){case -1:break;case 0:a.Ga(b.nb());break;case 1:a.va(b.P());a.Ga(b.nb());break;case 2:a.Fa(b.aa());a.va(b.P());a.Ga(b.nb());break;case 3:a.eb(b.Aa());a.Fa(b.aa());a.va(b.P());a.Ga(b.nb());break;case 4:a.vc(b.Ra());a.eb(b.Aa());a.Fa(b.aa());a.va(b.P());a.Ga(b.nb());break;case 5:a.Df(b.Ic());a.vc(b.Ra());a.eb(b.Aa());a.Fa(b.aa());a.va(b.P());a.Ga(b.nb());break;default:throw(new K).w(d);}} +function ql(a,b,d){if(32<=d)if(1024>d)a.Ga(a.P().d[31&b>>5]);else if(32768>d)a.va(a.aa().d[31&b>>10]),a.Ga(a.P().d[31&b>>5]);else if(1048576>d)a.Fa(a.Aa().d[31&b>>15]),a.va(a.aa().d[31&b>>10]),a.Ga(a.P().d[31&b>>5]);else if(33554432>d)a.eb(a.Ra().d[31&b>>20]),a.Fa(a.Aa().d[31&b>>15]),a.va(a.aa().d[31&b>>10]),a.Ga(a.P().d[31&b>>5]);else if(1073741824>d)a.vc(a.Ic().d[31&b>>25]),a.eb(a.Ra().d[31&b>>20]),a.Fa(a.Aa().d[31&b>>15]),a.va(a.aa().d[31&b>>10]),a.Ga(a.P().d[31&b>>5]);else throw(new Cb).b();} +function Z(a){null===a&&Ci("NULL");var b=p(v(u),[a.d.length]);Fa(a,0,b,0,a.d.length);return b}function rl(a,b,d){var e=p(v(u),[32]);Fa(a,b,e,d,32-(d>b?d:b)|0);return e} +function sl(a,b,d,e){if(32<=e)if(1024>e)1===a.Hb()&&(a.va(p(v(u),[32])),a.P().d[31&b>>5]=a.nb(),a.Md(1+a.Hb()|0)),a.Ga(p(v(u),[32]));else if(32768>e)2===a.Hb()&&(a.Fa(p(v(u),[32])),a.aa().d[31&b>>10]=a.P(),a.Md(1+a.Hb()|0)),a.va(a.aa().d[31&d>>10]),null===a.P()&&a.va(p(v(u),[32])),a.Ga(p(v(u),[32]));else if(1048576>e)3===a.Hb()&&(a.eb(p(v(u),[32])),a.Aa().d[31&b>>15]=a.aa(),a.Fa(p(v(u),[32])),a.va(p(v(u),[32])),a.Md(1+a.Hb()|0)),a.Fa(a.Aa().d[31&d>>15]),null===a.aa()&&a.Fa(p(v(u),[32])),a.va(a.aa().d[31& +d>>10]),null===a.P()&&a.va(p(v(u),[32])),a.Ga(p(v(u),[32]));else if(33554432>e)4===a.Hb()&&(a.vc(p(v(u),[32])),a.Ra().d[31&b>>20]=a.Aa(),a.eb(p(v(u),[32])),a.Fa(p(v(u),[32])),a.va(p(v(u),[32])),a.Md(1+a.Hb()|0)),a.eb(a.Ra().d[31&d>>20]),null===a.Aa()&&a.eb(p(v(u),[32])),a.Fa(a.Aa().d[31&d>>15]),null===a.aa()&&a.Fa(p(v(u),[32])),a.va(a.aa().d[31&d>>10]),null===a.P()&&a.va(p(v(u),[32])),a.Ga(p(v(u),[32]));else if(1073741824>e)5===a.Hb()&&(a.Df(p(v(u),[32])),a.Ic().d[31&b>>25]=a.Ra(),a.vc(p(v(u),[32])), +a.eb(p(v(u),[32])),a.Fa(p(v(u),[32])),a.va(p(v(u),[32])),a.Md(1+a.Hb()|0)),a.vc(a.Ic().d[31&d>>20]),null===a.Ra()&&a.vc(p(v(u),[32])),a.eb(a.Ra().d[31&d>>20]),null===a.Aa()&&a.eb(p(v(u),[32])),a.Fa(a.Aa().d[31&d>>15]),null===a.aa()&&a.Fa(p(v(u),[32])),a.va(a.aa().d[31&d>>10]),null===a.P()&&a.va(p(v(u),[32])),a.Ga(p(v(u),[32]));else throw(new Cb).b();}function tl(){}tl.prototype=new t;tl.prototype.na=function(){var a=(new dk).b();return ul(new vl,a,M(function(){return function(a){return(new wl).h(a)}}(this)))}; +tl.prototype.a=new s({TC:0},!1,"scala.collection.immutable.WrappedString$",{TC:1,c:1});var xl=void 0;function yl(a,b,d,e){var f=Ri(U(),a.Pb());e=eb))throw(new Xl).w("assertion failed: loadFactor too large; must be \x3c 0.5");return Yl(Zl(Uf((new T).Oa(d),(new T).Oa(b)),(new T).k(1E3,0,0)))} +Vl.prototype.a=new s({gD:0},!1,"scala.collection.mutable.FlatHashTable$",{gD:1,c:1});var $l=void 0;function am(){$l||($l=(new Vl).b());return $l}function bm(){}bm.prototype=new t;bm.prototype.o=h("NullSentinel");bm.prototype.M=h(0);bm.prototype.a=new s({iD:0},!1,"scala.collection.mutable.FlatHashTable$NullSentinel$",{iD:1,c:1});var cm=void 0;function dm(){cm||(cm=(new bm).b());return cm} +function em(a,b){for(var d=null===b?dm():b,e=za(d),e=fm(a,e),f=a.Nb.d[e];null!==f&&!O(P(),f,d);)e=(1+e|0)%a.Nb.d.length,f=a.Nb.d[e];return f} +function gm(a,b){for(var d=za(b),d=fm(a,d),e=a.Nb.d[d];null!==e;){if(O(P(),e,b))return;d=(1+d|0)%a.Nb.d.length;e=a.Nb.d[d]}a.Nb.d[d]=b;a.Pg=1+a.Pg|0;null!==a.eg&&(d>>=5,e=a.eg,e.d[d]=1+e.d[d]|0);if(a.Pg>=a.zj){d=a.Nb;a.Nb=p(v(u),[w(2,a.Nb.d.length)]);a.Pg=0;if(null!==a.eg)if(e=1+(a.Nb.d.length>>5)|0,a.eg.d.length!==e)a.eg=p(v(Ua),[e]);else{jg||(jg=(new ig).b());for(var e=a.eg,f=0;f!==e.d.length;)e.d[f]=0,f=1+f|0}a.vj=Nf(Ve(),-1+a.Nb.d.length|0);a.zj=Wl(am(),a.Fi,a.Nb.d.length);for(e=0;e>>8|0)|e>>>24|0);var d=d%32,f=-1+a.Nb.d.length|0;return((e>>>d|0|e<<(32-d|0))>>>(32-Nf(Ve(),f)|0)|0)&f}function hm(){im||(im=(new jm).b());var a=31,a=a|a>>>1|0,a=a|a>>>2|0,a=a|a>>>4|0,a=a|a>>>8|0;return 1+(a|a>>>16|0)|0}function jm(){}jm.prototype=new t;jm.prototype.a=new s({mD:0},!1,"scala.collection.mutable.HashTable$",{mD:1,c:1}); +var im=void 0;function km(a,b){var d=(new T).Oa(a.p.d.length);if(lm((new T).Oa(b),d)){for(d=Uf((new T).k(2,0,0),d);lm((new T).Oa(b),d);)d=Uf((new T).k(2,0,0),d);lm(d,(new T).k(4194303,511,0))&&(d=(new T).k(4194303,511,0));d=p(v(u),[Yl(d)]);Fa(a.p,0,d,0,a.Mb);a.p=d}}function mm(a,b){if(b>=a.Mb)throw(new Rg).h(""+b);return a.p.d[b]}function we(){this.hq=null}we.prototype=new t;we.prototype.b=function(){ve=this;this.hq=(new Sb).me(p(v(u),[0]));return this}; +function xe(a){if(null===a)return null;if(jb(a,1))return(new Sb).me(a);if(cb(a,1))return(new nm).Of(a);if(fb(a,1))return(new om).Mf(a);if(db(a,1))return(new pm).Pf(a);if(eb(a,1))return(new qm).Nf(a);if($a(a,1))return(new rm).Lf(a);if(ab(a,1))return(new sm).Kf(a);if(bb(a,1))return(new tm).Qf(a);if(Za(a,1))return(new um).Rf(a);if(vm(a))return(new wm).Sf(a);throw(new K).w(a);}we.prototype.a=new s({vD:0},!1,"scala.collection.mutable.WrappedArray$",{vD:1,c:1});var ve=void 0;function xm(){} +xm.prototype=new t;function Cg(){ym||(ym=(new xm).b());return{}}xm.prototype.a=new s({ED:0},!1,"scala.scalajs.js.Dictionary$",{ED:1,c:1});var ym=void 0;function zm(){this.oh=null}zm.prototype=new t;zm.prototype.b=function(){Am=this;this.oh=m.Object.prototype.hasOwnProperty;return this};zm.prototype.a=new s({ID:0},!1,"scala.scalajs.js.WrappedDictionary$Cache$",{ID:1,c:1});var Am=void 0;function Dg(){Am||(Am=(new zm).b());return Am} +function Bm(){this.vg=!1;this.an=this.Yu=this.aj=this.Ph=null;this.Yj=!1;this.In=this.kn=0}Bm.prototype=new t; +Bm.prototype.b=function(){Cm=this;this.Ph=(this.vg=!!(m.ArrayBuffer&&m.Int32Array&&m.Float32Array&&m.Float64Array))?new m.ArrayBuffer(8):null;this.aj=this.vg?new m.Int32Array(this.Ph,0,2):null;this.Yu=this.vg?new m.Float32Array(this.Ph,0,2):null;this.an=this.vg?new m.Float64Array(this.Ph,0,1):null;if(this.vg)this.aj[0]=16909060,a=1===((new m.Int8Array(this.Ph,0,8))[0]|0);else var a=!0;this.kn=(this.Yj=a)?0:1;this.In=this.Yj?1:0;return this}; +function Ca(a,b){var d=b|0;if(d===b&&-Infinity!==1/b)return d;if(a.vg)a.an[0]=b,d=Dm(Em((new T).Oa(a.aj[a.kn]|0),32),Fm((new T).k(4194303,1023,0),(new T).Oa(a.aj[a.In]|0)));else{if(b!==b)var d=!1,e=2047,f=+m.Math.pow(2,51);else if(Infinity===b||-Infinity===b)d=0>b,e=2047,f=0;else if(0===b)d=-Infinity===1/b,f=e=0;else{var g=(d=0>b)?-b:b;if(g>=+m.Math.pow(2,-1022)){var e=+m.Math.pow(2,52),f=+m.Math.log(g)/0.6931471805599453,f=+m.Math.floor(f)|0,f=1023>f?f:1023,k=g/+m.Math.pow(2,f)*e,g=+m.Math.floor(k), +k=k-g,g=0.5>k?g:0.5g?f:0.5a||1114111>10,56320|1023&a];a=[].concat(a);return d.apply(b,a)} +function Aa(a,b){for(var d=0,e=1,f=-1+(b.length|0)|0;0<=f;)d=d+w(65535&(b.charCodeAt(f)|0),e)|0,e=w(31,e),f=-1+f|0;return d}Im.prototype.a=new s({PD:0},!1,"scala.scalajs.runtime.RuntimeString$",{PD:1,c:1});var Qm=void 0;function Ba(){Qm||(Qm=(new Im).b());return Qm}function Rm(){this.tH=!1;this.ju=this.wm=this.qu=null;this.Q=!1}Rm.prototype=new t; +Rm.prototype.b=function(){Sm=this;for(var a={O:"java_lang_Object",T:"java_lang_String",V:"scala_Unit",Z:"scala_Boolean",C:"scala_Char",B:"scala_Byte",S:"scala_Short",I:"scala_Int",J:"scala_Long",F:"scala_Float",D:"scala_Double"},b=0;22>=b;)2<=b&&(a["T"+b]="scala_Tuple"+b),a["F"+b]="scala_Function"+b,b=1+b|0;this.qu=a;this.wm={sjsr_:"scala_scalajs_runtime_",sjs_:"scala_scalajs_",sci_:"scala_collection_immutable_",scm_:"scala_collection_mutable_",scg_:"scala_collection_generic_",sc_:"scala_collection_", +sr_:"scala_runtime_",s_:"scala_",jl_:"java_lang_",ju_:"java_util_"};this.ju=m.Object.keys(this.wm);return this};Rm.prototype.a=new s({QD:0},!1,"scala.scalajs.runtime.StackTrace$",{QD:1,c:1});var Sm=void 0;function Tm(){Sm||(Sm=(new Rm).b());return Sm}function Um(){}Um.prototype=new t;function G(a,b){return Vm(b)?b.Gf:b}function Wm(a,b){return b&&b.a&&b.a.t.dc?b:(new Xm).w(b)}Um.prototype.a=new s({RD:0},!1,"scala.scalajs.runtime.package$",{RD:1,c:1});var Ym=void 0; +function H(){Ym||(Ym=(new Um).b());return Ym}function vm(a){return!!(a&&a.a&&1===a.a.Qh&&a.a.Oh.t.Cp)}var ua=new s({Cp:0},!1,"scala.runtime.BoxedUnit",{Cp:1,c:1},void 0,function(a){return void 0===a});function Zm(){}Zm.prototype=new t; +function O(a,b,d){return b===d?!0:$f(b)?$f(d)?$m(b,d):an(d)?"number"===typeof b?+b===d.j:wa(b)?bn(Ia(b),(new T).Oa(d.j)):null===b?null===d:ya(b,d):null===b?null===d:ya(b,d):an(b)?an(d)?b.j===d.j:$f(d)?"number"===typeof d?+d===b.j:wa(d)?bn(Ia(d),(new T).Oa(b.j)):null===d?null===b:ya(d,b):null===b&&null===d:null===b?null===d:ya(b,d)} +function $m(a,b){if("number"===typeof a){var d=+a;if("number"===typeof b)return d===+b;if(wa(b)){var e=Ia(b);return d===cn(e)}return dn(b)?b.K(d):!1}return wa(a)?(d=Ia(a),wa(b)?(e=Ia(b),bn(d,e)):"number"===typeof b?(e=+b,cn(d)===e):dn(b)?b.K(d):!1):null===a?null===b:ya(a,b)}Zm.prototype.a=new s({$D:0},!1,"scala.runtime.BoxesRunTime$",{$D:1,c:1});var en=void 0;function P(){en||(en=(new Zm).b());return en}var Zh=new s({cE:0},!1,"scala.runtime.Null$",{cE:1,c:1});function fn(){}fn.prototype=new t; +function Ri(a,b){if(jb(b,1)||cb(b,1)||fb(b,1)||db(b,1)||eb(b,1)||$a(b,1)||ab(b,1)||bb(b,1)||Za(b,1)||vm(b))return b.d.length;if(null===b)throw(new va).b();throw(new K).w(b);}function ui(a,b){var d;if(null===b)d=0;else if($f(b))if(P(),Ha(b))d=b|0;else if(wa(b))d=Yl(Ia(b)),d=bn((new T).Oa(d),Ia(b))?d:Yl(Gm(Ia(b),Hm(Ia(b))));else if("number"===typeof b){var e=+b|0;d=+b;e===d?d=e:(e=gn(Ja(),+b),d=cn(e)===d?Yl(Gm(e,Hm(e))):Ca(Da(),+b))}else d=za(b);else d=za(b);return d} +function Si(a,b,d,e){if(jb(b,1))b.d[d]=e;else if(cb(b,1))b.d[d]=e|0;else if(fb(b,1))b.d[d]=+e;else if(db(b,1))b.d[d]=Ia(e);else if(eb(b,1))b.d[d]=qa(e);else if($a(b,1))b.d[d]=null===e?0:e.j;else if(ab(b,1))b.d[d]=e|0;else if(bb(b,1))b.d[d]=e|0;else if(Za(b,1))b.d[d]=!!e;else if(vm(b))b.d[d]=e;else{if(null===b)throw(new va).b();throw(new K).w(b);}} +function Mh(a,b){if(b&&b.a&&b.a.t.An)return b.Ed.getComponentType();if(b&&b.a&&b.a.t.cd)return b.sd();throw(new xj).h(Db((new Eb).La((new C).A(["unsupported schematic "," (",")"])),(new C).A([b,la(b)])));}function hn(a,b){var d=b.qb(),e=b.jb()+"(";return L(d,e,",",")")}fn.prototype.a=new s({eE:0},!1,"scala.runtime.ScalaRunTime$",{eE:1,c:1});var jn=void 0;function U(){jn||(jn=(new fn).b());return jn}function kn(){}kn.prototype=new t; +kn.prototype.ej=function(a,b){var d;d=w(-862048943,b);d=Mf(Ve(),d,15);d=w(461845907,d);return a^d};function ln(a,b){if(null===b)return 0;if(wa(b)){var d=Ia(b);return Yl(d)}return"number"===typeof b?+b|0:b!==b||qa(b)===b?qa(b)|0:za(b)}kn.prototype.Nc=function(a,b){var d=this.ej(a,b),d=Mf(Ve(),d,13);return-430675100+w(5,d)|0};kn.prototype.Cg=function(a,b){var d=a^b,d=w(-2048144789,d^(d>>>16|0)),d=d^(d>>>13|0),d=w(-1028477387,d);return d^=d>>>16|0}; +kn.prototype.a=new s({gE:0},!1,"scala.runtime.Statics$",{gE:1,c:1});var mn=void 0;function nn(){mn||(mn=(new kn).b());return mn}function on(){this.lo=null}on.prototype=new t;function Vc(a){var b=new on;b.lo=a;return b}on.prototype.ug=function(a){a.classList.add(this.lo.Ha)};on.prototype.je=function(a){this.ug(a)};on.prototype.a=new s({xq:0},!1,"scalatags.JsDom$Aggregate$$anon$1",{xq:1,c:1,tf:1});function R(){this.W=this.yb=null}R.prototype=new t; +function Q(a,b,d){a.yb=d;if(null===b)throw G(H(),null);a.W=b;return a}R.prototype.Ze=function(a){var b=m.document.createElement("div"),d=this.yb;b.style.setProperty(d.yb.ke,ka(d.Za));b=Rb(Ba(),b.getAttribute("style"),":",2);rc();null===b?d=sg():(d=pn(Ac(),b),Ac(),d=(new tg).w(Kj(d,new Bc)));if(d.m()||null===d.Wc()||0!==d.Wc().pb(2))throw(new K).w(b);b=d.Wc().ma(0);d=d.Wc().ma(1);b=a.qf.Np(b,d);return Jd(new Kd,a.he,b,a.Bc)}; +R.prototype.a=new s({yq:0},!1,"scalatags.JsDom$Aggregate$StyleFrag",{yq:1,c:1,Vl:1});function qn(){}qn.prototype=new t;qn.prototype.mm=function(a,b,d){a.setAttribute(b.Ha,ka(d))};qn.prototype.a=new s({Bq:0},!1,"scalatags.JsDom$GenericAttr",{Bq:1,c:1,Mq:1});function wb(){this.Vc=null}wb.prototype=new t;wb.prototype.Cb=function(a,b){return A(new B,a,b,this.Vc)};wb.prototype.$d=function(a){this.Vc=a;return this};wb.prototype.a=new s({Cq:0},!1,"scalatags.JsDom$GenericPixelStyle",{Cq:1,c:1,Sq:1}); +function rn(){this.Vc=null}rn.prototype=new t;rn.prototype.Cb=function(a,b){var d=new B,e;Pg||(Pg=(new Og).b());e=""+Bj(Ba(),b)+"px";return A(d,a,e,this.Vc)};rn.prototype.$d=function(a){this.Vc=a;return this};rn.prototype.a=new s({Dq:0},!1,"scalatags.JsDom$GenericPixelStylePx",{Dq:1,c:1,Sq:1});function z(){}z.prototype=new t;z.prototype.a=new s({Eq:0},!1,"scalatags.JsDom$GenericStyle",{Eq:1,c:1,aG:1});function ed(){this.Om=null}ed.prototype=new t;function dd(a,b){a.Om=b;return a} +ed.prototype.mm=function(a,b,d){a[b.Ha]=this.Om.l(d)};ed.prototype.a=new s({Kq:0},!1,"scalatags.LowPriorityImplicits$$anon$2",{Kq:1,c:1,Mq:1});function sb(){}sb.prototype=new t;sb.prototype.Rp=h("http://www.w3.org/1999/xhtml");sb.prototype.a=new s({Qq:0},!1,"scalatags.generic.Namespace$$anon$1",{Qq:1,c:1,Oq:1});function tb(){}tb.prototype=new t;tb.prototype.Rp=h("http://www.w3.org/2000/svg");tb.prototype.a=new s({Rq:0},!1,"scalatags.generic.Namespace$$anon$2",{Rq:1,c:1,Oq:1}); +function sn(){this.W=this.Do=this.Ei=null}sn.prototype=new t;function fd(a,b,d){var e=new sn;e.Ei=b;e.Do=d;if(null===a)throw G(H(),null);e.W=a;return e}sn.prototype.je=function(a){this.Ei.R(M(function(a,d){return function(e){a.Do.l(e).je(d)}}(this,a)))};sn.prototype.a=new s({rr:0},!1,"scalatags.generic.Util$SeqNode",{rr:1,c:1,tf:1});function tn(){this.kg=null}tn.prototype=new t; +tn.prototype.Ze=function(a){var b=a.he,d=(this.kg.Q?this.kg.fg:ac(this.kg)).qf.Al(a.qf),e=(this.kg.Q?this.kg.fg:ac(this.kg)).Bc;a=a.Bc;var f=bc();return Jd(new Kd,b,d,e.sf(a,f.N))};function Zd(a){var b=new tn;if(null===a)throw G(H(),null);b.kg=a;return b}tn.prototype.a=new s({vr:0},!1,"scalatags.stylesheet.Cls$$anon$1",{vr:1,c:1,Vl:1});function un(){this.Ce=null}un.prototype=new t; +function Hd(a,b){var d=a.Ce,e=x();if(null===d?null===e:d.K(e))return(new un).La(jk(bc(),(new C).A([":"+b])));var d=a.Ce.ef(),e=a.Ce.Je(),f=bc();return(new un).La(d.Dd(e+":"+b,f.N))}un.prototype.La=function(a){this.Ce=a;return this};un.prototype.a=new s({xr:0},!1,"scalatags.stylesheet.Selector",{xr:1,c:1,wr:1});function vn(){this.W=this.he=null}vn.prototype=new t;function wn(){}wn.prototype=vn.prototype;function Nd(a,b){return xn("",a.he,b)} +vn.prototype.Kv=function(a,b){this.he=b;if(null===a)throw G(H(),null);this.W=a;return this};function yn(){this.sh=null}yn.prototype=new t;yn.prototype.Ze=function(a){var b=a.he,d=a.qf;a=a.Bc;var e=jk(bc(),(new C).A([this.sh])),f=bc();return Jd(new Kd,b,d,a.sf(e,f.N))};function Md(a){var b=new yn;b.sh=a;return b}yn.prototype.a=new s({zr:0},!1,"scalatags.stylesheet.StyleSheetFrag$StyleTreeFrag",{zr:1,c:1,Vl:1});function mc(){this.Hj=null}mc.prototype=new t;mc.prototype.Rk=c("Hj"); +mc.prototype.Fe=function(a){this.Hj=a;return this};mc.prototype.a=new s({gs:0},!1,"upickle.Knot$R",{gs:1,c:1,dm:1});function qe(){this.Dl=null}qe.prototype=new t;qe.prototype.Rk=c("Dl");qe.prototype.Fe=function(a){this.Dl=a;return this};qe.prototype.a=new s({ks:0},!1,"upickle.Reader$$anon$3",{ks:1,c:1,dm:1});function Ie(){this.Tp=null}Ie.prototype=new t;function He(a,b){a.Tp=b;return a}Ie.prototype.Up=c("Tp");Ie.prototype.a=new s({ps:0},!1,"upickle.Writer$$anon$2",{ps:1,c:1,ns:1}); +var ta=new s({bw:0},!1,"java.lang.Boolean",{bw:1,c:1,Zc:1},void 0,function(a){return"boolean"===typeof a});function Re(){this.j=0}Re.prototype=new t;l=Re.prototype;l.K=function(a){return an(a)?this.j===a.j:!1};l.o=function(){return m.String.fromCharCode(this.j)};l.nc=function(a){this.j=a;return this};l.M=c("j");function an(a){return!!(a&&a.a&&a.a.t.zn)}l.a=new s({zn:0},!1,"java.lang.Character",{zn:1,c:1,Zc:1});function oi(){eg.call(this)}oi.prototype=new fg;function zn(){}zn.prototype=oi.prototype; +function An(){this.SI=this.Pi=this.yb=null}An.prototype=new t;function Bn(){}l=Bn.prototype=An.prototype;l.b=function(){An.prototype.Ee.call(this,null,null);return this};l.Ti=function(){var a=Tm(),b;a:try{b=a.undef()}catch(d){a=Wm(H(),d);if(null!==a){if(Vm(a)){b=a.Gf;break a}throw G(H(),a);}throw d;}this.stackdata=b;return this};l.di=c("yb");l.o=function(){var a=ib(la(this)),b=this.di();return null===b?a:a+": "+b};l.Ee=function(a,b){this.yb=a;this.Pi=b;this.Ti();return this}; +function Cn(){this.Zp=0;this.Bl=null}Cn.prototype=new t;function Dn(){}Dn.prototype=Cn.prototype;Cn.prototype.o=c("Bl");Cn.prototype.ff=function(a,b){this.Zp=a;this.Bl=b;return this};var En=new s({Uf:0},!1,"java.util.concurrent.TimeUnit",{Uf:1,c:1,e:1});Cn.prototype.a=En;function Mm(){this.pn=this.mf=null;this.ho=this.io=0;this.Ie=this.Ck=this.Kg=null;this.Hi=this.Hk=!1;this.lm=0}Mm.prototype=new t; +function Nm(a){if(a.Hi){a.Hk=!0;a.Ie=a.Kg.exec(a.Ck);if(null!==a.Ie){var b=a.Ie[0];if(void 0===b)throw(new uj).h("undefined.get");if(null===b)throw(new va).b();""===b&&(b=a.Kg,b.lastIndex=1+(b.lastIndex|0)|0)}else a.Hi=!1;return null!==a.Ie}return!1}function Om(a){if(null===a.Ie)throw(new Fn).h("No match available");return a.Ie}function Gn(a){Hn(a);Nm(a);null===a.Ie||0===(Om(a).index|0)&&Pm(a)===(a.Ck.length|0)||Hn(a);return null!==a.Ie} +function Pm(a){var b=Om(a).index|0;a=Om(a)[0];if(void 0===a)throw(new uj).h("undefined.get");return b+(a.length|0)|0}function Lm(a,b,d,e){a.mf=b;a.pn=d;a.io=0;a.ho=e;a.Kg=new m.RegExp(a.mf.En,a.mf.Dn);a.Ck=ka(Ea(a.pn,a.io,a.ho));a.Ie=null;a.Hk=!1;a.Hi=!0;a.lm=0;return a}function Hn(a){a.Kg.lastIndex=0;a.Ie=null;a.Hk=!1;a.Hi=!0;a.lm=0}Mm.prototype.a=new s({Pw:0},!1,"java.util.regex.Matcher",{Pw:1,c:1,yH:1});function Bc(){}Bc.prototype=new t;Bc.prototype.$e=function(){In();uc();return(new Jn).b()}; +Bc.prototype.Tc=function(){In();uc();return(new Jn).b()};Bc.prototype.a=new s({Iz:0},!1,"scala.LowPriorityImplicits$$anon$4",{Iz:1,c:1,qi:1});function Kn(){}Kn.prototype=new t;Kn.prototype.$e=function(){return(new dk).b()};Kn.prototype.Tc=function(){return(new dk).b()};Kn.prototype.a=new s({Vz:0},!1,"scala.Predef$$anon$3",{Vz:1,c:1,qi:1});function dn(a){return!!(a&&a.a&&a.a.t.pI)}function Wg(){}Wg.prototype=new t;Wg.prototype.o=h("object AnyRef"); +Wg.prototype.a=new s({uA:0},!1,"scala.package$$anon$1",{uA:1,c:1,$H:1});function Ln(){this.ml=this.Jk=this.ll=this.bJ=this.UI=this.KH=this.TI=this.XG=0}Ln.prototype=new si;Ln.prototype.b=function(){Mn=this;this.ll=Aa(Ba(),"Seq");this.Jk=Aa(Ba(),"Map");this.ml=Aa(Ba(),"Set");return this};function Nn(a,b){var d;if(b&&b.a&&b.a.t.Jo){d=0;for(var e=a.ll,f=b;!f.m();){var g=f.u(),f=f.s(),e=a.Nc(e,ui(U(),g));d=1+d|0}d=a.Cg(e,d)}else d=xi(a,b,a.ll);return d} +Ln.prototype.a=new s({YA:0},!1,"scala.util.hashing.MurmurHash3$",{YA:1,sI:1,c:1});var Mn=void 0;function wi(){Mn||(Mn=(new Ln).b());return Mn}function On(){this.W=this.hj=null}On.prototype=new t;function Pn(){}Pn.prototype=On.prototype;On.prototype.R=function(a){this.W.R(M(function(a,d){return function(e){return a.hj.l(e)?d.l(e):void 0}}(this,a)))};On.prototype.od=function(a,b){this.hj=b;if(null===a)throw G(H(),null);this.W=a;return this}; +On.prototype.a=new s({so:0},!1,"scala.collection.TraversableLike$WithFilter",{so:1,c:1,$:1});function Qn(){this.W=null}Qn.prototype=new t;Qn.prototype.$e=function(){return Wj(new Xj,this.W.Ri())};Qn.prototype.Tc=function(){return Wj(new Xj,this.W.Ri())};Qn.prototype.a=new s({vB:0},!1,"scala.collection.generic.GenMapFactory$MapCanBuildFrom",{vB:1,c:1,qi:1});function Rn(){}Rn.prototype=new ik;function Sn(){}Sn.prototype=Rn.prototype;function Tn(){this.N=null}Tn.prototype=new ik;function Un(){} +Un.prototype=Tn.prototype;Tn.prototype.b=function(){this.N=(new Vn).ii(this);return this};function Wn(){this.W=null}Wn.prototype=new t;function Xn(){}Xn.prototype=Wn.prototype;Wn.prototype.$e=function(){return this.W.na()};Wn.prototype.Tc=function(a){return a.Ab().na()};Wn.prototype.ii=function(a){if(null===a)throw G(H(),null);this.W=a;return this};function Yn(){}Yn.prototype=new nk;function Zn(){}Zn.prototype=Yn.prototype;function $n(){}$n.prototype=new gk;function ao(){}ao.prototype=$n.prototype; +function bo(){this.Mk=this.Xv=null}bo.prototype=new sk;function co(a,b){a.Mk=b;var d=new eo;if(null===a)throw G(H(),null);d.ja=a;a.Xv=d;return a}bo.prototype.Wj=function(a,b){return zg(this.Mk,a,b)};bo.prototype.a=new s({EB:0},!1,"scala.collection.immutable.HashMap$$anon$2",{EB:1,JB:1,c:1});function eo(){this.ja=null}eo.prototype=new sk;eo.prototype.Wj=function(a,b){return zg(this.ja.Mk,b,a)};eo.prototype.a=new s({FB:0},!1,"scala.collection.immutable.HashMap$$anon$2$$anon$3",{FB:1,JB:1,c:1}); +function fo(){}fo.prototype=new t;fo.prototype.b=function(){return this};fo.prototype.l=function(){return this};fo.prototype.o=h("\x3cfunction1\x3e");fo.prototype.a=new s({SB:0},!1,"scala.collection.immutable.List$$anon$1",{SB:1,c:1,x:1});function go(){}go.prototype=new t;function ho(){}ho.prototype=go.prototype;go.prototype.o=h("\x3cfunction0\x3e");function io(){}io.prototype=new t;function jo(){}jo.prototype=io.prototype;io.prototype.b=function(){return this};io.prototype.o=h("\x3cfunction1\x3e"); +function ko(){}ko.prototype=new t;function lo(){}lo.prototype=ko.prototype;ko.prototype.o=h("\x3cfunction2\x3e");function mo(){this.v=!1}mo.prototype=new t;mo.prototype.o=function(){return""+this.v};function Oj(a){var b=new mo;b.v=a;return b}mo.prototype.a=new s({ZD:0},!1,"scala.runtime.BooleanRef",{ZD:1,c:1,e:1});function od(){this.v=0}od.prototype=new t;od.prototype.o=function(){return""+this.v};od.prototype.Oa=function(a){this.v=a;return this}; +od.prototype.a=new s({aE:0},!1,"scala.runtime.IntRef",{aE:1,c:1,e:1});function Hj(){this.v=null}Hj.prototype=new t;Hj.prototype.o=function(){return Bj(Ba(),this.v)};Hj.prototype.w=function(a){this.v=a;return this};Hj.prototype.a=new s({dE:0},!1,"scala.runtime.ObjectRef",{dE:1,c:1,e:1});function no(){}no.prototype=new t;function oo(){}oo.prototype=no.prototype;no.prototype.Ii=ba();function Lc(){this.W=this.wo=this.Ei=null}Lc.prototype=new t; +Lc.prototype.ug=function(a){this.Ei.R(M(function(a,d){return function(e){a.wo.l(e).je(d)}}(this,a)))};Lc.prototype.je=function(a){this.ug(a)};function Kc(a,b,d,e){a.Ei=d;a.wo=e;if(null===b)throw G(H(),null);a.W=b;return a}Lc.prototype.a=new s({Aq:0},!1,"scalatags.JsDom$Cap$SeqFrag",{Aq:1,c:1,Lj:1,tf:1});function po(){}po.prototype=new t;po.prototype.o=h("TypedTag");po.prototype.a=new s({Hq:0},!1,"scalatags.JsDom$TypedTag$",{Hq:1,c:1,g:1,e:1});var qo=void 0; +function ro(){qo||(qo=(new po).b());return qo}function so(){this.W=this.Pi=null}so.prototype=new t;so.prototype.ug=function(a){a.appendChild(this.Pi)};so.prototype.je=function(a){this.ug(a)};function Mc(a,b){var d=new so;d.Pi=b;if(null===a)throw G(H(),null);d.W=a;return d}so.prototype.a=new s({Lq:0},!1,"scalatags.LowPriorityImplicits$bindNode",{Lq:1,c:1,Lj:1,tf:1});function to(){vn.call(this)}to.prototype=new wn; +to.prototype.a=new s({yr:0},!1,"scalatags.stylesheet.StyleSheet$cls$",{yr:1,jG:1,c:1,wr:1});function Ed(){this.jg=this.Tj=this.Vm=this.fo=this.bf=this.wj=this.Ln=this.Jn=this.Kn=this.pe=this.Qn=this.Rn=null;this.Q=0;this.Ki=this.jF=null}Ed.prototype=new t;function uo(a){if(0===(512&a.Q)&&0===(512&a.Q)){var b=ae(a),d=ae(a).Ha,d=cc("exact",d);a.Vm=xn(d,b.rd,b.ld);a.Q|=512}return a.Vm}Ed.prototype.b=function(){this.jg=(new un).La(x());return this}; +function sd(a){if(0===(128&a.Q)&&0===(128&a.Q)){var b=Wd(a),d=Wd(a).Ha,d=cc("closed",d);a.bf=xn(d,b.rd,b.ld);a.Q|=128}return a.bf}function $c(a){if(0===(4&a.Q)&&0===(4&a.Q)){var b=be(a),d=be(a).Ha,d=cc("menu",d);a.pe=xn(d,b.rd,b.ld);a.Q|=4}return a.pe}function wd(a){if(0===(16&a.Q)&&0===(16&a.Q)){var b=Xd(a),d=Xd(a).Ha,d=cc("menuItem",d);a.Jn=xn(d,b.rd,b.ld);a.Q|=16}return a.Jn} +function ud(a){if(0===(64&a.Q)&&0===(64&a.Q)){var b=Fd(a),d=Fd(a).Ha,d=cc("selected",d);a.wj=xn(d,b.rd,b.ld);a.Q|=64}return a.wj}function Uc(a){if(0===(1&a.Q)&&0===(1&a.Q)){var b=$d(a),d=$d(a).Ha,d=cc("noteBox",d);a.Rn=xn(d,b.rd,b.ld);a.Q|=1}return a.Rn}function Xc(a){if(0===(2&a.Q)&&0===(2&a.Q)){var b=Sd(a),d=Sd(a).Ha,d=cc("note",d);a.Qn=xn(d,b.rd,b.ld);a.Q|=2}return a.Qn} +function bd(a){if(0===(8&a.Q)&&0===(8&a.Q)){var b=Yd(a),d=Yd(a).Ha,d=cc("menuLink",d);a.Kn=xn(d,b.rd,b.ld);a.Q|=8}return a.Kn}function td(a){if(0===(256&a.Q)&&0===(256&a.Q)){var b=de(a),d=de(a).Ha,d=cc("pathed",d);a.fo=xn(d,b.rd,b.ld);a.Q|=256}return a.fo}function Gd(a){if(null===a.Ki&&null===a.Ki){var b=new to;vn.prototype.Kv.call(b,a,x());a.Ki=b}return a.Ki} +function Yb(a){0===(1024&a.Q)&&(a.Tj=jk(bc(),(new C).A([Uc(a),Xc(a),$c(a),bd(a),wd(a),yd(a),ud(a),sd(a),td(a),uo(a)])),a.Q|=1024);return a.Tj}function yd(a){if(0===(32&a.Q)&&0===(32&a.Q)){var b=Od(a),d=Od(a).Ha,d=cc("menuList",d);a.Ln=xn(d,b.rd,b.ld);a.Q|=32}return a.Ln}Ed.prototype.a=new s({Fr:0},!1,"scalatex.scrollspy.Styles$$anon$1",{Fr:1,c:1,kG:1,iG:1});function Ee(){this.El=this.Fl=null}Ee.prototype=new t;function De(a,b,d){a.Fl=b;a.El=d;return a}Ee.prototype.Rk=c("El");Ee.prototype.Up=c("Fl"); +Ee.prototype.a=new s({is:0},!1,"upickle.ReadWriter$$anon$1",{is:1,c:1,ns:1,dm:1});var na=new s({cw:0},!1,"java.lang.Byte",{cw:1,Gg:1,c:1,Zc:1},void 0,function(a){return a<<24>>24===a&&1/a!==1/-0}),sa=new s({gw:0},!1,"java.lang.Double",{gw:1,Gg:1,c:1,Zc:1},void 0,function(a){return"number"===typeof a});function vo(){An.call(this)}vo.prototype=new Bn;function wo(){}wo.prototype=vo.prototype;vo.prototype.h=function(a){vo.prototype.Ee.call(this,a,null);return this};function xo(){An.call(this)} +xo.prototype=new Bn;function yo(){}yo.prototype=xo.prototype;xo.prototype.h=function(a){xo.prototype.Ee.call(this,a,null);return this}; +var ra=new s({jw:0},!1,"java.lang.Float",{jw:1,Gg:1,c:1,Zc:1},void 0,function(a){return a!==a||qa(a)===a}),pa=new s({lw:0},!1,"java.lang.Integer",{lw:1,Gg:1,c:1,Zc:1},void 0,function(a){return Ha(a)}),xa=new s({pw:0},!1,"java.lang.Long",{pw:1,Gg:1,c:1,Zc:1},void 0,function(a){return wa(a)}),oa=new s({sw:0},!1,"java.lang.Short",{sw:1,Gg:1,c:1,Zc:1},void 0,function(a){return a<<16>>16===a&&1/a!==1/-0});function zo(){this.Bf=null;this.bf=!1}zo.prototype=new t;l=zo.prototype; +l.b=function(){zo.prototype.Lv.call(this,(new Ao).b());return this};function Bo(a,b,d,e,f,g,k){var n=(b.length|0)+(d.length|0)|0;if(g<=n)b=""+d+b;else{var r=Co("-",f);e=Co("0",f)&&!e;var y="";for(g=g-n|0;0= +Df||Df>pb.d.length){var mv=me[5];if(void 0===mv){var nv;throw(new uj).h("undefined.get");}nv=mv;throw(new jq).h(nv);}var ca=pb.d[-1+Df|0],ov=me[3],Kp=void 0===ov?"":ov;if(null===Kp){var pv;throw(new va).b();}pv=Kp;var qv=""!==pv,Zb=qv?Ue(Ve(),Kp,10):0,rv=me[4],Lp=void 0===rv?"":rv;if(null===Lp){var sv;throw(new va).b();}sv=Lp;var bh=""!==sv,ch=bh?Ue(Ve(),Lp,10):0,tv=me[5];if(void 0===tv){var uv;throw(new uj).h("undefined.get");}uv=tv;var Kb=65535&(uv.charCodeAt(0)|0);switch(Kb){case 98:case 66:if(null=== +ca)var Mp="false";else if("boolean"===typeof ca)var Ay=ca,Mp=Bj(Ba(),Ay);else Mp="true";Bo(Wa,Mp,"",!1,Ra,Zb,Kb);break;case 104:case 72:var By=null===ca?"null":(+(za(ca)>>>0)).toString(16);Bo(Wa,By,"",!1,Ra,Zb,Kb);break;case 115:case 83:if(null!==ca||Co("#",Ra))if(ca&&ca.a&&ca.a.t.xH){var Cy=ca,Dy=(Co("-",Ra)?1:0)|(Co("#",Ra)?4:0),vv;Ob();var wv=Kb;vv=Nb(0,wv)===wv;Cy.rH(Wa,Dy|(vv?2:0),qv?Zb:-1,bh?ch:-1);sg()}else{if(null===ca||Co("#",Ra))throw kq();Bo(Wa,ka(ca),"",!1,Ra,Zb,Kb)}else Bo(Wa,"null", +"",!1,Ra,Zb,Kb);break;case 99:case 67:var Np;if(Ha(ca))Np=ca|0;else if(an(ca))Np=null===ca?0:ca.j;else throw(new K).w(ca);Bo(Wa,m.String.fromCharCode(65535&Np),"",!1,Ra,Zb,Kb);break;case 100:var Fy=Ho(ca);Io(Wa,""+Fy,!1,Ra,Zb,Kb);break;case 111:if(Ha(ca))var Dk=(+((ca|0)>>>0)).toString(8);else if(wa(ca)){var dh=Ia(ca),Op=2097151&dh.oa,Pp=(1048575&dh.Y)<<1|dh.oa>>21,xv=dh.z<<2|dh.Y>>20;if(0!==xv)var Gy=(+(xv>>>0)).toString(8),yv=(+(Pp>>>0)).toString(8),Hy="0000000".substring(yv.length|0),zv=(+(Op>>> +0)).toString(8),Dk=Gy+(""+Hy+yv)+(""+"0000000".substring(zv.length|0)+zv);else if(0!==Pp)var Iy=(+(Pp>>>0)).toString(8),Av=(+(Op>>>0)).toString(8),Dk=Iy+(""+"0000000".substring(Av.length|0)+Av);else Dk=(+(Op>>>0)).toString(8)}else throw(new K).w(ca);Fo(Wa,Dk,Co("#",Ra)?"0":"",Ra,Zb,Kb);break;case 120:case 88:if(Ha(ca))var Ek=(+((ca|0)>>>0)).toString(16);else if(wa(ca)){var eh=Ia(ca),Qp=eh.Y>>2,Rp=eh.oa|(3&eh.Y)<<22;if(0!==eh.z)var Jy=(+(eh.z>>>0)).toString(16),Bv=(+(Qp>>>0)).toString(16),Ky="000000".substring(1+ +(Bv.length|0)|0),Cv=(+(Rp>>>0)).toString(16),Ek=Jy+(""+Ky+Bv)+(""+"000000".substring(Cv.length|0)+Cv);else if(0!==Qp)var Ly=(+(Qp>>>0)).toString(16),Dv=(+(Rp>>>0)).toString(16),Ek=Ly+(""+"000000".substring(Dv.length|0)+Dv);else Ek=(+(Rp>>>0)).toString(16)}else throw(new K).w(ca);Fo(Wa,Ek,Co("#",Ra)?"0x":"",Ra,Zb,Kb);break;case 101:case 69:Go(Wa,bh?ch:6,Ra,ca,Zb,Kb);break;case 103:case 71:var Sp=Ho(ca),Tp=0>Sp?-Sp:Sp,Up=bh?0===ch?1:ch:6;if(1E-4<=Tp&&Tp<+m.Math.pow(10,Up)){var My=+m.Math.log(Tp)/2.302585092994046, +Ny=+m.Math.ceil(My)|0,Oy=Ho(ca),Ev=Up-Ny|0,Py=Oy.toFixed(0b.z||a.z===b.z&&a.Y>b.Y||a.z===b.z&&a.Y===b.Y&&a.oa>=b.oa:!(0===(524288&b.z)||a.z>13|(15&a.Y)<<9,f=8191&a.Y>>4,g=a.Y>>17|(255&a.z)<<5,k=(1048320&a.z)>>8;d|=0;e|=0;f|=0;g|=0;k|=0;var n=8191&b.oa,r=b.oa>>13|(15&b.Y)<<9,y=8191&b.Y>>4,S=b.Y>>17|(255&b.z)<<5,Oa=(1048320&b.z)>>8;var n=n|0,r=r|0,y=y|0,pb=S|0,Rd=Oa|0,Zc=w(d,n),Ic=w(e,n),Oa=w(f,n),S=w(g,n),k=w(k,n);0!==r&&(Ic=Ic+w(d,r)|0,Oa=Oa+w(e,r)|0,S=S+w(f,r)|0,k=k+w(g,r)|0);0!==y&&(Oa=Oa+w(d,y)|0,S=S+w(e,y)|0,k=k+w(f,y)|0);0!==pb&&(S=S+w(d,pb)|0,k=k+w(e,pb)|0);0!==Rd&&(k=k+w(d,Rd)|0);d=(4194303& +Zc)+((511&Ic)<<13)|0;e=((((Zc>>22)+(Ic>>9)|0)+((262143&Oa)<<4)|0)+((31&S)<<17)|0)+(d>>22)|0;return(new T).k(4194303&d,4194303&e,1048575&((((Oa>>18)+(S>>5)|0)+((4095&k)<<8)|0)+(e>>22)|0))}l.k=function(a,b,d){this.oa=a;this.Y=b;this.z=d;return this};function Hp(a,b){return xq(a,b)[1]} +l.o=function(){if(0===this.oa&&0===this.Y&&0===this.z)return"0";if(bn(this,Ja().rg))return"-9223372036854775808";if(0!==(524288&this.z))return"-"+Tf(this).o();var a=Ja().jm,b=this,d="";for(;;){var e=b;if(0===e.oa&&0===e.Y&&0===e.z)return d;e=xq(b,a);b=e[0];e=""+Yl(e[1]);d=(0===b.oa&&0===b.Y&&0===b.z?"":"000000000".substring(e.length|0))+e+d}}; +function xq(a,b){if(0===b.oa&&0===b.Y&&0===b.z)throw(new yq).h("/ by zero");if(0===a.oa&&0===a.Y&&0===a.z)return[Ja().kd,Ja().kd];if(bn(b,Ja().rg))return bn(a,Ja().rg)?[Ja().Rj,Ja().kd]:[Ja().kd,a];var d=0!==(524288&a.z),e=0!==(524288&b.z),f=bn(a,Ja().rg),g=0===b.z&&0===b.Y&&0!==b.oa&&0===(b.oa&(-1+b.oa|0))?Pf(Ve(),b.oa):0===b.z&&0!==b.Y&&0===b.oa&&0===(b.Y&(-1+b.Y|0))?22+Pf(Ve(),b.Y)|0:0!==b.z&&0===b.Y&&0===b.oa&&0===(b.z&(-1+b.z|0))?44+Pf(Ve(),b.z)|0:-1;if(0<=g){if(f)return d=zq(a,g),[e?Tf(d):d, +Ja().kd];var f=0!==(524288&a.z)?Tf(a):a,k=zq(f,g),e=d!==e?Tf(k):k,f=22>=g?(new T).k(f.oa&(-1+(1<=g?(new T).k(f.oa,f.Y&(-1+(1<<(-22+g|0))|0),0):(new T).k(f.oa,f.Y,f.z&(-1+(1<<(-44+g|0))|0)),d=d?Tf(f):f;return[e,d]}g=0!==(524288&b.z)?Tf(b):b;if(f)var n=Ja().Pj;else{var r=0!==(524288&a.z)?Tf(a):a;if(lm(g,r))return[Ja().kd,a];n=r}var r=Aq(g)-Aq(n)|0,y=Em(g,r),g=r,r=y,y=n,n=Ja().kd;a:for(;;){if(0>g)var S=!0;else S=y,S=0===S.oa&&0===S.Y&&0===S.z;if(S){var Oa=n,k=y;break a}else S=Vf(y,Tf(r)), +0===(524288&S.z)?(y=-1+g|0,r=zq(r,1),n=22>g?(new T).k(n.oa|1<g?(new T).k(n.oa,n.Y|1<<(-22+g|0),n.z):(new T).k(n.oa,n.Y,n.z|1<<(-44+g|0)),g=y,y=S):(g=-1+g|0,r=zq(r,1))}e=d!==e?Tf(Oa):Oa;d&&f?(d=Tf(k),f=Ja().Rj,d=Vf(d,Tf(f))):d=d?Tf(k):k;return[e,d]}function Fm(a,b){return(new T).k(a.oa&b.oa,a.Y&b.Y,a.z&b.z)}function Hm(a){return(new T).k(4194303&(a.Y>>10|a.z<<12),4194303&(a.z>>>10|0),0)} +function lm(a,b){return 0===(524288&a.z)?0!==(524288&b.z)||a.z>b.z||a.z===b.z&&a.Y>b.Y||a.z===b.z&&a.Y===b.Y&&a.oa>b.oa:!(0===(524288&b.z)||a.zd){var e=22-d|0;return(new T).k(4194303&a.oa<>e),1048575&(a.z<>e))}return 44>d?(e=-22+d|0,(new T).k(0,4194303&a.oa<>(44-d|0)))):(new T).k(0,0,1048575&a.oa<<(-44+d|0))}function Yl(a){return a.oa|a.Y<<22} +l.Oa=function(a){T.prototype.k.call(this,4194303&a,4194303&a>>22,0>a?1048575:0);return this};function Tf(a){var b=4194303&(1+~a.oa|0),d=4194303&(~a.Y+(0===b?1:0)|0);return(new T).k(b,d,1048575&(~a.z+(0===b&&0===d?1:0)|0))}function Vf(a,b){var d=a.oa+b.oa|0,e=(a.Y+b.Y|0)+(d>>22)|0;return(new T).k(4194303&d,4194303&e,1048575&((a.z+b.z|0)+(e>>22)|0))} +function zq(a,b){var d=63&b,e=0!==(524288&a.z),f=e?-1048576|a.z:a.z;if(22>d)return e=22-d|0,(new T).k(4194303&(a.oa>>d|a.Y<>d|f<>d);if(44>d){var g=-22+d|0;return(new T).k(4194303&(a.Y>>g|f<<(44-d|0)),4194303&f>>g,1048575&(e?1048575:0))}return(new T).k(4194303&f>>(-44+d|0),4194303&(e?4194303:0),1048575&(e?1048575:0))}function cn(a){return bn(a,Ja().rg)?-9223372036854775E3:0!==(524288&a.z)?-cn(Tf(a)):a.oa+4194304*a.Y+17592186044416*a.z} +function Zl(a,b){return xq(a,b)[0]}function Aq(a){return 0!==a.z?-12+Of(Ve(),a.z)|0:0!==a.Y?10+Of(Ve(),a.Y)|0:32+Of(Ve(),a.oa)|0}l.M=function(){return Yl(Gm(this,Hm(this)))};function Gm(a,b){return(new T).k(a.oa^b.oa,a.Y^b.Y,a.z^b.z)}function bn(a,b){return a.oa===b.oa&&a.Y===b.Y&&a.z===b.z}function wa(a){return!!(a&&a.a&&a.a.t.Bp)}l.a=new s({Bp:0},!1,"scala.scalajs.runtime.RuntimeLong",{Bp:1,Gg:1,c:1,Zc:1}); +function Bq(){this.RG=this.QG=this.PG=this.OG=this.NG=this.MG=this.LG=this.JG=this.IG=this.pG=this.oG=this.mF=this.lF=this.kF=0;this.jm=this.Pj=this.rg=this.us=this.Rj=this.kd=null}Bq.prototype=new t;Bq.prototype.b=function(){Cq=this;this.kd=(new T).k(0,0,0);this.Rj=(new T).k(1,0,0);this.us=(new T).k(4194303,4194303,1048575);this.rg=(new T).k(0,0,524288);this.Pj=(new T).k(4194303,4194303,524287);this.jm=(new T).k(1755648,238,0);return this};function Sf(){return Ja().kd} +function gn(a,b){if(b!==b)return a.kd;if(-9223372036854775E3>b)return a.rg;if(9223372036854775E3<=b)return a.Pj;if(0>b)return Tf(gn(a,-b));var d=b,e=17592186044416<=d?d/17592186044416|0:0,d=d-17592186044416*e,f=4194304<=d?d/4194304|0:0;return(new T).k(d-4194304*f|0,f,e)}Bq.prototype.a=new s({OD:0},!1,"scala.scalajs.runtime.RuntimeLong$",{OD:1,c:1,g:1,e:1});var Cq=void 0;function Ja(){Cq||(Cq=(new Bq).b());return Cq}function Dq(){}Dq.prototype=new t;function Eq(){}Eq.prototype=Dq.prototype; +Dq.prototype.b=function(){return this};Dq.prototype.l=function(a){return this.Bb(a,Mg().Lm)};Dq.prototype.o=h("\x3cfunction1\x3e");Dq.prototype.lf=function(a){return tf(new uf,this,a)};var Yh=new s({bE:0},!1,"scala.runtime.Nothing$",{bE:1,dc:1,c:1,e:1});function Fq(){this.Xn=null}Fq.prototype=new oo;function Gq(){}Gq.prototype=Fq.prototype;Fq.prototype.yk=function(a){this.Xn=a;return this};function yf(a){return"string"===typeof a} +var ma=new s({Os:0},!1,"java.lang.String",{Os:1,c:1,e:1,yn:1,Zc:1},void 0,yf);function Xl(){An.call(this)}Xl.prototype=new wo;Xl.prototype.w=function(a){Xl.prototype.h.call(this,ka(a));return this};Xl.prototype.a=new s({aw:0},!1,"java.lang.AssertionError",{aw:1,iw:1,dc:1,c:1,e:1});function Hq(){}Hq.prototype=new oo;Hq.prototype.a=new s({ow:0},!1,"java.lang.JSConsoleBasedPrintStream$DummyOutputStream",{ow:1,vq:1,c:1,Kj:1,Jl:1});function ji(){An.call(this)}ji.prototype=new yo;function Iq(){} +Iq.prototype=ji.prototype;ji.prototype.b=function(){ji.prototype.Ee.call(this,null,null);return this};ji.prototype.h=function(a){ji.prototype.Ee.call(this,a,null);return this};ji.prototype.a=new s({ad:0},!1,"java.lang.RuntimeException",{ad:1,$c:1,dc:1,c:1,e:1});function Ao(){this.Ob=null}Ao.prototype=new t;l=Ao.prototype;l.b=function(){Ao.prototype.h.call(this,"");return this};function Jq(a,b){a.Ob=""+a.Ob+(null===b?"null":b);return a}l.Dp=function(a,b){return this.Ob.substring(a,b)};l.o=c("Ob"); +function Kq(a){var b=new Ao;Ao.prototype.h.call(b,ka(a));return b}l.Vj=function(a){return Lq(this,a)};function Lq(a,b){return null===b?Jq(a,null):Jq(a,ka(b))}l.Oa=function(){Ao.prototype.h.call(this,"");return this};function Mq(a,b,d,e){return null===b?Mq(a,"null",d,e):Jq(a,ka(Ea(b,d,e)))}l.q=function(){return this.Ob.length|0};function Nq(a,b){return Jq(a,m.String.fromCharCode(b))}l.h=function(a){this.Ob=a;return this};l.Uj=function(a){return Nq(this,a)}; +function Oq(a){for(var b=a.Ob,d="",e=0;e<(b.length|0);){var f=65535&(b.charCodeAt(e)|0);if(55296===(64512&f)&&(1+e|0)<(b.length|0)){var g=65535&(b.charCodeAt(1+e|0)|0);56320===(64512&g)?(d=""+m.String.fromCharCode(f)+m.String.fromCharCode(g)+d,e=2+e|0):(d=""+m.String.fromCharCode(f)+d,e=1+e|0)}else d=""+m.String.fromCharCode(f)+d,e=1+e|0}a.Ob=d;return a}l.a=new s({uw:0},!1,"java.lang.StringBuilder",{uw:1,c:1,yn:1,Zv:1,e:1}); +function Pq(){this.Pu=this.Qu=this.Ou=this.Nu=this.Mu=this.Lu=this.Ku=this.Ju=this.Iu=null}Pq.prototype=new xg;Pq.prototype.b=function(){Qq=this;this.Iu=p(v(Pa),[0]);this.Ju=p(v(Sa),[0]);this.Ku=p(v(Qa),[0]);this.Lu=p(v(Ya),[0]);this.Mu=p(v(Xa),[0]);this.Nu=p(v(Ua),[0]);this.Ou=p(v(Va),[0]);this.Qu=p(v(Ta),[0]);this.Pu=p(v(u),[0]);return this};function qc(a,b,d){a=d.xc(b.q());d=d=0;for(b=b.X();b.Ca();){var e=b.wa();Si(U(),a,d,e);d=1+d|0}return a} +function zl(a,b,d,e,f,g){a=la(b);var k;if(k=!!a.Ed.isArrayClass)k=la(e),k.Ed.isPrimitive||a.Ed.isPrimitive?a=k===a||(k===q(Ta)?a===q(Sa):k===q(Ua)?a===q(Sa)||a===q(Ta):k===q(Xa)?a===q(Sa)||a===q(Ta)||a===q(Ua):k===q(Ya)&&(a===q(Sa)||a===q(Ta)||a===q(Ua)||a===q(Xa))):(a=a.Ed.getFakeInstance(),a=!!k.Ed.isInstance(a)),k=a;if(k)Fa(b,d,e,f,g);else for(a=d,d=d+g|0;a=a.th.d.length);var e=a.th,f=sc(tc(),q(oq));rc();f=f.xc(1+e.d.length|0);zl(rc(),e,0,f,0,e.d.length);Si(U(),f,e.d.length,null);a.th=f;continue b}else throw d;}break a}return b.E} +l.lc=function(a){return Vj(this,a)};l.Kb=function(a){return Oi(this,a)};function or(){this.ob=this.Cc=null}or.prototype=new t;function pr(a,b){a.Cc=b;a.ob=b;return a}l=or.prototype;l.tb=function(a){this.ob.tb(a);return this};l.pa=c("ob");l.hd=function(a,b){Ul(this,a,b)};l.Da=function(a){this.ob.tb(a);return this};l.Ta=ba();l.Ka=function(a){return lk(this,a)};l.a=new s({jD:0},!1,"scala.collection.mutable.GrowingBuilder",{jD:1,c:1,Vb:1,Ub:1,Tb:1});function qr(){this.Qd=null}qr.prototype=new t; +function rr(){}l=rr.prototype=qr.prototype;l.b=function(){this.Qd=(new zp).b();return this};l.tb=function(a){return sr(this,a)};function sr(a,b){var d=a.Qd;J();var e=(new C).A([b]),f=J().N;gr(d,Kj(e,f));return a}l.hd=function(a,b){Ul(this,a,b)};l.Da=function(a){return sr(this,a)};l.Ta=ba();l.Ka=function(a){gr(this.Qd,a);return this};function Xj(){this.ob=this.Cc=null}Xj.prototype=new t;function qk(a,b){a.ob=a.ob.Yd(b);return a}l=Xj.prototype;l.tb=function(a){return qk(this,a)};l.pa=c("ob"); +l.hd=function(a,b){Ul(this,a,b)};function Wj(a,b){a.Cc=b;a.ob=b;return a}l.Da=function(a){return qk(this,a)};l.Ta=ba();l.Ka=function(a){return lk(this,a)};l.a=new s({rD:0},!1,"scala.collection.mutable.MapBuilder",{rD:1,c:1,Vb:1,Ub:1,Tb:1});function tr(){this.ob=this.Cc=null}tr.prototype=new t;l=tr.prototype;l.tb=function(a){return ur(this,a)};l.pa=c("ob");l.hd=function(a,b){Ul(this,a,b)};function ur(a,b){a.ob=a.ob.ze(b);return a}function vr(a,b){a.Cc=b;a.ob=b;return a} +l.Da=function(a){return ur(this,a)};l.Ta=ba();l.Ka=function(a){return lk(this,a)};l.a=new s({sD:0},!1,"scala.collection.mutable.SetBuilder",{sD:1,c:1,Vb:1,Ub:1,Tb:1});function wr(){this.ob=this.ix=this.we=null;this.ve=this.af=0}wr.prototype=new t;l=wr.prototype;l.zk=function(a){this.ix=this.we=a;this.ve=this.af=0;return this};l.tb=function(a){return xr(this,a)}; +function xr(a,b){var d=1+a.ve|0;if(a.afd&&Mq(e,a,d,f);d=1+f|0;if(d>=b)throw(new ms).gi(a,f);var g=65535&(a.charCodeAt(d)|0);switch(g){case 98:f=8;break;case 116:f=9;break;case 110:f=10;break;case 102:f=12;break;case 114:f=13;break;case 34:f=34;break;case 39:f=39;break;case 92:f=92;break;default:if(48<=g&&55>=g){g=65535&(a.charCodeAt(d)|0);f= +-48+g|0;d=1+d|0;if(d=(65535&(a.charCodeAt(d)|0))){var k=d,f=-48+(w(8,f)+(65535&(a.charCodeAt(k)|0))|0)|0,d=1+d|0;d=g&&48<=(65535&(a.charCodeAt(d)|0))&&55>=(65535&(a.charCodeAt(d)|0))&&(g=d,f=-48+(w(8,f)+(65535&(a.charCodeAt(g)|0))|0)|0,d=1+d|0)}d=-1+d|0;f&=65535}else throw(new ms).gi(a,f);}d=1+d|0;Nq(e,f);f=d;Ba();g=a;k=Sj(92);g=g.indexOf(k,d)|0;d=f;f=g}else{d=a.Zh.d.length){var d=32+a.Rh|0,e=a.Rh^d;if(1024>e)1===a.Hb()&&(a.va(p(v(u),[32])),a.P().d[0]=a.nb(),a.Md(1+a.Hb()|0)),a.Ga(p(v(u),[32])),a.P().d[31&d>>5]=a.nb();else if(32768>e)2===a.Hb()&&(a.Fa(p(v(u),[32])),a.aa().d[0]=a.P(),a.Md(1+a.Hb()|0)),a.Ga(p(v(u),[32])),a.va(p(v(u),[32])),a.P().d[31&d>>5]=a.nb(),a.aa().d[31&d>>10]=a.P();else if(1048576>e)3===a.Hb()&&(a.eb(p(v(u),[32])),a.Aa().d[0]=a.aa(),a.Md(1+a.Hb()|0)),a.Ga(p(v(u),[32])),a.va(p(v(u),[32])),a.Fa(p(v(u),[32])), +a.P().d[31&d>>5]=a.nb(),a.aa().d[31&d>>10]=a.P(),a.Aa().d[31&d>>15]=a.aa();else if(33554432>e)4===a.Hb()&&(a.vc(p(v(u),[32])),a.Ra().d[0]=a.Aa(),a.Md(1+a.Hb()|0)),a.Ga(p(v(u),[32])),a.va(p(v(u),[32])),a.Fa(p(v(u),[32])),a.eb(p(v(u),[32])),a.P().d[31&d>>5]=a.nb(),a.aa().d[31&d>>10]=a.P(),a.Aa().d[31&d>>15]=a.aa(),a.Ra().d[31&d>>20]=a.Aa();else if(1073741824>e)5===a.Hb()&&(a.Df(p(v(u),[32])),a.Ic().d[0]=a.Ra(),a.Md(1+a.Hb()|0)),a.Ga(p(v(u),[32])),a.va(p(v(u),[32])),a.Fa(p(v(u),[32])),a.eb(p(v(u),[32])), +a.vc(p(v(u),[32])),a.P().d[31&d>>5]=a.nb(),a.aa().d[31&d>>10]=a.P(),a.Aa().d[31&d>>15]=a.aa(),a.Ra().d[31&d>>20]=a.Aa(),a.Ic().d[31&d>>25]=a.Ra();else throw(new Cb).b();a.Rh=d;a.Hg=0}a.Zh.d[a.Hg]=b;a.Hg=1+a.Hg|0;return a}l.pa=function(){var a;a=this.Rh+this.Hg|0;if(0===a)a=uc().Fh;else{var b=(new Vs).k(0,a,0);pl(b,this,this.Yh);1d)this.Ga(this.P().d[31&b>>5]);else if(32768>d)this.va(this.aa().d[31&b>>10]),this.Ga(this.P().d[0]);else if(1048576>d)this.Fa(this.Aa().d[31&b>>15]),this.va(this.aa().d[0]),this.Ga(this.P().d[0]);else if(33554432>d)this.eb(this.Ra().d[31&b>>20]),this.Fa(this.Aa().d[0]),this.va(this.aa().d[0]),this.Ga(this.P().d[0]); +else if(1073741824>d)this.vc(this.Ic().d[31&b>>25]),this.eb(this.Ra().d[0]),this.Fa(this.Aa().d[0]),this.va(this.aa().d[0]),this.Ga(this.P().d[0]);else throw(new Cb).b();this.Af=b;b=this.lk-this.Af|0;this.mk=32>b?b:32;this.Yf=0}else this.Oe=!1;return a};l.Aa=c("Em");l.Hb=c("gk");l.Df=da("Im");l.nb=c("hk");l.Ra=c("Gm");l.Fa=da("Cm");l.va=da("Am");l.Ca=c("Oe");l.vc=da("Gm");l.P=c("Am");l.Ic=c("Im");l.Md=da("gk");l.aa=c("Cm");l.Ga=da("hk");l.eb=da("Em"); +l.a=new s({RC:0},!1,"scala.collection.immutable.VectorIterator",{RC:1,Hd:1,c:1,ed:1,H:1,G:1,Qo:1});function Yt(){}Yt.prototype=new t;function Zt(){}Zt.prototype=Yt.prototype;Yt.prototype.hd=function(a,b){Ul(this,a,b)};function $t(){lt.call(this);this.Av=this.Ex=null}$t.prototype=new mt;$t.prototype.Ea=function(a,b,d){lt.prototype.Ea.call(this,a,b,d);a=(new z).b();this.Ex=A(new B,this,"none",a);a=(new z).b();this.Av=A(new B,this,"hidden",a);return this}; +$t.prototype.a=new s({Vq:0},!1,"scalatags.generic.StyleMisc$BorderStyle",{Vq:1,Rl:1,cc:1,c:1,xa:1,n:1,g:1,e:1});function au(){Hr.call(this);this.Ld=this.ja=null}au.prototype=new Ir;au.prototype.al=da("Ld");au.prototype.xb=function(a){if(null===a)throw G(H(),null);this.ja=a;Hr.prototype.ia.call(this,"marginRight","margin-right");vb(this);return this};au.prototype.a=new s({ar:0},!1,"scalatags.generic.Styles$$anon$1",{ar:1,qg:1,c:1,xa:1,n:1,g:1,e:1,Ql:1}); +function bu(){Hr.call(this);this.Ld=this.ja=null}bu.prototype=new Ir;bu.prototype.al=da("Ld");bu.prototype.xb=function(a){if(null===a)throw G(H(),null);this.ja=a;Hr.prototype.ia.call(this,"marginTop","margin-top");vb(this);return this};bu.prototype.a=new s({br:0},!1,"scalatags.generic.Styles$$anon$2",{br:1,qg:1,c:1,xa:1,n:1,g:1,e:1,Ql:1});function cu(){Hr.call(this);this.Ld=this.ja=null}cu.prototype=new Ir;cu.prototype.al=da("Ld"); +cu.prototype.xb=function(a){if(null===a)throw G(H(),null);this.ja=a;Hr.prototype.ia.call(this,"marginLeft","margin-left");vb(this);return this};cu.prototype.a=new s({cr:0},!1,"scalatags.generic.Styles$$anon$3",{cr:1,qg:1,c:1,xa:1,n:1,g:1,e:1,Ql:1});function du(){E.call(this);this.Ek=this.dk=this.lj=this.Ik=this.zg=this.nl=this.ja=null}du.prototype=new Jr;l=du.prototype;l.Co=da("nl");l.zo=da("Ek");l.xo=da("dk");l.Ao=da("Ik");l.Bo=da("lj");l.yo=da("zg"); +l.xb=function(a){if(null===a)throw G(H(),null);this.ja=a;E.prototype.ia.call(this,"textAlignLast","text-align-last");xb(this);return this};l.a=new s({dr:0},!1,"scalatags.generic.Styles$$anon$4",{dr:1,cc:1,c:1,xa:1,n:1,g:1,e:1,fr:1});function eu(){E.call(this);this.Ek=this.dk=this.lj=this.Ik=this.zg=this.nl=this.ja=null}eu.prototype=new Jr;l=eu.prototype;l.Co=da("nl");l.zo=da("Ek");l.xo=da("dk");l.Ao=da("Ik");l.Bo=da("lj");l.yo=da("zg"); +l.xb=function(a){if(null===a)throw G(H(),null);this.ja=a;E.prototype.ia.call(this,"textAlign","text-align");xb(this);return this};l.a=new s({er:0},!1,"scalatags.generic.Styles$$anon$5",{er:1,cc:1,c:1,xa:1,n:1,g:1,e:1,fr:1});function fu(){gt.call(this);this.Zs=this.DE=this.qt=this.Dx=this.hF=this.Jx=this.ax=this.qv=this.nv=this.tz=this.wz=this.px=this.$E=this.pv=this.DD=this.ot=null}fu.prototype=new ht; +fu.prototype.xb=function(a){gt.prototype.Ea.call(this,a,"color","color");a=(new z).b();this.ot=A(new B,this,"black",a);a=(new z).b();this.DD=A(new B,this,"silver",a);a=(new z).b();this.pv=A(new B,this,"gray",a);a=(new z).b();this.$E=A(new B,this,"white",a);a=(new z).b();this.px=A(new B,this,"maroon",a);a=(new z).b();this.wz=A(new B,this,"red",a);a=(new z).b();this.tz=A(new B,this,"purple",a);a=(new z).b();this.nv=A(new B,this,"fuschia",a);a=(new z).b();this.qv=A(new B,this,"green",a);a=(new z).b(); +this.ax=A(new B,this,"lime",a);a=(new z).b();this.Jx=A(new B,this,"olive",a);a=(new z).b();this.hF=A(new B,this,"yellow",a);a=(new z).b();this.Dx=A(new B,this,"navy",a);a=(new z).b();this.qt=A(new B,this,"blue",a);a=(new z).b();this.DE=A(new B,this,"teal",a);a=(new z).b();this.Zs=A(new B,this,"aqua",a);return this};fu.prototype.a=new s({gr:0},!1,"scalatags.generic.Styles$color$",{gr:1,$F:1,cc:1,c:1,xa:1,n:1,g:1,e:1});function gu(){nt.call(this)}gu.prototype=new ot; +gu.prototype.xb=function(a){nt.prototype.Ea.call(this,a,"overflow","overflow");return this};gu.prototype.a=new s({lr:0},!1,"scalatags.generic.Styles$overflow$",{lr:1,Sl:1,cc:1,c:1,xa:1,n:1,g:1,e:1});function hu(){at.call(this);this.rn=null;this.tk=!1;this.Th=null}hu.prototype=new bt;function cg(a){var b=new hu;b.rn=a;at.prototype.yk.call(b,(new Hq).b());b.tk=!0;b.Th="";return b} +function ct(a,b){for(var d=b;""!==d;){var e=d.indexOf("\n")|0;if(0>e)a.Th=""+a.Th+d,a.tk=!1,d="";else{var f=""+a.Th+d.substring(0,e);m.console&&(a.rn&&m.console.error?m.console.error(f):m.console.log(f));a.Th="";a.tk=!0;d=d.substring(1+e|0)}}}hu.prototype.Ii=ba();hu.prototype.a=new s({nw:0},!1,"java.lang.JSConsoleBasedPrintStream",{nw:1,GF:1,FF:1,vq:1,c:1,Kj:1,Jl:1,Zv:1});function iu(){An.call(this);this.rm=0;this.pk=null}iu.prototype=new Jt; +iu.prototype.di=function(){return"Conversion \x3d "+(new Re).nc(this.rm)+", Flags \x3d "+this.pk};iu.prototype.nc=function(a){this.rm=a;It.prototype.b.call(this);this.pk=null;return this};function kq(){var a=new iu;iu.prototype.nc.call(a,115);a.pk="#";return a}iu.prototype.a=new s({zw:0},!1,"java.util.FormatFlagsConversionMismatchException",{zw:1,Fn:1,hh:1,ad:1,$c:1,dc:1,c:1,e:1});function Do(){An.call(this);this.qk=null}Do.prototype=new Jt; +Do.prototype.b=function(){It.prototype.b.call(this);this.qk=null;return this};Do.prototype.di=function(){return"Flags \x3d '"+this.qk+"'"};Do.prototype.h=function(a){Do.prototype.b.call(this);if(null===a)throw(new va).b();this.qk=a;return this};Do.prototype.a=new s({Ew:0},!1,"java.util.IllegalFormatFlagsException",{Ew:1,Fn:1,hh:1,ad:1,$c:1,dc:1,c:1,e:1});function jq(){An.call(this);this.Tk=null}jq.prototype=new Jt;jq.prototype.b=function(){It.prototype.b.call(this);this.Tk=null;return this}; +jq.prototype.di=function(){return"Format specifier '"+this.Tk+"'"};jq.prototype.h=function(a){jq.prototype.b.call(this);if(null===a)throw(new va).b();this.Tk=a;return this};jq.prototype.a=new s({Fw:0},!1,"java.util.MissingFormatArgumentException",{Fw:1,Fn:1,hh:1,ad:1,$c:1,dc:1,c:1,e:1});function Dp(){}Dp.prototype=new Nt;Dp.prototype.K=h(!1);Dp.prototype.o=h("Duration.Undefined");Dp.prototype.a=new s({bA:0},!1,"scala.concurrent.duration.Duration$$anon$1",{bA:1,oo:1,Uk:1,c:1,g:1,e:1,lh:1,Zc:1}); +function Ep(){}Ep.prototype=new Nt;Ep.prototype.o=h("Duration.Inf");Ep.prototype.a=new s({cA:0},!1,"scala.concurrent.duration.Duration$$anon$2",{cA:1,oo:1,Uk:1,c:1,g:1,e:1,lh:1,Zc:1});function Fp(){}Fp.prototype=new Nt;Fp.prototype.o=h("Duration.MinusInf");Fp.prototype.a=new s({dA:0},!1,"scala.concurrent.duration.Duration$$anon$3",{dA:1,oo:1,Uk:1,c:1,g:1,e:1,lh:1,Zc:1});function Wp(){this.nj=null}Wp.prototype=new t;l=Wp.prototype; +l.xc=function(a){var b=this.sd();b===q(Sa)?a=p(v(Sa),[a]):b===q(Ta)?a=p(v(Ta),[a]):b===q(Qa)?a=p(v(Qa),[a]):b===q(Ua)?a=p(v(Ua),[a]):b===q(Va)?a=p(v(Va),[a]):b===q(Xa)?a=p(v(Xa),[a]):b===q(Ya)?a=p(v(Ya),[a]):b===q(Pa)?a=p(v(Pa),[a]):b===q(Na)?a=p(v(ua),[a]):(hg||(hg=(new gg).b()),a=this.sd().Ed.newArrayOfThisClass([a]));return a};l.K=function(a){var b;a&&a.a&&a.a.t.cd?(b=this.sd(),a=a.sd(),b=b===a):b=!1;return b};l.o=function(){return Lh(this,this.nj)};l.sd=c("nj");l.M=function(){return ui(U(),this.nj)}; +l.a=new s({xA:0},!1,"scala.reflect.ClassTag$$anon$1",{xA:1,c:1,cd:1,Gd:1,vd:1,g:1,e:1,n:1});function ju(){this.N=null}ju.prototype=new Qt;ju.prototype.na=function(){ku||(ku=(new lu).b());return(new zp).b()};ju.prototype.a=new s({mB:0},!1,"scala.collection.Seq$",{mB:1,Le:1,Ke:1,xd:1,yc:1,c:1,yd:1,zc:1});var mu=void 0;function bc(){mu||(mu=(new ju).b());return mu}function nu(){this.N=null}nu.prototype=new Qt;function ou(){}ou.prototype=nu.prototype;function pu(){this.ru=null}pu.prototype=new eq; +pu.prototype.b=function(){qu=this;this.ru=co(new bo,nc(function(){return aa()}(this)));return this};function ru(a,b,d,e,f,g,k){var n=31&(b>>>g|0),r=31&(e>>>g|0);if(n!==r)return a=1<=this.sc(a,b)};l.a=new s({qA:0},!1,"scala.math.Ordering$Int$",{qA:1,c:1,rA:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1});var Sv=void 0; +function zd(){Sv||(Sv=(new Rv).b());return Sv}function Tv(){}Tv.prototype=new t;l=Tv.prototype;l.b=function(){Uv=this;return this};l.Dg=function(a,b){return 0<=this.sc(a,b)};l.sc=function(a,b){return a===b?0:a=this.sc(a,b)};l.a=new s({sA:0},!1,"scala.math.Ordering$String$",{sA:1,c:1,oI:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1});var Uv=void 0;function Id(){Uv||(Uv=(new Tv).b());return Uv}function Vv(){this.Kp=null;this.fn=0}Vv.prototype=new t;function Wv(){}Wv.prototype=Vv.prototype; +Vv.prototype.K=function(a){return this===a};Vv.prototype.o=c("Kp");Vv.prototype.h=function(a){this.Kp=a;this.fn=Ga(this);return this};Vv.prototype.M=c("fn");function Xv(){this.TE=this.ko=this.rz=null}Xv.prototype=new t;function Yv(){}Yv.prototype=Xv.prototype;Xv.prototype.sd=c("ko");Xv.prototype.Nv=function(a,b,d){this.rz=a;this.ko=b;this.TE=d;return this};function Zv(){this.zb=this.N=null}Zv.prototype=new ou;Zv.prototype.b=function(){nu.prototype.b.call(this);$v=this;this.zb=(new aq).b();return this}; +Zv.prototype.na=function(){In();uc();return(new Jn).b()};Zv.prototype.a=new s({dB:0},!1,"scala.collection.IndexedSeq$",{dB:1,Fo:1,Le:1,Ke:1,xd:1,yc:1,c:1,yd:1,zc:1});var $v=void 0;function vc(){$v||($v=(new Zv).b());return $v}function X(){this.fh=this.zg=0;this.W=null}X.prototype=new Zq;X.prototype.wa=function(){this.fh>=this.zg&&$g().Cc.wa();var a=this.W.ma(this.fh);this.fh=1+this.fh|0;return a};function W(a,b,d){a.zg=d;if(null===b)throw G(H(),null);a.W=b;a.fh=0;return a} +X.prototype.Ca=function(){return this.fh>>g|0),n=31&(e>>>g|0);if(k!==n)return a=1<=this.sc(a,b)}; +l.a=new s({jA:0},!1,"scala.math.Numeric$ByteIsIntegral$",{jA:1,c:1,dI:1,qo:1,oj:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1,kI:1});var Xe=void 0;function df(){}df.prototype=new t;l=df.prototype;l.b=function(){cf=this;return this};l.zi=function(a){return a|0};l.Dg=function(a,b){return 0<=this.sc(a,b)};l.sc=function(a,b){return(a|0)<(b|0)?-1:(a|0)===(b|0)?0:1};l.Ig=function(a,b){return 0>=this.sc(a,b)};l.a=new s({mA:0},!1,"scala.math.Numeric$IntIsIntegral$",{mA:1,c:1,iI:1,qo:1,oj:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1,rA:1}); +var cf=void 0;function bf(){}bf.prototype=new t;l=bf.prototype;l.b=function(){af=this;return this};l.zi=function(a){return a|0};l.Dg=function(a,b){return 0<=this.sc(a,b)};l.sc=function(a,b){return(a|0)-(b|0)|0};l.Ig=function(a,b){return 0>=this.sc(a,b)};l.a=new s({nA:0},!1,"scala.math.Numeric$ShortIsIntegral$",{nA:1,c:1,jI:1,qo:1,oj:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1,nI:1});var af=void 0;function Cw(){}Cw.prototype=new t;function Dw(){}l=Dw.prototype=Cw.prototype; +l.Fb=function(){var a=J().N;return Kj(this,a)};l.fc=function(a){return this.Ec("",a,"")};l.Ec=function(a,b,d){return L(this,a,b,d)};l.Kd=function(a){return(new On).od(this,a)};l.ef=function(){return Zi(this)};l.le=function(a,b){return bk(this,a,b)};l.Rc=function(){uc();var a=vc().zb;return Kj(this,a)};l.U=function(){return ek(this)};l.ec=function(){return this.fc("")};l.sf=function(a,b){return Qj(this,a,b)};l.s=function(){return bj(this)};l.rc=function(a,b,d,e){return Cj(this,a,b,d,e)}; +l.Dc=function(a){return ck(this,a)};l.Pb=function(){return this};l.Ac=function(a,b){return this.le(a,b)};l.Yc=h(!0);l.lc=function(a){return Vj(this,a)};l.oe=function(a,b){return Nj(this,a,b)};l.Kb=function(a){return Oi(this,a)};l.na=function(){return this.Ab().na()};l.Wb=function(){return Rj(this)};function mf(){}mf.prototype=new t;l=mf.prototype;l.b=function(){lf=this;return this};l.zi=function(a){return+a};l.Dg=function(a,b){return+a>=+b};l.sc=function(a,b){var d=+a,e=+b;return Jf(hf(),d,e)}; +l.Ig=function(a,b){return+a<=+b};l.a=new s({kA:0},!1,"scala.math.Numeric$DoubleIsFractional$",{kA:1,c:1,fI:1,eI:1,oj:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1,fA:1,lI:1});var lf=void 0;function kf(){}kf.prototype=new t;l=kf.prototype;l.b=function(){jf=this;return this};l.zi=function(a){return qa(a)};l.Dg=function(a,b){var d=qa(a),e=qa(b);return d>=e};l.sc=function(a,b){var d=qa(a),e=qa(b);return Jf(hf(),d,e)};l.Ig=function(a,b){var d=qa(a),e=qa(b);return d<=e}; +l.a=new s({lA:0},!1,"scala.math.Numeric$FloatIsFractional$",{lA:1,c:1,hI:1,gI:1,oj:1,mh:1,ih:1,nh:1,kh:1,g:1,e:1,fA:1,mI:1});var jf=void 0;function Ij(a){return!!(a&&a.a&&a.a.t.rb)}function Ew(){}Ew.prototype=new Dw;function Fw(){}l=Fw.prototype=Ew.prototype;l.u=function(){return this.X().wa()};l.Qb=function(a){return Vi(this,a)};l.Ab=function(){return Zg()};l.ci=function(a){var b=this.X();return oj(b,a)};l.R=function(a){var b=this.X();nj(b,a)};l.Yg=function(a){return ej(this,a)}; +l.Zb=function(a){var b=this.na();Pj(b,this,-(0>a?0:a)|0);for(var d=0,e=this.X();da)a=1;else{for(var b=0,d=this.X();d.Ca();){if(b===a){a=d.Ca()?1:0;break a}d.wa();b=1+b|0}a=b-a|0}return a};l.m=function(){return 0===this.pb(0)};l.K=function(a){return Nr(a)?this.Qb(a):!1};l.Dd=function(a,b){return Jj(this,a,b)};l.o=function(){return Lj(this)};l.pc=function(){return Gj(this)};l.lf=function(a){return tf(new uf,this,a)};l.U=function(){return this.q()};l.Fc=function(a,b){return Fj(this,a,b)};l.bc=function(){return this};l.Bb=function(a,b){return Ng(this,a,b)}; +l.M=function(){return Nn(wi(),this.Me())};l.kc=aa();function Mw(){}Mw.prototype=new Fw;function Nw(){}l=Nw.prototype=Mw.prototype;l.Ba=function(){return this.dg()};l.l=function(a){return yj(this,a)};l.Ja=function(){return this};l.m=function(){return 0===this.U()};l.K=function(a){return Bi(this,a)};l.o=function(){return Lj(this)};l.Ff=function(){return Yj()};l.lf=function(a){return tf(new uf,this,a)};l.dg=function(){return this};l.Gb=function(a){return Ab(this.Xc(a))}; +l.rc=function(a,b,d,e){return zj(this,a,b,d,e)};l.Va=function(a){return this.Gb(a)};l.M=function(){var a=wi();return ti(a,this.dg(),a.Jk)};l.Bb=function(a,b){return Ng(this,a,b)};l.na=function(){return Wj(new Xj,this.Ff())};l.Wb=h("Map");function Ow(){}Ow.prototype=new Fw;function Pw(){}l=Pw.prototype=Ow.prototype;l.m=function(){return 0===this.U()};l.K=function(a){return Ei(this,a)};l.o=function(){return Lj(this)};l.ol=function(a){return this.ci(a)};l.M=function(){var a=wi();return ti(a,this,a.ml)}; +l.na=function(){return vr(new tr,this.xg())};l.Wb=h("Set");function Bf(){this.W=this.Si=null}Bf.prototype=new Nw;function Qw(){}l=Qw.prototype=Bf.prototype;l.Fj=function(a){var b=Wj(new Xj,Yj());lk(b,this);qk(b,(new V).ha(a.Ua,a.$a));return b.ob};l.R=function(a){(new On).od(this.W,M(function(){return function(a){return null!==a}}(this))).R(M(function(a,d){return function(e){if(null!==e)return d.l((new V).ha(e.Ua,a.Si.l(e.$a)));throw(new K).w(e);}}(this,a)))}; +l.Ak=function(a,b){this.Si=b;if(null===a)throw G(H(),null);this.W=a;return this};l.U=function(){return this.W.U()};l.X=function(){var a=this.W.X(),a=(new ss).Zi(a,M(function(){return function(a){return null!==a}}(this)));return(new Aj).Zi(a,M(function(a){return function(d){if(null!==d)return(new V).ha(d.Ua,a.Si.l(d.$a));throw(new K).w(d);}}(this)))};l.Xc=function(a){a=this.W.Xc(a);var b=this.Si;return a.m()?sg():(new tg).w(b.l(a.Wc()))};l.Gb=function(a){return this.W.Gb(a)};l.Yd=function(a){return this.Fj(a)}; +l.a=new s({Xk:0},!1,"scala.collection.MapLike$MappedValues",{Xk:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,ro:1});function Rw(){}Rw.prototype=new Nw;function Sw(){}l=Sw.prototype=Rw.prototype;l.b=function(){return this};l.Ba=function(){return this};l.Ja=function(){return this};l.Ab=function(){return qs()};l.Ff=function(){return this.kk()};l.kk=function(){return Yj()};l.dg=function(){return this};l.lc=function(){return this}; +l.cj=function(a){return Tw(this,a)};function Uw(){}Uw.prototype=new Pw;function Vw(){}l=Vw.prototype=Uw.prototype;l.Ba=function(){return this};l.b=function(){return this};l.u=function(){throw(new uj).h("Set has no elements");};l.l=function(a){return this.Gb(a)};l.m=h(!0);l.Ja=function(){return this};l.Zk=function(){throw(new uj).h("Empty ListSet has no outer pointer");};l.Ab=function(){lw||(lw=(new kw).b());return lw};l.zh=function(a){return fr(this,a)};l.U=h(0);l.X=function(){return(new Ds).gh(this)}; +l.xg=function(){return cr()};l.s=function(){return this.ql()};l.Gb=h(!1);l.ze=function(a){return this.zh(a)};l.ql=function(){throw(new uj).h("Next of an empty set");};l.Wb=h("ListSet");function Ww(){}Ww.prototype=new Pw;l=Ww.prototype;l.Ba=function(){return this};l.b=function(){Xw=this;return this};l.l=h(!1);l.Ja=function(){return this};l.Ab=function(){return ep()};l.R=ba();l.U=h(0);l.X=function(){return $g().Cc};l.xg=function(){return Vt()};l.ze=function(a){return(new Yw).w(a)}; +l.a=new s({rC:0},!1,"scala.collection.immutable.Set$EmptySet$",{rC:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});var Xw=void 0;function Vt(){Xw||(Xw=(new Ww).b());return Xw}function Yw(){this.wb=null}Yw.prototype=new Pw;l=Yw.prototype;l.Ba=function(){return this};l.l=function(a){return this.Gb(a)};l.Ja=function(){return this};l.Ab=function(){return ep()};l.ci=function(a){return!!a.l(this.wb)}; +l.R=function(a){a.l(this.wb)};l.U=h(1);l.w=function(a){this.wb=a;return this};l.X=function(){$g();var a=(new C).A([this.wb]);return W(new X,a,a.p.length|0)};l.xg=function(){return Vt()};l.lg=function(a){return this.Gb(a)?this:(new Zw).ha(this.wb,a)};l.Gb=function(a){return O(P(),a,this.wb)};l.ze=function(a){return this.lg(a)}; +l.a=new s({sC:0},!1,"scala.collection.immutable.Set$Set1",{sC:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});function Zw(){this.mc=this.wb=null}Zw.prototype=new Pw;l=Zw.prototype;l.Ba=function(){return this};l.l=function(a){return this.Gb(a)};l.Ja=function(){return this};l.ha=function(a,b){this.wb=a;this.mc=b;return this};l.Ab=function(){return ep()}; +l.ci=function(a){return!!a.l(this.wb)&&!!a.l(this.mc)};l.R=function(a){a.l(this.wb);a.l(this.mc)};l.U=h(2);l.X=function(){$g();var a=(new C).A([this.wb,this.mc]);return W(new X,a,a.p.length|0)};l.xg=function(){return Vt()};l.lg=function(a){if(this.Gb(a))a=this;else{var b=this.mc,d=new $w;d.wb=this.wb;d.mc=b;d.Od=a;a=d}return a};l.Gb=function(a){return O(P(),a,this.wb)||O(P(),a,this.mc)};l.ze=function(a){return this.lg(a)}; +l.a=new s({tC:0},!1,"scala.collection.immutable.Set$Set2",{tC:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});function $w(){this.Od=this.mc=this.wb=null}$w.prototype=new Pw;l=$w.prototype;l.Ba=function(){return this};l.l=function(a){return this.Gb(a)};l.Ja=function(){return this};l.Ab=function(){return ep()};l.ci=function(a){return!!a.l(this.wb)&&!!a.l(this.mc)&&!!a.l(this.Od)}; +l.R=function(a){a.l(this.wb);a.l(this.mc);a.l(this.Od)};l.U=h(3);l.X=function(){$g();var a=(new C).A([this.wb,this.mc,this.Od]);return W(new X,a,a.p.length|0)};l.xg=function(){return Vt()};l.lg=function(a){return this.Gb(a)?this:(new ax).gf(this.wb,this.mc,this.Od,a)};l.Gb=function(a){return O(P(),a,this.wb)||O(P(),a,this.mc)||O(P(),a,this.Od)};l.ze=function(a){return this.lg(a)}; +l.a=new s({uC:0},!1,"scala.collection.immutable.Set$Set3",{uC:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});function ax(){this.dh=this.Od=this.mc=this.wb=null}ax.prototype=new Pw;l=ax.prototype;l.Ba=function(){return this};l.l=function(a){return this.Gb(a)};l.Ja=function(){return this};l.Ab=function(){return ep()};l.ci=function(a){return!!a.l(this.wb)&&!!a.l(this.mc)&&!!a.l(this.Od)&&!!a.l(this.dh)}; +l.R=function(a){a.l(this.wb);a.l(this.mc);a.l(this.Od);a.l(this.dh)};l.U=h(4);l.X=function(){$g();var a=(new C).A([this.wb,this.mc,this.Od,this.dh]);return W(new X,a,a.p.length|0)};l.xg=function(){return Vt()};l.lg=function(a){if(this.Gb(a))return this;var b=(new bx).b(),d=this.mc;a=[this.Od,this.dh,a];var e=cx(cx(b,this.wb),d),b=0,d=a.length|0,f=e;for(;;){if(b===d)return f;e=1+b|0;f=f.ze(a[b]);b=e}};l.Gb=function(a){return O(P(),a,this.wb)||O(P(),a,this.mc)||O(P(),a,this.Od)||O(P(),a,this.dh)}; +l.gf=function(a,b,d,e){this.wb=a;this.mc=b;this.Od=d;this.dh=e;return this};l.ze=function(a){return this.lg(a)};l.a=new s({vC:0},!1,"scala.collection.immutable.Set$Set4",{vC:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});function bx(){}bx.prototype=new Pw;function dx(){}l=dx.prototype=bx.prototype;l.Ba=function(){return this};l.Bi=function(a,b){return ex(a,b)}; +l.Wh=function(a){return this.xk(ui(U(),a))};l.b=function(){return this};l.l=function(a){return this.Gb(a)};function cx(a,b){return a.Bi(b,a.Wh(b),0)}l.Ja=function(){return this};l.Ab=function(){return hw()};l.R=ba();l.ol=function(a){if(a&&a.a&&a.a.t.qh)return this.xi(a,0);var b=this.X();return oj(b,a)};l.U=h(0);l.X=function(){return $g().Cc};l.xg=function(){return fw()};l.xk=function(a){a=a+~(a<<9)|0;a^=a>>>14|0;a=a+(a<<4)|0;return a^(a>>>10|0)};l.Gb=function(a){return this.If(a,this.Wh(a),0)}; +l.ze=function(a){return cx(this,a)};l.If=h(!1);l.xi=h(!0);var cw=new s({qh:0},!1,"scala.collection.immutable.HashSet",{qh:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,Sa:1,g:1,e:1});bx.prototype.a=cw;function fx(){}fx.prototype=new Vw; +fx.prototype.a=new s({$B:0},!1,"scala.collection.immutable.ListSet$EmptyListSet$",{$B:1,XB:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});var gx=void 0;function cr(){gx||(gx=(new fx).b());return gx}function hx(){this.W=this.Jf=null}hx.prototype=new Vw;l=hx.prototype;l.u=c("Jf");l.m=h(!1);l.Zk=c("W");l.zh=function(a){return ix(this,a)?this:fr(this,a)}; +l.U=function(){var a;a:{a=this;var b=0;for(;;){if(a.m()){a=b;break a}a=a.Zk();b=1+b|0}a=void 0}return a};function fr(a,b){var d=new hx;d.Jf=b;if(null===a)throw G(H(),null);d.W=a;return d}l.Gb=function(a){return ix(this,a)};l.s=c("W");function ix(a,b){for(;;){if(a.m())return!1;if(O(P(),a.u(),b))return!0;a=a.Zk()}}l.ql=c("W");l.ze=function(a){return this.zh(a)}; +l.a=new s({bC:0},!1,"scala.collection.immutable.ListSet$Node",{bC:1,XB:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,g:1,e:1});function jx(){}jx.prototype=new Lw;function kx(){}kx.prototype=jx.prototype;jx.prototype.Ba=function(){return this.ti()};jx.prototype.ti=function(){return this};function lx(){}lx.prototype=new dx; +lx.prototype.a=new s({LB:0},!1,"scala.collection.immutable.HashSet$EmptyHashSet$",{LB:1,qh:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,Sa:1,g:1,e:1});var mx=void 0;function fw(){mx||(mx=(new lx).b());return mx}function ew(){this.Be=0;this.Jc=null;this.Ng=0}ew.prototype=new dx;l=ew.prototype; +l.Bi=function(a,b,d){var e=1<<(31&(b>>>d|0)),f=Nf(Ve(),this.Be&(-1+e|0));if(0!==(this.Be&e)){e=this.Jc.d[f];a=e.Bi(a,b,5+d|0);if(e===a)return this;b=p(v(cw),[this.Jc.d.length]);zl(rc(),this.Jc,0,b,0,this.Jc.d.length);b.d[f]=a;return dw(new ew,this.Be,b,this.Ng+(a.U()-e.U()|0)|0)}d=p(v(cw),[1+this.Jc.d.length|0]);zl(rc(),this.Jc,0,d,0,f);d.d[f]=ex(a,b);zl(rc(),this.Jc,f,d,1+f|0,this.Jc.d.length-f|0);return dw(new ew,this.Be|e,d,1+this.Ng|0)}; +l.R=function(a){for(var b=0;b>>d|0),f=1<=a?this:a>=this.U()?Ld(this.bd):(new Fx).$i(Fk(Zk(),this.ie,a),this.bd)};l.s=function(){return(new Fx).$i(Qk(Zk(),this.ie,Nk(Zk(),this.ie).ka,this.bd),this.bd)}; +l.Gb=function(a){Zk();return null!==Wk(this.ie,a,this.bd)};function Gx(a,b,d){return(new Fx).$i(Vk(Zk(),a.ie,b,d,a.bd),a.bd)}l.rc=function(a,b,d,e){return zj(this,a,b,d,e)};l.Dc=function(a){return ck(this,a)};l.Va=function(a){Zk();return null!==Wk(this.ie,a,this.bd)};l.Pb=function(){return this};l.Ac=function(a,b){return bk(this,a,b)};l.Bb=function(a,b){return Ng(this,a,b)};l.M=function(){var a=wi();return ti(a,this,a.Jk)};l.Yc=h(!0);l.lc=function(){return this}; +l.Gj=function(a){return Gx(this,a.Ua,a.$a)};l.Al=function(a){return Hx(this,a)};l.cj=function(a){return Ix(this,a)};l.Yd=function(a){return Gx(this,a.Ua,a.$a)};l.Kb=function(a){return Oi(this,a)};l.na=function(){Ms||(Ms=(new Ls).b());return ok(Ms,this.bd)};l.Wb=h("Map");l.a=new s({LC:0},!1,"scala.collection.immutable.TreeMap",{LC:1,c:1,wC:1,Id:1,Na:1,Qa:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,Pa:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,Jd:1,nB:1,oB:1,AB:1,g:1,e:1}); +function Cx(){}Cx.prototype=new Sw;function Jx(){}l=Jx.prototype=Cx.prototype;l.Ba=function(){return this};l.Wh=function(a){return this.xk(ui(U(),a))};l.b=function(){return this};l.Ja=function(){return this};l.Ai=function(a,b,d,e,f){return Kx(a,b,e,f)};l.eh=function(){return sg()};l.R=ba();function Dx(a,b){return a.Ai(b.Ua,a.Wh(b.Ua),0,b.$a,b,null)}l.Ff=function(){wu();return vu()};l.kk=function(){wu();return vu()};l.dg=function(){return this};l.U=h(0);l.X=function(){return $g().Cc}; +l.Xc=function(a){return this.eh(a,this.Wh(a),0)};l.xk=function(a){a=a+~(a<<9)|0;a^=a>>>14|0;a=a+(a<<4)|0;return a^(a>>>10|0)};l.Yd=function(a){return Dx(this,a)};var su=new s({ri:0},!1,"scala.collection.immutable.HashMap",{ri:1,se:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,Id:1,Na:1,Qa:1,Pa:1,Jd:1,g:1,e:1,Sa:1});Cx.prototype.a=su;function Lx(){this.Mc=null;this.Jb=0}Lx.prototype=new ox;l=Lx.prototype; +l.Bi=function(a,b,d){if(b===this.Jb&&O(P(),a,this.Mc))return this;if(b!==this.Jb)return bw(hw(),this.Jb,this,b,ex(a,b),d);var e=cr();d=new Mx;a=fr(e,this.Mc).zh(a);d.Jb=b;d.Vf=a;return d};function ex(a,b){var d=new Lx;d.Mc=a;d.Jb=b;return d}l.R=function(a){a.l(this.Mc)};l.X=function(){$g();var a=(new C).A([this.Mc]);return W(new X,a,a.p.length|0)};l.U=h(1);l.If=function(a,b){return b===this.Jb&&O(P(),a,this.Mc)};l.xi=function(a,b){return a.If(this.Mc,this.Jb,b)}; +l.a=new s({Ho:0},!1,"scala.collection.immutable.HashSet$HashSet1",{Ho:1,OB:1,qh:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,Sa:1,g:1,e:1});function Mx(){this.Jb=0;this.Vf=null}Mx.prototype=new ox;l=Mx.prototype;l.Bi=function(a,b,d){b===this.Jb?(d=new Mx,a=this.Vf.zh(a),d.Jb=b,d.Vf=a,b=d):b=bw(hw(),this.Jb,this,b,ex(a,b),d);return b};l.R=function(a){var b=(new Ds).gh(this.Vf);nj(b,a)};l.X=function(){return(new Ds).gh(this.Vf)}; +l.U=function(){return this.Vf.U()};l.If=function(a,b){return b===this.Jb&&this.Vf.Gb(a)};l.xi=function(a,b){for(var d=(new Ds).gh(this.Vf),e=!0;;)if(e&&!d.Qg.m())e=d.wa(),e=a.If(e,this.Jb,b);else break;return e};l.a=new s({MB:0},!1,"scala.collection.immutable.HashSet$HashSetCollision1",{MB:1,OB:1,qh:1,re:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,de:1,x:1,Sd:1,ce:1,fe:1,ee:1,ab:1,te:1,Na:1,Qa:1,Pa:1,Sa:1,g:1,e:1});function Nx(){}Nx.prototype=new Lw; +function Ox(){}l=Ox.prototype=Nx.prototype;l.Ba=function(){return this};l.b=function(){return this};l.ma=function(a){return rj(this,a)};l.pb=function(a){return pj(this,a)};l.l=function(a){return rj(this,a|0)};l.Qb=function(a){return vj(this,a)};l.Fb=function(){return this};l.Ja=function(){return this};l.Jm=function(a){return Px(this,a)};l.Ab=function(){return J()};l.R=function(a){for(var b=this;!b.m();)a.l(b.u()),b=b.s()};l.le=function(a,b){return qj(this,a,b)}; +l.pc=function(){for(var a=x(),b=this;!b.m();)var d=b.u(),a=Tb(new Ub,d,a),b=b.s();return a};l.Fc=function(a,b){return b&&b.a&&b.a.t.cl?Tb(new Ub,a,this):Fj(this,a,b)};l.X=function(){var a=new ts;a.jc=this;return a};function Px(a,b){for(var d=a,e=b;!d.m()&&0=a)a=x();else{for(var b=Tb(new Ub,this.u(),x()),d=b,e=this.s(),f=1;;){if(e.m()){a=this;break a}if(fa||a>=this.Fd)throw(new Rg).h(""+a);return this.ic+w(this.ac,a)|0}; +l.k=function(a,b,d){this.ic=a;this.Ag=b;this.ac=d;this.pd=a>b&&0d||a===b&&!this.Tf();if(0===d){var e;throw(new Cb).h("step cannot be 0.");}this.pd?e=0:(e=Vf(Zl(Xx(this),(new T).Oa(this.ac)),(new T).Oa(this.Tf()||!bn(Hp(Xx(this),(new T).Oa(this.ac)),Sf())?1:0)),e=lm(e,(new T).k(4194303,511,0))?-1:Yl(e));this.Fd=e;if(this.pd)b=a-d|0;else switch(d){case 1:b=this.Tf()?b:-1+b|0;break;case -1:b=this.Tf()?b:1+b|0;break;default:a=Yl(Hp(Xx(this),(new T).Oa(d))),b=0!==a?b-a|0:this.Tf()?b:b-d|0}this.Gk= +b;this.Fp=this.Gk+d|0;return this};l.ef=function(){if(this.pd){var a=x();Zi(a)}0<=this.Fd?a=Yx(this,this.Fd-1|0):(a=Vx(this)-w(this.ac,1)|0,0this.ac&&a>this.ic?(a=this.ic,a=(new Tx).k(a,a,this.ac)):a=(new $p).k(this.ic,a,this.ac));return a};l.Ab=function(){return In()};l.o=function(){var a=this.Fd>qh().Mj||!this.pd&&0>this.Fd?", ... )":")",b=Yx(this,qh().Mj);return L(b,"Range(",", ",a)}; +l.R=function(a){Wx(this);for(var b=-2147483648!==this.ic||-2147483648!==this.Ag,d=this.ic,e=0,f=this.Fp,g=this.ac;b?d!==f:ea.Fd&&lq(qh(),a.ic,a.Ag,a.ac,a.Tf())}l.q=function(){return 0>this.Fd?lq(qh(),this.ic,this.Ag,this.ac,this.Tf()):this.Fd}; +l.Me=function(){return this};function Zx(a,b){if(0>=b||a.pd)return a;if(b>=a.Fd&&0<=a.Fd){var d=a.Ag;return(new Tx).k(d,d,a.ac)}return a.vm(a.ic+w(a.ac,b)|0,a.Ag,a.ac)}l.Je=function(){return Vx(this)};l.Zb=function(a){return Zx(this,a)};l.s=function(){this.pd&&$x(x());return Zx(this,1)};l.bc=function(){return this};l.Dc=function(a){return a===zd()?0=b||a.pd){var d=a.ic;return(new Tx).k(d,d,a.ac)}return b>=a.Fd&&0<=a.Fd?a:(new $p).k(a.ic,a.ic+w(a.ac,-1+b|0)|0,a.ac)}function Vx(a){return a.pd?(a=x(),tj(a)|0):a.Gk}l.Va=function(a){return Di(this,a|0)};l.M=function(){return Nn(wi(),this)};l.kc=aa();function Xx(a){var b=(new T).Oa(a.Ag);a=(new T).Oa(a.ic);return Vf(b,Tf(a))} +l.a=new s({il:0},!1,"scala.collection.immutable.Range",{il:1,gc:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,Sb:1,la:1,x:1,Rb:1,Wa:1,Xa:1,gl:1,Mg:1,Na:1,Qa:1,Pa:1,Pc:1,rb:1,Sa:1,g:1,e:1});function ay(){}ay.prototype=new Lw;function by(){}l=by.prototype=ay.prototype;l.Ba=function(){return this}; +function cy(a){for(var b=lj(),b=(new Hj).w(b),d=a;!d.m();){lh();var e=fl(el(new dl,Nc(function(a,b){return function(){return b.v}}(a,b))),d.u());e.s();b.v=e;d=d.s()}return b.v}l.b=function(){return this};l.ma=function(a){return rj(this,a)};l.pb=function(a){return pj(this,a)};l.Qb=function(a){return vj(this,a)};l.l=function(a){return rj(this,a|0)};l.Ja=function(){return this}; +function Hs(a,b){var d=(lh(),(new rq).b());if(Is(d.Tc(a))){if(a.m())d=lj();else{for(var d=(new Hj).w(a),e=b.l(d.v.u()).db();!d.v.m()&&e.m();)d.v=d.v.s(),d.v.m()||(e=b.l(d.v.u()).db());d=d.v.m()?(lh(),lj()):dy(e,Nc(function(a,b,d){return function(){return Hs(d.v.s(),b)}}(a,b,d)))}return d}return Mj(a,b,d)}l.Jm=function(a){return ey(this,a)};l.fc=function(a){return this.Ec("",a,"")}; +l.Ec=function(a,b,d){var e=this,f=this;for(e.m()||(e=e.s());f!==e&&!e.m();){e=e.s();if(e.m())break;e=e.s();if(e===f)break;f=f.s()}return L(this,a,b,d)};l.Kd=function(a){var b=new sq;b.$n=a;On.prototype.od.call(b,this,a);return b};l.ef=function(){return fy(this)};l.Ab=function(){return lh()};l.o=function(){return L(this,"Stream(",", ",")")};l.R=function(a){var b=this;a:b:for(;;){if(!b.m()){a.l(b.u());b=b.s();continue b}break a}}; +l.le=function(a,b){var d=this;for(;;){if(d.m())return a;var e=d.s(),f=zg(b,a,d.u()),d=e;a=f}};l.pc=function(){return cy(this)};l.Fc=function(a,b){return Is(b.Tc(this))?jj(new kj,a,Nc(function(a){return function(){return a}}(this))):Fj(this,a,b)};l.X=function(){return Ks(this)};l.sf=function(a,b){if(Is(b.Tc(this))){if(this.m())var d=a.db();else d=this.u(),d=jj(new kj,d,Nc(function(a,b){return function(){return a.s().sf(b,(lh(),(new rq).b()))}}(this,a)));return d}return Qj(this,a,b)}; +l.q=function(){for(var a=0,b=this;!b.m();)a=1+a|0,b=b.s();return a};l.Yg=function(a){var b=lh();return gy(this,uw(b,0,1),a)};l.ec=function(){return this.Ec("","","")};l.Me=function(){return this};l.Ep=function(a){return hy(this,a)};l.db=function(){return this};l.Je=function(){return tj(this)};l.Zb=function(a){return ey(this,a)};function ey(a,b){var d=a;for(;;){if(0>=b||d.m())return d;var d=d.s(),e=-1+b|0;b=e}}l.bc=function(){return this}; +l.rc=function(a,b,d,e){Zj(a,b);if(!this.m()){ak(a,this.u());b=this;if(b.rf()){var f=this.s();if(f.m())return Zj(a,e),a;if(b!==f&&f.rf())for(b=f,f=f.s();b!==f&&f.rf();)ak(Zj(a,d),b.u()),b=b.s(),f=f.s(),f.rf()&&(f=f.s());if(f.rf()){for(var g=this,k=0;g!==f;)g=g.s(),f=f.s(),k=1+k|0;b===f&&0=b||a.m())return lh(),lj();if(1===b){var d=a.u();return jj(new kj,d,Nc(function(){return function(){lh();return lj()}}(a)))}d=a.u();return jj(new kj,d,Nc(function(a,b){return function(){return hy(a.s(),-1+b|0)}}(a,b)))}l.kc=aa();l.Kb=function(a){if(this.m())throw(new xj).h("empty.reduceLeft");for(var b=this.u(),d=this.s();!d.m();)b=zg(a,b,d.u()),d=d.s();return b}; +function dy(a,b){if(a.m())return cd(b).db();var d=a.u();return jj(new kj,d,Nc(function(a,b){return function(){return dy(a.s(),b)}}(a,b)))}l.Wb=h("Stream");function gy(a,b,d){return Is(d.Tc(a))?(a.m()||b.m()?a=lj():(d=(new V).ha(a.u(),b.u()),a=jj(new kj,d,Nc(function(a,b){return function(){return gy(a.s(),b.s(),(lh(),(new rq).b()))}}(a,b)))),a):dj(a,b,d)}function iy(){}iy.prototype=new Jx; +iy.prototype.a=new s({GB:0},!1,"scala.collection.immutable.HashMap$EmptyHashMap$",{GB:1,ri:1,se:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,Id:1,Na:1,Qa:1,Pa:1,Jd:1,g:1,e:1,Sa:1});var jy=void 0;function vu(){jy||(jy=(new iy).b());return jy}function ky(){this.Mc=null;this.Jb=0;this.ki=this.gg=null}ky.prototype=new Jx;function St(a){null===a.ki&&(a.ki=(new V).ha(a.Mc,a.gg));return a.ki} +function Kx(a,b,d,e){var f=new ky;f.Mc=a;f.Jb=b;f.gg=d;f.ki=e;return f}l=ky.prototype;l.Ai=function(a,b,d,e,f,g){if(b===this.Jb&&O(P(),a,this.Mc)){if(null===g)return this.gg===e?this:Kx(a,b,e,f);a=g.Wj(this.ki,f);return Kx(a.Ua,b,a.$a,a)}if(b!==this.Jb)return a=Kx(a,b,e,f),ru(wu(),this.Jb,this,b,a,d,2);d=rx();return ly(new my,b,sx(new tx,d,this.Mc,this.gg).Ci(a,e))};l.eh=function(a,b){return b===this.Jb&&O(P(),a,this.Mc)?(new tg).w(this.gg):sg()};l.R=function(a){a.l(St(this))}; +l.X=function(){$g();var a=(new C).A([St(this)]);return W(new X,a,a.p.length|0)};l.U=h(1);l.a=new s({Go:0},!1,"scala.collection.immutable.HashMap$HashMap1",{Go:1,ri:1,se:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,Id:1,Na:1,Qa:1,Pa:1,Jd:1,g:1,e:1,Sa:1});function my(){this.Jb=0;this.He=null}my.prototype=new Jx;l=my.prototype; +l.Ai=function(a,b,d,e,f,g){if(b===this.Jb){if(null===g||!Ab(this.He.Xc(a)))return ly(new my,b,this.He.Ci(a,e));d=this.He;a=g.Wj((new V).ha(a,this.He.l(a)),f);return ly(new my,b,d.Ci(a.Ua,a.$a))}a=Kx(a,b,e,f);return ru(wu(),this.Jb,this,b,a,d,1+this.He.U()|0)};l.eh=function(a,b){return b===this.Jb?this.He.Xc(a):sg()};l.R=function(a){var b=this.He.X();nj(b,a)};l.X=function(){return this.He.X()};l.U=function(){return this.He.U()};function ly(a,b,d){a.Jb=b;a.He=d;return a} +l.a=new s({HB:0},!1,"scala.collection.immutable.HashMap$HashMapCollision1",{HB:1,ri:1,se:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,Id:1,Na:1,Qa:1,Pa:1,Jd:1,g:1,e:1,Sa:1});function uu(){this.yf=0;this.md=null;this.Mb=0}uu.prototype=new Jx;l=uu.prototype; +l.Ai=function(a,b,d,e,f,g){var k=1<<(31&(b>>>d|0)),n=Nf(Ve(),this.yf&(-1+k|0));if(0!==(this.yf&k)){k=this.md.d[n];a=k.Ai(a,b,5+d|0,e,f,g);if(a===k)return this;b=p(v(su),[this.md.d.length]);zl(rc(),this.md,0,b,0,this.md.d.length);b.d[n]=a;return tu(new uu,this.yf,b,this.Mb+(a.U()-k.U()|0)|0)}d=p(v(su),[1+this.md.d.length|0]);zl(rc(),this.md,0,d,0,n);d.d[n]=Kx(a,b,e,f);zl(rc(),this.md,n,d,1+n|0,this.md.d.length-n|0);return tu(new uu,this.yf|k,d,1+this.Mb|0)}; +l.eh=function(a,b,d){var e=31&(b>>>d|0),f=1<e)a.Ga(Z(a.nb()));else if(1024>e)a.va(Z(a.P())),a.P().d[31&b>>5]=a.nb(),a.Ga(ol(a.P(),31&d>>5));else if(32768>e)a.va(Z(a.P())),a.Fa(Z(a.aa())),a.P().d[31&b>>5]=a.nb(),a.aa().d[31&b>>10]=a.P(),a.va(ol(a.aa(),31&d>>10)),a.Ga(ol(a.P(),31&d>>5));else if(1048576>e)a.va(Z(a.P())),a.Fa(Z(a.aa())),a.eb(Z(a.Aa())),a.P().d[31&b>>5]=a.nb(),a.aa().d[31&b>>10]=a.P(),a.Aa().d[31&b>>15]=a.aa(),a.Fa(ol(a.Aa(),31&d>>15)),a.va(ol(a.aa(),31&d>>10)),a.Ga(ol(a.P(),31&d>>5));else if(33554432> +e)a.va(Z(a.P())),a.Fa(Z(a.aa())),a.eb(Z(a.Aa())),a.vc(Z(a.Ra())),a.P().d[31&b>>5]=a.nb(),a.aa().d[31&b>>10]=a.P(),a.Aa().d[31&b>>15]=a.aa(),a.Ra().d[31&b>>20]=a.Aa(),a.eb(ol(a.Ra(),31&d>>20)),a.Fa(ol(a.Aa(),31&d>>15)),a.va(ol(a.aa(),31&d>>10)),a.Ga(ol(a.P(),31&d>>5));else if(1073741824>e)a.va(Z(a.P())),a.Fa(Z(a.aa())),a.eb(Z(a.Aa())),a.vc(Z(a.Ra())),a.Df(Z(a.Ic())),a.P().d[31&b>>5]=a.nb(),a.aa().d[31&b>>10]=a.P(),a.Aa().d[31&b>>15]=a.aa(),a.Ra().d[31&b>>20]=a.Aa(),a.Ic().d[31&b>>25]=a.Ra(),a.vc(ol(a.Ic(), +31&d>>25)),a.eb(ol(a.Ra(),31&d>>20)),a.Fa(ol(a.Aa(),31&d>>15)),a.va(ol(a.aa(),31&d>>10)),a.Ga(ol(a.P(),31&d>>5));else throw(new Cb).b();else{b=-1+a.Hb()|0;switch(b){case 5:a.Df(Z(a.Ic()));a.vc(ol(a.Ic(),31&d>>25));a.eb(ol(a.Ra(),31&d>>20));a.Fa(ol(a.Aa(),31&d>>15));a.va(ol(a.aa(),31&d>>10));a.Ga(ol(a.P(),31&d>>5));break;case 4:a.vc(Z(a.Ra()));a.eb(ol(a.Ra(),31&d>>20));a.Fa(ol(a.Aa(),31&d>>15));a.va(ol(a.aa(),31&d>>10));a.Ga(ol(a.P(),31&d>>5));break;case 3:a.eb(Z(a.Aa()));a.Fa(ol(a.Aa(),31&d>>15)); +a.va(ol(a.aa(),31&d>>10));a.Ga(ol(a.P(),31&d>>5));break;case 2:a.Fa(Z(a.aa()));a.va(ol(a.aa(),31&d>>10));a.Ga(ol(a.P(),31&d>>5));break;case 1:a.va(Z(a.P()));a.Ga(ol(a.P(),31&d>>5));break;case 0:a.Ga(Z(a.nb()));break;default:throw(new K).w(b);}a.mb=!0}}l.u=function(){if(0===this.pb(0))throw(new xj).h("empty.head");return this.ma(0)};l.ma=function(a){var b=a+this.sb|0;if(0<=a&&bthis.sb){var b=this.Ib-1|0,d=-32&(-1+b|0),e=ry(this.sb^(-1+b|0)),f=this.sb&~(-1+(1<=b)ty(a.vb,b);else if(1024>=b)ty(a.vb,1+(31&(-1+b|0))|0),a.Db=uy(a.Db,b>>>5|0);else if(32768>=b)ty(a.vb,1+(31&(-1+b|0))|0),a.Db=uy(a.Db,1+(31&((-1+b|0)>>>5|0))|0),a.Yb=uy(a.Yb,b>>>10|0);else if(1048576>= +b)ty(a.vb,1+(31&(-1+b|0))|0),a.Db=uy(a.Db,1+(31&((-1+b|0)>>>5|0))|0),a.Yb=uy(a.Yb,1+(31&((-1+b|0)>>>10|0))|0),a.uc=uy(a.uc,b>>>15|0);else if(33554432>=b)ty(a.vb,1+(31&(-1+b|0))|0),a.Db=uy(a.Db,1+(31&((-1+b|0)>>>5|0))|0),a.Yb=uy(a.Yb,1+(31&((-1+b|0)>>>10|0))|0),a.uc=uy(a.uc,1+(31&((-1+b|0)>>>15|0))|0),a.Uc=uy(a.Uc,b>>>20|0);else if(1073741824>=b)ty(a.vb,1+(31&(-1+b|0))|0),a.Db=uy(a.Db,1+(31&((-1+b|0)>>>5|0))|0),a.Yb=uy(a.Yb,1+(31&((-1+b|0)>>>10|0))|0),a.uc=uy(a.uc,1+(31&((-1+b|0)>>>15|0))|0),a.Uc= +uy(a.Uc,1+(31&((-1+b|0)>>>20|0))|0),a.Nd=uy(a.Nd,b>>>25|0);else throw(new Cb).b();}else a=uc().Fh;return a};l.Ab=function(){return uc()};l.nb=c("vb");l.Fa=da("Yb");l.Ra=c("Uc");function vy(a,b,d){var e=-1+a.ub|0;switch(e){case 0:a.vb=rl(a.vb,b,d);break;case 1:a.Db=rl(a.Db,b,d);break;case 2:a.Yb=rl(a.Yb,b,d);break;case 3:a.uc=rl(a.uc,b,d);break;case 4:a.Uc=rl(a.Uc,b,d);break;case 5:a.Nd=rl(a.Nd,b,d);break;default:throw(new K).w(e);}}l.Rc=function(){return this}; +function qy(a,b){if(a.Ib!==a.sb){var d=-32&a.Ib,e=31&a.Ib;if(a.Ib!==d){var f=(new Vs).k(a.sb,1+a.Ib|0,d);pl(f,a,a.ub);f.mb=a.mb;py(f,a.wc,d,a.wc^d);f.vb.d[e]=b;return f}var g=a.sb&~(-1+(1<>>w(5,-1+a.ub|0)|0;if(0!==g){if(1=e||e>5)return e=(new Hj).w(this),d.R(M(function(a,b){return function(a){b.v=b.v.Dd(a,(uc(),vc().zb))}}(this,e))),e.v;if(this.q()>5&&d&&d.a&&d.a.t.Po){for(e=Ts(this);e.Ca();)var f=e.wa(),d=d.Fc(f,(uc(),vc().zb));return d}return Qj(this,d,b)}}else return Qj(this,a.Ba(),b)};l.q=function(){return this.Ib-this.sb|0};l.Me=function(){return this};l.vc=da("Uc"); +function wy(a,b,d,e){a.mb?(nl(a,b),sl(a,b,d,e)):(sl(a,b,d,e),a.mb=!0)}l.P=c("Db");l.Je=function(){if(0===this.pb(0))throw(new xj).h("empty.last");return this.ma(-1+this.q()|0)};l.Zb=function(a){return yy(this,a)};l.Ic=c("Nd");l.s=function(){if(0===this.pb(0))throw(new xj).h("empty.tail");return yy(this,1)};l.bc=function(){return this};function ry(a){if(32>a)return 1;if(1024>a)return 2;if(32768>a)return 3;if(1048576>a)return 4;if(33554432>a)return 5;if(1073741824>a)return 6;throw(new Cb).b();} +function xd(a){var b=a.sb,d=a.Ib,e=new Xt;e.lk=d;e.Af=-32&b;e.Yf=31&b;b=d-e.Af|0;e.mk=32>b?b:32;e.Oe=(e.Af+e.Yf|0)>>w(5,-1+a.ub|0)|0;if(0!==f){if(1d)return f=(1<=b)d=a;else if((a.sb+b|0)e)Ey(d.vb,e);else if(1024>e)Ey(d.vb,31&e),d.Db=Uy(d.Db,e>>>5|0);else if(32768>e)Ey(d.vb,31&e),d.Db=Uy(d.Db,31&(e>>>5|0)),d.Yb=Uy(d.Yb,e>>>10|0);else if(1048576>e)Ey(d.vb,31&e),d.Db=Uy(d.Db,31&(e>>>5|0)),d.Yb=Uy(d.Yb,31&(e>>>10|0)),d.uc=Uy(d.uc,e>>>15|0);else if(33554432>e)Ey(d.vb, +31&e),d.Db=Uy(d.Db,31&(e>>>5|0)),d.Yb=Uy(d.Yb,31&(e>>>10|0)),d.uc=Uy(d.uc,31&(e>>>15|0)),d.Uc=Uy(d.Uc,e>>>20|0);else if(1073741824>e)Ey(d.vb,31&e),d.Db=Uy(d.Db,31&(e>>>5|0)),d.Yb=Uy(d.Yb,31&(e>>>10|0)),d.uc=Uy(d.uc,31&(e>>>15|0)),d.Uc=Uy(d.Uc,31&(e>>>20|0)),d.Nd=Uy(d.Nd,e>>>25|0);else throw(new Cb).b();}else d=uc().Fh;return d}l.kc=aa();function uy(a,b){var d=p(v(u),[a.d.length]);Fa(a,0,d,0,b);return d}function Uy(a,b){var d=p(v(u),[a.d.length]);Fa(a,b,d,b,d.d.length-b|0);return d}l.eb=da("uc"); +l.a=new s({Po:0},!1,"scala.collection.immutable.Vector",{Po:1,gc:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,Sb:1,la:1,x:1,Rb:1,Wa:1,Xa:1,gl:1,Mg:1,Na:1,Qa:1,Pa:1,Pc:1,rb:1,Qo:1,g:1,e:1,Sa:1});function wl(){this.Xd=null}wl.prototype=new Lw;l=wl.prototype;l.Ba=function(){return this};l.u=function(){return cj(this)};l.ma=function(a){a=65535&(this.Xd.charCodeAt(a)|0);return(new Re).nc(a)};l.pb=function(a){return Fi(this,a)}; +l.l=function(a){a=65535&(this.Xd.charCodeAt(a|0)|0);return(new Re).nc(a)};l.Qb=function(a){return Ui(this,a)};l.m=function(){return aj(this)};l.Ja=function(){return this};l.o=c("Xd");l.ef=function(){return Yi(this)};l.Ab=function(){return In()};l.R=function(a){Wi(this,a)};l.le=function(a,b){return Ni(this,0,this.Xd.length|0,a,b)};l.Qc=function(a,b){return Vy(this,a,b)};l.pc=function(){return Xi(this)};l.X=function(){return W(new X,this,this.Xd.length|0)};l.Me=function(){return this}; +l.q=function(){return this.Xd.length|0};l.ec=c("Xd");l.Yg=function(a){return Ti(this,a)};l.Je=function(){return Gi(this)};l.Zb=function(a){return Vy(this,a,this.Xd.length|0)};l.bc=function(){return this};l.s=function(){return $i(this)};l.Va=function(a){return Di(this,a|0)};l.M=function(){return Nn(wi(),this)};l.Hc=function(a,b,d){Qi(this,a,b,d)};l.h=function(a){this.Xd=a;return this}; +function Vy(a,b,d){b=0>b?0:b;if(d<=b||b>=(a.Xd.length|0))return(new wl).h("");d=d>(a.Xd.length|0)?a.Xd.length|0:d;Ac();return(new wl).h((null!==a?a.Xd:null).substring(b,d))}l.kc=aa();l.Kb=function(a){return Mi(this,a)};l.na=function(){xl||(xl=(new tl).b());return xl.na()}; +l.a=new s({SC:0},!1,"scala.collection.immutable.WrappedString",{SC:1,gc:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,Sb:1,la:1,x:1,Rb:1,Wa:1,Xa:1,gl:1,Mg:1,Na:1,Qa:1,Pa:1,Pc:1,rb:1,No:1,Lb:1,lh:1,Zc:1});function Ub(){this.Cd=this.Jf=null}Ub.prototype=new Ox;l=Ub.prototype;l.jb=h("::");l.u=c("Jf");l.hb=h(2);l.m=h(!1);l.ib=function(a){switch(a){case 0:return this.Jf;case 1:return this.Cd;default:throw(new Rg).h(""+a);}};l.s=c("Cd"); +function Tb(a,b,d){a.Jf=b;a.Cd=d;return a}l.qb=function(){return Fr(new Gr,this)};l.a=new s({el:0},!1,"scala.collection.immutable.$colon$colon",{el:1,Jo:1,gc:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,Sb:1,la:1,x:1,Rb:1,Wa:1,Xa:1,hl:1,Mg:1,Na:1,Qa:1,Pa:1,pi:1,Vk:1,xa:1,Wk:1,e:1,g:1});function Wy(){}Wy.prototype=new Ox;l=Wy.prototype;l.u=function(){this.ei()};l.jb=h("Nil");l.hb=h(0);l.K=function(a){return Nr(a)?a.m():!1}; +function $x(){throw(new xj).h("tail of empty list");}l.m=h(!0);l.ib=function(a){throw(new Rg).h(""+a);};l.ei=function(){throw(new uj).h("head of empty list");};l.s=function(){return $x()};l.qb=function(){return Fr(new Gr,this)};l.a=new s({jC:0},!1,"scala.collection.immutable.Nil$",{jC:1,Jo:1,gc:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,Sb:1,la:1,x:1,Rb:1,Wa:1,Xa:1,hl:1,Mg:1,Na:1,Qa:1,Pa:1,pi:1,Vk:1,xa:1,Wk:1,e:1,g:1});var Xy=void 0; +function x(){Xy||(Xy=(new Wy).b());return Xy}function Yy(){}Yy.prototype=new Nw;function Zy(){}l=Zy.prototype=Yy.prototype;l.Ba=function(){return this};l.Ab=function(){Zs||(Zs=(new Ys).b());return Zs};l.hd=function(a,b){Ul(this,a,b)};l.Ta=ba();l.na=function(){return this.Ff()};l.Ka=function(a){return lk(this,a)};function $y(){Bf.call(this);this.Tu=this.yl=null}$y.prototype=new Qw;l=$y.prototype;l.Ba=function(){return this};l.Ja=function(){return this};l.Fj=function(a){return al(this,a)}; +l.Np=function(a,b){return this.Gj((new V).ha(a,b))};function Ix(a,b){var d=new $y;if(null===a)throw G(H(),null);d.yl=a;d.Tu=b;Bf.prototype.Ak.call(d,a,b);return d}l.Ab=function(){return qs()};l.Ff=function(){return Ld(this.ni())};l.dg=function(){return this};l.ni=function(){return this.yl.ni()};l.lc=function(){return this};l.Gj=function(a){return al(this,a)};l.Al=function(a){return cl(this,a)};l.cj=function(a){return Ix(this,a)};l.Yd=function(a){return al(this,a)};l.na=function(){return ok(bl(),this.ni())}; +l.a=new s({yC:0},!1,"scala.collection.immutable.SortedMap$$anon$2",{yC:1,Xk:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,ro:1,CI:1,wC:1,Id:1,Na:1,Qa:1,Pa:1,Jd:1,nB:1,oB:1,AB:1,uI:1});function az(){}az.prototype=new Hw;function bz(){}l=bz.prototype=az.prototype;l.m=function(){return 0===this.U()};l.K=function(a){return Ei(this,a)};l.o=function(){return Lj(this)};l.ol=function(a){var b=Xs(this);return oj(b,a)}; +l.hd=function(a,b){Ul(this,a,b)};l.M=function(){var a=wi();return ti(a,this,a.ml)};l.Ta=ba();l.na=function(){return this.Ab().Ef()};l.Ka=function(a){return lk(this,a)};l.Wb=h("Set");function Af(){this.Cf=null}Af.prototype=new Zy;l=Af.prototype;l.l=function(a){return this.Xj(a)};l.Ja=function(){return this};l.ji=function(a){this.Cf=a;return this};l.tb=function(a){return cz(this,a)};l.Ff=function(){return(new Af).ji(Cg())};l.pa=function(){return this};l.dg=function(){return this};l.X=function(){return(new zr).ji(this.Cf)}; +l.Xc=function(a){var b=this.Cf;return Dg().oh.call(b,a)?(new tg).w(this.Cf[a]):sg()};l.Xj=function(a){var b=this.Cf;if(Dg().oh.call(b,a))return this.Cf[a];throw(new uj).h("key not found: "+a);};function cz(a,b){a.Cf[b.Ua]=b.$a;return a}l.Gb=function(a){var b=this.Cf;return!!Dg().oh.call(b,a)};l.Da=function(a){return cz(this,a)};l.Yd=function(a){var b=(new Af).ji(Cg());return cz(lk(b,this),a)}; +l.a=new s({HD:0},!1,"scala.scalajs.js.WrappedDictionary",{HD:1,EI:1,wd:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,fd:1,Oc:1,dd:1,gd:1,la:1,x:1,ab:1,JI:1,Ad:1,Bd:1,ud:1,KI:1,Vb:1,Ub:1,Tb:1,uj:1,zd:1,td:1,qd:1});function dz(){}dz.prototype=new kx;function ez(){}ez.prototype=dz.prototype;dz.prototype.Ka=function(a){return lk(this,a)};function fz(){}fz.prototype=new kx;function gz(){}l=gz.prototype=fz.prototype;l.Ba=function(){return this};l.u=function(){return cj(this)}; +l.pb=function(a){return Fi(this,a)};l.Qb=function(a){return Ui(this,a)};l.m=function(){return aj(this)};l.Ja=function(){return this};l.ef=function(){return Yi(this)};l.Ab=function(){return Ov()};l.R=function(a){Wi(this,a)};l.le=function(a,b){return Ni(this,0,this.q(),a,b)};l.Qc=function(a,b){return Pi(this,a,b)};l.pc=function(){return Xi(this)};l.ti=function(){return this};l.X=function(){return W(new X,this,this.q())};l.Me=function(){return this};l.Yg=function(a){return Ti(this,a)};l.Je=function(){return Gi(this)}; +l.Zb=function(a){var b=this.q();return Pi(this,a,b)};l.bc=function(){return this};l.s=function(){return $i(this)};l.Va=function(a){return Di(this,a|0)};l.Hc=function(a,b,d){Qi(this,a,b,d)};l.M=function(){return Nn(wi(),this)};l.kc=aa();l.Kb=function(a){return Mi(this,a)};l.na=function(){return(new wr).zk(this.De())};l.Wb=h("WrappedArray");function er(){this.Fi=0;this.Nb=null;this.zj=this.Pg=0;this.eg=null;this.vj=0}er.prototype=new bz;l=er.prototype;l.Ba=function(){return this}; +l.b=function(){er.prototype.Ov.call(this,null);return this};l.l=function(a){return null!==em(this,a)};l.Ja=function(){return this};l.tb=function(a){return hr(this,a)};l.Ab=function(){nw||(nw=(new mw).b());return nw};l.R=function(a){for(var b=0,d=this.Nb.d.length;ba||a>=this.Xf)throw(new Rg).h(""+a);return rj(this.Ya,a)};l.pb=function(a){return pj(this.Ya,a)};l.l=function(a){return this.ma(a|0)};l.Qb=function(a){return vj(this.Ya,a)};l.m=function(){return this.Ya.m()}; +l.Fb=function(){this.$h=!this.Ya.m();return this.Ya};l.Ja=function(){return this};l.K=function(a){return a&&a.a&&a.a.t.np?this.Ya.K(a.Ya):Nr(a)?this.Qb(a):!1};l.fc=function(a){return L(this.Ya,"",a,"")};l.Ec=function(a,b,d){return L(this.Ya,a,b,d)};l.tb=function(a){return gr(this,a)};l.Ab=function(){zw||(zw=(new yw).b());return zw};l.R=function(a){for(var b=this.Ya;!b.m();)a.l(b.u()),b=b.s()};l.le=function(a,b){return qj(this.Ya,a,b)};l.U=c("Xf");l.pa=function(){return this.Fb()}; +l.X=function(){var a=new $s;a.Xh=this.Ya.m()?x():this.Ya;return a};l.hd=function(a,b){Ul(this,a,b)};l.ec=function(){return L(this.Ya,"","","")};l.q=c("Xf");l.Me=function(){return this};l.db=function(){return this.Ya.db()};l.Je=function(){return tj(this.Ya)};l.rc=function(a,b,d,e){return Cj(this.Ya,a,b,d,e)};function gr(a,b){a.$h&&Qx(a);if(a.Ya.m())a.Wf=Tb(new Ub,b,x()),a.Ya=a.Wf;else{var d=a.Wf;a.Wf=Tb(new Ub,b,x());d.Cd=a.Wf}a.Xf=1+a.Xf|0;return a}l.Dc=function(a){return ck(this.Ya,a)}; +l.Va=function(a){return 0<=(a|0)&&0=d)){f.hd(d,e);for(var g=0,e=e.X();gthis.Mb&&1<=a&&(a=p(v(u),[a]),Fa(this.p,0,a,0,this.Mb),this.p=a)};l.M=function(){return Nn(wi(),this)};l.kc=aa();l.Kb=function(a){return Mi(this,a)}; +l.Ka=function(a){return Ej(this,a)};l.Wb=h("ArrayBuffer");l.a=new s({UC:0},!1,"scala.collection.mutable.ArrayBuffer",{UC:1,Ro:1,Ud:1,gc:1,ya:1,za:1,c:1,ta:1,fa:1,ga:1,$:1,H:1,G:1,ca:1,ea:1,ra:1,ua:1,sa:1,qa:1,ba:1,da:1,n:1,Sb:1,la:1,x:1,Rb:1,Wa:1,Xa:1,Vd:1,Ad:1,Bd:1,ud:1,Wd:1,zd:1,td:1,qd:1,lp:1,mp:1,Ub:1,Tb:1,uj:1,Yk:1,ab:1,hc:1,$b:1,rb:1,Lb:1,Vb:1,LI:1,ge:1,Pc:1,Sa:1,g:1,e:1});}).call(this); +//# sourceMappingURL=scrollspy-opt.js.map + (function(){'use strict';function ca(){return function(a){return a}}function ea(){return function(){}}function d(a){return function(b){this[a]=b}}function g(a){return function(){return this[a]}}function l(a){return function(){return a}}var m,fa="object"===typeof __ScalaJSEnv&&__ScalaJSEnv?__ScalaJSEnv:{},n="object"===typeof fa.global&&fa.global?fa.global:"object"===typeof global&&global&&global.Object===Object?global:this;fa.global=n;var r="object"===typeof fa.exportsNamespace&&fa.exportsNamespace?fa.exportsNamespace:n; fa.exportsNamespace=r;n.Object.freeze(fa);var ga=0;function ha(a){return function(b,c){return!(!b||!b.a||b.a.hi!==c||b.a.fi!==a)}}function ia(a){var b,c;for(c in a)b=c;return b}function s(a,b){return ja(a,b,0)}function ja(a,b,c){var e=new a.vk(b[c]);if(c>24===b&&1/b!==1/-0?t(na):b<<16>>16===b&&1/b!==1/-0?t(pa):t(sa):a!==a||ta(a)===a?t(ua):t(va);case "boolean":return t(wa);case "undefined":return t(xa);default:if(null===a)throw(new ya).b();return za(a)?t(Aa):a&&a.a?t(a.a):null}}function Ca(a,b){return a&&a.a||null===a?a.M(b):"number"===typeof a?"number"===typeof b&&(a===b?0!==a||1/a===1/b:a!==a&&b!==b):a===b} diff --git a/styles.css b/styles.css index 014d2f9..9eb271d 100644 --- a/styles.css +++ b/styles.css @@ -1,4 +1,3 @@ -.hljs{display:block;overflow-x:auto;padding:.5em;color:#000;background:#fff;-webkit-text-size-adjust:none}.hljs-subst,.hljs-title,.json .hljs-value{font-weight:normal;color:#000}.hljs-comment,.hljs-template_comment,.hljs-javadoc,.diff .hljs-header{color:#808080;font-style:italic}.hljs-annotation,.hljs-decorator,.hljs-preprocessor,.hljs-pragma,.hljs-doctype,.hljs-pi,.hljs-chunk,.hljs-shebang,.apache .hljs-cbracket,.hljs-prompt,.http .hljs-title{color:#808000}.hljs-tag,.hljs-pi{background:#efefef}.hljs-tag .hljs-title,.hljs-id,.hljs-attr_selector,.hljs-pseudo,.hljs-literal,.hljs-keyword,.hljs-hexcolor,.css .hljs-function,.ini .hljs-title,.css .hljs-class,.hljs-list .hljs-keyword,.nginx .hljs-title,.tex .hljs-command,.hljs-request,.hljs-status{font-weight:bold;color:#000080}.hljs-attribute,.hljs-rules .hljs-keyword,.hljs-number,.hljs-date,.hljs-regexp,.tex .hljs-special{font-weight:bold;color:#00f}.hljs-number,.hljs-regexp{font-weight:normal}.hljs-string,.hljs-value,.hljs-filter .hljs-argument,.css .hljs-function .hljs-params,.apache .hljs-tag{color:#008000;font-weight:bold}.hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-char,.tex .hljs-formula{color:#000;background:#d0eded;font-style:italic}.hljs-phpdoc,.hljs-dartdoc,.hljs-yardoctag,.hljs-javadoctag{text-decoration:underline}.hljs-variable,.hljs-envvar,.apache .hljs-sqbracket,.nginx .hljs-built_in{color:#660e7a}.hljs-addition{background:#baeeba}.hljs-deletion{background:#ffc8bd}.diff .hljs-change{background:#bccff9} /*! Pure v0.5.0 Copyright 2014 Yahoo! Inc. All rights reserved. @@ -11,68 +10,7 @@ Copyright (c) Nicolas Gallagher and Jonathan Neal */ /*! normalize.css v1.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none;height:0}[hidden]{display:none}html{font-size:100%;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}html,button,input,select,textarea{font-family:sans-serif}body{margin:0}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{font-size:2em;margin:.67em 0}h2{font-size:1.5em;margin:.83em 0}h3{font-size:1.17em;margin:1em 0}h4{font-size:1em;margin:1.33em 0}h5{font-size:.83em;margin:1.67em 0}h6{font-size:.67em;margin:2.33em 0}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:700}blockquote{margin:1em 40px}dfn{font-style:italic}hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}mark{background:#ff0;color:#000}p,pre{margin:1em 0}code,kbd,pre,samp{font-family:monospace,serif;_font-family:'courier new',monospace;font-size:1em}pre{white-space:pre;white-space:pre-wrap;word-wrap:break-word}q{quotes:none}q:before,q:after{content:'';content:none}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sup{top:-.5em}sub{bottom:-.25em}dl,menu,ol,ul{margin:1em 0}dd{margin:0 0 0 40px}menu,ol,ul{padding:0 0 0 40px}nav ul,nav ol{list-style:none;list-style-image:none}img{border:0;-ms-interpolation-mode:bicubic}svg:not(:root){overflow:hidden}figure{margin:0}form{margin:0}fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}legend{border:0;padding:0;white-space:normal;*margin-left:-7px}button,input,select,textarea{font-size:100%;margin:0;vertical-align:baseline;*vertical-align:middle}button,input{line-height:normal}button,select{text-transform:none}button,html input[type=button],input[type=reset],input[type=submit]{-webkit-appearance:button;cursor:pointer;*overflow:visible}button[disabled],html input[disabled]{cursor:default}input[type=checkbox],input[type=radio]{box-sizing:border-box;padding:0;*height:13px;*width:13px}input[type=search]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}input[type=search]::-webkit-search-cancel-button,input[type=search]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}[hidden]{display:none!important}.pure-img{max-width:100%;height:auto;display:block}.pure-g{letter-spacing:-.31em;*letter-spacing:normal;*word-spacing:-.43em;text-rendering:optimizespeed;font-family:FreeSans,Arimo,"Droid Sans",Helvetica,Arial,sans-serif;display:-webkit-flex;-webkit-flex-flow:row wrap;display:-ms-flexbox;-ms-flex-flow:row wrap}.opera-only :-o-prefocus,.pure-g{word-spacing:-.43em}.pure-u{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-g [class *="pure-u"]{font-family:sans-serif}.pure-u-1,.pure-u-1-1,.pure-u-1-2,.pure-u-1-3,.pure-u-2-3,.pure-u-1-4,.pure-u-3-4,.pure-u-1-5,.pure-u-2-5,.pure-u-3-5,.pure-u-4-5,.pure-u-5-5,.pure-u-1-6,.pure-u-5-6,.pure-u-1-8,.pure-u-3-8,.pure-u-5-8,.pure-u-7-8,.pure-u-1-12,.pure-u-5-12,.pure-u-7-12,.pure-u-11-12,.pure-u-1-24,.pure-u-2-24,.pure-u-3-24,.pure-u-4-24,.pure-u-5-24,.pure-u-6-24,.pure-u-7-24,.pure-u-8-24,.pure-u-9-24,.pure-u-10-24,.pure-u-11-24,.pure-u-12-24,.pure-u-13-24,.pure-u-14-24,.pure-u-15-24,.pure-u-16-24,.pure-u-17-24,.pure-u-18-24,.pure-u-19-24,.pure-u-20-24,.pure-u-21-24,.pure-u-22-24,.pure-u-23-24,.pure-u-24-24{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-u-1-24{width:4.1667%;*width:4.1357%}.pure-u-1-12,.pure-u-2-24{width:8.3333%;*width:8.3023%}.pure-u-1-8,.pure-u-3-24{width:12.5%;*width:12.469%}.pure-u-1-6,.pure-u-4-24{width:16.6667%;*width:16.6357%}.pure-u-1-5{width:20%;*width:19.969%}.pure-u-5-24{width:20.8333%;*width:20.8023%}.pure-u-1-4,.pure-u-6-24{width:25%;*width:24.969%}.pure-u-7-24{width:29.1667%;*width:29.1357%}.pure-u-1-3,.pure-u-8-24{width:33.3333%;*width:33.3023%}.pure-u-3-8,.pure-u-9-24{width:37.5%;*width:37.469%}.pure-u-2-5{width:40%;*width:39.969%}.pure-u-5-12,.pure-u-10-24{width:41.6667%;*width:41.6357%}.pure-u-11-24{width:45.8333%;*width:45.8023%}.pure-u-1-2,.pure-u-12-24{width:50%;*width:49.969%}.pure-u-13-24{width:54.1667%;*width:54.1357%}.pure-u-7-12,.pure-u-14-24{width:58.3333%;*width:58.3023%}.pure-u-3-5{width:60%;*width:59.969%}.pure-u-5-8,.pure-u-15-24{width:62.5%;*width:62.469%}.pure-u-2-3,.pure-u-16-24{width:66.6667%;*width:66.6357%}.pure-u-17-24{width:70.8333%;*width:70.8023%}.pure-u-3-4,.pure-u-18-24{width:75%;*width:74.969%}.pure-u-19-24{width:79.1667%;*width:79.1357%}.pure-u-4-5{width:80%;*width:79.969%}.pure-u-5-6,.pure-u-20-24{width:83.3333%;*width:83.3023%}.pure-u-7-8,.pure-u-21-24{width:87.5%;*width:87.469%}.pure-u-11-12,.pure-u-22-24{width:91.6667%;*width:91.6357%}.pure-u-23-24{width:95.8333%;*width:95.8023%}.pure-u-1,.pure-u-1-1,.pure-u-5-5,.pure-u-24-24{width:100%}.pure-button{display:inline-block;*display:inline;zoom:1;line-height:normal;white-space:nowrap;vertical-align:baseline;text-align:center;cursor:pointer;-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pure-button::-moz-focus-inner{padding:0;border:0}.pure-button{font-family:inherit;font-size:100%;*font-size:90%;*overflow:visible;padding:.5em 1em;color:#444;color:rgba(0,0,0,.8);*color:#444;border:1px solid #999;border:0 rgba(0,0,0,0);background-color:#E6E6E6;text-decoration:none;border-radius:2px}.pure-button-hover,.pure-button:hover,.pure-button:focus{filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000', endColorstr='#1a000000', GradientType=0);background-image:-webkit-gradient(linear,0 0,0 100%,from(transparent),color-stop(40%,rgba(0,0,0,.05)),to(rgba(0,0,0,.1)));background-image:-webkit-linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1));background-image:-moz-linear-gradient(top,rgba(0,0,0,.05) 0,rgba(0,0,0,.1));background-image:-o-linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1));background-image:linear-gradient(transparent,rgba(0,0,0,.05) 40%,rgba(0,0,0,.1))}.pure-button:focus{outline:0}.pure-button-active,.pure-button:active{box-shadow:0 0 0 1px rgba(0,0,0,.15) inset,0 0 6px rgba(0,0,0,.2) inset}.pure-button[disabled],.pure-button-disabled,.pure-button-disabled:hover,.pure-button-disabled:focus,.pure-button-disabled:active{border:0;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);filter:alpha(opacity=40);-khtml-opacity:.4;-moz-opacity:.4;opacity:.4;cursor:not-allowed;box-shadow:none}.pure-button-hidden{display:none}.pure-button::-moz-focus-inner{padding:0;border:0}.pure-button-primary,.pure-button-selected,a.pure-button-primary,a.pure-button-selected{background-color:#0078e7;color:#fff}.pure-form input[type=text],.pure-form input[type=password],.pure-form input[type=email],.pure-form input[type=url],.pure-form input[type=date],.pure-form input[type=month],.pure-form input[type=time],.pure-form input[type=datetime],.pure-form input[type=datetime-local],.pure-form input[type=week],.pure-form input[type=number],.pure-form input[type=search],.pure-form input[type=tel],.pure-form input[type=color],.pure-form select,.pure-form textarea{padding:.5em .6em;display:inline-block;border:1px solid #ccc;box-shadow:inset 0 1px 3px #ddd;border-radius:4px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.pure-form input:not([type]){padding:.5em .6em;display:inline-block;border:1px solid #ccc;box-shadow:inset 0 1px 3px #ddd;border-radius:4px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.pure-form input[type=color]{padding:.2em .5em}.pure-form input[type=text]:focus,.pure-form input[type=password]:focus,.pure-form input[type=email]:focus,.pure-form input[type=url]:focus,.pure-form input[type=date]:focus,.pure-form input[type=month]:focus,.pure-form input[type=time]:focus,.pure-form input[type=datetime]:focus,.pure-form input[type=datetime-local]:focus,.pure-form input[type=week]:focus,.pure-form input[type=number]:focus,.pure-form input[type=search]:focus,.pure-form input[type=tel]:focus,.pure-form input[type=color]:focus,.pure-form select:focus,.pure-form textarea:focus{outline:0;outline:thin dotted \9;border-color:#129FEA}.pure-form input:not([type]):focus{outline:0;outline:thin dotted \9;border-color:#129FEA}.pure-form input[type=file]:focus,.pure-form input[type=radio]:focus,.pure-form input[type=checkbox]:focus{outline:thin dotted #333;outline:1px auto #129FEA}.pure-form .pure-checkbox,.pure-form .pure-radio{margin:.5em 0;display:block}.pure-form input[type=text][disabled],.pure-form input[type=password][disabled],.pure-form input[type=email][disabled],.pure-form input[type=url][disabled],.pure-form input[type=date][disabled],.pure-form input[type=month][disabled],.pure-form input[type=time][disabled],.pure-form input[type=datetime][disabled],.pure-form input[type=datetime-local][disabled],.pure-form input[type=week][disabled],.pure-form input[type=number][disabled],.pure-form input[type=search][disabled],.pure-form input[type=tel][disabled],.pure-form input[type=color][disabled],.pure-form select[disabled],.pure-form textarea[disabled]{cursor:not-allowed;background-color:#eaeded;color:#cad2d3}.pure-form input:not([type])[disabled]{cursor:not-allowed;background-color:#eaeded;color:#cad2d3}.pure-form input[readonly],.pure-form select[readonly],.pure-form textarea[readonly]{background:#eee;color:#777;border-color:#ccc}.pure-form input:focus:invalid,.pure-form textarea:focus:invalid,.pure-form select:focus:invalid{color:#b94a48;border-color:#ee5f5b}.pure-form input:focus:invalid:focus,.pure-form textarea:focus:invalid:focus,.pure-form select:focus:invalid:focus{border-color:#e9322d}.pure-form input[type=file]:focus:invalid:focus,.pure-form input[type=radio]:focus:invalid:focus,.pure-form input[type=checkbox]:focus:invalid:focus{outline-color:#e9322d}.pure-form select{border:1px solid #ccc;background-color:#fff}.pure-form select[multiple]{height:auto}.pure-form label{margin:.5em 0 .2em}.pure-form fieldset{margin:0;padding:.35em 0 .75em;border:0}.pure-form legend{display:block;width:100%;padding:.3em 0;margin-bottom:.3em;color:#333;border-bottom:1px solid #e5e5e5}.pure-form-stacked input[type=text],.pure-form-stacked input[type=password],.pure-form-stacked input[type=email],.pure-form-stacked input[type=url],.pure-form-stacked input[type=date],.pure-form-stacked input[type=month],.pure-form-stacked input[type=time],.pure-form-stacked input[type=datetime],.pure-form-stacked input[type=datetime-local],.pure-form-stacked input[type=week],.pure-form-stacked input[type=number],.pure-form-stacked input[type=search],.pure-form-stacked input[type=tel],.pure-form-stacked input[type=color],.pure-form-stacked select,.pure-form-stacked label,.pure-form-stacked textarea{display:block;margin:.25em 0}.pure-form-stacked input:not([type]){display:block;margin:.25em 0}.pure-form-aligned input,.pure-form-aligned textarea,.pure-form-aligned select,.pure-form-aligned .pure-help-inline,.pure-form-message-inline{display:inline-block;*display:inline;*zoom:1;vertical-align:middle}.pure-form-aligned textarea{vertical-align:top}.pure-form-aligned .pure-control-group{margin-bottom:.5em}.pure-form-aligned .pure-control-group label{text-align:right;display:inline-block;vertical-align:middle;width:10em;margin:0 1em 0 0}.pure-form-aligned .pure-controls{margin:1.5em 0 0 10em}.pure-form input.pure-input-rounded,.pure-form .pure-input-rounded{border-radius:2em;padding:.5em 1em}.pure-form .pure-group fieldset{margin-bottom:10px}.pure-form .pure-group input{display:block;padding:10px;margin:0;border-radius:0;position:relative;top:-1px}.pure-form .pure-group input:focus{z-index:2}.pure-form .pure-group input:first-child{top:1px;border-radius:4px 4px 0 0}.pure-form .pure-group input:last-child{top:-2px;border-radius:0 0 4px 4px}.pure-form .pure-group button{margin:.35em 0}.pure-form .pure-input-1{width:100%}.pure-form .pure-input-2-3{width:66%}.pure-form .pure-input-1-2{width:50%}.pure-form .pure-input-1-3{width:33%}.pure-form .pure-input-1-4{width:25%}.pure-form .pure-help-inline,.pure-form-message-inline{display:inline-block;padding-left:.3em;color:#666;vertical-align:middle;font-size:.875em}.pure-form-message{display:block;color:#666;font-size:.875em}@media only screen and (max-width :480px){.pure-form button[type=submit]{margin:.7em 0 0}.pure-form input:not([type]),.pure-form input[type=text],.pure-form input[type=password],.pure-form input[type=email],.pure-form input[type=url],.pure-form input[type=date],.pure-form input[type=month],.pure-form input[type=time],.pure-form input[type=datetime],.pure-form input[type=datetime-local],.pure-form input[type=week],.pure-form input[type=number],.pure-form input[type=search],.pure-form input[type=tel],.pure-form input[type=color],.pure-form label{margin-bottom:.3em;display:block}.pure-group input:not([type]),.pure-group input[type=text],.pure-group input[type=password],.pure-group input[type=email],.pure-group input[type=url],.pure-group input[type=date],.pure-group input[type=month],.pure-group input[type=time],.pure-group input[type=datetime],.pure-group input[type=datetime-local],.pure-group input[type=week],.pure-group input[type=number],.pure-group input[type=search],.pure-group input[type=tel],.pure-group input[type=color]{margin-bottom:0}.pure-form-aligned .pure-control-group label{margin-bottom:.3em;text-align:left;display:block;width:100%}.pure-form-aligned .pure-controls{margin:1.5em 0 0}.pure-form .pure-help-inline,.pure-form-message-inline,.pure-form-message{display:block;font-size:.75em;padding:.2em 0 .8em}}.pure-menu ul{position:absolute;visibility:hidden}.pure-menu.pure-menu-open{visibility:visible;z-index:2;width:100%}.pure-menu ul{left:-10000px;list-style:none;margin:0;padding:0;top:-10000px;z-index:1}.pure-menu>ul{position:relative}.pure-menu-open>ul{left:0;top:0;visibility:visible}.pure-menu-open>ul:focus{outline:0}.pure-menu li{position:relative}.pure-menu a,.pure-menu .pure-menu-heading{display:block;color:inherit;line-height:1.5em;padding:5px 20px;text-decoration:none;white-space:nowrap}.pure-menu.pure-menu-horizontal>.pure-menu-heading{display:inline-block;*display:inline;zoom:1;margin:0;vertical-align:middle}.pure-menu.pure-menu-horizontal>ul{display:inline-block;*display:inline;zoom:1;vertical-align:middle}.pure-menu li a{padding:5px 20px}.pure-menu-can-have-children>.pure-menu-label:after{content:'\25B8';float:right;font-family:'Lucida Grande','Lucida Sans Unicode','DejaVu Sans',sans-serif;margin-right:-20px;margin-top:-1px}.pure-menu-can-have-children>.pure-menu-label{padding-right:30px}.pure-menu-separator{background-color:#dfdfdf;display:block;height:1px;font-size:0;margin:7px 2px;overflow:hidden}.pure-menu-hidden{display:none}.pure-menu-fixed{position:fixed;top:0;left:0;width:100%}.pure-menu-horizontal li{display:inline-block;*display:inline;zoom:1;vertical-align:middle}.pure-menu-horizontal li li{display:block}.pure-menu-horizontal>.pure-menu-children>.pure-menu-can-have-children>.pure-menu-label:after{content:"\25BE"}.pure-menu-horizontal>.pure-menu-children>.pure-menu-can-have-children>.pure-menu-label{padding-right:30px}.pure-menu-horizontal li.pure-menu-separator{height:50%;width:1px;margin:0 7px}.pure-menu-horizontal li li.pure-menu-separator{height:1px;width:auto;margin:7px 2px}.pure-menu.pure-menu-open,.pure-menu.pure-menu-horizontal li .pure-menu-children{background:#fff;border:1px solid #b7b7b7}.pure-menu.pure-menu-horizontal,.pure-menu.pure-menu-horizontal .pure-menu-heading{border:0}.pure-menu a{border:1px solid transparent;border-left:0;border-right:0}.pure-menu a,.pure-menu .pure-menu-can-have-children>li:after{color:#777}.pure-menu .pure-menu-can-have-children>li:hover:after{color:#fff}.pure-menu .pure-menu-open{background:#dedede}.pure-menu li a:hover,.pure-menu li a:focus{background:#eee}.pure-menu li.pure-menu-disabled a:hover,.pure-menu li.pure-menu-disabled a:focus{background:#fff;color:#bfbfbf}.pure-menu .pure-menu-disabled>a{background-image:none;border-color:transparent;cursor:default}.pure-menu .pure-menu-disabled>a,.pure-menu .pure-menu-can-have-children.pure-menu-disabled>a:after{color:#bfbfbf}.pure-menu .pure-menu-heading{color:#565d64;text-transform:uppercase;font-size:90%;margin-top:.5em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:#dfdfdf}.pure-menu .pure-menu-selected a{color:#000}.pure-menu.pure-menu-open.pure-menu-fixed{border:0;border-bottom:1px solid #b7b7b7}.pure-paginator{letter-spacing:-.31em;*letter-spacing:normal;*word-spacing:-.43em;text-rendering:optimizespeed;list-style:none;margin:0;padding:0}.opera-only :-o-prefocus,.pure-paginator{word-spacing:-.43em}.pure-paginator li{display:inline-block;*display:inline;zoom:1;letter-spacing:normal;word-spacing:normal;vertical-align:top;text-rendering:auto}.pure-paginator .pure-button{border-radius:0;padding:.8em 1.4em;vertical-align:top;height:1.1em}.pure-paginator .pure-button:focus,.pure-paginator .pure-button:active{outline-style:none}.pure-paginator .prev,.pure-paginator .next{color:#C0C1C3;text-shadow:0 -1px 0 rgba(0,0,0,.45)}.pure-paginator .prev{border-radius:2px 0 0 2px}.pure-paginator .next{border-radius:0 2px 2px 0}@media (max-width:480px){.pure-menu-horizontal{width:100%}.pure-menu-children li{display:block;border-bottom:1px solid #000}}.pure-table{border-collapse:collapse;border-spacing:0;empty-cells:show;border:1px solid #cbcbcb}.pure-table caption{color:#000;font:italic 85%/1 arial,sans-serif;padding:1em 0;text-align:center}.pure-table td,.pure-table th{border-left:1px solid #cbcbcb;border-width:0 0 0 1px;font-size:inherit;margin:0;overflow:visible;padding:.5em 1em}.pure-table td:first-child,.pure-table th:first-child{border-left-width:0}.pure-table thead{background:#e0e0e0;color:#000;text-align:left;vertical-align:bottom}.pure-table td{background-color:transparent}.pure-table-odd td{background-color:#f2f2f2}.pure-table-striped tr:nth-child(2n-1) td{background-color:#f2f2f2}.pure-table-bordered td{border-bottom:1px solid #cbcbcb}.pure-table-bordered tbody>tr:last-child td,.pure-table-horizontal tbody>tr:last-child td{border-bottom-width:0}.pure-table-horizontal td,.pure-table-horizontal th{border-width:0 0 1px;border-bottom:1px solid #cbcbcb}.pure-table-horizontal tbody>tr:last-child td{border-bottom-width:0} -.scalatex-content *{ - position: relative; -} -.scalatex-content p{ - text-align: justify; -} - -/* -The content `
    ` is where all your content goes. -*/ -.scalatex-content { - margin: 0 auto; - padding: 0 1em; - max-width: 800px; - padding-bottom: 50px; - line-height: 1.6em; - color: #777; -} - -/* Custom Stuff */ -.scalatex-content a:link { - color: #37a; - text-decoration: none; -} -.scalatex-content a:visited { - color: #949; - text-decoration: none; -} -.scalatex-content a:hover { - text-decoration: underline; -} -.scalatex-content a:active { - color: #000; - text-decoration: underline; -} -.scalatex-content code{ - color: #000; -} - -.scalatex-hover-container:hover .scalatex-header-link:hover > i{ - opacity: 1.0; -} - -.scalatex-hover-container:hover .scalatex-header-link > i:active{ - opacity: 0.75; -} - -.scalatex-hover-container:hover .scalatex-header-link > i{ - opacity: 0.5; -} - -.scalatex-header-link > i{ - color: #777; - opacity: 0.05; - text-decoration: none; -} - - -/*Workaround for bug in highlight.js IDEA theme*/ -span.hljs-tag, span.hljs-symbol{ - background: none; -} +.hljs{display:block;overflow-x:auto;padding:.5em;color:#000;background:#fff;-webkit-text-size-adjust:none}.hljs-subst,.hljs-title,.json .hljs-value{font-weight:normal;color:#000}.hljs-comment,.hljs-template_comment,.hljs-javadoc,.diff .hljs-header{color:#808080;font-style:italic}.hljs-annotation,.hljs-decorator,.hljs-preprocessor,.hljs-pragma,.hljs-doctype,.hljs-pi,.hljs-chunk,.hljs-shebang,.apache .hljs-cbracket,.hljs-prompt,.http .hljs-title{color:#808000}.hljs-tag,.hljs-pi{background:#efefef}.hljs-tag .hljs-title,.hljs-id,.hljs-attr_selector,.hljs-pseudo,.hljs-literal,.hljs-keyword,.hljs-hexcolor,.css .hljs-function,.ini .hljs-title,.css .hljs-class,.hljs-list .hljs-keyword,.nginx .hljs-title,.tex .hljs-command,.hljs-request,.hljs-status{font-weight:bold;color:#000080}.hljs-attribute,.hljs-rules .hljs-keyword,.hljs-number,.hljs-date,.hljs-regexp,.tex .hljs-special{font-weight:bold;color:#00f}.hljs-number,.hljs-regexp{font-weight:normal}.hljs-string,.hljs-value,.hljs-filter .hljs-argument,.css .hljs-function .hljs-params,.apache .hljs-tag{color:#008000;font-weight:bold}.hljs-symbol,.ruby .hljs-symbol .hljs-string,.hljs-char,.tex .hljs-formula{color:#000;background:#d0eded;font-style:italic}.hljs-phpdoc,.hljs-dartdoc,.hljs-yardoctag,.hljs-javadoctag{text-decoration:underline}.hljs-variable,.hljs-envvar,.apache .hljs-sqbracket,.nginx .hljs-built_in{color:#660e7a}.hljs-addition{background:#baeeba}.hljs-deletion{background:#ffc8bd}.diff .hljs-change{background:#bccff9} /*! Pure v0.5.0 Copyright 2014 Yahoo! Inc. All rights reserved. -- cgit v1.2.3
    Can UseCan't Use