tour: delete the web pages

“A Tour of Go” moved to golang.org/x/website in CL 322790.
The supporting packages stay.

We may also use this repo for some other tours in the future.

Change-Id: Icb60bb9c1e4fe2e9b532108e3aefab24715c7c91
Reviewed-on: https://go-review.googlesource.com/c/tour/+/324309
Trust: Russ Cox <rsc@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/.gcloudignore b/.gcloudignore
deleted file mode 100644
index 0030d4f..0000000
--- a/.gcloudignore
+++ /dev/null
@@ -1,2 +0,0 @@
-.gcloudignore
-.git
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index fc23135..d0485e8 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,13 +17,6 @@
 General questions should go to the [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) instead of the issue tracker.
 The gophers there will answer or ask you to file an issue if you've tripped over a bug.
 
-## Verifying changes during development
-
-In order to verify changes to the slides or code examples while developing
-locally compile with your local toolchain:
-
-    $ go run golang.org/x/tour
-
 ## Contributing code
 
 Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html)
diff --git a/README.md b/README.md
index a186565..09d3b94 100644
--- a/README.md
+++ b/README.md
@@ -1,65 +1,7 @@
 # Go Tour
 
-[![Go Reference](https://pkg.go.dev/badge/golang.org/x/tour.svg)](https://pkg.go.dev/golang.org/x/tour)
+The actual web pages for
+“A Tour of Go” moved to [golang.org/x/website](https://golang.org/x/website).
 
-A Tour of Go is an introduction to the Go programming language. Visit
-https://tour.golang.org to start the tour.
-
-## Download/Install
-
-To install the tour from source, first
-[install Go](https://golang.org/doc/install) and then run:
-
-	$ go get golang.org/x/tour
-
-This will place a `tour` binary in your
-[workspace](https://golang.org/doc/code.html#Workspaces)'s `bin` directory.
-The tour program can be run offline.
-
-## Contributing
-
-Contributions should follow the same procedure as for the Go project:
-https://golang.org/doc/contribute.html
-
-To run the tour server locally:
-
-```sh
-go run .
-```
-
-Your browser should now open. If not, please visit [http://localhost:3999/](http://localhost:3999).
-
-
-## Report Issues / Send Patches
-
-This repository uses Gerrit for code changes. To learn how to submit changes to
-this repository, see https://golang.org/doc/contribute.html.
-
-The issue tracker for the tour's code is located at https://github.com/golang/go/issues.
-Prefix your issue with "x/tour:" in the subject line, so it is easy to find.
-
-Issues with the tour's content itself should be reported in the issue tracker
-at https://github.com/golang/tour/issues.
-
-## Deploying
-
-1.	To deploy tour.golang.org, run:
-
-	```
-	GO111MODULE=on gcloud --project=golang-org app deploy --no-promote app.yaml
-	```
-
-	This will create a new version, which can be viewed within the
-	[golang-org GCP project](https://console.cloud.google.com/appengine/versions?project=golang-org&serviceId=tour).
-
-2.	Check that the deployed version looks OK (click the version link in GCP).
-
-3.	If all is well, click "Migrate Traffic" to move 100% of the tour.golang.org
-	traffic to the new version.
-
-4.	You're done.
-
-## License
-
-Unless otherwise noted, the go-tour source files are distributed
-under the BSD-style license found in the LICENSE file.
+This repo still holds the supporting packages like
+[golang.org/x/tour/pic](https://golang.org/x/tour/pic).
diff --git a/TODO b/TODO
deleted file mode 100644
index 8eb78bd..0000000
--- a/TODO
+++ /dev/null
@@ -1,104 +0,0 @@
-This file lists topics that already exist (prefixed by *) and topics that
-should be added (prefixed by -). It should be kept up-to-date with tour.article.
-
-* Hello, 世界
-* Go local
-* Packages
-* Imports
-- "Imported but not used" errors (later perhaps)
-* Exported names
-* Functions
-* Functions continued
-* Multiple results
-* Named results
-- Variables (single declaration first)
-* Variables
-* Variables with initializers
-* Short variable declarations
-* Basic types
-* Type inference
-* Type conversions
-* Zero values
-* Constants
-* Numeric Constants
-* For
-* For continued
-* For is Go's "while"
-* Forever
-* If
-* If with a short statement
-* If and else
-* Exercise: Loops and Functions
-* Structs
-* Struct Fields
-* Pointers
-* Struct Literals
-* The new function
-* Arrays
-* Slices
-* Slicing slices
-* Making slices
-* Append
-- Copy
-* Nil slices
-* Range
-* Range continued
-- The blank identifier
-- Slices of slices.
-* Exercise: Slices
-* Maps
-* Map literals
-* Map literals continued
-* Mutating Maps
-- Maps and range
-* Exercise: Maps
-* Function values
-* Function closures
-* Exercise: Fibonacci closure
-* Switch
-* Switch evaluation order
-* Switch with no condition
-- Complex numbers
-* Advanced Exercise: Complex cube roots
-- the type keyword
-* Methods and Interfaces
-* Methods
-* Methods continued
-* Methods with pointer receivers
-* Interfaces
-* Interfaces are satisfied implicitly
-- Interface assignment
-- Empty interface
-* Errors
-* Exercise: Errors
-* Web servers
-* Exercise: HTTP Handlers
-* Images
-* Exercise: Images
-* Exercise: Rot13 Reader
-- Sort (see sort package examples)
-- Exercise: Sort
-- Embedding
-- Exercise: Embedding (sort by different fields)
-- Type assertion
-- Type switch
-- Exercise: Visitor (walk a tree?)
-* Concurrency
-* Goroutines
-* Channels
-* Buffered Channels
-* Range and Close
-* Select
-* Default Selection
-* Exercise: Equivalent Binary Trees
-* Exercise: Equivalent Binary Trees
-* Exercise: Web Crawler
-- More language features
-* Defer
-- Panic and recover
-- init functions
-- Tools
-- Godoc
-- Gofmt
-* Where to Go from here...
-
diff --git a/TRANSLATE b/TRANSLATE
deleted file mode 100644
index fa39dba..0000000
--- a/TRANSLATE
+++ /dev/null
@@ -1,33 +0,0 @@
-Translating the Tour
-
-A Tour of Go is a Go program that runs as a stand-alone web server or
-an App Engine app. The version available at tour.golang.org is run from
-App Engine. There are several localized versions of the tour, such as
-this Chinese translation, also running on App Engine:
-
-	https://go-tour-zh.appspot.com
-
-The Tour contains a slide named "Go local", which lists several of
-these translations. If you are a native speaker of a language not on
-that list and have some experience with Go, please consider providing
-a translation of the Tour in your own language.
-
-To translate the tour:
-
-1. Translate the files in content/
-2. Provide localized version for the UI strings in static/js/values.js
-3. Sign up to App Engine and create an app named go-tour-LL,
-   where LL is the two-letter country code that applies best
-   to your chosen language. (This shouldn't cost you anything;
-   the Tour App usually runs inside App Engine's free quota.)
-4. Deploy your version of the Tour to that app.
-5. Announce to golang-nuts@googlegroups.com
-
-The Tour content changes occasionally, and you should keep your
-translation up to date. To follow the development of the tour,
-you can subscribe to the feed at
-
-	https://github.com/golang/tour/commits/master.atom
-
-Finally, if you have any questions about the Tour or Go,
-please mail golang-nuts@googlegroups.com.
diff --git a/app.yaml b/app.yaml
deleted file mode 100644
index 3af97ec..0000000
--- a/app.yaml
+++ /dev/null
@@ -1,36 +0,0 @@
-service: tour
-runtime: go114
-
-env_variables:
-  TOUR_ANALYTICS: |
-    <script async src="https://www.googletagmanager.com/gtag/js?id=UA-11222381-5"></script>
-    <script>
-    window.dataLayer = window.dataLayer || [];
-    function gtag(){dataLayer.push(arguments);}
-    gtag("js", new Date());
-    gtag("config", "UA-11222381-5");
-    gtag("config", "UA-49880327-6");
-    </script>
-
-default_expiration: "7d"
-
-handlers:
-
-# Keep these static file handlers in sync with local.go.
-# They're here for improved latency across global regions.
-- url: /favicon.ico
-  static_files: static/img/favicon.ico
-  upload: static/img/favicon.ico
-  secure: always
-- url: /content/img
-  static_dir: content/img
-  secure: always
-- url: /static
-  static_dir: static
-  secure: always
-
-# This is here to redirect all HTTP traffic to an HTTPS URL
-# with the same path.
-- url: /.*
-  script: auto
-  secure: always
diff --git a/appengine.go b/appengine.go
deleted file mode 100644
index c6201a3..0000000
--- a/appengine.go
+++ /dev/null
@@ -1,90 +0,0 @@
-// Copyright 2011 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"bufio"
-	"bytes"
-	"html/template"
-	"io"
-	"log"
-	"net/http"
-	"os"
-
-	_ "golang.org/x/tools/playground"
-)
-
-func gaeMain() {
-	prepContent = gaePrepContent
-	socketAddr = gaeSocketAddr
-	analyticsHTML = template.HTML(os.Getenv("TOUR_ANALYTICS"))
-
-	if err := initTour(".", "HTTPTransport"); err != nil {
-		log.Fatal(err)
-	}
-
-	http.Handle("/", hstsHandler(rootHandler))
-	http.Handle("/lesson/", hstsHandler(lessonHandler))
-
-	registerStatic(".")
-
-	port := os.Getenv("PORT")
-	if port == "" {
-		port = "8080"
-	}
-	log.Fatal(http.ListenAndServe(":"+port, nil))
-}
-
-// gaePrepContent returns a Reader that produces the content from the given
-// Reader, but strips the prefix "#appengine:", optionally followed by a space, from each line.
-// It also drops any non-blank line that follows a series of 1 or more lines with the prefix.
-func gaePrepContent(in io.Reader) io.Reader {
-	var prefix = []byte("#appengine:")
-	out, w := io.Pipe()
-	go func() {
-		r := bufio.NewReader(in)
-		drop := false
-		for {
-			b, err := r.ReadBytes('\n')
-			if err != nil && err != io.EOF {
-				w.CloseWithError(err)
-				return
-			}
-			if bytes.HasPrefix(b, prefix) {
-				b = b[len(prefix):]
-				if b[0] == ' ' {
-					// Consume a single space after the prefix.
-					b = b[1:]
-				}
-				drop = true
-			} else if drop {
-				if len(b) > 1 {
-					b = nil
-				}
-				drop = false
-			}
-			if len(b) > 0 {
-				w.Write(b)
-			}
-			if err == io.EOF {
-				w.Close()
-				return
-			}
-		}
-	}()
-	return out
-}
-
-// gaeSocketAddr returns the WebSocket handler address.
-// The App Engine version does not provide a WebSocket handler.
-func gaeSocketAddr() string { return "" }
-
-// hstsHandler wraps an http.HandlerFunc such that it sets the HSTS header.
-func hstsHandler(fn http.HandlerFunc) http.Handler {
-	return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
-		w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
-		fn(w, r)
-	})
-}
diff --git a/content/basics.article b/content/basics.article
deleted file mode 100644
index 082a6ab..0000000
--- a/content/basics.article
+++ /dev/null
@@ -1,235 +0,0 @@
-Packages, variables, and functions.
-Learn the basic components of any Go program.
-
-The Go Authors
-https://golang.org
-
-* Packages
-
-Every Go program is made up of packages.
-
-Programs start running in package `main`.
-
-This program is using the packages with import paths `"fmt"` and `"math/rand"`.
-
-By convention, the package name is the same as the last element of the import path. For instance, the `"math/rand"` package comprises files that begin with the statement `package`rand`.
-
-#appengine: *Note:* The environment in which these programs are executed is
-#appengine: deterministic, so each time you run the example program
-#appengine: `rand.Intn` will return the same number.
-#appengine:
-#appengine: (To see a different number, seed the number generator; see [[https://golang.org/pkg/math/rand/#Seed][`rand.Seed`]].
-#appengine: Time is constant in the playground, so you will need to use something else as the seed.)
-
-.play basics/packages.go
-
-* Imports
-
-This code groups the imports into a parenthesized, "factored" import statement.
-
-You can also write multiple import statements, like:
-
-	import "fmt"
-	import "math"
-
-But it is good style to use the factored import statement.
-
-.play basics/imports.go
-
-* Exported names
-
-In Go, a name is exported if it begins with a capital letter.
-For example, `Pizza` is an exported name, as is `Pi`, which is exported from
-the `math` package.
-
-`pizza` and `pi` do not start with a capital letter, so they are not exported.
-
-When importing a package, you can refer only to its exported names.
-Any "unexported" names are not accessible from outside the package.
-
-Run the code. Notice the error message.
-
-To fix the error, rename `math.pi` to `math.Pi` and try it again.
-
-.play basics/exported-names.go
-
-* Functions
-
-A function can take zero or more arguments.
-
-In this example, `add` takes two parameters of type `int`.
-
-Notice that the type comes _after_ the variable name.
-
-(For more about why types look the way they do, see the [[https://blog.golang.org/gos-declaration-syntax][article on Go's declaration syntax]].)
-
-.play basics/functions.go
-
-* Functions continued
-
-When two or more consecutive named function parameters share a type, you can omit the type from all but the last.
-
-In this example, we shortened
-
-	x int, y int
-
-to
-
-	x, y int
-
-.play basics/functions-continued.go
-
-* Multiple results
-
-A function can return any number of results.
-
-The `swap` function returns two strings.
-
-.play basics/multiple-results.go
-
-* Named return values
-
-Go's return values may be named. If so, they are treated as variables defined at the top of the function.
-
-These names should be used to document the meaning of the return values.
-
-A `return` statement without arguments returns the named return values. This is known as a "naked" return.
-
-Naked return statements should be used only in short functions, as with the example shown here. They can harm readability in longer functions.
-
-.play basics/named-results.go
-
-* Variables
-
-The `var` statement declares a list of variables; as in function argument lists, the type is last.
-
-A `var` statement can be at package or function level. We see both in this example.
-
-.play basics/variables.go
-
-* Variables with initializers
-
-A var declaration can include initializers, one per variable.
-
-If an initializer is present, the type can be omitted; the variable will take the type of the initializer.
-
-.play basics/variables-with-initializers.go
-
-* Short variable declarations
-
-Inside a function, the `:=` short assignment statement can be used in place of a `var` declaration with implicit type.
-
-Outside a function, every statement begins with a keyword (`var`, `func`, and so on) and so the `:=` construct is not available.
-
-.play basics/short-variable-declarations.go
-
-* Basic types
-
-Go's basic types are
-
-	bool
-
-	string
-
-	int  int8  int16  int32  int64
-	uint uint8 uint16 uint32 uint64 uintptr
-
-	byte // alias for uint8
-
-	rune // alias for int32
-	     // represents a Unicode code point
-
-	float32 float64
-
-	complex64 complex128
-
-The example shows variables of several types,
-and also that variable declarations may be "factored" into blocks,
-as with import statements.
-
-The `int`, `uint`, and `uintptr` types are usually 32 bits wide on 32-bit systems and 64 bits wide on 64-bit systems.
-When you need an integer value you should use `int` unless you have a specific reason to use a sized or unsigned integer type.
-
-.play basics/basic-types.go
-
-* Zero values
-
-Variables declared without an explicit initial value are given their
-_zero_value_.
-
-The zero value is:
-
-- `0` for numeric types,
-- `false` for the boolean type, and
-- `""` (the empty string) for strings.
-
-.play basics/zero.go
-
-* Type conversions
-
-The expression `T(v)` converts the value `v` to the type `T`.
-
-Some numeric conversions:
-
-	var i int = 42
-	var f float64 = float64(i)
-	var u uint = uint(f)
-
-Or, put more simply:
-
-	i := 42
-	f := float64(i)
-	u := uint(f)
-
-Unlike in C, in Go assignment between items of different type requires an
-explicit conversion.
-Try removing the `float64` or `uint` conversions in the example and see what happens.
-
-.play basics/type-conversions.go
-
-* Type inference
-
-When declaring a variable without specifying an explicit type (either by using the `:=` syntax or `var`=` expression syntax), the variable's type is inferred from the value on the right hand side.
-
-When the right hand side of the declaration is typed, the new variable is of that same type:
-
-	var i int
-	j := i // j is an int
-
-But when the right hand side contains an untyped numeric constant, the new variable may be an `int`, `float64`, or `complex128` depending on the precision of the constant:
-
-	i := 42           // int
-	f := 3.142        // float64
-	g := 0.867 + 0.5i // complex128
-
-Try changing the initial value of `v` in the example code and observe how its type is affected.
-
-.play basics/type-inference.go
-
-* Constants
-
-Constants are declared like variables, but with the `const` keyword.
-
-Constants can be character, string, boolean, or numeric values.
-
-Constants cannot be declared using the `:=` syntax.
-
-.play basics/constants.go
-
-* Numeric Constants
-
-Numeric constants are high-precision _values_.
-
-An untyped constant takes the type needed by its context.
-
-Try printing `needInt(Big)` too.
-
-(An `int` can store at maximum a 64-bit integer, and sometimes less.)
-
-.play basics/numeric-constants.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/basics/basic-types.go b/content/basics/basic-types.go
deleted file mode 100644
index 99becee..0000000
--- a/content/basics/basic-types.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math/cmplx"
-)
-
-var (
-	ToBe   bool       = false
-	MaxInt uint64     = 1<<64 - 1
-	z      complex128 = cmplx.Sqrt(-5 + 12i)
-)
-
-func main() {
-	fmt.Printf("Type: %T Value: %v\n", ToBe, ToBe)
-	fmt.Printf("Type: %T Value: %v\n", MaxInt, MaxInt)
-	fmt.Printf("Type: %T Value: %v\n", z, z)
-}
diff --git a/content/basics/constants.go b/content/basics/constants.go
deleted file mode 100644
index 21eb716..0000000
--- a/content/basics/constants.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-const Pi = 3.14
-
-func main() {
-	const World = "世界"
-	fmt.Println("Hello", World)
-	fmt.Println("Happy", Pi, "Day")
-
-	const Truth = true
-	fmt.Println("Go rules?", Truth)
-}
diff --git a/content/basics/exported-names.go b/content/basics/exported-names.go
deleted file mode 100644
index 1eec5cb..0000000
--- a/content/basics/exported-names.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func main() {
-	fmt.Println(math.pi)
-}
diff --git a/content/basics/functions-continued.go b/content/basics/functions-continued.go
deleted file mode 100644
index 432d47f..0000000
--- a/content/basics/functions-continued.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func add(x, y int) int {
-	return x + y
-}
-
-func main() {
-	fmt.Println(add(42, 13))
-}
diff --git a/content/basics/functions.go b/content/basics/functions.go
deleted file mode 100644
index 5b71184..0000000
--- a/content/basics/functions.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func add(x int, y int) int {
-	return x + y
-}
-
-func main() {
-	fmt.Println(add(42, 13))
-}
diff --git a/content/basics/imports.go b/content/basics/imports.go
deleted file mode 100644
index 8424aca..0000000
--- a/content/basics/imports.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func main() {
-	fmt.Printf("Now you have %g problems.\n", math.Sqrt(7))
-}
diff --git a/content/basics/multiple-results.go b/content/basics/multiple-results.go
deleted file mode 100644
index 1b86fd7..0000000
--- a/content/basics/multiple-results.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func swap(x, y string) (string, string) {
-	return y, x
-}
-
-func main() {
-	a, b := swap("hello", "world")
-	fmt.Println(a, b)
-}
diff --git a/content/basics/named-results.go b/content/basics/named-results.go
deleted file mode 100644
index 0047872..0000000
--- a/content/basics/named-results.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func split(sum int) (x, y int) {
-	x = sum * 4 / 9
-	y = sum - x
-	return
-}
-
-func main() {
-	fmt.Println(split(17))
-}
diff --git a/content/basics/numeric-constants.go b/content/basics/numeric-constants.go
deleted file mode 100644
index 59784b5..0000000
--- a/content/basics/numeric-constants.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-const (
-	// Create a huge number by shifting a 1 bit left 100 places.
-	// In other words, the binary number that is 1 followed by 100 zeroes.
-	Big = 1 << 100
-	// Shift it right again 99 places, so we end up with 1<<1, or 2.
-	Small = Big >> 99
-)
-
-func needInt(x int) int { return x*10 + 1 }
-func needFloat(x float64) float64 {
-	return x * 0.1
-}
-
-func main() {
-	fmt.Println(needInt(Small))
-	fmt.Println(needFloat(Small))
-	fmt.Println(needFloat(Big))
-}
diff --git a/content/basics/packages.go b/content/basics/packages.go
deleted file mode 100644
index 8b5ddac..0000000
--- a/content/basics/packages.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math/rand"
-)
-
-func main() {
-	fmt.Println("My favorite number is", rand.Intn(10))
-}
diff --git a/content/basics/short-variable-declarations.go b/content/basics/short-variable-declarations.go
deleted file mode 100644
index c6edd9f..0000000
--- a/content/basics/short-variable-declarations.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i, j int = 1, 2
-	k := 3
-	c, python, java := true, false, "no!"
-
-	fmt.Println(i, j, k, c, python, java)
-}
diff --git a/content/basics/type-conversions.go b/content/basics/type-conversions.go
deleted file mode 100644
index 0ce3537..0000000
--- a/content/basics/type-conversions.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func main() {
-	var x, y int = 3, 4
-	var f float64 = math.Sqrt(float64(x*x + y*y))
-	var z uint = uint(f)
-	fmt.Println(x, y, z)
-}
diff --git a/content/basics/type-inference.go b/content/basics/type-inference.go
deleted file mode 100644
index b311933..0000000
--- a/content/basics/type-inference.go
+++ /dev/null
@@ -1,10 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	v := 42 // change me!
-	fmt.Printf("v is of type %T\n", v)
-}
diff --git a/content/basics/variables-with-initializers.go b/content/basics/variables-with-initializers.go
deleted file mode 100644
index d27f855..0000000
--- a/content/basics/variables-with-initializers.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-var i, j int = 1, 2
-
-func main() {
-	var c, python, java = true, false, "no!"
-	fmt.Println(i, j, c, python, java)
-}
diff --git a/content/basics/variables.go b/content/basics/variables.go
deleted file mode 100644
index cd4c26a..0000000
--- a/content/basics/variables.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-var c, python, java bool
-
-func main() {
-	var i int
-	fmt.Println(i, c, python, java)
-}
diff --git a/content/basics/zero.go b/content/basics/zero.go
deleted file mode 100644
index eb95a07..0000000
--- a/content/basics/zero.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i int
-	var f float64
-	var b bool
-	var s string
-	fmt.Printf("%v %v %v %q\n", i, f, b, s)
-}
diff --git a/content/concurrency.article b/content/concurrency.article
deleted file mode 100644
index 9cb5f69..0000000
--- a/content/concurrency.article
+++ /dev/null
@@ -1,208 +0,0 @@
-Concurrency
-Go provides concurrency constructions as part of the core language. This lesson presents them and gives some examples on how they can be used.
-
-The Go Authors
-https://golang.org
-
-* Goroutines
-
-A _goroutine_ is a lightweight thread managed by the Go runtime.
-
-	go f(x, y, z)
-
-starts a new goroutine running
-
-	f(x, y, z)
-
-The evaluation of `f`, `x`, `y`, and `z` happens in the current goroutine and the execution of `f` happens in the new goroutine.
-
-Goroutines run in the same address space, so access to shared memory must be synchronized. The [[https://golang.org/pkg/sync/][`sync`]] package provides useful primitives, although you won't need them much in Go as there are other primitives. (See the next slide.)
-
-.play concurrency/goroutines.go
-
-* Channels
-
-Channels are a typed conduit through which you can send and receive values with the channel operator, `<-`.
-
-	ch <- v    // Send v to channel ch.
-	v := <-ch  // Receive from ch, and
-	           // assign value to v.
-
-(The data flows in the direction of the arrow.)
-
-Like maps and slices, channels must be created before use:
-
-	ch := make(chan int)
-
-By default, sends and receives block until the other side is ready. This allows goroutines to synchronize without explicit locks or condition variables.
-
-The example code sums the numbers in a slice, distributing the work between two goroutines.
-Once both goroutines have completed their computation, it calculates the final result.
-
-.play concurrency/channels.go
-
-* Buffered Channels
-
-Channels can be _buffered_.  Provide the buffer length as the second argument to `make` to initialize a buffered channel:
-
-	ch := make(chan int, 100)
-
-Sends to a buffered channel block only when the buffer is full. Receives block when the buffer is empty.
-
-Modify the example to overfill the buffer and see what happens.
-
-.play concurrency/buffered-channels.go
-
-* Range and Close
-
-A sender can `close` a channel to indicate that no more values will be sent. Receivers can test whether a channel has been closed by assigning a second parameter to the receive expression: after
-
-	v, ok := <-ch
-
-`ok` is `false` if there are no more values to receive and the channel is closed.
-
-The loop `for`i`:=`range`c` receives values from the channel repeatedly until it is closed.
-
-*Note:* Only the sender should close a channel, never the receiver. Sending on a closed channel will cause a panic.
-
-*Another*note:* Channels aren't like files; you don't usually need to close them. Closing is only necessary when the receiver must be told there are no more values coming, such as to terminate a `range` loop.
-
-.play concurrency/range-and-close.go
-
-* Select
-
-The `select` statement lets a goroutine wait on multiple communication operations.
-
-A `select` blocks until one of its cases can run, then it executes that case.  It chooses one at random if multiple are ready.
-
-.play concurrency/select.go
-
-* Default Selection
-
-The `default` case in a `select` is run if no other case is ready.
-
-Use a `default` case to try a send or receive without blocking:
-
-	select {
-	case i := <-c:
-		// use i
-	default:
-		// receiving from c would block
-	}
-
-.play concurrency/default-selection.go
-
-* Exercise: Equivalent Binary Trees
-
-There can be many different binary trees with the same sequence of values stored in it. For example, here are two binary trees storing the sequence 1, 1, 2, 3, 5, 8, 13.
-
-.image /content/img/tree.png
-
-A function to check whether two binary trees store the same sequence is quite complex in most languages. We'll use Go's concurrency and channels to write a simple solution.
-
-This example uses the `tree` package, which defines the type:
-
-	type Tree struct {
-		Left  *Tree
-		Value int
-		Right *Tree
-	}
-
-
-Continue description on [[javascript:click('.next-page')][next page]].
-
-* Exercise: Equivalent Binary Trees
-
-*1.* Implement the `Walk` function.
-
-*2.* Test the `Walk` function.
-
-The function `tree.New(k)` constructs a randomly-structured (but always sorted) binary tree holding the values `k`, `2k`, `3k`, ..., `10k`.
-
-Create a new channel `ch` and kick off the walker:
-
-	go Walk(tree.New(1), ch)
-
-Then read and print 10 values from the channel. It should be the numbers 1, 2, 3, ..., 10.
-
-*3.* Implement the `Same` function using `Walk` to determine whether `t1` and `t2` store the same values.
-
-*4.* Test the `Same` function.
-
-`Same(tree.New(1),`tree.New(1))` should return true, and `Same(tree.New(1),`tree.New(2))` should return false.
-
-The documentation for `Tree` can be found [[https://godoc.org/golang.org/x/tour/tree#Tree][here]].
-
-.play concurrency/exercise-equivalent-binary-trees.go
-
-* sync.Mutex
-
-We've seen how channels are great for communication among goroutines.
-
-But what if we don't need communication? What if we just want to make sure only
-one goroutine can access a variable at a time to avoid conflicts?
-
-This concept is called _mutual_exclusion_, and the conventional name for the data structure that provides it is _mutex_.
-
-Go's standard library provides mutual exclusion with
-[[https://golang.org/pkg/sync/#Mutex][`sync.Mutex`]] and its two methods:
-
-- `Lock`
-- `Unlock`
-
-We can define a block of code to be executed in mutual exclusion by surrounding it
-with a call to `Lock` and `Unlock` as shown on the `Inc` method.
-
-We can also use `defer` to ensure the mutex will be unlocked as in the `Value` method.
-
-.play concurrency/mutex-counter.go
-
-* Exercise: Web Crawler
-
-In this exercise you'll use Go's concurrency features to parallelize a web crawler.
-
-Modify the `Crawl` function to fetch URLs in parallel without fetching the same URL twice.
-
-_Hint_: you can keep a cache of the URLs that have been fetched on a map, but maps alone are not
-safe for concurrent use!
-
-.play concurrency/exercise-web-crawler.go
-
-* Where to Go from here...
-
-#appengine: You can get started by
-#appengine: [[https://golang.org/dl/][installing Go]].
-
-#appengine: Once you have Go installed, the
-The
-[[https://golang.org/doc/][Go Documentation]] is a great place to
-#appengine: continue.
-start.
-It contains references, tutorials, videos, and more.
-
-To learn how to organize and work with Go code, read [[https://golang.org/doc/code][How to Write Go Code]].
-
-If you need help with the standard library, see the [[https://golang.org/pkg/][package reference]]. For help with the language itself, you might be surprised to find the [[https://golang.org/ref/spec][Language Spec]] is quite readable.
-
-To further explore Go's concurrency model, watch
-[[https://www.youtube.com/watch?v=f6kdp27TYZs][Go Concurrency Patterns]]
-([[https://talks.golang.org/2012/concurrency.slide][slides]])
-and
-[[https://www.youtube.com/watch?v=QDDwwePbDtw][Advanced Go Concurrency Patterns]]
-([[https://talks.golang.org/2013/advconc.slide][slides]])
-and read the
-[[https://golang.org/doc/codewalk/sharemem/][Share Memory by Communicating]]
-codewalk.
-
-To get started writing web applications, watch
-[[https://vimeo.com/53221558][A simple programming environment]]
-([[https://talks.golang.org/2012/simple.slide][slides]])
-and read the
-[[https://golang.org/doc/articles/wiki/][Writing Web Applications]] tutorial.
-
-The [[https://golang.org/doc/codewalk/functions/][First Class Functions in Go]] codewalk gives an interesting perspective on Go's function types.
-
-The [[https://blog.golang.org/][Go Blog]] has a large archive of informative Go articles.
-
-Visit [[https://golang.org][golang.org]] for more.
-
diff --git a/content/concurrency/buffered-channels.go b/content/concurrency/buffered-channels.go
deleted file mode 100644
index b5abf10..0000000
--- a/content/concurrency/buffered-channels.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	ch := make(chan int, 2)
-	ch <- 1
-	ch <- 2
-	fmt.Println(<-ch)
-	fmt.Println(<-ch)
-}
diff --git a/content/concurrency/channels.go b/content/concurrency/channels.go
deleted file mode 100644
index 60fc324..0000000
--- a/content/concurrency/channels.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func sum(s []int, c chan int) {
-	sum := 0
-	for _, v := range s {
-		sum += v
-	}
-	c <- sum // send sum to c
-}
-
-func main() {
-	s := []int{7, 2, 8, -9, 4, 0}
-
-	c := make(chan int)
-	go sum(s[:len(s)/2], c)
-	go sum(s[len(s)/2:], c)
-	x, y := <-c, <-c // receive from c
-
-	fmt.Println(x, y, x+y)
-}
diff --git a/content/concurrency/default-selection.go b/content/concurrency/default-selection.go
deleted file mode 100644
index 8e0d2a5..0000000
--- a/content/concurrency/default-selection.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	tick := time.Tick(100 * time.Millisecond)
-	boom := time.After(500 * time.Millisecond)
-	for {
-		select {
-		case <-tick:
-			fmt.Println("tick.")
-		case <-boom:
-			fmt.Println("BOOM!")
-			return
-		default:
-			fmt.Println("    .")
-			time.Sleep(50 * time.Millisecond)
-		}
-	}
-}
diff --git a/content/concurrency/exercise-equivalent-binary-trees.go b/content/concurrency/exercise-equivalent-binary-trees.go
deleted file mode 100644
index 56d98a7..0000000
--- a/content/concurrency/exercise-equivalent-binary-trees.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/tree"
-
-// Walk walks the tree t sending all values
-// from the tree to the channel ch.
-func Walk(t *tree.Tree, ch chan int)
-
-// Same determines whether the trees
-// t1 and t2 contain the same values.
-func Same(t1, t2 *tree.Tree) bool
-
-func main() {
-}
diff --git a/content/concurrency/exercise-web-crawler.go b/content/concurrency/exercise-web-crawler.go
deleted file mode 100644
index c426e05..0000000
--- a/content/concurrency/exercise-web-crawler.go
+++ /dev/null
@@ -1,87 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-type Fetcher interface {
-	// Fetch returns the body of URL and
-	// a slice of URLs found on that page.
-	Fetch(url string) (body string, urls []string, err error)
-}
-
-// Crawl uses fetcher to recursively crawl
-// pages starting with url, to a maximum of depth.
-func Crawl(url string, depth int, fetcher Fetcher) {
-	// TODO: Fetch URLs in parallel.
-	// TODO: Don't fetch the same URL twice.
-	// This implementation doesn't do either:
-	if depth <= 0 {
-		return
-	}
-	body, urls, err := fetcher.Fetch(url)
-	if err != nil {
-		fmt.Println(err)
-		return
-	}
-	fmt.Printf("found: %s %q\n", url, body)
-	for _, u := range urls {
-		Crawl(u, depth-1, fetcher)
-	}
-	return
-}
-
-func main() {
-	Crawl("https://golang.org/", 4, fetcher)
-}
-
-// fakeFetcher is Fetcher that returns canned results.
-type fakeFetcher map[string]*fakeResult
-
-type fakeResult struct {
-	body string
-	urls []string
-}
-
-func (f fakeFetcher) Fetch(url string) (string, []string, error) {
-	if res, ok := f[url]; ok {
-		return res.body, res.urls, nil
-	}
-	return "", nil, fmt.Errorf("not found: %s", url)
-}
-
-// fetcher is a populated fakeFetcher.
-var fetcher = fakeFetcher{
-	"https://golang.org/": &fakeResult{
-		"The Go Programming Language",
-		[]string{
-			"https://golang.org/pkg/",
-			"https://golang.org/cmd/",
-		},
-	},
-	"https://golang.org/pkg/": &fakeResult{
-		"Packages",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/cmd/",
-			"https://golang.org/pkg/fmt/",
-			"https://golang.org/pkg/os/",
-		},
-	},
-	"https://golang.org/pkg/fmt/": &fakeResult{
-		"Package fmt",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-	"https://golang.org/pkg/os/": &fakeResult{
-		"Package os",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-}
diff --git a/content/concurrency/goroutines.go b/content/concurrency/goroutines.go
deleted file mode 100644
index 9efc833..0000000
--- a/content/concurrency/goroutines.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func say(s string) {
-	for i := 0; i < 5; i++ {
-		time.Sleep(100 * time.Millisecond)
-		fmt.Println(s)
-	}
-}
-
-func main() {
-	go say("world")
-	say("hello")
-}
diff --git a/content/concurrency/mutex-counter.go b/content/concurrency/mutex-counter.go
deleted file mode 100644
index b1483d6..0000000
--- a/content/concurrency/mutex-counter.go
+++ /dev/null
@@ -1,41 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"sync"
-	"time"
-)
-
-// SafeCounter is safe to use concurrently.
-type SafeCounter struct {
-	mu sync.Mutex
-	v  map[string]int
-}
-
-// Inc increments the counter for the given key.
-func (c *SafeCounter) Inc(key string) {
-	c.mu.Lock()
-	// Lock so only one goroutine at a time can access the map c.v.
-	c.v[key]++
-	c.mu.Unlock()
-}
-
-// Value returns the current value of the counter for the given key.
-func (c *SafeCounter) Value(key string) int {
-	c.mu.Lock()
-	// Lock so only one goroutine at a time can access the map c.v.
-	defer c.mu.Unlock()
-	return c.v[key]
-}
-
-func main() {
-	c := SafeCounter{v: make(map[string]int)}
-	for i := 0; i < 1000; i++ {
-		go c.Inc("somekey")
-	}
-
-	time.Sleep(time.Second)
-	fmt.Println(c.Value("somekey"))
-}
diff --git a/content/concurrency/range-and-close.go b/content/concurrency/range-and-close.go
deleted file mode 100644
index 6e5a3b8..0000000
--- a/content/concurrency/range-and-close.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-func fibonacci(n int, c chan int) {
-	x, y := 0, 1
-	for i := 0; i < n; i++ {
-		c <- x
-		x, y = y, x+y
-	}
-	close(c)
-}
-
-func main() {
-	c := make(chan int, 10)
-	go fibonacci(cap(c), c)
-	for i := range c {
-		fmt.Println(i)
-	}
-}
diff --git a/content/concurrency/select.go b/content/concurrency/select.go
deleted file mode 100644
index d657f01..0000000
--- a/content/concurrency/select.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func fibonacci(c, quit chan int) {
-	x, y := 0, 1
-	for {
-		select {
-		case c <- x:
-			x, y = y, x+y
-		case <-quit:
-			fmt.Println("quit")
-			return
-		}
-	}
-}
-
-func main() {
-	c := make(chan int)
-	quit := make(chan int)
-	go func() {
-		for i := 0; i < 10; i++ {
-			fmt.Println(<-c)
-		}
-		quit <- 0
-	}()
-	fibonacci(c, quit)
-}
diff --git a/content/content_test.go b/content/content_test.go
deleted file mode 100644
index 4c0ff2a..0000000
--- a/content/content_test.go
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright 2016 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package content
-
-import (
-	"bytes"
-	"errors"
-	"fmt"
-	"io/ioutil"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"strings"
-	"testing"
-)
-
-// Test that all the .go files inside the content file build
-// and execute (without checking for output correctness).
-// Files that contain the string "// +build no-build" are not built.
-// Files that contain the string "// +build no-run" are not executed.
-func TestContent(t *testing.T) {
-	if _, err := exec.LookPath("go"); err != nil {
-		t.Skipf("skipping because 'go' executable not available: %v", err)
-	}
-
-	scratch, err := ioutil.TempDir("", "tour-content-test")
-	if err != nil {
-		t.Fatal(err)
-	}
-	defer os.RemoveAll(scratch)
-
-	err = filepath.Walk(".", func(path string, fi os.FileInfo, err error) error {
-		if filepath.Ext(path) != ".go" {
-			return nil
-		}
-		if filepath.Base(path) == "content_test.go" {
-			return nil
-		}
-		if err := testSnippet(t, path, scratch); err != nil {
-			t.Errorf("%v: %v", path, err)
-		}
-		return nil
-	})
-	if err != nil {
-		t.Error(err)
-	}
-}
-
-func testSnippet(t *testing.T, path, scratch string) error {
-	b, err := ioutil.ReadFile(path)
-	if err != nil {
-		return err
-	}
-
-	build := string(bytes.SplitN(b, []byte{'\n'}, 2)[0])
-	if !strings.HasPrefix(build, "// +build ") {
-		return errors.New("first line is not a +build comment")
-	}
-	if !strings.Contains(build, "OMIT") {
-		return errors.New(`+build comment does not contain "OMIT"`)
-	}
-
-	if strings.Contains(build, "no-build") {
-		return nil
-	}
-	bin := filepath.Join(scratch, filepath.Base(path)+".exe")
-	out, err := exec.Command("go", "build", "-o", bin, path).CombinedOutput()
-	if err != nil {
-		return fmt.Errorf("build error: %v\noutput:\n%s", err, out)
-	}
-	defer os.Remove(bin)
-
-	if strings.Contains(build, "no-run") {
-		return nil
-	}
-	out, err = exec.Command(bin).CombinedOutput()
-	if err != nil {
-		return fmt.Errorf("%v\nOutput:\n%s", err, out)
-	}
-	return nil
-}
diff --git a/content/flowcontrol.article b/content/flowcontrol.article
deleted file mode 100644
index 0f25ab4..0000000
--- a/content/flowcontrol.article
+++ /dev/null
@@ -1,178 +0,0 @@
-Flow control statements: for, if, else, switch and defer
-Learn how to control the flow of your code with conditionals, loops, switches and defers.
-
-The Go Authors
-https://golang.org
-
-* For
-
-Go has only one looping construct, the `for` loop.
-
-The basic `for` loop has three components separated by semicolons:
-
-- the init statement: executed before the first iteration
-- the condition expression: evaluated before every iteration
-- the post statement: executed at the end of every iteration
-
-The init statement will often be a short variable declaration, and the
-variables declared there are visible only in the scope of the `for`
-statement.
-
-The loop will stop iterating once the boolean condition evaluates to `false`.
-
-*Note:* Unlike other languages like C, Java, or JavaScript there are no parentheses
-surrounding the three components of the `for` statement and the braces `{`}` are
-always required.
-
-.play flowcontrol/for.go
-
-* For continued
-
-The init and post statements are optional.
-
-.play flowcontrol/for-continued.go
-
-* For is Go's "while"
-
-At that point you can drop the semicolons: C's `while` is spelled `for` in Go.
-
-.play flowcontrol/for-is-gos-while.go
-
-* Forever
-
-If you omit the loop condition it loops forever, so an infinite loop is compactly expressed.
-
-.play flowcontrol/forever.go
-
-* If
-
-Go's `if` statements are like its `for` loops; the expression need not be
-surrounded by parentheses `(`)` but the braces `{`}` are required.
-
-.play flowcontrol/if.go
-
-* If with a short statement
-
-Like `for`, the `if` statement can start with a short statement to execute before the condition.
-
-Variables declared by the statement are only in scope until the end of the `if`.
-
-(Try using `v` in the last `return` statement.)
-
-.play flowcontrol/if-with-a-short-statement.go
-
-* If and else
-
-Variables declared inside an `if` short statement are also available inside any
-of the `else` blocks.
-
-(Both calls to `pow` return their results before the call to `fmt.Println`
-in `main` begins.)
-
-.play flowcontrol/if-and-else.go
-
-* Exercise: Loops and Functions
-
-As a way to play with functions and loops, let's implement a square root function: given a number x, we want to find the number z for which z² is most nearly x.
-
-Computers typically compute the square root of x using a loop.
-Starting with some guess z, we can adjust z based on how close z² is to x,
-producing a better guess:
-
-	z -= (z*z - x) / (2*z)
-
-Repeating this adjustment makes the guess better and better
-until we reach an answer that is as close to the actual square root as can be.
-
-Implement this in the `func`Sqrt` provided.
-A decent starting guess for z is 1, no matter what the input.
-To begin with, repeat the calculation 10 times and print each z along the way.
-See how close you get to the answer for various values of x (1, 2, 3, ...)
-and how quickly the guess improves.
-
-Hint: To declare and initialize a floating point value,
-give it floating point syntax or use a conversion:
-
-	z := 1.0
-	z := float64(1)
-
-Next, change the loop condition to stop once the value has stopped
-changing (or only changes by a very small amount).
-See if that's more or fewer than 10 iterations.
-Try other initial guesses for z, like x, or x/2.
-How close are your function's results to the [[https://golang.org/pkg/math/#Sqrt][math.Sqrt]] in the standard library?
-
-(*Note:* If you are interested in the details of the algorithm, the z² − x above
-is how far away z² is from where it needs to be (x), and the division by 2z is the derivative
-of z², to scale how much we adjust z by how quickly z² is changing.
-This general approach is called [[https://en.wikipedia.org/wiki/Newton%27s_method][Newton's method]].
-It works well for many functions but especially well for square root.)
-
-.play flowcontrol/exercise-loops-and-functions.go
-
-* Switch
-
-A `switch` statement is a shorter way to write a sequence of `if`-`else` statements.
-It runs the first case whose value is equal to the condition expression.
-
-Go's switch is like the one in C, C++, Java, JavaScript, and PHP,
-except that Go only runs the selected case, not all the cases that follow.
-In effect, the `break` statement that is needed at the end of each case in those
-languages is provided automatically in Go.
-Another important difference is that Go's switch cases need not
-be constants, and the values involved need not be integers.
-
-.play flowcontrol/switch.go
-
-* Switch evaluation order
-
-Switch cases evaluate cases from top to bottom, stopping when a case succeeds.
-
-(For example,
-
-	switch i {
-	case 0:
-	case f():
-	}
-
-does not call `f` if `i==0`.)
-
-#appengine: *Note:* Time in the Go playground always appears to start at
-#appengine: 2009-11-10 23:00:00 UTC, a value whose significance is left as an
-#appengine: exercise for the reader.
-
-.play flowcontrol/switch-evaluation-order.go
-
-* Switch with no condition
-
-Switch without a condition is the same as `switch`true`.
-
-This construct can be a clean way to write long if-then-else chains.
-
-.play flowcontrol/switch-with-no-condition.go
-
-* Defer
-
-A defer statement defers the execution of a function until the surrounding
-function returns.
-
-The deferred call's arguments are evaluated immediately, but the function call
-is not executed until the surrounding function returns.
-
-.play flowcontrol/defer.go
-
-* Stacking defers
-
-Deferred function calls are pushed onto a stack. When a function returns, its
-deferred calls are executed in last-in-first-out order.
-
-To learn more about defer statements read this
-[[https://blog.golang.org/defer-panic-and-recover][blog post]].
-
-.play flowcontrol/defer-multi.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/flowcontrol/defer-multi.go b/content/flowcontrol/defer-multi.go
deleted file mode 100644
index 82419d5..0000000
--- a/content/flowcontrol/defer-multi.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	fmt.Println("counting")
-
-	for i := 0; i < 10; i++ {
-		defer fmt.Println(i)
-	}
-
-	fmt.Println("done")
-}
diff --git a/content/flowcontrol/defer.go b/content/flowcontrol/defer.go
deleted file mode 100644
index 3314c05..0000000
--- a/content/flowcontrol/defer.go
+++ /dev/null
@@ -1,11 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	defer fmt.Println("world")
-
-	fmt.Println("hello")
-}
diff --git a/content/flowcontrol/exercise-loops-and-functions.go b/content/flowcontrol/exercise-loops-and-functions.go
deleted file mode 100644
index 68c334d..0000000
--- a/content/flowcontrol/exercise-loops-and-functions.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-func Sqrt(x float64) float64 {
-}
-
-func main() {
-	fmt.Println(Sqrt(2))
-}
diff --git a/content/flowcontrol/for-continued.go b/content/flowcontrol/for-continued.go
deleted file mode 100644
index 71c9686..0000000
--- a/content/flowcontrol/for-continued.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	sum := 1
-	for ; sum < 1000; {
-		sum += sum
-	}
-	fmt.Println(sum)
-}
diff --git a/content/flowcontrol/for-is-gos-while.go b/content/flowcontrol/for-is-gos-while.go
deleted file mode 100644
index 5f6fce4..0000000
--- a/content/flowcontrol/for-is-gos-while.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	sum := 1
-	for sum < 1000 {
-		sum += sum
-	}
-	fmt.Println(sum)
-}
diff --git a/content/flowcontrol/for.go b/content/flowcontrol/for.go
deleted file mode 100644
index 0bf8713..0000000
--- a/content/flowcontrol/for.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	sum := 0
-	for i := 0; i < 10; i++ {
-		sum += i
-	}
-	fmt.Println(sum)
-}
diff --git a/content/flowcontrol/forever.go b/content/flowcontrol/forever.go
deleted file mode 100644
index d3a9c9d..0000000
--- a/content/flowcontrol/forever.go
+++ /dev/null
@@ -1,8 +0,0 @@
-// +build no-run OMIT
-
-package main
-
-func main() {
-	for {
-	}
-}
diff --git a/content/flowcontrol/if-and-else.go b/content/flowcontrol/if-and-else.go
deleted file mode 100644
index 32f92a9..0000000
--- a/content/flowcontrol/if-and-else.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func pow(x, n, lim float64) float64 {
-	if v := math.Pow(x, n); v < lim {
-		return v
-	} else {
-		fmt.Printf("%g >= %g\n", v, lim)
-	}
-	// can't use v here, though
-	return lim
-}
-
-func main() {
-	fmt.Println(
-		pow(3, 2, 10),
-		pow(3, 3, 20),
-	)
-}
diff --git a/content/flowcontrol/if-with-a-short-statement.go b/content/flowcontrol/if-with-a-short-statement.go
deleted file mode 100644
index 30a0cbf..0000000
--- a/content/flowcontrol/if-with-a-short-statement.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func pow(x, n, lim float64) float64 {
-	if v := math.Pow(x, n); v < lim {
-		return v
-	}
-	return lim
-}
-
-func main() {
-	fmt.Println(
-		pow(3, 2, 10),
-		pow(3, 3, 20),
-	)
-}
diff --git a/content/flowcontrol/if.go b/content/flowcontrol/if.go
deleted file mode 100644
index 1d6d841..0000000
--- a/content/flowcontrol/if.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func sqrt(x float64) string {
-	if x < 0 {
-		return sqrt(-x) + "i"
-	}
-	return fmt.Sprint(math.Sqrt(x))
-}
-
-func main() {
-	fmt.Println(sqrt(2), sqrt(-4))
-}
diff --git a/content/flowcontrol/switch-evaluation-order.go b/content/flowcontrol/switch-evaluation-order.go
deleted file mode 100644
index 71eb3c3..0000000
--- a/content/flowcontrol/switch-evaluation-order.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	fmt.Println("When's Saturday?")
-	today := time.Now().Weekday()
-	switch time.Saturday {
-	case today + 0:
-		fmt.Println("Today.")
-	case today + 1:
-		fmt.Println("Tomorrow.")
-	case today + 2:
-		fmt.Println("In two days.")
-	default:
-		fmt.Println("Too far away.")
-	}
-}
diff --git a/content/flowcontrol/switch-with-no-condition.go b/content/flowcontrol/switch-with-no-condition.go
deleted file mode 100644
index e9f001c..0000000
--- a/content/flowcontrol/switch-with-no-condition.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	t := time.Now()
-	switch {
-	case t.Hour() < 12:
-		fmt.Println("Good morning!")
-	case t.Hour() < 17:
-		fmt.Println("Good afternoon.")
-	default:
-		fmt.Println("Good evening.")
-	}
-}
diff --git a/content/flowcontrol/switch.go b/content/flowcontrol/switch.go
deleted file mode 100644
index 065db3d..0000000
--- a/content/flowcontrol/switch.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"runtime"
-)
-
-func main() {
-	fmt.Print("Go runs on ")
-	switch os := runtime.GOOS; os {
-	case "darwin":
-		fmt.Println("OS X.")
-	case "linux":
-		fmt.Println("Linux.")
-	default:
-		// freebsd, openbsd,
-		// plan9, windows...
-		fmt.Printf("%s.\n", os)
-	}
-}
diff --git a/content/img/tree.png b/content/img/tree.png
deleted file mode 100644
index a140421..0000000
--- a/content/img/tree.png
+++ /dev/null
Binary files differ
diff --git a/content/methods.article b/content/methods.article
deleted file mode 100644
index 34aa673..0000000
--- a/content/methods.article
+++ /dev/null
@@ -1,422 +0,0 @@
-Methods and interfaces
-This lesson covers methods and interfaces, the constructs that define objects and their behavior.
-
-The Go Authors
-https://golang.org
-
-* Methods
-
-Go does not have classes.
-However, you can define methods on types.
-
-A method is a function with a special _receiver_ argument.
-
-The receiver appears in its own argument list between the `func` keyword and
-the method name.
-
-In this example, the `Abs` method has a receiver of type `Vertex` named `v`.
-
-.play methods/methods.go
-
-* Methods are functions
-
-Remember: a method is just a function with a receiver argument.
-
-Here's `Abs` written as a regular function with no change in functionality.
-
-.play methods/methods-funcs.go
-
-* Methods continued
-
-You can declare a method on non-struct types, too.
-
-In this example we see a numeric type `MyFloat` with an `Abs` method.
-
-You can only declare a method with a receiver whose type is defined in the same
-package as the method.
-You cannot declare a method with a receiver whose type is defined in another
-package (which includes the built-in types such as `int`).
-
-.play methods/methods-continued.go
-
-* Pointer receivers
-
-You can declare methods with pointer receivers.
-
-This means the receiver type has the literal syntax `*T` for some type `T`.
-(Also, `T` cannot itself be a pointer such as `*int`.)
-
-For example, the `Scale` method here is defined on `*Vertex`.
-
-Methods with pointer receivers can modify the value to which the receiver
-points (as `Scale` does here).
-Since methods often need to modify their receiver, pointer receivers are more
-common than value receivers.
-
-Try removing the `*` from the declaration of the `Scale` function on line 16
-and observe how the program's behavior changes.
-
-With a value receiver, the `Scale` method operates on a copy of the original
-`Vertex` value.
-(This is the same behavior as for any other function argument.)
-The `Scale` method must have a pointer receiver to change the `Vertex` value
-declared in the `main` function.
-
-.play methods/methods-pointers.go
-
-* Pointers and functions
-
-Here we see the `Abs` and `Scale` methods rewritten as functions.
-
-Again, try removing the `*` from line 16.
-Can you see why the behavior changes?
-What else did you need to change for the example to compile?
-
-(If you're not sure, continue to the next page.)
-
-.play methods/methods-pointers-explained.go
-
-* Methods and pointer indirection
-
-Comparing the previous two programs, you might notice that
-functions with a pointer argument must take a pointer:
-
-	var v Vertex
-	ScaleFunc(v, 5)  // Compile error!
-	ScaleFunc(&v, 5) // OK
-
-while methods with pointer receivers take either a value or a pointer as the
-receiver when they are called:
-
-	var v Vertex
-	v.Scale(5)  // OK
-	p := &v
-	p.Scale(10) // OK
-
-For the statement `v.Scale(5)`, even though `v` is a value and not a pointer,
-the method with the pointer receiver is called automatically.
-That is, as a convenience, Go interprets the statement `v.Scale(5)` as
-`(&v).Scale(5)` since the `Scale` method has a pointer receiver.
-
-.play methods/indirection.go
-
-* Methods and pointer indirection (2)
-
-The equivalent thing happens in the reverse direction.
-
-Functions that take a value argument must take a value of that specific type:
-
-	var v Vertex
-	fmt.Println(AbsFunc(v))  // OK
-	fmt.Println(AbsFunc(&v)) // Compile error!
-
-while methods with value receivers take either a value or a pointer as the
-receiver when they are called:
-
-	var v Vertex
-	fmt.Println(v.Abs()) // OK
-	p := &v
-	fmt.Println(p.Abs()) // OK
-
-In this case, the method call `p.Abs()` is interpreted as `(*p).Abs()`.
-
-.play methods/indirection-values.go
-
-* Choosing a value or pointer receiver
-
-There are two reasons to use a pointer receiver.
-
-The first is so that the method can modify the value that its receiver points to.
-
-The second is to avoid copying the value on each method call.
-This can be more efficient if the receiver is a large struct, for example.
-
-In this example, both `Scale` and `Abs` are with receiver type `*Vertex`,
-even though the `Abs` method needn't modify its receiver.
-
-In general, all methods on a given type should have either value or pointer
-receivers, but not a mixture of both.
-(We'll see why over the next few pages.)
-
-.play methods/methods-with-pointer-receivers.go
-
-* Interfaces
-
-An _interface_type_ is defined as a set of method signatures.
-
-A value of interface type can hold any value that implements those methods.
-
-*Note:* There is an error in the example code on line 22.
-`Vertex` (the value type) doesn't implement `Abser` because
-the `Abs` method is defined only on `*Vertex` (the pointer type).
-
-.play methods/interfaces.go
-
-* Interfaces are implemented implicitly
-
-A type implements an interface by implementing its methods.
-There is no explicit declaration of intent, no "implements" keyword.
-
-Implicit interfaces decouple the definition of an interface from its
-implementation, which could then appear in any package without prearrangement.
-
-.play methods/interfaces-are-satisfied-implicitly.go
-
-* Interface values
-
-Under the hood, interface values can be thought of as a tuple of a value and a
-concrete type:
-
-	(value, type)
-
-An interface value holds a value of a specific underlying concrete type.
-
-Calling a method on an interface value executes the method of the same name on
-its underlying type.
-
-.play methods/interface-values.go
-
-* Interface values with nil underlying values
-
-If the concrete value inside the interface itself is nil,
-the method will be called with a nil receiver.
-
-In some languages this would trigger a null pointer exception,
-but in Go it is common to write methods that gracefully handle being called
-with a nil receiver (as with the method `M` in this example.)
-
-Note that an interface value that holds a nil concrete value is itself non-nil.
-
-.play methods/interface-values-with-nil.go
-
-* Nil interface values
-
-A nil interface value holds neither value nor concrete type.
-
-Calling a method on a nil interface is a run-time error because there is no
-type inside the interface tuple to indicate which _concrete_ method to call.
-
-.play methods/nil-interface-values.go
-
-* The empty interface
-
-The interface type that specifies zero methods is known as the _empty_interface_:
-
-	interface{}
-
-An empty interface may hold values of any type.
-(Every type implements at least zero methods.)
-
-Empty interfaces are used by code that handles values of unknown type.
-For example, `fmt.Print` takes any number of arguments of type `interface{}`.
-
-.play methods/empty-interface.go
-
-* Type assertions
-
-A _type_assertion_ provides access to an interface value's underlying concrete value.
-
-	t := i.(T)
-
-This statement asserts that the interface value `i` holds the concrete type `T`
-and assigns the underlying `T` value to the variable `t`.
-
-If `i` does not hold a `T`, the statement will trigger a panic.
-
-To _test_ whether an interface value holds a specific type,
-a type assertion can return two values: the underlying value
-and a boolean value that reports whether the assertion succeeded.
-
-	t, ok := i.(T)
-
-If `i` holds a `T`, then `t` will be the underlying value and `ok` will be true.
-
-If not, `ok` will be false and `t` will be the zero value of type `T`,
-and no panic occurs.
-
-Note the similarity between this syntax and that of reading from a map.
-
-.play methods/type-assertions.go
-
-* Type switches
-
-A _type_switch_ is a construct that permits several type assertions in series.
-
-A type switch is like a regular switch statement, but the cases in a type
-switch specify types (not values), and those values are compared against
-the type of the value held by the given interface value.
-
-	switch v := i.(type) {
-	case T:
-		// here v has type T
-	case S:
-		// here v has type S
-	default:
-		// no match; here v has the same type as i
-	}
-
-The declaration in a type switch has the same syntax as a type assertion `i.(T)`,
-but the specific type `T` is replaced with the keyword `type`.
-
-This switch statement tests whether the interface value `i`
-holds a value of type `T` or `S`.
-In each of the `T` and `S` cases, the variable `v` will be of type
-`T` or `S` respectively and hold the value held by `i`.
-In the default case (where there is no match), the variable `v` is
-of the same interface type and value as `i`.
-
-.play methods/type-switches.go
-
-* Stringers
-
-One of the most ubiquitous interfaces is [[//golang.org/pkg/fmt/#Stringer][`Stringer`]] defined by the [[//golang.org/pkg/fmt/][`fmt`]] package.
-
-	type Stringer interface {
-		String() string
-	}
-
-A `Stringer` is a type that can describe itself as a string. The `fmt` package
-(and many others) look for this interface to print values.
-
-.play methods/stringer.go
-
-* Exercise: Stringers
-
-Make the `IPAddr` type implement `fmt.Stringer` to print the address as
-a dotted quad.
-
-For instance, `IPAddr{1,`2,`3,`4}` should print as `"1.2.3.4"`.
-
-.play methods/exercise-stringer.go
-
-* Errors
-
-Go programs express error state with `error` values.
-
-The `error` type is a built-in interface similar to `fmt.Stringer`:
-
-	type error interface {
-		Error() string
-	}
-
-(As with `fmt.Stringer`, the `fmt` package looks for the `error` interface when
-printing values.)
-
-Functions often return an `error` value, and calling code should handle errors
-by testing whether the error equals `nil`.
-
-	i, err := strconv.Atoi("42")
-	if err != nil {
-		fmt.Printf("couldn't convert number: %v\n", err)
-		return
-	}
-	fmt.Println("Converted integer:", i)
-
-A nil `error` denotes success; a non-nil `error` denotes failure.
-
-.play methods/errors.go
-
-* Exercise: Errors
-
-Copy your `Sqrt` function from the [[/flowcontrol/8][earlier exercise]] and modify it to return an `error` value.
-
-`Sqrt` should return a non-nil error value when given a negative number, as it doesn't support complex numbers.
-
-Create a new type
-
-	type ErrNegativeSqrt float64
-
-and make it an `error` by giving it a
-
-	func (e ErrNegativeSqrt) Error() string
-
-method such that `ErrNegativeSqrt(-2).Error()` returns `"cannot`Sqrt`negative`number:`-2"`.
-
-*Note:* A call to `fmt.Sprint(e)` inside the `Error` method will send the program into an infinite loop. You can avoid this by converting `e` first: `fmt.Sprint(float64(e))`. Why?
-
-Change your `Sqrt` function to return an `ErrNegativeSqrt` value when given a negative number.
-
-.play methods/exercise-errors.go
-
-* Readers
-
-The `io` package specifies the `io.Reader` interface,
-which represents the read end of a stream of data.
-
-The Go standard library contains [[https://golang.org/search?q=Read#Global][many implementations]] of this interface, including files, network connections, compressors, ciphers, and others.
-
-The `io.Reader` interface has a `Read` method:
-
-	func (T) Read(b []byte) (n int, err error)
-
-`Read` populates the given byte slice with data and returns the number of bytes
-populated and an error value. It returns an `io.EOF` error when the stream
-ends.
-
-The example code creates a
-[[//golang.org/pkg/strings/#Reader][`strings.Reader`]]
-and consumes its output 8 bytes at a time.
-
-.play methods/reader.go
-
-* Exercise: Readers
-
-Implement a `Reader` type that emits an infinite stream of the ASCII character
-`'A'`.
-
-.play methods/exercise-reader.go
-
-* Exercise: rot13Reader
-
-A common pattern is an [[https://golang.org/pkg/io/#Reader][io.Reader]] that wraps another `io.Reader`, modifying the stream in some way.
-
-For example, the [[https://golang.org/pkg/compress/gzip/#NewReader][gzip.NewReader]] function takes an `io.Reader` (a stream of compressed data) and returns a `*gzip.Reader` that also implements `io.Reader` (a stream of the decompressed data).
-
-Implement a `rot13Reader` that implements `io.Reader` and reads from an `io.Reader`, modifying the stream by applying the [[https://en.wikipedia.org/wiki/ROT13][rot13]] substitution cipher to all alphabetical characters.
-
-The `rot13Reader` type is provided for you.
-Make it an `io.Reader` by implementing its `Read` method.
-
-.play methods/exercise-rot-reader.go
-
-* Images
-
-[[https://golang.org/pkg/image/#Image][Package image]] defines the `Image` interface:
-
-	package image
-
-	type Image interface {
-		ColorModel() color.Model
-		Bounds() Rectangle
-		At(x, y int) color.Color
-	}
-
-*Note*: the `Rectangle` return value of the `Bounds` method is actually an
-[[https://golang.org/pkg/image/#Rectangle][`image.Rectangle`]], as the
-declaration is inside package `image`.
-
-(See [[https://golang.org/pkg/image/#Image][the documentation]] for all the details.)
-
-The `color.Color` and `color.Model` types are also interfaces, but we'll ignore that by using the predefined implementations `color.RGBA` and `color.RGBAModel`. These interfaces and types are specified by the [[https://golang.org/pkg/image/color/][image/color package]]
-
-.play methods/images.go
-
-* Exercise: Images
-
-Remember the [[/moretypes/18][picture generator]] you wrote earlier? Let's write another one, but this time it will return an implementation of `image.Image` instead of a slice of data.
-
-Define your own `Image` type, implement [[https://golang.org/pkg/image/#Image][the necessary methods]], and call `pic.ShowImage`.
-
-`Bounds` should return a `image.Rectangle`, like `image.Rect(0,`0,`w,`h)`.
-
-`ColorModel` should return `color.RGBAModel`.
-
-`At` should return a color; the value `v` in the last picture generator corresponds to `color.RGBA{v,`v,`255,`255}` in this one.
-
-.play methods/exercise-images.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/methods/empty-interface.go b/content/methods/empty-interface.go
deleted file mode 100644
index 10e9861..0000000
--- a/content/methods/empty-interface.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i interface{}
-	describe(i)
-
-	i = 42
-	describe(i)
-
-	i = "hello"
-	describe(i)
-}
-
-func describe(i interface{}) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/errors.go b/content/methods/errors.go
deleted file mode 100644
index 7ea0aed..0000000
--- a/content/methods/errors.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-type MyError struct {
-	When time.Time
-	What string
-}
-
-func (e *MyError) Error() string {
-	return fmt.Sprintf("at %v, %s",
-		e.When, e.What)
-}
-
-func run() error {
-	return &MyError{
-		time.Now(),
-		"it didn't work",
-	}
-}
-
-func main() {
-	if err := run(); err != nil {
-		fmt.Println(err)
-	}
-}
diff --git a/content/methods/exercise-errors.go b/content/methods/exercise-errors.go
deleted file mode 100644
index 22e933b..0000000
--- a/content/methods/exercise-errors.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-)
-
-func Sqrt(x float64) (float64, error) {
-	return 0, nil
-}
-
-func main() {
-	fmt.Println(Sqrt(2))
-	fmt.Println(Sqrt(-2))
-}
diff --git a/content/methods/exercise-images.go b/content/methods/exercise-images.go
deleted file mode 100644
index 5b93246..0000000
--- a/content/methods/exercise-images.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/pic"
-
-type Image struct{}
-
-func main() {
-	m := Image{}
-	pic.ShowImage(m)
-}
diff --git a/content/methods/exercise-reader.go b/content/methods/exercise-reader.go
deleted file mode 100644
index e1394b2..0000000
--- a/content/methods/exercise-reader.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/reader"
-
-type MyReader struct{}
-
-// TODO: Add a Read([]byte) (int, error) method to MyReader.
-
-func main() {
-	reader.Validate(MyReader{})
-}
diff --git a/content/methods/exercise-rot-reader.go b/content/methods/exercise-rot-reader.go
deleted file mode 100644
index 21aead5..0000000
--- a/content/methods/exercise-rot-reader.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"io"
-	"os"
-	"strings"
-)
-
-type rot13Reader struct {
-	r io.Reader
-}
-
-func main() {
-	s := strings.NewReader("Lbh penpxrq gur pbqr!")
-	r := rot13Reader{s}
-	io.Copy(os.Stdout, &r)
-}
diff --git a/content/methods/exercise-stringer.go b/content/methods/exercise-stringer.go
deleted file mode 100644
index bd9fed5..0000000
--- a/content/methods/exercise-stringer.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type IPAddr [4]byte
-
-// TODO: Add a "String() string" method to IPAddr.
-
-func main() {
-	hosts := map[string]IPAddr{
-		"loopback":  {127, 0, 0, 1},
-		"googleDNS": {8, 8, 8, 8},
-	}
-	for name, ip := range hosts {
-		fmt.Printf("%v: %v\n", name, ip)
-	}
-}
diff --git a/content/methods/images.go b/content/methods/images.go
deleted file mode 100644
index 6305e26..0000000
--- a/content/methods/images.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"image"
-)
-
-func main() {
-	m := image.NewRGBA(image.Rect(0, 0, 100, 100))
-	fmt.Println(m.Bounds())
-	fmt.Println(m.At(0, 0).RGBA())
-}
diff --git a/content/methods/indirection-values.go b/content/methods/indirection-values.go
deleted file mode 100644
index 04e022b..0000000
--- a/content/methods/indirection-values.go
+++ /dev/null
@@ -1,30 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func AbsFunc(v Vertex) float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := Vertex{3, 4}
-	fmt.Println(v.Abs())
-	fmt.Println(AbsFunc(v))
-
-	p := &Vertex{4, 3}
-	fmt.Println(p.Abs())
-	fmt.Println(AbsFunc(*p))
-}
diff --git a/content/methods/indirection.go b/content/methods/indirection.go
deleted file mode 100644
index 6b69828..0000000
--- a/content/methods/indirection.go
+++ /dev/null
@@ -1,31 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v *Vertex) Scale(f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func ScaleFunc(v *Vertex, f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func main() {
-	v := Vertex{3, 4}
-	v.Scale(2)
-	ScaleFunc(&v, 10)
-
-	p := &Vertex{4, 3}
-	p.Scale(3)
-	ScaleFunc(p, 8)
-
-	fmt.Println(v, p)
-}
diff --git a/content/methods/interface-values-with-nil.go b/content/methods/interface-values-with-nil.go
deleted file mode 100644
index 9c4773a..0000000
--- a/content/methods/interface-values-with-nil.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type I interface {
-	M()
-}
-
-type T struct {
-	S string
-}
-
-func (t *T) M() {
-	if t == nil {
-		fmt.Println("<nil>")
-		return
-	}
-	fmt.Println(t.S)
-}
-
-func main() {
-	var i I
-
-	var t *T
-	i = t
-	describe(i)
-	i.M()
-
-	i = &T{"hello"}
-	describe(i)
-	i.M()
-}
-
-func describe(i I) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/interface-values.go b/content/methods/interface-values.go
deleted file mode 100644
index 82d096f..0000000
--- a/content/methods/interface-values.go
+++ /dev/null
@@ -1,42 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type I interface {
-	M()
-}
-
-type T struct {
-	S string
-}
-
-func (t *T) M() {
-	fmt.Println(t.S)
-}
-
-type F float64
-
-func (f F) M() {
-	fmt.Println(f)
-}
-
-func main() {
-	var i I
-
-	i = &T{"Hello"}
-	describe(i)
-	i.M()
-
-	i = F(math.Pi)
-	describe(i)
-	i.M()
-}
-
-func describe(i I) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/interfaces-are-satisfied-implicitly.go b/content/methods/interfaces-are-satisfied-implicitly.go
deleted file mode 100644
index 23f4539..0000000
--- a/content/methods/interfaces-are-satisfied-implicitly.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type I interface {
-	M()
-}
-
-type T struct {
-	S string
-}
-
-// This method means type T implements the interface I,
-// but we don't need to explicitly declare that it does so.
-func (t T) M() {
-	fmt.Println(t.S)
-}
-
-func main() {
-	var i I = T{"hello"}
-	i.M()
-}
diff --git a/content/methods/interfaces.go b/content/methods/interfaces.go
deleted file mode 100644
index a6eda32..0000000
--- a/content/methods/interfaces.go
+++ /dev/null
@@ -1,44 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Abser interface {
-	Abs() float64
-}
-
-func main() {
-	var a Abser
-	f := MyFloat(-math.Sqrt2)
-	v := Vertex{3, 4}
-
-	a = f  // a MyFloat implements Abser
-	a = &v // a *Vertex implements Abser
-
-	// In the following line, v is a Vertex (not *Vertex)
-	// and does NOT implement Abser.
-	a = v
-
-	fmt.Println(a.Abs())
-}
-
-type MyFloat float64
-
-func (f MyFloat) Abs() float64 {
-	if f < 0 {
-		return float64(-f)
-	}
-	return float64(f)
-}
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v *Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
diff --git a/content/methods/methods-continued.go b/content/methods/methods-continued.go
deleted file mode 100644
index 6710d1b..0000000
--- a/content/methods/methods-continued.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type MyFloat float64
-
-func (f MyFloat) Abs() float64 {
-	if f < 0 {
-		return float64(-f)
-	}
-	return float64(f)
-}
-
-func main() {
-	f := MyFloat(-math.Sqrt2)
-	fmt.Println(f.Abs())
-}
diff --git a/content/methods/methods-funcs.go b/content/methods/methods-funcs.go
deleted file mode 100644
index 476f0cf..0000000
--- a/content/methods/methods-funcs.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func Abs(v Vertex) float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := Vertex{3, 4}
-	fmt.Println(Abs(v))
-}
diff --git a/content/methods/methods-pointers-explained.go b/content/methods/methods-pointers-explained.go
deleted file mode 100644
index db9107a..0000000
--- a/content/methods/methods-pointers-explained.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func Abs(v Vertex) float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func Scale(v *Vertex, f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func main() {
-	v := Vertex{3, 4}
-	Scale(&v, 10)
-	fmt.Println(Abs(v))
-}
diff --git a/content/methods/methods-pointers.go b/content/methods/methods-pointers.go
deleted file mode 100644
index cd88f46..0000000
--- a/content/methods/methods-pointers.go
+++ /dev/null
@@ -1,27 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func (v *Vertex) Scale(f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func main() {
-	v := Vertex{3, 4}
-	v.Scale(10)
-	fmt.Println(v.Abs())
-}
diff --git a/content/methods/methods-with-pointer-receivers.go b/content/methods/methods-with-pointer-receivers.go
deleted file mode 100644
index 28acc2b..0000000
--- a/content/methods/methods-with-pointer-receivers.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v *Vertex) Scale(f float64) {
-	v.X = v.X * f
-	v.Y = v.Y * f
-}
-
-func (v *Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := &Vertex{3, 4}
-	fmt.Printf("Before scaling: %+v, Abs: %v\n", v, v.Abs())
-	v.Scale(5)
-	fmt.Printf("After scaling: %+v, Abs: %v\n", v, v.Abs())
-}
diff --git a/content/methods/methods.go b/content/methods/methods.go
deleted file mode 100644
index 692a095..0000000
--- a/content/methods/methods.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type Vertex struct {
-	X, Y float64
-}
-
-func (v Vertex) Abs() float64 {
-	return math.Sqrt(v.X*v.X + v.Y*v.Y)
-}
-
-func main() {
-	v := Vertex{3, 4}
-	fmt.Println(v.Abs())
-}
diff --git a/content/methods/nil-interface-values.go b/content/methods/nil-interface-values.go
deleted file mode 100644
index 55dbf86..0000000
--- a/content/methods/nil-interface-values.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build no-run OMIT
-
-package main
-
-import "fmt"
-
-type I interface {
-	M()
-}
-
-func main() {
-	var i I
-	describe(i)
-	i.M()
-}
-
-func describe(i I) {
-	fmt.Printf("(%v, %T)\n", i, i)
-}
diff --git a/content/methods/reader.go b/content/methods/reader.go
deleted file mode 100644
index 4c97eb4..0000000
--- a/content/methods/reader.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"io"
-	"strings"
-)
-
-func main() {
-	r := strings.NewReader("Hello, Reader!")
-
-	b := make([]byte, 8)
-	for {
-		n, err := r.Read(b)
-		fmt.Printf("n = %v err = %v b = %v\n", n, err, b)
-		fmt.Printf("b[:n] = %q\n", b[:n])
-		if err == io.EOF {
-			break
-		}
-	}
-}
diff --git a/content/methods/stringer.go b/content/methods/stringer.go
deleted file mode 100644
index 10944b9..0000000
--- a/content/methods/stringer.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Person struct {
-	Name string
-	Age  int
-}
-
-func (p Person) String() string {
-	return fmt.Sprintf("%v (%v years)", p.Name, p.Age)
-}
-
-func main() {
-	a := Person{"Arthur Dent", 42}
-	z := Person{"Zaphod Beeblebrox", 9001}
-	fmt.Println(a, z)
-}
diff --git a/content/methods/type-assertions.go b/content/methods/type-assertions.go
deleted file mode 100644
index 7e81499..0000000
--- a/content/methods/type-assertions.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build no-run OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var i interface{} = "hello"
-
-	s := i.(string)
-	fmt.Println(s)
-
-	s, ok := i.(string)
-	fmt.Println(s, ok)
-
-	f, ok := i.(float64)
-	fmt.Println(f, ok)
-
-	f = i.(float64) // panic
-	fmt.Println(f)
-}
diff --git a/content/methods/type-switches.go b/content/methods/type-switches.go
deleted file mode 100644
index 12d879d..0000000
--- a/content/methods/type-switches.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func do(i interface{}) {
-	switch v := i.(type) {
-	case int:
-		fmt.Printf("Twice %v is %v\n", v, v*2)
-	case string:
-		fmt.Printf("%q is %v bytes long\n", v, len(v))
-	default:
-		fmt.Printf("I don't know about type %T!\n", v)
-	}
-}
-
-func main() {
-	do(21)
-	do("hello")
-	do(true)
-}
diff --git a/content/moretypes.article b/content/moretypes.article
deleted file mode 100644
index 5fe9401..0000000
--- a/content/moretypes.article
+++ /dev/null
@@ -1,361 +0,0 @@
-More types: structs, slices, and maps.
-Learn how to define types based on existing ones: this lesson covers structs, arrays, slices, and maps.
-
-The Go Authors
-https://golang.org
-
-* Pointers
-
-Go has pointers.
-A pointer holds the memory address of a value.
-
-The type `*T` is a pointer to a `T` value. Its zero value is `nil`.
-
-	var p *int
-
-The `&` operator generates a pointer to its operand.
-
-	i := 42
-	p = &i
-
-The `*` operator denotes the pointer's underlying value.
-
-	fmt.Println(*p) // read i through the pointer p
-	*p = 21         // set i through the pointer p
-
-This is known as "dereferencing" or "indirecting".
-
-Unlike C, Go has no pointer arithmetic.
-
-.play moretypes/pointers.go
-
-* Structs
-
-A `struct` is a collection of fields.
-
-.play moretypes/structs.go
-
-* Struct Fields
-
-Struct fields are accessed using a dot.
-
-.play moretypes/struct-fields.go
-
-* Pointers to structs
-
-Struct fields can be accessed through a struct pointer.
-
-To access the field `X` of a struct when we have the struct pointer `p` we could
-write `(*p).X`.
-However, that notation is cumbersome, so the language permits us instead to
-write just `p.X`, without the explicit dereference.
-
-.play moretypes/struct-pointers.go
-
-* Struct Literals
-
-A struct literal denotes a newly allocated struct value by listing the values of its fields.
-
-You can list just a subset of fields by using the `Name:` syntax. (And the order of named fields is irrelevant.)
-
-The special prefix `&` returns a pointer to the struct value.
-
-.play moretypes/struct-literals.go
-
-
-* Arrays
-
-The type `[n]T` is an array of `n` values of type `T`.
-
-The expression
-
-	var a [10]int
-
-declares a variable `a` as an array of ten integers.
-
-An array's length is part of its type, so arrays cannot be resized.
-This seems limiting, but don't worry;
-Go provides a convenient way of working with arrays.
-
-.play moretypes/array.go
-
-
-* Slices
-
-An array has a fixed size.
-A slice, on the other hand, is a dynamically-sized,
-flexible view into the elements of an array.
-In practice, slices are much more common than arrays.
-
-The type `[]T` is a slice with elements of type `T`.
-
-A slice is formed by specifying two indices, a low and
-high bound, separated by a colon:
-
-	a[low : high]
-
-This selects a half-open range which includes the first
-element, but excludes the last one.
-
-The following expression creates a slice which includes
-elements 1 through 3 of `a`:
-
-	a[1:4]
-
-.play moretypes/slices.go
-
-
-* Slices are like references to arrays
-
-A slice does not store any data,
-it just describes a section of an underlying array.
-
-Changing the elements of a slice modifies the
-corresponding elements of its underlying array.
-
-Other slices that share the same underlying array will see those changes.
-
-.play moretypes/slices-pointers.go
-
-
-* Slice literals
-
-A slice literal is like an array literal without the length.
-
-This is an array literal:
-
-	[3]bool{true, true, false}
-
-And this creates the same array as above,
-then builds a slice that references it:
-
-	[]bool{true, true, false}
-
-.play moretypes/slice-literals.go
-
-
-* Slice defaults
-
-When slicing, you may omit the high or low bounds to use their defaults instead.
-
-The default is zero for the low bound and the length of the slice for the high bound.
-
-For the array
-
-	var a [10]int
-
-these slice expressions are equivalent:
-
-	a[0:10]
-	a[:10]
-	a[0:]
-	a[:]
-
-.play moretypes/slice-bounds.go
-
-
-* Slice length and capacity
-
-A slice has both a _length_ and a _capacity_.
-
-The length of a slice is the number of elements it contains.
-
-The capacity of a slice is the number of elements in the underlying array,
-counting from the first element in the slice.
-
-The length and capacity of a slice `s` can be obtained using the expressions
-`len(s)` and `cap(s)`.
-
-You can extend a slice's length by re-slicing it,
-provided it has sufficient capacity.
-Try changing one of the slice operations in the example program to extend it
-beyond its capacity and see what happens.
-
-.play moretypes/slice-len-cap.go
-
-
-* Nil slices
-
-The zero value of a slice is `nil`.
-
-A nil slice has a length and capacity of 0
-and has no underlying array.
-
-.play moretypes/nil-slices.go
-
-
-* Creating a slice with make
-
-Slices can be created with the built-in `make` function;
-this is how you create dynamically-sized arrays.
-
-The `make` function allocates a zeroed array
-and returns a slice that refers to that array:
-
-	a := make([]int, 5)  // len(a)=5
-
-To specify a capacity, pass a third argument to `make`:
-
-	b := make([]int, 0, 5) // len(b)=0, cap(b)=5
-
-	b = b[:cap(b)] // len(b)=5, cap(b)=5
-	b = b[1:]      // len(b)=4, cap(b)=4
-
-.play moretypes/making-slices.go
-
-
-* Slices of slices
-
-Slices can contain any type, including other slices.
-
-.play moretypes/slices-of-slice.go
-
-
-* Appending to a slice
-
-It is common to append new elements to a slice, and so Go provides a built-in
-`append` function. The [[https://golang.org/pkg/builtin/#append][documentation]]
-of the built-in package describes `append`.
-
-	func append(s []T, vs ...T) []T
-
-The first parameter `s` of `append` is a slice of type `T`, and the rest are
-`T` values to append to the slice.
-
-The resulting value of `append` is a slice containing all the elements of the
-original slice plus the provided values.
-
-If the backing array of `s` is too small to fit all the given values a bigger
-array will be allocated. The returned slice will point to the newly allocated
-array.
-
-(To learn more about slices, read the [[https://blog.golang.org/go-slices-usage-and-internals][Slices: usage and internals]] article.)
-
-.play moretypes/append.go
-
-
-* Range
-
-The `range` form of the `for` loop iterates over a slice or map.
-
-When ranging over a slice, two values are returned for each iteration.
-The first is the index, and the second is a copy of the element at that index.
-
-.play moretypes/range.go
-
-* Range continued
-
-You can skip the index or value by assigning to `_`.
-
-    for i, _ := range pow
-    for _, value := range pow
-
-If you only want the index, you can omit the second variable.
-
-    for i := range pow
-
-.play moretypes/range-continued.go
-
-* Exercise: Slices
-
-Implement `Pic`. It should return a slice of length `dy`, each element of which is a slice of `dx` 8-bit unsigned integers. When you run the program, it will display your picture, interpreting the integers as grayscale (well, bluescale) values.
-
-The choice of image is up to you. Interesting functions include `(x+y)/2`, `x*y`, and `x^y`.
-
-(You need to use a loop to allocate each `[]uint8` inside the `[][]uint8`.)
-
-(Use `uint8(intValue)` to convert between types.)
-
-.play moretypes/exercise-slices.go
-
-* Maps
-
-A map maps keys to values.
-
-The zero value of a map is `nil`.
-A `nil` map has no keys, nor can keys be added.
-
-The `make` function returns a map of the given type,
-initialized and ready for use.
-
-.play moretypes/maps.go
-
-* Map literals
-
-Map literals are like struct literals, but the keys are required.
-
-.play moretypes/map-literals.go
-
-* Map literals continued
-
-If the top-level type is just a type name, you can omit it from the elements of the literal.
-
-.play moretypes/map-literals-continued.go
-
-* Mutating Maps
-
-Insert or update an element in map `m`:
-
-	m[key] = elem
-
-Retrieve an element:
-
-	elem = m[key]
-
-Delete an element:
-
-	delete(m, key)
-
-Test that a key is present with a two-value assignment:
-
-	elem, ok = m[key]
-
-If `key` is in `m`, `ok` is `true`. If not, `ok` is `false`.
-
-If `key` is not in the map, then `elem` is the zero value for the map's element type.
-
-*Note:* If `elem` or `ok` have not yet been declared you could use a short declaration form:
-
-	elem, ok := m[key]
-
-.play moretypes/mutating-maps.go
-
-* Exercise: Maps
-
-Implement `WordCount`.  It should return a map of the counts of each “word” in the string `s`. The `wc.Test` function runs a test suite against the provided function and prints success or failure.
-
-You might find [[https://golang.org/pkg/strings/#Fields][strings.Fields]] helpful.
-
-.play moretypes/exercise-maps.go
-
-* Function values
-
-Functions are values too. They can be passed around just like other values.
-
-Function values may be used as function arguments and return values.
-
-.play moretypes/function-values.go
-
-* Function closures
-
-Go functions may be closures. A closure is a function value that references variables from outside its body. The function may access and assign to the referenced variables; in this sense the function is "bound" to the variables.
-
-For example, the `adder` function returns a closure. Each closure is bound to its own `sum` variable.
-
-.play moretypes/function-closures.go
-
-* Exercise: Fibonacci closure
-
-Let's have some fun with functions.
-
-Implement a `fibonacci` function that returns a function (a closure) that
-returns successive [[https://en.wikipedia.org/wiki/Fibonacci_number][fibonacci numbers]]
-(0, 1, 1, 2, 3, 5, ...).
-
-.play moretypes/exercise-fibonacci-closure.go
-
-* Congratulations!
-
-You finished this lesson!
-
-You can go back to the list of [[/list][modules]] to find what to learn next, or continue with the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/moretypes/append.go b/content/moretypes/append.go
deleted file mode 100644
index f13b9d6..0000000
--- a/content/moretypes/append.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var s []int
-	printSlice(s)
-
-	// append works on nil slices.
-	s = append(s, 0)
-	printSlice(s)
-
-	// The slice grows as needed.
-	s = append(s, 1)
-	printSlice(s)
-
-	// We can add more than one element at a time.
-	s = append(s, 2, 3, 4)
-	printSlice(s)
-}
-
-func printSlice(s []int) {
-	fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
-}
diff --git a/content/moretypes/array.go b/content/moretypes/array.go
deleted file mode 100644
index 8d73573..0000000
--- a/content/moretypes/array.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var a [2]string
-	a[0] = "Hello"
-	a[1] = "World"
-	fmt.Println(a[0], a[1])
-	fmt.Println(a)
-
-	primes := [6]int{2, 3, 5, 7, 11, 13}
-	fmt.Println(primes)
-}
diff --git a/content/moretypes/exercise-fibonacci-closure.go b/content/moretypes/exercise-fibonacci-closure.go
deleted file mode 100644
index d5a4e00..0000000
--- a/content/moretypes/exercise-fibonacci-closure.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "fmt"
-
-// fibonacci is a function that returns
-// a function that returns an int.
-func fibonacci() func() int {
-}
-
-func main() {
-	f := fibonacci()
-	for i := 0; i < 10; i++ {
-		fmt.Println(f())
-	}
-}
diff --git a/content/moretypes/exercise-maps.go b/content/moretypes/exercise-maps.go
deleted file mode 100644
index e48e48a..0000000
--- a/content/moretypes/exercise-maps.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"golang.org/x/tour/wc"
-)
-
-func WordCount(s string) map[string]int {
-	return map[string]int{"x": 1}
-}
-
-func main() {
-	wc.Test(WordCount)
-}
diff --git a/content/moretypes/exercise-slices.go b/content/moretypes/exercise-slices.go
deleted file mode 100644
index 094ec09..0000000
--- a/content/moretypes/exercise-slices.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build no-build OMIT
-
-package main
-
-import "golang.org/x/tour/pic"
-
-func Pic(dx, dy int) [][]uint8 {
-}
-
-func main() {
-	pic.Show(Pic)
-}
diff --git a/content/moretypes/function-closures.go b/content/moretypes/function-closures.go
deleted file mode 100644
index df09995..0000000
--- a/content/moretypes/function-closures.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func adder() func(int) int {
-	sum := 0
-	return func(x int) int {
-		sum += x
-		return sum
-	}
-}
-
-func main() {
-	pos, neg := adder(), adder()
-	for i := 0; i < 10; i++ {
-		fmt.Println(
-			pos(i),
-			neg(-2*i),
-		)
-	}
-}
diff --git a/content/moretypes/function-values.go b/content/moretypes/function-values.go
deleted file mode 100644
index 0527d71..0000000
--- a/content/moretypes/function-values.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-func compute(fn func(float64, float64) float64) float64 {
-	return fn(3, 4)
-}
-
-func main() {
-	hypot := func(x, y float64) float64 {
-		return math.Sqrt(x*x + y*y)
-	}
-	fmt.Println(hypot(5, 12))
-
-	fmt.Println(compute(hypot))
-	fmt.Println(compute(math.Pow))
-}
diff --git a/content/moretypes/making-slices.go b/content/moretypes/making-slices.go
deleted file mode 100644
index 2dae8de..0000000
--- a/content/moretypes/making-slices.go
+++ /dev/null
@@ -1,24 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	a := make([]int, 5)
-	printSlice("a", a)
-
-	b := make([]int, 0, 5)
-	printSlice("b", b)
-
-	c := b[:2]
-	printSlice("c", c)
-
-	d := c[2:5]
-	printSlice("d", d)
-}
-
-func printSlice(s string, x []int) {
-	fmt.Printf("%s len=%d cap=%d %v\n",
-		s, len(x), cap(x), x)
-}
diff --git a/content/moretypes/map-literals-continued.go b/content/moretypes/map-literals-continued.go
deleted file mode 100644
index 3a78844..0000000
--- a/content/moretypes/map-literals-continued.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	Lat, Long float64
-}
-
-var m = map[string]Vertex{
-	"Bell Labs": {40.68433, -74.39967},
-	"Google":    {37.42202, -122.08408},
-}
-
-func main() {
-	fmt.Println(m)
-}
diff --git a/content/moretypes/map-literals.go b/content/moretypes/map-literals.go
deleted file mode 100644
index 9aca19a..0000000
--- a/content/moretypes/map-literals.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	Lat, Long float64
-}
-
-var m = map[string]Vertex{
-	"Bell Labs": Vertex{
-		40.68433, -74.39967,
-	},
-	"Google": Vertex{
-		37.42202, -122.08408,
-	},
-}
-
-func main() {
-	fmt.Println(m)
-}
diff --git a/content/moretypes/maps.go b/content/moretypes/maps.go
deleted file mode 100644
index 17727b7..0000000
--- a/content/moretypes/maps.go
+++ /dev/null
@@ -1,19 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	Lat, Long float64
-}
-
-var m map[string]Vertex
-
-func main() {
-	m = make(map[string]Vertex)
-	m["Bell Labs"] = Vertex{
-		40.68433, -74.39967,
-	}
-	fmt.Println(m["Bell Labs"])
-}
diff --git a/content/moretypes/mutating-maps.go b/content/moretypes/mutating-maps.go
deleted file mode 100644
index 2c3d048..0000000
--- a/content/moretypes/mutating-maps.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	m := make(map[string]int)
-
-	m["Answer"] = 42
-	fmt.Println("The value:", m["Answer"])
-
-	m["Answer"] = 48
-	fmt.Println("The value:", m["Answer"])
-
-	delete(m, "Answer")
-	fmt.Println("The value:", m["Answer"])
-
-	v, ok := m["Answer"]
-	fmt.Println("The value:", v, "Present?", ok)
-}
diff --git a/content/moretypes/nil-slices.go b/content/moretypes/nil-slices.go
deleted file mode 100644
index a317027..0000000
--- a/content/moretypes/nil-slices.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	var s []int
-	fmt.Println(s, len(s), cap(s))
-	if s == nil {
-		fmt.Println("nil!")
-	}
-}
diff --git a/content/moretypes/pointers.go b/content/moretypes/pointers.go
deleted file mode 100644
index 9909b3c..0000000
--- a/content/moretypes/pointers.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	i, j := 42, 2701
-
-	p := &i         // point to i
-	fmt.Println(*p) // read i through the pointer
-	*p = 21         // set i through the pointer
-	fmt.Println(i)  // see the new value of i
-
-	p = &j         // point to j
-	*p = *p / 37   // divide j through the pointer
-	fmt.Println(j) // see the new value of j
-}
diff --git a/content/moretypes/range-continued.go b/content/moretypes/range-continued.go
deleted file mode 100644
index feae06b..0000000
--- a/content/moretypes/range-continued.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	pow := make([]int, 10)
-	for i := range pow {
-		pow[i] = 1 << uint(i) // == 2**i
-	}
-	for _, value := range pow {
-		fmt.Printf("%d\n", value)
-	}
-}
diff --git a/content/moretypes/range.go b/content/moretypes/range.go
deleted file mode 100644
index 193c961..0000000
--- a/content/moretypes/range.go
+++ /dev/null
@@ -1,13 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-var pow = []int{1, 2, 4, 8, 16, 32, 64, 128}
-
-func main() {
-	for i, v := range pow {
-		fmt.Printf("2**%d = %d\n", i, v)
-	}
-}
diff --git a/content/moretypes/slice-bounds.go b/content/moretypes/slice-bounds.go
deleted file mode 100644
index 1ba3963..0000000
--- a/content/moretypes/slice-bounds.go
+++ /dev/null
@@ -1,18 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	s := []int{2, 3, 5, 7, 11, 13}
-
-	s = s[1:4]
-	fmt.Println(s)
-
-	s = s[:2]
-	fmt.Println(s)
-
-	s = s[1:]
-	fmt.Println(s)
-}
diff --git a/content/moretypes/slice-len-cap.go b/content/moretypes/slice-len-cap.go
deleted file mode 100644
index a1c5764..0000000
--- a/content/moretypes/slice-len-cap.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	s := []int{2, 3, 5, 7, 11, 13}
-	printSlice(s)
-
-	// Slice the slice to give it zero length.
-	s = s[:0]
-	printSlice(s)
-
-	// Extend its length.
-	s = s[:4]
-	printSlice(s)
-
-	// Drop its first two values.
-	s = s[2:]
-	printSlice(s)
-}
-
-func printSlice(s []int) {
-	fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s)
-}
diff --git a/content/moretypes/slice-literals.go b/content/moretypes/slice-literals.go
deleted file mode 100644
index 5a98010..0000000
--- a/content/moretypes/slice-literals.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	q := []int{2, 3, 5, 7, 11, 13}
-	fmt.Println(q)
-
-	r := []bool{true, false, true, true, false, true}
-	fmt.Println(r)
-
-	s := []struct {
-		i int
-		b bool
-	}{
-		{2, true},
-		{3, false},
-		{5, true},
-		{7, true},
-		{11, false},
-		{13, true},
-	}
-	fmt.Println(s)
-}
diff --git a/content/moretypes/slices-of-slice.go b/content/moretypes/slices-of-slice.go
deleted file mode 100644
index 8f5cbc8..0000000
--- a/content/moretypes/slices-of-slice.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"strings"
-)
-
-func main() {
-	// Create a tic-tac-toe board.
-	board := [][]string{
-		[]string{"_", "_", "_"},
-		[]string{"_", "_", "_"},
-		[]string{"_", "_", "_"},
-	}
-
-	// The players take turns.
-	board[0][0] = "X"
-	board[2][2] = "O"
-	board[1][2] = "X"
-	board[1][0] = "O"
-	board[0][2] = "X"
-
-	for i := 0; i < len(board); i++ {
-		fmt.Printf("%s\n", strings.Join(board[i], " "))
-	}
-}
diff --git a/content/moretypes/slices-pointers.go b/content/moretypes/slices-pointers.go
deleted file mode 100644
index 193b463..0000000
--- a/content/moretypes/slices-pointers.go
+++ /dev/null
@@ -1,23 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	names := [4]string{
-		"John",
-		"Paul",
-		"George",
-		"Ringo",
-	}
-	fmt.Println(names)
-
-	a := names[0:2]
-	b := names[1:3]
-	fmt.Println(a, b)
-
-	b[0] = "XXX"
-	fmt.Println(a, b)
-	fmt.Println(names)
-}
diff --git a/content/moretypes/slices.go b/content/moretypes/slices.go
deleted file mode 100644
index 7720f84..0000000
--- a/content/moretypes/slices.go
+++ /dev/null
@@ -1,12 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	primes := [6]int{2, 3, 5, 7, 11, 13}
-
-	var s []int = primes[1:4]
-	fmt.Println(s)
-}
diff --git a/content/moretypes/struct-fields.go b/content/moretypes/struct-fields.go
deleted file mode 100644
index b85607f..0000000
--- a/content/moretypes/struct-fields.go
+++ /dev/null
@@ -1,16 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X int
-	Y int
-}
-
-func main() {
-	v := Vertex{1, 2}
-	v.X = 4
-	fmt.Println(v.X)
-}
diff --git a/content/moretypes/struct-literals.go b/content/moretypes/struct-literals.go
deleted file mode 100644
index 5a96b2c..0000000
--- a/content/moretypes/struct-literals.go
+++ /dev/null
@@ -1,20 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X, Y int
-}
-
-var (
-	v1 = Vertex{1, 2}  // has type Vertex
-	v2 = Vertex{X: 1}  // Y:0 is implicit
-	v3 = Vertex{}      // X:0 and Y:0
-	p  = &Vertex{1, 2} // has type *Vertex
-)
-
-func main() {
-	fmt.Println(v1, p, v2, v3)
-}
diff --git a/content/moretypes/struct-pointers.go b/content/moretypes/struct-pointers.go
deleted file mode 100644
index 901f003..0000000
--- a/content/moretypes/struct-pointers.go
+++ /dev/null
@@ -1,17 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X int
-	Y int
-}
-
-func main() {
-	v := Vertex{1, 2}
-	p := &v
-	p.X = 1e9
-	fmt.Println(v)
-}
diff --git a/content/moretypes/structs.go b/content/moretypes/structs.go
deleted file mode 100644
index 253a4fd..0000000
--- a/content/moretypes/structs.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-type Vertex struct {
-	X int
-	Y int
-}
-
-func main() {
-	fmt.Println(Vertex{1, 2})
-}
diff --git a/content/welcome.article b/content/welcome.article
deleted file mode 100644
index e96256a..0000000
--- a/content/welcome.article
+++ /dev/null
@@ -1,107 +0,0 @@
-Welcome!
-Learn how to use this tour: including how to navigate the different lessons and how to run code.
-
-The Go Authors
-https://golang.org
-
-* Hello, 世界
-
-Welcome to a tour of the [[https://golang.org/][Go programming language]].
-
-The tour is divided into a list of modules that you can
-access by clicking on
-[[javascript:highlight(".logo")][A Tour of Go]] on the top left of the page.
-
-You can also view the table of contents at any time by clicking on the [[javascript:highlightAndClick(".nav")][menu]] on the top right of the page.
-
-Throughout the tour you will find a series of slides and exercises for you
-to complete.
-
-You can navigate through them using
-
-- [[javascript:highlight(".prev-page")]["previous"]] or `PageUp` to go to the previous page,
-
-- [[javascript:highlight(".next-page")]["next"]] or `PageDown` to go to the next page.
-
-The tour is interactive. Click the
-[[javascript:highlightAndClick("#run")][Run]] button now
-(or press `Shift` + `Enter`) to compile and run the program on
-#appengine: a remote server.
-your computer.
-The result is displayed below the code.
-
-These example programs demonstrate different aspects of Go. The programs in the tour are meant to be starting points for your own experimentation.
-
-Edit the program and run it again.
-
-When you click on [[javascript:highlightAndClick("#format")][Format]]
-(shortcut: `Ctrl` + `Enter`), the text in the editor is formatted using the
-[[https://golang.org/cmd/gofmt/][gofmt]] tool. You can switch syntax highlighting on and off
-by clicking on the [[javascript:highlightAndClick(".syntax-checkbox")][syntax]] button.
-
-When you're ready to move on, click the [[javascript:highlightAndClick(".next-page")][right arrow]] below or type the `PageDown` key.
-
-.play welcome/hello.go
-
-* Go local
-
-The tour is available in other languages:
-
-- [[https://go-tour-br.appspot.com/][Brazilian Portuguese — Português do Brasil]]
-- [[https://go-tour-ca.appspot.com/][Catalan — Català]]
-- [[https://tour.go-zh.org/][Simplified Chinese — 中文(简体)]]
-- [[https://go-tour-cz.appspot.com/][Czech — Česky]]
-- [[https://go-tour-fr.appspot.com/][French — Français]]
-- [[https://go-tour-id2.appspot.com/][Indonesian — Bahasa Indonesia]]
-- [[https://go-tour-jp.appspot.com/][Japanese — 日本語]]
-- [[https://go-tour-ko.appspot.com/][Korean — 한국어]]
-- [[https://go-tour-pl1.appspot.com/][Polish — Polski]]
-- [[https://go-tour-th.appspot.com/][Thai — ภาษาไทย]]
-- [[https://go-tour-uz.appspot.com/][Uzbek — Ўзбекча]]
-
-Click the [[javascript:highlightAndClick(".next-page")]["next"]] button or type `PageDown` to continue.
-
-#appengine: * Go offline (optional)
-#appengine:
-#appengine: This tour is also available as a stand-alone program that you can use
-#appengine: without access to the internet. It builds and runs the code samples on
-#appengine: your own machine.
-#appengine:
-#appengine: To run the tour locally, you'll need to first
-#appengine: [[https://golang.org/doc/install][install Go]] and then run:
-#appengine:
-#appengine:   go get golang.org/x/tour
-#appengine:
-#appengine: This will place a `tour` binary in your
-#appengine: [[https://golang.org/doc/code.html#Workspaces][workspace]]'s `bin` directory.
-#appengine: When you run the tour program, it will open a web browser displaying
-#appengine: your local version of the tour.
-#appengine:
-#appengine: Of course, you can continue to take the tour through this web site.
-
-#appengine: * The Go Playground
-#appengine:
-#appengine: This tour is built atop the [[https://play.golang.org/][Go Playground]], a
-#appengine: web service that runs on [[https://golang.org/][golang.org]]'s servers.
-#appengine:
-#appengine: The service receives a Go program, compiles, links, and runs the program inside
-#appengine: a sandbox, then returns the output.
-#appengine:
-#appengine: There are limitations to the programs that can be run in the playground:
-#appengine:
-#appengine: - In the playground the time begins at 2009-11-10 23:00:00 UTC (determining the significance of this date is an exercise for the reader). This makes it easier to cache programs by giving them deterministic output.
-#appengine:
-#appengine: - There are also limits on execution time and on CPU and memory usage, and the program cannot access external network hosts.
-#appengine:
-#appengine: The playground uses the latest stable release of Go.
-#appengine:
-#appengine: Read "[[https://blog.golang.org/playground][Inside the Go Playground]]" to learn more.
-#appengine:
-#appengine: .play welcome/sandbox.go
-
-* Congratulations
-
-You've finished the first module of the tour!
-
-Now click on [[javascript:highlightAndClick(".logo")][A Tour of Go]] to find out what else
-you can learn about Go, or go directly to the [[javascript:click('.next-page')][next lesson]].
diff --git a/content/welcome/hello.go b/content/welcome/hello.go
deleted file mode 100644
index b480451..0000000
--- a/content/welcome/hello.go
+++ /dev/null
@@ -1,9 +0,0 @@
-// +build OMIT
-
-package main
-
-import "fmt"
-
-func main() {
-	fmt.Println("Hello, 世界")
-}
diff --git a/content/welcome/sandbox.go b/content/welcome/sandbox.go
deleted file mode 100644
index 398a9ef..0000000
--- a/content/welcome/sandbox.go
+++ /dev/null
@@ -1,14 +0,0 @@
-// +build OMIT
-
-package main
-
-import (
-	"fmt"
-	"time"
-)
-
-func main() {
-	fmt.Println("Welcome to the playground!")
-
-	fmt.Println("The time is", time.Now())
-}
diff --git a/fmt.go b/fmt.go
deleted file mode 100644
index 0a0be16..0000000
--- a/fmt.go
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"bytes"
-	"encoding/json"
-	"go/ast"
-	"go/parser"
-	"go/printer"
-	"go/token"
-	"net/http"
-
-	"golang.org/x/tools/imports"
-)
-
-func init() {
-	http.HandleFunc("/fmt", fmtHandler)
-}
-
-type fmtResponse struct {
-	Body  string
-	Error string
-}
-
-func fmtHandler(w http.ResponseWriter, r *http.Request) {
-	resp := new(fmtResponse)
-	var body string
-	var err error
-	if r.FormValue("imports") == "true" {
-		var b []byte
-		b, err = imports.Process("prog.go", []byte(r.FormValue("body")), nil)
-		body = string(b)
-	} else {
-		body, err = gofmt(r.FormValue("body"))
-	}
-	if err != nil {
-		resp.Error = err.Error()
-	} else {
-		resp.Body = body
-	}
-	json.NewEncoder(w).Encode(resp)
-}
-
-func gofmt(body string) (string, error) {
-	fset := token.NewFileSet()
-	f, err := parser.ParseFile(fset, "prog.go", body, parser.ParseComments)
-	if err != nil {
-		return "", err
-	}
-	ast.SortImports(fset, f)
-	var buf bytes.Buffer
-	config := &printer.Config{Mode: printer.UseSpaces | printer.TabIndent, Tabwidth: 8}
-	err = config.Fprint(&buf, fset, f)
-	if err != nil {
-		return "", err
-	}
-	return buf.String(), nil
-}
diff --git a/go.mod b/go.mod
index ceb57a7..593d3e7 100644
--- a/go.mod
+++ b/go.mod
@@ -1,5 +1,3 @@
 module golang.org/x/tour
 
-go 1.11
-
-require golang.org/x/tools v0.1.3-0.20210525215409-a3eb095d6aee
+go 1.16
diff --git a/go.sum b/go.sum
deleted file mode 100644
index f2eedd1..0000000
--- a/go.sum
+++ /dev/null
@@ -1,29 +0,0 @@
-github.com/yuin/goldmark v1.3.5 h1:dPmz1Snjq0kmkz159iL7S6WzdahUTHnHB5M56WFVifs=
-github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
-golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
-golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
-golang.org/x/mod v0.4.2 h1:Gz96sIWK3OalVv/I/qNygP42zyoKp3xptRVCWRFEBvo=
-golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
-golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
-golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
-golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 h1:4nGaVu0QrbjT/AK2PRLuQfQuh6DJve+pELhqTdAj3x0=
-golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
-golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
-golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
-golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE=
-golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
-golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
-golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
-golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
-golang.org/x/tools v0.1.3-0.20210525215409-a3eb095d6aee h1:qoXIhA/wpnHg2z8RiA/rZb66+iiULmKyO9olVAU+GfU=
-golang.org/x/tools v0.1.3-0.20210525215409-a3eb095d6aee/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
-golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
-golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
diff --git a/gotour/main.go b/gotour/main.go
deleted file mode 100644
index b0b2d50..0000000
--- a/gotour/main.go
+++ /dev/null
@@ -1,15 +0,0 @@
-// Copyright 2018 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"io"
-	"os"
-)
-
-func main() {
-	io.WriteString(os.Stderr, "golang.org/x/tour/gotour has moved to golang.org/x/tour\n")
-	os.Exit(1)
-}
diff --git a/local.go b/local.go
deleted file mode 100644
index 076cf94..0000000
--- a/local.go
+++ /dev/null
@@ -1,227 +0,0 @@
-// Copyright 2011 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-package main
-
-import (
-	"encoding/json"
-	"flag"
-	"go/build"
-	"html/template"
-	"io"
-	"log"
-	"net"
-	"net/http"
-	"net/url"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"runtime"
-	"runtime/debug"
-	"strings"
-	"time"
-
-	"golang.org/x/tools/playground/socket"
-
-	// Imports so that go build/install automatically installs them.
-	_ "golang.org/x/tour/pic"
-	_ "golang.org/x/tour/tree"
-	_ "golang.org/x/tour/wc"
-)
-
-const (
-	socketPath = "/socket"
-)
-
-var (
-	httpListen  = flag.String("http", "127.0.0.1:3999", "host:port to listen on")
-	openBrowser = flag.Bool("openbrowser", true, "open browser automatically")
-)
-
-var (
-	httpAddr string
-)
-
-// isRoot reports whether path is the root directory of the tour tree.
-// To be the root, it must have content and template subdirectories.
-func isRoot(path string) bool {
-	_, err := os.Stat(filepath.Join(path, "content", "welcome.article"))
-	if err == nil {
-		_, err = os.Stat(filepath.Join(path, "template", "index.tmpl"))
-	}
-	return err == nil
-}
-
-// findRoot is a best-effort attempt to find a tour directory
-// that contains the files it needs. It may not always work.
-//
-// TODO: Delete after Go 1.17 is out and we can just use embed; see CL 291849.
-func findRoot() (string, bool) {
-	// Try finding the golang.org/x/tour package in the
-	// legacy GOPATH mode workspace or in build list.
-	p, err := build.Import("golang.org/x/tour", "", build.FindOnly)
-	if err == nil && isRoot(p.Dir) {
-		return p.Dir, true
-	}
-	// If that didn't work, perhaps we're not inside any module
-	// and the binary was built in module mode (e.g., 'go install
-	// golang.org/x/tour@latest' or 'go get golang.org/x/tour'
-	// outside a module).
-	// In that's the case, find out what version it is,
-	// and access its content from the module cache.
-	if info, ok := debug.ReadBuildInfo(); ok &&
-		info.Main.Path == "golang.org/x/tour" &&
-		info.Main.Replace == nil &&
-		info.Main.Version != "(devel)" {
-		// Make some assumptions for brevity:
-		// • the 'go' binary is in $PATH
-		// • the main module isn't replaced
-		// • the version isn't "(devel)"
-		// They should hold for the use cases we care about, until this
-		// entire mechanism is obsoleted by file embedding.
-		out, execError := exec.Command("go", "mod", "download", "-json", "--", "golang.org/x/tour@"+info.Main.Version).Output()
-		var tourRoot struct{ Dir string }
-		jsonError := json.Unmarshal(out, &tourRoot)
-		if execError == nil && jsonError == nil && isRoot(tourRoot.Dir) {
-			return tourRoot.Dir, true
-		}
-	}
-	return "", false
-}
-
-func main() {
-	flag.Parse()
-
-	if os.Getenv("GAE_ENV") == "standard" {
-		log.Println("running in App Engine Standard mode")
-		gaeMain()
-		return
-	}
-
-	// find and serve the go tour files
-	root, ok := findRoot()
-	if !ok {
-		log.Fatalln("Couldn't find files for the Go tour. Try reinstalling it.")
-	}
-
-	log.Println("Serving content from", root)
-
-	host, port, err := net.SplitHostPort(*httpListen)
-	if err != nil {
-		log.Fatal(err)
-	}
-	if host == "" {
-		host = "localhost"
-	}
-	if host != "127.0.0.1" && host != "localhost" {
-		log.Print(localhostWarning)
-	}
-	httpAddr = host + ":" + port
-
-	if err := initTour(root, "SocketTransport"); err != nil {
-		log.Fatal(err)
-	}
-
-	http.HandleFunc("/", rootHandler)
-	http.HandleFunc("/lesson/", lessonHandler)
-
-	origin := &url.URL{Scheme: "http", Host: host + ":" + port}
-	http.Handle(socketPath, socket.NewHandler(origin))
-
-	registerStatic(root)
-
-	go func() {
-		url := "http://" + httpAddr
-		if waitServer(url) && *openBrowser && startBrowser(url) {
-			log.Printf("A browser window should open. If not, please visit %s", url)
-		} else {
-			log.Printf("Please open your web browser and visit %s", url)
-		}
-	}()
-	log.Fatal(http.ListenAndServe(httpAddr, nil))
-}
-
-// registerStatic registers handlers to serve static content
-// from the directory root.
-func registerStatic(root string) {
-	// Keep these static file handlers in sync with app.yaml.
-	http.Handle("/favicon.ico", http.FileServer(http.Dir(filepath.Join(root, "static", "img"))))
-	static := http.FileServer(http.Dir(root))
-	http.Handle("/content/img/", static)
-	http.Handle("/static/", static)
-}
-
-// rootHandler returns a handler for all the requests except the ones for lessons.
-func rootHandler(w http.ResponseWriter, r *http.Request) {
-	if err := renderUI(w); err != nil {
-		log.Println(err)
-	}
-}
-
-// lessonHandler handler the HTTP requests for lessons.
-func lessonHandler(w http.ResponseWriter, r *http.Request) {
-	lesson := strings.TrimPrefix(r.URL.Path, "/lesson/")
-	if err := writeLesson(lesson, w); err != nil {
-		if err == lessonNotFound {
-			http.NotFound(w, r)
-		} else {
-			log.Println(err)
-		}
-	}
-}
-
-const localhostWarning = `
-WARNING!  WARNING!  WARNING!
-
-The tour server appears to be listening on an address that is
-not localhost and is configured to run code snippets locally.
-Anyone with access to this address and port will have access
-to this machine as the user running gotour.
-
-If you don't understand this message, hit Control-C to terminate this process.
-
-WARNING!  WARNING!  WARNING!
-`
-
-// waitServer waits some time for the http Server to start
-// serving url. The return value reports whether it starts.
-func waitServer(url string) bool {
-	tries := 20
-	for tries > 0 {
-		resp, err := http.Get(url)
-		if err == nil {
-			resp.Body.Close()
-			return true
-		}
-		time.Sleep(100 * time.Millisecond)
-		tries--
-	}
-	return false
-}
-
-// startBrowser tries to open the URL in a browser, and returns
-// whether it succeed.
-func startBrowser(url string) bool {
-	// try to start the browser
-	var args []string
-	switch runtime.GOOS {
-	case "darwin":
-		args = []string{"open"}
-	case "windows":
-		args = []string{"cmd", "/c", "start"}
-	default:
-		args = []string{"xdg-open"}
-	}
-	cmd := exec.Command(args[0], append(args[1:], url)...)
-	return cmd.Start() == nil
-}
-
-// prepContent for the local tour simply returns the content as-is.
-var prepContent = func(r io.Reader) io.Reader { return r }
-
-// socketAddr returns the WebSocket handler address.
-var socketAddr = func() string { return "ws://" + httpAddr + socketPath }
-
-// analyticsHTML is optional analytics HTML to insert at the beginning of <head>.
-var analyticsHTML template.HTML
diff --git a/solutions/README b/solutions/README
deleted file mode 100644
index 4915dc7..0000000
--- a/solutions/README
+++ /dev/null
@@ -1,8 +0,0 @@
-This directory contains the solutions to the exercises presented in the Go tour.
-
-IMPORTANT: The main point of the Go tour is to challenge you, so please try to
-solve all problems by yourself before reading these solutions!!!
-
-In any case, these are not the only valid solutions. But they have been reviewed
-by the Go team. Therefore you can use them as a guide on how to solve the
-most basic problems in Go.
diff --git a/solutions/binarytrees.go b/solutions/binarytrees.go
deleted file mode 100644
index 2ba3604..0000000
--- a/solutions/binarytrees.go
+++ /dev/null
@@ -1,68 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-
-	"golang.org/x/tour/tree"
-)
-
-func walkImpl(t *tree.Tree, ch chan int) {
-	if t == nil {
-		return
-	}
-	walkImpl(t.Left, ch)
-	ch <- t.Value
-	walkImpl(t.Right, ch)
-}
-
-// Walk walks the tree t sending all values
-// from the tree to the channel ch.
-func Walk(t *tree.Tree, ch chan int) {
-	walkImpl(t, ch)
-	// Need to close the channel here
-	close(ch)
-}
-
-// Same determines whether the trees
-// t1 and t2 contain the same values.
-// NOTE: The implementation leaks goroutines when trees are different.
-// See binarytrees_quit.go for a better solution.
-func Same(t1, t2 *tree.Tree) bool {
-	w1, w2 := make(chan int), make(chan int)
-
-	go Walk(t1, w1)
-	go Walk(t2, w2)
-
-	for {
-		v1, ok1 := <-w1
-		v2, ok2 := <-w2
-		if !ok1 || !ok2 {
-			return ok1 == ok2
-		}
-		if v1 != v2 {
-			return false
-		}
-	}
-}
-
-func main() {
-	fmt.Print("tree.New(1) == tree.New(1): ")
-	if Same(tree.New(1), tree.New(1)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-
-	fmt.Print("tree.New(1) != tree.New(2): ")
-	if !Same(tree.New(1), tree.New(2)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-}
diff --git a/solutions/binarytrees_quit.go b/solutions/binarytrees_quit.go
deleted file mode 100644
index 076bd66..0000000
--- a/solutions/binarytrees_quit.go
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright 2015 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-
-	"golang.org/x/tour/tree"
-)
-
-func walkImpl(t *tree.Tree, ch, quit chan int) {
-	if t == nil {
-		return
-	}
-	walkImpl(t.Left, ch, quit)
-	select {
-	case ch <- t.Value:
-		// Value successfully sent.
-	case <-quit:
-		return
-	}
-	walkImpl(t.Right, ch, quit)
-}
-
-// Walk walks the tree t sending all values
-// from the tree to the channel ch.
-func Walk(t *tree.Tree, ch, quit chan int) {
-	walkImpl(t, ch, quit)
-	close(ch)
-}
-
-// Same determines whether the trees
-// t1 and t2 contain the same values.
-func Same(t1, t2 *tree.Tree) bool {
-	w1, w2 := make(chan int), make(chan int)
-	quit := make(chan int)
-	defer close(quit)
-
-	go Walk(t1, w1, quit)
-	go Walk(t2, w2, quit)
-
-	for {
-		v1, ok1 := <-w1
-		v2, ok2 := <-w2
-		if !ok1 || !ok2 {
-			return ok1 == ok2
-		}
-		if v1 != v2 {
-			return false
-		}
-	}
-}
-
-func main() {
-	fmt.Print("tree.New(1) == tree.New(1): ")
-	if Same(tree.New(1), tree.New(1)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-
-	fmt.Print("tree.New(1) != tree.New(2): ")
-	if !Same(tree.New(1), tree.New(2)) {
-		fmt.Println("PASSED")
-	} else {
-		fmt.Println("FAILED")
-	}
-}
diff --git a/solutions/errors.go b/solutions/errors.go
deleted file mode 100644
index e8de49e..0000000
--- a/solutions/errors.go
+++ /dev/null
@@ -1,40 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-type ErrNegativeSqrt float64
-
-func (e ErrNegativeSqrt) Error() string {
-	return fmt.Sprintf("Sqrt: negative number %g", e)
-}
-
-const delta = 1e-10
-
-func Sqrt(f float64) (float64, error) {
-	if f < 0 {
-		return 0, ErrNegativeSqrt(f)
-	}
-	z := f
-	for {
-		n := z - (z*z-f)/(2*z)
-		if math.Abs(n-z) < delta {
-			break
-		}
-		z = n
-	}
-	return z, nil
-}
-
-func main() {
-	fmt.Println(Sqrt(2))
-	fmt.Println(Sqrt(-2))
-}
diff --git a/solutions/fib.go b/solutions/fib.go
deleted file mode 100644
index 0f3959a..0000000
--- a/solutions/fib.go
+++ /dev/null
@@ -1,26 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "fmt"
-
-// fibonacci is a function that returns
-// a function that returns an int.
-func fibonacci() func() int {
-	f, g := 1, 0
-	return func() int {
-		f, g = g, f+g
-		return f
-	}
-}
-
-func main() {
-	f := fibonacci()
-	for i := 0; i < 10; i++ {
-		fmt.Println(f())
-	}
-}
diff --git a/solutions/http.go b/solutions/http.go
deleted file mode 100644
index 9fe3d5f..0000000
--- a/solutions/http.go
+++ /dev/null
@@ -1,38 +0,0 @@
-// Copyright 2014 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-	"log"
-	"net/http"
-)
-
-type String string
-
-func (s String) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	fmt.Fprint(w, s)
-}
-
-type Struct struct {
-	Greeting string
-	Punct    string
-	Who      string
-}
-
-func (s *Struct) ServeHTTP(w http.ResponseWriter, r *http.Request) {
-	fmt.Fprintf(w, "%s%s %s", s.Greeting, s.Punct, s.Who)
-}
-
-func main() {
-	http.Handle("/string", String("I'm a frayed knot."))
-	http.Handle("/struct", &Struct{"Hello", ":", "Gophers!"})
-	err := http.ListenAndServe("localhost:4000", nil)
-	if err != nil {
-		log.Fatal(err)
-	}
-}
diff --git a/solutions/image.go b/solutions/image.go
deleted file mode 100644
index 60d9c5e..0000000
--- a/solutions/image.go
+++ /dev/null
@@ -1,36 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"image"
-	"image/color"
-
-	"golang.org/x/tour/pic"
-)
-
-type Image struct {
-	Height, Width int
-}
-
-func (m Image) ColorModel() color.Model {
-	return color.RGBAModel
-}
-
-func (m Image) Bounds() image.Rectangle {
-	return image.Rect(0, 0, m.Height, m.Width)
-}
-
-func (m Image) At(x, y int) color.Color {
-	c := uint8(x ^ y)
-	return color.RGBA{c, c, 255, 255}
-}
-
-func main() {
-	m := Image{256, 256}
-	pic.ShowImage(m)
-}
diff --git a/solutions/loops.go b/solutions/loops.go
deleted file mode 100644
index 296138f..0000000
--- a/solutions/loops.go
+++ /dev/null
@@ -1,29 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"fmt"
-	"math"
-)
-
-const delta = 1e-6
-
-func Sqrt(x float64) float64 {
-	z := x
-	n := 0.0
-	for math.Abs(n-z) > delta {
-		n, z = z, z-(z*z-x)/(2*z)
-	}
-	return z
-}
-
-func main() {
-	const x = 2
-	mine, theirs := Sqrt(x), math.Sqrt(x)
-	fmt.Println(mine, theirs, mine-theirs)
-}
diff --git a/solutions/maps.go b/solutions/maps.go
deleted file mode 100644
index ddd6b52..0000000
--- a/solutions/maps.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"strings"
-
-	"golang.org/x/tour/wc"
-)
-
-func WordCount(s string) map[string]int {
-	m := make(map[string]int)
-	for _, f := range strings.Fields(s) {
-		m[f]++
-	}
-	return m
-}
-
-func main() {
-	wc.Test(WordCount)
-}
diff --git a/solutions/readers.go b/solutions/readers.go
deleted file mode 100644
index 278cd65..0000000
--- a/solutions/readers.go
+++ /dev/null
@@ -1,22 +0,0 @@
-// Copyright 2017 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "golang.org/x/tour/reader"
-
-type MyReader struct{}
-
-func (r MyReader) Read(b []byte) (int, error) {
-	for i := range b {
-		b[i] = 'A'
-	}
-	return len(b), nil
-}
-
-func main() {
-	reader.Validate(MyReader{})
-}
diff --git a/solutions/rot13.go b/solutions/rot13.go
deleted file mode 100644
index 84315a4..0000000
--- a/solutions/rot13.go
+++ /dev/null
@@ -1,45 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"io"
-	"os"
-	"strings"
-)
-
-func rot13(b byte) byte {
-	var a, z byte
-	switch {
-	case 'a' <= b && b <= 'z':
-		a, z = 'a', 'z'
-	case 'A' <= b && b <= 'Z':
-		a, z = 'A', 'Z'
-	default:
-		return b
-	}
-	return (b-a+13)%(z-a+1) + a
-}
-
-type rot13Reader struct {
-	r io.Reader
-}
-
-func (r rot13Reader) Read(p []byte) (n int, err error) {
-	n, err = r.r.Read(p)
-	for i := 0; i < n; i++ {
-		p[i] = rot13(p[i])
-	}
-	return
-}
-
-func main() {
-	s := strings.NewReader(
-		"Lbh penpxrq gur pbqr!")
-	r := rot13Reader{s}
-	io.Copy(os.Stdout, &r)
-}
diff --git a/solutions/slices.go b/solutions/slices.go
deleted file mode 100644
index 37bf9b3..0000000
--- a/solutions/slices.go
+++ /dev/null
@@ -1,28 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "golang.org/x/tour/pic"
-
-func Pic(dx, dy int) [][]uint8 {
-	p := make([][]uint8, dy)
-	for i := range p {
-		p[i] = make([]uint8, dx)
-	}
-
-	for y, row := range p {
-		for x := range row {
-			row[x] = uint8(x * y)
-		}
-	}
-
-	return p
-}
-
-func main() {
-	pic.Show(Pic)
-}
diff --git a/solutions/stringers.go b/solutions/stringers.go
deleted file mode 100644
index 7462f4c..0000000
--- a/solutions/stringers.go
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright 2015 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import "fmt"
-
-type IPAddr [4]byte
-
-func (ip IPAddr) String() string {
-	return fmt.Sprintf("%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3])
-}
-
-func main() {
-	addrs := map[string]IPAddr{
-		"loopback":  {127, 0, 0, 1},
-		"googleDNS": {8, 8, 8, 8},
-	}
-	for n, a := range addrs {
-		fmt.Printf("%v: %v\n", n, a)
-	}
-}
diff --git a/solutions/webcrawler.go b/solutions/webcrawler.go
deleted file mode 100644
index 89b86a8..0000000
--- a/solutions/webcrawler.go
+++ /dev/null
@@ -1,137 +0,0 @@
-// Copyright 2012 The Go Authors.  All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// +build ignore
-
-package main
-
-import (
-	"errors"
-	"fmt"
-	"sync"
-)
-
-type Fetcher interface {
-	// Fetch returns the body of URL and
-	// a slice of URLs found on that page.
-	Fetch(url string) (body string, urls []string, err error)
-}
-
-// fetched tracks URLs that have been (or are being) fetched.
-// The lock must be held while reading from or writing to the map.
-// See https://golang.org/ref/spec#Struct_types section on embedded types.
-var fetched = struct {
-	m map[string]error
-	sync.Mutex
-}{m: make(map[string]error)}
-
-var loading = errors.New("url load in progress") // sentinel value
-
-// Crawl uses fetcher to recursively crawl
-// pages starting with url, to a maximum of depth.
-func Crawl(url string, depth int, fetcher Fetcher) {
-	if depth <= 0 {
-		fmt.Printf("<- Done with %v, depth 0.\n", url)
-		return
-	}
-
-	fetched.Lock()
-	if _, ok := fetched.m[url]; ok {
-		fetched.Unlock()
-		fmt.Printf("<- Done with %v, already fetched.\n", url)
-		return
-	}
-	// We mark the url to be loading to avoid others reloading it at the same time.
-	fetched.m[url] = loading
-	fetched.Unlock()
-
-	// We load it concurrently.
-	body, urls, err := fetcher.Fetch(url)
-
-	// And update the status in a synced zone.
-	fetched.Lock()
-	fetched.m[url] = err
-	fetched.Unlock()
-
-	if err != nil {
-		fmt.Printf("<- Error on %v: %v\n", url, err)
-		return
-	}
-	fmt.Printf("Found: %s %q\n", url, body)
-	done := make(chan bool)
-	for i, u := range urls {
-		fmt.Printf("-> Crawling child %v/%v of %v : %v.\n", i, len(urls), url, u)
-		go func(url string) {
-			Crawl(url, depth-1, fetcher)
-			done <- true
-		}(u)
-	}
-	for i, u := range urls {
-		fmt.Printf("<- [%v] %v/%v Waiting for child %v.\n", url, i, len(urls), u)
-		<-done
-	}
-	fmt.Printf("<- Done with %v\n", url)
-}
-
-func main() {
-	Crawl("https://golang.org/", 4, fetcher)
-
-	fmt.Println("Fetching stats\n--------------")
-	for url, err := range fetched.m {
-		if err != nil {
-			fmt.Printf("%v failed: %v\n", url, err)
-		} else {
-			fmt.Printf("%v was fetched\n", url)
-		}
-	}
-}
-
-// fakeFetcher is Fetcher that returns canned results.
-type fakeFetcher map[string]*fakeResult
-
-type fakeResult struct {
-	body string
-	urls []string
-}
-
-func (f *fakeFetcher) Fetch(url string) (string, []string, error) {
-	if res, ok := (*f)[url]; ok {
-		return res.body, res.urls, nil
-	}
-	return "", nil, fmt.Errorf("not found: %s", url)
-}
-
-// fetcher is a populated fakeFetcher.
-var fetcher = &fakeFetcher{
-	"https://golang.org/": &fakeResult{
-		"The Go Programming Language",
-		[]string{
-			"https://golang.org/pkg/",
-			"https://golang.org/cmd/",
-		},
-	},
-	"https://golang.org/pkg/": &fakeResult{
-		"Packages",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/cmd/",
-			"https://golang.org/pkg/fmt/",
-			"https://golang.org/pkg/os/",
-		},
-	},
-	"https://golang.org/pkg/fmt/": &fakeResult{
-		"Package fmt",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-	"https://golang.org/pkg/os/": &fakeResult{
-		"Package os",
-		[]string{
-			"https://golang.org/",
-			"https://golang.org/pkg/",
-		},
-	},
-}
diff --git a/static/css/app.css b/static/css/app.css
deleted file mode 100755
index e2f2ffd..0000000
--- a/static/css/app.css
+++ /dev/null
@@ -1,529 +0,0 @@
-/* Generic elements */
-html, body {
-    margin: 0;
-    padding: 0;
-    font-size: 16px;
-    height: 100%;
-    font-family: sans-serif;
-    line-height: 24px;
-    word-wrap: break-word;
-    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-    /* Prevent font scaling in landscape */
-    -webkit-text-size-adjust: none;
-    -webkit-font-smoothing: antialiased;
-}
-* {
-    outline: none;
-}
-a {
-    color: #375eab;
-    text-decoration: none;
-}
-a.logo, .toc a {
-    color: inherit;
-}
-h1, h2, h3, h4 {
-    color: #333;
-    line-height: 32px;
-    margin: 0;
-}
-pre, code {
-    font-family: 'Inconsolata', monospace;
-    border-radius: 4px;
-    color: #333;
-    background-color: #fafafa;
-}
-pre {
-    padding: 10px;
-}
-code {
-    padding: 2px;
-}
-.left {
-    display: block;
-    float: left;
-    margin-right: 10px;
-}
-.right {
-    display: block;
-    float: right;
-    margin-left: 10px;
-}
-.bar {
-    display: block;
-    overflow: hidden;
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-.wrapper {
-    position: fixed;
-    overflow: auto;
-    top: 48px;
-    bottom: 0;
-    left: 0;
-    right: 0;
-}
-.container {
-    max-width: 800px;
-    width: 90%;
-    margin: 0 auto 36px auto;
-    padding: 16px 5%;
-    background: #ffffff;
-}
-.container a {
-    color: #375eab;
-}
-.relative-content {
-    display: block;
-    position: relative;
-    height: 100%;
-}
-.highlight {
-    background: #b5533b !important;
-    color: yellow !important;
-}
-.hidden {
-    display: none;
-}
-p {
-    margin: 16px 0;
-}
-li {
-    margin: 8px 0;
-}
-ul {
-    list-style: none;
-    margin: 0;
-    padding-left: 32px;
-}
-/* Navigation bars */
-.top-bar {
-    position: fixed;
-    left: 0;
-    right: 0;
-    top: 0;
-    z-index: 1000;
-    font-size: 1.4em;
-    padding: 8px 24px;
-    line-height: 32px;
-    color: #222;
-    background: #E0EBF5;
-}
-.nav {
-    float: right;
-    padding: 2px;
-    height: 25px;
-    width: 25px;
-    margin-left: 10px;
-    cursor: pointer;
-    fill: #375eab;
-}
-.nav:hover {
-    fill: #ffffff;
-}
-/* Module list */
-.page-header {
-    font-size: 1.2em;
-    line-height: 32px;
-    margin: 32px 0;
-}
-@media (max-width: 515px) {
-    .page-header {
-        font-size: 0.75em;
-    }
-}
-.module {
-    margin: 32px 0;
-}
-.module-title {
-    font-size: 1.3em;
-    font-weight: bold;
-    color: #333;
-    margin: 0;
-}
-.lesson {
-    background: #E0EBF5;
-    padding: 8px 16px;
-    margin: 16px 0;
-    position: relative;
-}
-.lesson-title {
-    display: inline-block;
-    font-size: 1.2em;
-    font-weight: bold;
-    margin: 16px 0 0 0;
-    padding-right: 48px;
-}
-/* Lesson viewer */
-.slide-content {
-    padding: 16px;
-    background: #fff;
-}
-.module-bar {
-    font-size: 1.5em;
-    padding: 8px 0;
-    text-align: center;
-    line-height: 24px;
-    font-size: 24px;
-}
-.module-bar a {
-    color: #375eab;
-    position: relative;
-    font-weight: bold;
-    margin: 5px;
-}
-.menu-button {
-    display: inline-block;
-    text-decoration: none;
-    cursor: pointer;
-    font-size: 0.9em;
-    border-radius: 2px;
-    background-color: #E0EBF5;
-    border: 1px solid rgba(0, 0, 0, 0.1);
-    margin: 2px;
-    height: 24px;
-    padding: 1px 8px;
-    line-height: 24px;
-    color: #444;
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-.menu-button:hover:not(.active) {
-    border: 1px solid #C6C6C6;
-    background-color: #fafafa;
-}
-.menu-button.active {
-    background: #fff;
-}
-.menu-button[imports-checkbox]:after {
-    content: ' off';
-}
-.menu-button[imports-checkbox].active:after {
-    content: ' on';
-}
-.menu-button[syntax-checkbox]:after {
-    content: ' off';
-}
-.menu-button[syntax-checkbox].active:after {
-    content: ' on';
-}
-#file-menu .menu-button {
-    float: right;
-}
-a#run, a#kill {
-    background-color: #375eab;
-    color: #fff;
-    width: 40px;
-    text-align: center;
-}
-#run:hover:not(:active), #kill:hover:not(:active) {
-    background-color: #fff;
-    color: #375eab;
-}
-.output:not(.active) {
-    display: none;
-}
-.output > pre {
-    font-family: 'Inconsolata', monospace;
-    background: #fafafa;
-    margin: 0;
-}
-.output .system {
-    color: #888;
-}
-.output .stderr {
-    color: #D00A0A;
-}
-.output-menu .menu-button {
-    float: left;
-}
-.output-menu, #file-menu {
-    background: #fafafa;
-}
-#explorer {
-    height: 32px;
-    padding-left: 30px;
-    background: #fafafa;
-}
-#explorer .imports-checkbox {
-    float: right;
-}
-#explorer .menu-button.active {
-    cursor: default;
-}
-#explorer .syntax-checkbox {
-    float: right;
-}
-/* CodeMirror */
-#file-editor {
-    background: #FFFFD8;
-    overflow: auto;
-}
-#file-editor > textarea {
-    display: none;
-}
-#file-editor .CodeMirror {
-    height: 100%;
-    background: #FFFFD8;
-}
-#file-editor .CodeMirror-lines, #file-editor .CodeMirror-gutters {
-    background: #FFFFD8;
-    font-family: 'Inconsolata', monospace;
-    line-height: 1.2em;
-}
-.CodeMirror-code > .line-error {
-    background: #FF8080;
-}
-.CodeMirror-code > .line-error .CodeMirror-linenumber {
-    color: #FF5555;
-    font-weight: bolder;
-}
-#file-editor .CodeMirror-gutters {
-    width: 32px;
-}
-@media (min-width: 601px) {
-    #editor-container {
-        position: fixed;
-        top: 48px;
-        left: 0px;
-        right: 0px;
-        bottom: 0px;
-        overflow: hidden;
-        background: #fff;
-    }
-    #left-side {
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        left: 0;
-        width: 50%;
-        overflow: hidden;
-    }
-    .output {
-        background-image: url(/static/img/gopher.png);
-        background-repeat: no-repeat;
-        background-position: bottom;
-        background-color: #fff;
-    }
-    div[vertical-slide] {
-        position: absolute;
-        top: 0px;
-        bottom: 0px;
-        width: 5px;
-        background: #e0ebf5;
-        left: 50%;
-        right: 50%;
-        z-index: 100;
-        cursor: move;
-    }
-    #right-side {
-        position: absolute;
-        top: 0;
-        bottom: 0;
-        right: 0;
-        left: 50%;
-        background: #fff;
-    }
-    .slide-content {
-        position: absolute;
-        left: 0;
-        right: 0;
-        top: 0;
-        bottom: 30px;
-        overflow: auto;
-    }
-    .module-bar {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        padding: 4px 0;
-        margin: 0;
-    }
-    #top-part {
-        position: absolute;
-        left: 0;
-        right: 0;
-        top: 0;
-        bottom: 33%;
-        background: #e0ebf5;
-    }
-    #file-editor {
-        position: absolute;
-        left: 0;
-        right: 0;
-        top: 0;
-        bottom: 0;
-    }
-    div[horizontal-slide] {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 33%;
-        height: 5px;
-        background: #e0ebf5;
-        z-index: 100;
-        cursor: move;
-    }
-    #bottom-part {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        top: 67%;
-        min-height: 100px;
-        z-index: 50;
-    }
-    #explorer {
-        position: absolute;
-        top: 0;
-        left: 0;
-        right: 0;
-    }
-    #explorer + div {
-        top: 32px;
-    }
-    #file-menu {
-        position: absolute;
-        top: 0;
-        right: 0;
-        left: 0;
-        background: #fafafa;
-    }
-    .output {
-        position: absolute;
-        top: 34px;
-        bottom: 0;
-        left: 0;
-        right: 0;
-        margin: 0;
-        padding: 0;
-        overflow: auto;
-    }
-}
-@media (max-width: 600px) {
-    #top-part {
-        border: 1px solid #ccc;
-    }
-    #left-side {
-        background: #e0ebf5;
-    }
-    #right-side {
-        padding-top: 48px;
-    }
-    #file-menu {
-        height: 32px;
-    }
-    .output {
-        background: white;
-        max-height: 300px;
-        overflow: auto;
-    }
-    #editor-container {
-        padding-bottom: 40px;
-    }
-    .module-bar {
-        position: fixed;
-        background: #e0ebf5;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        z-index: 10;
-        height: 42px;
-        padding: 0;
-        overflow: hidden;
-        text-align: center;
-    }
-    .module-bar * {
-        display: inline-block;
-        width: 25%;
-        font-size: 1.1em;
-        padding: 8px 0;
-    }
-    div[horizontal-slide], div[vertical-slide] {
-        display: none;
-    }
-}
-/* Table of contents */
-.toc {
-    display: none;
-    position: fixed;
-    z-index: 200;
-    font-size: 1.3em;
-    top: 48px;
-    bottom: 0;
-    right: 0;
-    width: 500px;
-    background: #e0ebf5;
-    color: black;
-    overflow-y: auto;
-    padding: 0;
-    margin: 0;
-    border-left: 4px solid #e0ebf5;
-    border-bottom: 4px solid #e0ebf5;
-    -moz-user-select: none;
-    -webkit-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-}
-.click-catcher {
-    position: fixed;
-    z-index: -100;
-    top: 0;
-    bottom: 0;
-    left: 0;
-    right: 10px; /* avoid covering the TOC scroller */
-    background: rgba(0, 0, 0, 0);
-}
-.toc * {
-    margin: 0;
-    padding: 0;
-    font-size: 0.95em;
-    display: block;
-}
-.toc span, .toc a {
-    padding: 4px;
-}
-.toc-module {
-    color: #375eab;
-    background: #e0ebf5;
-}
-.toc-lesson {
-    background: #fafafa;
-    color: #333;
-    margin: 1px 0;
-    cursor: pointer;
-}
-.toc-page {
-    background: #fff;
-    color: #333;
-    padding-left: 4px;
-    display: list-item;
-}
-.toc-lesson.active .toc-page {
-    display: list-item;
-}
-.toc-page.active {
-    color: #375eab;
-    font-weight: bold;
-}
-@media (max-width: 600px) {
-    .toc {
-        position: absolute;
-        left: 0;
-        right: 0;
-        bottom: 0;
-        width: 100%;
-        border: none;
-    }
-    .toc ul {
-        width: 100%;
-    }
-    .click-catcher {
-        display: none;
-    }
-}
diff --git a/static/img/favicon.ico b/static/img/favicon.ico
deleted file mode 100644
index 8d22584..0000000
--- a/static/img/favicon.ico
+++ /dev/null
Binary files differ
diff --git a/static/img/gopher.png b/static/img/gopher.png
deleted file mode 100644
index 11d01ae..0000000
--- a/static/img/gopher.png
+++ /dev/null
Binary files differ
diff --git a/static/js/app.js b/static/js/app.js
deleted file mode 100755
index 7127bfc..0000000
--- a/static/js/app.js
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-angular.module('tour', ['ui', 'tour.services', 'tour.controllers', 'tour.directives', 'tour.values', 'ng']).
-
-config(['$routeProvider', '$locationProvider',
-    function($routeProvider, $locationProvider) {
-        $routeProvider.
-        when('/', {
-            redirectTo: '/welcome/1'
-        }).
-        when('/list', {
-            templateUrl: '/static/partials/list.html',
-        }).
-        when('/:lessonId/:pageNumber', {
-            templateUrl: '/static/partials/editor.html',
-            controller: 'EditorCtrl'
-        }).
-        when('/:lessonId', {
-            redirectTo: '/:lessonId/1'
-        }).
-        otherwise({
-            redirectTo: '/'
-        });
-
-        $locationProvider.html5Mode(true).hashPrefix('!');
-    }
-]).
-
-// handle mapping from old paths (#42) to the new organization.
-run(function($rootScope, $location, mapping) {
-    $rootScope.$on( "$locationChangeStart", function(event, next) {
-        var url = document.createElement('a');
-        url.href = next; 
-        if (url.pathname != '/' || url.hash == '') {
-            return;
-        }
-        $location.hash('');
-        var m = mapping[url.hash];
-        if (m === undefined) {
-            console.log('unknown url, redirecting home');
-            $location.path('/welcome/1');
-            return;
-        }
-        $location.path(m);
-    });         
-});
diff --git a/static/js/controllers.js b/static/js/controllers.js
deleted file mode 100755
index f3b9cf7..0000000
--- a/static/js/controllers.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-/* Controllers */
-
-
-angular.module('tour.controllers', []).
-
-// Navigation controller
-controller('EditorCtrl', ['$scope', '$routeParams', '$location', 'toc', 'i18n', 'run', 'fmt', 'editor', 'analytics', 'storage',
-    function($scope, $routeParams, $location, toc, i18n, run, fmt, editor, analytics, storage) {
-        var lessons = [];
-        toc.lessons.then(function(v) {
-            lessons = v;
-            $scope.gotoPage($scope.curPage);
-
-            // Store changes on the current file to local storage.
-            $scope.$watch(function() {
-                var f = file();
-                return f && f.Content;
-            }, function(val) {
-                if (val) storage.set(file().Hash, val);
-            });
-        });
-
-        $scope.toc = toc;
-        $scope.lessonId = $routeParams.lessonId;
-        $scope.curPage = parseInt($routeParams.pageNumber);
-        $scope.curFile = 0;
-        $scope.job = null;
-
-        $scope.nextPageClick = function(event) {
-            event.preventDefault();
-            $scope.nextPage();
-        };
-        $scope.prevPageClick = function(event) {
-            event.preventDefault();
-            $scope.prevPage();
-        };
-        $scope.nextPage = function() {
-            $scope.gotoPage($scope.curPage + 1);
-        };
-        $scope.prevPage = function() {
-            $scope.gotoPage($scope.curPage - 1);
-        };
-        $scope.gotoPage = function(page) {
-            $scope.kill();
-            var l = $routeParams.lessonId;
-            if (page >= 1 && page <= lessons[$scope.lessonId].Pages.length) {
-                $scope.curPage = page;
-            } else {
-                l = (page < 1) ? toc.prevLesson(l) : toc.nextLesson(l);
-                if (l === '') { // If there's not previous or next
-                    $location.path('/list');
-                    return;
-                }
-                page = (page < 1) ? lessons[l].Pages.length : 1;
-            }
-            $location.path('/' + l + '/' + page);
-            $scope.openFile($scope.curFile);
-            analytics.trackView();
-        };
-        $scope.openFile = function(file) {
-            $scope.curFile = file;
-            editor.paint();
-        };
-
-        function log(mode, text) {
-            $('.output.active').html('<pre class="' + mode + '">' + text + '</pre>');
-        }
-
-        function clearOutput() {
-            $('.output.active').html('');
-        }
-
-        function file() {
-            return lessons[$scope.lessonId].Pages[$scope.curPage - 1].Files[$scope.curFile];
-        }
-
-        $scope.run = function() {
-            log('info', i18n.l('waiting'));
-            var f = file();
-            $scope.job = run(f.Content, $('.output.active > pre')[0], {
-                path: f.Name
-            }, function() {
-                $scope.job = null;
-                $scope.$apply();
-            });
-        };
-
-        $scope.kill = function() {
-            if ($scope.job !== null) $scope.job.Kill();
-        };
-
-        $scope.format = function() {
-            log('info', i18n.l('waiting'));
-            fmt(file().Content, editor.imports).then(
-                function(data) {
-                    if (data.data.Error !== '') {
-                        log('stderr', data.data.Error);
-                        return;
-                    }
-                    clearOutput();
-                    file().Content = data.data.Body;
-                },
-                function(error) {
-                    log('stderr', error);
-                });
-        };
-
-        $scope.reset = function() {
-            file().Content = file().OrigContent;
-        };
-    }
-]);
diff --git a/static/js/directives.js b/static/js/directives.js
deleted file mode 100755
index d7eb9bc..0000000
--- a/static/js/directives.js
+++ /dev/null
@@ -1,237 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-/* Directives */
-
-angular.module('tour.directives', []).
-
-// onpageup executes the given expression when Page Up is released.
-directive('onpageup', function() {
-    return function(scope, elm, attrs) {
-        elm.attr('tabindex', 0);
-        elm.keyup(function(evt) {
-            var key = evt.which || evt.keyCode;
-            if (key == 33 && !evt.ctrlKey) {
-                scope.$apply(attrs.onpageup);
-                evt.preventDefault();
-            }
-        });
-    };
-}).
-
-// onpagedown executes the given expression when Page Down is released.
-directive('onpagedown', function() {
-    return function(scope, elm, attrs) {
-        elm.attr('tabindex', 0);
-        elm.keyup(function(evt) {
-            var key = evt.which || evt.keyCode;
-            if (key == 34 && !evt.ctrlKey) {
-                scope.$apply(attrs.onpagedown);
-                evt.preventDefault();
-            }
-        });
-    };
-}).
-
-// autofocus sets the focus on the given element when the condition is true.
-directive('autofocus', function() {
-    return function(scope, elm, attrs) {
-        elm.attr('tabindex', 0);
-        scope.$watch(function() {
-            return scope.$eval(attrs.autofocus);
-        }, function(val) {
-            if (val === true) $(elm).focus();
-        });
-    };
-}).
-
-// imports-checkbox activates and deactivates
-directive('importsCheckbox', ['editor',
-    function(editor) {
-        return function(scope, elm) {
-            elm.click(function() {
-                editor.toggleImports();
-                scope.$digest();
-            });
-            scope.editor = editor;
-        };
-    }
-]).
-
-// syntax-checkbox activates and deactivates
-directive('syntaxCheckbox', ['editor',
-    function(editor) {
-        return function(scope, elm) {
-            elm.click(function() {
-                editor.toggleSyntax();
-                scope.$digest();
-            });
-            scope.editor = editor;
-        };
-    }
-]).
-
-// verticalSlide creates a sliding separator between the left and right elements.
-// e.g.:
-// <div id="header">Some content</div>
-// <div vertical-slide top="#header" bottom="#footer"></div>
-// <div id="footer">Some footer</div>
-directive('verticalSlide', ['editor',
-    function(editor) {
-        return function(scope, elm, attrs) {
-            var moveTo = function(x) {
-                if (x < 0) {
-                    x = 0;
-                }
-                if (x > $(window).width()) {
-                    x = $(window).width();
-                }
-                elm.css('left', x);
-                $(attrs.left).width(x);
-                $(attrs.right).offset({
-                    left: x
-                });
-                editor.x = x;
-            };
-
-            elm.draggable({
-                axis: 'x',
-                drag: function(event) {
-                    moveTo(event.clientX);
-                    return true;
-                },
-                containment: 'parent',
-            });
-
-            if (editor.x !== undefined) {
-                moveTo(editor.x);
-            }
-        };
-    }
-]).
-
-// horizontalSlide creates a sliding separator between the top and bottom elements.
-// <div id="menu">Some menu</div>
-// <div vertical-slide left="#menu" bottom="#content"></div>
-// <div id="content">Some content</div>
-directive('horizontalSlide', ['editor',
-    function(editor) {
-        return function(scope, elm, attrs) {
-            var moveTo = function(y) {
-                var top = $(attrs.top).offset().top;
-                if (y < top) {
-                    y = top;
-                }
-                elm.css('top', y - top);
-                $(attrs.top).height(y - top);
-                $(attrs.bottom).offset({
-                    top: y,
-                    height: 0
-                });
-                editor.y = y;
-            };
-            elm.draggable({
-                axis: 'y',
-                drag: function(event) {
-                    moveTo(event.clientY);
-                    return true;
-                },
-                containment: 'parent',
-            });
-
-            if (editor.y !== undefined) {
-                moveTo(editor.y);
-            }
-        };
-    }
-]).
-
-directive('tableOfContentsButton', ['i18n', function(i18n) {
-    var speed = 250;
-    return {
-        restrict: 'A',
-        templateUrl: '/static/partials/toc-button.html',
-        link: function(scope, elm, attrs) {
-            scope.tocMessage = i18n.l('toc');
-            elm.on('click', function() {
-                var toc = $(attrs.tableOfContentsButton);
-                // hide all non active lessons before displaying the toc.
-                var visible = toc.css('display') != 'none';
-                if (!visible) {
-                    toc.find('.toc-lesson:not(.active) .toc-page').hide();
-                    toc.find('.toc-lesson.active .toc-page').show();
-                }
-                toc.toggle('slide', {
-                    direction: 'right'
-                }, speed);
-
-                // if fullscreen hide the rest of the content when showing the atoc.
-                var fullScreen = toc.width() == $(window).width();
-                if (fullScreen) $('#editor-container')[visible ? 'show' : 'hide']();
-            });
-        }
-    };
-}]).
-
-// side bar with dynamic table of contents
-directive('tableOfContents', ['$routeParams', 'toc',
-    function($routeParams, toc) {
-        var speed = 250;
-        return {
-            restrict: 'A',
-            templateUrl: '/static/partials/toc.html',
-            link: function(scope, elm) {
-                scope.toc = toc;
-                scope.params = $routeParams;
-
-                scope.toggleLesson = function(id) {
-                    var l = $('#toc-l-' + id + ' .toc-page');
-                    l[l.css('display') == 'none' ? 'slideDown' : 'slideUp']();
-                };
-
-                scope.$watch(function() {
-                    return scope.params.lessonId + scope.params.lessonId;
-                }, function() {
-                    $('.toc-lesson:not(#toc-l-' + scope.params.lessonId + ') .toc-page').slideUp(speed);
-                });
-
-                scope.hideTOC = function(fullScreenOnly) {
-                    var fullScreen = elm.find('.toc').width() == $(window).width();
-                    if (fullScreenOnly && !fullScreen) {
-                        return;
-                    }
-                    $('.toc').toggle('slide', {
-                        direction: 'right'
-                    }, speed);
-                    $('#editor-container').show();
-                };
-            }
-        };
-    }
-]).
-
-directive('feedbackButton', ['i18n', function(i18n) {
-    return {
-        restrict: 'A',
-        templateUrl: '/static/partials/feedback-button.html',
-        link: function(scope, elm, attrs) {
-            scope.feedbackMessage = i18n.l('submit-feedback');
-
-            elm.on('click', function() {
-                var context = window.location.pathname === '/list'
-                    ? '/list'
-                    : '/' + scope.params.lessonId + '/' + scope.params.pageNumber;
-	        context = window.location.protocol + '//' + window.location.host + context;
-                var title = i18n.l('issue-title');
-                var body = i18n.l('context') + ': '+ context + '\n\n'+ i18n.l('issue-message');
-                var url = 'https://' + i18n.l('github-repo') + '/issues/new'
-                    + '?title=' + encodeURIComponent(title)
-                    + '&body=' + encodeURIComponent(body);
-                window.open(url);
-            });
-        }
-    };
-}]);
diff --git a/static/js/services.js b/static/js/services.js
deleted file mode 100755
index da5f79c..0000000
--- a/static/js/services.js
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-/* Services */
-
-angular.module('tour.services', []).
-
-// Google Analytics
-factory('analytics', ['$window',
-    function(win) {
-        var track = win.trackPageview || (function() {});
-        return {
-            trackView: track
-        };
-    }
-]).
-
-// Internationalization
-factory('i18n', ['translation',
-    function(translation) {
-        return {
-            l: function(key) {
-                if (translation[key]) return translation[key];
-                return '(no translation for ' + key + ')';
-            }
-        };
-    }
-]).
-
-// Running code
-factory('run', ['$window', 'editor',
-    function(win, editor) {
-        var writeInterceptor = function(writer, done) {
-            return function(write) {
-                if (write.Kind == 'stderr') {
-                    var lines = write.Body.split('\n');
-                    for (var i in lines) {
-                        var match = lines[i].match(/.*\.go:([0-9]+): ([^\n]*)/);
-                        if (match !== null) {
-                            editor.highlight(match[1], match[2]);
-                        }
-                    }
-                }
-                writer(write);
-                if (write.Kind == 'end') done();
-            };
-        };
-        return function(code, output, options, done) {
-            // We want to build tour snippets in module mode, so append
-            // a default go.mod file when it is not already included in
-            // the txtar archive.
-            //
-            // The exercises use golang.org/x/tour/{pic,reader,tree,wc}
-            // packages, so include the golang.org/x/tour module in the
-            // build list.
-            const hasGoMod = code.indexOf('\n-- go.mod --\n') !== -1 || code.startsWith('-- go.mod --\n');
-            if (!hasGoMod) {
-                code += '\n' +
-                    '-- go.mod --\n' +
-                    'module example\n' +
-                    'require golang.org/x/tour v0.0.0-20201207214521-004403599411\n' +
-                    '-- go.sum --\n' +
-                    'golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=\n' +
-                    'golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=\n' +
-                    'golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=\n' +
-                    'golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=\n' +
-                    'golang.org/x/tools v0.0.0-20190312164927-7b79afddac43/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=\n' +
-                    'golang.org/x/tour v0.0.0-20201207214521-004403599411 h1:dJ4kVwSGlrLZXW6eo2IOer4Pm3wl2GIG4fytRziMgL8=\n' +
-                    'golang.org/x/tour v0.0.0-20201207214521-004403599411/go.mod h1:qMugOFWX59KzC8Nx7f2uvXxKxAqJfi1J6ZUHAWKnrRA=\n';
-            }
-
-            // PlaygroundOutput is defined in playground.js which is prepended
-            // to the generated script.js in gotour/tour.go.
-            // The next line removes the jshint warning.
-            // global PlaygroundOutput
-            return win.transport.Run(code, writeInterceptor(PlaygroundOutput(output), done), options);
-        };
-    }
-]).
-
-// Formatting code
-factory('fmt', ['$http',
-    function($http) {
-        return function(body, imports) {
-            var params = $.param({
-                'body': body,
-                'imports': imports,
-            });
-            var headers = {
-                'Content-Type': 'application/x-www-form-urlencoded'
-            };
-            return $http.post('/fmt', params, {
-                headers: headers
-            });
-        };
-    }
-]).
-
-// Local storage, persistent to page refreshing.
-factory('storage', ['$window',
-    function(win) {
-        try {
-            // This will raise an exception if cookies are disabled.
-            win.localStorage = win.localStorage;
-            return {
-                get: function(key) {
-                    return win.localStorage.getItem(key);
-                },
-                set: function(key, val) {
-                    win.localStorage.setItem(key, val);
-                }
-            };
-        } catch (e) {
-            return {
-                get: function() {
-                    return null;
-                },
-                set: function() {}
-            };
-        }
-    }
-]).
-
-// Editor context service, kept through the whole app.
-factory('editor', ['$window', 'storage',
-    function(win, storage) {
-        var ctx = {
-            imports: storage.get('imports') === 'true',
-            toggleImports: function() {
-                ctx.imports = !ctx.imports;
-                storage.set('imports', ctx.imports);
-            },
-            syntax: storage.get('syntax') === 'true',
-            toggleSyntax: function() {
-                ctx.syntax = !ctx.syntax;
-                storage.set('syntax', ctx.syntax);
-                ctx.paint();
-            },
-            paint: function() {
-                var mode = ctx.syntax && 'text/x-go' || 'text/x-go-comment';
-                // Wait for codemirror to start.
-                var set = function() {
-                    if ($('.CodeMirror').length > 0) {
-                        var cm = $('.CodeMirror')[0].CodeMirror;
-                        if (cm.getOption('mode') == mode) {
-                            cm.refresh();
-                            return;
-                        }
-                        cm.setOption('mode', mode);
-                    }
-                    win.setTimeout(set, 10);
-                };
-                set();
-            },
-            highlight: function(line, message) {
-                $('.CodeMirror-code > div:nth-child(' + line + ')')
-                    .addClass('line-error').attr('title', message);
-            },
-            onChange: function() {
-                $('.line-error').removeClass('line-error').attr('title', null);
-            }
-        };
-        // Set in the window so the onChange function in the codemirror config
-        // can call it.
-        win.codeChanged = ctx.onChange;
-        return ctx;
-    }
-]).
-
-// Table of contents management and navigation
-factory('toc', ['$http', '$q', '$log', 'tableOfContents', 'storage',
-    function($http, $q, $log, tableOfContents, storage) {
-        var modules = tableOfContents;
-
-        var lessons = {};
-
-        var prevLesson = function(id) {
-            var mod = lessons[id].module;
-            var idx = mod.lessons.indexOf(id);
-            if (idx < 0) return '';
-            if (idx > 0) return mod.lessons[idx - 1];
-
-            idx = modules.indexOf(mod);
-            if (idx <= 0) return '';
-            mod = modules[idx - 1];
-            return mod.lessons[mod.lessons.length - 1];
-        };
-
-        var nextLesson = function(id) {
-            var mod = lessons[id].module;
-            var idx = mod.lessons.indexOf(id);
-            if (idx < 0) return '';
-            if (idx + 1 < mod.lessons.length) return mod.lessons[idx + 1];
-
-            idx = modules.indexOf(mod);
-            if (idx < 0 || modules.length <= idx + 1) return '';
-            mod = modules[idx + 1];
-            return mod.lessons[0];
-        };
-
-        $http.get('/lesson/').then(
-            function(data) {
-                lessons = data.data;
-                for (var m = 0; m < modules.length; m++) {
-                    var module = modules[m];
-                    module.lesson = {};
-                    for (var l = 0; l < modules[m].lessons.length; l++) {
-                        var lessonName = module.lessons[l];
-                        var lesson = lessons[lessonName];
-                        lesson.module = module;
-                        module.lesson[lessonName] = lesson;
-
-                        // replace file contents with locally stored copies.
-                        for (var p = 0; p < lesson.Pages.length; p++) {
-                            var page = lesson.Pages[p];
-                            for (var f = 0; f < page.Files.length; f++) {
-                                page.Files[f].OrigContent = page.Files[f].Content;
-                                var val = storage.get(page.Files[f].Hash);
-                                if (val !== null) {
-                                    page.Files[f].Content = val;
-                                }
-                            }
-                        }
-                    }
-                }
-                moduleQ.resolve(modules);
-                lessonQ.resolve(lessons);
-            },
-            function(error) {
-                $log.error('error loading lessons : ', error);
-                moduleQ.reject(error);
-                lessonQ.reject(error);
-            }
-        );
-
-        var moduleQ = $q.defer();
-        var lessonQ = $q.defer();
-
-        return {
-            modules: moduleQ.promise,
-            lessons: lessonQ.promise,
-            prevLesson: prevLesson,
-            nextLesson: nextLesson
-        };
-    }
-]);
diff --git a/static/js/values.js b/static/js/values.js
deleted file mode 100644
index 1c24ddc..0000000
--- a/static/js/values.js
+++ /dev/null
@@ -1,167 +0,0 @@
-/* Copyright 2012 The Go Authors.   All rights reserved.
- * Use of this source code is governed by a BSD-style
- * license that can be found in the LICENSE file.
- */
-'use strict';
-
-angular.module('tour.values', []).
-
-// List of modules with description and lessons in it.
-value('tableOfContents', [{
-    'id': 'mechanics',
-    'title': 'Using the tour',
-    'description': '<p>Welcome to a tour of the <a href="https://golang.org">Go programming language</a>. The tour covers the most important features of the language, mainly:</p>',
-    'lessons': ['welcome']
-}, {
-    'id': 'basics',
-    'title': 'Basics',
-    'description': '<p>The starting point, learn all the basics of the language.</p><p>Declaring variables, calling functions, and all the things you need to know before moving to the next lessons.</p>',
-    'lessons': ['basics', 'flowcontrol', 'moretypes']
-}, {
-    'id': 'methods',
-    'title': 'Methods and interfaces',
-    'description': '<p>Learn how to define methods on types, how to declare interfaces, and how to put everything together.</p>',
-    'lessons': ['methods']
-}, {
-    'id': 'concurrency',
-    'title': 'Concurrency',
-    'description': '<p>Go provides concurrency features as part of the core language.</p><p>This module goes over goroutines and channels, and how they are used to implement different concurrency patterns.</p>',
-    'lessons': ['concurrency']
-}]).
-
-// translation
-value('translation', {
-    'off': 'off',
-    'on': 'on',
-    'syntax': 'Syntax-Highlighting',
-    'lineno': 'Line-Numbers',
-    'reset': 'Reset Slide',
-    'format': 'Format Source Code',
-    'kill': 'Kill Program',
-    'run': 'Run',
-    'compile': 'Compile and Run',
-    'more': 'Options',
-    'toc': 'Table of Contents',
-    'prev': 'Previous',
-    'next': 'Next',
-    'waiting': 'Waiting for remote server...',
-    'errcomm': 'Error communicating with remote server.',
-    'submit-feedback': 'Send feedback about this page',
-
-    // GitHub issue template: update repo and messaging when translating.
-    'github-repo': 'github.com/golang/tour',
-    'issue-title': 'tour: [REPLACE WITH SHORT DESCRIPTION]',
-    'issue-message': 'Change the title above to describe your issue and add your feedback here, including code if necessary',
-    'context': 'Context',
-}).
-
-// Config for codemirror plugin
-value('ui.config', {
-    codemirror: {
-        mode: 'text/x-go',
-        matchBrackets: true,
-        lineNumbers: true,
-        autofocus: true,
-        indentWithTabs: true,
-        indentUnit: 4,
-        tabSize: 4,
-        lineWrapping: true,
-        extraKeys: {
-            'Shift-Enter': function() {
-                $('#run').click();
-            },
-            'Ctrl-Enter': function() {
-                $('#format').click();
-            },
-            'PageDown': function() {
-                return false;
-            },
-            'PageUp': function() {
-                return false;
-            },
-        },
-        // TODO: is there a better way to do this?
-        // AngularJS values can't depend on factories.
-        onChange: function() {
-            if (window.codeChanged !== null) window.codeChanged();
-        }
-    }
-}).
-
-// mapping from the old paths (#42) to the new organization.
-// The values have been generated with the map.sh script in the tools directory.
-value('mapping', {
-    '#1': '/welcome/1', // Hello, 世界
-    '#2': '/welcome/2', // Go local
-    '#3': '/basics/1', // Packages
-    '#4': '/basics/2', // Imports
-    '#5': '/basics/3', // Exported names
-    '#6': '/basics/4', // Functions
-    '#7': '/basics/5', // Functions continued
-    '#8': '/basics/6', // Multiple results
-    '#9': undefined, // Named results
-    '#10': '/basics/8', // Variables
-    '#11': '/basics/9', // Variables with initializers
-    '#12': '/basics/10', // Short variable declarations
-    '#13': '/basics/11', // Basic types
-    '#14': '/basics/13', // Type conversions
-    '#15': '/basics/15', // Constants
-    '#16': '/basics/16', // Numeric Constants
-    '#17': '/flowcontrol/1', // For
-    '#18': '/flowcontrol/2', // For continued
-    '#19': '/flowcontrol/3', // For is Go's "while"
-    '#20': '/flowcontrol/4', // Forever
-    '#21': '/flowcontrol/5', // If
-    '#22': '/flowcontrol/6', // If with a short statement
-    '#23': '/flowcontrol/7', // If and else
-    '#24': '/flowcontrol/8', // Exercise: Loops and Functions
-    '#25': '/moretypes/2', // Structs
-    '#26': '/moretypes/3', // Struct Fields
-    '#27': '/moretypes/1', // Pointers
-    '#28': '/moretypes/5', // Struct Literals
-    '#29': undefined, // The new function
-    '#30': '/moretypes/6', // Arrays
-    '#31': '/moretypes/7', // Slices
-    '#32': '/moretypes/8', // Slicing slices
-    '#33': '/moretypes/9', // Making slices
-    '#34': '/moretypes/10', // Nil slices
-    '#35': '/moretypes/12', // Range
-    '#36': '/moretypes/13', // Range continued
-    '#37': '/moretypes/14', // Exercise: Slices
-    '#38': '/moretypes/15', // Maps
-    '#39': '/moretypes/16', // Map literals
-    '#40': '/moretypes/17', // Map literals continued
-    '#41': '/moretypes/18', // Mutating Maps
-    '#42': '/moretypes/19', // Exercise: Maps
-    '#43': '/moretypes/20', // Function values
-    '#44': '/moretypes/21', // Function closures
-    '#45': '/moretypes/22', // Exercise: Fibonacci closure
-    '#46': '/flowcontrol/9', // Switch
-    '#47': '/flowcontrol/10', // Switch evaluation order
-    '#48': '/flowcontrol/11', // Switch with no condition
-    '#49': undefined, // Advanced Exercise: Complex cube roots
-    '#50': undefined, // Methods and Interfaces
-    '#51': '/methods/1', // Methods
-    '#52': '/methods/2', // Methods continued
-    '#53': '/methods/3', // Methods with pointer receivers
-    '#54': '/methods/4', // Interfaces
-    '#55': '/methods/5', // Interfaces are satisfied implicitly
-    '#56': '/methods/8', // Errors
-    '#57': '/methods/9', // Exercise: Errors
-    '#58': '/methods/13', // Web servers
-    '#59': '/methods/14', // Exercise: HTTP Handlers
-    '#60': '/methods/15', // Images
-    '#61': '/methods/16', // Exercise: Images
-    '#62': undefined, // Exercise: Rot13 Reader
-    '#63': undefined, // Concurrency
-    '#64': '/concurrency/1', // Goroutines
-    '#65': '/concurrency/2', // Channels
-    '#66': '/concurrency/3', // Buffered Channels
-    '#67': '/concurrency/4', // Range and Close
-    '#68': '/concurrency/5', // Select
-    '#69': '/concurrency/6', // Default Selection
-    '#70': '/concurrency/7', // Exercise: Equivalent Binary Trees
-    '#71': '/concurrency/8', // Exercise: Equivalent Binary Trees
-    '#72': '/concurrency/9', // Exercise: Web Crawler
-    '#73': '/concurrency/10', // Where to Go from here...
-});
diff --git a/static/lib/angular-ui.min.js b/static/lib/angular-ui.min.js
deleted file mode 100644
index 6b031ab..0000000
--- a/static/lib/angular-ui.min.js
+++ /dev/null
@@ -1,7 +0,0 @@
-/**
- * AngularUI - The companion suite for AngularJS
- * @version v0.4.0 - 2013-02-15
- * @link http://angular-ui.github.com
- * @license MIT License, http://www.opensource.org/licenses/MIT
- */
-angular.module("ui.config",[]).value("ui.config",{}),angular.module("ui.filters",["ui.config"]),angular.module("ui.directives",["ui.config"]),angular.module("ui",["ui.filters","ui.directives","ui.config"]),angular.module("ui.directives").directive("uiAnimate",["ui.config","$timeout",function(e,t){var n={};return angular.isString(e.animate)?n["class"]=e.animate:e.animate&&(n=e.animate),{restrict:"A",link:function(e,r,i){var s={};i.uiAnimate&&(s=e.$eval(i.uiAnimate),angular.isString(s)&&(s={"class":s})),s=angular.extend({"class":"ui-animate"},n,s),r.addClass(s["class"]),t(function(){r.removeClass(s["class"])},20,!1)}}}]),angular.module("ui.directives").directive("uiCalendar",["ui.config","$parse",function(e,t){return e.uiCalendar=e.uiCalendar||{},{require:"ngModel",restrict:"A",link:function(t,n,r,i){function a(){t.calendar=n.html("");var i=t.calendar.fullCalendar("getView");i&&(i=i.name);var o,u={defaultView:i,eventSources:s};r.uiCalendar?o=t.$eval(r.uiCalendar):o={},angular.extend(u,e.uiCalendar,o),t.calendar.fullCalendar(u)}var s=t.$eval(r.ngModel),o=0,u=function(){var e=t.$eval(r.equalsTracker);return o=0,angular.forEach(s,function(e,t){angular.isArray(e)&&(o+=e.length)}),angular.isNumber(e)?o+s.length+e:o+s.length};a(),t.$watch(u,function(e,t){a()})}}}]),angular.module("ui.directives").directive("uiCodemirror",["ui.config","$timeout",function(e,t){"use strict";var n=["cursorActivity","viewportChange","gutterClick","focus","blur","scroll","update"];return{restrict:"A",require:"ngModel",link:function(r,i,s,o){var u,a,f,l,c;if(i[0].type!=="textarea")throw new Error("uiCodemirror3 can only be applied to a textarea element");u=e.codemirror||{},a=angular.extend({},u,r.$eval(s.uiCodemirror)),f=function(e){return function(t,n){var i=t.getValue();i!==o.$viewValue&&(o.$setViewValue(i),r.$apply()),typeof e=="function"&&e(t,n)}},l=function(){c=CodeMirror.fromTextArea(i[0],a),c.on("change",f(a.onChange));for(var e=0,u=n.length,l;e<u;++e){l=a["on"+n[e].charAt(0).toUpperCase()+n[e].slice(1)];if(l===void 0)continue;if(typeof l!="function")continue;c.on(n[e],l)}o.$formatters.push(function(e){if(angular.isUndefined(e)||e===null)return"";if(angular.isObject(e)||angular.isArray(e))throw new Error("ui-codemirror cannot use an object or an array as a model");return e}),o.$render=function(){c.setValue(o.$viewValue)},s.uiRefresh&&r.$watch(s.uiRefresh,function(e,n){e!==n&&t(c.refresh)})},t(l)}}}]),angular.module("ui.directives").directive("uiCurrency",["ui.config","currencyFilter",function(e,t){var n={pos:"ui-currency-pos",neg:"ui-currency-neg",zero:"ui-currency-zero"};return e.currency&&angular.extend(n,e.currency),{restrict:"EAC",require:"ngModel",link:function(e,r,i,s){var o,u,a;o=angular.extend({},n,e.$eval(i.uiCurrency)),u=function(e){var n;return n=e*1,r.toggleClass(o.pos,n>0),r.toggleClass(o.neg,n<0),r.toggleClass(o.zero,n===0),e===""?r.text(""):r.text(t(n,o.symbol)),!0},s.$render=function(){a=s.$viewValue,r.val(a),u(a)}}}}]),angular.module("ui.directives").directive("uiDate",["ui.config",function(e){"use strict";var t;return t={},angular.isObject(e.date)&&angular.extend(t,e.date),{require:"?ngModel",link:function(t,n,r,i){var s=function(){return angular.extend({},e.date,t.$eval(r.uiDate))},o=function(){var e=s();if(i){var r=function(){t.$apply(function(){var e=n.datepicker("getDate");n.datepicker("setDate",n.val()),i.$setViewValue(e),n.blur()})};if(e.onSelect){var o=e.onSelect;e.onSelect=function(e,n){r(),t.$apply(function(){o(e,n)})}}else e.onSelect=r;n.bind("change",r),i.$render=function(){var e=i.$viewValue;if(angular.isDefined(e)&&e!==null&&!angular.isDate(e))throw new Error("ng-Model value must be a Date object - currently it is a "+typeof e+" - use ui-date-format to convert it from a string");n.datepicker("setDate",e)}}n.datepicker("destroy"),n.datepicker(e),i&&i.$render()};t.$watch(s,o,!0)}}}]).directive("uiDateFormat",["ui.config",function(e){var t={require:"ngModel",link:function(t,n,r,i){var s=r.uiDateFormat||e.dateFormat;s?(i.$formatters.push(function(e){if(angular.isString(e))return $.datepicker.parseDate(s,e)}),i.$parsers.push(function(e){if(e)return $.datepicker.formatDate(s,e)})):(i.$formatters.push(function(e){if(angular.isString(e))return new Date(e)}),i.$parsers.push(function(e){if(e)return e.toISOString()}))}};return t}]),angular.module("ui.directives").directive("uiEvent",["$parse",function(e){return function(t,n,r){var i=t.$eval(r.uiEvent);angular.forEach(i,function(r,i){var s=e(r);n.bind(i,function(e){var n=Array.prototype.slice.call(arguments);n=n.splice(1),t.$apply(function(){s(t,{$event:e,$params:n})})})})}}]),angular.module("ui.directives").directive("uiIf",[function(){return{transclude:"element",priority:1e3,terminal:!0,restrict:"A",compile:function(e,t,n){return function(e,t,r){var i,s;e.$watch(r.uiIf,function(r){i&&(i.remove(),i=undefined),s&&(s.$destroy(),s=undefined),r&&(s=e.$new(),n(s,function(e){i=e,t.after(e)}))})}}}}]),angular.module("ui.directives").directive("uiJq",["ui.config","$timeout",function(t,n){return{restrict:"A",compile:function(r,i){if(!angular.isFunction(r[i.uiJq]))throw new Error('ui-jq: The "'+i.uiJq+'" function does not exist');var s=t.jq&&t.jq[i.uiJq];return function(t,r,i){function u(){n(function(){r[i.uiJq].apply(r,o)},0,!1)}var o=[];i.uiOptions?(o=t.$eval("["+i.uiOptions+"]"),angular.isObject(s)&&angular.isObject(o[0])&&(o[0]=angular.extend({},s,o[0]))):s&&(o=[s]),i.ngModel&&r.is("select,input,textarea")&&r.on("change",function(){r.trigger("input")}),i.uiRefresh&&t.$watch(i.uiRefresh,function(e){u()}),u()}}}}]),angular.module("ui.directives").factory("keypressHelper",["$parse",function(t){var n={8:"backspace",9:"tab",13:"enter",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"insert",46:"delete"},r=function(e){return e.charAt(0).toUpperCase()+e.slice(1)};return function(e,i,s,o){var u,a=[];u=i.$eval(o["ui"+r(e)]),angular.forEach(u,function(e,n){var r,i;i=t(e),angular.forEach(n.split(" "),function(e){r={expression:i,keys:{}},angular.forEach(e.split("-"),function(e){r.keys[e]=!0}),a.push(r)})}),s.bind(e,function(t){var r=t.metaKey||t.altKey,s=t.ctrlKey,o=t.shiftKey,u=t.keyCode;e==="keypress"&&!o&&u>=97&&u<=122&&(u-=32),angular.forEach(a,function(e){var u=e.keys[n[t.keyCode]]||e.keys[t.keyCode.toString()]||!1,a=e.keys.alt||!1,f=e.keys.ctrl||!1,l=e.keys.shift||!1;u&&a==r&&f==s&&l==o&&i.$apply(function(){e.expression(i,{$event:t})})})})}}]),angular.module("ui.directives").directive("uiKeydown",["keypressHelper",function(e){return{link:function(t,n,r){e("keydown",t,n,r)}}}]),angular.module("ui.directives").directive("uiKeypress",["keypressHelper",function(e){return{link:function(t,n,r){e("keypress",t,n,r)}}}]),angular.module("ui.directives").directive("uiKeyup",["keypressHelper",function(e){return{link:function(t,n,r){e("keyup",t,n,r)}}}]),function(){function t(e,t,n,r){angular.forEach(t.split(" "),function(t){var i={type:"map-"+t};google.maps.event.addListener(n,t,function(t){r.triggerHandler(angular.extend({},i,t)),e.$$phase||e.$apply()})})}function n(n,r){e.directive(n,[function(){return{restrict:"A",link:function(e,i,s){e.$watch(s[n],function(n){t(e,r,n,i)})}}}])}var e=angular.module("ui.directives");e.directive("uiMap",["ui.config","$parse",function(e,n){var r="bounds_changed center_changed click dblclick drag dragend dragstart heading_changed idle maptypeid_changed mousemove mouseout mouseover projection_changed resize rightclick tilesloaded tilt_changed zoom_changed",i=e.map||{};return{restrict:"A",link:function(e,s,o){var u=angular.extend({},i,e.$eval(o.uiOptions)),a=new google.maps.Map(s[0],u),f=n(o.uiMap);f.assign(e,a),t(e,r,a,s)}}}]),e.directive("uiMapInfoWindow",["ui.config","$parse","$compile",function(e,n,r){var i="closeclick content_change domready position_changed zindex_changed",s=e.mapInfoWindow||{};return{link:function(e,o,u){var a=angular.extend({},s,e.$eval(u.uiOptions));a.content=o[0];var f=n(u.uiMapInfoWindow),l=f(e);l||(l=new google.maps.InfoWindow(a),f.assign(e,l)),t(e,i,l,o),o.replaceWith("<div></div>");var c=l.open;l.open=function(n,i,s,u,a,f){r(o.contents())(e),c.call(l,n,i,s,u,a,f)}}}}]),n("uiMapMarker","animation_changed click clickable_changed cursor_changed dblclick drag dragend draggable_changed dragstart flat_changed icon_changed mousedown mouseout mouseover mouseup position_changed rightclick shadow_changed shape_changed title_changed visible_changed zindex_changed"),n("uiMapPolyline","click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapPolygon","click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapRectangle","bounds_changed click dblclick mousedown mousemove mouseout mouseover mouseup rightclick"),n("uiMapCircle","center_changed click dblclick mousedown mousemove mouseout mouseover mouseup radius_changed rightclick"),n("uiMapGroundOverlay","click dblclick")}(),angular.module("ui.directives").directive("uiMask",[function(){return{require:"ngModel",link:function(e,t,n,r){r.$render=function(){var i=r.$viewValue||"";t.val(i),t.mask(e.$eval(n.uiMask))},r.$parsers.push(function(e){var n=t.isMaskValid()||angular.isUndefined(t.isMaskValid())&&t.val().length>0;return r.$setValidity("mask",n),n?e:undefined}),t.bind("keyup",function(){e.$apply(function(){r.$setViewValue(t.mask())})})}}}]),angular.module("ui.directives").directive("uiReset",["ui.config",function(e){var t=null;return e.reset!==undefined&&(t=e.reset),{require:"ngModel",link:function(e,n,r,i){var s;s=angular.element('<a class="ui-reset" />'),n.wrap('<span class="ui-resetwrap" />').after(s),s.bind("click",function(n){n.preventDefault(),e.$apply(function(){r.uiReset?i.$setViewValue(e.$eval(r.uiReset)):i.$setViewValue(t),i.$render()})})}}}]),angular.module("ui.directives").directive("uiRoute",["$location","$parse",function(e,t){return{restrict:"AC",compile:function(n,r){var i;if(r.uiRoute)i="uiRoute";else if(r.ngHref)i="ngHref";else{if(!r.href)throw new Error("uiRoute missing a route or href property on "+n[0]);i="href"}return function(n,r,s){function a(t){(hash=t.indexOf("#"))>-1&&(t=t.substr(hash+1)),u=function(){o(n,e.path().indexOf(t)>-1)},u()}function f(t){(hash=t.indexOf("#"))>-1&&(t=t.substr(hash+1)),u=function(){var i=new RegExp("^"+t+"$",["i"]);o(n,i.test(e.path()))},u()}var o=t(s.ngModel||s.routeModel||"$uiRoute").assign,u=angular.noop;switch(i){case"uiRoute":s.uiRoute?f(s.uiRoute):s.$observe("uiRoute",f);break;case"ngHref":s.ngHref?a(s.ngHref):s.$observe("ngHref",a);break;case"href":a(s.href)}n.$on("$routeChangeSuccess",function(){u()})}}}}]),angular.module("ui.directives").directive("uiScrollfix",["$window",function(e){"use strict";return{link:function(t,n,r){var i=n.offset().top;r.uiScrollfix?r.uiScrollfix.charAt(0)==="-"?r.uiScrollfix=i-r.uiScrollfix.substr(1):r.uiScrollfix.charAt(0)==="+"&&(r.uiScrollfix=i+parseFloat(r.uiScrollfix.substr(1))):r.uiScrollfix=i,angular.element(e).on("scroll.ui-scrollfix",function(){var t;if(angular.isDefined(e.pageYOffset))t=e.pageYOffset;else{var i=document.compatMode&&document.compatMode!=="BackCompat"?document.documentElement:document.body;t=i.scrollTop}!n.hasClass("ui-scrollfix")&&t>r.uiScrollfix?n.addClass("ui-scrollfix"):n.hasClass("ui-scrollfix")&&t<r.uiScrollfix&&n.removeClass("ui-scrollfix")})}}}]),angular.module("ui.directives").directive("uiSelect2",["ui.config","$timeout",function(e,t){var n={};return e.select2&&angular.extend(n,e.select2),{require:"?ngModel",compile:function(e,r){var i,s,o,u=e.is("select"),a=r.multiple!==undefined;return e.is("select")&&(s=e.find("option[ng-repeat], option[data-ng-repeat]"),s.length&&(o=s.attr("ng-repeat")||s.attr("data-ng-repeat"),i=jQuery.trim(o.split("|")[0]).split(" ").pop())),function(e,r,s,o){var f=angular.extend({},n,e.$eval(s.uiSelect2));u?(delete f.multiple,delete f.initSelection):a&&(f.multiple=!0);if(o){o.$render=function(){u?r.select2("val",o.$modelValue):a?o.$modelValue?angular.isArray(o.$modelValue)?r.select2("data",o.$modelValue):r.select2("val",o.$modelValue):r.select2("data",[]):angular.isObject(o.$modelValue)?r.select2("data",o.$modelValue):r.select2("val",o.$modelValue)},i&&e.$watch(i,function(e,n,i){if(!e)return;t(function(){r.select2("val",o.$viewValue),r.trigger("change")})});if(!u){r.bind("change",function(){e.$apply(function(){o.$setViewValue(r.select2("data"))})});if(f.initSelection){var l=f.initSelection;f.initSelection=function(e,t){l(e,function(e){o.$setViewValue(e),t(e)})}}}}s.$observe("disabled",function(e){r.select2(e&&"disable"||"enable")}),s.ngMultiple&&e.$watch(s.ngMultiple,function(e){r.select2(f)}),r.val(e.$eval(s.ngModel)),t(function(){r.select2(f),!f.initSelection&&!u&&o.$setViewValue(r.select2("data"))})}}}}]),angular.module("ui.directives").directive("uiShow",[function(){return function(e,t,n){e.$watch(n.uiShow,function(e,n){e?t.addClass("ui-show"):t.removeClass("ui-show")})}}]).directive("uiHide",[function(){return function(e,t,n){e.$watch(n.uiHide,function(e,n){e?t.addClass("ui-hide"):t.removeClass("ui-hide")})}}]).directive("uiToggle",[function(){return function(e,t,n){e.$watch(n.uiToggle,function(e,n){e?t.removeClass("ui-hide").addClass("ui-show"):t.removeClass("ui-show").addClass("ui-hide")})}}]),angular.module("ui.directives").directive("uiSortable",["ui.config",function(e){return{require:"?ngModel",link:function(t,n,r,i){var s,o,u,a,f,l,c,h,p;f=angular.extend({},e.sortable,t.$eval(r.uiSortable)),i&&(i.$render=function(){n.sortable("refresh")},u=function(e,t){t.item.sortable={index:t.item.index()}},a=function(e,t){t.item.sortable.resort=i},s=function(e,t){t.item.sortable.relocate=!0,i.$modelValue.splice(t.item.index(),0,t.item.sortable.moved)},o=function(e,t){i.$modelValue.length===1?t.item.sortable.moved=i.$modelValue.splice(0,1)[0]:t.item.sortable.moved=i.$modelValue.splice(t.item.sortable.index,1)[0]},onStop=function(e,n){if(n.item.sortable.resort&&!n.item.sortable.relocate){var r,i;i=n.item.sortable.index,r=n.item.index(),i<r&&r--,n.item.sortable.resort.$modelValue.splice(r,0,n.item.sortable.resort.$modelValue.splice(i,1)[0])}(n.item.sortable.resort||n.item.sortable.relocate)&&t.$apply()},h=f.start,f.start=function(e,t){u(e,t),typeof h=="function"&&h(e,t)},_stop=f.stop,f.stop=function(e,t){onStop(e,t),typeof _stop=="function"&&_stop(e,t)},p=f.update,f.update=function(e,t){a(e,t),typeof p=="function"&&p(e,t)},l=f.receive,f.receive=function(e,t){s(e,t),typeof l=="function"&&l(e,t)},c=f.remove,f.remove=function(e,t){o(e,t),typeof c=="function"&&c(e,t)}),n.sortable(f)}}}]),angular.module("ui.directives").directive("uiTinymce",["ui.config",function(e){return e.tinymce=e.tinymce||{},{require:"ngModel",link:function(t,n,r,i){var s,o={onchange_callback:function(e){e.isDirty()&&(e.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply())},handle_event_callback:function(e){return this.isDirty()&&(this.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply()),!0},setup:function(e){e.onSetContent.add(function(e,r){e.isDirty()&&(e.save(),i.$setViewValue(n.val()),t.$$phase||t.$apply())})}};r.uiTinymce?s=t.$eval(r.uiTinymce):s={},angular.extend(o,e.tinymce,s),setTimeout(function(){n.tinymce(o)})}}}]),angular.module("ui.directives").directive("uiValidate",function(){return{restrict:"A",require:"ngModel",link:function(e,t,n,r){var i,s,o={},u=e.$eval(n.uiValidate);if(!u)return;angular.isString(u)&&(u={validator:u}),angular.forEach(u,function(t,n){i=function(i){return e.$eval(t,{$value:i})?(r.$setValidity(n,!0),i):(r.$setValidity(n,!1),undefined)},o[n]=i,r.$formatters.push(i),r.$parsers.push(i)}),n.uiValidateWatch&&(s=e.$eval(n.uiValidateWatch),angular.isString(s)?e.$watch(s,function(){angular.forEach(o,function(e,t){e(r.$modelValue)})}):angular.forEach(s,function(t,n){e.$watch(t,function(){o[n](r.$modelValue)})}))}}}),angular.module("ui.filters").filter("format",function(){return function(e,t){if(!e)return e;var n=e.toString(),r;return t===undefined?n:!angular.isArray(t)&&!angular.isObject(t)?n.split("$0").join(t):(r=angular.isArray(t)&&"$"||":",angular.forEach(t,function(e,t){n=n.split(r+t).join(e)}),n)}}),angular.module("ui.filters").filter("highlight",function(){return function(e,t,n){return t||angular.isNumber(t)?(e=e.toString(),t=t.toString(),n?e.split(t).join('<span class="ui-match">'+t+"</span>"):e.replace(new RegExp(t,"gi"),'<span class="ui-match">$&</span>')):e}}),angular.module("ui.filters").filter("inflector",function(){function e(e){return e.replace(/^([a-z])|\s+([a-z])/g,function(e){return e.toUpperCase()})}function t(e,t){return e.replace(/[A-Z]/g,function(e){return t+e})}var n={humanize:function(n){return e(t(n," ").split("_").join(" "))},underscore:function(e){return e.substr(0,1).toLowerCase()+t(e.substr(1),"_").toLowerCase().split(" ").join("_")},variable:function(t){return t=t.substr(0,1).toLowerCase()+e(t.split("_").join(" ")).substr(1).split(" ").join(""),t}};return function(e,t,r){return t!==!1&&angular.isString(e)?(t=t||"humanize",n[t](e)):e}}),angular.module("ui.filters").filter("unique",function(){return function(e,t){if(t===!1)return e;if((t||angular.isUndefined(t))&&angular.isArray(e)){var n={},r=[],i=function(e){return angular.isObject(e)&&angular.isString(t)?e[t]:e};angular.forEach(e,function(e){var t,n=!1;for(var s=0;s<r.length;s++)if(angular.equals(i(r[s]),i(e))){n=!0;break}n||r.push(e)}),e=r}return e}});
\ No newline at end of file
diff --git a/static/lib/angular.min.js b/static/lib/angular.min.js
deleted file mode 100644
index 1068a6a..0000000
--- a/static/lib/angular.min.js
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- AngularJS v1.0.6
- (c) 2010-2012 Google, Inc. http://angularjs.org
- License: MIT
-*/
-(function(N,Y,q){'use strict';function n(b,a,c){var d;if(b)if(H(b))for(d in b)d!="prototype"&&d!="length"&&d!="name"&&b.hasOwnProperty(d)&&a.call(c,b[d],d);else if(b.forEach&&b.forEach!==n)b.forEach(a,c);else if(!b||typeof b.length!=="number"?0:typeof b.hasOwnProperty!="function"&&typeof b.constructor!="function"||b instanceof K||ca&&b instanceof ca||xa.call(b)!=="[object Object]"||typeof b.callee==="function")for(d=0;d<b.length;d++)a.call(c,b[d],d);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],
-d);return b}function nb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function fc(b,a,c){for(var d=nb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function ob(b){return function(a,c){b(c,a)}}function ya(){for(var b=aa.length,a;b;){b--;a=aa[b].charCodeAt(0);if(a==57)return aa[b]="A",aa.join("");if(a==90)aa[b]="0";else return aa[b]=String.fromCharCode(a+1),aa.join("")}aa.unshift("0");return aa.join("")}function v(b){n(arguments,function(a){a!==b&&n(a,function(a,d){b[d]=
-a})});return b}function G(b){return parseInt(b,10)}function za(b,a){return v(new (v(function(){},{prototype:b})),a)}function w(){}function na(b){return b}function I(b){return function(){return b}}function x(b){return typeof b=="undefined"}function y(b){return typeof b!="undefined"}function L(b){return b!=null&&typeof b=="object"}function B(b){return typeof b=="string"}function Ra(b){return typeof b=="number"}function oa(b){return xa.apply(b)=="[object Date]"}function E(b){return xa.apply(b)=="[object Array]"}
-function H(b){return typeof b=="function"}function pa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function O(b){return B(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function gc(b){return b&&(b.nodeName||b.bind&&b.find)}function Sa(b,a,c){var d=[];n(b,function(b,g,h){d.push(a.call(c,b,g,h))});return d}function Aa(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Ta(b,a){var c=Aa(b,a);c>=0&&b.splice(c,1);return a}function V(b,a){if(pa(b)||
-b&&b.$evalAsync&&b.$watch)throw Error("Can't copy Window or Scope");if(a){if(b===a)throw Error("Can't copy equivalent objects or arrays");if(E(b))for(var c=a.length=0;c<b.length;c++)a.push(V(b[c]));else for(c in n(a,function(b,c){delete a[c]}),b)a[c]=V(b[c])}else(a=b)&&(E(b)?a=V(b,[]):oa(b)?a=new Date(b.getTime()):L(b)&&(a=V(b,{})));return a}function hc(b,a){var a=a||{},c;for(c in b)b.hasOwnProperty(c)&&c.substr(0,2)!=="$$"&&(a[c]=b[c]);return a}function ga(b,a){if(b===a)return!0;if(b===null||a===
-null)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&c=="object")if(E(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ga(b[d],a[d]))return!1;return!0}}else if(oa(b))return oa(a)&&b.getTime()==a.getTime();else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||pa(b)||pa(a))return!1;c={};for(d in b)if(!(d.charAt(0)==="$"||H(b[d]))){if(!ga(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&a[d]!==q&&!H(a[d]))return!1;return!0}return!1}function Ua(b,a){var c=
-arguments.length>2?ha.call(arguments,2):[];return H(a)&&!(a instanceof RegExp)?c.length?function(){return arguments.length?a.apply(b,c.concat(ha.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}:a}function ic(b,a){var c=a;/^\$+/.test(b)?c=q:pa(a)?c="$WINDOW":a&&Y===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function da(b,a){return JSON.stringify(b,ic,a?"  ":null)}function pb(b){return B(b)?JSON.parse(b):b}function Va(b){b&&b.length!==
-0?(b=A(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;return b}function qa(b){b=u(b).clone();try{b.html("")}catch(a){}var c=u("<div>").append(b).html();try{return b[0].nodeType===3?A(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+A(b)})}catch(d){return A(c)}}function Wa(b){var a={},c,d;n((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=y(c[1])?decodeURIComponent(c[1]):!0)});return a}function qb(b){var a=[];n(b,function(b,
-d){a.push(Xa(d,!0)+(b===!0?"":"="+Xa(b,!0)))});return a.length?a.join("&"):""}function Ya(b){return Xa(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Xa(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function jc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,h=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;n(h,function(a){h[a]=!0;c(Y.getElementById(a));
-a=a.replace(":","\\:");b.querySelectorAll&&(n(b.querySelectorAll("."+a),c),n(b.querySelectorAll("."+a+"\\:"),c),n(b.querySelectorAll("["+a+"]"),c))});n(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):n(a.attributes,function(b){if(!e&&h[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function rb(b,a){var c=function(){b=u(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=sb(a);c.invoke(["$rootScope","$rootElement",
-"$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(N&&!d.test(N.name))return c();N.name=N.name.replace(d,"");Za.resumeBootstrap=function(b){n(b,function(b){a.push(b)});c()}}function $a(b,a){a=a||"_";return b.replace(kc,function(b,d){return(d?a:"")+b.toLowerCase()})}function ab(b,a,c){if(!b)throw Error("Argument '"+(a||"?")+"' is "+(c||"required"));return b}function ra(b,a,c){c&&E(b)&&(b=b[b.length-1]);ab(H(b),a,"not a function, got "+
-(b&&typeof b=="object"?b.constructor.name||"Object":typeof b));return b}function lc(b){function a(a,b,e){return a[b]||(a[b]=e())}return a(a(b,"angular",Object),"module",function(){var b={};return function(d,e,g){e&&b.hasOwnProperty(d)&&(b[d]=null);return a(b,d,function(){function a(c,d,e){return function(){b[e||"push"]([c,d,arguments]);return k}}if(!e)throw Error("No module: "+d);var b=[],c=[],i=a("$injector","invoke"),k={_invokeQueue:b,_runBlocks:c,requires:e,name:d,provider:a("$provide","provider"),
-factory:a("$provide","factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:i,run:function(a){c.push(a);return this}};g&&i(g);return k})}})}function tb(b){return b.replace(mc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(nc,"Moz$1")}function bb(b,a){function c(){var e;for(var b=[this],c=a,h,f,j,
-i,k,m;b.length;){h=b.shift();f=0;for(j=h.length;f<j;f++){i=u(h[f]);c?i.triggerHandler("$destroy"):c=!c;k=0;for(e=(m=i.children()).length,i=e;k<i;k++)b.push(ca(m[k]))}}return d.apply(this,arguments)}var d=ca.fn[b],d=d.$original||d;c.$original=d;ca.fn[b]=c}function K(b){if(b instanceof K)return b;if(!(this instanceof K)){if(B(b)&&b.charAt(0)!="<")throw Error("selectors not implemented");return new K(b)}if(B(b)){var a=Y.createElement("div");a.innerHTML="<div>&#160;</div>"+b;a.removeChild(a.firstChild);
-cb(this,a.childNodes);this.remove()}else cb(this,b)}function db(b){return b.cloneNode(!0)}function sa(b){ub(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)sa(b[a])}function vb(b,a,c){var d=ba(b,"events");ba(b,"handle")&&(x(a)?n(d,function(a,c){eb(b,c,a);delete d[c]}):x(c)?(eb(b,a,d[a]),delete d[a]):Ta(d[a],c))}function ub(b){var a=b[Ba],c=Ca[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),vb(b)),delete Ca[a],b[Ba]=q)}function ba(b,a,c){var d=b[Ba],d=Ca[d||-1];if(y(c))d||(b[Ba]=d=++oc,
-d=Ca[d]={}),d[a]=c;else return d&&d[a]}function wb(b,a,c){var d=ba(b,"data"),e=y(c),g=!e&&y(a),h=g&&!L(a);!d&&!h&&ba(b,"data",d={});if(e)d[a]=c;else if(g)if(h)return d&&d[a];else v(d,a);else return d}function Da(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>-1}function xb(b,a){a&&n(a.split(" "),function(a){b.className=O((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+O(a)+" "," "))})}function yb(b,a){a&&n(a.split(" "),function(a){if(!Da(b,a))b.className=O(b.className+
-" "+O(a))})}function cb(b,a){if(a)for(var a=!a.nodeName&&y(a.length)&&!pa(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function zb(b,a){return Ea(b,"$"+(a||"ngController")+"Controller")}function Ea(b,a,c){b=u(b);for(b[0].nodeType==9&&(b=b.find("html"));b.length;){if(c=b.data(a))return c;b=b.parent()}}function Ab(b,a){var c=Fa[a.toLowerCase()];return c&&Bb[b.nodeName]&&c}function pc(b,a){var c=function(c,e){if(!c.preventDefault)c.preventDefault=function(){c.returnValue=!1};if(!c.stopPropagation)c.stopPropagation=
-function(){c.cancelBubble=!0};if(!c.target)c.target=c.srcElement||Y;if(x(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented};n(a[e||c.type],function(a){a.call(b,c)});Z<=8?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function fa(b){var a=typeof b,
-c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===q)c=b.$$hashKey=ya()}else c=b;return a+":"+c}function Ga(b){n(b,this.put,this)}function fb(){}function Cb(b){var a,c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(qc,""),c=c.match(rc),n(c[1].split(sc),function(b){b.replace(tc,function(b,c,d){a.push(d)})}),b.$inject=a}else E(b)?(c=b.length-1,ra(b[c],"fn"),a=b.slice(0,c)):ra(b,"fn",!0);return a}function sb(b){function a(a){return function(b,
-c){if(L(b))n(b,ob(a));else return a(b,c)}}function c(a,b){if(H(b)||E(b))b=m.instantiate(b);if(!b.$get)throw Error("Provider "+a+" must define $get factory method.");return k[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];n(a,function(a){if(!i.get(a))if(i.put(a,!0),B(a)){var c=ta(a);b=b.concat(e(c.requires)).concat(c._runBlocks);try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var g=d[c],j=g[0]=="$injector"?m:m.get(g[0]);j[g[1]].apply(j,g[2])}}catch(h){throw h.message&&(h.message+=
-" from "+a),h;}}else if(H(a))try{b.push(m.invoke(a))}catch(o){throw o.message&&(o.message+=" from "+a),o;}else if(E(a))try{b.push(m.invoke(a))}catch(k){throw k.message&&(k.message+=" from "+String(a[a.length-1])),k;}else ra(a,"module")});return b}function g(a,b){function c(d){if(typeof d!=="string")throw Error("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===h)throw Error("Circular dependency: "+j.join(" <- "));return a[d]}else try{return j.unshift(d),a[d]=h,a[d]=b(d)}finally{j.shift()}}
-function d(a,b,e){var f=[],i=Cb(a),g,h,j;h=0;for(g=i.length;h<g;h++)j=i[h],f.push(e&&e.hasOwnProperty(j)?e[j]:c(j));a.$inject||(a=a[g]);switch(b?-1:f.length){case 0:return a();case 1:return a(f[0]);case 2:return a(f[0],f[1]);case 3:return a(f[0],f[1],f[2]);case 4:return a(f[0],f[1],f[2],f[3]);case 5:return a(f[0],f[1],f[2],f[3],f[4]);case 6:return a(f[0],f[1],f[2],f[3],f[4],f[5]);case 7:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6]);case 8:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7]);case 9:return a(f[0],
-f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8]);case 10:return a(f[0],f[1],f[2],f[3],f[4],f[5],f[6],f[7],f[8],f[9]);default:return a.apply(b,f)}}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(E(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return L(e)?e:c},get:c,annotate:Cb}}var h={},f="Provider",j=[],i=new Ga,k={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,I(b))}),
-constant:a(function(a,b){k[a]=b;l[a]=b}),decorator:function(a,b){var c=m.get(a+f),d=c.$get;c.$get=function(){var a=t.invoke(d,c);return t.invoke(b,null,{$delegate:a})}}}},m=g(k,function(){throw Error("Unknown provider: "+j.join(" <- "));}),l={},t=l.$injector=g(l,function(a){a=m.get(a+f);return t.invoke(a.$get,a)});n(e(b),function(a){t.invoke(a||w)});return t}function uc(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=
-null;n(a,function(a){!b&&A(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=h.getElementById(b))?d.scrollIntoView():(d=e(h.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):a.scrollTo(0,0)}var h=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(g)});return g}]}function vc(b,a,c,d){function e(a){try{a.apply(null,ha.call(arguments,1))}finally{if(o--,o===0)for(;p.length;)try{p.pop()()}catch(b){c.error(b)}}}function g(a,b){(function S(){n(s,
-function(a){a()});P=b(S,a)})()}function h(){C!=f.url()&&(C=f.url(),n(W,function(a){a(f.url())}))}var f=this,j=a[0],i=b.location,k=b.history,m=b.setTimeout,l=b.clearTimeout,t={};f.isMock=!1;var o=0,p=[];f.$$completeOutstandingRequest=e;f.$$incOutstandingRequestCount=function(){o++};f.notifyWhenNoOutstandingRequests=function(a){n(s,function(a){a()});o===0?a():p.push(a)};var s=[],P;f.addPollFn=function(a){x(P)&&g(100,m);s.push(a);return a};var C=i.href,z=a.find("base");f.url=function(a,b){if(a){if(C!=
-a)return C=a,d.history?b?k.replaceState(null,"",a):(k.pushState(null,"",a),z.attr("href",z.attr("href"))):b?i.replace(a):i.href=a,f}else return i.href.replace(/%27/g,"'")};var W=[],J=!1;f.onUrlChange=function(a){J||(d.history&&u(b).bind("popstate",h),d.hashchange?u(b).bind("hashchange",h):f.addPollFn(h),J=!0);W.push(a);return a};f.baseHref=function(){var a=z.attr("href");return a?a.replace(/^https?\:\/\/[^\/]*/,""):""};var r={},$="",Q=f.baseHref();f.cookies=function(a,b){var d,e,f,i;if(a)if(b===q)j.cookie=
-escape(a)+"=;path="+Q+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(B(b))d=(j.cookie=escape(a)+"="+escape(b)+";path="+Q).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!")}else{if(j.cookie!==$){$=j.cookie;d=$.split("; ");r={};for(f=0;f<d.length;f++)e=d[f],i=e.indexOf("="),i>0&&(r[unescape(e.substring(0,i))]=unescape(e.substring(i+1)))}return r}};f.defer=function(a,b){var c;o++;c=m(function(){delete t[c];e(a)},b||0);t[c]=!0;return c};
-f.defer.cancel=function(a){return t[a]?(delete t[a],l(a),e(w),!0):!1}}function wc(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new vc(b,d,a,c)}]}function xc(){this.$get=function(){function b(b,d){function e(a){if(a!=m){if(l){if(l==a)l=a.n}else l=a;g(a.n,a.p);g(a,m);m=a;m.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw Error("cacheId "+b+" taken");var h=0,f=v({},d,{id:b}),j={},i=d&&d.capacity||Number.MAX_VALUE,k={},m=null,l=null;return a[b]=
-{put:function(a,b){var c=k[a]||(k[a]={key:a});e(c);x(b)||(a in j||h++,j[a]=b,h>i&&this.remove(l.key))},get:function(a){var b=k[a];if(b)return e(b),j[a]},remove:function(a){var b=k[a];if(b){if(b==m)m=b.p;if(b==l)l=b.n;g(b.n,b.p);delete k[a];delete j[a];h--}},removeAll:function(){j={};h=0;k={};m=l=null},destroy:function(){k=f=j=null;delete a[b]},info:function(){return v({},f,{size:h})}}}var a={};b.info=function(){var b={};n(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}
-function yc(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function Db(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ",h=/^\s*(https?|ftp|mailto|file):/;this.directive=function j(d,e){B(d)?(ab(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];n(a[d],function(a){try{var g=b.invoke(a);if(H(g))g={compile:I(g)};
-else if(!g.compile&&g.link)g.compile=I(g.link);g.priority=g.priority||0;g.name=g.name||d;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"A";e.push(g)}catch(h){c(h)}});return e}])),a[d].push(e)):n(d,ob(j));return this};this.urlSanitizationWhitelist=function(a){return y(a)?(h=a,this):h};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document",function(b,i,k,m,l,t,o,p,s){function P(a,b,c){a instanceof u||(a=u(a));
-n(a,function(b,c){b.nodeType==3&&b.nodeValue.match(/\S+/)&&(a[c]=u(b).wrap("<span></span>").parent()[0])});var d=z(a,b,a,c);return function(b,c){ab(b,"scope");for(var e=c?va.clone.call(a):a,g=0,i=e.length;g<i;g++){var h=e[g];(h.nodeType==1||h.nodeType==9)&&e.eq(g).data("$scope",b)}C(e,"ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function C(a,b){try{a.addClass(b)}catch(c){}}function z(a,b,c,d){function e(a,c,d,i){var h,j,k,o,l,m,t,s=[];l=0;for(m=c.length;l<m;l++)s.push(c[l]);t=l=0;for(m=g.length;l<
-m;t++)j=s[t],c=g[l++],h=g[l++],c?(c.scope?(k=a.$new(L(c.scope)),u(j).data("$scope",k)):k=a,(o=c.transclude)||!i&&b?c(h,k,j,d,function(b){return function(c){var d=a.$new();d.$$transcluded=!0;return b(d,c).bind("$destroy",Ua(d,d.$destroy))}}(o||b)):c(h,k,j,q,i)):h&&h(a,j.childNodes,q,i)}for(var g=[],i,h,j,k=0;k<a.length;k++)h=new ia,i=W(a[k],[],h,d),h=(i=i.length?J(i,a[k],h,b,c):null)&&i.terminal||!a[k].childNodes||!a[k].childNodes.length?null:z(a[k].childNodes,i?i.transclude:b),g.push(i),g.push(h),
-j=j||i||h;return j?e:null}function W(a,b,c,i){var g=c.$attr,h;switch(a.nodeType){case 1:r(b,ea(gb(a).toLowerCase()),"E",i);var j,k,l;h=a.attributes;for(var o=0,m=h&&h.length;o<m;o++)if(j=h[o],j.specified)k=j.name,l=ea(k.toLowerCase()),g[l]=k,c[l]=j=O(Z&&k=="href"?decodeURIComponent(a.getAttribute(k,2)):j.value),Ab(a,l)&&(c[l]=!0),S(a,b,j,l),r(b,l,"A",i);a=a.className;if(B(a)&&a!=="")for(;h=e.exec(a);)l=ea(h[2]),r(b,l,"C",i)&&(c[l]=O(h[3])),a=a.substr(h.index+h[0].length);break;case 3:y(b,a.nodeValue);
-break;case 8:try{if(h=d.exec(a.nodeValue))l=ea(h[1]),r(b,l,"M",i)&&(c[l]=O(h[2]))}catch(t){}}b.sort(F);return b}function J(a,b,c,d,e){function i(a,b){if(a)a.require=r.require,m.push(a);if(b)b.require=r.require,s.push(b)}function h(a,b){var c,d="data",e=!1;if(B(a)){for(;(c=a.charAt(0))=="^"||c=="?";)a=a.substr(1),c=="^"&&(d="inheritedData"),e=e||c=="?";c=b[d]("$"+a+"Controller");if(!c&&!e)throw Error("No controller: "+a);}else E(a)&&(c=[],n(a,function(a){c.push(h(a,b))}));return c}function j(a,d,e,
-i,g){var l,p,r,D,C;l=b===e?c:hc(c,new ia(u(e),c.$attr));p=l.$$element;if(J){var P=/^\s*([@=&])\s*(\w*)\s*$/,ja=d.$parent||d;n(J.scope,function(a,b){var c=a.match(P)||[],e=c[2]||b,c=c[1],i,g,h;d.$$isolateBindings[b]=c+e;switch(c){case "@":l.$observe(e,function(a){d[b]=a});l.$$observers[e].$$scope=ja;break;case "=":g=t(l[e]);h=g.assign||function(){i=d[b]=g(ja);throw Error(Eb+l[e]+" (directive: "+J.name+")");};i=d[b]=g(ja);d.$watch(function(){var a=g(ja);a!==d[b]&&(a!==i?i=d[b]=a:h(ja,a=i=d[b]));return a});
-break;case "&":g=t(l[e]);d[b]=function(a){return g(ja,a)};break;default:throw Error("Invalid isolate scope definition for directive "+J.name+": "+a);}})}y&&n(y,function(a){var b={$scope:d,$element:p,$attrs:l,$transclude:g};C=a.controller;C=="@"&&(C=l[a.name]);p.data("$"+a.name+"Controller",o(C,b))});i=0;for(r=m.length;i<r;i++)try{D=m[i],D(d,p,l,D.require&&h(D.require,p))}catch(z){k(z,qa(p))}a&&a(d,e.childNodes,q,g);i=0;for(r=s.length;i<r;i++)try{D=s[i],D(d,p,l,D.require&&h(D.require,p))}catch(zc){k(zc,
-qa(p))}}for(var l=-Number.MAX_VALUE,m=[],s=[],p=null,J=null,z=null,D=c.$$element=u(b),r,F,T,ka,S=d,y,x,X,v=0,A=a.length;v<A;v++){r=a[v];T=q;if(l>r.priority)break;if(X=r.scope)ua("isolated scope",J,r,D),L(X)&&(C(D,"ng-isolate-scope"),J=r),C(D,"ng-scope"),p=p||r;F=r.name;if(X=r.controller)y=y||{},ua("'"+F+"' controller",y[F],r,D),y[F]=r;if(X=r.transclude)ua("transclusion",ka,r,D),ka=r,l=r.priority,X=="element"?(T=u(b),D=c.$$element=u(Y.createComment(" "+F+": "+c[F]+" ")),b=D[0],w(e,u(T[0]),b),S=P(T,
-d,l)):(T=u(db(b)).contents(),D.html(""),S=P(T,d));if(X=r.template)if(ua("template",z,r,D),z=r,X=Fb(X),r.replace){T=u("<div>"+O(X)+"</div>").contents();b=T[0];if(T.length!=1||b.nodeType!==1)throw Error(g+X);w(e,D,b);F={$attr:{}};a=a.concat(W(b,a.splice(v+1,a.length-(v+1)),F));$(c,F);A=a.length}else D.html(X);if(r.templateUrl)ua("template",z,r,D),z=r,j=Q(a.splice(v,a.length-v),j,D,c,e,r.replace,S),A=a.length;else if(r.compile)try{x=r.compile(D,c,S),H(x)?i(null,x):x&&i(x.pre,x.post)}catch(G){k(G,qa(D))}if(r.terminal)j.terminal=
-!0,l=Math.max(l,r.priority)}j.scope=p&&p.scope;j.transclude=ka&&S;return j}function r(d,e,i,g){var h=!1;if(a.hasOwnProperty(e))for(var l,e=b.get(e+c),o=0,m=e.length;o<m;o++)try{if(l=e[o],(g===q||g>l.priority)&&l.restrict.indexOf(i)!=-1)d.push(l),h=!0}catch(t){k(t)}return h}function $(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;n(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});n(b,function(b,i){i=="class"?(C(e,b),a["class"]=(a["class"]?a["class"]+" ":
-"")+b):i=="style"?e.attr("style",e.attr("style")+";"+b):i.charAt(0)!="$"&&!a.hasOwnProperty(i)&&(a[i]=b,d[i]=c[i])})}function Q(a,b,c,d,e,i,h){var j=[],k,o,t=c[0],s=a.shift(),p=v({},s,{controller:null,templateUrl:null,transclude:null,scope:null});c.html("");m.get(s.templateUrl,{cache:l}).success(function(l){var m,s,l=Fb(l);if(i){s=u("<div>"+O(l)+"</div>").contents();m=s[0];if(s.length!=1||m.nodeType!==1)throw Error(g+l);l={$attr:{}};w(e,c,m);W(m,a,l);$(d,l)}else m=t,c.html(l);a.unshift(p);k=J(a,m,
-d,h);for(o=z(c[0].childNodes,h);j.length;){var ia=j.pop(),l=j.pop();s=j.pop();var r=j.pop(),D=m;s!==t&&(D=db(m),w(l,u(s),D));k(function(){b(o,r,D,e,ia)},r,D,e,ia)}j=null}).error(function(a,b,c,d){throw Error("Failed to load template: "+d.url);});return function(a,c,d,e,i){j?(j.push(c),j.push(d),j.push(e),j.push(i)):k(function(){b(o,c,d,e,i)},c,d,e,i)}}function F(a,b){return b.priority-a.priority}function ua(a,b,c,d){if(b)throw Error("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+
-qa(d));}function y(a,b){var c=i(b,!0);c&&a.push({priority:0,compile:I(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);C(d.data("$binding",e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function S(a,b,c,d){var e=i(c,!0);e&&b.push({priority:100,compile:I(function(a,b,c){b=c.$$observers||(c.$$observers={});d==="class"&&(e=i(c[d],!0));c[d]=q;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function w(a,b,
-c){var d=b[0],e=d.parentNode,i,g;if(a){i=0;for(g=a.length;i<g;i++)if(a[i]==d){a[i]=c;break}}e&&e.replaceChild(c,d);c[u.expando]=d[u.expando];b[0]=c}var ia=function(a,b){this.$$element=a;this.$attr=b||{}};ia.prototype={$normalize:ea,$set:function(a,b,c,d){var e=Ab(this.$$element[0],a),i=this.$$observers;e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=$a(a,"-"));if(gb(this.$$element[0])==="A"&&a==="href")D.setAttribute("href",b),e=D.href,e.match(h)||
-(this[a]=b="unsafe:"+e);c!==!1&&(b===null||b===q?this.$$element.removeAttr(d):this.$$element.attr(d,b));i&&n(i[a],function(a){try{a(b)}catch(c){k(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);p.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var D=s[0].createElement("a"),T=i.startSymbol(),ka=i.endSymbol(),Fb=T=="{{"||ka=="}}"?na:function(a){return a.replace(/\{\{/g,T).replace(/}}/g,ka)};return P}]}function ea(b){return tb(b.replace(Ac,
-""))}function Bc(){var b={};this.register=function(a,c){L(a)?v(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(B(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:hb(e.$scope,g,!0)||hb(c,g,!0);ra(d,g,!0)}return a.instantiate(d,e)}}]}function Cc(){this.$get=["$window",function(b){return u(b.document)}]}function Dc(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function Ec(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):
-b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse",function(c){function d(d,f){for(var j,i,k=0,m=[],l=d.length,t=!1,o=[];k<l;)(j=d.indexOf(b,k))!=-1&&(i=d.indexOf(a,j+e))!=-1?(k!=j&&m.push(d.substring(k,j)),m.push(k=c(t=d.substring(j+e,i))),k.exp=t,k=i+g,t=!0):(k!=l&&m.push(d.substring(k)),k=l);if(!(l=m.length))m.push(""),l=1;if(!f||t)return o.length=l,k=function(a){for(var b=0,c=l,d;b<c;b++){if(typeof(d=m[b])=="function")d=d(a),d==null||d==q?d="":typeof d!="string"&&(d=da(d));
-o[b]=d}return o.join("")},k.exp=d,k.parts=m,k}var e=b.length,g=a.length;d.startSymbol=function(){return b};d.endSymbol=function(){return a};return d}]}function Gb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Ya(b[a]);return b.join("/")}function wa(b,a){var c=Hb.exec(b),c={protocol:c[1],host:c[3],port:G(c[5])||Ib[c[1]]||null,path:c[6]||"/",search:c[8],hash:c[10]};if(a)a.$$protocol=c.protocol,a.$$host=c.host,a.$$port=c.port;return c}function la(b,a,c){return b+"://"+a+(c==Ib[b]?"":":"+c)}function Fc(b,
-a,c){var d=wa(b);return decodeURIComponent(d.path)!=a||x(d.hash)||d.hash.indexOf(c)!==0?b:la(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Gc(b,a,c){var d=wa(b);if(decodeURIComponent(d.path)==a&&!x(d.hash)&&d.hash.indexOf(c)===0)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",h=a.substr(0,a.lastIndexOf("/")),f=d.path.substr(h.length);if(d.path.indexOf(h)!==0)throw Error('Invalid url "'+b+'", missing path prefix "'+h+'" !');return la(d.protocol,
-d.host,d.port)+a+"#"+c+f+e+g}}function ib(b,a,c){a=a||"";this.$$parse=function(b){var c=wa(b,this);if(c.path.indexOf(a)!==0)throw Error('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Wa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=function(){var b=qb(this.$$search),c=this.$$hash?"#"+Ya(this.$$hash):"";this.$$url=Gb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=la(this.$$protocol,
-this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ha(b,a,c){var d;this.$$parse=function(b){var c=wa(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw Error('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Hc.exec((c.hash||"").substr(a.length));this.$$path=c[1]?(c[1].charAt(0)=="/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Wa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||
-"";this.$$compose()};this.$$compose=function(){var b=qb(this.$$search),c=this.$$hash?"#"+Ya(this.$$hash):"";this.$$url=Gb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=la(this.$$protocol,this.$$host,this.$$port)+d+(this.$$url?"#"+a+this.$$url:"")};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Jb(b,a,c,d){Ha.apply(this,arguments);this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==0)return c+d+"#"+a+b.substr(c.length)}}function Ia(b){return function(){return this[b]}}
-function Kb(b,a){return function(c){if(x(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Ic(){var b="",a=!1;this.hashPrefix=function(a){return y(a)?(b=a,this):b};this.html5Mode=function(b){return y(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function h(a){c.$broadcast("$locationChangeSuccess",f.absUrl(),a)}var f,j,i,k=d.url(),m=wa(k);a?(j=d.baseHref()||"/",i=j.substr(0,j.lastIndexOf("/")),m=la(m.protocol,m.host,m.port)+i+"/",
-f=e.history?new ib(Fc(k,j,b),i,m):new Jb(Gc(k,j,b),b,m,j.substr(i.length+1))):(m=la(m.protocol,m.host,m.port)+(m.path||"")+(m.search?"?"+m.search:"")+"#"+b+"/",f=new Ha(k,b,m));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=u(a.target);A(b[0].nodeName)!=="a";)if(b[0]===g[0]||!(b=b.parent())[0])return;var d=b.prop("href"),e=f.$$rewriteAppUrl(d);d&&!b.attr("target")&&e&&(f.$$parse(e),c.$apply(),a.preventDefault(),N.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=
-k&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();f.$$parse(a);h(b)}),c.$$phase||c.$digest())});var l=0;c.$watch(function(){var a=d.url(),b=f.$$replace;if(!l||a!=f.absUrl())l++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),h(a))});f.$$replace=!1;return l});return f}]}function Jc(){this.$get=["$window",function(b){function a(a){a instanceof Error&&(a.stack?a=a.message&&
-a.stack.indexOf(a.message)===-1?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function c(c){var e=b.console||{},g=e[c]||e.log||w;return g.apply?function(){var b=[];n(arguments,function(c){b.push(a(c))});return g.apply(e,b)}:function(a,b){g(a,b)}}return{log:c("log"),warn:c("warn"),info:c("info"),error:c("error")}}]}function Kc(b,a){function c(a){return a.indexOf(s)!=-1}function d(){return o+1<b.length?b.charAt(o+1):!1}function e(a){return"0"<=
-a&&a<="9"}function g(a){return a==" "||a=="\r"||a=="\t"||a=="\n"||a=="\u000b"||a=="\u00a0"}function h(a){return"a"<=a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function j(a,c,d){d=d||o;throw Error("Lexer Error: "+a+" at column"+(y(c)?"s "+c+"-"+o+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function i(){for(var a="",c=o;o<b.length;){var i=A(b.charAt(o));if(i=="."||e(i))a+=i;else{var g=d();if(i=="e"&&f(g))a+=i;else if(f(i)&&g&&e(g)&&a.charAt(a.length-
-1)=="e")a+=i;else if(f(i)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")j("Invalid exponent");else break}o++}a*=1;l.push({index:c,text:a,json:!0,fn:function(){return a}})}function k(){for(var c="",d=o,f,i,j;o<b.length;){var k=b.charAt(o);if(k=="."||h(k)||e(k))k=="."&&(f=o),c+=k;else break;o++}if(f)for(i=o;i<b.length;){k=b.charAt(i);if(k=="("){j=c.substr(f-d+1);c=c.substr(0,f-d);o=i;break}if(g(k))i++;else break}d={index:d,text:c};if(Ja.hasOwnProperty(c))d.fn=d.json=Ja[c];else{var m=Lb(c,a);d.fn=v(function(a,
-b){return m(a,b)},{assign:function(a,b){return Mb(a,c,b)}})}l.push(d);j&&(l.push({index:f,text:".",json:!1}),l.push({index:f+1,text:j,json:!1}))}function m(a){var c=o;o++;for(var d="",e=a,f=!1;o<b.length;){var i=b.charAt(o);e+=i;if(f)i=="u"?(i=b.substring(o+1,o+5),i.match(/[\da-f]{4}/i)||j("Invalid unicode escape [\\u"+i+"]"),o+=4,d+=String.fromCharCode(parseInt(i,16))):(f=Lc[i],d+=f?f:i),f=!1;else if(i=="\\")f=!0;else if(i==a){o++;l.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});
-return}else d+=i;o++}j("Unterminated quote",c)}for(var l=[],t,o=0,p=[],s,P=":";o<b.length;){s=b.charAt(o);if(c("\"'"))m(s);else if(e(s)||c(".")&&e(d()))i();else if(h(s)){if(k(),"{,".indexOf(P)!=-1&&p[0]=="{"&&(t=l[l.length-1]))t.json=t.text.indexOf(".")==-1}else if(c("(){}[].,;:"))l.push({index:o,text:s,json:":[,".indexOf(P)!=-1&&c("{[")||c("}]:,")}),c("{[")&&p.unshift(s),c("}]")&&p.shift(),o++;else if(g(s)){o++;continue}else{var n=s+d(),z=Ja[s],W=Ja[n];W?(l.push({index:o,text:n,fn:W}),o+=2):z?(l.push({index:o,
-text:s,fn:z,json:"[,:".indexOf(P)!=-1&&c("+-")}),o+=1):j("Unexpected next character ",o,o+1)}P=s}return l}function Mc(b,a,c,d){function e(a,c){throw Error("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(Q.length===0)throw Error("Unexpected end of expression: "+b);return Q[0]}function h(a,b,c,d){if(Q.length>0){var e=Q[0],f=e.text;if(f==a||f==b||f==c||f==d||!a&&!b&&!c&&!d)return e}return!1}function f(b,
-c,d,f){return(b=h(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),Q.shift(),b):!1}function j(a){f(a)||e("is unexpected, expecting ["+a+"]",h())}function i(a,b){return function(c,d){return a(c,d,b)}}function k(a,b,c){return function(d,e){return b(d,e,a,c)}}function m(){for(var a=[];;)if(Q.length>0&&!h("}",")",";","]")&&a.push(x()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,e=0;e<a.length;e++){var f=a[e];f&&(d=f(b,c))}return d}}function l(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(F());
-else{var e=function(a,c,e){for(var e=[e],f=0;f<d.length;f++)e.push(d[f](a,c));return b.apply(a,e)};return function(){return e}}}function t(){for(var a=o(),b;;)if(b=f("||"))a=k(a,b.fn,o());else return a}function o(){var a=p(),b;if(b=f("&&"))a=k(a,b.fn,o());return a}function p(){var a=s(),b;if(b=f("==","!="))a=k(a,b.fn,p());return a}function s(){var a;a=n();for(var b;b=f("+","-");)a=k(a,b.fn,n());if(b=f("<",">","<=",">="))a=k(a,b.fn,s());return a}function n(){for(var a=C(),b;b=f("*","/","%");)a=k(a,
-b.fn,C());return a}function C(){var a;return f("+")?z():(a=f("-"))?k(r,a.fn,C()):(a=f("!"))?i(a.fn,C()):z()}function z(){var a;if(f("("))a=x(),j(")");else if(f("["))a=W();else if(f("{"))a=J();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=y(a,c),c=null):b.text==="["?(c=a,a=S(a)):b.text==="."?(c=a,a=u(a)):e("IMPOSSIBLE");return a}function W(){var a=[];if(g().text!="]"){do a.push(F());while(f(","))}j("]");return function(b,c){for(var d=[],e=0;e<
-a.length;e++)d.push(a[e](b,c));return d}}function J(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;j(":");var c=F();a.push({key:b,value:c})}while(f(","))}j("}");return function(b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],i=f.value(b,c);d[f.key]=i}return d}}var r=I(0),$,Q=Kc(b,d),F=function(){var a=t(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+b.substring(0,d.index)+"] can not be assigned to",d),c=t(),function(b,d){return a.assign(b,c(b,d),d)}):a},y=function(a,
-b){var c=[];if(g().text!=")"){do c.push(F());while(f(","))}j(")");return function(d,e){for(var f=[],i=b?b(d,e):d,g=0;g<c.length;g++)f.push(c[g](d,e));g=a(d,e)||w;return g.apply?g.apply(i,f):g(f[0],f[1],f[2],f[3],f[4])}},u=function(a){var b=f().text,c=Lb(b,d);return v(function(b,d){return c(a(b,d),d)},{assign:function(c,d,e){return Mb(a(c,e),b,d)}})},S=function(a){var b=F();j("]");return v(function(c,d){var e=a(c,d),f=b(c,d),i;if(!e)return q;if((e=e[f])&&e.then){i=e;if(!("$$v"in e))i.$$v=q,i.then(function(a){i.$$v=
-a});e=e.$$v}return e},{assign:function(c,d,e){return a(c,e)[b(c,e)]=d}})},x=function(){for(var a=F(),b;;)if(b=f("|"))a=k(a,b.fn,l());else return a};a?(F=t,y=u=S=x=function(){e("is not valid json",{text:b,index:0})},$=z()):$=m();Q.length!==0&&e("is an unexpected token",Q[0]);return $}function Mb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=c}function hb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,h=0;h<g;h++)d=a[h],
-b&&(b=(e=b)[d]);return!c&&H(b)?Ua(e,b):b}function Nb(b,a,c,d,e){return function(g,h){var f=h&&h.hasOwnProperty(b)?h:g,j;if(f===null||f===q)return f;if((f=f[b])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!a||f===null||f===q)return f;if((f=f[a])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!c||f===null||f===q)return f;if((f=f[c])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!d||f===null||f===q)return f;
-if((f=f[d])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}if(!e||f===null||f===q)return f;if((f=f[e])&&f.then){if(!("$$v"in f))j=f,j.$$v=q,j.then(function(a){j.$$v=a});f=f.$$v}return f}}function Lb(b,a){if(jb.hasOwnProperty(b))return jb[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Nb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,i;do i=Nb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=q,a=i;while(e<d);return i};else{var g="var l, fn, p;\n";n(c,function(a,b){g+="if(s === null || s === undefined) return s;\nl=s;\ns="+
-(b?"s":'((k&&k.hasOwnProperty("'+a+'"))?k:s)')+'["'+a+'"];\nif (s && s.then) {\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v=v;});\n}\n s=s.$$v\n}\n'});g+="return s;";e=Function("s","k",g);e.toString=function(){return g}}return jb[b]=e}function Nc(){var b={};this.$get=["$filter","$sniffer",function(a,c){return function(d){switch(typeof d){case "string":return b.hasOwnProperty(d)?b[d]:b[d]=Mc(d,!1,a,c.csp);case "function":return d;default:return w}}}]}function Oc(){this.$get=
-["$rootScope","$exceptionHandler",function(b,a){return Pc(function(a){b.$evalAsync(a)},a)}]}function Pc(b,a){function c(a){return a}function d(a){return h(a)}var e=function(){var f=[],j,i;return i={resolve:function(a){if(f){var c=f;f=q;j=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],j.then(a[0],a[1])})}},reject:function(a){i.resolve(h(a))},promise:{then:function(b,i){var g=e(),h=function(d){try{g.resolve((b||c)(d))}catch(e){a(e),g.reject(e)}},o=function(b){try{g.resolve((i||
-d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([h,o]):j.then(h,o);return g.promise}}}},g=function(a){return a&&a.then?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},h=function(a){return{then:function(c,i){var g=e();b(function(){g.resolve((i||d)(a))});return g.promise}}};return{defer:e,reject:h,when:function(f,j,i){var k=e(),m,l=function(b){try{return(j||c)(b)}catch(d){return a(d),h(d)}},t=function(b){try{return(i||d)(b)}catch(c){return a(c),h(c)}};b(function(){g(f).then(function(a){m||
-(m=!0,k.resolve(g(a).then(l,t)))},function(a){m||(m=!0,k.resolve(t(a)))})});return k.promise},all:function(a){var b=e(),c=a.length,d=[];c?n(a,function(a,e){g(a).then(function(a){e in d||(d[e]=a,--c||b.resolve(d))},function(a){e in d||b.reject(a)})}):b.resolve(d);return b.promise}}}function Qc(){var b={};this.when=function(a,c){b[a]=v({reloadOnSearch:!0},c);if(a){var d=a[a.length-1]=="/"?a.substr(0,a.length-1):a+"/";b[d]={redirectTo:a}}return this};this.otherwise=function(a){this.when(null,a);return this};
-this.$get=["$rootScope","$location","$routeParams","$q","$injector","$http","$templateCache",function(a,c,d,e,g,h,f){function j(a,b){for(var b="^"+b.replace(/[-\/\\^$*+?.()|[\]{}]/g,"\\$&")+"$",c="",d=[],e={},f=/:(\w+)/g,i,g=0;(i=f.exec(b))!==null;)c+=b.slice(g,i.index),c+="([^\\/]*)",d.push(i[1]),g=f.lastIndex;c+=b.substr(g);var h=a.match(RegExp(c));h&&n(d,function(a,b){e[a]=h[b+1]});return h?e:null}function i(){var b=k(),i=t.current;if(b&&i&&b.$$route===i.$$route&&ga(b.pathParams,i.pathParams)&&
-!b.reloadOnSearch&&!l)i.params=b.params,V(i.params,d),a.$broadcast("$routeUpdate",i);else if(b||i)l=!1,a.$broadcast("$routeChangeStart",b,i),(t.current=b)&&b.redirectTo&&(B(b.redirectTo)?c.path(m(b.redirectTo,b.params)).search(b.params).replace():c.url(b.redirectTo(b.pathParams,c.path(),c.search())).replace()),e.when(b).then(function(){if(b){var a=[],c=[],d;n(b.resolve||{},function(b,d){a.push(d);c.push(B(b)?g.get(b):g.invoke(b))});if(!y(d=b.template))if(y(d=b.templateUrl))d=h.get(d,{cache:f}).then(function(a){return a.data});
-y(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c={};n(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==t.current){if(b)b.locals=c,V(b.params,d);a.$broadcast("$routeChangeSuccess",b,i)}},function(c){b==t.current&&a.$broadcast("$routeChangeError",b,i,c)})}function k(){var a,d;n(b,function(b,e){if(!d&&(a=j(c.path(),e)))d=za(b,{params:v({},c.search(),a),pathParams:a}),d.$$route=b});return d||b[null]&&za(b[null],{params:{},pathParams:{}})}function m(a,b){var c=
-[];n((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var l=!1,t={routes:b,reload:function(){l=!0;a.$evalAsync(i)}};a.$on("$locationChangeSuccess",i);return t}]}function Rc(){this.$get=I({})}function Sc(){var b=10;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=ya();this.$$phase=this.$parent=this.$$watchers=
-this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$listeners={};this.$$isolateBindings={}}function g(a){if(j.$$phase)throw Error(j.$$phase+" already in progress");j.$$phase=a}function h(a,b){var c=d(a);ra(c,b);return c}function f(){}e.prototype={$new:function(a){if(H(a))throw Error("API-CHANGE: Use $controller to instantiate controllers.");a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=
-this,a=new a,a.$id=ya());a["this"]=a;a.$$listeners={};a.$parent=this;a.$$asyncQueue=[];a.$$watchers=a.$$nextSibling=a.$$childHead=a.$$childTail=null;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,c){var d=h(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!H(b)){var j=h(b||w,"listener");g.fn=function(a,b,c){j(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){Ta(e,
-g)}},$digest:function(){var a,d,e,h,t,o,p,s=b,n,C=[],z,q;g("$digest");do{p=!1;n=this;do{for(t=n.$$asyncQueue;t.length;)try{n.$eval(t.shift())}catch(J){c(J)}if(h=n.$$watchers)for(o=h.length;o--;)try{if(a=h[o],(d=a.get(n))!==(e=a.last)&&!(a.eq?ga(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))p=!0,a.last=a.eq?V(d):d,a.fn(d,e===f?d:e,n),s<5&&(z=4-s,C[z]||(C[z]=[]),q=H(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):a.exp,q+="; newVal: "+da(d)+"; oldVal: "+da(e),C[z].push(q))}catch(r){c(r)}if(!(h=
-n.$$childHead||n!==this&&n.$$nextSibling))for(;n!==this&&!(h=n.$$nextSibling);)n=n.$parent}while(n=h);if(p&&!s--)throw j.$$phase=null,Error(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+da(C));}while(p||t.length);j.$$phase=null},$destroy:function(){if(!(j==this||this.$$destroyed)){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==this)a.$$childTail=this.$$prevSibling;
-if(this.$$prevSibling)this.$$prevSibling.$$nextSibling=this.$$nextSibling;if(this.$$nextSibling)this.$$nextSibling.$$prevSibling=this.$$prevSibling;this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null}},$eval:function(a,b){return d(a)(this,b)},$evalAsync:function(a){this.$$asyncQueue.push(a)},$apply:function(a){try{return g("$apply"),this.$eval(a)}catch(b){c(b)}finally{j.$$phase=null;try{j.$digest()}catch(d){throw c(d),d;}}},$on:function(a,b){var c=this.$$listeners[a];
-c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[Aa(c,b)]=null}},$emit:function(a,b){var d=[],e,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},j=[h].concat(ha.call(arguments,1)),n,C;do{e=f.$$listeners[a]||d;h.currentScope=f;n=0;for(C=e.length;n<C;n++)if(e[n])try{if(e[n].apply(null,j),g)return h}catch(z){c(z)}else e.splice(n,1),n--,C--;f=f.$parent}while(f);return h},$broadcast:function(a,b){var d=
-this,e=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(ha.call(arguments,1)),h,j;do{d=e;f.currentScope=d;e=d.$$listeners[a]||[];h=0;for(j=e.length;h<j;h++)if(e[h])try{e[h].apply(null,g)}catch(n){c(n)}else e.splice(h,1),h--,j--;if(!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent}while(d=e);return f}};var j=new e;return j}]}function Tc(){this.$get=["$window",function(b){var a={},c=G((/android (\d+)/.exec(A(b.navigator.userAgent))||
-[])[1]);return{history:!(!b.history||!b.history.pushState||c<4),hashchange:"onhashchange"in b&&(!b.document.documentMode||b.document.documentMode>7),hasEvent:function(c){if(c=="input"&&Z==9)return!1;if(x(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Uc(){this.$get=I(N)}function Ob(b){var a={},c,d,e;if(!b)return a;n(b.split("\n"),function(b){e=b.indexOf(":");c=A(O(b.substr(0,e)));d=O(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Pb(b){var a=
-L(b)?b:q;return function(c){a||(a=Ob(b));return c?a[A(c)]||null:a}}function Qb(b,a,c){if(H(c))return c(b,a);n(c,function(c){b=c(b,a)});return b}function Vc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){B(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=pb(d,!0)));return d}],transformRequest:[function(a){return L(a)&&xa.apply(a)!=="[object File]"?da(a):a}],headers:{common:{Accept:"application/json, text/plain, */*","X-Requested-With":"XMLHttpRequest"},
-post:{"Content-Type":"application/json;charset=utf-8"},put:{"Content-Type":"application/json;charset=utf-8"}}},e=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,j,i,k){function m(a){function c(a){var b=v({},a,{data:Qb(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:i.reject(b)}a.method=ma(a.method);var e=a.transformRequest||d.transformRequest,f=a.transformResponse||d.transformResponse,g=d.headers,g=v({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},
-g.common,g[A(a.method)],a.headers),e=Qb(a.data,Pb(g),e),j;x(a.data)&&delete g["Content-Type"];j=l(a,e,g);j=j.then(c,c);n(p,function(a){j=a(j)});j.success=function(b){j.then(function(c){b(c.data,c.status,c.headers,a)});return j};j.error=function(b){j.then(null,function(c){b(c.data,c.status,c.headers,a)});return j};return j}function l(b,c,d){function e(a,b,c){n&&(200<=a&&a<300?n.put(q,[a,b,Ob(c)]):n.remove(q));f(b,a,c);j.$apply()}function f(a,c,d){c=Math.max(c,0);(200<=c&&c<300?k.resolve:k.reject)({data:a,
-status:c,headers:Pb(d),config:b})}function h(){var a=Aa(m.pendingRequests,b);a!==-1&&m.pendingRequests.splice(a,1)}var k=i.defer(),l=k.promise,n,p,q=t(b.url,b.params);m.pendingRequests.push(b);l.then(h,h);b.cache&&b.method=="GET"&&(n=L(b.cache)?b.cache:o);if(n)if(p=n.get(q))if(p.then)return p.then(h,h),p;else E(p)?f(p[1],p[0],V(p[2])):f(p,200,{});else n.put(q,l);p||a(b.method,q,c,e,d,b.timeout,b.withCredentials);return l}function t(a,b){if(!b)return a;var c=[];fc(b,function(a,b){a==null||a==q||(L(a)&&
-(a=da(a)),c.push(encodeURIComponent(b)+"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var o=c("$http"),p=[];n(e,function(a){p.push(B(a)?k.get(a):k.invoke(a))});m.pendingRequests=[];(function(a){n(arguments,function(a){m[a]=function(b,c){return m(v(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){n(arguments,function(a){m[a]=function(b,c,d){return m(v(d||{},{method:a,url:b,data:c}))}})})("post","put");m.defaults=d;return m}]}function Wc(){this.$get=
-["$browser","$window","$document",function(b,a,c){return Xc(b,Yc,b.defer,a.angular.callbacks,c[0],a.location.protocol.replace(":",""))}]}function Xc(b,a,c,d,e,g){function h(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;Z?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=d;e.body.appendChild(c)}return function(e,j,i,k,m,l,t){function o(a,c,d,e){c=(j.match(Hb)||["",g])[1]=="file"?d?200:404:
-c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(w)}b.$$incOutstandingRequestCount();j=j||b.url();if(A(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};h(j.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?o(k,200,d[p].data):o(k,-2);delete d[p]})}else{var s=new a;s.open(e,j,!0);n(m,function(a,b){a&&s.setRequestHeader(b,a)});var q;s.onreadystatechange=function(){if(s.readyState==4){var a=s.getAllResponseHeaders(),b=["Cache-Control","Content-Language",
-"Content-Type","Expires","Last-Modified","Pragma"];a||(a="",n(b,function(b){var c=s.getResponseHeader(b);c&&(a+=b+": "+c+"\n")}));o(k,q||s.status,s.responseText,a)}};if(t)s.withCredentials=!0;s.send(i||"");l>0&&c(function(){q=-1;s.abort()},l)}}}function Zc(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",
-negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January,February,March,April,May,June,July,August,September,October,November,December".split(","),SHORTMONTH:"Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec".split(","),DAY:"Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(","),SHORTDAY:"Sun,Mon,Tue,Wed,Thu,Fri,Sat".split(","),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",
-shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return b===1?"one":"other"}}}}function $c(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,f,j){var i=c.defer(),k=i.promise,m=y(j)&&!j,f=a.defer(function(){try{i.resolve(e())}catch(a){i.reject(a),d(a)}m||b.$apply()},f),j=function(){delete g[k.$$timeoutId]};k.$$timeoutId=f;g[f]=i;k.then(j,j);return k}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),
-a.defer.cancel(b.$$timeoutId)):!1};return e}]}function Rb(b){function a(a,e){return b.factory(a+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",Sb);a("date",Tb);a("filter",ad);a("json",bd);a("limitTo",cd);a("lowercase",dd);a("number",Ub);a("orderBy",Vb);a("uppercase",ed)}function ad(){return function(b,a){if(!E(b))return b;var c=[];c.check=function(a){for(var b=0;b<c.length;b++)if(!c[b](a))return!1;return!0};var d=function(a,
-b){if(b.charAt(0)==="!")return!d(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return(""+a).toLowerCase().indexOf(b)>-1;case "object":for(var c in a)if(c.charAt(0)!=="$"&&d(a[c],b))return!0;return!1;case "array":for(c=0;c<a.length;c++)if(d(a[c],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var e in a)e=="$"?function(){var b=(""+a[e]).toLowerCase();b&&c.push(function(a){return d(a,b)})}():function(){var b=
-e,f=(""+a[e]).toLowerCase();f&&c.push(function(a){return d(hb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=[],h=0;h<b.length;h++){var f=b[h];c.check(f)&&g.push(f)}return g}}function Sb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(x(d))d=a.CURRENCY_SYM;return Wb(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Ub(b){var a=b.NUMBER_FORMATS;return function(b,d){return Wb(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Wb(b,a,c,d,
-e){if(isNaN(b)||!isFinite(b))return"";var g=b<0,b=Math.abs(b),h=b+"",f="",j=[],i=!1;if(h.indexOf("e")!==-1){var k=h.match(/([\d\.]+)e(-?)(\d+)/);k&&k[2]=="-"&&k[3]>e+1?h="0":(f=h,i=!0)}if(!i){h=(h.split(Xb)[1]||"").length;x(e)&&(e=Math.min(Math.max(a.minFrac,h),a.maxFrac));var h=Math.pow(10,e),b=Math.round(b*h)/h,b=(""+b).split(Xb),h=b[0],b=b[1]||"",i=0,k=a.lgSize,m=a.gSize;if(h.length>=k+m)for(var i=h.length-k,l=0;l<i;l++)(i-l)%m===0&&l!==0&&(f+=c),f+=h.charAt(l);for(l=i;l<h.length;l++)(h.length-
-l)%k===0&&l!==0&&(f+=c),f+=h.charAt(l);for(;b.length<e;)b+="0";e&&e!=="0"&&(f+=d+b.substr(0,e))}j.push(g?a.negPre:a.posPre);j.push(f);j.push(g?a.negSuf:a.posSuf);return j.join("")}function kb(b,a,c){var d="";b<0&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function M(b,a,c,d){return function(e){e=e["get"+b]();if(c>0||e>-c)e+=c;e===0&&c==-12&&(e=12);return kb(e,a,d)}}function Ka(b,a){return function(c,d){var e=c["get"+b](),g=ma(a?"SHORT"+b:b);return d[g][e]}}
-function Tb(b){function a(a){var b;if(b=a.match(c)){var a=new Date(0),g=0,h=0;b[9]&&(g=G(b[9]+b[10]),h=G(b[9]+b[11]));a.setUTCFullYear(G(b[1]),G(b[2])-1,G(b[3]));a.setUTCHours(G(b[4]||0)-g,G(b[5]||0)-h,G(b[6]||0),G(b[7]||0))}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var g="",h=[],f,j,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;B(c)&&(c=fd.test(c)?G(c):a(c));Ra(c)&&(c=new Date(c));if(!oa(c))return c;for(;e;)(j=
-gd.exec(e))?(h=h.concat(ha.call(j,1)),e=h.pop()):(h.push(e),e=null);n(h,function(a){f=hd[a];g+=f?f(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function bd(){return function(b){return da(b,!0)}}function cd(){return function(b,a){if(!(b instanceof Array))return b;var a=G(a),c=[],d,e;if(!b||!(b instanceof Array))return c;a>b.length?a=b.length:a<-b.length&&(a=-b.length);a>0?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Vb(b){return function(a,
-c,d){function e(a,b){return Va(b)?function(b,c){return a(c,b)}:a}if(!E(a))return a;if(!c)return a;for(var c=E(c)?c:[c],c=Sa(c,function(a){var c=!1,d=a||na;if(B(a)){if(a.charAt(0)=="+"||a.charAt(0)=="-")c=a.charAt(0)=="-",a=a.substring(1);d=b(a)}return e(function(a,b){var c;c=d(a);var e=d(b),f=typeof c,g=typeof e;f==g?(f=="string"&&(c=c.toLowerCase()),f=="string"&&(e=e.toLowerCase()),c=c===e?0:c<e?-1:1):c=f<g?-1:1;return c},c)}),g=[],h=0;h<a.length;h++)g.push(a[h]);return g.sort(e(function(a,b){for(var d=
-0;d<c.length;d++){var e=c[d](a,b);if(e!==0)return e}return 0},d))}}function R(b){H(b)&&(b={link:b});b.restrict=b.restrict||"AC";return I(b)}function Yb(b,a){function c(a,c){c=c?"-"+$a(c,"-"):"";b.removeClass((a?La:Ma)+c).addClass((a?Ma:La)+c)}var d=this,e=b.parent().controller("form")||Na,g=0,h=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Oa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=
-function(a){a.$name&&d[a.$name]===a&&delete d[a.$name];n(h,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,i){var k=h[a];if(b){if(k&&(Ta(k,i),!k.length)){g--;if(!g)c(b),d.$valid=!0,d.$invalid=!1;h[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(k){if(Aa(k,i)!=-1)return}else h[a]=k=[],g++,c(!1,a),e.$setValidity(a,!1,d);k.push(i);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Oa).addClass(Zb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()}}function U(b){return x(b)||
-b===""||b===null||b!==b}function Pa(b,a,c,d,e,g){var h=function(){var c=O(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",h);else{var f;a.bind("keydown",function(a){a=a.keyCode;a===91||15<a&&a<19||37<=a&&a<=40||f||(f=g.defer(function(){h();f=null}))});a.bind("change",h)}d.$render=function(){a.val(U(d.$viewValue)?"":d.$viewValue)};var j=c.ngPattern,i=function(a,b){return U(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",
-!1),q)};j&&(j.match(/^\/(.*)\/$/)?(j=RegExp(j.substr(1,j.length-2)),e=function(a){return i(j,a)}):e=function(a){var c=b.$eval(j);if(!c||!c.test)throw Error("Expected "+j+" to be a RegExp but was "+c);return i(c,a)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var k=G(c.ngMinlength),e=function(a){return!U(a)&&a.length<k?(d.$setValidity("minlength",!1),q):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var m=G(c.ngMaxlength),c=function(a){return!U(a)&&
-a.length>m?(d.$setValidity("maxlength",!1),q):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function lb(b,a){b="ngClass"+b;return R(function(c,d,e){function g(b){if(a===!0||c.$index%2===a)j&&b!==j&&h(j),f(b);j=b}function h(a){L(a)&&!E(a)&&(a=Sa(a,function(a,b){if(a)return b}));d.removeClass(E(a)?a.join(" "):a)}function f(a){L(a)&&!E(a)&&(a=Sa(a,function(a,b){if(a)return b}));a&&d.addClass(E(a)?a.join(" "):a)}var j=q;c.$watch(e[b],g,!0);e.$observe("class",function(){var a=
-c.$eval(e[b]);g(a,a)});b!=="ngClass"&&c.$watch("$index",function(d,g){var j=d%2;j!==g%2&&(j==a?f(c.$eval(e[b])):h(c.$eval(e[b])))})})}var A=function(b){return B(b)?b.toLowerCase():b},ma=function(b){return B(b)?b.toUpperCase():b},Z=G((/msie (\d+)/.exec(A(navigator.userAgent))||[])[1]),u,ca,ha=[].slice,Qa=[].push,xa=Object.prototype.toString,Za=N.angular||(N.angular={}),ta,gb,aa=["0","0","0"];w.$inject=[];na.$inject=[];gb=Z<9?function(b){b=b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?ma(b.scopeName+
-":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var kc=/[A-Z]/g,id={full:"1.0.6",major:1,minor:0,dot:6,codeName:"universal-irreversibility"},Ca=K.cache={},Ba=K.expando="ng-"+(new Date).getTime(),oc=1,$b=N.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},eb=N.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)},mc=/([\:\-\_]+(.))/g,nc=/^moz([A-Z])/,
-va=K.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;this.bind("DOMContentLoaded",a);K(N).bind("load",a)},toString:function(){var b=[];n(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return b>=0?u(this[b]):u(this[this.length+b])},length:0,push:Qa,sort:[].sort,splice:[].splice},Fa={};n("multiple,selected,checked,disabled,readOnly,required".split(","),function(b){Fa[A(b)]=b});var Bb={};n("input,select,option,textarea,button,form".split(","),function(b){Bb[ma(b)]=
-!0});n({data:wb,inheritedData:Ea,scope:function(b){return Ea(b,"$scope")},controller:zb,injector:function(b){return Ea(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Da,css:function(b,a,c){a=tb(a);if(y(c))b.style[a]=c;else{var d;Z<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];Z<=8&&(d=d===""?q:d);return d}},attr:function(b,a,c){var d=A(a);if(Fa[d])if(y(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||
-w).specified?d:q;else if(y(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?q:b},prop:function(b,a,c){if(y(c))b[a]=c;else return b[a]},text:v(Z<9?function(b,a){if(b.nodeType==1){if(x(a))return b.innerText;b.innerText=a}else{if(x(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(x(a))return b.textContent;b.textContent=a},{$dv:""}),val:function(b,a){if(x(a))return b.value;b.value=a},html:function(b,a){if(x(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)sa(d[c]);
-b.innerHTML=a}},function(b,a){K.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Da&&b!==zb?a:d)===q)if(L(a)){for(e=0;e<this.length;e++)if(b===wb)b(this[e],a);else for(g in a)b(this[e],g,a[g]);return this}else{if(this.length)return b(this[0],a,d)}else{for(e=0;e<this.length;e++)b(this[e],a,d);return this}return b.$dv}});n({removeData:ub,dealoc:sa,bind:function a(c,d,e){var g=ba(c,"events"),h=ba(c,"handle");g||ba(c,"events",g={});h||ba(c,"handle",h=pc(c,g));n(d.split(" "),function(d){var j=g[d];
-if(!j){if(d=="mouseenter"||d=="mouseleave"){var i=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){i++;i==1&&h(a,"mouseenter")});a(c,"mouseout",function(a){i--;i==0&&h(a,"mouseleave")})}else $b(c,d,h),g[d]=[];j=g[d]}j.push(e)})},unbind:vb,replaceWith:function(a,c){var d,e=a.parentNode;sa(a);n(new K(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];n(a.childNodes,function(a){a.nodeType===1&&c.push(a)});return c},contents:function(a){return a.childNodes||
-[]},append:function(a,c){n(new K(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;n(new K(c),function(c){d?a.insertBefore(c,d):(a.appendChild(c),d=c)})}},wrap:function(a,c){var c=u(c)[0],d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){sa(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;n(new K(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:yb,removeClass:xb,
-toggleClass:function(a,c,d){x(d)&&(d=!Da(a,c));(d?yb:xb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;a!=null&&a.nodeType!==1;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName(c)},clone:db,triggerHandler:function(a,c){var d=(ba(a,"events")||{})[c];n(d,function(c){c.call(a,null)})}},function(a,c){K.prototype[c]=function(c,e){for(var g,h=0;h<this.length;h++)g==
-q?(g=a(this[h],c,e),g!==q&&(g=u(g))):cb(g,a(this[h],c,e));return g==q?this:g}});Ga.prototype={put:function(a,c){this[fa(a)]=c},get:function(a){return this[fa(a)]},remove:function(a){var c=this[a=fa(a)];delete this[a];return c}};fb.prototype={push:function(a,c){var d=this[a=fa(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=fa(a)];if(c)return c.length==1?(delete this[a],c[0]):c.shift()},peek:function(a){if(a=this[fa(a)])return a[0]}};var rc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,sc=/,/,tc=
-/^\s*(_?)(\S+?)\1\s*$/,qc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Eb="Non-assignable model expression: ";Db.$inject=["$provide"];var Ac=/^(x[\:\-_]|data[\:\-_])/i,Hb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?(\{?[\w\.-]*\}?)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,ac=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Hc=ac,Ib={http:80,https:443,ftp:21};ib.prototype={$$replace:!1,absUrl:Ia("$$absUrl"),url:function(a,c){if(x(a))return this.$$url;var d=ac.exec(a);d[1]&&this.path(decodeURIComponent(d[1]));if(d[2]||d[1])this.search(d[3]||
-"");this.hash(d[5]||"",c);return this},protocol:Ia("$$protocol"),host:Ia("$$host"),port:Ia("$$port"),path:Kb("$$path",function(a){return a.charAt(0)=="/"?a:"/"+a}),search:function(a,c){if(x(a))return this.$$search;y(c)?c===null?delete this.$$search[a]:this.$$search[a]=c:this.$$search=B(a)?Wa(a):a;this.$$compose();return this},hash:Kb("$$hash",na),replace:function(){this.$$replace=!0;return this}};Ha.prototype=za(ib.prototype);Jb.prototype=za(Ha.prototype);var Ja={"null":function(){return null},"true":function(){return!0},
-"false":function(){return!1},undefined:w,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return y(d)?y(e)?d+e:d:y(e)?e:q},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(y(d)?d:0)-(y(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"=":w,"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},
-">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Lc={n:"\n",f:"\u000c",r:"\r",t:"\t",v:"\u000b","'":"'",'"':'"'},jb={},Yc=N.XMLHttpRequest||function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(c){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(d){}throw Error("This browser does not support XMLHttpRequest.");
-};Rb.$inject=["$provide"];Sb.$inject=["$locale"];Ub.$inject=["$locale"];var Xb=".",hd={yyyy:M("FullYear",4),yy:M("FullYear",2,0,!0),y:M("FullYear",1),MMMM:Ka("Month"),MMM:Ka("Month",!0),MM:M("Month",2,1),M:M("Month",1,1),dd:M("Date",2),d:M("Date",1),HH:M("Hours",2),H:M("Hours",1),hh:M("Hours",2,-12),h:M("Hours",1,-12),mm:M("Minutes",2),m:M("Minutes",1),ss:M("Seconds",2),s:M("Seconds",1),EEEE:Ka("Day"),EEE:Ka("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){var a=
--1*a.getTimezoneOffset(),c=a>=0?"+":"";c+=kb(Math[a>0?"floor":"ceil"](a/60),2)+kb(Math.abs(a%60),2);return c}},gd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,fd=/^\d+$/;Tb.$inject=["$locale"];var dd=I(A),ed=I(ma);Vb.$inject=["$parse"];var jd=I({restrict:"E",compile:function(a,c){Z<=8&&(!c.href&&!c.name&&c.$set("href",""),a.append(Y.createComment("IE fix")));return function(a,c){c.bind("click",function(a){c.attr("href")||a.preventDefault()})}}}),mb={};n(Fa,function(a,
-c){var d=ea("ng-"+c);mb[d]=function(){return{priority:100,compile:function(){return function(a,g,h){a.$watch(h[d],function(a){h.$set(c,!!a)})}}}}});n(["src","href"],function(a){var c=ea("ng-"+a);mb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),Z&&e.prop(a,g[a]))})}}}});var Na={$addControl:w,$removeControl:w,$setValidity:w,$setDirty:w};Yb.$inject=["$element","$attrs","$scope"];var Qa=function(a){return["$timeout",function(c){var d={name:"form",restrict:"E",
-controller:Yb,compile:function(){return{pre:function(a,d,h,f){if(!h.action){var j=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};$b(d[0],"submit",j);d.bind("$destroy",function(){c(function(){eb(d[0],"submit",j)},0,!1)})}var i=d.parent().controller("form"),k=h.name||h.ngForm;k&&(a[k]=f);i&&d.bind("$destroy",function(){i.$removeControl(f);k&&(a[k]=q);v(f,Na)})}}}};return a?v(V(d),{restrict:"EAC"}):d}]},kd=Qa(),ld=Qa(!0),md=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,
-nd=/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/,od=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,bc={text:Pa,number:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);e.$parsers.push(function(a){var c=U(a);return c||od.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",!1),q)});e.$formatters.push(function(a){return U(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!U(a)&&a<f?(e.$setValidity("min",!1),q):(e.$setValidity("min",!0),a)};e.$parsers.push(a);
-e.$formatters.push(a)}if(d.max){var j=parseFloat(d.max),d=function(a){return!U(a)&&a>j?(e.$setValidity("max",!1),q):(e.$setValidity("max",!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return U(a)||Ra(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),q)})},url:function(a,c,d,e,g,h){Pa(a,c,d,e,g,h);a=function(a){return U(a)||md.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),q)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,
-c,d,e,g,h){Pa(a,c,d,e,g,h);a=function(a){return U(a)||nd.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",!1),q)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){x(d.name)&&c.attr("name",ya());c.bind("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var g=d.ngTrueValue,h=d.ngFalseValue;B(g)||(g=!0);B(h)||(h=!1);c.bind("click",
-function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$formatters.push(function(a){return a===g});e.$parsers.push(function(a){return a?g:h})},hidden:w,button:w,submit:w,reset:w},cc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,h){h&&(bc[A(g.type)]||bc.text)(d,e,g,h,c,a)}}}],Ma="ng-valid",La="ng-invalid",Oa="ng-pristine",Zb="ng-dirty",pd=["$scope","$exceptionHandler","$attrs","$element","$parse",
-function(a,c,d,e,g){function h(a,c){c=c?"-"+$a(c,"-"):"";e.removeClass((a?La:Ma)+c).addClass((a?Ma:La)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=d.name;var f=g(d.ngModel),j=f.assign;if(!j)throw Error(Eb+d.ngModel+" ("+qa(e)+")");this.$render=w;var i=e.inheritedData("$formController")||Na,k=0,m=this.$error={};e.addClass(Oa);h(!0);this.$setValidity=function(a,
-c){if(m[a]!==!c){if(c){if(m[a]&&k--,!k)h(!0),this.$valid=!0,this.$invalid=!1}else h(!1),this.$invalid=!0,this.$valid=!1,k++;m[a]=!c;h(c,a);i.$setValidity(a,c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=!0,this.$pristine=!1,e.removeClass(Oa).addClass(Zb),i.$setDirty();n(this.$parsers,function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,j(a,d),n(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var l=this;a.$watch(function(){var c=
-f(a);if(l.$modelValue!==c){var d=l.$formatters,e=d.length;for(l.$modelValue=c;e--;)c=d[e](c);if(l.$viewValue!==c)l.$viewValue=c,l.$render()}})}],qd=function(){return{require:["ngModel","^?form"],controller:pd,link:function(a,c,d,e){var g=e[0],h=e[1]||Na;h.$addControl(g);c.bind("$destroy",function(){h.$removeControl(g)})}}},rd=I({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),dc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=
-!0;var g=function(a){if(d.required&&(U(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);d.$observe("required",function(){g(e.$viewValue)})}}}},sd=function(){return{require:"ngModel",link:function(a,c,d,e){var g=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){var c=[];a&&n(a.split(g),function(a){a&&c.push(O(a))});return c});e.$formatters.push(function(a){return E(a)?a.join(", "):
-q})}}},td=/^(true|false|\d+)$/,ud=function(){return{priority:100,compile:function(a,c){return td.test(c.ngValue)?function(a,c,g){g.$set("value",a.$eval(g.ngValue))}:function(a,c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},vd=R(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==q?"":a)})}),wd=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",
-function(a){d.text(a)})}}],xd=[function(){return function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBindHtmlUnsafe);a.$watch(d.ngBindHtmlUnsafe,function(a){c.html(a||"")})}}],yd=lb("",!0),zd=lb("Odd",0),Ad=lb("Even",1),Bd=R({compile:function(a,c){c.$set("ngCloak",q);a.removeClass("ng-cloak")}}),Cd=[function(){return{scope:!0,controller:"@"}}],Dd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],ec={};n("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),
-function(a){var c=ea("ng-"+a);ec[c]=["$parse",function(d){return function(e,g,h){var f=d(h[c]);g.bind(A(a),function(a){e.$apply(function(){f(e,{$event:a})})})}}]});var Ed=R(function(a,c,d){c.bind("submit",function(){a.$apply(d.ngSubmit)})}),Fd=["$http","$templateCache","$anchorScroll","$compile",function(a,c,d,e){return{restrict:"ECA",terminal:!0,compile:function(g,h){var f=h.ngInclude||h.src,j=h.onload||"",i=h.autoscroll;return function(g,h){var l=0,n,o=function(){n&&(n.$destroy(),n=null);h.html("")};
-g.$watch(f,function(f){var s=++l;f?a.get(f,{cache:c}).success(function(a){s===l&&(n&&n.$destroy(),n=g.$new(),h.html(a),e(h.contents())(n),y(i)&&(!i||g.$eval(i))&&d(),n.$emit("$includeContentLoaded"),g.$eval(j))}).error(function(){s===l&&o()}):o()})}}}}],Gd=R({compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Hd=R({terminal:!0,priority:1E3}),Id=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,h){var f=h.count,j=g.attr(h.$attr.when),i=h.offset||
-0,k=e.$eval(j),m={},l=c.startSymbol(),t=c.endSymbol();n(k,function(a,e){m[e]=c(a.replace(d,l+f+"-"+i+t))});e.$watch(function(){var c=parseFloat(e.$eval(f));return isNaN(c)?"":(k[c]||(c=a.pluralCat(c-i)),m[c](e,g,!0))},function(a){g.text(a)})}}}],Jd=R({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,c,h){var f=h.ngRepeat,h=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),j,i,k;if(!h)throw Error("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=h[1];
-j=h[2];h=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!h)throw Error("'item' in 'item in collection' should be identifier or (key, value) but got '"+f+"'.");i=h[3]||h[1];k=h[2];var m=new fb;a.$watch(function(a){var e,f,h=a.$eval(j),n=c,q=new fb,y,z,u,x,r,v;if(E(h))r=h||[];else{r=[];for(u in h)h.hasOwnProperty(u)&&u.charAt(0)!="$"&&r.push(u);r.sort()}y=r.length-1;e=0;for(f=r.length;e<f;e++){u=h===r?e:r[e];x=h[u];if(v=m.shift(x)){z=v.scope;q.push(x,v);if(e!==v.index)v.index=e,n.after(v.element);
-n=v.element}else z=a.$new();z[i]=x;k&&(z[k]=u);z.$index=e;z.$first=e===0;z.$last=e===y;z.$middle=!(z.$first||z.$last);v||d(z,function(a){n.after(a);v={scope:z,element:n=a,index:e};q.push(x,v)})}for(u in m)if(m.hasOwnProperty(u))for(r=m[u];r.length;)x=r.pop(),x.element.remove(),x.scope.$destroy();m=q})}}}),Kd=R(function(a,c,d){a.$watch(d.ngShow,function(a){c.css("display",Va(a)?"":"none")})}),Ld=R(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Va(a)?"none":"")})}),Md=R(function(a,c,
-d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&n(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Nd=I({restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(a,c,d,e){var g,h,f;a.$watch(d.ngSwitch||d.on,function(j){h&&(f.$destroy(),h.remove(),h=f=null);if(g=e.cases["!"+j]||e.cases["?"])a.$eval(d.change),f=a.$new(),g(f,function(a){h=a;c.append(a)})})}}),Od=R({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,g,h,
-f){f.cases["!"+c.ngSwitchWhen]=d}}}),Pd=R({transclude:"element",priority:500,require:"^ngSwitch",compile:function(a,c,d){return function(a,c,h,f){f.cases["?"]=d}}}),Qd=R({controller:["$transclude","$element",function(a,c){a(function(a){c.append(a)})}]}),Rd=["$http","$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,h){return{restrict:"ECA",terminal:!0,link:function(a,c,i){function k(){var i=d.current&&d.current.locals,k=i&&i.$template;if(k){c.html(k);m&&(m.$destroy(),
-m=null);var k=g(c.contents()),n=d.current;m=n.scope=a.$new();if(n.controller)i.$scope=m,i=h(n.controller,i),c.children().data("$ngControllerController",i);k(m);m.$emit("$viewContentLoaded");m.$eval(l);e()}else c.html(""),m&&(m.$destroy(),m=null)}var m,l=i.onload||"";a.$on("$routeChangeSuccess",k);k()}}}],Sd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){d.type=="text/ng-template"&&a.put(d.id,c[0].text)}}}],Td=I({terminal:!0}),Ud=["$compile","$parse",function(a,
-c){var d=/^\s*(.*?)(?:\s+as\s+(.*?))?(?:\s+group\s+by\s+(.*))?\s+for\s+(?:([\$\w][\$\w\d]*)|(?:\(\s*([\$\w][\$\w\d]*)\s*,\s*([\$\w][\$\w\d]*)\s*\)))\s+in\s+(.*)$/,e={$setViewValue:w};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var j=this,i={},k=e,m;j.databound=d.ngModel;j.init=function(a,c,d){k=a;m=d};j.addOption=function(c){i[c]=!0;k.$viewValue==c&&(a.val(c),m.parent()&&m.remove())};j.removeOption=function(a){this.hasOption(a)&&(delete i[a],
-k.$viewValue==a&&this.renderUnknownOption(a))};j.renderUnknownOption=function(c){c="? "+fa(c)+" ?";m.val(c);a.prepend(m);a.val(c);m.prop("selected",!0)};j.hasOption=function(a){return i.hasOwnProperty(a)};c.$on("$destroy",function(){j.renderUnknownOption=w})}],link:function(e,h,f,j){function i(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(w.parent()&&w.remove(),c.val(a),a===""&&v.prop("selected",!0)):x(a)&&v?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){w.parent()&&
-w.remove();d.$setViewValue(c.val())})})}function k(a,c,d){var e;d.$render=function(){var a=new Ga(d.$viewValue);n(c.find("option"),function(c){c.selected=y(a.get(c.value))})};a.$watch(function(){ga(e,d.$viewValue)||(e=V(d.$viewValue),d.$render())});c.bind("change",function(){a.$apply(function(){var a=[];n(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function m(e,f,g){function h(){var a={"":[]},c=[""],d,i,p,u,v;p=g.$modelValue;u=t(e)||[];var x=l?nb(u):u,y,w,A;w=
-{};v=!1;var B,E;if(o)v=new Ga(p);else if(p===null||s)a[""].push({selected:p===null,id:"",label:""}),v=!0;for(A=0;y=x.length,A<y;A++){w[k]=u[l?w[l]=x[A]:A];d=m(e,w)||"";if(!(i=a[d]))i=a[d]=[],c.push(d);o?d=v.remove(n(e,w))!=q:(d=p===n(e,w),v=v||d);B=j(e,w);B=B===q?"":B;i.push({id:l?x[A]:A,label:B,selected:d})}!o&&!v&&a[""].unshift({id:"?",label:"",selected:!0});w=0;for(x=c.length;w<x;w++){d=c[w];i=a[d];if(r.length<=w)p={element:z.clone().attr("label",d),label:i.label},u=[p],r.push(u),f.append(p.element);
-else if(u=r[w],p=u[0],p.label!=d)p.element.attr("label",p.label=d);B=null;A=0;for(y=i.length;A<y;A++)if(d=i[A],v=u[A+1]){B=v.element;if(v.label!==d.label)B.text(v.label=d.label);if(v.id!==d.id)B.val(v.id=d.id);if(v.element.selected!==d.selected)B.prop("selected",v.selected=d.selected)}else d.id===""&&s?E=s:(E=C.clone()).val(d.id).attr("selected",d.selected).text(d.label),u.push({element:E,label:d.label,id:d.id,selected:d.selected}),B?B.after(E):p.element.append(E),B=E;for(A++;u.length>A;)u.pop().element.remove()}for(;r.length>
-w;)r.pop()[0].element.remove()}var i;if(!(i=p.match(d)))throw Error("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+p+"'.");var j=c(i[2]||i[1]),k=i[4]||i[6],l=i[5],m=c(i[3]||""),n=c(i[2]?i[1]:k),t=c(i[7]),r=[[{element:f,label:""}]];s&&(a(s)(e),s.removeClass("ng-scope"),s.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,c=t(e)||[],d={},h,i,j,m,p,s;if(o){i=[];m=0;for(s=r.length;m<s;m++){a=r[m];j=1;for(p=a.length;j<p;j++)if((h=
-a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(n(e,d))}}else h=f.val(),h=="?"?i=q:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=n(e,d));g.$setViewValue(i)})});g.$render=h;e.$watch(h)}if(j[1]){for(var l=j[0],t=j[1],o=f.multiple,p=f.ngOptions,s=!1,v,C=u(Y.createElement("option")),z=u(Y.createElement("optgroup")),w=C.clone(),j=0,A=h.children(),r=A.length;j<r;j++)if(A[j].value==""){v=s=A.eq(j);break}l.init(t,s,w);if(o&&(f.required||f.ngRequired)){var B=function(a){t.$setValidity("required",
-!f.required||a&&a.length);return a};t.$parsers.push(B);t.$formatters.unshift(B);f.$observe("required",function(){B(t.$viewValue)})}p?m(e,h,t):o?k(e,h,t):i(e,h,t,l)}}}}],Vd=["$interpolate",function(a){var c={addOption:w,removeOption:w};return{restrict:"E",priority:100,compile:function(d,e){if(x(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var i=d.parent(),k=i.data("$selectController")||i.parent().data("$selectController");k&&k.databound?d.prop("selected",!1):k=
-c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&k.removeOption(c);k.addOption(a)}):k.addOption(e.value);d.bind("$destroy",function(){k.removeOption(e.value)})}}}}],Wd=I({restrict:"E",terminal:!0});(ca=N.jQuery)?(u=ca,v(ca.fn,{scope:va.scope,controller:va.controller,injector:va.injector,inheritedData:va.inheritedData}),bb("remove",!0),bb("empty"),bb("html")):u=K;Za.element=u;(function(a){v(a,{bootstrap:rb,copy:V,extend:v,equals:ga,element:u,forEach:n,injector:sb,noop:w,bind:Ua,toJson:da,fromJson:pb,
-identity:na,isUndefined:x,isDefined:y,isString:B,isFunction:H,isObject:L,isNumber:Ra,isElement:gc,isArray:E,version:id,isDate:oa,lowercase:A,uppercase:ma,callbacks:{counter:0}});ta=lc(N);try{ta("ngLocale")}catch(c){ta("ngLocale",[]).provider("$locale",Zc)}ta("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Db).directive({a:jd,input:cc,textarea:cc,form:kd,script:Sd,select:Ud,style:Wd,option:Vd,ngBind:vd,ngBindHtmlUnsafe:xd,ngBindTemplate:wd,ngClass:yd,ngClassEven:Ad,ngClassOdd:zd,ngCsp:Dd,
-ngCloak:Bd,ngController:Cd,ngForm:ld,ngHide:Ld,ngInclude:Fd,ngInit:Gd,ngNonBindable:Hd,ngPluralize:Id,ngRepeat:Jd,ngShow:Kd,ngSubmit:Ed,ngStyle:Md,ngSwitch:Nd,ngSwitchWhen:Od,ngSwitchDefault:Pd,ngOptions:Td,ngView:Rd,ngTransclude:Qd,ngModel:qd,ngList:sd,ngChange:rd,required:dc,ngRequired:dc,ngValue:ud}).directive(mb).directive(ec);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Bc,$document:Cc,$exceptionHandler:Dc,$filter:Rb,$interpolate:Ec,$http:Vc,$httpBackend:Wc,$location:Ic,
-$log:Jc,$parse:Nc,$route:Qc,$routeParams:Rc,$rootScope:Sc,$q:Oc,$sniffer:Tc,$templateCache:yc,$timeout:$c,$window:Uc})}])})(Za);u(Y).ready(function(){jc(Y,rb)})})(window,document);angular.element(document).find("head").append('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak{display:none;}ng\\:form{display:block;}</style>');
diff --git a/static/lib/codemirror/AUTHORS b/static/lib/codemirror/AUTHORS
deleted file mode 100644
index 2ac995f..0000000
--- a/static/lib/codemirror/AUTHORS
+++ /dev/null
@@ -1,647 +0,0 @@
-List of CodeMirror contributors. Updated before every release.
-
-4r2r
-Aaron Brooks
-Abdelouahab
-Abe Fettig
-Adam Ahmed
-Adam King
-Adam Particka
-adanlobato
-Adán Lobato
-Adrian Aichner
-Adrian Heine
-Adrien Bertrand
-aeroson
-Ahmad Amireh
-Ahmad M. Zawawi
-ahoward
-Akeksandr Motsjonov
-Alasdair Smith
-Alberto González Palomo
-Alberto Pose
-Albert Xing
-Alexander Pavlov
-Alexander Schepanovski
-Alexander Shvets
-Alexander Solovyov
-Alexandre Bique
-alexey-k
-Alex Piggott
-Aliaksei Chapyzhenka
-Allen Sarkisyan
-Ami Fischman
-Amin Shali
-Amin Ullah Khan
-amshali@google.com
-Amsul
-amuntean
-Amy
-Ananya Sen
-anaran
-AndersMad
-Anders Nawroth
-Anderson Mesquita
-Anders Wåglund
-Andrea G
-Andreas Reischuck
-Andres Taylor
-Andre von Houck
-Andrew Cheng
-Andrey Fedorov
-Andrey Klyuchnikov
-Andrey Lushnikov
-Andrey Shchekin
-Andy Joslin
-Andy Kimball
-Andy Li
-Angelo
-angelozerr
-angelo.zerr@gmail.com
-Ankit
-Ankit Ahuja
-Ansel Santosa
-Anthony Dugois
-anthonygego
-Anthony Gégo
-Anthony Grimes
-Anton Kovalyov
-Apollo Zhu
-AQNOUCH Mohammed
-areos
-Arnab Bose
-Arthur Müller
-Arun Narasani
-as3boyan
-atelierbram
-AtomicPages LLC
-Atul Bhouraskar
-Aurelian Oancea
-Axel Lewenhaupt
-Barret Rennie
-Basarat Ali Syed
-Bastian Müller
-belhaj
-Bem Jones-Bey
-benbro
-Beni Cherniavsky-Paskin
-Benjamin DeCoste
-Ben Keen
-Ben Miller
-Ben Mosher
-Bernhard Sirlinger
-Bert Chang
-Bharad
-BigBlueHat
-Billy Moon
-binny
-B Krishna Chaitanya
-Blaine G
-blukat29
-boomyjee
-borawjm
-Brad Metcalf
-Brandon Frohs
-Brandon Wamboldt
-Brett Zamir
-Brian Grinstead
-Brian Sletten
-brrd
-Bruce Mitchener
-Bryan Massoth
-Caitlin Potter
-Calin Barbat
-callodacity
-Camilo Roca
-Chad Jolly
-Chandra Sekhar Pydi
-Charles Skelton
-Cheah Chu Yeow
-Chris Coyier
-Chris Ford
-Chris Granger
-Chris Houseknecht
-Chris Lohfink
-Chris Morgan
-Chris Smith
-Christian Oyarzun
-Christian Petrov
-Christopher Brown
-Christopher Kramer
-Christopher Mitchell
-Christopher Pfohl
-Chunliang Lyu
-ciaranj
-CodeAnimal
-coderaiser
-Cole R Lawrence
-ComFreek
-Curtis Gagliardi
-dagsta
-daines
-Dale Jung
-Dan Bentley
-Dan Heberden
-Daniel, Dao Quang Minh
-Daniele Di Sarli
-Daniel Faust
-Daniel Huigens
-Daniel Kesler
-Daniel KJ
-Daniel Neel
-Daniel Parnell
-Danny Yoo
-darealshinji
-Darius Roberts
-Dave Brondsema
-Dave Myers
-David Barnett
-David H. Bronke
-David Mignot
-David Pathakjee
-David Vázquez
-David Whittington
-deebugger
-Deep Thought
-Devin Abbott
-Devon Carew
-Dick Choi
-dignifiedquire
-Dimage Sapelkin
-Dmitry Kiselyov
-domagoj412
-Dominator008
-Domizio Demichelis
-Doug Wikle
-Drew Bratcher
-Drew Hintz
-Drew Khoury
-Drini Cami
-Dror BG
-duralog
-eborden
-edsharp
-ekhaled
-Elisée
-Emmanuel Schanzer
-Enam Mijbah Noor
-Eric Allam
-Erik Welander
-eustas
-Fabien Dubosson
-Fabien O'Carroll
-Fabio Zendhi Nagao
-Faiza Alsaied
-Fauntleroy
-fbuchinger
-feizhang365
-Felipe Lalanne
-Felix Raab
-ficristo
-Filip Noetzel
-Filip Stollár
-flack
-Florian Felten
-ForbesLindesay
-Forbes Lindesay
-Ford_Lawnmower
-Forrest Oliphant
-Frank Wiegand
-Gabriel Gheorghian
-Gabriel Horner
-Gabriel Nahmias
-galambalazs
-Gary Sheng
-Gautam Mehta
-Gavin Douglas
-gekkoe
-Geordie Hall
-geowarin
-Gerard Braad
-Gergely Hegykozi
-Giovanni Calò
-Glebov Boris
-Glenn Jorde
-Glenn Ruehle
-Golevka
-Google Inc.
-Gordon Smith
-Grant Skinner
-greengiant
-Gregory Koberger
-Grzegorz Mazur
-Guillaume Massé
-Guillaume Massé
-guraga
-Gustavo Rodrigues
-Hakan Tunc
-Hans Engel
-Hardest
-Harshvardhan Gupta
-Hasan Karahan
-Hector Oswaldo Caballero
-Hendrik Wallbaum
-Herculano Campos
-Hiroyuki Makino
-hitsthings
-Hocdoc
-Hugues Malphettes
-Ian Beck
-Ian Dickinson
-Ian Wehrman
-Ian Wetherbee
-Ice White
-ICHIKAWA, Yuji
-idleberg
-ilvalle
-Ingo Richter
-Irakli Gozalishvili
-Ivan Kurnosov
-Ivoah
-Jacob Lee
-Jake Peyser
-Jakob Miland
-Jakub Vrana
-Jakub Vrána
-James Campos
-James Howard
-James Thorne
-Jamie Hill
-Jamie Morris
-Jan Jongboom
-jankeromnes
-Jan Keromnes
-Jan Odvarko
-Jan Schär
-Jan T. Sott
-Jared Dean
-Jared Forsyth
-Jared Jacobs
-Jason
-Jason Barnabe
-Jason Grout
-Jason Johnston
-Jason San Jose
-Jason Siefken
-Jaydeep Solanki
-Jean Boussier
-Jeff Blaisdell
-Jeff Jenkins
-jeffkenton
-Jeff Pickhardt
-jem (graphite)
-Jeremy Parmenter
-Jim
-Jim Avery
-JobJob
-jochenberger
-Jochen Berger
-Joel Einbinder
-joelpinheiro
-Johan Ask
-John Connor
-John-David Dalton
-John Engler
-John Lees-Miller
-John Snelson
-John Van Der Loo
-Jon Ander Peñalba
-Jonas Döbertin
-Jonathan Malmaud
-Jon Gacnik
-jongalloway
-Jon Malmaud
-Jon Sangster
-Joost-Wim Boekesteijn
-Joseph Pecoraro
-Josh Barnes
-Josh Cohen
-Josh Soref
-Joshua Newman
-Josh Watzman
-jots
-jsoojeon
-ju1ius
-Juan Benavides Romero
-Jucovschi Constantin
-Juho Vuori
-Julien Rebetez
-Justin Andresen
-Justin Hileman
-jwallers@gmail.com
-kaniga
-karevn
-Kayur Patel
-Kazuhito Hokamura
-Ken Newman
-ken restivo
-Ken Rockot
-Kevin Earls
-Kevin Muret
-Kevin Sawicki
-Kevin Ushey
-Klaus Silveira
-Koh Zi Han, Cliff
-komakino
-Konstantin Lopuhin
-koops
-Kris Ciccarello
-ks-ifware
-kubelsmieci
-KwanEsq
-Kyle Kelley
-Lanfei
-Lanny
-Laszlo Vidacs
-leaf corcoran
-Leonid Khachaturov
-Leon Sorokin
-Leonya Khachaturov
-Liam Newman
-Libo Cannici
-LloydMilligan
-LM
-lochel
-Lorenzo Stoakes
-Luca Fabbri
-Luciano Longo
-Lu Fangjian
-Luke Browning
-Luke Granger-Brown
-Luke Stagner
-lynschinzer
-M1cha
-Madhura Jayaratne
-Maksim Lin
-Maksym Taran
-Malay Majithia
-Manideep
-Manuel Rego Casasnovas
-Marat Dreizin
-Marcel Gerber
-Marcelo Camargo
-Marco Aurélio
-Marco Munizaga
-Marcus Bointon
-Marek Rudnicki
-Marijn Haverbeke
-Mário Gonçalves
-Mario Pietsch
-Mark Anderson
-Mark Lentczner
-Marko Bonaci
-Mark Peace
-Markus Bordihn
-Martin Balek
-Martín Gaitán
-Martin Hasoň
-Martin Hunt
-Martin Laine
-Martin Zagora
-Mason Malone
-Mateusz Paprocki
-Mathias Bynens
-mats cronqvist
-Matt Gaide
-Matthew Bauer
-Matthew Beale
-matthewhayes
-Matthew Rathbone
-Matthias Bussonnier
-Matthias BUSSONNIER
-Matt McDonald
-Matt Pass
-Matt Sacks
-mauricio
-Maximilian Hils
-Maxim Kraev
-Max Kirsch
-Max Schaefer
-Max Xiantu
-mbarkhau
-McBrainy
-mce2
-melpon
-Metatheos
-Micah Dubinko
-Michael
-Michael Goderbauer
-Michael Grey
-Michael Kaminsky
-Michael Lehenbauer
-Michael Zhou
-Michal Dorner
-Mighty Guava
-Miguel Castillo
-mihailik
-Mike
-Mike Brevoort
-Mike Diaz
-Mike Ivanov
-Mike Kadin
-Mike Kobit
-MinRK
-Miraculix87
-misfo
-mkaminsky11
-mloginov
-Moritz Schwörer
-mps
-ms
-mtaran-google
-Mu-An Chiou
-Narciso Jaramillo
-Nathan Williams
-ndr
-nerbert
-nextrevision
-ngn
-nguillaumin
-Ng Zhi An
-Nicholas Bollweg
-Nicholas Bollweg (Nick)
-Nick Kreeger
-Nick Small
-Nicolò Ribaudo
-Niels van Groningen
-nightwing
-Nikita Beloglazov
-Nikita Vasilyev
-Nikolay Kostov
-nilp0inter
-Nisarg Jhaveri
-nlwillia
-noragrossman
-Norman Rzepka
-Oreoluwa Onatemowo
-Oskar Segersvärd
-pablo
-pabloferz
-Pablo Zubieta
-Page
-Panupong Pasupat
-paris
-Paris
-Paris Kasidiaris
-Patil Arpith
-Patrick Stoica
-Patrick Strawderman
-Paul Garvin
-Paul Ivanov
-Paul Masson
-Pavel
-Pavel Feldman
-Pavel Petržela
-Pavel Strashkin
-Paweł Bartkiewicz
-peteguhl
-peter
-Peter Flynn
-peterkroon
-Peter Kroon
-Philipp A
-Philip Stadermann
-Pierre Gerold
-Piët Delport
-Pontus Melke
-prasanthj
-Prasanth J
-Prayag Verma
-Radek Piórkowski
-Rahul
-Rahul Anand
-ramwin1
-Randall Mason
-Randy Burden
-Randy Edmunds
-Rasmus Erik Voel Jensen
-ray ratchup
-Ray Ratchup
-Remi Nyborg
-Renaud Durlin
-Richard Denton
-Richard van der Meer
-Richard Z.H. Wang
-Rishi Goomar
-Robert Crossfield
-Roberto Abdelkader Martínez Pérez
-robertop23
-Robert Plummer
-Rrandom
-Rrrandom
-Ruslan Osmanov
-Ryan Petrello
-Ryan Prior
-sabaca
-Sam Lee
-Samuel Ainsworth
-Sam Wilson
-sandeepshetty
-Sander AKA Redsandro
-Sander Verweij
-santec
-Sascha Peilicke
-satamas
-satchmorun
-sathyamoorthi
-Saul Costa
-S. Chris Colbert
-SCLINIC\jdecker
-Scott Aikin
-Scott Goodhew
-Sebastian Zaha
-Sergey Goder
-Sergey Tselovalnikov
-Se-Won Kim
-shaund
-shaun gilchrist
-Shawn A
-Shea Bunge
-sheopory
-Shiv Deepak
-Shmuel Englard
-Shubham Jain
-Siamak Mokhtari
-silverwind
-sinkuu
-snasa
-soliton4
-sonson
-spastorelli
-srajanpaliwal
-Stanislav Oaserele
-Stas Kobzar
-Stefan Borsje
-Steffen Beyer
-Steffen Bruchmann
-Stephen Lavelle
-Steve Champagne
-Steve Hoover
-Steve O'Hara
-stoskov
-Stu Kennedy
-Sungho Kim
-sverweij
-Taha Jahangir
-takamori
-Tako Schotanus
-Takuji Shimokawa
-Tarmil
-TDaglis
-tel
-tfjgeorge
-Thaddee Tyl
-thanasis
-TheHowl
-themrmax
-think
-Thomas Dvornik
-Thomas Kluyver
-Thomas Schmid
-Tim Alby
-Tim Baumann
-Timothy Farrell
-Timothy Gu
-Timothy Hatcher
-TobiasBg
-Todd Berman
-Tomas-A
-Tomas Varaneckas
-Tom Erik Støwer
-Tom Klancer
-Tom MacWright
-Tony Jian
-Travis Heppe
-Triangle717
-Tristan Tarrant
-TSUYUSATO Kitsune
-twifkak
-VapidWorx
-Vestimir Markov
-vf
-Victor Bocharsky
-Vincent Woo
-Volker Mische
-Weiyan Shao
-wenli
-Wes Cossick
-Wesley Wiser
-Will Binns-Smith
-Will Dean
-William Jamieson
-William Stein
-Willy
-Wojtek Ptak
-Wu Cheng-Han
-Xavier Mendez
-Yassin N. Hassan
-YNH Webdev
-Yunchi Luo
-Yuvi Panda
-Zac Anger
-Zachary Dremann
-Zeno Rocha
-Zhang Hao
-Ziv
-zziuni
-魏鹏刚
diff --git a/static/lib/codemirror/LICENSE b/static/lib/codemirror/LICENSE
deleted file mode 100644
index ff7db4b..0000000
--- a/static/lib/codemirror/LICENSE
+++ /dev/null
@@ -1,21 +0,0 @@
-MIT License
-
-Copyright (C) 2017 by Marijn Haverbeke <marijnh@gmail.com> and others
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
diff --git a/static/lib/codemirror/README.md b/static/lib/codemirror/README.md
deleted file mode 100644
index 3328e3b..0000000
--- a/static/lib/codemirror/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# CodeMirror
-[![Build Status](https://travis-ci.org/codemirror/CodeMirror.svg)](https://travis-ci.org/codemirror/CodeMirror)
-[![NPM version](https://img.shields.io/npm/v/codemirror.svg)](https://www.npmjs.org/package/codemirror)
-[![Join the chat at https://gitter.im/codemirror/CodeMirror](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/codemirror/CodeMirror)  
-[Funding status: ![maintainer happiness](https://marijnhaverbeke.nl/fund/status_s.png?again)](https://marijnhaverbeke.nl/fund/)
-
-CodeMirror is a versatile text editor implemented in JavaScript for
-the browser. It is specialized for editing code, and comes with over
-100 language modes and various addons that implement more advanced
-editing functionality.
-
-A rich programming API and a CSS theming system are available for
-customizing CodeMirror to fit your application, and extending it with
-new functionality.
-
-You can find more information (and the
-[manual](http://codemirror.net/doc/manual.html)) on the [project
-page](http://codemirror.net). For questions and discussion, use the
-[discussion forum](https://discuss.codemirror.net/).
-
-See
-[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
-for contributing guidelines.
-
-The CodeMirror community aims to be welcoming to everybody. We use the
-[Contributor Covenant
-(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
-conduct.
-
-### Quickstart
-
-To build the project, make sure you have Node.js installed (at least version 6)
-and then `npm install`. To run, just open `index.html` in your
-browser (you don't need to run a webserver). Run the tests with `npm test`.
diff --git a/static/lib/codemirror/lib/codemirror.css b/static/lib/codemirror/lib/codemirror.css
deleted file mode 100644
index b962b38..0000000
--- a/static/lib/codemirror/lib/codemirror.css
+++ /dev/null
@@ -1,340 +0,0 @@
-/* BASICS */
-
-.CodeMirror {
-  /* Set height, width, borders, and global font properties here */
-  font-family: monospace;
-  height: 300px;
-  color: black;
-}
-
-/* PADDING */
-
-.CodeMirror-lines {
-  padding: 4px 0; /* Vertical padding around content */
-}
-.CodeMirror pre {
-  padding: 0 4px; /* Horizontal padding of content */
-}
-
-.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
-  background-color: white; /* The little square between H and V scrollbars */
-}
-
-/* GUTTER */
-
-.CodeMirror-gutters {
-  border-right: 1px solid #ddd;
-  background-color: #f7f7f7;
-  white-space: nowrap;
-}
-.CodeMirror-linenumbers {}
-.CodeMirror-linenumber {
-  padding: 0 3px 0 5px;
-  min-width: 20px;
-  text-align: right;
-  color: #999;
-  white-space: nowrap;
-}
-
-.CodeMirror-guttermarker { color: black; }
-.CodeMirror-guttermarker-subtle { color: #999; }
-
-/* CURSOR */
-
-.CodeMirror-cursor {
-  border-left: 1px solid black;
-  border-right: none;
-  width: 0;
-}
-/* Shown when moving in bi-directional text */
-.CodeMirror div.CodeMirror-secondarycursor {
-  border-left: 1px solid silver;
-}
-.cm-fat-cursor .CodeMirror-cursor {
-  width: auto;
-  border: 0 !important;
-  background: #7e7;
-}
-.cm-fat-cursor div.CodeMirror-cursors {
-  z-index: 1;
-}
-
-.cm-animate-fat-cursor {
-  width: auto;
-  border: 0;
-  -webkit-animation: blink 1.06s steps(1) infinite;
-  -moz-animation: blink 1.06s steps(1) infinite;
-  animation: blink 1.06s steps(1) infinite;
-  background-color: #7e7;
-}
-@-moz-keyframes blink {
-  0% {}
-  50% { background-color: transparent; }
-  100% {}
-}
-@-webkit-keyframes blink {
-  0% {}
-  50% { background-color: transparent; }
-  100% {}
-}
-@keyframes blink {
-  0% {}
-  50% { background-color: transparent; }
-  100% {}
-}
-
-/* Can style cursor different in overwrite (non-insert) mode */
-.CodeMirror-overwrite .CodeMirror-cursor {}
-
-.cm-tab { display: inline-block; text-decoration: inherit; }
-
-.CodeMirror-rulers {
-  position: absolute;
-  left: 0; right: 0; top: -50px; bottom: -20px;
-  overflow: hidden;
-}
-.CodeMirror-ruler {
-  border-left: 1px solid #ccc;
-  top: 0; bottom: 0;
-  position: absolute;
-}
-
-/* DEFAULT THEME */
-
-.cm-s-default .cm-header {color: blue;}
-.cm-s-default .cm-quote {color: #090;}
-.cm-negative {color: #d44;}
-.cm-positive {color: #292;}
-.cm-header, .cm-strong {font-weight: bold;}
-.cm-em {font-style: italic;}
-.cm-link {text-decoration: underline;}
-.cm-strikethrough {text-decoration: line-through;}
-
-.cm-s-default .cm-keyword {color: #708;}
-.cm-s-default .cm-atom {color: #219;}
-.cm-s-default .cm-number {color: #164;}
-.cm-s-default .cm-def {color: #00f;}
-.cm-s-default .cm-variable,
-.cm-s-default .cm-punctuation,
-.cm-s-default .cm-property,
-.cm-s-default .cm-operator {}
-.cm-s-default .cm-variable-2 {color: #05a;}
-.cm-s-default .cm-variable-3 {color: #085;}
-.cm-s-default .cm-comment {color: #a50;}
-.cm-s-default .cm-string {color: #a11;}
-.cm-s-default .cm-string-2 {color: #f50;}
-.cm-s-default .cm-meta {color: #555;}
-.cm-s-default .cm-qualifier {color: #555;}
-.cm-s-default .cm-builtin {color: #30a;}
-.cm-s-default .cm-bracket {color: #997;}
-.cm-s-default .cm-tag {color: #170;}
-.cm-s-default .cm-attribute {color: #00c;}
-.cm-s-default .cm-hr {color: #999;}
-.cm-s-default .cm-link {color: #00c;}
-
-.cm-s-default .cm-error {color: #f00;}
-.cm-invalidchar {color: #f00;}
-
-.CodeMirror-composing { border-bottom: 2px solid; }
-
-/* Default styles for common addons */
-
-div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
-div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
-.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
-.CodeMirror-activeline-background {background: #e8f2ff;}
-
-/* STOP */
-
-/* The rest of this file contains styles related to the mechanics of
-   the editor. You probably shouldn't touch them. */
-
-.CodeMirror {
-  position: relative;
-  overflow: hidden;
-  background: white;
-}
-
-.CodeMirror-scroll {
-  overflow: scroll !important; /* Things will break if this is overridden */
-  /* 30px is the magic margin used to hide the element's real scrollbars */
-  /* See overflow: hidden in .CodeMirror */
-  margin-bottom: -30px; margin-right: -30px;
-  padding-bottom: 30px;
-  height: 100%;
-  outline: none; /* Prevent dragging from highlighting the element */
-  position: relative;
-}
-.CodeMirror-sizer {
-  position: relative;
-  border-right: 30px solid transparent;
-}
-
-/* The fake, visible scrollbars. Used to force redraw during scrolling
-   before actual scrolling happens, thus preventing shaking and
-   flickering artifacts. */
-.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
-  position: absolute;
-  z-index: 6;
-  display: none;
-}
-.CodeMirror-vscrollbar {
-  right: 0; top: 0;
-  overflow-x: hidden;
-  overflow-y: scroll;
-}
-.CodeMirror-hscrollbar {
-  bottom: 0; left: 0;
-  overflow-y: hidden;
-  overflow-x: scroll;
-}
-.CodeMirror-scrollbar-filler {
-  right: 0; bottom: 0;
-}
-.CodeMirror-gutter-filler {
-  left: 0; bottom: 0;
-}
-
-.CodeMirror-gutters {
-  position: absolute; left: 0; top: 0;
-  min-height: 100%;
-  z-index: 3;
-}
-.CodeMirror-gutter {
-  white-space: normal;
-  height: 100%;
-  display: inline-block;
-  vertical-align: top;
-  margin-bottom: -30px;
-}
-.CodeMirror-gutter-wrapper {
-  position: absolute;
-  z-index: 4;
-  background: none !important;
-  border: none !important;
-}
-.CodeMirror-gutter-background {
-  position: absolute;
-  top: 0; bottom: 0;
-  z-index: 4;
-}
-.CodeMirror-gutter-elt {
-  position: absolute;
-  cursor: default;
-  z-index: 4;
-}
-.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
-.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
-
-.CodeMirror-lines {
-  cursor: text;
-  min-height: 1px; /* prevents collapsing before first draw */
-}
-.CodeMirror pre {
-  /* Reset some styles that the rest of the page might have set */
-  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
-  border-width: 0;
-  background: transparent;
-  font-family: inherit;
-  font-size: inherit;
-  margin: 0;
-  white-space: pre;
-  word-wrap: normal;
-  line-height: inherit;
-  color: inherit;
-  z-index: 2;
-  position: relative;
-  overflow: visible;
-  -webkit-tap-highlight-color: transparent;
-  -webkit-font-variant-ligatures: contextual;
-  font-variant-ligatures: contextual;
-}
-.CodeMirror-wrap pre {
-  word-wrap: break-word;
-  white-space: pre-wrap;
-  word-break: normal;
-}
-
-.CodeMirror-linebackground {
-  position: absolute;
-  left: 0; right: 0; top: 0; bottom: 0;
-  z-index: 0;
-}
-
-.CodeMirror-linewidget {
-  position: relative;
-  z-index: 2;
-  overflow: auto;
-}
-
-.CodeMirror-widget {}
-
-.CodeMirror-rtl pre { direction: rtl; }
-
-.CodeMirror-code {
-  outline: none;
-}
-
-/* Force content-box sizing for the elements where we expect it */
-.CodeMirror-scroll,
-.CodeMirror-sizer,
-.CodeMirror-gutter,
-.CodeMirror-gutters,
-.CodeMirror-linenumber {
-  -moz-box-sizing: content-box;
-  box-sizing: content-box;
-}
-
-.CodeMirror-measure {
-  position: absolute;
-  width: 100%;
-  height: 0;
-  overflow: hidden;
-  visibility: hidden;
-}
-
-.CodeMirror-cursor {
-  position: absolute;
-  pointer-events: none;
-}
-.CodeMirror-measure pre { position: static; }
-
-div.CodeMirror-cursors {
-  visibility: hidden;
-  position: relative;
-  z-index: 3;
-}
-div.CodeMirror-dragcursors {
-  visibility: visible;
-}
-
-.CodeMirror-focused div.CodeMirror-cursors {
-  visibility: visible;
-}
-
-.CodeMirror-selected { background: #d9d9d9; }
-.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
-.CodeMirror-crosshair { cursor: crosshair; }
-.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
-.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
-
-.cm-searching {
-  background: #ffa;
-  background: rgba(255, 255, 0, .4);
-}
-
-/* Used to force a border model for a node */
-.cm-force-border { padding-right: .1px; }
-
-@media print {
-  /* Hide the cursor when printing */
-  .CodeMirror div.CodeMirror-cursors {
-    visibility: hidden;
-  }
-}
-
-/* See issue #2901 */
-.cm-tab-wrap-hack:after { content: ''; }
-
-/* Help users use markselection to safely style text background */
-span.CodeMirror-selectedtext { background: none; }
diff --git a/static/lib/codemirror/lib/codemirror.js b/static/lib/codemirror/lib/codemirror.js
deleted file mode 100644
index 8f2e33d..0000000
--- a/static/lib/codemirror/lib/codemirror.js
+++ /dev/null
@@ -1,9331 +0,0 @@
-// CodeMirror, copyright (c) by Marijn Haverbeke and others
-// Distributed under an MIT license: http://codemirror.net/LICENSE
-
-// This is CodeMirror (http://codemirror.net), a code editor
-// implemented in JavaScript on top of the browser's DOM.
-//
-// You can find some technical background for some of the code below
-// at http://marijnhaverbeke.nl/blog/#cm-internals .
-
-(function (global, factory) {
-  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
-  typeof define === 'function' && define.amd ? define(factory) :
-  (global.CodeMirror = factory());
-}(this, (function () { 'use strict';
-
-// Kludges for bugs and behavior differences that can't be feature
-// detected are enabled based on userAgent etc sniffing.
-var userAgent = navigator.userAgent
-var platform = navigator.platform
-
-var gecko = /gecko\/\d/i.test(userAgent)
-var ie_upto10 = /MSIE \d/.test(userAgent)
-var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
-var edge = /Edge\/(\d+)/.exec(userAgent)
-var ie = ie_upto10 || ie_11up || edge
-var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
-var webkit = !edge && /WebKit\//.test(userAgent)
-var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
-var chrome = !edge && /Chrome\//.test(userAgent)
-var presto = /Opera\//.test(userAgent)
-var safari = /Apple Computer/.test(navigator.vendor)
-var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
-var phantom = /PhantomJS/.test(userAgent)
-
-var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
-var android = /Android/.test(userAgent)
-// This is woefully incomplete. Suggestions for alternative methods welcome.
-var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
-var mac = ios || /Mac/.test(platform)
-var chromeOS = /\bCrOS\b/.test(userAgent)
-var windows = /win/i.test(platform)
-
-var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
-if (presto_version) { presto_version = Number(presto_version[1]) }
-if (presto_version && presto_version >= 15) { presto = false; webkit = true }
-// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
-var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
-var captureRightClick = gecko || (ie && ie_version >= 9)
-
-function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
-
-var rmClass = function(node, cls) {
-  var current = node.className
-  var match = classTest(cls).exec(current)
-  if (match) {
-    var after = current.slice(match.index + match[0].length)
-    node.className = current.slice(0, match.index) + (after ? match[1] + after : "")
-  }
-}
-
-function removeChildren(e) {
-  for (var count = e.childNodes.length; count > 0; --count)
-    { e.removeChild(e.firstChild) }
-  return e
-}
-
-function removeChildrenAndAdd(parent, e) {
-  return removeChildren(parent).appendChild(e)
-}
-
-function elt(tag, content, className, style) {
-  var e = document.createElement(tag)
-  if (className) { e.className = className }
-  if (style) { e.style.cssText = style }
-  if (typeof content == "string") { e.appendChild(document.createTextNode(content)) }
-  else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]) } }
-  return e
-}
-// wrapper for elt, which removes the elt from the accessibility tree
-function eltP(tag, content, className, style) {
-  var e = elt(tag, content, className, style)
-  e.setAttribute("role", "presentation")
-  return e
-}
-
-var range
-if (document.createRange) { range = function(node, start, end, endNode) {
-  var r = document.createRange()
-  r.setEnd(endNode || node, end)
-  r.setStart(node, start)
-  return r
-} }
-else { range = function(node, start, end) {
-  var r = document.body.createTextRange()
-  try { r.moveToElementText(node.parentNode) }
-  catch(e) { return r }
-  r.collapse(true)
-  r.moveEnd("character", end)
-  r.moveStart("character", start)
-  return r
-} }
-
-function contains(parent, child) {
-  if (child.nodeType == 3) // Android browser always returns false when child is a textnode
-    { child = child.parentNode }
-  if (parent.contains)
-    { return parent.contains(child) }
-  do {
-    if (child.nodeType == 11) { child = child.host }
-    if (child == parent) { return true }
-  } while (child = child.parentNode)
-}
-
-function activeElt() {
-  // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
-  // IE < 10 will throw when accessed while the page is loading or in an iframe.
-  // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
-  var activeElement
-  try {
-    activeElement = document.activeElement
-  } catch(e) {
-    activeElement = document.body || null
-  }
-  while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
-    { activeElement = activeElement.shadowRoot.activeElement }
-  return activeElement
-}
-
-function addClass(node, cls) {
-  var current = node.className
-  if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls }
-}
-function joinClasses(a, b) {
-  var as = a.split(" ")
-  for (var i = 0; i < as.length; i++)
-    { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } }
-  return b
-}
-
-var selectInput = function(node) { node.select() }
-if (ios) // Mobile Safari apparently has a bug where select() is broken.
-  { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length } }
-else if (ie) // Suppress mysterious IE10 errors
-  { selectInput = function(node) { try { node.select() } catch(_e) {} } }
-
-function bind(f) {
-  var args = Array.prototype.slice.call(arguments, 1)
-  return function(){return f.apply(null, args)}
-}
-
-function copyObj(obj, target, overwrite) {
-  if (!target) { target = {} }
-  for (var prop in obj)
-    { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
-      { target[prop] = obj[prop] } }
-  return target
-}
-
-// Counts the column offset in a string, taking tabs into account.
-// Used mostly to find indentation.
-function countColumn(string, end, tabSize, startIndex, startValue) {
-  if (end == null) {
-    end = string.search(/[^\s\u00a0]/)
-    if (end == -1) { end = string.length }
-  }
-  for (var i = startIndex || 0, n = startValue || 0;;) {
-    var nextTab = string.indexOf("\t", i)
-    if (nextTab < 0 || nextTab >= end)
-      { return n + (end - i) }
-    n += nextTab - i
-    n += tabSize - (n % tabSize)
-    i = nextTab + 1
-  }
-}
-
-var Delayed = function() {this.id = null};
-Delayed.prototype.set = function (ms, f) {
-  clearTimeout(this.id)
-  this.id = setTimeout(f, ms)
-};
-
-function indexOf(array, elt) {
-  for (var i = 0; i < array.length; ++i)
-    { if (array[i] == elt) { return i } }
-  return -1
-}
-
-// Number of pixels added to scroller and sizer to hide scrollbar
-var scrollerGap = 30
-
-// Returned or thrown by various protocols to signal 'I'm not
-// handling this'.
-var Pass = {toString: function(){return "CodeMirror.Pass"}}
-
-// Reused option objects for setSelection & friends
-var sel_dontScroll = {scroll: false};
-var sel_mouse = {origin: "*mouse"};
-var sel_move = {origin: "+move"};
-// The inverse of countColumn -- find the offset that corresponds to
-// a particular column.
-function findColumn(string, goal, tabSize) {
-  for (var pos = 0, col = 0;;) {
-    var nextTab = string.indexOf("\t", pos)
-    if (nextTab == -1) { nextTab = string.length }
-    var skipped = nextTab - pos
-    if (nextTab == string.length || col + skipped >= goal)
-      { return pos + Math.min(skipped, goal - col) }
-    col += nextTab - pos
-    col += tabSize - (col % tabSize)
-    pos = nextTab + 1
-    if (col >= goal) { return pos }
-  }
-}
-
-var spaceStrs = [""]
-function spaceStr(n) {
-  while (spaceStrs.length <= n)
-    { spaceStrs.push(lst(spaceStrs) + " ") }
-  return spaceStrs[n]
-}
-
-function lst(arr) { return arr[arr.length-1] }
-
-function map(array, f) {
-  var out = []
-  for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i) }
-  return out
-}
-
-function insertSorted(array, value, score) {
-  var pos = 0, priority = score(value)
-  while (pos < array.length && score(array[pos]) <= priority) { pos++ }
-  array.splice(pos, 0, value)
-}
-
-function nothing() {}
-
-function createObj(base, props) {
-  var inst
-  if (Object.create) {
-    inst = Object.create(base)
-  } else {
-    nothing.prototype = base
-    inst = new nothing()
-  }
-  if (props) { copyObj(props, inst) }
-  return inst
-}
-
-var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
-function isWordCharBasic(ch) {
-  return /\w/.test(ch) || ch > "\x80" &&
-    (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
-}
-function isWordChar(ch, helper) {
-  if (!helper) { return isWordCharBasic(ch) }
-  if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
-  return helper.test(ch)
-}
-
-function isEmpty(obj) {
-  for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
-  return true
-}
-
-// Extending unicode characters. A series of a non-extending char +
-// any number of extending chars is treated as a single unit as far
-// as editing and measuring is concerned. This is not fully correct,
-// since some scripts/fonts/browsers also treat other configurations
-// of code points as a group.
-var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/
-function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
-
-// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
-function skipExtendingChars(str, pos, dir) {
-  while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir }
-  return pos
-}
-
-// Returns the value from the range [`from`; `to`] that satisfies
-// `pred` and is closest to `from`. Assumes that at least `to` satisfies `pred`.
-function findFirst(pred, from, to) {
-  for (;;) {
-    if (Math.abs(from - to) <= 1) { return pred(from) ? from : to }
-    var mid = Math.floor((from + to) / 2)
-    if (pred(mid)) { to = mid }
-    else { from = mid }
-  }
-}
-
-// The display handles the DOM integration, both for input reading
-// and content drawing. It holds references to DOM nodes and
-// display-related state.
-
-function Display(place, doc, input) {
-  var d = this
-  this.input = input
-
-  // Covers bottom-right square when both scrollbars are present.
-  d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
-  d.scrollbarFiller.setAttribute("cm-not-content", "true")
-  // Covers bottom of gutter when coverGutterNextToScrollbar is on
-  // and h scrollbar is present.
-  d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
-  d.gutterFiller.setAttribute("cm-not-content", "true")
-  // Will contain the actual code, positioned to cover the viewport.
-  d.lineDiv = eltP("div", null, "CodeMirror-code")
-  // Elements are added to these to represent selection and cursors.
-  d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
-  d.cursorDiv = elt("div", null, "CodeMirror-cursors")
-  // A visibility: hidden element used to find the size of things.
-  d.measure = elt("div", null, "CodeMirror-measure")
-  // When lines outside of the viewport are measured, they are drawn in this.
-  d.lineMeasure = elt("div", null, "CodeMirror-measure")
-  // Wraps everything that needs to exist inside the vertically-padded coordinate system
-  d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
-                    null, "position: relative; outline: none")
-  var lines = eltP("div", [d.lineSpace], "CodeMirror-lines")
-  // Moved around its parent to cover visible view.
-  d.mover = elt("div", [lines], null, "position: relative")
-  // Set to the height of the document, allowing scrolling.
-  d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
-  d.sizerWidth = null
-  // Behavior of elts with overflow: auto and padding is
-  // inconsistent across browsers. This is used to ensure the
-  // scrollable area is big enough.
-  d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
-  // Will contain the gutters, if any.
-  d.gutters = elt("div", null, "CodeMirror-gutters")
-  d.lineGutter = null
-  // Actual scrollable element.
-  d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
-  d.scroller.setAttribute("tabIndex", "-1")
-  // The element in which the editor lives.
-  d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
-
-  // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
-  if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
-  if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true }
-
-  if (place) {
-    if (place.appendChild) { place.appendChild(d.wrapper) }
-    else { place(d.wrapper) }
-  }
-
-  // Current rendered range (may be bigger than the view window).
-  d.viewFrom = d.viewTo = doc.first
-  d.reportedViewFrom = d.reportedViewTo = doc.first
-  // Information about the rendered lines.
-  d.view = []
-  d.renderedView = null
-  // Holds info about a single rendered line when it was rendered
-  // for measurement, while not in view.
-  d.externalMeasured = null
-  // Empty space (in pixels) above the view
-  d.viewOffset = 0
-  d.lastWrapHeight = d.lastWrapWidth = 0
-  d.updateLineNumbers = null
-
-  d.nativeBarWidth = d.barHeight = d.barWidth = 0
-  d.scrollbarsClipped = false
-
-  // Used to only resize the line number gutter when necessary (when
-  // the amount of lines crosses a boundary that makes its width change)
-  d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
-  // Set to true when a non-horizontal-scrolling line widget is
-  // added. As an optimization, line widget aligning is skipped when
-  // this is false.
-  d.alignWidgets = false
-
-  d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
-
-  // Tracks the maximum line length so that the horizontal scrollbar
-  // can be kept static when scrolling.
-  d.maxLine = null
-  d.maxLineLength = 0
-  d.maxLineChanged = false
-
-  // Used for measuring wheel scrolling granularity
-  d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
-
-  // True when shift is held down.
-  d.shift = false
-
-  // Used to track whether anything happened since the context menu
-  // was opened.
-  d.selForContextMenu = null
-
-  d.activeTouch = null
-
-  input.init(d)
-}
-
-// Find the line object corresponding to the given line number.
-function getLine(doc, n) {
-  n -= doc.first
-  if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
-  var chunk = doc
-  while (!chunk.lines) {
-    for (var i = 0;; ++i) {
-      var child = chunk.children[i], sz = child.chunkSize()
-      if (n < sz) { chunk = child; break }
-      n -= sz
-    }
-  }
-  return chunk.lines[n]
-}
-
-// Get the part of a document between two positions, as an array of
-// strings.
-function getBetween(doc, start, end) {
-  var out = [], n = start.line
-  doc.iter(start.line, end.line + 1, function (line) {
-    var text = line.text
-    if (n == end.line) { text = text.slice(0, end.ch) }
-    if (n == start.line) { text = text.slice(start.ch) }
-    out.push(text)
-    ++n
-  })
-  return out
-}
-// Get the lines between from and to, as array of strings.
-function getLines(doc, from, to) {
-  var out = []
-  doc.iter(from, to, function (line) { out.push(line.text) }) // iter aborts when callback returns truthy value
-  return out
-}
-
-// Update the height of a line, propagating the height change
-// upwards to parent nodes.
-function updateLineHeight(line, height) {
-  var diff = height - line.height
-  if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } }
-}
-
-// Given a line object, find its line number by walking up through
-// its parent links.
-function lineNo(line) {
-  if (line.parent == null) { return null }
-  var cur = line.parent, no = indexOf(cur.lines, line)
-  for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
-    for (var i = 0;; ++i) {
-      if (chunk.children[i] == cur) { break }
-      no += chunk.children[i].chunkSize()
-    }
-  }
-  return no + cur.first
-}
-
-// Find the line at the given vertical position, using the height
-// information in the document tree.
-function lineAtHeight(chunk, h) {
-  var n = chunk.first
-  outer: do {
-    for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
-      var child = chunk.children[i$1], ch = child.height
-      if (h < ch) { chunk = child; continue outer }
-      h -= ch
-      n += child.chunkSize()
-    }
-    return n
-  } while (!chunk.lines)
-  var i = 0
-  for (; i < chunk.lines.length; ++i) {
-    var line = chunk.lines[i], lh = line.height
-    if (h < lh) { break }
-    h -= lh
-  }
-  return n + i
-}
-
-function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
-
-function lineNumberFor(options, i) {
-  return String(options.lineNumberFormatter(i + options.firstLineNumber))
-}
-
-// A Pos instance represents a position within the text.
-function Pos(line, ch, sticky) {
-  if ( sticky === void 0 ) sticky = null;
-
-  if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
-  this.line = line
-  this.ch = ch
-  this.sticky = sticky
-}
-
-// Compare two positions, return 0 if they are the same, a negative
-// number when a is less, and a positive number otherwise.
-function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
-
-function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
-
-function copyPos(x) {return Pos(x.line, x.ch)}
-function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
-function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
-
-// Most of the external API clips given positions to make sure they
-// actually exist within the document.
-function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
-function clipPos(doc, pos) {
-  if (pos.line < doc.first) { return Pos(doc.first, 0) }
-  var last = doc.first + doc.size - 1
-  if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
-  return clipToLen(pos, getLine(doc, pos.line).text.length)
-}
-function clipToLen(pos, linelen) {
-  var ch = pos.ch
-  if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
-  else if (ch < 0) { return Pos(pos.line, 0) }
-  else { return pos }
-}
-function clipPosArray(doc, array) {
-  var out = []
-  for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]) }
-  return out
-}
-
-// Optimize some code when these features are not used.
-var sawReadOnlySpans = false;
-var sawCollapsedSpans = false;
-function seeReadOnlySpans() {
-  sawReadOnlySpans = true
-}
-
-function seeCollapsedSpans() {
-  sawCollapsedSpans = true
-}
-
-// TEXTMARKER SPANS
-
-function MarkedSpan(marker, from, to) {
-  this.marker = marker
-  this.from = from; this.to = to
-}
-
-// Search an array of spans for a span matching the given marker.
-function getMarkedSpanFor(spans, marker) {
-  if (spans) { for (var i = 0; i < spans.length; ++i) {
-    var span = spans[i]
-    if (span.marker == marker) { return span }
-  } }
-}
-// Remove a span from an array, returning undefined if no spans are
-// left (we don't store arrays for lines without spans).
-function removeMarkedSpan(spans, span) {
-  var r
-  for (var i = 0; i < spans.length; ++i)
-    { if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }
-  return r
-}
-// Add a span to a line.
-function addMarkedSpan(line, span) {
-  line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]
-  span.marker.attachLine(line)
-}
-
-// Used for the algorithm that adjusts markers for a change in the
-// document. These functions cut an array of spans at a given
-// character position, returning an array of remaining chunks (or
-// undefined if nothing remains).
-function markedSpansBefore(old, startCh, isInsert) {
-  var nw
-  if (old) { for (var i = 0; i < old.length; ++i) {
-    var span = old[i], marker = span.marker
-    var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
-    if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
-      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
-      ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
-    }
-  } }
-  return nw
-}
-function markedSpansAfter(old, endCh, isInsert) {
-  var nw
-  if (old) { for (var i = 0; i < old.length; ++i) {
-    var span = old[i], marker = span.marker
-    var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
-    if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
-      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
-      ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
-                                            span.to == null ? null : span.to - endCh))
-    }
-  } }
-  return nw
-}
-
-// Given a change object, compute the new set of marker spans that
-// cover the line in which the change took place. Removes spans
-// entirely within the change, reconnects spans belonging to the
-// same marker that appear on both sides of the change, and cuts off
-// spans partially within the change. Returns an array of span
-// arrays with one element for each line in (after) the change.
-function stretchSpansOverChange(doc, change) {
-  if (change.full) { return null }
-  var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
-  var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
-  if (!oldFirst && !oldLast) { return null }
-
-  var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0
-  // Get the spans that 'stick out' on both sides
-  var first = markedSpansBefore(oldFirst, startCh, isInsert)
-  var last = markedSpansAfter(oldLast, endCh, isInsert)
-
-  // Next, merge those two ends
-  var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0)
-  if (first) {
-    // Fix up .to properties of first
-    for (var i = 0; i < first.length; ++i) {
-      var span = first[i]
-      if (span.to == null) {
-        var found = getMarkedSpanFor(last, span.marker)
-        if (!found) { span.to = startCh }
-        else if (sameLine) { span.to = found.to == null ? null : found.to + offset }
-      }
-    }
-  }
-  if (last) {
-    // Fix up .from in last (or move them into first in case of sameLine)
-    for (var i$1 = 0; i$1 < last.length; ++i$1) {
-      var span$1 = last[i$1]
-      if (span$1.to != null) { span$1.to += offset }
-      if (span$1.from == null) {
-        var found$1 = getMarkedSpanFor(first, span$1.marker)
-        if (!found$1) {
-          span$1.from = offset
-          if (sameLine) { (first || (first = [])).push(span$1) }
-        }
-      } else {
-        span$1.from += offset
-        if (sameLine) { (first || (first = [])).push(span$1) }
-      }
-    }
-  }
-  // Make sure we didn't create any zero-length spans
-  if (first) { first = clearEmptySpans(first) }
-  if (last && last != first) { last = clearEmptySpans(last) }
-
-  var newMarkers = [first]
-  if (!sameLine) {
-    // Fill gap with whole-line-spans
-    var gap = change.text.length - 2, gapMarkers
-    if (gap > 0 && first)
-      { for (var i$2 = 0; i$2 < first.length; ++i$2)
-        { if (first[i$2].to == null)
-          { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)) } } }
-    for (var i$3 = 0; i$3 < gap; ++i$3)
-      { newMarkers.push(gapMarkers) }
-    newMarkers.push(last)
-  }
-  return newMarkers
-}
-
-// Remove spans that are empty and don't have a clearWhenEmpty
-// option of false.
-function clearEmptySpans(spans) {
-  for (var i = 0; i < spans.length; ++i) {
-    var span = spans[i]
-    if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
-      { spans.splice(i--, 1) }
-  }
-  if (!spans.length) { return null }
-  return spans
-}
-
-// Used to 'clip' out readOnly ranges when making a change.
-function removeReadOnlyRanges(doc, from, to) {
-  var markers = null
-  doc.iter(from.line, to.line + 1, function (line) {
-    if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
-      var mark = line.markedSpans[i].marker
-      if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
-        { (markers || (markers = [])).push(mark) }
-    } }
-  })
-  if (!markers) { return null }
-  var parts = [{from: from, to: to}]
-  for (var i = 0; i < markers.length; ++i) {
-    var mk = markers[i], m = mk.find(0)
-    for (var j = 0; j < parts.length; ++j) {
-      var p = parts[j]
-      if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
-      var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to)
-      if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
-        { newParts.push({from: p.from, to: m.from}) }
-      if (dto > 0 || !mk.inclusiveRight && !dto)
-        { newParts.push({from: m.to, to: p.to}) }
-      parts.splice.apply(parts, newParts)
-      j += newParts.length - 3
-    }
-  }
-  return parts
-}
-
-// Connect or disconnect spans from a line.
-function detachMarkedSpans(line) {
-  var spans = line.markedSpans
-  if (!spans) { return }
-  for (var i = 0; i < spans.length; ++i)
-    { spans[i].marker.detachLine(line) }
-  line.markedSpans = null
-}
-function attachMarkedSpans(line, spans) {
-  if (!spans) { return }
-  for (var i = 0; i < spans.length; ++i)
-    { spans[i].marker.attachLine(line) }
-  line.markedSpans = spans
-}
-
-// Helpers used when computing which overlapping collapsed span
-// counts as the larger one.
-function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
-function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
-
-// Returns a number indicating which of two overlapping collapsed
-// spans is larger (and thus includes the other). Falls back to
-// comparing ids when the spans cover exactly the same range.
-function compareCollapsedMarkers(a, b) {
-  var lenDiff = a.lines.length - b.lines.length
-  if (lenDiff != 0) { return lenDiff }
-  var aPos = a.find(), bPos = b.find()
-  var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)
-  if (fromCmp) { return -fromCmp }
-  var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)
-  if (toCmp) { return toCmp }
-  return b.id - a.id
-}
-
-// Find out whether a line ends or starts in a collapsed span. If
-// so, return the marker for that span.
-function collapsedSpanAtSide(line, start) {
-  var sps = sawCollapsedSpans && line.markedSpans, found
-  if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
-    sp = sps[i]
-    if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
-        (!found || compareCollapsedMarkers(found, sp.marker) < 0))
-      { found = sp.marker }
-  } }
-  return found
-}
-function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
-function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
-
-// Test whether there exists a collapsed span that partially
-// overlaps (covers the start or end, but not both) of a new span.
-// Such overlap is not allowed.
-function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
-  var line = getLine(doc, lineNo)
-  var sps = sawCollapsedSpans && line.markedSpans
-  if (sps) { for (var i = 0; i < sps.length; ++i) {
-    var sp = sps[i]
-    if (!sp.marker.collapsed) { continue }
-    var found = sp.marker.find(0)
-    var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)
-    var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)
-    if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
-    if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
-        fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
-      { return true }
-  } }
-}
-
-// A visual line is a line as drawn on the screen. Folding, for
-// example, can cause multiple logical lines to appear on the same
-// visual line. This finds the start of the visual line that the
-// given line is part of (usually that is the line itself).
-function visualLine(line) {
-  var merged
-  while (merged = collapsedSpanAtStart(line))
-    { line = merged.find(-1, true).line }
-  return line
-}
-
-function visualLineEnd(line) {
-  var merged
-  while (merged = collapsedSpanAtEnd(line))
-    { line = merged.find(1, true).line }
-  return line
-}
-
-// Returns an array of logical lines that continue the visual line
-// started by the argument, or undefined if there are no such lines.
-function visualLineContinued(line) {
-  var merged, lines
-  while (merged = collapsedSpanAtEnd(line)) {
-    line = merged.find(1, true).line
-    ;(lines || (lines = [])).push(line)
-  }
-  return lines
-}
-
-// Get the line number of the start of the visual line that the
-// given line number is part of.
-function visualLineNo(doc, lineN) {
-  var line = getLine(doc, lineN), vis = visualLine(line)
-  if (line == vis) { return lineN }
-  return lineNo(vis)
-}
-
-// Get the line number of the start of the next visual line after
-// the given line.
-function visualLineEndNo(doc, lineN) {
-  if (lineN > doc.lastLine()) { return lineN }
-  var line = getLine(doc, lineN), merged
-  if (!lineIsHidden(doc, line)) { return lineN }
-  while (merged = collapsedSpanAtEnd(line))
-    { line = merged.find(1, true).line }
-  return lineNo(line) + 1
-}
-
-// Compute whether a line is hidden. Lines count as hidden when they
-// are part of a visual line that starts with another line, or when
-// they are entirely covered by collapsed, non-widget span.
-function lineIsHidden(doc, line) {
-  var sps = sawCollapsedSpans && line.markedSpans
-  if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
-    sp = sps[i]
-    if (!sp.marker.collapsed) { continue }
-    if (sp.from == null) { return true }
-    if (sp.marker.widgetNode) { continue }
-    if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
-      { return true }
-  } }
-}
-function lineIsHiddenInner(doc, line, span) {
-  if (span.to == null) {
-    var end = span.marker.find(1, true)
-    return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
-  }
-  if (span.marker.inclusiveRight && span.to == line.text.length)
-    { return true }
-  for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
-    sp = line.markedSpans[i]
-    if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
-        (sp.to == null || sp.to != span.from) &&
-        (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
-        lineIsHiddenInner(doc, line, sp)) { return true }
-  }
-}
-
-// Find the height above the given line.
-function heightAtLine(lineObj) {
-  lineObj = visualLine(lineObj)
-
-  var h = 0, chunk = lineObj.parent
-  for (var i = 0; i < chunk.lines.length; ++i) {
-    var line = chunk.lines[i]
-    if (line == lineObj) { break }
-    else { h += line.height }
-  }
-  for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
-    for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
-      var cur = p.children[i$1]
-      if (cur == chunk) { break }
-      else { h += cur.height }
-    }
-  }
-  return h
-}
-
-// Compute the character length of a line, taking into account
-// collapsed ranges (see markText) that might hide parts, and join
-// other lines onto it.
-function lineLength(line) {
-  if (line.height == 0) { return 0 }
-  var len = line.text.length, merged, cur = line
-  while (merged = collapsedSpanAtStart(cur)) {
-    var found = merged.find(0, true)
-    cur = found.from.line
-    len += found.from.ch - found.to.ch
-  }
-  cur = line
-  while (merged = collapsedSpanAtEnd(cur)) {
-    var found$1 = merged.find(0, true)
-    len -= cur.text.length - found$1.from.ch
-    cur = found$1.to.line
-    len += cur.text.length - found$1.to.ch
-  }
-  return len
-}
-
-// Find the longest line in the document.
-function findMaxLine(cm) {
-  var d = cm.display, doc = cm.doc
-  d.maxLine = getLine(doc, doc.first)
-  d.maxLineLength = lineLength(d.maxLine)
-  d.maxLineChanged = true
-  doc.iter(function (line) {
-    var len = lineLength(line)
-    if (len > d.maxLineLength) {
-      d.maxLineLength = len
-      d.maxLine = line
-    }
-  })
-}
-
-// BIDI HELPERS
-
-function iterateBidiSections(order, from, to, f) {
-  if (!order) { return f(from, to, "ltr") }
-  var found = false
-  for (var i = 0; i < order.length; ++i) {
-    var part = order[i]
-    if (part.from < to && part.to > from || from == to && part.to == from) {
-      f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr")
-      found = true
-    }
-  }
-  if (!found) { f(from, to, "ltr") }
-}
-
-var bidiOther = null
-function getBidiPartAt(order, ch, sticky) {
-  var found
-  bidiOther = null
-  for (var i = 0; i < order.length; ++i) {
-    var cur = order[i]
-    if (cur.from < ch && cur.to > ch) { return i }
-    if (cur.to == ch) {
-      if (cur.from != cur.to && sticky == "before") { found = i }
-      else { bidiOther = i }
-    }
-    if (cur.from == ch) {
-      if (cur.from != cur.to && sticky != "before") { found = i }
-      else { bidiOther = i }
-    }
-  }
-  return found != null ? found : bidiOther
-}
-
-// Bidirectional ordering algorithm
-// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
-// that this (partially) implements.
-
-// One-char codes used for character types:
-// L (L):   Left-to-Right
-// R (R):   Right-to-Left
-// r (AL):  Right-to-Left Arabic
-// 1 (EN):  European Number
-// + (ES):  European Number Separator
-// % (ET):  European Number Terminator
-// n (AN):  Arabic Number
-// , (CS):  Common Number Separator
-// m (NSM): Non-Spacing Mark
-// b (BN):  Boundary Neutral
-// s (B):   Paragraph Separator
-// t (S):   Segment Separator
-// w (WS):  Whitespace
-// N (ON):  Other Neutrals
-
-// Returns null if characters are ordered as they appear
-// (left-to-right), or an array of sections ({from, to, level}
-// objects) in the order in which they occur visually.
-var bidiOrdering = (function() {
-  // Character types for codepoints 0 to 0xff
-  var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
-  // Character types for codepoints 0x600 to 0x6f9
-  var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"
-  function charType(code) {
-    if (code <= 0xf7) { return lowTypes.charAt(code) }
-    else if (0x590 <= code && code <= 0x5f4) { return "R" }
-    else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
-    else if (0x6ee <= code && code <= 0x8ac) { return "r" }
-    else if (0x2000 <= code && code <= 0x200b) { return "w" }
-    else if (code == 0x200c) { return "b" }
-    else { return "L" }
-  }
-
-  var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/
-  var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/
-
-  function BidiSpan(level, from, to) {
-    this.level = level
-    this.from = from; this.to = to
-  }
-
-  return function(str, direction) {
-    var outerType = direction == "ltr" ? "L" : "R"
-
-    if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
-    var len = str.length, types = []
-    for (var i = 0; i < len; ++i)
-      { types.push(charType(str.charCodeAt(i))) }
-
-    // W1. Examine each non-spacing mark (NSM) in the level run, and
-    // change the type of the NSM to the type of the previous
-    // character. If the NSM is at the start of the level run, it will
-    // get the type of sor.
-    for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
-      var type = types[i$1]
-      if (type == "m") { types[i$1] = prev }
-      else { prev = type }
-    }
-
-    // W2. Search backwards from each instance of a European number
-    // until the first strong type (R, L, AL, or sor) is found. If an
-    // AL is found, change the type of the European number to Arabic
-    // number.
-    // W3. Change all ALs to R.
-    for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
-      var type$1 = types[i$2]
-      if (type$1 == "1" && cur == "r") { types[i$2] = "n" }
-      else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R" } }
-    }
-
-    // W4. A single European separator between two European numbers
-    // changes to a European number. A single common separator between
-    // two numbers of the same type changes to that type.
-    for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
-      var type$2 = types[i$3]
-      if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1" }
-      else if (type$2 == "," && prev$1 == types[i$3+1] &&
-               (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 }
-      prev$1 = type$2
-    }
-
-    // W5. A sequence of European terminators adjacent to European
-    // numbers changes to all European numbers.
-    // W6. Otherwise, separators and terminators change to Other
-    // Neutral.
-    for (var i$4 = 0; i$4 < len; ++i$4) {
-      var type$3 = types[i$4]
-      if (type$3 == ",") { types[i$4] = "N" }
-      else if (type$3 == "%") {
-        var end = (void 0)
-        for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
-        var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"
-        for (var j = i$4; j < end; ++j) { types[j] = replace }
-        i$4 = end - 1
-      }
-    }
-
-    // W7. Search backwards from each instance of a European number
-    // until the first strong type (R, L, or sor) is found. If an L is
-    // found, then change the type of the European number to L.
-    for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
-      var type$4 = types[i$5]
-      if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L" }
-      else if (isStrong.test(type$4)) { cur$1 = type$4 }
-    }
-
-    // N1. A sequence of neutrals takes the direction of the
-    // surrounding strong text if the text on both sides has the same
-    // direction. European and Arabic numbers act as if they were R in
-    // terms of their influence on neutrals. Start-of-level-run (sor)
-    // and end-of-level-run (eor) are used at level run boundaries.
-    // N2. Any remaining neutrals take the embedding direction.
-    for (var i$6 = 0; i$6 < len; ++i$6) {
-      if (isNeutral.test(types[i$6])) {
-        var end$1 = (void 0)
-        for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
-        var before = (i$6 ? types[i$6-1] : outerType) == "L"
-        var after = (end$1 < len ? types[end$1] : outerType) == "L"
-        var replace$1 = before == after ? (before ? "L" : "R") : outerType
-        for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 }
-        i$6 = end$1 - 1
-      }
-    }
-
-    // Here we depart from the documented algorithm, in order to avoid
-    // building up an actual levels array. Since there are only three
-    // levels (0, 1, 2) in an implementation that doesn't take
-    // explicit embedding into account, we can build up the order on
-    // the fly, without following the level-based algorithm.
-    var order = [], m
-    for (var i$7 = 0; i$7 < len;) {
-      if (countsAsLeft.test(types[i$7])) {
-        var start = i$7
-        for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
-        order.push(new BidiSpan(0, start, i$7))
-      } else {
-        var pos = i$7, at = order.length
-        for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
-        for (var j$2 = pos; j$2 < i$7;) {
-          if (countsAsNum.test(types[j$2])) {
-            if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) }
-            var nstart = j$2
-            for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
-            order.splice(at, 0, new BidiSpan(2, nstart, j$2))
-            pos = j$2
-          } else { ++j$2 }
-        }
-        if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)) }
-      }
-    }
-    if (order[0].level == 1 && (m = str.match(/^\s+/))) {
-      order[0].from = m[0].length
-      order.unshift(new BidiSpan(0, 0, m[0].length))
-    }
-    if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
-      lst(order).to -= m[0].length
-      order.push(new BidiSpan(0, len - m[0].length, len))
-    }
-
-    return direction == "rtl" ? order.reverse() : order
-  }
-})()
-
-// Get the bidi ordering for the given line (and cache it). Returns
-// false for lines that are fully left-to-right, and an array of
-// BidiSpan objects otherwise.
-function getOrder(line, direction) {
-  var order = line.order
-  if (order == null) { order = line.order = bidiOrdering(line.text, direction) }
-  return order
-}
-
-function moveCharLogically(line, ch, dir) {
-  var target = skipExtendingChars(line.text, ch + dir, dir)
-  return target < 0 || target > line.text.length ? null : target
-}
-
-function moveLogically(line, start, dir) {
-  var ch = moveCharLogically(line, start.ch, dir)
-  return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
-}
-
-function endOfLine(visually, cm, lineObj, lineNo, dir) {
-  if (visually) {
-    var order = getOrder(lineObj, cm.doc.direction)
-    if (order) {
-      var part = dir < 0 ? lst(order) : order[0]
-      var moveInStorageOrder = (dir < 0) == (part.level == 1)
-      var sticky = moveInStorageOrder ? "after" : "before"
-      var ch
-      // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
-      // it could be that the last bidi part is not on the last visual line,
-      // since visual lines contain content order-consecutive chunks.
-      // Thus, in rtl, we are looking for the first (content-order) character
-      // in the rtl chunk that is on the last line (that is, the same line
-      // as the last (content-order) character).
-      if (part.level > 0) {
-        var prep = prepareMeasureForLine(cm, lineObj)
-        ch = dir < 0 ? lineObj.text.length - 1 : 0
-        var targetTop = measureCharPrepared(cm, prep, ch).top
-        ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch)
-        if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1, true) }
-      } else { ch = dir < 0 ? part.to : part.from }
-      return new Pos(lineNo, ch, sticky)
-    }
-  }
-  return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
-}
-
-function moveVisually(cm, line, start, dir) {
-  var bidi = getOrder(line, cm.doc.direction)
-  if (!bidi) { return moveLogically(line, start, dir) }
-  if (start.ch >= line.text.length) {
-    start.ch = line.text.length
-    start.sticky = "before"
-  } else if (start.ch <= 0) {
-    start.ch = 0
-    start.sticky = "after"
-  }
-  var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]
-  if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
-    // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
-    // nothing interesting happens.
-    return moveLogically(line, start, dir)
-  }
-
-  var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); }
-  var prep
-  var getWrappedLineExtent = function (ch) {
-    if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
-    prep = prep || prepareMeasureForLine(cm, line)
-    return wrappedLineExtentChar(cm, line, prep, ch)
-  }
-  var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch)
-
-  if (cm.doc.direction == "rtl" || part.level == 1) {
-    var moveInStorageOrder = (part.level == 1) == (dir < 0)
-    var ch = mv(start, moveInStorageOrder ? 1 : -1)
-    if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
-      // Case 2: We move within an rtl part or in an rtl editor on the same visual line
-      var sticky = moveInStorageOrder ? "before" : "after"
-      return new Pos(start.line, ch, sticky)
-    }
-  }
-
-  // Case 3: Could not move within this bidi part in this visual line, so leave
-  // the current bidi part
-
-  var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
-    var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
-      ? new Pos(start.line, mv(ch, 1), "before")
-      : new Pos(start.line, ch, "after"); }
-
-    for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
-      var part = bidi[partPos]
-      var moveInStorageOrder = (dir > 0) == (part.level != 1)
-      var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1)
-      if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
-      ch = moveInStorageOrder ? part.from : mv(part.to, -1)
-      if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
-    }
-  }
-
-  // Case 3a: Look for other bidi parts on the same visual line
-  var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent)
-  if (res) { return res }
-
-  // Case 3b: Look for other bidi parts on the next visual line
-  var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1)
-  if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
-    res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh))
-    if (res) { return res }
-  }
-
-  // Case 4: Nowhere to move
-  return null
-}
-
-// EVENT HANDLING
-
-// Lightweight event framework. on/off also work on DOM nodes,
-// registering native DOM handlers.
-
-var noHandlers = []
-
-var on = function(emitter, type, f) {
-  if (emitter.addEventListener) {
-    emitter.addEventListener(type, f, false)
-  } else if (emitter.attachEvent) {
-    emitter.attachEvent("on" + type, f)
-  } else {
-    var map = emitter._handlers || (emitter._handlers = {})
-    map[type] = (map[type] || noHandlers).concat(f)
-  }
-}
-
-function getHandlers(emitter, type) {
-  return emitter._handlers && emitter._handlers[type] || noHandlers
-}
-
-function off(emitter, type, f) {
-  if (emitter.removeEventListener) {
-    emitter.removeEventListener(type, f, false)
-  } else if (emitter.detachEvent) {
-    emitter.detachEvent("on" + type, f)
-  } else {
-    var map = emitter._handlers, arr = map && map[type]
-    if (arr) {
-      var index = indexOf(arr, f)
-      if (index > -1)
-        { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)) }
-    }
-  }
-}
-
-function signal(emitter, type /*, values...*/) {
-  var handlers = getHandlers(emitter, type)
-  if (!handlers.length) { return }
-  var args = Array.prototype.slice.call(arguments, 2)
-  for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args) }
-}
-
-// The DOM events that CodeMirror handles can be overridden by
-// registering a (non-DOM) handler on the editor for the event name,
-// and preventDefault-ing the event in that handler.
-function signalDOMEvent(cm, e, override) {
-  if (typeof e == "string")
-    { e = {type: e, preventDefault: function() { this.defaultPrevented = true }} }
-  signal(cm, override || e.type, cm, e)
-  return e_defaultPrevented(e) || e.codemirrorIgnore
-}
-
-function signalCursorActivity(cm) {
-  var arr = cm._handlers && cm._handlers.cursorActivity
-  if (!arr) { return }
-  var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])
-  for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
-    { set.push(arr[i]) } }
-}
-
-function hasHandler(emitter, type) {
-  return getHandlers(emitter, type).length > 0
-}
-
-// Add on and off methods to a constructor's prototype, to make
-// registering events on such objects more convenient.
-function eventMixin(ctor) {
-  ctor.prototype.on = function(type, f) {on(this, type, f)}
-  ctor.prototype.off = function(type, f) {off(this, type, f)}
-}
-
-// Due to the fact that we still support jurassic IE versions, some
-// compatibility wrappers are needed.
-
-function e_preventDefault(e) {
-  if (e.preventDefault) { e.preventDefault() }
-  else { e.returnValue = false }
-}
-function e_stopPropagation(e) {
-  if (e.stopPropagation) { e.stopPropagation() }
-  else { e.cancelBubble = true }
-}
-function e_defaultPrevented(e) {
-  return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
-}
-function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)}
-
-function e_target(e) {return e.target || e.srcElement}
-function e_button(e) {
-  var b = e.which
-  if (b == null) {
-    if (e.button & 1) { b = 1 }
-    else if (e.button & 2) { b = 3 }
-    else if (e.button & 4) { b = 2 }
-  }
-  if (mac && e.ctrlKey && b == 1) { b = 3 }
-  return b
-}
-
-// Detect drag-and-drop
-var dragAndDrop = function() {
-  // There is *some* kind of drag-and-drop support in IE6-8, but I
-  // couldn't get it to work yet.
-  if (ie && ie_version < 9) { return false }
-  var div = elt('div')
-  return "draggable" in div || "dragDrop" in div
-}()
-
-var zwspSupported
-function zeroWidthElement(measure) {
-  if (zwspSupported == null) {
-    var test = elt("span", "\u200b")
-    removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
-    if (measure.firstChild.offsetHeight != 0)
-      { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8) }
-  }
-  var node = zwspSupported ? elt("span", "\u200b") :
-    elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
-  node.setAttribute("cm-text", "")
-  return node
-}
-
-// Feature-detect IE's crummy client rect reporting for bidi text
-var badBidiRects
-function hasBadBidiRects(measure) {
-  if (badBidiRects != null) { return badBidiRects }
-  var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"))
-  var r0 = range(txt, 0, 1).getBoundingClientRect()
-  var r1 = range(txt, 1, 2).getBoundingClientRect()
-  removeChildren(measure)
-  if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
-  return badBidiRects = (r1.right - r0.right < 3)
-}
-
-// See if "".split is the broken IE version, if so, provide an
-// alternative way to split lines.
-var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
-  var pos = 0, result = [], l = string.length
-  while (pos <= l) {
-    var nl = string.indexOf("\n", pos)
-    if (nl == -1) { nl = string.length }
-    var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl)
-    var rt = line.indexOf("\r")
-    if (rt != -1) {
-      result.push(line.slice(0, rt))
-      pos += rt + 1
-    } else {
-      result.push(line)
-      pos = nl + 1
-    }
-  }
-  return result
-} : function (string) { return string.split(/\r\n?|\n/); }
-
-var hasSelection = window.getSelection ? function (te) {
-  try { return te.selectionStart != te.selectionEnd }
-  catch(e) { return false }
-} : function (te) {
-  var range
-  try {range = te.ownerDocument.selection.createRange()}
-  catch(e) {}
-  if (!range || range.parentElement() != te) { return false }
-  return range.compareEndPoints("StartToEnd", range) != 0
-}
-
-var hasCopyEvent = (function () {
-  var e = elt("div")
-  if ("oncopy" in e) { return true }
-  e.setAttribute("oncopy", "return;")
-  return typeof e.oncopy == "function"
-})()
-
-var badZoomedRects = null
-function hasBadZoomedRects(measure) {
-  if (badZoomedRects != null) { return badZoomedRects }
-  var node = removeChildrenAndAdd(measure, elt("span", "x"))
-  var normal = node.getBoundingClientRect()
-  var fromRange = range(node, 0, 1).getBoundingClientRect()
-  return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
-}
-
-var modes = {};
-var mimeModes = {};
-// Extra arguments are stored as the mode's dependencies, which is
-// used by (legacy) mechanisms like loadmode.js to automatically
-// load a mode. (Preferred mechanism is the require/define calls.)
-function defineMode(name, mode) {
-  if (arguments.length > 2)
-    { mode.dependencies = Array.prototype.slice.call(arguments, 2) }
-  modes[name] = mode
-}
-
-function defineMIME(mime, spec) {
-  mimeModes[mime] = spec
-}
-
-// Given a MIME type, a {name, ...options} config object, or a name
-// string, return a mode config object.
-function resolveMode(spec) {
-  if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
-    spec = mimeModes[spec]
-  } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
-    var found = mimeModes[spec.name]
-    if (typeof found == "string") { found = {name: found} }
-    spec = createObj(found, spec)
-    spec.name = found.name
-  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
-    return resolveMode("application/xml")
-  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
-    return resolveMode("application/json")
-  }
-  if (typeof spec == "string") { return {name: spec} }
-  else { return spec || {name: "null"} }
-}
-
-// Given a mode spec (anything that resolveMode accepts), find and
-// initialize an actual mode object.
-function getMode(options, spec) {
-  spec = resolveMode(spec)
-  var mfactory = modes[spec.name]
-  if (!mfactory) { return getMode(options, "text/plain") }
-  var modeObj = mfactory(options, spec)
-  if (modeExtensions.hasOwnProperty(spec.name)) {
-    var exts = modeExtensions[spec.name]
-    for (var prop in exts) {
-      if (!exts.hasOwnProperty(prop)) { continue }
-      if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] }
-      modeObj[prop] = exts[prop]
-    }
-  }
-  modeObj.name = spec.name
-  if (spec.helperType) { modeObj.helperType = spec.helperType }
-  if (spec.modeProps) { for (var prop$1 in spec.modeProps)
-    { modeObj[prop$1] = spec.modeProps[prop$1] } }
-
-  return modeObj
-}
-
-// This can be used to attach properties to mode objects from
-// outside the actual mode definition.
-var modeExtensions = {}
-function extendMode(mode, properties) {
-  var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
-  copyObj(properties, exts)
-}
-
-function copyState(mode, state) {
-  if (state === true) { return state }
-  if (mode.copyState) { return mode.copyState(state) }
-  var nstate = {}
-  for (var n in state) {
-    var val = state[n]
-    if (val instanceof Array) { val = val.concat([]) }
-    nstate[n] = val
-  }
-  return nstate
-}
-
-// Given a mode and a state (for that mode), find the inner mode and
-// state at the position that the state refers to.
-function innerMode(mode, state) {
-  var info
-  while (mode.innerMode) {
-    info = mode.innerMode(state)
-    if (!info || info.mode == mode) { break }
-    state = info.state
-    mode = info.mode
-  }
-  return info || {mode: mode, state: state}
-}
-
-function startState(mode, a1, a2) {
-  return mode.startState ? mode.startState(a1, a2) : true
-}
-
-// STRING STREAM
-
-// Fed to the mode parsers, provides helper functions to make
-// parsers more succinct.
-
-var StringStream = function(string, tabSize) {
-  this.pos = this.start = 0
-  this.string = string
-  this.tabSize = tabSize || 8
-  this.lastColumnPos = this.lastColumnValue = 0
-  this.lineStart = 0
-};
-
-StringStream.prototype.eol = function () {return this.pos >= this.string.length};
-StringStream.prototype.sol = function () {return this.pos == this.lineStart};
-StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
-StringStream.prototype.next = function () {
-  if (this.pos < this.string.length)
-    { return this.string.charAt(this.pos++) }
-};
-StringStream.prototype.eat = function (match) {
-  var ch = this.string.charAt(this.pos)
-  var ok
-  if (typeof match == "string") { ok = ch == match }
-  else { ok = ch && (match.test ? match.test(ch) : match(ch)) }
-  if (ok) {++this.pos; return ch}
-};
-StringStream.prototype.eatWhile = function (match) {
-  var start = this.pos
-  while (this.eat(match)){}
-  return this.pos > start
-};
-StringStream.prototype.eatSpace = function () {
-    var this$1 = this;
-
-  var start = this.pos
-  while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos }
-  return this.pos > start
-};
-StringStream.prototype.skipToEnd = function () {this.pos = this.string.length};
-StringStream.prototype.skipTo = function (ch) {
-  var found = this.string.indexOf(ch, this.pos)
-  if (found > -1) {this.pos = found; return true}
-};
-StringStream.prototype.backUp = function (n) {this.pos -= n};
-StringStream.prototype.column = function () {
-  if (this.lastColumnPos < this.start) {
-    this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
-    this.lastColumnPos = this.start
-  }
-  return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
-};
-StringStream.prototype.indentation = function () {
-  return countColumn(this.string, null, this.tabSize) -
-    (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
-};
-StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
-  if (typeof pattern == "string") {
-    var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; }
-    var substr = this.string.substr(this.pos, pattern.length)
-    if (cased(substr) == cased(pattern)) {
-      if (consume !== false) { this.pos += pattern.length }
-      return true
-    }
-  } else {
-    var match = this.string.slice(this.pos).match(pattern)
-    if (match && match.index > 0) { return null }
-    if (match && consume !== false) { this.pos += match[0].length }
-    return match
-  }
-};
-StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
-StringStream.prototype.hideFirstChars = function (n, inner) {
-  this.lineStart += n
-  try { return inner() }
-  finally { this.lineStart -= n }
-};
-
-// Compute a style array (an array starting with a mode generation
-// -- for invalidation -- followed by pairs of end positions and
-// style strings), which is used to highlight the tokens on the
-// line.
-function highlightLine(cm, line, state, forceToEnd) {
-  // A styles array always starts with a number identifying the
-  // mode/overlays that it is based on (for easy invalidation).
-  var st = [cm.state.modeGen], lineClasses = {}
-  // Compute the base array of styles
-  runMode(cm, line.text, cm.doc.mode, state, function (end, style) { return st.push(end, style); },
-    lineClasses, forceToEnd)
-
-  // Run overlays, adjust style array.
-  var loop = function ( o ) {
-    var overlay = cm.state.overlays[o], i = 1, at = 0
-    runMode(cm, line.text, overlay.mode, true, function (end, style) {
-      var start = i
-      // Ensure there's a token end at the current position, and that i points at it
-      while (at < end) {
-        var i_end = st[i]
-        if (i_end > end)
-          { st.splice(i, 1, end, st[i+1], i_end) }
-        i += 2
-        at = Math.min(end, i_end)
-      }
-      if (!style) { return }
-      if (overlay.opaque) {
-        st.splice(start, i - start, end, "overlay " + style)
-        i = start + 2
-      } else {
-        for (; start < i; start += 2) {
-          var cur = st[start+1]
-          st[start+1] = (cur ? cur + " " : "") + "overlay " + style
-        }
-      }
-    }, lineClasses)
-  };
-
-  for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
-
-  return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
-}
-
-function getLineStyles(cm, line, updateFrontier) {
-  if (!line.styles || line.styles[0] != cm.state.modeGen) {
-    var state = getStateBefore(cm, lineNo(line))
-    var result = highlightLine(cm, line, line.text.length > cm.options.maxHighlightLength ? copyState(cm.doc.mode, state) : state)
-    line.stateAfter = state
-    line.styles = result.styles
-    if (result.classes) { line.styleClasses = result.classes }
-    else if (line.styleClasses) { line.styleClasses = null }
-    if (updateFrontier === cm.doc.frontier) { cm.doc.frontier++ }
-  }
-  return line.styles
-}
-
-function getStateBefore(cm, n, precise) {
-  var doc = cm.doc, display = cm.display
-  if (!doc.mode.startState) { return true }
-  var pos = findStartLine(cm, n, precise), state = pos > doc.first && getLine(doc, pos-1).stateAfter
-  if (!state) { state = startState(doc.mode) }
-  else { state = copyState(doc.mode, state) }
-  doc.iter(pos, n, function (line) {
-    processLine(cm, line.text, state)
-    var save = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo
-    line.stateAfter = save ? copyState(doc.mode, state) : null
-    ++pos
-  })
-  if (precise) { doc.frontier = pos }
-  return state
-}
-
-// Lightweight form of highlight -- proceed over this line and
-// update state, but don't save a style array. Used for lines that
-// aren't currently visible.
-function processLine(cm, text, state, startAt) {
-  var mode = cm.doc.mode
-  var stream = new StringStream(text, cm.options.tabSize)
-  stream.start = stream.pos = startAt || 0
-  if (text == "") { callBlankLine(mode, state) }
-  while (!stream.eol()) {
-    readToken(mode, stream, state)
-    stream.start = stream.pos
-  }
-}
-
-function callBlankLine(mode, state) {
-  if (mode.blankLine) { return mode.blankLine(state) }
-  if (!mode.innerMode) { return }
-  var inner = innerMode(mode, state)
-  if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
-}
-
-function readToken(mode, stream, state, inner) {
-  for (var i = 0; i < 10; i++) {
-    if (inner) { inner[0] = innerMode(mode, state).mode }
-    var style = mode.token(stream, state)
-    if (stream.pos > stream.start) { return style }
-  }
-  throw new Error("Mode " + mode.name + " failed to advance stream.")
-}
-
-// Utility for getTokenAt and getLineTokens
-function takeToken(cm, pos, precise, asArray) {
-  var getObj = function (copy) { return ({
-    start: stream.start, end: stream.pos,
-    string: stream.current(),
-    type: style || null,
-    state: copy ? copyState(doc.mode, state) : state
-  }); }
-
-  var doc = cm.doc, mode = doc.mode, style
-  pos = clipPos(doc, pos)
-  var line = getLine(doc, pos.line), state = getStateBefore(cm, pos.line, precise)
-  var stream = new StringStream(line.text, cm.options.tabSize), tokens
-  if (asArray) { tokens = [] }
-  while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
-    stream.start = stream.pos
-    style = readToken(mode, stream, state)
-    if (asArray) { tokens.push(getObj(true)) }
-  }
-  return asArray ? tokens : getObj()
-}
-
-function extractLineClasses(type, output) {
-  if (type) { for (;;) {
-    var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/)
-    if (!lineClass) { break }
-    type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length)
-    var prop = lineClass[1] ? "bgClass" : "textClass"
-    if (output[prop] == null)
-      { output[prop] = lineClass[2] }
-    else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
-      { output[prop] += " " + lineClass[2] }
-  } }
-  return type
-}
-
-// Run the given mode's parser over a line, calling f for each token.
-function runMode(cm, text, mode, state, f, lineClasses, forceToEnd) {
-  var flattenSpans = mode.flattenSpans
-  if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans }
-  var curStart = 0, curStyle = null
-  var stream = new StringStream(text, cm.options.tabSize), style
-  var inner = cm.options.addModeClass && [null]
-  if (text == "") { extractLineClasses(callBlankLine(mode, state), lineClasses) }
-  while (!stream.eol()) {
-    if (stream.pos > cm.options.maxHighlightLength) {
-      flattenSpans = false
-      if (forceToEnd) { processLine(cm, text, state, stream.pos) }
-      stream.pos = text.length
-      style = null
-    } else {
-      style = extractLineClasses(readToken(mode, stream, state, inner), lineClasses)
-    }
-    if (inner) {
-      var mName = inner[0].name
-      if (mName) { style = "m-" + (style ? mName + " " + style : mName) }
-    }
-    if (!flattenSpans || curStyle != style) {
-      while (curStart < stream.start) {
-        curStart = Math.min(stream.start, curStart + 5000)
-        f(curStart, curStyle)
-      }
-      curStyle = style
-    }
-    stream.start = stream.pos
-  }
-  while (curStart < stream.pos) {
-    // Webkit seems to refuse to render text nodes longer than 57444
-    // characters, and returns inaccurate measurements in nodes
-    // starting around 5000 chars.
-    var pos = Math.min(stream.pos, curStart + 5000)
-    f(pos, curStyle)
-    curStart = pos
-  }
-}
-
-// Finds the line to start with when starting a parse. Tries to
-// find a line with a stateAfter, so that it can start with a
-// valid state. If that fails, it returns the line with the
-// smallest indentation, which tends to need the least context to
-// parse correctly.
-function findStartLine(cm, n, precise) {
-  var minindent, minline, doc = cm.doc
-  var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)
-  for (var search = n; search > lim; --search) {
-    if (search <= doc.first) { return doc.first }
-    var line = getLine(doc, search - 1)
-    if (line.stateAfter && (!precise || search <= doc.frontier)) { return search }
-    var indented = countColumn(line.text, null, cm.options.tabSize)
-    if (minline == null || minindent > indented) {
-      minline = search - 1
-      minindent = indented
-    }
-  }
-  return minline
-}
-
-// LINE DATA STRUCTURE
-
-// Line objects. These hold state related to a line, including
-// highlighting info (the styles array).
-var Line = function(text, markedSpans, estimateHeight) {
-  this.text = text
-  attachMarkedSpans(this, markedSpans)
-  this.height = estimateHeight ? estimateHeight(this) : 1
-};
-
-Line.prototype.lineNo = function () { return lineNo(this) };
-eventMixin(Line)
-
-// Change the content (text, markers) of a line. Automatically
-// invalidates cached information and tries to re-estimate the
-// line's height.
-function updateLine(line, text, markedSpans, estimateHeight) {
-  line.text = text
-  if (line.stateAfter) { line.stateAfter = null }
-  if (line.styles) { line.styles = null }
-  if (line.order != null) { line.order = null }
-  detachMarkedSpans(line)
-  attachMarkedSpans(line, markedSpans)
-  var estHeight = estimateHeight ? estimateHeight(line) : 1
-  if (estHeight != line.height) { updateLineHeight(line, estHeight) }
-}
-
-// Detach a line from the document tree and its markers.
-function cleanUpLine(line) {
-  line.parent = null
-  detachMarkedSpans(line)
-}
-
-// Convert a style as returned by a mode (either null, or a string
-// containing one or more styles) to a CSS style. This is cached,
-// and also looks for line-wide styles.
-var styleToClassCache = {};
-var styleToClassCacheWithMode = {};
-function interpretTokenStyle(style, options) {
-  if (!style || /^\s*$/.test(style)) { return null }
-  var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache
-  return cache[style] ||
-    (cache[style] = style.replace(/\S+/g, "cm-$&"))
-}
-
-// Render the DOM representation of the text of a line. Also builds
-// up a 'line map', which points at the DOM nodes that represent
-// specific stretches of text, and is used by the measuring code.
-// The returned object contains the DOM node, this map, and
-// information about line-wide styles that were set by the mode.
-function buildLineContent(cm, lineView) {
-  // The padding-right forces the element to have a 'border', which
-  // is needed on Webkit to be able to get line-level bounding
-  // rectangles for it (in measureChar).
-  var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null)
-  var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
-                 col: 0, pos: 0, cm: cm,
-                 trailingSpace: false,
-                 splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}
-  lineView.measure = {}
-
-  // Iterate over the logical lines that make up this visual line.
-  for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
-    var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)
-    builder.pos = 0
-    builder.addToken = buildToken
-    // Optionally wire in some hacks into the token-rendering
-    // algorithm, to deal with browser quirks.
-    if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
-      { builder.addToken = buildTokenBadBidi(builder.addToken, order) }
-    builder.map = []
-    var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)
-    insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))
-    if (line.styleClasses) {
-      if (line.styleClasses.bgClass)
-        { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") }
-      if (line.styleClasses.textClass)
-        { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "") }
-    }
-
-    // Ensure at least a single node is present, for measuring.
-    if (builder.map.length == 0)
-      { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }
-
-    // Store the map and a cache object for the current logical line
-    if (i == 0) {
-      lineView.measure.map = builder.map
-      lineView.measure.cache = {}
-    } else {
-      ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
-      ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})
-    }
-  }
-
-  // See issue #2901
-  if (webkit) {
-    var last = builder.content.lastChild
-    if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
-      { builder.content.className = "cm-tab-wrap-hack" }
-  }
-
-  signal(cm, "renderLine", cm, lineView.line, builder.pre)
-  if (builder.pre.className)
-    { builder.textClass = joinClasses(builder.pre.className, builder.textClass || "") }
-
-  return builder
-}
-
-function defaultSpecialCharPlaceholder(ch) {
-  var token = elt("span", "\u2022", "cm-invalidchar")
-  token.title = "\\u" + ch.charCodeAt(0).toString(16)
-  token.setAttribute("aria-label", token.title)
-  return token
-}
-
-// Build up the DOM representation for a single token, and add it to
-// the line map. Takes care to render special characters separately.
-function buildToken(builder, text, style, startStyle, endStyle, title, css) {
-  if (!text) { return }
-  var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
-  var special = builder.cm.state.specialChars, mustWrap = false
-  var content
-  if (!special.test(text)) {
-    builder.col += text.length
-    content = document.createTextNode(displayText)
-    builder.map.push(builder.pos, builder.pos + text.length, content)
-    if (ie && ie_version < 9) { mustWrap = true }
-    builder.pos += text.length
-  } else {
-    content = document.createDocumentFragment()
-    var pos = 0
-    while (true) {
-      special.lastIndex = pos
-      var m = special.exec(text)
-      var skipped = m ? m.index - pos : text.length - pos
-      if (skipped) {
-        var txt = document.createTextNode(displayText.slice(pos, pos + skipped))
-        if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])) }
-        else { content.appendChild(txt) }
-        builder.map.push(builder.pos, builder.pos + skipped, txt)
-        builder.col += skipped
-        builder.pos += skipped
-      }
-      if (!m) { break }
-      pos += skipped + 1
-      var txt$1 = (void 0)
-      if (m[0] == "\t") {
-        var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize
-        txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"))
-        txt$1.setAttribute("role", "presentation")
-        txt$1.setAttribute("cm-text", "\t")
-        builder.col += tabWidth
-      } else if (m[0] == "\r" || m[0] == "\n") {
-        txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"))
-        txt$1.setAttribute("cm-text", m[0])
-        builder.col += 1
-      } else {
-        txt$1 = builder.cm.options.specialCharPlaceholder(m[0])
-        txt$1.setAttribute("cm-text", m[0])
-        if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])) }
-        else { content.appendChild(txt$1) }
-        builder.col += 1
-      }
-      builder.map.push(builder.pos, builder.pos + 1, txt$1)
-      builder.pos++
-    }
-  }
-  builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
-  if (style || startStyle || endStyle || mustWrap || css) {
-    var fullStyle = style || ""
-    if (startStyle) { fullStyle += startStyle }
-    if (endStyle) { fullStyle += endStyle }
-    var token = elt("span", [content], fullStyle, css)
-    if (title) { token.title = title }
-    return builder.content.appendChild(token)
-  }
-  builder.content.appendChild(content)
-}
-
-function splitSpaces(text, trailingBefore) {
-  if (text.length > 1 && !/  /.test(text)) { return text }
-  var spaceBefore = trailingBefore, result = ""
-  for (var i = 0; i < text.length; i++) {
-    var ch = text.charAt(i)
-    if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
-      { ch = "\u00a0" }
-    result += ch
-    spaceBefore = ch == " "
-  }
-  return result
-}
-
-// Work around nonsense dimensions being reported for stretches of
-// right-to-left text.
-function buildTokenBadBidi(inner, order) {
-  return function (builder, text, style, startStyle, endStyle, title, css) {
-    style = style ? style + " cm-force-border" : "cm-force-border"
-    var start = builder.pos, end = start + text.length
-    for (;;) {
-      // Find the part that overlaps with the start of this text
-      var part = (void 0)
-      for (var i = 0; i < order.length; i++) {
-        part = order[i]
-        if (part.to > start && part.from <= start) { break }
-      }
-      if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
-      inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css)
-      startStyle = null
-      text = text.slice(part.to - start)
-      start = part.to
-    }
-  }
-}
-
-function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
-  var widget = !ignoreWidget && marker.widgetNode
-  if (widget) { builder.map.push(builder.pos, builder.pos + size, widget) }
-  if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
-    if (!widget)
-      { widget = builder.content.appendChild(document.createElement("span")) }
-    widget.setAttribute("cm-marker", marker.id)
-  }
-  if (widget) {
-    builder.cm.display.input.setUneditable(widget)
-    builder.content.appendChild(widget)
-  }
-  builder.pos += size
-  builder.trailingSpace = false
-}
-
-// Outputs a number of spans to make up a line, taking highlighting
-// and marked text into account.
-function insertLineContent(line, builder, styles) {
-  var spans = line.markedSpans, allText = line.text, at = 0
-  if (!spans) {
-    for (var i$1 = 1; i$1 < styles.length; i$1+=2)
-      { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }
-    return
-  }
-
-  var len = allText.length, pos = 0, i = 1, text = "", style, css
-  var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed
-  for (;;) {
-    if (nextChange == pos) { // Update current marker set
-      spanStyle = spanEndStyle = spanStartStyle = title = css = ""
-      collapsed = null; nextChange = Infinity
-      var foundBookmarks = [], endStyles = (void 0)
-      for (var j = 0; j < spans.length; ++j) {
-        var sp = spans[j], m = sp.marker
-        if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
-          foundBookmarks.push(m)
-        } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
-          if (sp.to != null && sp.to != pos && nextChange > sp.to) {
-            nextChange = sp.to
-            spanEndStyle = ""
-          }
-          if (m.className) { spanStyle += " " + m.className }
-          if (m.css) { css = (css ? css + ";" : "") + m.css }
-          if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle }
-          if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }
-          if (m.title && !title) { title = m.title }
-          if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
-            { collapsed = sp }
-        } else if (sp.from > pos && nextChange > sp.from) {
-          nextChange = sp.from
-        }
-      }
-      if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
-        { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } }
-
-      if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
-        { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]) } }
-      if (collapsed && (collapsed.from || 0) == pos) {
-        buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
-                           collapsed.marker, collapsed.from == null)
-        if (collapsed.to == null) { return }
-        if (collapsed.to == pos) { collapsed = false }
-      }
-    }
-    if (pos >= len) { break }
-
-    var upto = Math.min(len, nextChange)
-    while (true) {
-      if (text) {
-        var end = pos + text.length
-        if (!collapsed) {
-          var tokenText = end > upto ? text.slice(0, upto - pos) : text
-          builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
-                           spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css)
-        }
-        if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
-        pos = end
-        spanStartStyle = ""
-      }
-      text = allText.slice(at, at = styles[i++])
-      style = interpretTokenStyle(styles[i++], builder.cm.options)
-    }
-  }
-}
-
-
-// These objects are used to represent the visible (currently drawn)
-// part of the document. A LineView may correspond to multiple
-// logical lines, if those are connected by collapsed ranges.
-function LineView(doc, line, lineN) {
-  // The starting line
-  this.line = line
-  // Continuing lines, if any
-  this.rest = visualLineContinued(line)
-  // Number of logical lines in this visual line
-  this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1
-  this.node = this.text = null
-  this.hidden = lineIsHidden(doc, line)
-}
-
-// Create a range of LineView objects for the given lines.
-function buildViewArray(cm, from, to) {
-  var array = [], nextPos
-  for (var pos = from; pos < to; pos = nextPos) {
-    var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)
-    nextPos = pos + view.size
-    array.push(view)
-  }
-  return array
-}
-
-var operationGroup = null
-
-function pushOperation(op) {
-  if (operationGroup) {
-    operationGroup.ops.push(op)
-  } else {
-    op.ownsGroup = operationGroup = {
-      ops: [op],
-      delayedCallbacks: []
-    }
-  }
-}
-
-function fireCallbacksForOps(group) {
-  // Calls delayed callbacks and cursorActivity handlers until no
-  // new ones appear
-  var callbacks = group.delayedCallbacks, i = 0
-  do {
-    for (; i < callbacks.length; i++)
-      { callbacks[i].call(null) }
-    for (var j = 0; j < group.ops.length; j++) {
-      var op = group.ops[j]
-      if (op.cursorActivityHandlers)
-        { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
-          { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } }
-    }
-  } while (i < callbacks.length)
-}
-
-function finishOperation(op, endCb) {
-  var group = op.ownsGroup
-  if (!group) { return }
-
-  try { fireCallbacksForOps(group) }
-  finally {
-    operationGroup = null
-    endCb(group)
-  }
-}
-
-var orphanDelayedCallbacks = null
-
-// Often, we want to signal events at a point where we are in the
-// middle of some work, but don't want the handler to start calling
-// other methods on the editor, which might be in an inconsistent
-// state or simply not expect any other events to happen.
-// signalLater looks whether there are any handlers, and schedules
-// them to be executed when the last operation ends, or, if no
-// operation is active, when a timeout fires.
-function signalLater(emitter, type /*, values...*/) {
-  var arr = getHandlers(emitter, type)
-  if (!arr.length) { return }
-  var args = Array.prototype.slice.call(arguments, 2), list
-  if (operationGroup) {
-    list = operationGroup.delayedCallbacks
-  } else if (orphanDelayedCallbacks) {
-    list = orphanDelayedCallbacks
-  } else {
-    list = orphanDelayedCallbacks = []
-    setTimeout(fireOrphanDelayed, 0)
-  }
-  var loop = function ( i ) {
-    list.push(function () { return arr[i].apply(null, args); })
-  };
-
-  for (var i = 0; i < arr.length; ++i)
-    loop( i );
-}
-
-function fireOrphanDelayed() {
-  var delayed = orphanDelayedCallbacks
-  orphanDelayedCallbacks = null
-  for (var i = 0; i < delayed.length; ++i) { delayed[i]() }
-}
-
-// When an aspect of a line changes, a string is added to
-// lineView.changes. This updates the relevant part of the line's
-// DOM structure.
-function updateLineForChanges(cm, lineView, lineN, dims) {
-  for (var j = 0; j < lineView.changes.length; j++) {
-    var type = lineView.changes[j]
-    if (type == "text") { updateLineText(cm, lineView) }
-    else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims) }
-    else if (type == "class") { updateLineClasses(cm, lineView) }
-    else if (type == "widget") { updateLineWidgets(cm, lineView, dims) }
-  }
-  lineView.changes = null
-}
-
-// Lines with gutter elements, widgets or a background class need to
-// be wrapped, and have the extra elements added to the wrapper div
-function ensureLineWrapped(lineView) {
-  if (lineView.node == lineView.text) {
-    lineView.node = elt("div", null, null, "position: relative")
-    if (lineView.text.parentNode)
-      { lineView.text.parentNode.replaceChild(lineView.node, lineView.text) }
-    lineView.node.appendChild(lineView.text)
-    if (ie && ie_version < 8) { lineView.node.style.zIndex = 2 }
-  }
-  return lineView.node
-}
-
-function updateLineBackground(cm, lineView) {
-  var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass
-  if (cls) { cls += " CodeMirror-linebackground" }
-  if (lineView.background) {
-    if (cls) { lineView.background.className = cls }
-    else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null }
-  } else if (cls) {
-    var wrap = ensureLineWrapped(lineView)
-    lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild)
-    cm.display.input.setUneditable(lineView.background)
-  }
-}
-
-// Wrapper around buildLineContent which will reuse the structure
-// in display.externalMeasured when possible.
-function getLineContent(cm, lineView) {
-  var ext = cm.display.externalMeasured
-  if (ext && ext.line == lineView.line) {
-    cm.display.externalMeasured = null
-    lineView.measure = ext.measure
-    return ext.built
-  }
-  return buildLineContent(cm, lineView)
-}
-
-// Redraw the line's text. Interacts with the background and text
-// classes because the mode may output tokens that influence these
-// classes.
-function updateLineText(cm, lineView) {
-  var cls = lineView.text.className
-  var built = getLineContent(cm, lineView)
-  if (lineView.text == lineView.node) { lineView.node = built.pre }
-  lineView.text.parentNode.replaceChild(built.pre, lineView.text)
-  lineView.text = built.pre
-  if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
-    lineView.bgClass = built.bgClass
-    lineView.textClass = built.textClass
-    updateLineClasses(cm, lineView)
-  } else if (cls) {
-    lineView.text.className = cls
-  }
-}
-
-function updateLineClasses(cm, lineView) {
-  updateLineBackground(cm, lineView)
-  if (lineView.line.wrapClass)
-    { ensureLineWrapped(lineView).className = lineView.line.wrapClass }
-  else if (lineView.node != lineView.text)
-    { lineView.node.className = "" }
-  var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass
-  lineView.text.className = textClass || ""
-}
-
-function updateLineGutter(cm, lineView, lineN, dims) {
-  if (lineView.gutter) {
-    lineView.node.removeChild(lineView.gutter)
-    lineView.gutter = null
-  }
-  if (lineView.gutterBackground) {
-    lineView.node.removeChild(lineView.gutterBackground)
-    lineView.gutterBackground = null
-  }
-  if (lineView.line.gutterClass) {
-    var wrap = ensureLineWrapped(lineView)
-    lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
-                                    ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"))
-    cm.display.input.setUneditable(lineView.gutterBackground)
-    wrap.insertBefore(lineView.gutterBackground, lineView.text)
-  }
-  var markers = lineView.line.gutterMarkers
-  if (cm.options.lineNumbers || markers) {
-    var wrap$1 = ensureLineWrapped(lineView)
-    var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"))
-    cm.display.input.setUneditable(gutterWrap)
-    wrap$1.insertBefore(gutterWrap, lineView.text)
-    if (lineView.line.gutterClass)
-      { gutterWrap.className += " " + lineView.line.gutterClass }
-    if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
-      { lineView.lineNumber = gutterWrap.appendChild(
-        elt("div", lineNumberFor(cm.options, lineN),
-            "CodeMirror-linenumber CodeMirror-gutter-elt",
-            ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))) }
-    if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
-      var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]
-      if (found)
-        { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
-                                   ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) }
-    } }
-  }
-}
-
-function updateLineWidgets(cm, lineView, dims) {
-  if (lineView.alignable) { lineView.alignable = null }
-  for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
-    next = node.nextSibling
-    if (node.className == "CodeMirror-linewidget")
-      { lineView.node.removeChild(node) }
-  }
-  insertLineWidgets(cm, lineView, dims)
-}
-
-// Build a line's DOM representation from scratch
-function buildLineElement(cm, lineView, lineN, dims) {
-  var built = getLineContent(cm, lineView)
-  lineView.text = lineView.node = built.pre
-  if (built.bgClass) { lineView.bgClass = built.bgClass }
-  if (built.textClass) { lineView.textClass = built.textClass }
-
-  updateLineClasses(cm, lineView)
-  updateLineGutter(cm, lineView, lineN, dims)
-  insertLineWidgets(cm, lineView, dims)
-  return lineView.node
-}
-
-// A lineView may contain multiple logical lines (when merged by
-// collapsed spans). The widgets for all of them need to be drawn.
-function insertLineWidgets(cm, lineView, dims) {
-  insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)
-  if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
-    { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } }
-}
-
-function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
-  if (!line.widgets) { return }
-  var wrap = ensureLineWrapped(lineView)
-  for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
-    var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget")
-    if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true") }
-    positionLineWidget(widget, node, lineView, dims)
-    cm.display.input.setUneditable(node)
-    if (allowAbove && widget.above)
-      { wrap.insertBefore(node, lineView.gutter || lineView.text) }
-    else
-      { wrap.appendChild(node) }
-    signalLater(widget, "redraw")
-  }
-}
-
-function positionLineWidget(widget, node, lineView, dims) {
-  if (widget.noHScroll) {
-    ;(lineView.alignable || (lineView.alignable = [])).push(node)
-    var width = dims.wrapperWidth
-    node.style.left = dims.fixedPos + "px"
-    if (!widget.coverGutter) {
-      width -= dims.gutterTotalWidth
-      node.style.paddingLeft = dims.gutterTotalWidth + "px"
-    }
-    node.style.width = width + "px"
-  }
-  if (widget.coverGutter) {
-    node.style.zIndex = 5
-    node.style.position = "relative"
-    if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px" }
-  }
-}
-
-function widgetHeight(widget) {
-  if (widget.height != null) { return widget.height }
-  var cm = widget.doc.cm
-  if (!cm) { return 0 }
-  if (!contains(document.body, widget.node)) {
-    var parentStyle = "position: relative;"
-    if (widget.coverGutter)
-      { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" }
-    if (widget.noHScroll)
-      { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" }
-    removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle))
-  }
-  return widget.height = widget.node.parentNode.offsetHeight
-}
-
-// Return true when the given mouse event happened in a widget
-function eventInWidget(display, e) {
-  for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
-    if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
-        (n.parentNode == display.sizer && n != display.mover))
-      { return true }
-  }
-}
-
-// POSITION MEASUREMENT
-
-function paddingTop(display) {return display.lineSpace.offsetTop}
-function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
-function paddingH(display) {
-  if (display.cachedPaddingH) { return display.cachedPaddingH }
-  var e = removeChildrenAndAdd(display.measure, elt("pre", "x"))
-  var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle
-  var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}
-  if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data }
-  return data
-}
-
-function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
-function displayWidth(cm) {
-  return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
-}
-function displayHeight(cm) {
-  return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
-}
-
-// Ensure the lineView.wrapping.heights array is populated. This is
-// an array of bottom offsets for the lines that make up a drawn
-// line. When lineWrapping is on, there might be more than one
-// height.
-function ensureLineHeights(cm, lineView, rect) {
-  var wrapping = cm.options.lineWrapping
-  var curWidth = wrapping && displayWidth(cm)
-  if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
-    var heights = lineView.measure.heights = []
-    if (wrapping) {
-      lineView.measure.width = curWidth
-      var rects = lineView.text.firstChild.getClientRects()
-      for (var i = 0; i < rects.length - 1; i++) {
-        var cur = rects[i], next = rects[i + 1]
-        if (Math.abs(cur.bottom - next.bottom) > 2)
-          { heights.push((cur.bottom + next.top) / 2 - rect.top) }
-      }
-    }
-    heights.push(rect.bottom - rect.top)
-  }
-}
-
-// Find a line map (mapping character offsets to text nodes) and a
-// measurement cache for the given line number. (A line view might
-// contain multiple lines when collapsed ranges are present.)
-function mapFromLineView(lineView, line, lineN) {
-  if (lineView.line == line)
-    { return {map: lineView.measure.map, cache: lineView.measure.cache} }
-  for (var i = 0; i < lineView.rest.length; i++)
-    { if (lineView.rest[i] == line)
-      { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
-  for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
-    { if (lineNo(lineView.rest[i$1]) > lineN)
-      { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
-}
-
-// Render a line into the hidden node display.externalMeasured. Used
-// when measurement is needed for a line that's not in the viewport.
-function updateExternalMeasurement(cm, line) {
-  line = visualLine(line)
-  var lineN = lineNo(line)
-  var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)
-  view.lineN = lineN
-  var built = view.built = buildLineContent(cm, view)
-  view.text = built.pre
-  removeChildrenAndAdd(cm.display.lineMeasure, built.pre)
-  return view
-}
-
-// Get a {top, bottom, left, right} box (in line-local coordinates)
-// for a given character.
-function measureChar(cm, line, ch, bias) {
-  return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
-}
-
-// Find a line view that corresponds to the given line number.
-function findViewForLine(cm, lineN) {
-  if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
-    { return cm.display.view[findViewIndex(cm, lineN)] }
-  var ext = cm.display.externalMeasured
-  if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
-    { return ext }
-}
-
-// Measurement can be split in two steps, the set-up work that
-// applies to the whole line, and the measurement of the actual
-// character. Functions like coordsChar, that need to do a lot of
-// measurements in a row, can thus ensure that the set-up work is
-// only done once.
-function prepareMeasureForLine(cm, line) {
-  var lineN = lineNo(line)
-  var view = findViewForLine(cm, lineN)
-  if (view && !view.text) {
-    view = null
-  } else if (view && view.changes) {
-    updateLineForChanges(cm, view, lineN, getDimensions(cm))
-    cm.curOp.forceUpdate = true
-  }
-  if (!view)
-    { view = updateExternalMeasurement(cm, line) }
-
-  var info = mapFromLineView(view, line, lineN)
-  return {
-    line: line, view: view, rect: null,
-    map: info.map, cache: info.cache, before: info.before,
-    hasHeights: false
-  }
-}
-
-// Given a prepared measurement object, measures the position of an
-// actual character (or fetches it from the cache).
-function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
-  if (prepared.before) { ch = -1 }
-  var key = ch + (bias || ""), found
-  if (prepared.cache.hasOwnProperty(key)) {
-    found = prepared.cache[key]
-  } else {
-    if (!prepared.rect)
-      { prepared.rect = prepared.view.text.getBoundingClientRect() }
-    if (!prepared.hasHeights) {
-      ensureLineHeights(cm, prepared.view, prepared.rect)
-      prepared.hasHeights = true
-    }
-    found = measureCharInner(cm, prepared, ch, bias)
-    if (!found.bogus) { prepared.cache[key] = found }
-  }
-  return {left: found.left, right: found.right,
-          top: varHeight ? found.rtop : found.top,
-          bottom: varHeight ? found.rbottom : found.bottom}
-}
-
-var nullRect = {left: 0, right: 0, top: 0, bottom: 0}
-
-function nodeAndOffsetInLineMap(map, ch, bias) {
-  var node, start, end, collapse, mStart, mEnd
-  // First, search the line map for the text node corresponding to,
-  // or closest to, the target character.
-  for (var i = 0; i < map.length; i += 3) {
-    mStart = map[i]
-    mEnd = map[i + 1]
-    if (ch < mStart) {
-      start = 0; end = 1
-      collapse = "left"
-    } else if (ch < mEnd) {
-      start = ch - mStart
-      end = start + 1
-    } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
-      end = mEnd - mStart
-      start = end - 1
-      if (ch >= mEnd) { collapse = "right" }
-    }
-    if (start != null) {
-      node = map[i + 2]
-      if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
-        { collapse = bias }
-      if (bias == "left" && start == 0)
-        { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
-          node = map[(i -= 3) + 2]
-          collapse = "left"
-        } }
-      if (bias == "right" && start == mEnd - mStart)
-        { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
-          node = map[(i += 3) + 2]
-          collapse = "right"
-        } }
-      break
-    }
-  }
-  return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
-}
-
-function getUsefulRect(rects, bias) {
-  var rect = nullRect
-  if (bias == "left") { for (var i = 0; i < rects.length; i++) {
-    if ((rect = rects[i]).left != rect.right) { break }
-  } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
-    if ((rect = rects[i$1]).left != rect.right) { break }
-  } }
-  return rect
-}
-
-function measureCharInner(cm, prepared, ch, bias) {
-  var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
-  var node = place.node, start = place.start, end = place.end, collapse = place.collapse
-
-  var rect
-  if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
-    for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
-      while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start }
-      while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end }
-      if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
-        { rect = node.parentNode.getBoundingClientRect() }
-      else
-        { rect = getUsefulRect(range(node, start, end).getClientRects(), bias) }
-      if (rect.left || rect.right || start == 0) { break }
-      end = start
-      start = start - 1
-      collapse = "right"
-    }
-    if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect) }
-  } else { // If it is a widget, simply get the box for the whole widget.
-    if (start > 0) { collapse = bias = "right" }
-    var rects
-    if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
-      { rect = rects[bias == "right" ? rects.length - 1 : 0] }
-    else
-      { rect = node.getBoundingClientRect() }
-  }
-  if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
-    var rSpan = node.parentNode.getClientRects()[0]
-    if (rSpan)
-      { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} }
-    else
-      { rect = nullRect }
-  }
-
-  var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top
-  var mid = (rtop + rbot) / 2
-  var heights = prepared.view.measure.heights
-  var i = 0
-  for (; i < heights.length - 1; i++)
-    { if (mid < heights[i]) { break } }
-  var top = i ? heights[i - 1] : 0, bot = heights[i]
-  var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
-                right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
-                top: top, bottom: bot}
-  if (!rect.left && !rect.right) { result.bogus = true }
-  if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot }
-
-  return result
-}
-
-// Work around problem with bounding client rects on ranges being
-// returned incorrectly when zoomed on IE10 and below.
-function maybeUpdateRectForZooming(measure, rect) {
-  if (!window.screen || screen.logicalXDPI == null ||
-      screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
-    { return rect }
-  var scaleX = screen.logicalXDPI / screen.deviceXDPI
-  var scaleY = screen.logicalYDPI / screen.deviceYDPI
-  return {left: rect.left * scaleX, right: rect.right * scaleX,
-          top: rect.top * scaleY, bottom: rect.bottom * scaleY}
-}
-
-function clearLineMeasurementCacheFor(lineView) {
-  if (lineView.measure) {
-    lineView.measure.cache = {}
-    lineView.measure.heights = null
-    if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
-      { lineView.measure.caches[i] = {} } }
-  }
-}
-
-function clearLineMeasurementCache(cm) {
-  cm.display.externalMeasure = null
-  removeChildren(cm.display.lineMeasure)
-  for (var i = 0; i < cm.display.view.length; i++)
-    { clearLineMeasurementCacheFor(cm.display.view[i]) }
-}
-
-function clearCaches(cm) {
-  clearLineMeasurementCache(cm)
-  cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null
-  if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true }
-  cm.display.lineNumChars = null
-}
-
-function pageScrollX() {
-  // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
-  // which causes page_Offset and bounding client rects to use
-  // different reference viewports and invalidate our calculations.
-  if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
-  return window.pageXOffset || (document.documentElement || document.body).scrollLeft
-}
-function pageScrollY() {
-  if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
-  return window.pageYOffset || (document.documentElement || document.body).scrollTop
-}
-
-// Converts a {top, bottom, left, right} box from line-local
-// coordinates into another coordinate system. Context may be one of
-// "line", "div" (display.lineDiv), "local"./null (editor), "window",
-// or "page".
-function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
-  if (!includeWidgets && lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above) {
-    var size = widgetHeight(lineObj.widgets[i])
-    rect.top += size; rect.bottom += size
-  } } }
-  if (context == "line") { return rect }
-  if (!context) { context = "local" }
-  var yOff = heightAtLine(lineObj)
-  if (context == "local") { yOff += paddingTop(cm.display) }
-  else { yOff -= cm.display.viewOffset }
-  if (context == "page" || context == "window") {
-    var lOff = cm.display.lineSpace.getBoundingClientRect()
-    yOff += lOff.top + (context == "window" ? 0 : pageScrollY())
-    var xOff = lOff.left + (context == "window" ? 0 : pageScrollX())
-    rect.left += xOff; rect.right += xOff
-  }
-  rect.top += yOff; rect.bottom += yOff
-  return rect
-}
-
-// Coverts a box from "div" coords to another coordinate system.
-// Context may be "window", "page", "div", or "local"./null.
-function fromCoordSystem(cm, coords, context) {
-  if (context == "div") { return coords }
-  var left = coords.left, top = coords.top
-  // First move into "page" coordinate system
-  if (context == "page") {
-    left -= pageScrollX()
-    top -= pageScrollY()
-  } else if (context == "local" || !context) {
-    var localBox = cm.display.sizer.getBoundingClientRect()
-    left += localBox.left
-    top += localBox.top
-  }
-
-  var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()
-  return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
-}
-
-function charCoords(cm, pos, context, lineObj, bias) {
-  if (!lineObj) { lineObj = getLine(cm.doc, pos.line) }
-  return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
-}
-
-// Returns a box for a given cursor position, which may have an
-// 'other' property containing the position of the secondary cursor
-// on a bidi boundary.
-// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
-// and after `char - 1` in writing order of `char - 1`
-// A cursor Pos(line, char, "after") is on the same visual line as `char`
-// and before `char` in writing order of `char`
-// Examples (upper-case letters are RTL, lower-case are LTR):
-//     Pos(0, 1, ...)
-//     before   after
-// ab     a|b     a|b
-// aB     a|B     aB|
-// Ab     |Ab     A|b
-// AB     B|A     B|A
-// Every position after the last character on a line is considered to stick
-// to the last character on the line.
-function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
-  lineObj = lineObj || getLine(cm.doc, pos.line)
-  if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }
-  function get(ch, right) {
-    var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight)
-    if (right) { m.left = m.right; } else { m.right = m.left }
-    return intoCoordSystem(cm, lineObj, m, context)
-  }
-  var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky
-  if (ch >= lineObj.text.length) {
-    ch = lineObj.text.length
-    sticky = "before"
-  } else if (ch <= 0) {
-    ch = 0
-    sticky = "after"
-  }
-  if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
-
-  function getBidi(ch, partPos, invert) {
-    var part = order[partPos], right = (part.level % 2) != 0
-    return get(invert ? ch - 1 : ch, right != invert)
-  }
-  var partPos = getBidiPartAt(order, ch, sticky)
-  var other = bidiOther
-  var val = getBidi(ch, partPos, sticky == "before")
-  if (other != null) { val.other = getBidi(ch, other, sticky != "before") }
-  return val
-}
-
-// Used to cheaply estimate the coordinates for a position. Used for
-// intermediate scroll updates.
-function estimateCoords(cm, pos) {
-  var left = 0
-  pos = clipPos(cm.doc, pos)
-  if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch }
-  var lineObj = getLine(cm.doc, pos.line)
-  var top = heightAtLine(lineObj) + paddingTop(cm.display)
-  return {left: left, right: left, top: top, bottom: top + lineObj.height}
-}
-
-// Positions returned by coordsChar contain some extra information.
-// xRel is the relative x position of the input coordinates compared
-// to the found position (so xRel > 0 means the coordinates are to
-// the right of the character position, for example). When outside
-// is true, that means the coordinates lie outside the line's
-// vertical range.
-function PosWithInfo(line, ch, sticky, outside, xRel) {
-  var pos = Pos(line, ch, sticky)
-  pos.xRel = xRel
-  if (outside) { pos.outside = true }
-  return pos
-}
-
-// Compute the character position closest to the given coordinates.
-// Input must be lineSpace-local ("div" coordinate system).
-function coordsChar(cm, x, y) {
-  var doc = cm.doc
-  y += cm.display.viewOffset
-  if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
-  var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1
-  if (lineN > last)
-    { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
-  if (x < 0) { x = 0 }
-
-  var lineObj = getLine(doc, lineN)
-  for (;;) {
-    var found = coordsCharInner(cm, lineObj, lineN, x, y)
-    var merged = collapsedSpanAtEnd(lineObj)
-    var mergedPos = merged && merged.find(0, true)
-    if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))
-      { lineN = lineNo(lineObj = mergedPos.to.line) }
-    else
-      { return found }
-  }
-}
-
-function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
-  var measure = function (ch) { return intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line"); }
-  var end = lineObj.text.length
-  var begin = findFirst(function (ch) { return measure(ch - 1).bottom <= y; }, end, 0)
-  end = findFirst(function (ch) { return measure(ch).top > y; }, begin, end)
-  return {begin: begin, end: end}
-}
-
-function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
-  var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top
-  return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
-}
-
-function coordsCharInner(cm, lineObj, lineNo, x, y) {
-  y -= heightAtLine(lineObj)
-  var begin = 0, end = lineObj.text.length
-  var preparedMeasure = prepareMeasureForLine(cm, lineObj)
-  var pos
-  var order = getOrder(lineObj, cm.doc.direction)
-  if (order) {
-    if (cm.options.lineWrapping) {
-      ;var assign;
-      ((assign = wrappedLineExtent(cm, lineObj, preparedMeasure, y), begin = assign.begin, end = assign.end, assign))
-    }
-    pos = new Pos(lineNo, begin)
-    var beginLeft = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left
-    var dir = beginLeft < x ? 1 : -1
-    var prevDiff, diff = beginLeft - x, prevPos
-    do {
-      prevDiff = diff
-      prevPos = pos
-      pos = moveVisually(cm, lineObj, pos, dir)
-      if (pos == null || pos.ch < begin || end <= (pos.sticky == "before" ? pos.ch - 1 : pos.ch)) {
-        pos = prevPos
-        break
-      }
-      diff = cursorCoords(cm, pos, "line", lineObj, preparedMeasure).left - x
-    } while ((dir < 0) != (diff < 0) && (Math.abs(diff) <= Math.abs(prevDiff)))
-    if (Math.abs(diff) > Math.abs(prevDiff)) {
-      if ((diff < 0) == (prevDiff < 0)) { throw new Error("Broke out of infinite loop in coordsCharInner") }
-      pos = prevPos
-    }
-  } else {
-    var ch = findFirst(function (ch) {
-      var box = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, ch), "line")
-      if (box.top > y) {
-        // For the cursor stickiness
-        end = Math.min(ch, end)
-        return true
-      }
-      else if (box.bottom <= y) { return false }
-      else if (box.left > x) { return true }
-      else if (box.right < x) { return false }
-      else { return (x - box.left < box.right - x) }
-    }, begin, end)
-    ch = skipExtendingChars(lineObj.text, ch, 1)
-    pos = new Pos(lineNo, ch, ch == end ? "before" : "after")
-  }
-  var coords = cursorCoords(cm, pos, "line", lineObj, preparedMeasure)
-  if (y < coords.top || coords.bottom < y) { pos.outside = true }
-  pos.xRel = x < coords.left ? -1 : (x > coords.right ? 1 : 0)
-  return pos
-}
-
-var measureText
-// Compute the default text height.
-function textHeight(display) {
-  if (display.cachedTextHeight != null) { return display.cachedTextHeight }
-  if (measureText == null) {
-    measureText = elt("pre")
-    // Measure a bunch of lines, for browsers that compute
-    // fractional heights.
-    for (var i = 0; i < 49; ++i) {
-      measureText.appendChild(document.createTextNode("x"))
-      measureText.appendChild(elt("br"))
-    }
-    measureText.appendChild(document.createTextNode("x"))
-  }
-  removeChildrenAndAdd(display.measure, measureText)
-  var height = measureText.offsetHeight / 50
-  if (height > 3) { display.cachedTextHeight = height }
-  removeChildren(display.measure)
-  return height || 1
-}
-
-// Compute the default character width.
-function charWidth(display) {
-  if (display.cachedCharWidth != null) { return display.cachedCharWidth }
-  var anchor = elt("span", "xxxxxxxxxx")
-  var pre = elt("pre", [anchor])
-  removeChildrenAndAdd(display.measure, pre)
-  var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10
-  if (width > 2) { display.cachedCharWidth = width }
-  return width || 10
-}
-
-// Do a bulk-read of the DOM positions and sizes needed to draw the
-// view, so that we don't interleave reading and writing to the DOM.
-function getDimensions(cm) {
-  var d = cm.display, left = {}, width = {}
-  var gutterLeft = d.gutters.clientLeft
-  for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
-    left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft
-    width[cm.options.gutters[i]] = n.clientWidth
-  }
-  return {fixedPos: compensateForHScroll(d),
-          gutterTotalWidth: d.gutters.offsetWidth,
-          gutterLeft: left,
-          gutterWidth: width,
-          wrapperWidth: d.wrapper.clientWidth}
-}
-
-// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
-// but using getBoundingClientRect to get a sub-pixel-accurate
-// result.
-function compensateForHScroll(display) {
-  return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
-}
-
-// Returns a function that estimates the height of a line, to use as
-// first approximation until the line becomes visible (and is thus
-// properly measurable).
-function estimateHeight(cm) {
-  var th = textHeight(cm.display), wrapping = cm.options.lineWrapping
-  var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)
-  return function (line) {
-    if (lineIsHidden(cm.doc, line)) { return 0 }
-
-    var widgetsHeight = 0
-    if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
-      if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height }
-    } }
-
-    if (wrapping)
-      { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
-    else
-      { return widgetsHeight + th }
-  }
-}
-
-function estimateLineHeights(cm) {
-  var doc = cm.doc, est = estimateHeight(cm)
-  doc.iter(function (line) {
-    var estHeight = est(line)
-    if (estHeight != line.height) { updateLineHeight(line, estHeight) }
-  })
-}
-
-// Given a mouse event, find the corresponding position. If liberal
-// is false, it checks whether a gutter or scrollbar was clicked,
-// and returns null if it was. forRect is used by rectangular
-// selections, and tries to estimate a character position even for
-// coordinates beyond the right of the text.
-function posFromMouse(cm, e, liberal, forRect) {
-  var display = cm.display
-  if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
-
-  var x, y, space = display.lineSpace.getBoundingClientRect()
-  // Fails unpredictably on IE[67] when mouse is dragged around quickly.
-  try { x = e.clientX - space.left; y = e.clientY - space.top }
-  catch (e) { return null }
-  var coords = coordsChar(cm, x, y), line
-  if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
-    var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length
-    coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))
-  }
-  return coords
-}
-
-// Find the view element corresponding to a given line. Return null
-// when the line isn't visible.
-function findViewIndex(cm, n) {
-  if (n >= cm.display.viewTo) { return null }
-  n -= cm.display.viewFrom
-  if (n < 0) { return null }
-  var view = cm.display.view
-  for (var i = 0; i < view.length; i++) {
-    n -= view[i].size
-    if (n < 0) { return i }
-  }
-}
-
-function updateSelection(cm) {
-  cm.display.input.showSelection(cm.display.input.prepareSelection())
-}
-
-function prepareSelection(cm, primary) {
-  var doc = cm.doc, result = {}
-  var curFragment = result.cursors = document.createDocumentFragment()
-  var selFragment = result.selection = document.createDocumentFragment()
-
-  for (var i = 0; i < doc.sel.ranges.length; i++) {
-    if (primary === false && i == doc.sel.primIndex) { continue }
-    var range = doc.sel.ranges[i]
-    if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
-    var collapsed = range.empty()
-    if (collapsed || cm.options.showCursorWhenSelecting)
-      { drawSelectionCursor(cm, range.head, curFragment) }
-    if (!collapsed)
-      { drawSelectionRange(cm, range, selFragment) }
-  }
-  return result
-}
-
-// Draws a cursor for the given range
-function drawSelectionCursor(cm, head, output) {
-  var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine)
-
-  var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"))
-  cursor.style.left = pos.left + "px"
-  cursor.style.top = pos.top + "px"
-  cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
-
-  if (pos.other) {
-    // Secondary cursor, shown when on a 'jump' in bi-directional text
-    var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))
-    otherCursor.style.display = ""
-    otherCursor.style.left = pos.other.left + "px"
-    otherCursor.style.top = pos.other.top + "px"
-    otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"
-  }
-}
-
-// Draws the given range as a highlighted selection
-function drawSelectionRange(cm, range, output) {
-  var display = cm.display, doc = cm.doc
-  var fragment = document.createDocumentFragment()
-  var padding = paddingH(cm.display), leftSide = padding.left
-  var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right
-
-  function add(left, top, width, bottom) {
-    if (top < 0) { top = 0 }
-    top = Math.round(top)
-    bottom = Math.round(bottom)
-    fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n                             top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n                             height: " + (bottom - top) + "px")))
-  }
-
-  function drawForLine(line, fromArg, toArg) {
-    var lineObj = getLine(doc, line)
-    var lineLen = lineObj.text.length
-    var start, end
-    function coords(ch, bias) {
-      return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
-    }
-
-    iterateBidiSections(getOrder(lineObj, doc.direction), fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir) {
-      var leftPos = coords(from, "left"), rightPos, left, right
-      if (from == to) {
-        rightPos = leftPos
-        left = right = leftPos.left
-      } else {
-        rightPos = coords(to - 1, "right")
-        if (dir == "rtl") { var tmp = leftPos; leftPos = rightPos; rightPos = tmp }
-        left = leftPos.left
-        right = rightPos.right
-      }
-      if (fromArg == null && from == 0) { left = leftSide }
-      if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
-        add(left, leftPos.top, null, leftPos.bottom)
-        left = leftSide
-        if (leftPos.bottom < rightPos.top) { add(left, leftPos.bottom, null, rightPos.top) }
-      }
-      if (toArg == null && to == lineLen) { right = rightSide }
-      if (!start || leftPos.top < start.top || leftPos.top == start.top && leftPos.left < start.left)
-        { start = leftPos }
-      if (!end || rightPos.bottom > end.bottom || rightPos.bottom == end.bottom && rightPos.right > end.right)
-        { end = rightPos }
-      if (left < leftSide + 1) { left = leftSide }
-      add(left, rightPos.top, right - left, rightPos.bottom)
-    })
-    return {start: start, end: end}
-  }
-
-  var sFrom = range.from(), sTo = range.to()
-  if (sFrom.line == sTo.line) {
-    drawForLine(sFrom.line, sFrom.ch, sTo.ch)
-  } else {
-    var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)
-    var singleVLine = visualLine(fromLine) == visualLine(toLine)
-    var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end
-    var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start
-    if (singleVLine) {
-      if (leftEnd.top < rightStart.top - 2) {
-        add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)
-        add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)
-      } else {
-        add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)
-      }
-    }
-    if (leftEnd.bottom < rightStart.top)
-      { add(leftSide, leftEnd.bottom, null, rightStart.top) }
-  }
-
-  output.appendChild(fragment)
-}
-
-// Cursor-blinking
-function restartBlink(cm) {
-  if (!cm.state.focused) { return }
-  var display = cm.display
-  clearInterval(display.blinker)
-  var on = true
-  display.cursorDiv.style.visibility = ""
-  if (cm.options.cursorBlinkRate > 0)
-    { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
-      cm.options.cursorBlinkRate) }
-  else if (cm.options.cursorBlinkRate < 0)
-    { display.cursorDiv.style.visibility = "hidden" }
-}
-
-function ensureFocus(cm) {
-  if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
-}
-
-function delayBlurEvent(cm) {
-  cm.state.delayingBlurEvent = true
-  setTimeout(function () { if (cm.state.delayingBlurEvent) {
-    cm.state.delayingBlurEvent = false
-    onBlur(cm)
-  } }, 100)
-}
-
-function onFocus(cm, e) {
-  if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false }
-
-  if (cm.options.readOnly == "nocursor") { return }
-  if (!cm.state.focused) {
-    signal(cm, "focus", cm, e)
-    cm.state.focused = true
-    addClass(cm.display.wrapper, "CodeMirror-focused")
-    // This test prevents this from firing when a context
-    // menu is closed (since the input reset would kill the
-    // select-all detection hack)
-    if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
-      cm.display.input.reset()
-      if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730
-    }
-    cm.display.input.receivedFocus()
-  }
-  restartBlink(cm)
-}
-function onBlur(cm, e) {
-  if (cm.state.delayingBlurEvent) { return }
-
-  if (cm.state.focused) {
-    signal(cm, "blur", cm, e)
-    cm.state.focused = false
-    rmClass(cm.display.wrapper, "CodeMirror-focused")
-  }
-  clearInterval(cm.display.blinker)
-  setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false } }, 150)
-}
-
-// Re-align line numbers and gutter marks to compensate for
-// horizontal scrolling.
-function alignHorizontally(cm) {
-  var display = cm.display, view = display.view
-  if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
-  var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
-  var gutterW = display.gutters.offsetWidth, left = comp + "px"
-  for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
-    if (cm.options.fixedGutter) {
-      if (view[i].gutter)
-        { view[i].gutter.style.left = left }
-      if (view[i].gutterBackground)
-        { view[i].gutterBackground.style.left = left }
-    }
-    var align = view[i].alignable
-    if (align) { for (var j = 0; j < align.length; j++)
-      { align[j].style.left = left } }
-  } }
-  if (cm.options.fixedGutter)
-    { display.gutters.style.left = (comp + gutterW) + "px" }
-}
-
-// Used to ensure that the line number gutter is still the right
-// size for the current document size. Returns true when an update
-// is needed.
-function maybeUpdateLineNumberWidth(cm) {
-  if (!cm.options.lineNumbers) { return false }
-  var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
-  if (last.length != display.lineNumChars) {
-    var test = display.measure.appendChild(elt("div", [elt("div", last)],
-                                               "CodeMirror-linenumber CodeMirror-gutter-elt"))
-    var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
-    display.lineGutter.style.width = ""
-    display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
-    display.lineNumWidth = display.lineNumInnerWidth + padding
-    display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
-    display.lineGutter.style.width = display.lineNumWidth + "px"
-    updateGutterSpace(cm)
-    return true
-  }
-  return false
-}
-
-// Read the actual heights of the rendered lines, and update their
-// stored heights to match.
-function updateHeightsInViewport(cm) {
-  var display = cm.display
-  var prevBottom = display.lineDiv.offsetTop
-  for (var i = 0; i < display.view.length; i++) {
-    var cur = display.view[i], height = (void 0)
-    if (cur.hidden) { continue }
-    if (ie && ie_version < 8) {
-      var bot = cur.node.offsetTop + cur.node.offsetHeight
-      height = bot - prevBottom
-      prevBottom = bot
-    } else {
-      var box = cur.node.getBoundingClientRect()
-      height = box.bottom - box.top
-    }
-    var diff = cur.line.height - height
-    if (height < 2) { height = textHeight(display) }
-    if (diff > .001 || diff < -.001) {
-      updateLineHeight(cur.line, height)
-      updateWidgetHeight(cur.line)
-      if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
-        { updateWidgetHeight(cur.rest[j]) } }
-    }
-  }
-}
-
-// Read and store the height of line widgets associated with the
-// given line.
-function updateWidgetHeight(line) {
-  if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)
-    { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight } }
-}
-
-// Compute the lines that are visible in a given viewport (defaults
-// the the current scroll position). viewport may contain top,
-// height, and ensure (see op.scrollToPos) properties.
-function visibleLines(display, doc, viewport) {
-  var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
-  top = Math.floor(top - paddingTop(display))
-  var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
-
-  var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
-  // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
-  // forces those lines into the viewport (if possible).
-  if (viewport && viewport.ensure) {
-    var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
-    if (ensureFrom < from) {
-      from = ensureFrom
-      to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
-    } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
-      from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
-      to = ensureTo
-    }
-  }
-  return {from: from, to: Math.max(to, from + 1)}
-}
-
-// Sync the scrollable area and scrollbars, ensure the viewport
-// covers the visible area.
-function setScrollTop(cm, val) {
-  if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
-  cm.doc.scrollTop = val
-  if (!gecko) { updateDisplaySimple(cm, {top: val}) }
-  if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val }
-  cm.display.scrollbars.setScrollTop(val)
-  if (gecko) { updateDisplaySimple(cm) }
-  startWorker(cm, 100)
-}
-// Sync scroller and scrollbar, ensure the gutter elements are
-// aligned.
-function setScrollLeft(cm, val, isScroller) {
-  if (isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) { return }
-  val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)
-  cm.doc.scrollLeft = val
-  alignHorizontally(cm)
-  if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val }
-  cm.display.scrollbars.setScrollLeft(val)
-}
-
-// Since the delta values reported on mouse wheel events are
-// unstandardized between browsers and even browser versions, and
-// generally horribly unpredictable, this code starts by measuring
-// the scroll effect that the first few mouse wheel events have,
-// and, from that, detects the way it can convert deltas to pixel
-// offsets afterwards.
-//
-// The reason we want to know the amount a wheel event will scroll
-// is that it gives us a chance to update the display before the
-// actual scrolling happens, reducing flickering.
-
-var wheelSamples = 0;
-var wheelPixelsPerUnit = null;
-// Fill in a browser-detected starting value on browsers where we
-// know one. These don't have to be accurate -- the result of them
-// being wrong would just be a slight flicker on the first wheel
-// scroll (if it is large enough).
-if (ie) { wheelPixelsPerUnit = -.53 }
-else if (gecko) { wheelPixelsPerUnit = 15 }
-else if (chrome) { wheelPixelsPerUnit = -.7 }
-else if (safari) { wheelPixelsPerUnit = -1/3 }
-
-function wheelEventDelta(e) {
-  var dx = e.wheelDeltaX, dy = e.wheelDeltaY
-  if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail }
-  if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail }
-  else if (dy == null) { dy = e.wheelDelta }
-  return {x: dx, y: dy}
-}
-function wheelEventPixels(e) {
-  var delta = wheelEventDelta(e)
-  delta.x *= wheelPixelsPerUnit
-  delta.y *= wheelPixelsPerUnit
-  return delta
-}
-
-function onScrollWheel(cm, e) {
-  var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
-
-  var display = cm.display, scroll = display.scroller
-  // Quit if there's nothing to scroll here
-  var canScrollX = scroll.scrollWidth > scroll.clientWidth
-  var canScrollY = scroll.scrollHeight > scroll.clientHeight
-  if (!(dx && canScrollX || dy && canScrollY)) { return }
-
-  // Webkit browsers on OS X abort momentum scrolls when the target
-  // of the scroll event is removed from the scrollable element.
-  // This hack (see related code in patchDisplay) makes sure the
-  // element is kept around.
-  if (dy && mac && webkit) {
-    outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
-      for (var i = 0; i < view.length; i++) {
-        if (view[i].node == cur) {
-          cm.display.currentWheelTarget = cur
-          break outer
-        }
-      }
-    }
-  }
-
-  // On some browsers, horizontal scrolling will cause redraws to
-  // happen before the gutter has been realigned, causing it to
-  // wriggle around in a most unseemly way. When we have an
-  // estimated pixels/delta value, we just handle horizontal
-  // scrolling entirely here. It'll be slightly off from native, but
-  // better than glitching out.
-  if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
-    if (dy && canScrollY)
-      { setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight))) }
-    setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)))
-    // Only prevent default scrolling if vertical scrolling is
-    // actually possible. Otherwise, it causes vertical scroll
-    // jitter on OSX trackpads when deltaX is small and deltaY
-    // is large (issue #3579)
-    if (!dy || (dy && canScrollY))
-      { e_preventDefault(e) }
-    display.wheelStartX = null // Abort measurement, if in progress
-    return
-  }
-
-  // 'Project' the visible viewport to cover the area that is being
-  // scrolled into view (if we know enough to estimate it).
-  if (dy && wheelPixelsPerUnit != null) {
-    var pixels = dy * wheelPixelsPerUnit
-    var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight
-    if (pixels < 0) { top = Math.max(0, top + pixels - 50) }
-    else { bot = Math.min(cm.doc.height, bot + pixels + 50) }
-    updateDisplaySimple(cm, {top: top, bottom: bot})
-  }
-
-  if (wheelSamples < 20) {
-    if (display.wheelStartX == null) {
-      display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop
-      display.wheelDX = dx; display.wheelDY = dy
-      setTimeout(function () {
-        if (display.wheelStartX == null) { return }
-        var movedX = scroll.scrollLeft - display.wheelStartX
-        var movedY = scroll.scrollTop - display.wheelStartY
-        var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
-          (movedX && display.wheelDX && movedX / display.wheelDX)
-        display.wheelStartX = display.wheelStartY = null
-        if (!sample) { return }
-        wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1)
-        ++wheelSamples
-      }, 200)
-    } else {
-      display.wheelDX += dx; display.wheelDY += dy
-    }
-  }
-}
-
-// SCROLLBARS
-
-// Prepare DOM reads needed to update the scrollbars. Done in one
-// shot to minimize update/measure roundtrips.
-function measureForScrollbars(cm) {
-  var d = cm.display, gutterW = d.gutters.offsetWidth
-  var docH = Math.round(cm.doc.height + paddingVert(cm.display))
-  return {
-    clientHeight: d.scroller.clientHeight,
-    viewHeight: d.wrapper.clientHeight,
-    scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
-    viewWidth: d.wrapper.clientWidth,
-    barLeft: cm.options.fixedGutter ? gutterW : 0,
-    docHeight: docH,
-    scrollHeight: docH + scrollGap(cm) + d.barHeight,
-    nativeBarWidth: d.nativeBarWidth,
-    gutterWidth: gutterW
-  }
-}
-
-var NativeScrollbars = function(place, scroll, cm) {
-  this.cm = cm
-  var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar")
-  var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar")
-  place(vert); place(horiz)
-
-  on(vert, "scroll", function () {
-    if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") }
-  })
-  on(horiz, "scroll", function () {
-    if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") }
-  })
-
-  this.checkedZeroWidth = false
-  // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
-  if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px" }
-};
-
-NativeScrollbars.prototype.update = function (measure) {
-  var needsH = measure.scrollWidth > measure.clientWidth + 1
-  var needsV = measure.scrollHeight > measure.clientHeight + 1
-  var sWidth = measure.nativeBarWidth
-
-  if (needsV) {
-    this.vert.style.display = "block"
-    this.vert.style.bottom = needsH ? sWidth + "px" : "0"
-    var totalHeight = measure.viewHeight - (needsH ? sWidth : 0)
-    // A bug in IE8 can cause this value to be negative, so guard it.
-    this.vert.firstChild.style.height =
-      Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"
-  } else {
-    this.vert.style.display = ""
-    this.vert.firstChild.style.height = "0"
-  }
-
-  if (needsH) {
-    this.horiz.style.display = "block"
-    this.horiz.style.right = needsV ? sWidth + "px" : "0"
-    this.horiz.style.left = measure.barLeft + "px"
-    var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0)
-    this.horiz.firstChild.style.width =
-      Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"
-  } else {
-    this.horiz.style.display = ""
-    this.horiz.firstChild.style.width = "0"
-  }
-
-  if (!this.checkedZeroWidth && measure.clientHeight > 0) {
-    if (sWidth == 0) { this.zeroWidthHack() }
-    this.checkedZeroWidth = true
-  }
-
-  return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
-};
-
-NativeScrollbars.prototype.setScrollLeft = function (pos) {
-  if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos }
-  if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz") }
-};
-
-NativeScrollbars.prototype.setScrollTop = function (pos) {
-  if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos }
-  if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert") }
-};
-
-NativeScrollbars.prototype.zeroWidthHack = function () {
-  var w = mac && !mac_geMountainLion ? "12px" : "18px"
-  this.horiz.style.height = this.vert.style.width = w
-  this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"
-  this.disableHoriz = new Delayed
-  this.disableVert = new Delayed
-};
-
-NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
-  bar.style.pointerEvents = "auto"
-  function maybeDisable() {
-    // To find out whether the scrollbar is still visible, we
-    // check whether the element under the pixel in the bottom
-    // right corner of the scrollbar box is the scrollbar box
-    // itself (when the bar is still visible) or its filler child
-    // (when the bar is hidden). If it is still visible, we keep
-    // it enabled, if it's hidden, we disable pointer events.
-    var box = bar.getBoundingClientRect()
-    var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
-        : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1)
-    if (elt != bar) { bar.style.pointerEvents = "none" }
-    else { delay.set(1000, maybeDisable) }
-  }
-  delay.set(1000, maybeDisable)
-};
-
-NativeScrollbars.prototype.clear = function () {
-  var parent = this.horiz.parentNode
-  parent.removeChild(this.horiz)
-  parent.removeChild(this.vert)
-};
-
-var NullScrollbars = function () {};
-
-NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
-NullScrollbars.prototype.setScrollLeft = function () {};
-NullScrollbars.prototype.setScrollTop = function () {};
-NullScrollbars.prototype.clear = function () {};
-
-function updateScrollbars(cm, measure) {
-  if (!measure) { measure = measureForScrollbars(cm) }
-  var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight
-  updateScrollbarsInner(cm, measure)
-  for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
-    if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
-      { updateHeightsInViewport(cm) }
-    updateScrollbarsInner(cm, measureForScrollbars(cm))
-    startWidth = cm.display.barWidth; startHeight = cm.display.barHeight
-  }
-}
-
-// Re-synchronize the fake scrollbars with the actual size of the
-// content.
-function updateScrollbarsInner(cm, measure) {
-  var d = cm.display
-  var sizes = d.scrollbars.update(measure)
-
-  d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"
-  d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"
-  d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
-
-  if (sizes.right && sizes.bottom) {
-    d.scrollbarFiller.style.display = "block"
-    d.scrollbarFiller.style.height = sizes.bottom + "px"
-    d.scrollbarFiller.style.width = sizes.right + "px"
-  } else { d.scrollbarFiller.style.display = "" }
-  if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
-    d.gutterFiller.style.display = "block"
-    d.gutterFiller.style.height = sizes.bottom + "px"
-    d.gutterFiller.style.width = measure.gutterWidth + "px"
-  } else { d.gutterFiller.style.display = "" }
-}
-
-var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}
-
-function initScrollbars(cm) {
-  if (cm.display.scrollbars) {
-    cm.display.scrollbars.clear()
-    if (cm.display.scrollbars.addClass)
-      { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
-  }
-
-  cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
-    cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller)
-    // Prevent clicks in the scrollbars from killing focus
-    on(node, "mousedown", function () {
-      if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0) }
-    })
-    node.setAttribute("cm-not-content", "true")
-  }, function (pos, axis) {
-    if (axis == "horizontal") { setScrollLeft(cm, pos) }
-    else { setScrollTop(cm, pos) }
-  }, cm)
-  if (cm.display.scrollbars.addClass)
-    { addClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
-}
-
-// SCROLLING THINGS INTO VIEW
-
-// If an editor sits on the top or bottom of the window, partially
-// scrolled out of view, this ensures that the cursor is visible.
-function maybeScrollWindow(cm, rect) {
-  if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
-
-  var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null
-  if (rect.top + box.top < 0) { doScroll = true }
-  else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false }
-  if (doScroll != null && !phantom) {
-    var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n                         top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n                         height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n                         left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"))
-    cm.display.lineSpace.appendChild(scrollNode)
-    scrollNode.scrollIntoView(doScroll)
-    cm.display.lineSpace.removeChild(scrollNode)
-  }
-}
-
-// Scroll a given position into view (immediately), verifying that
-// it actually became visible (as line heights are accurately
-// measured, the position of something may 'drift' during drawing).
-function scrollPosIntoView(cm, pos, end, margin) {
-  if (margin == null) { margin = 0 }
-  var rect
-  for (var limit = 0; limit < 5; limit++) {
-    var changed = false
-    var coords = cursorCoords(cm, pos)
-    var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)
-    rect = {left: Math.min(coords.left, endCoords.left),
-            top: Math.min(coords.top, endCoords.top) - margin,
-            right: Math.max(coords.left, endCoords.left),
-            bottom: Math.max(coords.bottom, endCoords.bottom) + margin}
-    var scrollPos = calculateScrollPos(cm, rect)
-    var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft
-    if (scrollPos.scrollTop != null) {
-      setScrollTop(cm, scrollPos.scrollTop)
-      if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true }
-    }
-    if (scrollPos.scrollLeft != null) {
-      setScrollLeft(cm, scrollPos.scrollLeft)
-      if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true }
-    }
-    if (!changed) { break }
-  }
-  return rect
-}
-
-// Scroll a given set of coordinates into view (immediately).
-function scrollIntoView(cm, rect) {
-  var scrollPos = calculateScrollPos(cm, rect)
-  if (scrollPos.scrollTop != null) { setScrollTop(cm, scrollPos.scrollTop) }
-  if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) }
-}
-
-// Calculate a new scroll position needed to scroll the given
-// rectangle into view. Returns an object with scrollTop and
-// scrollLeft properties. When these are undefined, the
-// vertical/horizontal position does not need to be adjusted.
-function calculateScrollPos(cm, rect) {
-  var display = cm.display, snapMargin = textHeight(cm.display)
-  if (rect.top < 0) { rect.top = 0 }
-  var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop
-  var screen = displayHeight(cm), result = {}
-  if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen }
-  var docBottom = cm.doc.height + paddingVert(display)
-  var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin
-  if (rect.top < screentop) {
-    result.scrollTop = atTop ? 0 : rect.top
-  } else if (rect.bottom > screentop + screen) {
-    var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)
-    if (newTop != screentop) { result.scrollTop = newTop }
-  }
-
-  var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft
-  var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)
-  var tooWide = rect.right - rect.left > screenw
-  if (tooWide) { rect.right = rect.left + screenw }
-  if (rect.left < 10)
-    { result.scrollLeft = 0 }
-  else if (rect.left < screenleft)
-    { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)) }
-  else if (rect.right > screenw + screenleft - 3)
-    { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw }
-  return result
-}
-
-// Store a relative adjustment to the scroll position in the current
-// operation (to be applied when the operation finishes).
-function addToScrollPos(cm, left, top) {
-  if (left != null || top != null) { resolveScrollToPos(cm) }
-  if (left != null)
-    { cm.curOp.scrollLeft = (cm.curOp.scrollLeft == null ? cm.doc.scrollLeft : cm.curOp.scrollLeft) + left }
-  if (top != null)
-    { cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top }
-}
-
-// Make sure that at the end of the operation the current cursor is
-// shown.
-function ensureCursorVisible(cm) {
-  resolveScrollToPos(cm)
-  var cur = cm.getCursor(), from = cur, to = cur
-  if (!cm.options.lineWrapping) {
-    from = cur.ch ? Pos(cur.line, cur.ch - 1) : cur
-    to = Pos(cur.line, cur.ch + 1)
-  }
-  cm.curOp.scrollToPos = {from: from, to: to, margin: cm.options.cursorScrollMargin}
-}
-
-// When an operation has its scrollToPos property set, and another
-// scroll action is applied before the end of the operation, this
-// 'simulates' scrolling that position into view in a cheap way, so
-// that the effect of intermediate scroll commands is not ignored.
-function resolveScrollToPos(cm) {
-  var range = cm.curOp.scrollToPos
-  if (range) {
-    cm.curOp.scrollToPos = null
-    var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)
-    var sPos = calculateScrollPos(cm, {
-      left: Math.min(from.left, to.left),
-      top: Math.min(from.top, to.top) - range.margin,
-      right: Math.max(from.right, to.right),
-      bottom: Math.max(from.bottom, to.bottom) + range.margin
-    })
-    cm.scrollTo(sPos.scrollLeft, sPos.scrollTop)
-  }
-}
-
-// Operations are used to wrap a series of changes to the editor
-// state in such a way that each change won't have to update the
-// cursor and display (which would be awkward, slow, and
-// error-prone). Instead, display updates are batched and then all
-// combined and executed at once.
-
-var nextOpId = 0
-// Start a new operation.
-function startOperation(cm) {
-  cm.curOp = {
-    cm: cm,
-    viewChanged: false,      // Flag that indicates that lines might need to be redrawn
-    startHeight: cm.doc.height, // Used to detect need to update scrollbar
-    forceUpdate: false,      // Used to force a redraw
-    updateInput: null,       // Whether to reset the input textarea
-    typing: false,           // Whether this reset should be careful to leave existing text (for compositing)
-    changeObjs: null,        // Accumulated changes, for firing change events
-    cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
-    cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
-    selectionChanged: false, // Whether the selection needs to be redrawn
-    updateMaxLine: false,    // Set when the widest line needs to be determined anew
-    scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
-    scrollToPos: null,       // Used to scroll to a specific position
-    focus: false,
-    id: ++nextOpId           // Unique ID
-  }
-  pushOperation(cm.curOp)
-}
-
-// Finish an operation, updating the display and signalling delayed events
-function endOperation(cm) {
-  var op = cm.curOp
-  finishOperation(op, function (group) {
-    for (var i = 0; i < group.ops.length; i++)
-      { group.ops[i].cm.curOp = null }
-    endOperations(group)
-  })
-}
-
-// The DOM updates done when an operation finishes are batched so
-// that the minimum number of relayouts are required.
-function endOperations(group) {
-  var ops = group.ops
-  for (var i = 0; i < ops.length; i++) // Read DOM
-    { endOperation_R1(ops[i]) }
-  for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
-    { endOperation_W1(ops[i$1]) }
-  for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
-    { endOperation_R2(ops[i$2]) }
-  for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
-    { endOperation_W2(ops[i$3]) }
-  for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
-    { endOperation_finish(ops[i$4]) }
-}
-
-function endOperation_R1(op) {
-  var cm = op.cm, display = cm.display
-  maybeClipScrollbars(cm)
-  if (op.updateMaxLine) { findMaxLine(cm) }
-
-  op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
-    op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
-                       op.scrollToPos.to.line >= display.viewTo) ||
-    display.maxLineChanged && cm.options.lineWrapping
-  op.update = op.mustUpdate &&
-    new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate)
-}
-
-function endOperation_W1(op) {
-  op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)
-}
-
-function endOperation_R2(op) {
-  var cm = op.cm, display = cm.display
-  if (op.updatedDisplay) { updateHeightsInViewport(cm) }
-
-  op.barMeasure = measureForScrollbars(cm)
-
-  // If the max line changed since it was last measured, measure it,
-  // and ensure the document's width matches it.
-  // updateDisplay_W2 will use these properties to do the actual resizing
-  if (display.maxLineChanged && !cm.options.lineWrapping) {
-    op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3
-    cm.display.sizerWidth = op.adjustWidthTo
-    op.barMeasure.scrollWidth =
-      Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth)
-    op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))
-  }
-
-  if (op.updatedDisplay || op.selectionChanged)
-    { op.preparedSelection = display.input.prepareSelection(op.focus) }
-}
-
-function endOperation_W2(op) {
-  var cm = op.cm
-
-  if (op.adjustWidthTo != null) {
-    cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"
-    if (op.maxScrollLeft < cm.doc.scrollLeft)
-      { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true) }
-    cm.display.maxLineChanged = false
-  }
-
-  var takeFocus = op.focus && op.focus == activeElt() && (!document.hasFocus || document.hasFocus())
-  if (op.preparedSelection)
-    { cm.display.input.showSelection(op.preparedSelection, takeFocus) }
-  if (op.updatedDisplay || op.startHeight != cm.doc.height)
-    { updateScrollbars(cm, op.barMeasure) }
-  if (op.updatedDisplay)
-    { setDocumentHeight(cm, op.barMeasure) }
-
-  if (op.selectionChanged) { restartBlink(cm) }
-
-  if (cm.state.focused && op.updateInput)
-    { cm.display.input.reset(op.typing) }
-  if (takeFocus) { ensureFocus(op.cm) }
-}
-
-function endOperation_finish(op) {
-  var cm = op.cm, display = cm.display, doc = cm.doc
-
-  if (op.updatedDisplay) { postUpdateDisplay(cm, op.update) }
-
-  // Abort mouse wheel delta measurement, when scrolling explicitly
-  if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
-    { display.wheelStartX = display.wheelStartY = null }
-
-  // Propagate the scroll position to the actual DOM scroller
-  if (op.scrollTop != null && (display.scroller.scrollTop != op.scrollTop || op.forceScroll)) {
-    doc.scrollTop = Math.max(0, Math.min(display.scroller.scrollHeight - display.scroller.clientHeight, op.scrollTop))
-    display.scrollbars.setScrollTop(doc.scrollTop)
-    display.scroller.scrollTop = doc.scrollTop
-  }
-  if (op.scrollLeft != null && (display.scroller.scrollLeft != op.scrollLeft || op.forceScroll)) {
-    doc.scrollLeft = Math.max(0, Math.min(display.scroller.scrollWidth - display.scroller.clientWidth, op.scrollLeft))
-    display.scrollbars.setScrollLeft(doc.scrollLeft)
-    display.scroller.scrollLeft = doc.scrollLeft
-    alignHorizontally(cm)
-  }
-  // If we need to scroll a specific position into view, do so.
-  if (op.scrollToPos) {
-    var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
-                                 clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin)
-    maybeScrollWindow(cm, rect)
-  }
-
-  // Fire events for markers that are hidden/unidden by editing or
-  // undoing
-  var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers
-  if (hidden) { for (var i = 0; i < hidden.length; ++i)
-    { if (!hidden[i].lines.length) { signal(hidden[i], "hide") } } }
-  if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
-    { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } }
-
-  if (display.wrapper.offsetHeight)
-    { doc.scrollTop = cm.display.scroller.scrollTop }
-
-  // Fire change events, and delayed event handlers
-  if (op.changeObjs)
-    { signal(cm, "changes", cm, op.changeObjs) }
-  if (op.update)
-    { op.update.finish() }
-}
-
-// Run the given function in an operation
-function runInOp(cm, f) {
-  if (cm.curOp) { return f() }
-  startOperation(cm)
-  try { return f() }
-  finally { endOperation(cm) }
-}
-// Wraps a function in an operation. Returns the wrapped function.
-function operation(cm, f) {
-  return function() {
-    if (cm.curOp) { return f.apply(cm, arguments) }
-    startOperation(cm)
-    try { return f.apply(cm, arguments) }
-    finally { endOperation(cm) }
-  }
-}
-// Used to add methods to editor and doc instances, wrapping them in
-// operations.
-function methodOp(f) {
-  return function() {
-    if (this.curOp) { return f.apply(this, arguments) }
-    startOperation(this)
-    try { return f.apply(this, arguments) }
-    finally { endOperation(this) }
-  }
-}
-function docMethodOp(f) {
-  return function() {
-    var cm = this.cm
-    if (!cm || cm.curOp) { return f.apply(this, arguments) }
-    startOperation(cm)
-    try { return f.apply(this, arguments) }
-    finally { endOperation(cm) }
-  }
-}
-
-// Updates the display.view data structure for a given change to the
-// document. From and to are in pre-change coordinates. Lendiff is
-// the amount of lines added or subtracted by the change. This is
-// used for changes that span multiple lines, or change the way
-// lines are divided into visual lines. regLineChange (below)
-// registers single-line changes.
-function regChange(cm, from, to, lendiff) {
-  if (from == null) { from = cm.doc.first }
-  if (to == null) { to = cm.doc.first + cm.doc.size }
-  if (!lendiff) { lendiff = 0 }
-
-  var display = cm.display
-  if (lendiff && to < display.viewTo &&
-      (display.updateLineNumbers == null || display.updateLineNumbers > from))
-    { display.updateLineNumbers = from }
-
-  cm.curOp.viewChanged = true
-
-  if (from >= display.viewTo) { // Change after
-    if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
-      { resetView(cm) }
-  } else if (to <= display.viewFrom) { // Change before
-    if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
-      resetView(cm)
-    } else {
-      display.viewFrom += lendiff
-      display.viewTo += lendiff
-    }
-  } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
-    resetView(cm)
-  } else if (from <= display.viewFrom) { // Top overlap
-    var cut = viewCuttingPoint(cm, to, to + lendiff, 1)
-    if (cut) {
-      display.view = display.view.slice(cut.index)
-      display.viewFrom = cut.lineN
-      display.viewTo += lendiff
-    } else {
-      resetView(cm)
-    }
-  } else if (to >= display.viewTo) { // Bottom overlap
-    var cut$1 = viewCuttingPoint(cm, from, from, -1)
-    if (cut$1) {
-      display.view = display.view.slice(0, cut$1.index)
-      display.viewTo = cut$1.lineN
-    } else {
-      resetView(cm)
-    }
-  } else { // Gap in the middle
-    var cutTop = viewCuttingPoint(cm, from, from, -1)
-    var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)
-    if (cutTop && cutBot) {
-      display.view = display.view.slice(0, cutTop.index)
-        .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
-        .concat(display.view.slice(cutBot.index))
-      display.viewTo += lendiff
-    } else {
-      resetView(cm)
-    }
-  }
-
-  var ext = display.externalMeasured
-  if (ext) {
-    if (to < ext.lineN)
-      { ext.lineN += lendiff }
-    else if (from < ext.lineN + ext.size)
-      { display.externalMeasured = null }
-  }
-}
-
-// Register a change to a single line. Type must be one of "text",
-// "gutter", "class", "widget"
-function regLineChange(cm, line, type) {
-  cm.curOp.viewChanged = true
-  var display = cm.display, ext = cm.display.externalMeasured
-  if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
-    { display.externalMeasured = null }
-
-  if (line < display.viewFrom || line >= display.viewTo) { return }
-  var lineView = display.view[findViewIndex(cm, line)]
-  if (lineView.node == null) { return }
-  var arr = lineView.changes || (lineView.changes = [])
-  if (indexOf(arr, type) == -1) { arr.push(type) }
-}
-
-// Clear the view.
-function resetView(cm) {
-  cm.display.viewFrom = cm.display.viewTo = cm.doc.first
-  cm.display.view = []
-  cm.display.viewOffset = 0
-}
-
-function viewCuttingPoint(cm, oldN, newN, dir) {
-  var index = findViewIndex(cm, oldN), diff, view = cm.display.view
-  if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
-    { return {index: index, lineN: newN} }
-  var n = cm.display.viewFrom
-  for (var i = 0; i < index; i++)
-    { n += view[i].size }
-  if (n != oldN) {
-    if (dir > 0) {
-      if (index == view.length - 1) { return null }
-      diff = (n + view[index].size) - oldN
-      index++
-    } else {
-      diff = n - oldN
-    }
-    oldN += diff; newN += diff
-  }
-  while (visualLineNo(cm.doc, newN) != newN) {
-    if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
-    newN += dir * view[index - (dir < 0 ? 1 : 0)].size
-    index += dir
-  }
-  return {index: index, lineN: newN}
-}
-
-// Force the view to cover a given range, adding empty view element
-// or clipping off existing ones as needed.
-function adjustView(cm, from, to) {
-  var display = cm.display, view = display.view
-  if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
-    display.view = buildViewArray(cm, from, to)
-    display.viewFrom = from
-  } else {
-    if (display.viewFrom > from)
-      { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view) }
-    else if (display.viewFrom < from)
-      { display.view = display.view.slice(findViewIndex(cm, from)) }
-    display.viewFrom = from
-    if (display.viewTo < to)
-      { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)) }
-    else if (display.viewTo > to)
-      { display.view = display.view.slice(0, findViewIndex(cm, to)) }
-  }
-  display.viewTo = to
-}
-
-// Count the number of lines in the view whose DOM representation is
-// out of date (or nonexistent).
-function countDirtyView(cm) {
-  var view = cm.display.view, dirty = 0
-  for (var i = 0; i < view.length; i++) {
-    var lineView = view[i]
-    if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty }
-  }
-  return dirty
-}
-
-// HIGHLIGHT WORKER
-
-function startWorker(cm, time) {
-  if (cm.doc.mode.startState && cm.doc.frontier < cm.display.viewTo)
-    { cm.state.highlight.set(time, bind(highlightWorker, cm)) }
-}
-
-function highlightWorker(cm) {
-  var doc = cm.doc
-  if (doc.frontier < doc.first) { doc.frontier = doc.first }
-  if (doc.frontier >= cm.display.viewTo) { return }
-  var end = +new Date + cm.options.workTime
-  var state = copyState(doc.mode, getStateBefore(cm, doc.frontier))
-  var changedLines = []
-
-  doc.iter(doc.frontier, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
-    if (doc.frontier >= cm.display.viewFrom) { // Visible
-      var oldStyles = line.styles, tooLong = line.text.length > cm.options.maxHighlightLength
-      var highlighted = highlightLine(cm, line, tooLong ? copyState(doc.mode, state) : state, true)
-      line.styles = highlighted.styles
-      var oldCls = line.styleClasses, newCls = highlighted.classes
-      if (newCls) { line.styleClasses = newCls }
-      else if (oldCls) { line.styleClasses = null }
-      var ischange = !oldStyles || oldStyles.length != line.styles.length ||
-        oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
-      for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i] }
-      if (ischange) { changedLines.push(doc.frontier) }
-      line.stateAfter = tooLong ? state : copyState(doc.mode, state)
-    } else {
-      if (line.text.length <= cm.options.maxHighlightLength)
-        { processLine(cm, line.text, state) }
-      line.stateAfter = doc.frontier % 5 == 0 ? copyState(doc.mode, state) : null
-    }
-    ++doc.frontier
-    if (+new Date > end) {
-      startWorker(cm, cm.options.workDelay)
-      return true
-    }
-  })
-  if (changedLines.length) { runInOp(cm, function () {
-    for (var i = 0; i < changedLines.length; i++)
-      { regLineChange(cm, changedLines[i], "text") }
-  }) }
-}
-
-// DISPLAY DRAWING
-
-var DisplayUpdate = function(cm, viewport, force) {
-  var display = cm.display
-
-  this.viewport = viewport
-  // Store some values that we'll need later (but don't want to force a relayout for)
-  this.visible = visibleLines(display, cm.doc, viewport)
-  this.editorIsHidden = !display.wrapper.offsetWidth
-  this.wrapperHeight = display.wrapper.clientHeight
-  this.wrapperWidth = display.wrapper.clientWidth
-  this.oldDisplayWidth = displayWidth(cm)
-  this.force = force
-  this.dims = getDimensions(cm)
-  this.events = []
-};
-
-DisplayUpdate.prototype.signal = function (emitter, type) {
-  if (hasHandler(emitter, type))
-    { this.events.push(arguments) }
-};
-DisplayUpdate.prototype.finish = function () {
-    var this$1 = this;
-
-  for (var i = 0; i < this.events.length; i++)
-    { signal.apply(null, this$1.events[i]) }
-};
-
-function maybeClipScrollbars(cm) {
-  var display = cm.display
-  if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
-    display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth
-    display.heightForcer.style.height = scrollGap(cm) + "px"
-    display.sizer.style.marginBottom = -display.nativeBarWidth + "px"
-    display.sizer.style.borderRightWidth = scrollGap(cm) + "px"
-    display.scrollbarsClipped = true
-  }
-}
-
-// Does the actual updating of the line display. Bails out
-// (returning false) when there is nothing to be done and forced is
-// false.
-function updateDisplayIfNeeded(cm, update) {
-  var display = cm.display, doc = cm.doc
-
-  if (update.editorIsHidden) {
-    resetView(cm)
-    return false
-  }
-
-  // Bail out if the visible area is already rendered and nothing changed.
-  if (!update.force &&
-      update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
-      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
-      display.renderedView == display.view && countDirtyView(cm) == 0)
-    { return false }
-
-  if (maybeUpdateLineNumberWidth(cm)) {
-    resetView(cm)
-    update.dims = getDimensions(cm)
-  }
-
-  // Compute a suitable new viewport (from & to)
-  var end = doc.first + doc.size
-  var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)
-  var to = Math.min(end, update.visible.to + cm.options.viewportMargin)
-  if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }
-  if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }
-  if (sawCollapsedSpans) {
-    from = visualLineNo(cm.doc, from)
-    to = visualLineEndNo(cm.doc, to)
-  }
-
-  var different = from != display.viewFrom || to != display.viewTo ||
-    display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth
-  adjustView(cm, from, to)
-
-  display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))
-  // Position the mover div to align with the current scroll position
-  cm.display.mover.style.top = display.viewOffset + "px"
-
-  var toUpdate = countDirtyView(cm)
-  if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
-      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
-    { return false }
-
-  // For big changes, we hide the enclosing element during the
-  // update, since that speeds up the operations on most browsers.
-  var focused = activeElt()
-  if (toUpdate > 4) { display.lineDiv.style.display = "none" }
-  patchDisplay(cm, display.updateLineNumbers, update.dims)
-  if (toUpdate > 4) { display.lineDiv.style.display = "" }
-  display.renderedView = display.view
-  // There might have been a widget with a focused element that got
-  // hidden or updated, if so re-focus it.
-  if (focused && activeElt() != focused && focused.offsetHeight) { focused.focus() }
-
-  // Prevent selection and cursors from interfering with the scroll
-  // width and height.
-  removeChildren(display.cursorDiv)
-  removeChildren(display.selectionDiv)
-  display.gutters.style.height = display.sizer.style.minHeight = 0
-
-  if (different) {
-    display.lastWrapHeight = update.wrapperHeight
-    display.lastWrapWidth = update.wrapperWidth
-    startWorker(cm, 400)
-  }
-
-  display.updateLineNumbers = null
-
-  return true
-}
-
-function postUpdateDisplay(cm, update) {
-  var viewport = update.viewport
-
-  for (var first = true;; first = false) {
-    if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
-      // Clip forced viewport to actual scrollable area.
-      if (viewport && viewport.top != null)
-        { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)} }
-      // Updated line heights might result in the drawn area not
-      // actually covering the viewport. Keep looping until it does.
-      update.visible = visibleLines(cm.display, cm.doc, viewport)
-      if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
-        { break }
-    }
-    if (!updateDisplayIfNeeded(cm, update)) { break }
-    updateHeightsInViewport(cm)
-    var barMeasure = measureForScrollbars(cm)
-    updateSelection(cm)
-    updateScrollbars(cm, barMeasure)
-    setDocumentHeight(cm, barMeasure)
-  }
-
-  update.signal(cm, "update", cm)
-  if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
-    update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo)
-    cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo
-  }
-}
-
-function updateDisplaySimple(cm, viewport) {
-  var update = new DisplayUpdate(cm, viewport)
-  if (updateDisplayIfNeeded(cm, update)) {
-    updateHeightsInViewport(cm)
-    postUpdateDisplay(cm, update)
-    var barMeasure = measureForScrollbars(cm)
-    updateSelection(cm)
-    updateScrollbars(cm, barMeasure)
-    setDocumentHeight(cm, barMeasure)
-    update.finish()
-  }
-}
-
-// Sync the actual display DOM structure with display.view, removing
-// nodes for lines that are no longer in view, and creating the ones
-// that are not there yet, and updating the ones that are out of
-// date.
-function patchDisplay(cm, updateNumbersFrom, dims) {
-  var display = cm.display, lineNumbers = cm.options.lineNumbers
-  var container = display.lineDiv, cur = container.firstChild
-
-  function rm(node) {
-    var next = node.nextSibling
-    // Works around a throw-scroll bug in OS X Webkit
-    if (webkit && mac && cm.display.currentWheelTarget == node)
-      { node.style.display = "none" }
-    else
-      { node.parentNode.removeChild(node) }
-    return next
-  }
-
-  var view = display.view, lineN = display.viewFrom
-  // Loop over the elements in the view, syncing cur (the DOM nodes
-  // in display.lineDiv) with the view as we go.
-  for (var i = 0; i < view.length; i++) {
-    var lineView = view[i]
-    if (lineView.hidden) {
-    } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
-      var node = buildLineElement(cm, lineView, lineN, dims)
-      container.insertBefore(node, cur)
-    } else { // Already drawn
-      while (cur != lineView.node) { cur = rm(cur) }
-      var updateNumber = lineNumbers && updateNumbersFrom != null &&
-        updateNumbersFrom <= lineN && lineView.lineNumber
-      if (lineView.changes) {
-        if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false }
-        updateLineForChanges(cm, lineView, lineN, dims)
-      }
-      if (updateNumber) {
-        removeChildren(lineView.lineNumber)
-        lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))
-      }
-      cur = lineView.node.nextSibling
-    }
-    lineN += lineView.size
-  }
-  while (cur) { cur = rm(cur) }
-}
-
-function updateGutterSpace(cm) {
-  var width = cm.display.gutters.offsetWidth
-  cm.display.sizer.style.marginLeft = width + "px"
-}
-
-function setDocumentHeight(cm, measure) {
-  cm.display.sizer.style.minHeight = measure.docHeight + "px"
-  cm.display.heightForcer.style.top = measure.docHeight + "px"
-  cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"
-}
-
-// Rebuild the gutter elements, ensure the margin to the left of the
-// code matches their width.
-function updateGutters(cm) {
-  var gutters = cm.display.gutters, specs = cm.options.gutters
-  removeChildren(gutters)
-  var i = 0
-  for (; i < specs.length; ++i) {
-    var gutterClass = specs[i]
-    var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
-    if (gutterClass == "CodeMirror-linenumbers") {
-      cm.display.lineGutter = gElt
-      gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
-    }
-  }
-  gutters.style.display = i ? "" : "none"
-  updateGutterSpace(cm)
-}
-
-// Make sure the gutters options contains the element
-// "CodeMirror-linenumbers" when the lineNumbers option is true.
-function setGuttersForLineNumbers(options) {
-  var found = indexOf(options.gutters, "CodeMirror-linenumbers")
-  if (found == -1 && options.lineNumbers) {
-    options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
-  } else if (found > -1 && !options.lineNumbers) {
-    options.gutters = options.gutters.slice(0)
-    options.gutters.splice(found, 1)
-  }
-}
-
-// Selection objects are immutable. A new one is created every time
-// the selection changes. A selection is one or more non-overlapping
-// (and non-touching) ranges, sorted, and an integer that indicates
-// which one is the primary selection (the one that's scrolled into
-// view, that getCursor returns, etc).
-var Selection = function(ranges, primIndex) {
-  this.ranges = ranges
-  this.primIndex = primIndex
-};
-
-Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
-
-Selection.prototype.equals = function (other) {
-    var this$1 = this;
-
-  if (other == this) { return true }
-  if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
-  for (var i = 0; i < this.ranges.length; i++) {
-    var here = this$1.ranges[i], there = other.ranges[i]
-    if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
-  }
-  return true
-};
-
-Selection.prototype.deepCopy = function () {
-    var this$1 = this;
-
-  var out = []
-  for (var i = 0; i < this.ranges.length; i++)
-    { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) }
-  return new Selection(out, this.primIndex)
-};
-
-Selection.prototype.somethingSelected = function () {
-    var this$1 = this;
-
-  for (var i = 0; i < this.ranges.length; i++)
-    { if (!this$1.ranges[i].empty()) { return true } }
-  return false
-};
-
-Selection.prototype.contains = function (pos, end) {
-    var this$1 = this;
-
-  if (!end) { end = pos }
-  for (var i = 0; i < this.ranges.length; i++) {
-    var range = this$1.ranges[i]
-    if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
-      { return i }
-  }
-  return -1
-};
-
-var Range = function(anchor, head) {
-  this.anchor = anchor; this.head = head
-};
-
-Range.prototype.from = function () { return minPos(this.anchor, this.head) };
-Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
-Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
-
-// Take an unsorted, potentially overlapping set of ranges, and
-// build a selection out of it. 'Consumes' ranges array (modifying
-// it).
-function normalizeSelection(ranges, primIndex) {
-  var prim = ranges[primIndex]
-  ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })
-  primIndex = indexOf(ranges, prim)
-  for (var i = 1; i < ranges.length; i++) {
-    var cur = ranges[i], prev = ranges[i - 1]
-    if (cmp(prev.to(), cur.from()) >= 0) {
-      var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
-      var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
-      if (i <= primIndex) { --primIndex }
-      ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
-    }
-  }
-  return new Selection(ranges, primIndex)
-}
-
-function simpleSelection(anchor, head) {
-  return new Selection([new Range(anchor, head || anchor)], 0)
-}
-
-// Compute the position of the end of a change (its 'to' property
-// refers to the pre-change end).
-function changeEnd(change) {
-  if (!change.text) { return change.to }
-  return Pos(change.from.line + change.text.length - 1,
-             lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
-}
-
-// Adjust a position to refer to the post-change position of the
-// same text, or the end of the change if the change covers it.
-function adjustForChange(pos, change) {
-  if (cmp(pos, change.from) < 0) { return pos }
-  if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
-
-  var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch
-  if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }
-  return Pos(line, ch)
-}
-
-function computeSelAfterChange(doc, change) {
-  var out = []
-  for (var i = 0; i < doc.sel.ranges.length; i++) {
-    var range = doc.sel.ranges[i]
-    out.push(new Range(adjustForChange(range.anchor, change),
-                       adjustForChange(range.head, change)))
-  }
-  return normalizeSelection(out, doc.sel.primIndex)
-}
-
-function offsetPos(pos, old, nw) {
-  if (pos.line == old.line)
-    { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
-  else
-    { return Pos(nw.line + (pos.line - old.line), pos.ch) }
-}
-
-// Used by replaceSelections to allow moving the selection to the
-// start or around the replaced test. Hint may be "start" or "around".
-function computeReplacedSel(doc, changes, hint) {
-  var out = []
-  var oldPrev = Pos(doc.first, 0), newPrev = oldPrev
-  for (var i = 0; i < changes.length; i++) {
-    var change = changes[i]
-    var from = offsetPos(change.from, oldPrev, newPrev)
-    var to = offsetPos(changeEnd(change), oldPrev, newPrev)
-    oldPrev = change.to
-    newPrev = to
-    if (hint == "around") {
-      var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0
-      out[i] = new Range(inv ? to : from, inv ? from : to)
-    } else {
-      out[i] = new Range(from, from)
-    }
-  }
-  return new Selection(out, doc.sel.primIndex)
-}
-
-// Used to get the editor into a consistent state again when options change.
-
-function loadMode(cm) {
-  cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
-  resetModeState(cm)
-}
-
-function resetModeState(cm) {
-  cm.doc.iter(function (line) {
-    if (line.stateAfter) { line.stateAfter = null }
-    if (line.styles) { line.styles = null }
-  })
-  cm.doc.frontier = cm.doc.first
-  startWorker(cm, 100)
-  cm.state.modeGen++
-  if (cm.curOp) { regChange(cm) }
-}
-
-// DOCUMENT DATA STRUCTURE
-
-// By default, updates that start and end at the beginning of a line
-// are treated specially, in order to make the association of line
-// widgets and marker elements with the text behave more intuitive.
-function isWholeLineUpdate(doc, change) {
-  return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
-    (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
-}
-
-// Perform a change on the document data structure.
-function updateDoc(doc, change, markedSpans, estimateHeight) {
-  function spansFor(n) {return markedSpans ? markedSpans[n] : null}
-  function update(line, text, spans) {
-    updateLine(line, text, spans, estimateHeight)
-    signalLater(line, "change", line, change)
-  }
-  function linesFor(start, end) {
-    var result = []
-    for (var i = start; i < end; ++i)
-      { result.push(new Line(text[i], spansFor(i), estimateHeight)) }
-    return result
-  }
-
-  var from = change.from, to = change.to, text = change.text
-  var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)
-  var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line
-
-  // Adjust the line structure
-  if (change.full) {
-    doc.insert(0, linesFor(0, text.length))
-    doc.remove(text.length, doc.size - text.length)
-  } else if (isWholeLineUpdate(doc, change)) {
-    // This is a whole-line replace. Treated specially to make
-    // sure line objects move the way they are supposed to.
-    var added = linesFor(0, text.length - 1)
-    update(lastLine, lastLine.text, lastSpans)
-    if (nlines) { doc.remove(from.line, nlines) }
-    if (added.length) { doc.insert(from.line, added) }
-  } else if (firstLine == lastLine) {
-    if (text.length == 1) {
-      update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)
-    } else {
-      var added$1 = linesFor(1, text.length - 1)
-      added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))
-      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
-      doc.insert(from.line + 1, added$1)
-    }
-  } else if (text.length == 1) {
-    update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))
-    doc.remove(from.line + 1, nlines)
-  } else {
-    update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
-    update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)
-    var added$2 = linesFor(1, text.length - 1)
-    if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }
-    doc.insert(from.line + 1, added$2)
-  }
-
-  signalLater(doc, "change", doc, change)
-}
-
-// Call f for all linked documents.
-function linkedDocs(doc, f, sharedHistOnly) {
-  function propagate(doc, skip, sharedHist) {
-    if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
-      var rel = doc.linked[i]
-      if (rel.doc == skip) { continue }
-      var shared = sharedHist && rel.sharedHist
-      if (sharedHistOnly && !shared) { continue }
-      f(rel.doc, shared)
-      propagate(rel.doc, doc, shared)
-    } }
-  }
-  propagate(doc, null, true)
-}
-
-// Attach a document to an editor.
-function attachDoc(cm, doc) {
-  if (doc.cm) { throw new Error("This document is already in use.") }
-  cm.doc = doc
-  doc.cm = cm
-  estimateLineHeights(cm)
-  loadMode(cm)
-  setDirectionClass(cm)
-  if (!cm.options.lineWrapping) { findMaxLine(cm) }
-  cm.options.mode = doc.modeOption
-  regChange(cm)
-}
-
-function setDirectionClass(cm) {
-  ;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")
-}
-
-function directionChanged(cm) {
-  runInOp(cm, function () {
-    setDirectionClass(cm)
-    regChange(cm)
-  })
-}
-
-function History(startGen) {
-  // Arrays of change events and selections. Doing something adds an
-  // event to done and clears undo. Undoing moves events from done
-  // to undone, redoing moves them in the other direction.
-  this.done = []; this.undone = []
-  this.undoDepth = Infinity
-  // Used to track when changes can be merged into a single undo
-  // event
-  this.lastModTime = this.lastSelTime = 0
-  this.lastOp = this.lastSelOp = null
-  this.lastOrigin = this.lastSelOrigin = null
-  // Used by the isClean() method
-  this.generation = this.maxGeneration = startGen || 1
-}
-
-// Create a history change event from an updateDoc-style change
-// object.
-function historyChangeFromChange(doc, change) {
-  var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}
-  attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)
-  linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)
-  return histChange
-}
-
-// Pop all selection events off the end of a history array. Stop at
-// a change event.
-function clearSelectionEvents(array) {
-  while (array.length) {
-    var last = lst(array)
-    if (last.ranges) { array.pop() }
-    else { break }
-  }
-}
-
-// Find the top change event in the history. Pop off selection
-// events that are in the way.
-function lastChangeEvent(hist, force) {
-  if (force) {
-    clearSelectionEvents(hist.done)
-    return lst(hist.done)
-  } else if (hist.done.length && !lst(hist.done).ranges) {
-    return lst(hist.done)
-  } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
-    hist.done.pop()
-    return lst(hist.done)
-  }
-}
-
-// Register a change in the history. Merges changes that are within
-// a single operation, or are close together with an origin that
-// allows merging (starting with "+") into a single event.
-function addChangeToHistory(doc, change, selAfter, opId) {
-  var hist = doc.history
-  hist.undone.length = 0
-  var time = +new Date, cur
-  var last
-
-  if ((hist.lastOp == opId ||
-       hist.lastOrigin == change.origin && change.origin &&
-       ((change.origin.charAt(0) == "+" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||
-        change.origin.charAt(0) == "*")) &&
-      (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
-    // Merge this change into the last event
-    last = lst(cur.changes)
-    if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
-      // Optimized case for simple insertion -- don't want to add
-      // new changesets for every character typed
-      last.to = changeEnd(change)
-    } else {
-      // Add new sub-event
-      cur.changes.push(historyChangeFromChange(doc, change))
-    }
-  } else {
-    // Can not be merged, start a new event.
-    var before = lst(hist.done)
-    if (!before || !before.ranges)
-      { pushSelectionToHistory(doc.sel, hist.done) }
-    cur = {changes: [historyChangeFromChange(doc, change)],
-           generation: hist.generation}
-    hist.done.push(cur)
-    while (hist.done.length > hist.undoDepth) {
-      hist.done.shift()
-      if (!hist.done[0].ranges) { hist.done.shift() }
-    }
-  }
-  hist.done.push(selAfter)
-  hist.generation = ++hist.maxGeneration
-  hist.lastModTime = hist.lastSelTime = time
-  hist.lastOp = hist.lastSelOp = opId
-  hist.lastOrigin = hist.lastSelOrigin = change.origin
-
-  if (!last) { signal(doc, "historyAdded") }
-}
-
-function selectionEventCanBeMerged(doc, origin, prev, sel) {
-  var ch = origin.charAt(0)
-  return ch == "*" ||
-    ch == "+" &&
-    prev.ranges.length == sel.ranges.length &&
-    prev.somethingSelected() == sel.somethingSelected() &&
-    new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
-}
-
-// Called whenever the selection changes, sets the new selection as
-// the pending selection in the history, and pushes the old pending
-// selection into the 'done' array when it was significantly
-// different (in number of selected ranges, emptiness, or time).
-function addSelectionToHistory(doc, sel, opId, options) {
-  var hist = doc.history, origin = options && options.origin
-
-  // A new event is started when the previous origin does not match
-  // the current, or the origins don't allow matching. Origins
-  // starting with * are always merged, those starting with + are
-  // merged when similar and close together in time.
-  if (opId == hist.lastSelOp ||
-      (origin && hist.lastSelOrigin == origin &&
-       (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
-        selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
-    { hist.done[hist.done.length - 1] = sel }
-  else
-    { pushSelectionToHistory(sel, hist.done) }
-
-  hist.lastSelTime = +new Date
-  hist.lastSelOrigin = origin
-  hist.lastSelOp = opId
-  if (options && options.clearRedo !== false)
-    { clearSelectionEvents(hist.undone) }
-}
-
-function pushSelectionToHistory(sel, dest) {
-  var top = lst(dest)
-  if (!(top && top.ranges && top.equals(sel)))
-    { dest.push(sel) }
-}
-
-// Used to store marked span information in the history.
-function attachLocalSpans(doc, change, from, to) {
-  var existing = change["spans_" + doc.id], n = 0
-  doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
-    if (line.markedSpans)
-      { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans }
-    ++n
-  })
-}
-
-// When un/re-doing restores text containing marked spans, those
-// that have been explicitly cleared should not be restored.
-function removeClearedSpans(spans) {
-  if (!spans) { return null }
-  var out
-  for (var i = 0; i < spans.length; ++i) {
-    if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i) } }
-    else if (out) { out.push(spans[i]) }
-  }
-  return !out ? spans : out.length ? out : null
-}
-
-// Retrieve and filter the old marked spans stored in a change event.
-function getOldSpans(doc, change) {
-  var found = change["spans_" + doc.id]
-  if (!found) { return null }
-  var nw = []
-  for (var i = 0; i < change.text.length; ++i)
-    { nw.push(removeClearedSpans(found[i])) }
-  return nw
-}
-
-// Used for un/re-doing changes from the history. Combines the
-// result of computing the existing spans with the set of spans that
-// existed in the history (so that deleting around a span and then
-// undoing brings back the span).
-function mergeOldSpans(doc, change) {
-  var old = getOldSpans(doc, change)
-  var stretched = stretchSpansOverChange(doc, change)
-  if (!old) { return stretched }
-  if (!stretched) { return old }
-
-  for (var i = 0; i < old.length; ++i) {
-    var oldCur = old[i], stretchCur = stretched[i]
-    if (oldCur && stretchCur) {
-      spans: for (var j = 0; j < stretchCur.length; ++j) {
-        var span = stretchCur[j]
-        for (var k = 0; k < oldCur.length; ++k)
-          { if (oldCur[k].marker == span.marker) { continue spans } }
-        oldCur.push(span)
-      }
-    } else if (stretchCur) {
-      old[i] = stretchCur
-    }
-  }
-  return old
-}
-
-// Used both to provide a JSON-safe object in .getHistory, and, when
-// detaching a document, to split the history in two
-function copyHistoryArray(events, newGroup, instantiateSel) {
-  var copy = []
-  for (var i = 0; i < events.length; ++i) {
-    var event = events[i]
-    if (event.ranges) {
-      copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event)
-      continue
-    }
-    var changes = event.changes, newChanges = []
-    copy.push({changes: newChanges})
-    for (var j = 0; j < changes.length; ++j) {
-      var change = changes[j], m = (void 0)
-      newChanges.push({from: change.from, to: change.to, text: change.text})
-      if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
-        if (indexOf(newGroup, Number(m[1])) > -1) {
-          lst(newChanges)[prop] = change[prop]
-          delete change[prop]
-        }
-      } } }
-    }
-  }
-  return copy
-}
-
-// The 'scroll' parameter given to many of these indicated whether
-// the new cursor position should be scrolled into view after
-// modifying the selection.
-
-// If shift is held or the extend flag is set, extends a range to
-// include a given position (and optionally a second position).
-// Otherwise, simply returns the range between the given positions.
-// Used for cursor motion and such.
-function extendRange(doc, range, head, other) {
-  if (doc.cm && doc.cm.display.shift || doc.extend) {
-    var anchor = range.anchor
-    if (other) {
-      var posBefore = cmp(head, anchor) < 0
-      if (posBefore != (cmp(other, anchor) < 0)) {
-        anchor = head
-        head = other
-      } else if (posBefore != (cmp(head, other) < 0)) {
-        head = other
-      }
-    }
-    return new Range(anchor, head)
-  } else {
-    return new Range(other || head, head)
-  }
-}
-
-// Extend the primary selection range, discard the rest.
-function extendSelection(doc, head, other, options) {
-  setSelection(doc, new Selection([extendRange(doc, doc.sel.primary(), head, other)], 0), options)
-}
-
-// Extend all selections (pos is an array of selections with length
-// equal the number of selections)
-function extendSelections(doc, heads, options) {
-  var out = []
-  for (var i = 0; i < doc.sel.ranges.length; i++)
-    { out[i] = extendRange(doc, doc.sel.ranges[i], heads[i], null) }
-  var newSel = normalizeSelection(out, doc.sel.primIndex)
-  setSelection(doc, newSel, options)
-}
-
-// Updates a single range in the selection.
-function replaceOneSelection(doc, i, range, options) {
-  var ranges = doc.sel.ranges.slice(0)
-  ranges[i] = range
-  setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)
-}
-
-// Reset the selection to a single range.
-function setSimpleSelection(doc, anchor, head, options) {
-  setSelection(doc, simpleSelection(anchor, head), options)
-}
-
-// Give beforeSelectionChange handlers a change to influence a
-// selection update.
-function filterSelectionChange(doc, sel, options) {
-  var obj = {
-    ranges: sel.ranges,
-    update: function(ranges) {
-      var this$1 = this;
-
-      this.ranges = []
-      for (var i = 0; i < ranges.length; i++)
-        { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
-                                   clipPos(doc, ranges[i].head)) }
-    },
-    origin: options && options.origin
-  }
-  signal(doc, "beforeSelectionChange", doc, obj)
-  if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj) }
-  if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
-  else { return sel }
-}
-
-function setSelectionReplaceHistory(doc, sel, options) {
-  var done = doc.history.done, last = lst(done)
-  if (last && last.ranges) {
-    done[done.length - 1] = sel
-    setSelectionNoUndo(doc, sel, options)
-  } else {
-    setSelection(doc, sel, options)
-  }
-}
-
-// Set a new selection.
-function setSelection(doc, sel, options) {
-  setSelectionNoUndo(doc, sel, options)
-  addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
-}
-
-function setSelectionNoUndo(doc, sel, options) {
-  if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
-    { sel = filterSelectionChange(doc, sel, options) }
-
-  var bias = options && options.bias ||
-    (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
-  setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
-
-  if (!(options && options.scroll === false) && doc.cm)
-    { ensureCursorVisible(doc.cm) }
-}
-
-function setSelectionInner(doc, sel) {
-  if (sel.equals(doc.sel)) { return }
-
-  doc.sel = sel
-
-  if (doc.cm) {
-    doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true
-    signalCursorActivity(doc.cm)
-  }
-  signalLater(doc, "cursorActivity", doc)
-}
-
-// Verify that the selection does not partially select any atomic
-// marked ranges.
-function reCheckSelection(doc) {
-  setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false), sel_dontScroll)
-}
-
-// Return a selection that does not partially select any atomic
-// ranges.
-function skipAtomicInSelection(doc, sel, bias, mayClear) {
-  var out
-  for (var i = 0; i < sel.ranges.length; i++) {
-    var range = sel.ranges[i]
-    var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
-    var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
-    var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
-    if (out || newAnchor != range.anchor || newHead != range.head) {
-      if (!out) { out = sel.ranges.slice(0, i) }
-      out[i] = new Range(newAnchor, newHead)
-    }
-  }
-  return out ? normalizeSelection(out, sel.primIndex) : sel
-}
-
-function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
-  var line = getLine(doc, pos.line)
-  if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
-    var sp = line.markedSpans[i], m = sp.marker
-    if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
-        (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
-      if (mayClear) {
-        signal(m, "beforeCursorEnter")
-        if (m.explicitlyCleared) {
-          if (!line.markedSpans) { break }
-          else {--i; continue}
-        }
-      }
-      if (!m.atomic) { continue }
-
-      if (oldPos) {
-        var near = m.find(dir < 0 ? 1 : -1), diff = (void 0)
-        if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
-          { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) }
-        if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
-          { return skipAtomicInner(doc, near, pos, dir, mayClear) }
-      }
-
-      var far = m.find(dir < 0 ? -1 : 1)
-      if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
-        { far = movePos(doc, far, dir, far.line == pos.line ? line : null) }
-      return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
-    }
-  } }
-  return pos
-}
-
-// Ensure a given position is not inside an atomic range.
-function skipAtomic(doc, pos, oldPos, bias, mayClear) {
-  var dir = bias || 1
-  var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
-      (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
-      skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
-      (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
-  if (!found) {
-    doc.cantEdit = true
-    return Pos(doc.first, 0)
-  }
-  return found
-}
-
-function movePos(doc, pos, dir, line) {
-  if (dir < 0 && pos.ch == 0) {
-    if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
-    else { return null }
-  } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
-    if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
-    else { return null }
-  } else {
-    return new Pos(pos.line, pos.ch + dir)
-  }
-}
-
-function selectAll(cm) {
-  cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
-}
-
-// UPDATING
-
-// Allow "beforeChange" event handlers to influence a change
-function filterChange(doc, change, update) {
-  var obj = {
-    canceled: false,
-    from: change.from,
-    to: change.to,
-    text: change.text,
-    origin: change.origin,
-    cancel: function () { return obj.canceled = true; }
-  }
-  if (update) { obj.update = function (from, to, text, origin) {
-    if (from) { obj.from = clipPos(doc, from) }
-    if (to) { obj.to = clipPos(doc, to) }
-    if (text) { obj.text = text }
-    if (origin !== undefined) { obj.origin = origin }
-  } }
-  signal(doc, "beforeChange", doc, obj)
-  if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj) }
-
-  if (obj.canceled) { return null }
-  return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
-}
-
-// Apply a change to a document, and add it to the document's
-// history, and propagating it to all linked documents.
-function makeChange(doc, change, ignoreReadOnly) {
-  if (doc.cm) {
-    if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
-    if (doc.cm.state.suppressEdits) { return }
-  }
-
-  if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
-    change = filterChange(doc, change, true)
-    if (!change) { return }
-  }
-
-  // Possibly split or suppress the update based on the presence
-  // of read-only spans in its range.
-  var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)
-  if (split) {
-    for (var i = split.length - 1; i >= 0; --i)
-      { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text}) }
-  } else {
-    makeChangeInner(doc, change)
-  }
-}
-
-function makeChangeInner(doc, change) {
-  if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
-  var selAfter = computeSelAfterChange(doc, change)
-  addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN)
-
-  makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change))
-  var rebased = []
-
-  linkedDocs(doc, function (doc, sharedHist) {
-    if (!sharedHist && indexOf(rebased, doc.history) == -1) {
-      rebaseHist(doc.history, change)
-      rebased.push(doc.history)
-    }
-    makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change))
-  })
-}
-
-// Revert a change stored in a document's history.
-function makeChangeFromHistory(doc, type, allowSelectionOnly) {
-  if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }
-
-  var hist = doc.history, event, selAfter = doc.sel
-  var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done
-
-  // Verify that there is a useable event (so that ctrl-z won't
-  // needlessly clear selection events)
-  var i = 0
-  for (; i < source.length; i++) {
-    event = source[i]
-    if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
-      { break }
-  }
-  if (i == source.length) { return }
-  hist.lastOrigin = hist.lastSelOrigin = null
-
-  for (;;) {
-    event = source.pop()
-    if (event.ranges) {
-      pushSelectionToHistory(event, dest)
-      if (allowSelectionOnly && !event.equals(doc.sel)) {
-        setSelection(doc, event, {clearRedo: false})
-        return
-      }
-      selAfter = event
-    }
-    else { break }
-  }
-
-  // Build up a reverse change object to add to the opposite history
-  // stack (redo when undoing, and vice versa).
-  var antiChanges = []
-  pushSelectionToHistory(selAfter, dest)
-  dest.push({changes: antiChanges, generation: hist.generation})
-  hist.generation = event.generation || ++hist.maxGeneration
-
-  var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")
-
-  var loop = function ( i ) {
-    var change = event.changes[i]
-    change.origin = type
-    if (filter && !filterChange(doc, change, false)) {
-      source.length = 0
-      return {}
-    }
-
-    antiChanges.push(historyChangeFromChange(doc, change))
-
-    var after = i ? computeSelAfterChange(doc, change) : lst(source)
-    makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))
-    if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}) }
-    var rebased = []
-
-    // Propagate to the linked documents
-    linkedDocs(doc, function (doc, sharedHist) {
-      if (!sharedHist && indexOf(rebased, doc.history) == -1) {
-        rebaseHist(doc.history, change)
-        rebased.push(doc.history)
-      }
-      makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))
-    })
-  };
-
-  for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
-    var returned = loop( i$1 );
-
-    if ( returned ) return returned.v;
-  }
-}
-
-// Sub-views need their line numbers shifted when text is added
-// above or below them in the parent document.
-function shiftDoc(doc, distance) {
-  if (distance == 0) { return }
-  doc.first += distance
-  doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
-    Pos(range.anchor.line + distance, range.anchor.ch),
-    Pos(range.head.line + distance, range.head.ch)
-  ); }), doc.sel.primIndex)
-  if (doc.cm) {
-    regChange(doc.cm, doc.first, doc.first - distance, distance)
-    for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
-      { regLineChange(doc.cm, l, "gutter") }
-  }
-}
-
-// More lower-level change function, handling only a single document
-// (not linked ones).
-function makeChangeSingleDoc(doc, change, selAfter, spans) {
-  if (doc.cm && !doc.cm.curOp)
-    { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
-
-  if (change.to.line < doc.first) {
-    shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))
-    return
-  }
-  if (change.from.line > doc.lastLine()) { return }
-
-  // Clip the change to the size of this doc
-  if (change.from.line < doc.first) {
-    var shift = change.text.length - 1 - (doc.first - change.from.line)
-    shiftDoc(doc, shift)
-    change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
-              text: [lst(change.text)], origin: change.origin}
-  }
-  var last = doc.lastLine()
-  if (change.to.line > last) {
-    change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
-              text: [change.text[0]], origin: change.origin}
-  }
-
-  change.removed = getBetween(doc, change.from, change.to)
-
-  if (!selAfter) { selAfter = computeSelAfterChange(doc, change) }
-  if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) }
-  else { updateDoc(doc, change, spans) }
-  setSelectionNoUndo(doc, selAfter, sel_dontScroll)
-}
-
-// Handle the interaction of a change to a document with the editor
-// that this document is part of.
-function makeChangeSingleDocInEditor(cm, change, spans) {
-  var doc = cm.doc, display = cm.display, from = change.from, to = change.to
-
-  var recomputeMaxLength = false, checkWidthStart = from.line
-  if (!cm.options.lineWrapping) {
-    checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))
-    doc.iter(checkWidthStart, to.line + 1, function (line) {
-      if (line == display.maxLine) {
-        recomputeMaxLength = true
-        return true
-      }
-    })
-  }
-
-  if (doc.sel.contains(change.from, change.to) > -1)
-    { signalCursorActivity(cm) }
-
-  updateDoc(doc, change, spans, estimateHeight(cm))
-
-  if (!cm.options.lineWrapping) {
-    doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
-      var len = lineLength(line)
-      if (len > display.maxLineLength) {
-        display.maxLine = line
-        display.maxLineLength = len
-        display.maxLineChanged = true
-        recomputeMaxLength = false
-      }
-    })
-    if (recomputeMaxLength) { cm.curOp.updateMaxLine = true }
-  }
-
-  // Adjust frontier, schedule worker
-  doc.frontier = Math.min(doc.frontier, from.line)
-  startWorker(cm, 400)
-
-  var lendiff = change.text.length - (to.line - from.line) - 1
-  // Remember that these lines changed, for updating the display
-  if (change.full)
-    { regChange(cm) }
-  else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
-    { regLineChange(cm, from.line, "text") }
-  else
-    { regChange(cm, from.line, to.line + 1, lendiff) }
-
-  var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change")
-  if (changeHandler || changesHandler) {
-    var obj = {
-      from: from, to: to,
-      text: change.text,
-      removed: change.removed,
-      origin: change.origin
-    }
-    if (changeHandler) { signalLater(cm, "change", cm, obj) }
-    if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj) }
-  }
-  cm.display.selForContextMenu = null
-}
-
-function replaceRange(doc, code, from, to, origin) {
-  if (!to) { to = from }
-  if (cmp(to, from) < 0) { var tmp = to; to = from; from = tmp }
-  if (typeof code == "string") { code = doc.splitLines(code) }
-  makeChange(doc, {from: from, to: to, text: code, origin: origin})
-}
-
-// Rebasing/resetting history to deal with externally-sourced changes
-
-function rebaseHistSelSingle(pos, from, to, diff) {
-  if (to < pos.line) {
-    pos.line += diff
-  } else if (from < pos.line) {
-    pos.line = from
-    pos.ch = 0
-  }
-}
-
-// Tries to rebase an array of history events given a change in the
-// document. If the change touches the same lines as the event, the
-// event, and everything 'behind' it, is discarded. If the change is
-// before the event, the event's positions are updated. Uses a
-// copy-on-write scheme for the positions, to avoid having to
-// reallocate them all on every rebase, but also avoid problems with
-// shared position objects being unsafely updated.
-function rebaseHistArray(array, from, to, diff) {
-  for (var i = 0; i < array.length; ++i) {
-    var sub = array[i], ok = true
-    if (sub.ranges) {
-      if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }
-      for (var j = 0; j < sub.ranges.length; j++) {
-        rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)
-        rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)
-      }
-      continue
-    }
-    for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
-      var cur = sub.changes[j$1]
-      if (to < cur.from.line) {
-        cur.from = Pos(cur.from.line + diff, cur.from.ch)
-        cur.to = Pos(cur.to.line + diff, cur.to.ch)
-      } else if (from <= cur.to.line) {
-        ok = false
-        break
-      }
-    }
-    if (!ok) {
-      array.splice(0, i + 1)
-      i = 0
-    }
-  }
-}
-
-function rebaseHist(hist, change) {
-  var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1
-  rebaseHistArray(hist.done, from, to, diff)
-  rebaseHistArray(hist.undone, from, to, diff)
-}
-
-// Utility for applying a change to a line by handle or number,
-// returning the number and optionally registering the line as
-// changed.
-function changeLine(doc, handle, changeType, op) {
-  var no = handle, line = handle
-  if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)) }
-  else { no = lineNo(handle) }
-  if (no == null) { return null }
-  if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) }
-  return line
-}
-
-// The document is represented as a BTree consisting of leaves, with
-// chunk of lines in them, and branches, with up to ten leaves or
-// other branch nodes below them. The top node is always a branch
-// node, and is the document object itself (meaning it has
-// additional methods and properties).
-//
-// All nodes have parent links. The tree is used both to go from
-// line numbers to line objects, and to go from objects to numbers.
-// It also indexes by height, and is used to convert between height
-// and line object, and to find the total height of the document.
-//
-// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
-
-var LeafChunk = function(lines) {
-  var this$1 = this;
-
-  this.lines = lines
-  this.parent = null
-  var height = 0
-  for (var i = 0; i < lines.length; ++i) {
-    lines[i].parent = this$1
-    height += lines[i].height
-  }
-  this.height = height
-};
-
-LeafChunk.prototype.chunkSize = function () { return this.lines.length };
-
-// Remove the n lines at offset 'at'.
-LeafChunk.prototype.removeInner = function (at, n) {
-    var this$1 = this;
-
-  for (var i = at, e = at + n; i < e; ++i) {
-    var line = this$1.lines[i]
-    this$1.height -= line.height
-    cleanUpLine(line)
-    signalLater(line, "delete")
-  }
-  this.lines.splice(at, n)
-};
-
-// Helper used to collapse a small branch into a single leaf.
-LeafChunk.prototype.collapse = function (lines) {
-  lines.push.apply(lines, this.lines)
-};
-
-// Insert the given array of lines at offset 'at', count them as
-// having the given height.
-LeafChunk.prototype.insertInner = function (at, lines, height) {
-    var this$1 = this;
-
-  this.height += height
-  this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at))
-  for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1 }
-};
-
-// Used to iterate over a part of the tree.
-LeafChunk.prototype.iterN = function (at, n, op) {
-    var this$1 = this;
-
-  for (var e = at + n; at < e; ++at)
-    { if (op(this$1.lines[at])) { return true } }
-};
-
-var BranchChunk = function(children) {
-  var this$1 = this;
-
-  this.children = children
-  var size = 0, height = 0
-  for (var i = 0; i < children.length; ++i) {
-    var ch = children[i]
-    size += ch.chunkSize(); height += ch.height
-    ch.parent = this$1
-  }
-  this.size = size
-  this.height = height
-  this.parent = null
-};
-
-BranchChunk.prototype.chunkSize = function () { return this.size };
-
-BranchChunk.prototype.removeInner = function (at, n) {
-    var this$1 = this;
-
-  this.size -= n
-  for (var i = 0; i < this.children.length; ++i) {
-    var child = this$1.children[i], sz = child.chunkSize()
-    if (at < sz) {
-      var rm = Math.min(n, sz - at), oldHeight = child.height
-      child.removeInner(at, rm)
-      this$1.height -= oldHeight - child.height
-      if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null }
-      if ((n -= rm) == 0) { break }
-      at = 0
-    } else { at -= sz }
-  }
-  // If the result is smaller than 25 lines, ensure that it is a
-  // single leaf node.
-  if (this.size - n < 25 &&
-      (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
-    var lines = []
-    this.collapse(lines)
-    this.children = [new LeafChunk(lines)]
-    this.children[0].parent = this
-  }
-};
-
-BranchChunk.prototype.collapse = function (lines) {
-    var this$1 = this;
-
-  for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines) }
-};
-
-BranchChunk.prototype.insertInner = function (at, lines, height) {
-    var this$1 = this;
-
-  this.size += lines.length
-  this.height += height
-  for (var i = 0; i < this.children.length; ++i) {
-    var child = this$1.children[i], sz = child.chunkSize()
-    if (at <= sz) {
-      child.insertInner(at, lines, height)
-      if (child.lines && child.lines.length > 50) {
-        // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
-        // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
-        var remaining = child.lines.length % 25 + 25
-        for (var pos = remaining; pos < child.lines.length;) {
-          var leaf = new LeafChunk(child.lines.slice(pos, pos += 25))
-          child.height -= leaf.height
-          this$1.children.splice(++i, 0, leaf)
-          leaf.parent = this$1
-        }
-        child.lines = child.lines.slice(0, remaining)
-        this$1.maybeSpill()
-      }
-      break
-    }
-    at -= sz
-  }
-};
-
-// When a node has grown, check whether it should be split.
-BranchChunk.prototype.maybeSpill = function () {
-  if (this.children.length <= 10) { return }
-  var me = this
-  do {
-    var spilled = me.children.splice(me.children.length - 5, 5)
-    var sibling = new BranchChunk(spilled)
-    if (!me.parent) { // Become the parent node
-      var copy = new BranchChunk(me.children)
-      copy.parent = me
-      me.children = [copy, sibling]
-      me = copy
-   } else {
-      me.size -= sibling.size
-      me.height -= sibling.height
-      var myIndex = indexOf(me.parent.children, me)
-      me.parent.children.splice(myIndex + 1, 0, sibling)
-    }
-    sibling.parent = me.parent
-  } while (me.children.length > 10)
-  me.parent.maybeSpill()
-};
-
-BranchChunk.prototype.iterN = function (at, n, op) {
-    var this$1 = this;
-
-  for (var i = 0; i < this.children.length; ++i) {
-    var child = this$1.children[i], sz = child.chunkSize()
-    if (at < sz) {
-      var used = Math.min(n, sz - at)
-      if (child.iterN(at, used, op)) { return true }
-      if ((n -= used) == 0) { break }
-      at = 0
-    } else { at -= sz }
-  }
-};
-
-// Line widgets are block elements displayed above or below a line.
-
-var LineWidget = function(doc, node, options) {
-  var this$1 = this;
-
-  if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
-    { this$1[opt] = options[opt] } } }
-  this.doc = doc
-  this.node = node
-};
-
-LineWidget.prototype.clear = function () {
-    var this$1 = this;
-
-  var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line)
-  if (no == null || !ws) { return }
-  for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1) } }
-  if (!ws.length) { line.widgets = null }
-  var height = widgetHeight(this)
-  updateLineHeight(line, Math.max(0, line.height - height))
-  if (cm) {
-    runInOp(cm, function () {
-      adjustScrollWhenAboveVisible(cm, line, -height)
-      regLineChange(cm, no, "widget")
-    })
-    signalLater(cm, "lineWidgetCleared", cm, this, no)
-  }
-};
-
-LineWidget.prototype.changed = function () {
-    var this$1 = this;
-
-  var oldH = this.height, cm = this.doc.cm, line = this.line
-  this.height = null
-  var diff = widgetHeight(this) - oldH
-  if (!diff) { return }
-  updateLineHeight(line, line.height + diff)
-  if (cm) {
-    runInOp(cm, function () {
-      cm.curOp.forceUpdate = true
-      adjustScrollWhenAboveVisible(cm, line, diff)
-      signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line))
-    })
-  }
-};
-eventMixin(LineWidget)
-
-function adjustScrollWhenAboveVisible(cm, line, diff) {
-  if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
-    { addToScrollPos(cm, null, diff) }
-}
-
-function addLineWidget(doc, handle, node, options) {
-  var widget = new LineWidget(doc, node, options)
-  var cm = doc.cm
-  if (cm && widget.noHScroll) { cm.display.alignWidgets = true }
-  changeLine(doc, handle, "widget", function (line) {
-    var widgets = line.widgets || (line.widgets = [])
-    if (widget.insertAt == null) { widgets.push(widget) }
-    else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget) }
-    widget.line = line
-    if (cm && !lineIsHidden(doc, line)) {
-      var aboveVisible = heightAtLine(line) < doc.scrollTop
-      updateLineHeight(line, line.height + widgetHeight(widget))
-      if (aboveVisible) { addToScrollPos(cm, null, widget.height) }
-      cm.curOp.forceUpdate = true
-    }
-    return true
-  })
-  signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
-  return widget
-}
-
-// TEXTMARKERS
-
-// Created with markText and setBookmark methods. A TextMarker is a
-// handle that can be used to clear or find a marked position in the
-// document. Line objects hold arrays (markedSpans) containing
-// {from, to, marker} object pointing to such marker objects, and
-// indicating that such a marker is present on that line. Multiple
-// lines may point to the same marker when it spans across lines.
-// The spans will have null for their from/to properties when the
-// marker continues beyond the start/end of the line. Markers have
-// links back to the lines they currently touch.
-
-// Collapsed markers have unique ids, in order to be able to order
-// them, which is needed for uniquely determining an outer marker
-// when they overlap (they may nest, but not partially overlap).
-var nextMarkerId = 0
-
-var TextMarker = function(doc, type) {
-  this.lines = []
-  this.type = type
-  this.doc = doc
-  this.id = ++nextMarkerId
-};
-
-// Clear the marker.
-TextMarker.prototype.clear = function () {
-    var this$1 = this;
-
-  if (this.explicitlyCleared) { return }
-  var cm = this.doc.cm, withOp = cm && !cm.curOp
-  if (withOp) { startOperation(cm) }
-  if (hasHandler(this, "clear")) {
-    var found = this.find()
-    if (found) { signalLater(this, "clear", found.from, found.to) }
-  }
-  var min = null, max = null
-  for (var i = 0; i < this.lines.length; ++i) {
-    var line = this$1.lines[i]
-    var span = getMarkedSpanFor(line.markedSpans, this$1)
-    if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text") }
-    else if (cm) {
-      if (span.to != null) { max = lineNo(line) }
-      if (span.from != null) { min = lineNo(line) }
-    }
-    line.markedSpans = removeMarkedSpan(line.markedSpans, span)
-    if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
-      { updateLineHeight(line, textHeight(cm.display)) }
-  }
-  if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
-    var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual)
-    if (len > cm.display.maxLineLength) {
-      cm.display.maxLine = visual
-      cm.display.maxLineLength = len
-      cm.display.maxLineChanged = true
-    }
-  } }
-
-  if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1) }
-  this.lines.length = 0
-  this.explicitlyCleared = true
-  if (this.atomic && this.doc.cantEdit) {
-    this.doc.cantEdit = false
-    if (cm) { reCheckSelection(cm.doc) }
-  }
-  if (cm) { signalLater(cm, "markerCleared", cm, this, min, max) }
-  if (withOp) { endOperation(cm) }
-  if (this.parent) { this.parent.clear() }
-};
-
-// Find the position of the marker in the document. Returns a {from,
-// to} object by default. Side can be passed to get a specific side
-// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
-// Pos objects returned contain a line object, rather than a line
-// number (used to prevent looking up the same line twice).
-TextMarker.prototype.find = function (side, lineObj) {
-    var this$1 = this;
-
-  if (side == null && this.type == "bookmark") { side = 1 }
-  var from, to
-  for (var i = 0; i < this.lines.length; ++i) {
-    var line = this$1.lines[i]
-    var span = getMarkedSpanFor(line.markedSpans, this$1)
-    if (span.from != null) {
-      from = Pos(lineObj ? line : lineNo(line), span.from)
-      if (side == -1) { return from }
-    }
-    if (span.to != null) {
-      to = Pos(lineObj ? line : lineNo(line), span.to)
-      if (side == 1) { return to }
-    }
-  }
-  return from && {from: from, to: to}
-};
-
-// Signals that the marker's widget changed, and surrounding layout
-// should be recomputed.
-TextMarker.prototype.changed = function () {
-    var this$1 = this;
-
-  var pos = this.find(-1, true), widget = this, cm = this.doc.cm
-  if (!pos || !cm) { return }
-  runInOp(cm, function () {
-    var line = pos.line, lineN = lineNo(pos.line)
-    var view = findViewForLine(cm, lineN)
-    if (view) {
-      clearLineMeasurementCacheFor(view)
-      cm.curOp.selectionChanged = cm.curOp.forceUpdate = true
-    }
-    cm.curOp.updateMaxLine = true
-    if (!lineIsHidden(widget.doc, line) && widget.height != null) {
-      var oldHeight = widget.height
-      widget.height = null
-      var dHeight = widgetHeight(widget) - oldHeight
-      if (dHeight)
-        { updateLineHeight(line, line.height + dHeight) }
-    }
-    signalLater(cm, "markerChanged", cm, this$1)
-  })
-};
-
-TextMarker.prototype.attachLine = function (line) {
-  if (!this.lines.length && this.doc.cm) {
-    var op = this.doc.cm.curOp
-    if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
-      { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) }
-  }
-  this.lines.push(line)
-};
-
-TextMarker.prototype.detachLine = function (line) {
-  this.lines.splice(indexOf(this.lines, line), 1)
-  if (!this.lines.length && this.doc.cm) {
-    var op = this.doc.cm.curOp
-    ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this)
-  }
-};
-eventMixin(TextMarker)
-
-// Create a marker, wire it up to the right lines, and
-function markText(doc, from, to, options, type) {
-  // Shared markers (across linked documents) are handled separately
-  // (markTextShared will call out to this again, once per
-  // document).
-  if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
-  // Ensure we are in an operation.
-  if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
-
-  var marker = new TextMarker(doc, type), diff = cmp(from, to)
-  if (options) { copyObj(options, marker, false) }
-  // Don't connect empty markers unless clearWhenEmpty is false
-  if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
-    { return marker }
-  if (marker.replacedWith) {
-    // Showing up as a widget implies collapsed (widget replaces text)
-    marker.collapsed = true
-    marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget")
-    if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true") }
-    if (options.insertLeft) { marker.widgetNode.insertLeft = true }
-  }
-  if (marker.collapsed) {
-    if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
-        from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
-      { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
-    seeCollapsedSpans()
-  }
-
-  if (marker.addToHistory)
-    { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) }
-
-  var curLine = from.line, cm = doc.cm, updateMaxLine
-  doc.iter(curLine, to.line + 1, function (line) {
-    if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
-      { updateMaxLine = true }
-    if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0) }
-    addMarkedSpan(line, new MarkedSpan(marker,
-                                       curLine == from.line ? from.ch : null,
-                                       curLine == to.line ? to.ch : null))
-    ++curLine
-  })
-  // lineIsHidden depends on the presence of the spans, so needs a second pass
-  if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
-    if (lineIsHidden(doc, line)) { updateLineHeight(line, 0) }
-  }) }
-
-  if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) }
-
-  if (marker.readOnly) {
-    seeReadOnlySpans()
-    if (doc.history.done.length || doc.history.undone.length)
-      { doc.clearHistory() }
-  }
-  if (marker.collapsed) {
-    marker.id = ++nextMarkerId
-    marker.atomic = true
-  }
-  if (cm) {
-    // Sync editor state
-    if (updateMaxLine) { cm.curOp.updateMaxLine = true }
-    if (marker.collapsed)
-      { regChange(cm, from.line, to.line + 1) }
-    else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
-      { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text") } }
-    if (marker.atomic) { reCheckSelection(cm.doc) }
-    signalLater(cm, "markerAdded", cm, marker)
-  }
-  return marker
-}
-
-// SHARED TEXTMARKERS
-
-// A shared marker spans multiple linked documents. It is
-// implemented as a meta-marker-object controlling multiple normal
-// markers.
-var SharedTextMarker = function(markers, primary) {
-  var this$1 = this;
-
-  this.markers = markers
-  this.primary = primary
-  for (var i = 0; i < markers.length; ++i)
-    { markers[i].parent = this$1 }
-};
-
-SharedTextMarker.prototype.clear = function () {
-    var this$1 = this;
-
-  if (this.explicitlyCleared) { return }
-  this.explicitlyCleared = true
-  for (var i = 0; i < this.markers.length; ++i)
-    { this$1.markers[i].clear() }
-  signalLater(this, "clear")
-};
-
-SharedTextMarker.prototype.find = function (side, lineObj) {
-  return this.primary.find(side, lineObj)
-};
-eventMixin(SharedTextMarker)
-
-function markTextShared(doc, from, to, options, type) {
-  options = copyObj(options)
-  options.shared = false
-  var markers = [markText(doc, from, to, options, type)], primary = markers[0]
-  var widget = options.widgetNode
-  linkedDocs(doc, function (doc) {
-    if (widget) { options.widgetNode = widget.cloneNode(true) }
-    markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type))
-    for (var i = 0; i < doc.linked.length; ++i)
-      { if (doc.linked[i].isParent) { return } }
-    primary = lst(markers)
-  })
-  return new SharedTextMarker(markers, primary)
-}
-
-function findSharedMarkers(doc) {
-  return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
-}
-
-function copySharedMarkers(doc, markers) {
-  for (var i = 0; i < markers.length; i++) {
-    var marker = markers[i], pos = marker.find()
-    var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to)
-    if (cmp(mFrom, mTo)) {
-      var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type)
-      marker.markers.push(subMark)
-      subMark.parent = marker
-    }
-  }
-}
-
-function detachSharedMarkers(markers) {
-  var loop = function ( i ) {
-    var marker = markers[i], linked = [marker.primary.doc]
-    linkedDocs(marker.primary.doc, function (d) { return linked.push(d); })
-    for (var j = 0; j < marker.markers.length; j++) {
-      var subMarker = marker.markers[j]
-      if (indexOf(linked, subMarker.doc) == -1) {
-        subMarker.parent = null
-        marker.markers.splice(j--, 1)
-      }
-    }
-  };
-
-  for (var i = 0; i < markers.length; i++) loop( i );
-}
-
-var nextDocId = 0
-var Doc = function(text, mode, firstLine, lineSep, direction) {
-  if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
-  if (firstLine == null) { firstLine = 0 }
-
-  BranchChunk.call(this, [new LeafChunk([new Line("", null)])])
-  this.first = firstLine
-  this.scrollTop = this.scrollLeft = 0
-  this.cantEdit = false
-  this.cleanGeneration = 1
-  this.frontier = firstLine
-  var start = Pos(firstLine, 0)
-  this.sel = simpleSelection(start)
-  this.history = new History(null)
-  this.id = ++nextDocId
-  this.modeOption = mode
-  this.lineSep = lineSep
-  this.direction = (direction == "rtl") ? "rtl" : "ltr"
-  this.extend = false
-
-  if (typeof text == "string") { text = this.splitLines(text) }
-  updateDoc(this, {from: start, to: start, text: text})
-  setSelection(this, simpleSelection(start), sel_dontScroll)
-}
-
-Doc.prototype = createObj(BranchChunk.prototype, {
-  constructor: Doc,
-  // Iterate over the document. Supports two forms -- with only one
-  // argument, it calls that for each line in the document. With
-  // three, it iterates over the range given by the first two (with
-  // the second being non-inclusive).
-  iter: function(from, to, op) {
-    if (op) { this.iterN(from - this.first, to - from, op) }
-    else { this.iterN(this.first, this.first + this.size, from) }
-  },
-
-  // Non-public interface for adding and removing lines.
-  insert: function(at, lines) {
-    var height = 0
-    for (var i = 0; i < lines.length; ++i) { height += lines[i].height }
-    this.insertInner(at - this.first, lines, height)
-  },
-  remove: function(at, n) { this.removeInner(at - this.first, n) },
-
-  // From here, the methods are part of the public interface. Most
-  // are also available from CodeMirror (editor) instances.
-
-  getValue: function(lineSep) {
-    var lines = getLines(this, this.first, this.first + this.size)
-    if (lineSep === false) { return lines }
-    return lines.join(lineSep || this.lineSeparator())
-  },
-  setValue: docMethodOp(function(code) {
-    var top = Pos(this.first, 0), last = this.first + this.size - 1
-    makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
-                      text: this.splitLines(code), origin: "setValue", full: true}, true)
-    if (this.cm) { this.cm.scrollTo(0, 0) }
-    setSelection(this, simpleSelection(top), sel_dontScroll)
-  }),
-  replaceRange: function(code, from, to, origin) {
-    from = clipPos(this, from)
-    to = to ? clipPos(this, to) : from
-    replaceRange(this, code, from, to, origin)
-  },
-  getRange: function(from, to, lineSep) {
-    var lines = getBetween(this, clipPos(this, from), clipPos(this, to))
-    if (lineSep === false) { return lines }
-    return lines.join(lineSep || this.lineSeparator())
-  },
-
-  getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
-
-  getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
-  getLineNumber: function(line) {return lineNo(line)},
-
-  getLineHandleVisualStart: function(line) {
-    if (typeof line == "number") { line = getLine(this, line) }
-    return visualLine(line)
-  },
-
-  lineCount: function() {return this.size},
-  firstLine: function() {return this.first},
-  lastLine: function() {return this.first + this.size - 1},
-
-  clipPos: function(pos) {return clipPos(this, pos)},
-
-  getCursor: function(start) {
-    var range = this.sel.primary(), pos
-    if (start == null || start == "head") { pos = range.head }
-    else if (start == "anchor") { pos = range.anchor }
-    else if (start == "end" || start == "to" || start === false) { pos = range.to() }
-    else { pos = range.from() }
-    return pos
-  },
-  listSelections: function() { return this.sel.ranges },
-  somethingSelected: function() {return this.sel.somethingSelected()},
-
-  setCursor: docMethodOp(function(line, ch, options) {
-    setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options)
-  }),
-  setSelection: docMethodOp(function(anchor, head, options) {
-    setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options)
-  }),
-  extendSelection: docMethodOp(function(head, other, options) {
-    extendSelection(this, clipPos(this, head), other && clipPos(this, other), options)
-  }),
-  extendSelections: docMethodOp(function(heads, options) {
-    extendSelections(this, clipPosArray(this, heads), options)
-  }),
-  extendSelectionsBy: docMethodOp(function(f, options) {
-    var heads = map(this.sel.ranges, f)
-    extendSelections(this, clipPosArray(this, heads), options)
-  }),
-  setSelections: docMethodOp(function(ranges, primary, options) {
-    var this$1 = this;
-
-    if (!ranges.length) { return }
-    var out = []
-    for (var i = 0; i < ranges.length; i++)
-      { out[i] = new Range(clipPos(this$1, ranges[i].anchor),
-                         clipPos(this$1, ranges[i].head)) }
-    if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex) }
-    setSelection(this, normalizeSelection(out, primary), options)
-  }),
-  addSelection: docMethodOp(function(anchor, head, options) {
-    var ranges = this.sel.ranges.slice(0)
-    ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)))
-    setSelection(this, normalizeSelection(ranges, ranges.length - 1), options)
-  }),
-
-  getSelection: function(lineSep) {
-    var this$1 = this;
-
-    var ranges = this.sel.ranges, lines
-    for (var i = 0; i < ranges.length; i++) {
-      var sel = getBetween(this$1, ranges[i].from(), ranges[i].to())
-      lines = lines ? lines.concat(sel) : sel
-    }
-    if (lineSep === false) { return lines }
-    else { return lines.join(lineSep || this.lineSeparator()) }
-  },
-  getSelections: function(lineSep) {
-    var this$1 = this;
-
-    var parts = [], ranges = this.sel.ranges
-    for (var i = 0; i < ranges.length; i++) {
-      var sel = getBetween(this$1, ranges[i].from(), ranges[i].to())
-      if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()) }
-      parts[i] = sel
-    }
-    return parts
-  },
-  replaceSelection: function(code, collapse, origin) {
-    var dup = []
-    for (var i = 0; i < this.sel.ranges.length; i++)
-      { dup[i] = code }
-    this.replaceSelections(dup, collapse, origin || "+input")
-  },
-  replaceSelections: docMethodOp(function(code, collapse, origin) {
-    var this$1 = this;
-
-    var changes = [], sel = this.sel
-    for (var i = 0; i < sel.ranges.length; i++) {
-      var range = sel.ranges[i]
-      changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin}
-    }
-    var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse)
-    for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
-      { makeChange(this$1, changes[i$1]) }
-    if (newSel) { setSelectionReplaceHistory(this, newSel) }
-    else if (this.cm) { ensureCursorVisible(this.cm) }
-  }),
-  undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}),
-  redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}),
-  undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}),
-  redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}),
-
-  setExtending: function(val) {this.extend = val},
-  getExtending: function() {return this.extend},
-
-  historySize: function() {
-    var hist = this.history, done = 0, undone = 0
-    for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done } }
-    for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone } }
-    return {undo: done, redo: undone}
-  },
-  clearHistory: function() {this.history = new History(this.history.maxGeneration)},
-
-  markClean: function() {
-    this.cleanGeneration = this.changeGeneration(true)
-  },
-  changeGeneration: function(forceSplit) {
-    if (forceSplit)
-      { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null }
-    return this.history.generation
-  },
-  isClean: function (gen) {
-    return this.history.generation == (gen || this.cleanGeneration)
-  },
-
-  getHistory: function() {
-    return {done: copyHistoryArray(this.history.done),
-            undone: copyHistoryArray(this.history.undone)}
-  },
-  setHistory: function(histData) {
-    var hist = this.history = new History(this.history.maxGeneration)
-    hist.done = copyHistoryArray(histData.done.slice(0), null, true)
-    hist.undone = copyHistoryArray(histData.undone.slice(0), null, true)
-  },
-
-  setGutterMarker: docMethodOp(function(line, gutterID, value) {
-    return changeLine(this, line, "gutter", function (line) {
-      var markers = line.gutterMarkers || (line.gutterMarkers = {})
-      markers[gutterID] = value
-      if (!value && isEmpty(markers)) { line.gutterMarkers = null }
-      return true
-    })
-  }),
-
-  clearGutter: docMethodOp(function(gutterID) {
-    var this$1 = this;
-
-    this.iter(function (line) {
-      if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
-        changeLine(this$1, line, "gutter", function () {
-          line.gutterMarkers[gutterID] = null
-          if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null }
-          return true
-        })