Web development server initial prototype.
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/launcher/nb-configuration.xml Tue Jan 15 15:56:45 2013 +0100
1.3 @@ -0,0 +1,18 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<project-shared-configuration>
1.6 + <!--
1.7 +This file contains additional configuration written by modules in the NetBeans IDE.
1.8 +The configuration is intended to be shared among all the users of project and
1.9 +therefore it is assumed to be part of version control checkout.
1.10 +Without this configuration present, some functionality in the IDE may be limited or fail altogether.
1.11 +-->
1.12 + <properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
1.13 + <!--
1.14 +Properties that influence various parts of the IDE, especially code formatting and the like.
1.15 +You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
1.16 +That way multiple projects can share the same settings (useful for formatting rules for example).
1.17 +Any value defined here will override the pom.xml file value but is only applicable to the current project.
1.18 +-->
1.19 + <netbeans.compile.on.save>app</netbeans.compile.on.save>
1.20 + </properties>
1.21 +</project-shared-configuration>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/launcher/src/main/java/org/apidesign/bck2brwsr/dew/Dew.java Tue Jan 15 15:56:45 2013 +0100
2.3 @@ -0,0 +1,52 @@
2.4 +/*
2.5 + * To change this template, choose Tools | Templates
2.6 + * and open the template in the editor.
2.7 + */
2.8 +package org.apidesign.bck2brwsr.dew;
2.9 +
2.10 +import java.io.IOException;
2.11 +import java.io.InputStream;
2.12 +import java.io.OutputStream;
2.13 +import org.glassfish.grizzly.http.server.HttpHandler;
2.14 +import org.glassfish.grizzly.http.server.Request;
2.15 +import org.glassfish.grizzly.http.server.Response;
2.16 +
2.17 +/**
2.18 + *
2.19 + * @author phrebejk
2.20 + */
2.21 +public class Dew extends HttpHandler {
2.22 +
2.23 + @Override
2.24 + public void service(Request request, Response response) throws Exception {
2.25 + String r = request.getHttpHandlerPath();
2.26 + if (r == null || r.equals("/")) {
2.27 + r = "index.html";
2.28 + }
2.29 + if (r.startsWith("/")) {
2.30 + r = r.substring(1);
2.31 + }
2.32 + if (r.endsWith(".html") || r.endsWith(".xhtml")) {
2.33 + response.setContentType("text/html");
2.34 + }
2.35 + OutputStream os = response.getOutputStream();
2.36 + try (InputStream is = Dew.class.getResourceAsStream(r) ) {
2.37 + copyStream(is, os, request.getRequestURL().toString() );
2.38 + } catch (IOException ex) {
2.39 + response.setDetailMessage(ex.getLocalizedMessage());
2.40 + response.setError();
2.41 + response.setStatus(404);
2.42 + }
2.43 + }
2.44 +
2.45 + static void copyStream(InputStream is, OutputStream os, String baseURL) throws IOException {
2.46 + for (;;) {
2.47 + int ch = is.read();
2.48 + if (ch == -1) {
2.49 + break;
2.50 + }
2.51 + os.write(ch);
2.52 + }
2.53 + }
2.54 +
2.55 +}
3.1 --- a/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Tue Jan 08 16:32:11 2013 +0100
3.2 +++ b/launcher/src/main/java/org/apidesign/bck2brwsr/launcher/Bck2BrwsrLauncher.java Tue Jan 15 15:56:45 2013 +0100
3.3 @@ -39,6 +39,7 @@
3.4 import java.util.concurrent.TimeUnit;
3.5 import java.util.logging.Level;
3.6 import java.util.logging.Logger;
3.7 +import org.apidesign.bck2brwsr.dew.Dew;
3.8 import org.apidesign.vm4brwsr.Bck2Brwsr;
3.9 import org.glassfish.grizzly.PortRange;
3.10 import org.glassfish.grizzly.http.server.HttpHandler;
3.11 @@ -102,6 +103,14 @@
3.12 throw new IOException(ex);
3.13 }
3.14 }
3.15 +
3.16 + public static void main(String... args) throws Exception {
3.17 + Bck2BrwsrLauncher l = new Bck2BrwsrLauncher(null);
3.18 + HttpServer s = l.initServer();
3.19 + s.getServerConfiguration().addHttpHandler(new Dew(), "/dew/");
3.20 + l.launchServerAndBrwsr(s, "/dew/");
3.21 + System.in.read();
3.22 + }
3.23
3.24 @Override
3.25 public void initialize() throws IOException {
3.26 @@ -130,6 +139,7 @@
3.27 "org/apidesign/bck2brwsr/launcher/console.xhtml",
3.28 "org.apidesign.bck2brwsr.launcher.Console", "welcome", "false"
3.29 ), "/console");
3.30 + conf.addHttpHandler(new Dew(), "/dew/");
3.31 conf.addHttpHandler(new VM(resources), "/bck2brwsr.js");
3.32 conf.addHttpHandler(new VMInit(), "/vm.js");
3.33 conf.addHttpHandler(new Classes(resources), "/classes/");
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/css/app.css Tue Jan 15 15:56:45 2013 +0100
4.3 @@ -0,0 +1,36 @@
4.4 +/* app css stylesheet */
4.5 +.code-editor, .mono-font, .CodeMirror {
4.6 + font-family: "Inconsolata","Monaco","Consolas","Andale Mono","Bitstream Vera Sans Mono","Courier New",Courier,monospace;
4.7 + font-size: 13px;
4.8 + line-height: 15px;
4.9 +}
4.10 +
4.11 +.CodeMirror {
4.12 + border: 1px solid #d9edf7;
4.13 + height: 300px;
4.14 +}
4.15 +
4.16 +.CodeMirror-scroll {
4.17 + overflow-y: auto;
4.18 + overflow-x: auto;
4.19 +}
4.20 +
4.21 +.ic-html5 {
4.22 + display: inline-block;
4.23 + height: 20px;
4.24 + width: 20px;
4.25 + vertical-align: text-bottom;
4.26 + background-repeat: no-repeat;
4.27 + background-image: url("../img/html5.png");
4.28 +}
4.29 +
4.30 +.ic-java {
4.31 + display: inline-block;
4.32 + height: 20px;
4.33 + width: 20px;
4.34 + vertical-align: text-bottom;
4.35 + background-repeat: no-repeat;
4.36 + background-image: url("../img/java.png");
4.37 +
4.38 +}
4.39 +
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/css/bootstrap-combined.min.css Tue Jan 15 15:56:45 2013 +0100
5.3 @@ -0,0 +1,18 @@
5.4 +/*!
5.5 + * Bootstrap v2.2.2
5.6 + *
5.7 + * Copyright 2012 Twitter, Inc
5.8 + * Licensed under the Apache License v2.0
5.9 + * http://www.apache.org/licenses/LICENSE-2.0
5.10 + *
5.11 + * Designed and built with all the love in the world @twitter by @mdo and @fat.
5.12 + */article,aside,details,figcaption,figure,footer,header,hgroup,nav,section{display:block}audio,canvas,video{display:inline-block;*display:inline;*zoom:1}audio:not([controls]){display:none}html{font-size:100%;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}a:hover,a:active{outline:0}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{width:auto\9;height:auto;max-width:100%;vertical-align:middle;border:0;-ms-interpolation-mode:bicubic}#map_canvas img,.google-maps img{max-width:none}button,input,select,textarea{margin:0;font-size:100%;vertical-align:middle}button,input{*overflow:visible;line-height:normal}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}label,select,button,input[type="button"],input[type="reset"],input[type="submit"],input[type="radio"],input[type="checkbox"]{cursor:pointer}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-decoration,input[type="search"]::-webkit-search-cancel-button{-webkit-appearance:none}textarea{overflow:auto;vertical-align:top}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:.5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}body{margin:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;color:#333;background-color:#fff}a{color:#08c;text-decoration:none}a:hover{color:#005580;text-decoration:underline}.img-rounded{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.img-polaroid{padding:4px;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.1);box-shadow:0 1px 3px rgba(0,0,0,0.1)}.img-circle{-webkit-border-radius:500px;-moz-border-radius:500px;border-radius:500px}.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.span12{width:940px}.span11{width:860px}.span10{width:780px}.span9{width:700px}.span8{width:620px}.span7{width:540px}.span6{width:460px}.span5{width:380px}.span4{width:300px}.span3{width:220px}.span2{width:140px}.span1{width:60px}.offset12{margin-left:980px}.offset11{margin-left:900px}.offset10{margin-left:820px}.offset9{margin-left:740px}.offset8{margin-left:660px}.offset7{margin-left:580px}.offset6{margin-left:500px}.offset5{margin-left:420px}.offset4{margin-left:340px}.offset3{margin-left:260px}.offset2{margin-left:180px}.offset1{margin-left:100px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.127659574468085%;*margin-left:2.074468085106383%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.127659574468085%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.48936170212765%;*width:91.43617021276594%}.row-fluid .span10{width:82.97872340425532%;*width:82.92553191489361%}.row-fluid .span9{width:74.46808510638297%;*width:74.41489361702126%}.row-fluid .span8{width:65.95744680851064%;*width:65.90425531914893%}.row-fluid .span7{width:57.44680851063829%;*width:57.39361702127659%}.row-fluid .span6{width:48.93617021276595%;*width:48.88297872340425%}.row-fluid .span5{width:40.42553191489362%;*width:40.37234042553192%}.row-fluid .span4{width:31.914893617021278%;*width:31.861702127659576%}.row-fluid .span3{width:23.404255319148934%;*width:23.351063829787233%}.row-fluid .span2{width:14.893617021276595%;*width:14.840425531914894%}.row-fluid .span1{width:6.382978723404255%;*width:6.329787234042553%}.row-fluid .offset12{margin-left:104.25531914893617%;*margin-left:104.14893617021275%}.row-fluid .offset12:first-child{margin-left:102.12765957446808%;*margin-left:102.02127659574467%}.row-fluid .offset11{margin-left:95.74468085106382%;*margin-left:95.6382978723404%}.row-fluid .offset11:first-child{margin-left:93.61702127659574%;*margin-left:93.51063829787232%}.row-fluid .offset10{margin-left:87.23404255319149%;*margin-left:87.12765957446807%}.row-fluid .offset10:first-child{margin-left:85.1063829787234%;*margin-left:84.99999999999999%}.row-fluid .offset9{margin-left:78.72340425531914%;*margin-left:78.61702127659572%}.row-fluid .offset9:first-child{margin-left:76.59574468085106%;*margin-left:76.48936170212764%}.row-fluid .offset8{margin-left:70.2127659574468%;*margin-left:70.10638297872339%}.row-fluid .offset8:first-child{margin-left:68.08510638297872%;*margin-left:67.9787234042553%}.row-fluid .offset7{margin-left:61.70212765957446%;*margin-left:61.59574468085106%}.row-fluid .offset7:first-child{margin-left:59.574468085106375%;*margin-left:59.46808510638297%}.row-fluid .offset6{margin-left:53.191489361702125%;*margin-left:53.085106382978715%}.row-fluid .offset6:first-child{margin-left:51.063829787234035%;*margin-left:50.95744680851063%}.row-fluid .offset5{margin-left:44.68085106382979%;*margin-left:44.57446808510638%}.row-fluid .offset5:first-child{margin-left:42.5531914893617%;*margin-left:42.4468085106383%}.row-fluid .offset4{margin-left:36.170212765957444%;*margin-left:36.06382978723405%}.row-fluid .offset4:first-child{margin-left:34.04255319148936%;*margin-left:33.93617021276596%}.row-fluid .offset3{margin-left:27.659574468085104%;*margin-left:27.5531914893617%}.row-fluid .offset3:first-child{margin-left:25.53191489361702%;*margin-left:25.425531914893618%}.row-fluid .offset2{margin-left:19.148936170212764%;*margin-left:19.04255319148936%}.row-fluid .offset2:first-child{margin-left:17.02127659574468%;*margin-left:16.914893617021278%}.row-fluid .offset1{margin-left:10.638297872340425%;*margin-left:10.53191489361702%}.row-fluid .offset1:first-child{margin-left:8.51063829787234%;*margin-left:8.404255319148938%}[class*="span"].hide,.row-fluid [class*="span"].hide{display:none}[class*="span"].pull-right,.row-fluid [class*="span"].pull-right{float:right}.container{margin-right:auto;margin-left:auto;*zoom:1}.container:before,.container:after{display:table;line-height:0;content:""}.container:after{clear:both}.container-fluid{padding-right:20px;padding-left:20px;*zoom:1}.container-fluid:before,.container-fluid:after{display:table;line-height:0;content:""}.container-fluid:after{clear:both}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:21px;font-weight:200;line-height:30px}small{font-size:85%}strong{font-weight:bold}em{font-style:italic}cite{font-style:normal}.muted{color:#999}a.muted:hover{color:#808080}.text-warning{color:#c09853}a.text-warning:hover{color:#a47e3c}.text-error{color:#b94a48}a.text-error:hover{color:#953b39}.text-info{color:#3a87ad}a.text-info:hover{color:#2d6987}.text-success{color:#468847}a.text-success:hover{color:#356635}h1,h2,h3,h4,h5,h6{margin:10px 0;font-family:inherit;font-weight:bold;line-height:20px;color:inherit;text-rendering:optimizelegibility}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{line-height:40px}h1{font-size:38.5px}h2{font-size:31.5px}h3{font-size:24.5px}h4{font-size:17.5px}h5{font-size:14px}h6{font-size:11.9px}h1 small{font-size:24.5px}h2 small{font-size:17.5px}h3 small{font-size:14px}h4 small{font-size:14px}.page-header{padding-bottom:9px;margin:20px 0 30px;border-bottom:1px solid #eee}ul,ol{padding:0;margin:0 0 10px 25px}ul ul,ul ol,ol ol,ol ul{margin-bottom:0}li{line-height:20px}ul.unstyled,ol.unstyled{margin-left:0;list-style:none}ul.inline,ol.inline{margin-left:0;list-style:none}ul.inline>li,ol.inline>li{display:inline-block;padding-right:5px;padding-left:5px}dl{margin-bottom:20px}dt,dd{line-height:20px}dt{font-weight:bold}dd{margin-left:10px}.dl-horizontal{*zoom:1}.dl-horizontal:before,.dl-horizontal:after{display:table;line-height:0;content:""}.dl-horizontal:after{clear:both}.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}hr{margin:20px 0;border:0;border-top:1px solid #eee;border-bottom:1px solid #fff}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:0 0 0 15px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{margin-bottom:0;font-size:16px;font-weight:300;line-height:25px}blockquote small{display:block;line-height:20px;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{float:right;padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small{text-align:right}blockquote.pull-right small:before{content:''}blockquote.pull-right small:after{content:'\00A0 \2014'}q:before,q:after,blockquote:before,blockquote:after{content:""}address{display:block;margin-bottom:20px;font-style:normal;line-height:20px}code,pre{padding:0 3px 2px;font-family:Monaco,Menlo,Consolas,"Courier New",monospace;font-size:12px;color:#333;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}code{padding:2px 4px;color:#d14;white-space:nowrap;background-color:#f7f7f9;border:1px solid #e1e1e8}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:20px;word-break:break-all;word-wrap:break-word;white-space:pre;white-space:pre-wrap;background-color:#f5f5f5;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}pre.prettyprint{margin-bottom:20px}pre code{padding:0;color:inherit;white-space:pre;white-space:pre-wrap;background-color:transparent;border:0}.pre-scrollable{max-height:340px;overflow-y:scroll}form{margin:0 0 20px}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:40px;color:#333;border:0;border-bottom:1px solid #e5e5e5}legend small{font-size:15px;color:#999}label,input,button,select,textarea{font-size:14px;font-weight:normal;line-height:20px}input,button,select,textarea{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif}label{display:block;margin-bottom:5px}select,textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{display:inline-block;height:20px;padding:4px 6px;margin-bottom:10px;font-size:14px;line-height:20px;color:#555;vertical-align:middle;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}input,textarea,.uneditable-input{width:206px}textarea{height:auto}textarea,input[type="text"],input[type="password"],input[type="datetime"],input[type="datetime-local"],input[type="date"],input[type="month"],input[type="time"],input[type="week"],input[type="number"],input[type="email"],input[type="url"],input[type="search"],input[type="tel"],input[type="color"],.uneditable-input{background-color:#fff;border:1px solid #ccc;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border linear .2s,box-shadow linear .2s;-moz-transition:border linear .2s,box-shadow linear .2s;-o-transition:border linear .2s,box-shadow linear .2s;transition:border linear .2s,box-shadow linear .2s}textarea:focus,input[type="text"]:focus,input[type="password"]:focus,input[type="datetime"]:focus,input[type="datetime-local"]:focus,input[type="date"]:focus,input[type="month"]:focus,input[type="time"]:focus,input[type="week"]:focus,input[type="number"]:focus,input[type="email"]:focus,input[type="url"]:focus,input[type="search"]:focus,input[type="tel"]:focus,input[type="color"]:focus,.uneditable-input:focus{border-color:rgba(82,168,236,0.8);outline:0;outline:thin dotted \9;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(82,168,236,0.6)}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;*margin-top:0;line-height:normal}input[type="file"],input[type="image"],input[type="submit"],input[type="reset"],input[type="button"],input[type="radio"],input[type="checkbox"]{width:auto}select,input[type="file"]{height:30px;*margin-top:4px;line-height:30px}select{width:220px;background-color:#fff;border:1px solid #ccc}select[multiple],select[size]{height:auto}select:focus,input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.uneditable-input,.uneditable-textarea{color:#999;cursor:not-allowed;background-color:#fcfcfc;border-color:#ccc;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.025);box-shadow:inset 0 1px 2px rgba(0,0,0,0.025)}.uneditable-input{overflow:hidden;white-space:nowrap}.uneditable-textarea{width:auto;height:auto}input:-moz-placeholder,textarea:-moz-placeholder{color:#999}input:-ms-input-placeholder,textarea:-ms-input-placeholder{color:#999}input::-webkit-input-placeholder,textarea::-webkit-input-placeholder{color:#999}.radio,.checkbox{min-height:20px;padding-left:20px}.radio input[type="radio"],.checkbox input[type="checkbox"]{float:left;margin-left:-20px}.controls>.radio:first-child,.controls>.checkbox:first-child{padding-top:5px}.radio.inline,.checkbox.inline{display:inline-block;padding-top:5px;margin-bottom:0;vertical-align:middle}.radio.inline+.radio.inline,.checkbox.inline+.checkbox.inline{margin-left:10px}.input-mini{width:60px}.input-small{width:90px}.input-medium{width:150px}.input-large{width:210px}.input-xlarge{width:270px}.input-xxlarge{width:530px}input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"]{float:none;margin-left:0}.input-append input[class*="span"],.input-append .uneditable-input[class*="span"],.input-prepend input[class*="span"],.input-prepend .uneditable-input[class*="span"],.row-fluid input[class*="span"],.row-fluid select[class*="span"],.row-fluid textarea[class*="span"],.row-fluid .uneditable-input[class*="span"],.row-fluid .input-prepend [class*="span"],.row-fluid .input-append [class*="span"]{display:inline-block}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:926px}input.span11,textarea.span11,.uneditable-input.span11{width:846px}input.span10,textarea.span10,.uneditable-input.span10{width:766px}input.span9,textarea.span9,.uneditable-input.span9{width:686px}input.span8,textarea.span8,.uneditable-input.span8{width:606px}input.span7,textarea.span7,.uneditable-input.span7{width:526px}input.span6,textarea.span6,.uneditable-input.span6{width:446px}input.span5,textarea.span5,.uneditable-input.span5{width:366px}input.span4,textarea.span4,.uneditable-input.span4{width:286px}input.span3,textarea.span3,.uneditable-input.span3{width:206px}input.span2,textarea.span2,.uneditable-input.span2{width:126px}input.span1,textarea.span1,.uneditable-input.span1{width:46px}.controls-row{*zoom:1}.controls-row:before,.controls-row:after{display:table;line-height:0;content:""}.controls-row:after{clear:both}.controls-row [class*="span"],.row-fluid .controls-row [class*="span"]{float:left}.controls-row .checkbox[class*="span"],.controls-row .radio[class*="span"]{padding-top:5px}input[disabled],select[disabled],textarea[disabled],input[readonly],select[readonly],textarea[readonly]{cursor:not-allowed;background-color:#eee}input[type="radio"][disabled],input[type="checkbox"][disabled],input[type="radio"][readonly],input[type="checkbox"][readonly]{background-color:transparent}.control-group.warning .control-label,.control-group.warning .help-block,.control-group.warning .help-inline{color:#c09853}.control-group.warning .checkbox,.control-group.warning .radio,.control-group.warning input,.control-group.warning select,.control-group.warning textarea{color:#c09853}.control-group.warning input,.control-group.warning select,.control-group.warning textarea{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.warning input:focus,.control-group.warning select:focus,.control-group.warning textarea:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.control-group.warning .input-prepend .add-on,.control-group.warning .input-append .add-on{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.control-group.error .control-label,.control-group.error .help-block,.control-group.error .help-inline{color:#b94a48}.control-group.error .checkbox,.control-group.error .radio,.control-group.error input,.control-group.error select,.control-group.error textarea{color:#b94a48}.control-group.error input,.control-group.error select,.control-group.error textarea{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.error input:focus,.control-group.error select:focus,.control-group.error textarea:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.control-group.error .input-prepend .add-on,.control-group.error .input-append .add-on{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.control-group.success .control-label,.control-group.success .help-block,.control-group.success .help-inline{color:#468847}.control-group.success .checkbox,.control-group.success .radio,.control-group.success input,.control-group.success select,.control-group.success textarea{color:#468847}.control-group.success input,.control-group.success select,.control-group.success textarea{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.success input:focus,.control-group.success select:focus,.control-group.success textarea:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.control-group.success .input-prepend .add-on,.control-group.success .input-append .add-on{color:#468847;background-color:#dff0d8;border-color:#468847}.control-group.info .control-label,.control-group.info .help-block,.control-group.info .help-inline{color:#3a87ad}.control-group.info .checkbox,.control-group.info .radio,.control-group.info input,.control-group.info select,.control-group.info textarea{color:#3a87ad}.control-group.info input,.control-group.info select,.control-group.info textarea{border-color:#3a87ad;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.control-group.info input:focus,.control-group.info select:focus,.control-group.info textarea:focus{border-color:#2d6987;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7ab5d3}.control-group.info .input-prepend .add-on,.control-group.info .input-append .add-on{color:#3a87ad;background-color:#d9edf7;border-color:#3a87ad}input:focus:invalid,textarea:focus:invalid,select:focus:invalid{color:#b94a48;border-color:#ee5f5b}input:focus:invalid:focus,textarea:focus:invalid:focus,select:focus:invalid:focus{border-color:#e9322d;-webkit-box-shadow:0 0 6px #f8b9b7;-moz-box-shadow:0 0 6px #f8b9b7;box-shadow:0 0 6px #f8b9b7}.form-actions{padding:19px 20px 20px;margin-top:20px;margin-bottom:20px;background-color:#f5f5f5;border-top:1px solid #e5e5e5;*zoom:1}.form-actions:before,.form-actions:after{display:table;line-height:0;content:""}.form-actions:after{clear:both}.help-block,.help-inline{color:#595959}.help-block{display:block;margin-bottom:10px}.help-inline{display:inline-block;*display:inline;padding-left:5px;vertical-align:middle;*zoom:1}.input-append,.input-prepend{margin-bottom:5px;font-size:0;white-space:nowrap}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input,.input-append .dropdown-menu,.input-prepend .dropdown-menu{font-size:14px}.input-append input,.input-prepend input,.input-append select,.input-prepend select,.input-append .uneditable-input,.input-prepend .uneditable-input{position:relative;margin-bottom:0;*margin-left:0;vertical-align:top;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append input:focus,.input-prepend input:focus,.input-append select:focus,.input-prepend select:focus,.input-append .uneditable-input:focus,.input-prepend .uneditable-input:focus{z-index:2}.input-append .add-on,.input-prepend .add-on{display:inline-block;width:auto;height:20px;min-width:16px;padding:4px 5px;font-size:14px;font-weight:normal;line-height:20px;text-align:center;text-shadow:0 1px 0 #fff;background-color:#eee;border:1px solid #ccc}.input-append .add-on,.input-prepend .add-on,.input-append .btn,.input-prepend .btn,.input-append .btn-group>.dropdown-toggle,.input-prepend .btn-group>.dropdown-toggle{vertical-align:top;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-append .active,.input-prepend .active{background-color:#a9dba9;border-color:#46a546}.input-prepend .add-on,.input-prepend .btn{margin-right:-1px}.input-prepend .add-on:first-child,.input-prepend .btn:first-child{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input,.input-append select,.input-append .uneditable-input{-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-append input+.btn-group .btn:last-child,.input-append select+.btn-group .btn:last-child,.input-append .uneditable-input+.btn-group .btn:last-child{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-append .add-on,.input-append .btn,.input-append .btn-group{margin-left:-1px}.input-append .add-on:last-child,.input-append .btn:last-child,.input-append .btn-group:last-child>.dropdown-toggle{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append input,.input-prepend.input-append select,.input-prepend.input-append .uneditable-input{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.input-prepend.input-append input+.btn-group .btn,.input-prepend.input-append select+.btn-group .btn,.input-prepend.input-append .uneditable-input+.btn-group .btn{-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .add-on:first-child,.input-prepend.input-append .btn:first-child{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.input-prepend.input-append .add-on:last-child,.input-prepend.input-append .btn:last-child{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.input-prepend.input-append .btn-group:first-child{margin-left:0}input.search-query{padding-right:14px;padding-right:4px \9;padding-left:14px;padding-left:4px \9;margin-bottom:0;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.form-search .input-append .search-query,.form-search .input-prepend .search-query{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.form-search .input-append .search-query{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search .input-append .btn{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .search-query{-webkit-border-radius:0 14px 14px 0;-moz-border-radius:0 14px 14px 0;border-radius:0 14px 14px 0}.form-search .input-prepend .btn{-webkit-border-radius:14px 0 0 14px;-moz-border-radius:14px 0 0 14px;border-radius:14px 0 0 14px}.form-search input,.form-inline input,.form-horizontal input,.form-search textarea,.form-inline textarea,.form-horizontal textarea,.form-search select,.form-inline select,.form-horizontal select,.form-search .help-inline,.form-inline .help-inline,.form-horizontal .help-inline,.form-search .uneditable-input,.form-inline .uneditable-input,.form-horizontal .uneditable-input,.form-search .input-prepend,.form-inline .input-prepend,.form-horizontal .input-prepend,.form-search .input-append,.form-inline .input-append,.form-horizontal .input-append{display:inline-block;*display:inline;margin-bottom:0;vertical-align:middle;*zoom:1}.form-search .hide,.form-inline .hide,.form-horizontal .hide{display:none}.form-search label,.form-inline label,.form-search .btn-group,.form-inline .btn-group{display:inline-block}.form-search .input-append,.form-inline .input-append,.form-search .input-prepend,.form-inline .input-prepend{margin-bottom:0}.form-search .radio,.form-search .checkbox,.form-inline .radio,.form-inline .checkbox{padding-left:0;margin-bottom:0;vertical-align:middle}.form-search .radio input[type="radio"],.form-search .checkbox input[type="checkbox"],.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:left;margin-right:3px;margin-left:0}.control-group{margin-bottom:10px}legend+.control-group{margin-top:20px;-webkit-margin-top-collapse:separate}.form-horizontal .control-group{margin-bottom:20px;*zoom:1}.form-horizontal .control-group:before,.form-horizontal .control-group:after{display:table;line-height:0;content:""}.form-horizontal .control-group:after{clear:both}.form-horizontal .control-label{float:left;width:160px;padding-top:5px;text-align:right}.form-horizontal .controls{*display:inline-block;*padding-left:20px;margin-left:180px;*margin-left:0}.form-horizontal .controls:first-child{*padding-left:180px}.form-horizontal .help-block{margin-bottom:0}.form-horizontal input+.help-block,.form-horizontal select+.help-block,.form-horizontal textarea+.help-block,.form-horizontal .uneditable-input+.help-block,.form-horizontal .input-prepend+.help-block,.form-horizontal .input-append+.help-block{margin-top:10px}.form-horizontal .form-actions{padding-left:180px}table{max-width:100%;background-color:transparent;border-collapse:collapse;border-spacing:0}.table{width:100%;margin-bottom:20px}.table th,.table td{padding:8px;line-height:20px;text-align:left;vertical-align:top;border-top:1px solid #ddd}.table th{font-weight:bold}.table thead th{vertical-align:bottom}.table caption+thead tr:first-child th,.table caption+thead tr:first-child td,.table colgroup+thead tr:first-child th,.table colgroup+thead tr:first-child td,.table thead:first-child tr:first-child th,.table thead:first-child tr:first-child td{border-top:0}.table tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed th,.table-condensed td{padding:4px 5px}.table-bordered{border:1px solid #ddd;border-collapse:separate;*border-collapse:collapse;border-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.table-bordered th,.table-bordered td{border-left:1px solid #ddd}.table-bordered caption+thead tr:first-child th,.table-bordered caption+tbody tr:first-child th,.table-bordered caption+tbody tr:first-child td,.table-bordered colgroup+thead tr:first-child th,.table-bordered colgroup+tbody tr:first-child th,.table-bordered colgroup+tbody tr:first-child td,.table-bordered thead:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child th,.table-bordered tbody:first-child tr:first-child td{border-top:0}.table-bordered thead:first-child tr:first-child>th:first-child,.table-bordered tbody:first-child tr:first-child>td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered thead:first-child tr:first-child>th:last-child,.table-bordered tbody:first-child tr:first-child>td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-bordered thead:last-child tr:last-child>th:first-child,.table-bordered tbody:last-child tr:last-child>td:first-child,.table-bordered tfoot:last-child tr:last-child>td:first-child{-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomleft:4px}.table-bordered thead:last-child tr:last-child>th:last-child,.table-bordered tbody:last-child tr:last-child>td:last-child,.table-bordered tfoot:last-child tr:last-child>td:last-child{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-bottomright:4px}.table-bordered tfoot+tbody:last-child tr:last-child td:first-child{-webkit-border-bottom-left-radius:0;border-bottom-left-radius:0;-moz-border-radius-bottomleft:0}.table-bordered tfoot+tbody:last-child tr:last-child td:last-child{-webkit-border-bottom-right-radius:0;border-bottom-right-radius:0;-moz-border-radius-bottomright:0}.table-bordered caption+thead tr:first-child th:first-child,.table-bordered caption+tbody tr:first-child td:first-child,.table-bordered colgroup+thead tr:first-child th:first-child,.table-bordered colgroup+tbody tr:first-child td:first-child{-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topleft:4px}.table-bordered caption+thead tr:first-child th:last-child,.table-bordered caption+tbody tr:first-child td:last-child,.table-bordered colgroup+thead tr:first-child th:last-child,.table-bordered colgroup+tbody tr:first-child td:last-child{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-moz-border-radius-topright:4px}.table-striped tbody>tr:nth-child(odd)>td,.table-striped tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover tbody tr:hover td,.table-hover tbody tr:hover th{background-color:#f5f5f5}table td[class*="span"],table th[class*="span"],.row-fluid table td[class*="span"],.row-fluid table th[class*="span"]{display:table-cell;float:none;margin-left:0}.table td.span1,.table th.span1{float:none;width:44px;margin-left:0}.table td.span2,.table th.span2{float:none;width:124px;margin-left:0}.table td.span3,.table th.span3{float:none;width:204px;margin-left:0}.table td.span4,.table th.span4{float:none;width:284px;margin-left:0}.table td.span5,.table th.span5{float:none;width:364px;margin-left:0}.table td.span6,.table th.span6{float:none;width:444px;margin-left:0}.table td.span7,.table th.span7{float:none;width:524px;margin-left:0}.table td.span8,.table th.span8{float:none;width:604px;margin-left:0}.table td.span9,.table th.span9{float:none;width:684px;margin-left:0}.table td.span10,.table th.span10{float:none;width:764px;margin-left:0}.table td.span11,.table th.span11{float:none;width:844px;margin-left:0}.table td.span12,.table th.span12{float:none;width:924px;margin-left:0}.table tbody tr.success td{background-color:#dff0d8}.table tbody tr.error td{background-color:#f2dede}.table tbody tr.warning td{background-color:#fcf8e3}.table tbody tr.info td{background-color:#d9edf7}.table-hover tbody tr.success:hover td{background-color:#d0e9c6}.table-hover tbody tr.error:hover td{background-color:#ebcccc}.table-hover tbody tr.warning:hover td{background-color:#faf2cc}.table-hover tbody tr.info:hover td{background-color:#c4e3f3}[class^="icon-"],[class*=" icon-"]{display:inline-block;width:14px;height:14px;margin-top:1px;*margin-right:.3em;line-height:14px;vertical-align:text-top;background-image:url("../img/glyphicons-halflings.png");background-position:14px 14px;background-repeat:no-repeat}.icon-white,.nav-pills>.active>a>[class^="icon-"],.nav-pills>.active>a>[class*=" icon-"],.nav-list>.active>a>[class^="icon-"],.nav-list>.active>a>[class*=" icon-"],.navbar-inverse .nav>.active>a>[class^="icon-"],.navbar-inverse .nav>.active>a>[class*=" icon-"],.dropdown-menu>li>a:hover>[class^="icon-"],.dropdown-menu>li>a:hover>[class*=" icon-"],.dropdown-menu>.active>a>[class^="icon-"],.dropdown-menu>.active>a>[class*=" icon-"],.dropdown-submenu:hover>a>[class^="icon-"],.dropdown-submenu:hover>a>[class*=" icon-"]{background-image:url("../img/glyphicons-halflings-white.png")}.icon-glass{background-position:0 0}.icon-music{background-position:-24px 0}.icon-search{background-position:-48px 0}.icon-envelope{background-position:-72px 0}.icon-heart{background-position:-96px 0}.icon-star{background-position:-120px 0}.icon-star-empty{background-position:-144px 0}.icon-user{background-position:-168px 0}.icon-film{background-position:-192px 0}.icon-th-large{background-position:-216px 0}.icon-th{background-position:-240px 0}.icon-th-list{background-position:-264px 0}.icon-ok{background-position:-288px 0}.icon-remove{background-position:-312px 0}.icon-zoom-in{background-position:-336px 0}.icon-zoom-out{background-position:-360px 0}.icon-off{background-position:-384px 0}.icon-signal{background-position:-408px 0}.icon-cog{background-position:-432px 0}.icon-trash{background-position:-456px 0}.icon-home{background-position:0 -24px}.icon-file{background-position:-24px -24px}.icon-time{background-position:-48px -24px}.icon-road{background-position:-72px -24px}.icon-download-alt{background-position:-96px -24px}.icon-download{background-position:-120px -24px}.icon-upload{background-position:-144px -24px}.icon-inbox{background-position:-168px -24px}.icon-play-circle{background-position:-192px -24px}.icon-repeat{background-position:-216px -24px}.icon-refresh{background-position:-240px -24px}.icon-list-alt{background-position:-264px -24px}.icon-lock{background-position:-287px -24px}.icon-flag{background-position:-312px -24px}.icon-headphones{background-position:-336px -24px}.icon-volume-off{background-position:-360px -24px}.icon-volume-down{background-position:-384px -24px}.icon-volume-up{background-position:-408px -24px}.icon-qrcode{background-position:-432px -24px}.icon-barcode{background-position:-456px -24px}.icon-tag{background-position:0 -48px}.icon-tags{background-position:-25px -48px}.icon-book{background-position:-48px -48px}.icon-bookmark{background-position:-72px -48px}.icon-print{background-position:-96px -48px}.icon-camera{background-position:-120px -48px}.icon-font{background-position:-144px -48px}.icon-bold{background-position:-167px -48px}.icon-italic{background-position:-192px -48px}.icon-text-height{background-position:-216px -48px}.icon-text-width{background-position:-240px -48px}.icon-align-left{background-position:-264px -48px}.icon-align-center{background-position:-288px -48px}.icon-align-right{background-position:-312px -48px}.icon-align-justify{background-position:-336px -48px}.icon-list{background-position:-360px -48px}.icon-indent-left{background-position:-384px -48px}.icon-indent-right{background-position:-408px -48px}.icon-facetime-video{background-position:-432px -48px}.icon-picture{background-position:-456px -48px}.icon-pencil{background-position:0 -72px}.icon-map-marker{background-position:-24px -72px}.icon-adjust{background-position:-48px -72px}.icon-tint{background-position:-72px -72px}.icon-edit{background-position:-96px -72px}.icon-share{background-position:-120px -72px}.icon-check{background-position:-144px -72px}.icon-move{background-position:-168px -72px}.icon-step-backward{background-position:-192px -72px}.icon-fast-backward{background-position:-216px -72px}.icon-backward{background-position:-240px -72px}.icon-play{background-position:-264px -72px}.icon-pause{background-position:-288px -72px}.icon-stop{background-position:-312px -72px}.icon-forward{background-position:-336px -72px}.icon-fast-forward{background-position:-360px -72px}.icon-step-forward{background-position:-384px -72px}.icon-eject{background-position:-408px -72px}.icon-chevron-left{background-position:-432px -72px}.icon-chevron-right{background-position:-456px -72px}.icon-plus-sign{background-position:0 -96px}.icon-minus-sign{background-position:-24px -96px}.icon-remove-sign{background-position:-48px -96px}.icon-ok-sign{background-position:-72px -96px}.icon-question-sign{background-position:-96px -96px}.icon-info-sign{background-position:-120px -96px}.icon-screenshot{background-position:-144px -96px}.icon-remove-circle{background-position:-168px -96px}.icon-ok-circle{background-position:-192px -96px}.icon-ban-circle{background-position:-216px -96px}.icon-arrow-left{background-position:-240px -96px}.icon-arrow-right{background-position:-264px -96px}.icon-arrow-up{background-position:-289px -96px}.icon-arrow-down{background-position:-312px -96px}.icon-share-alt{background-position:-336px -96px}.icon-resize-full{background-position:-360px -96px}.icon-resize-small{background-position:-384px -96px}.icon-plus{background-position:-408px -96px}.icon-minus{background-position:-433px -96px}.icon-asterisk{background-position:-456px -96px}.icon-exclamation-sign{background-position:0 -120px}.icon-gift{background-position:-24px -120px}.icon-leaf{background-position:-48px -120px}.icon-fire{background-position:-72px -120px}.icon-eye-open{background-position:-96px -120px}.icon-eye-close{background-position:-120px -120px}.icon-warning-sign{background-position:-144px -120px}.icon-plane{background-position:-168px -120px}.icon-calendar{background-position:-192px -120px}.icon-random{width:16px;background-position:-216px -120px}.icon-comment{background-position:-240px -120px}.icon-magnet{background-position:-264px -120px}.icon-chevron-up{background-position:-288px -120px}.icon-chevron-down{background-position:-313px -119px}.icon-retweet{background-position:-336px -120px}.icon-shopping-cart{background-position:-360px -120px}.icon-folder-close{background-position:-384px -120px}.icon-folder-open{width:16px;background-position:-408px -120px}.icon-resize-vertical{background-position:-432px -119px}.icon-resize-horizontal{background-position:-456px -118px}.icon-hdd{background-position:0 -144px}.icon-bullhorn{background-position:-24px -144px}.icon-bell{background-position:-48px -144px}.icon-certificate{background-position:-72px -144px}.icon-thumbs-up{background-position:-96px -144px}.icon-thumbs-down{background-position:-120px -144px}.icon-hand-right{background-position:-144px -144px}.icon-hand-left{background-position:-168px -144px}.icon-hand-up{background-position:-192px -144px}.icon-hand-down{background-position:-216px -144px}.icon-circle-arrow-right{background-position:-240px -144px}.icon-circle-arrow-left{background-position:-264px -144px}.icon-circle-arrow-up{background-position:-288px -144px}.icon-circle-arrow-down{background-position:-312px -144px}.icon-globe{background-position:-336px -144px}.icon-wrench{background-position:-360px -144px}.icon-tasks{background-position:-384px -144px}.icon-filter{background-position:-408px -144px}.icon-briefcase{background-position:-432px -144px}.icon-fullscreen{background-position:-456px -144px}.dropup,.dropdown{position:relative}.dropdown-toggle{*margin-bottom:-3px}.dropdown-toggle:active,.open .dropdown-toggle{outline:0}.caret{display:inline-block;width:0;height:0;vertical-align:top;border-top:4px solid #000;border-right:4px solid transparent;border-left:4px solid transparent;content:""}.dropdown .caret{margin-top:8px;margin-left:2px}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);*border-right-width:2px;*border-bottom-width:2px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.dropdown-menu li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:20px;color:#333;white-space:nowrap}.dropdown-menu li>a:hover,.dropdown-menu li>a:focus,.dropdown-submenu:hover>a{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .active>a,.dropdown-menu .active>a:hover{color:#fff;text-decoration:none;background-color:#0081c2;background-image:-moz-linear-gradient(top,#08c,#0077b3);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#0077b3));background-image:-webkit-linear-gradient(top,#08c,#0077b3);background-image:-o-linear-gradient(top,#08c,#0077b3);background-image:linear-gradient(to bottom,#08c,#0077b3);background-repeat:repeat-x;outline:0;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0077b3',GradientType=0)}.dropdown-menu .disabled>a,.dropdown-menu .disabled>a:hover{color:#999}.dropdown-menu .disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open{*z-index:1000}.open>.dropdown-menu{display:block}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}.dropdown-submenu{position:relative}.dropdown-submenu>.dropdown-menu{top:0;left:100%;margin-top:-6px;margin-left:-1px;-webkit-border-radius:0 6px 6px 6px;-moz-border-radius:0 6px 6px 6px;border-radius:0 6px 6px 6px}.dropdown-submenu:hover>.dropdown-menu{display:block}.dropup .dropdown-submenu>.dropdown-menu{top:auto;bottom:0;margin-top:0;margin-bottom:-2px;-webkit-border-radius:5px 5px 5px 0;-moz-border-radius:5px 5px 5px 0;border-radius:5px 5px 5px 0}.dropdown-submenu>a:after{display:block;float:right;width:0;height:0;margin-top:5px;margin-right:-10px;border-color:transparent;border-left-color:#ccc;border-style:solid;border-width:5px 0 5px 5px;content:" "}.dropdown-submenu:hover>a:after{border-left-color:#fff}.dropdown-submenu.pull-left{float:none}.dropdown-submenu.pull-left>.dropdown-menu{left:-100%;margin-left:10px;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.dropdown .dropdown-menu .nav-header{padding-right:20px;padding-left:20px}.typeahead{z-index:1051;margin-top:2px;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-large{padding:24px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.well-small{padding:9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.fade{opacity:0;-webkit-transition:opacity .15s linear;-moz-transition:opacity .15s linear;-o-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;-moz-transition:height .35s ease;-o-transition:height .35s ease;transition:height .35s ease}.collapse.in{height:auto}.close{float:right;font-size:20px;font-weight:bold;line-height:20px;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover{color:#000;text-decoration:none;cursor:pointer;opacity:.4;filter:alpha(opacity=40)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.btn{display:inline-block;*display:inline;padding:4px 12px;margin-bottom:0;*margin-left:.3em;font-size:14px;line-height:20px;color:#333;text-align:center;text-shadow:0 1px 1px rgba(255,255,255,0.75);vertical-align:middle;cursor:pointer;background-color:#f5f5f5;*background-color:#e6e6e6;background-image:-moz-linear-gradient(top,#fff,#e6e6e6);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#e6e6e6));background-image:-webkit-linear-gradient(top,#fff,#e6e6e6);background-image:-o-linear-gradient(top,#fff,#e6e6e6);background-image:linear-gradient(to bottom,#fff,#e6e6e6);background-repeat:repeat-x;border:1px solid #bbb;*border:0;border-color:#e6e6e6 #e6e6e6 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);border-bottom-color:#a2a2a2;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#ffe6e6e6',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);*zoom:1;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn:hover,.btn:active,.btn.active,.btn.disabled,.btn[disabled]{color:#333;background-color:#e6e6e6;*background-color:#d9d9d9}.btn:active,.btn.active{background-color:#ccc \9}.btn:first-child{*margin-left:0}.btn:hover{color:#333;text-decoration:none;background-position:0 -15px;-webkit-transition:background-position .1s linear;-moz-transition:background-position .1s linear;-o-transition:background-position .1s linear;transition:background-position .1s linear}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn.active,.btn:active{background-image:none;outline:0;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn.disabled,.btn[disabled]{cursor:default;background-image:none;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-large{padding:11px 19px;font-size:17.5px;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.btn-large [class^="icon-"],.btn-large [class*=" icon-"]{margin-top:4px}.btn-small{padding:2px 10px;font-size:11.9px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-small [class^="icon-"],.btn-small [class*=" icon-"]{margin-top:0}.btn-mini [class^="icon-"],.btn-mini [class*=" icon-"]{margin-top:-1px}.btn-mini{padding:0 6px;font-size:10.5px;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.btn-primary.active,.btn-warning.active,.btn-danger.active,.btn-success.active,.btn-info.active,.btn-inverse.active{color:rgba(255,255,255,0.75)}.btn{border-color:#c5c5c5;border-color:rgba(0,0,0,0.15) rgba(0,0,0,0.15) rgba(0,0,0,0.25)}.btn-primary{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#006dcc;*background-color:#04c;background-image:-moz-linear-gradient(top,#08c,#04c);background-image:-webkit-gradient(linear,0 0,0 100%,from(#08c),to(#04c));background-image:-webkit-linear-gradient(top,#08c,#04c);background-image:-o-linear-gradient(top,#08c,#04c);background-image:linear-gradient(to bottom,#08c,#04c);background-repeat:repeat-x;border-color:#04c #04c #002a80;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc',endColorstr='#ff0044cc',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-primary:hover,.btn-primary:active,.btn-primary.active,.btn-primary.disabled,.btn-primary[disabled]{color:#fff;background-color:#04c;*background-color:#003bb3}.btn-primary:active,.btn-primary.active{background-color:#039 \9}.btn-warning{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#faa732;*background-color:#f89406;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;border-color:#f89406 #f89406 #ad6704;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-warning:hover,.btn-warning:active,.btn-warning.active,.btn-warning.disabled,.btn-warning[disabled]{color:#fff;background-color:#f89406;*background-color:#df8505}.btn-warning:active,.btn-warning.active{background-color:#c67605 \9}.btn-danger{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#da4f49;*background-color:#bd362f;background-image:-moz-linear-gradient(top,#ee5f5b,#bd362f);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#bd362f));background-image:-webkit-linear-gradient(top,#ee5f5b,#bd362f);background-image:-o-linear-gradient(top,#ee5f5b,#bd362f);background-image:linear-gradient(to bottom,#ee5f5b,#bd362f);background-repeat:repeat-x;border-color:#bd362f #bd362f #802420;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffbd362f',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-danger:hover,.btn-danger:active,.btn-danger.active,.btn-danger.disabled,.btn-danger[disabled]{color:#fff;background-color:#bd362f;*background-color:#a9302a}.btn-danger:active,.btn-danger.active{background-color:#942a25 \9}.btn-success{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#5bb75b;*background-color:#51a351;background-image:-moz-linear-gradient(top,#62c462,#51a351);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#51a351));background-image:-webkit-linear-gradient(top,#62c462,#51a351);background-image:-o-linear-gradient(top,#62c462,#51a351);background-image:linear-gradient(to bottom,#62c462,#51a351);background-repeat:repeat-x;border-color:#51a351 #51a351 #387038;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff51a351',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-success:hover,.btn-success:active,.btn-success.active,.btn-success.disabled,.btn-success[disabled]{color:#fff;background-color:#51a351;*background-color:#499249}.btn-success:active,.btn-success.active{background-color:#408140 \9}.btn-info{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#49afcd;*background-color:#2f96b4;background-image:-moz-linear-gradient(top,#5bc0de,#2f96b4);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#2f96b4));background-image:-webkit-linear-gradient(top,#5bc0de,#2f96b4);background-image:-o-linear-gradient(top,#5bc0de,#2f96b4);background-image:linear-gradient(to bottom,#5bc0de,#2f96b4);background-repeat:repeat-x;border-color:#2f96b4 #2f96b4 #1f6377;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff2f96b4',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-info:hover,.btn-info:active,.btn-info.active,.btn-info.disabled,.btn-info[disabled]{color:#fff;background-color:#2f96b4;*background-color:#2a85a0}.btn-info:active,.btn-info.active{background-color:#24748c \9}.btn-inverse{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#363636;*background-color:#222;background-image:-moz-linear-gradient(top,#444,#222);background-image:-webkit-gradient(linear,0 0,0 100%,from(#444),to(#222));background-image:-webkit-linear-gradient(top,#444,#222);background-image:-o-linear-gradient(top,#444,#222);background-image:linear-gradient(to bottom,#444,#222);background-repeat:repeat-x;border-color:#222 #222 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff444444',endColorstr='#ff222222',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.btn-inverse:hover,.btn-inverse:active,.btn-inverse.active,.btn-inverse.disabled,.btn-inverse[disabled]{color:#fff;background-color:#222;*background-color:#151515}.btn-inverse:active,.btn-inverse.active{background-color:#080808 \9}button.btn,input[type="submit"].btn{*padding-top:3px;*padding-bottom:3px}button.btn::-moz-focus-inner,input[type="submit"].btn::-moz-focus-inner{padding:0;border:0}button.btn.btn-large,input[type="submit"].btn.btn-large{*padding-top:7px;*padding-bottom:7px}button.btn.btn-small,input[type="submit"].btn.btn-small{*padding-top:3px;*padding-bottom:3px}button.btn.btn-mini,input[type="submit"].btn.btn-mini{*padding-top:1px;*padding-bottom:1px}.btn-link,.btn-link:active,.btn-link[disabled]{background-color:transparent;background-image:none;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.btn-link{color:#08c;cursor:pointer;border-color:transparent;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-link:hover{color:#005580;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover{color:#333;text-decoration:none}.btn-group{position:relative;display:inline-block;*display:inline;*margin-left:.3em;font-size:0;white-space:nowrap;vertical-align:middle;*zoom:1}.btn-group:first-child{*margin-left:0}.btn-group+.btn-group{margin-left:5px}.btn-toolbar{margin-top:10px;margin-bottom:10px;font-size:0}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group{margin-left:5px}.btn-group>.btn{position:relative;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group>.btn+.btn{margin-left:-1px}.btn-group>.btn,.btn-group>.dropdown-menu,.btn-group>.popover{font-size:14px}.btn-group>.btn-mini{font-size:10.5px}.btn-group>.btn-small{font-size:11.9px}.btn-group>.btn-large{font-size:17.5px}.btn-group>.btn:first-child{margin-left:0;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.btn-group>.btn:last-child,.btn-group>.dropdown-toggle{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.btn-group>.btn.large:first-child{margin-left:0;-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.btn-group>.btn.large:last-child,.btn-group>.large.dropdown-toggle{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.btn-group>.btn:hover,.btn-group>.btn:focus,.btn-group>.btn:active,.btn-group>.btn.active{z-index:2}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group>.btn+.dropdown-toggle{*padding-top:5px;padding-right:8px;*padding-bottom:5px;padding-left:8px;-webkit-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 1px 0 0 rgba(255,255,255,0.125),inset 0 1px 0 rgba(255,255,255,0.2),0 1px 2px rgba(0,0,0,0.05)}.btn-group>.btn-mini+.dropdown-toggle{*padding-top:2px;padding-right:5px;*padding-bottom:2px;padding-left:5px}.btn-group>.btn-small+.dropdown-toggle{*padding-top:5px;*padding-bottom:4px}.btn-group>.btn-large+.dropdown-toggle{*padding-top:7px;padding-right:12px;*padding-bottom:7px;padding-left:12px}.btn-group.open .dropdown-toggle{background-image:none;-webkit-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05);box-shadow:inset 0 2px 4px rgba(0,0,0,0.15),0 1px 2px rgba(0,0,0,0.05)}.btn-group.open .btn.dropdown-toggle{background-color:#e6e6e6}.btn-group.open .btn-primary.dropdown-toggle{background-color:#04c}.btn-group.open .btn-warning.dropdown-toggle{background-color:#f89406}.btn-group.open .btn-danger.dropdown-toggle{background-color:#bd362f}.btn-group.open .btn-success.dropdown-toggle{background-color:#51a351}.btn-group.open .btn-info.dropdown-toggle{background-color:#2f96b4}.btn-group.open .btn-inverse.dropdown-toggle{background-color:#222}.btn .caret{margin-top:8px;margin-left:0}.btn-mini .caret,.btn-small .caret,.btn-large .caret{margin-top:6px}.btn-large .caret{border-top-width:5px;border-right-width:5px;border-left-width:5px}.dropup .btn-large .caret{border-bottom-width:5px}.btn-primary .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret,.btn-success .caret,.btn-inverse .caret{border-top-color:#fff;border-bottom-color:#fff}.btn-group-vertical{display:inline-block;*display:inline;*zoom:1}.btn-group-vertical>.btn{display:block;float:none;max-width:100%;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.btn-group-vertical>.btn+.btn{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:first-child{-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.btn-group-vertical>.btn:last-child{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.btn-group-vertical>.btn-large:first-child{-webkit-border-radius:6px 6px 0 0;-moz-border-radius:6px 6px 0 0;border-radius:6px 6px 0 0}.btn-group-vertical>.btn-large:last-child{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.alert{padding:8px 35px 8px 14px;margin-bottom:20px;text-shadow:0 1px 0 rgba(255,255,255,0.5);background-color:#fcf8e3;border:1px solid #fbeed5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.alert,.alert h4{color:#c09853}.alert h4{margin:0}.alert .close{position:relative;top:-2px;right:-21px;line-height:20px}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success h4{color:#468847}.alert-danger,.alert-error{color:#b94a48;background-color:#f2dede;border-color:#eed3d7}.alert-danger h4,.alert-error h4{color:#b94a48}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info h4{color:#3a87ad}.alert-block{padding-top:14px;padding-bottom:14px}.alert-block>p,.alert-block>ul{margin-bottom:0}.alert-block p+p{margin-top:5px}.nav{margin-bottom:20px;margin-left:0;list-style:none}.nav>li>a{display:block}.nav>li>a:hover{text-decoration:none;background-color:#eee}.nav>li>a>img{max-width:none}.nav>.pull-right{float:right}.nav-header{display:block;padding:3px 15px;font-size:11px;font-weight:bold;line-height:20px;color:#999;text-shadow:0 1px 0 rgba(255,255,255,0.5);text-transform:uppercase}.nav li+.nav-header{margin-top:9px}.nav-list{padding-right:15px;padding-left:15px;margin-bottom:0}.nav-list>li>a,.nav-list .nav-header{margin-right:-15px;margin-left:-15px;text-shadow:0 1px 0 rgba(255,255,255,0.5)}.nav-list>li>a{padding:3px 15px}.nav-list>.active>a,.nav-list>.active>a:hover{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.2);background-color:#08c}.nav-list [class^="icon-"],.nav-list [class*=" icon-"]{margin-right:2px}.nav-list .divider{*width:100%;height:1px;margin:9px 1px;*margin:-5px 0 5px;overflow:hidden;background-color:#e5e5e5;border-bottom:1px solid #fff}.nav-tabs,.nav-pills{*zoom:1}.nav-tabs:before,.nav-pills:before,.nav-tabs:after,.nav-pills:after{display:table;line-height:0;content:""}.nav-tabs:after,.nav-pills:after{clear:both}.nav-tabs>li,.nav-pills>li{float:left}.nav-tabs>li>a,.nav-pills>li>a{padding-right:12px;padding-left:12px;margin-right:2px;line-height:14px}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{margin-bottom:-1px}.nav-tabs>li>a{padding-top:8px;padding-bottom:8px;line-height:20px;border:1px solid transparent;-webkit-border-radius:4px 4px 0 0;-moz-border-radius:4px 4px 0 0;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>.active>a,.nav-tabs>.active>a:hover{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-pills>li>a{padding-top:8px;padding-bottom:8px;margin-top:2px;margin-bottom:2px;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px}.nav-pills>.active>a,.nav-pills>.active>a:hover{color:#fff;background-color:#08c}.nav-stacked>li{float:none}.nav-stacked>li>a{margin-right:0}.nav-tabs.nav-stacked{border-bottom:0}.nav-tabs.nav-stacked>li>a{border:1px solid #ddd;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.nav-tabs.nav-stacked>li:first-child>a{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-topleft:4px}.nav-tabs.nav-stacked>li:last-child>a{-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-moz-border-radius-bottomright:4px;-moz-border-radius-bottomleft:4px}.nav-tabs.nav-stacked>li>a:hover{z-index:2;border-color:#ddd}.nav-pills.nav-stacked>li>a{margin-bottom:3px}.nav-pills.nav-stacked>li:last-child>a{margin-bottom:1px}.nav-tabs .dropdown-menu{-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px}.nav-pills .dropdown-menu{-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.nav .dropdown-toggle .caret{margin-top:6px;border-top-color:#08c;border-bottom-color:#08c}.nav .dropdown-toggle:hover .caret{border-top-color:#005580;border-bottom-color:#005580}.nav-tabs .dropdown-toggle .caret{margin-top:8px}.nav .active .dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-tabs .active .dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.nav>.dropdown.active>a:hover{cursor:pointer}.nav-tabs .open .dropdown-toggle,.nav-pills .open .dropdown-toggle,.nav>li.dropdown.open.active>a:hover{color:#fff;background-color:#999;border-color:#999}.nav li.dropdown.open .caret,.nav li.dropdown.open.active .caret,.nav li.dropdown.open a:hover .caret{border-top-color:#fff;border-bottom-color:#fff;opacity:1;filter:alpha(opacity=100)}.tabs-stacked .open>a:hover{border-color:#999}.tabbable{*zoom:1}.tabbable:before,.tabbable:after{display:table;line-height:0;content:""}.tabbable:after{clear:both}.tab-content{overflow:auto}.tabs-below>.nav-tabs,.tabs-right>.nav-tabs,.tabs-left>.nav-tabs{border-bottom:0}.tab-content>.tab-pane,.pill-content>.pill-pane{display:none}.tab-content>.active,.pill-content>.active{display:block}.tabs-below>.nav-tabs{border-top:1px solid #ddd}.tabs-below>.nav-tabs>li{margin-top:-1px;margin-bottom:0}.tabs-below>.nav-tabs>li>a{-webkit-border-radius:0 0 4px 4px;-moz-border-radius:0 0 4px 4px;border-radius:0 0 4px 4px}.tabs-below>.nav-tabs>li>a:hover{border-top-color:#ddd;border-bottom-color:transparent}.tabs-below>.nav-tabs>.active>a,.tabs-below>.nav-tabs>.active>a:hover{border-color:transparent #ddd #ddd #ddd}.tabs-left>.nav-tabs>li,.tabs-right>.nav-tabs>li{float:none}.tabs-left>.nav-tabs>li>a,.tabs-right>.nav-tabs>li>a{min-width:74px;margin-right:0;margin-bottom:3px}.tabs-left>.nav-tabs{float:left;margin-right:19px;border-right:1px solid #ddd}.tabs-left>.nav-tabs>li>a{margin-right:-1px;-webkit-border-radius:4px 0 0 4px;-moz-border-radius:4px 0 0 4px;border-radius:4px 0 0 4px}.tabs-left>.nav-tabs>li>a:hover{border-color:#eee #ddd #eee #eee}.tabs-left>.nav-tabs .active>a,.tabs-left>.nav-tabs .active>a:hover{border-color:#ddd transparent #ddd #ddd;*border-right-color:#fff}.tabs-right>.nav-tabs{float:right;margin-left:19px;border-left:1px solid #ddd}.tabs-right>.nav-tabs>li>a{margin-left:-1px;-webkit-border-radius:0 4px 4px 0;-moz-border-radius:0 4px 4px 0;border-radius:0 4px 4px 0}.tabs-right>.nav-tabs>li>a:hover{border-color:#eee #eee #eee #ddd}.tabs-right>.nav-tabs .active>a,.tabs-right>.nav-tabs .active>a:hover{border-color:#ddd #ddd #ddd transparent;*border-left-color:#fff}.nav>.disabled>a{color:#999}.nav>.disabled>a:hover{text-decoration:none;cursor:default;background-color:transparent}.navbar{*position:relative;*z-index:2;margin-bottom:20px;overflow:visible}.navbar-inner{min-height:40px;padding-right:20px;padding-left:20px;background-color:#fafafa;background-image:-moz-linear-gradient(top,#fff,#f2f2f2);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fff),to(#f2f2f2));background-image:-webkit-linear-gradient(top,#fff,#f2f2f2);background-image:-o-linear-gradient(top,#fff,#f2f2f2);background-image:linear-gradient(to bottom,#fff,#f2f2f2);background-repeat:repeat-x;border:1px solid #d4d4d4;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffffff',endColorstr='#fff2f2f2',GradientType=0);*zoom:1;-webkit-box-shadow:0 1px 4px rgba(0,0,0,0.065);-moz-box-shadow:0 1px 4px rgba(0,0,0,0.065);box-shadow:0 1px 4px rgba(0,0,0,0.065)}.navbar-inner:before,.navbar-inner:after{display:table;line-height:0;content:""}.navbar-inner:after{clear:both}.navbar .container{width:auto}.nav-collapse.collapse{height:auto;overflow:visible}.navbar .brand{display:block;float:left;padding:10px 20px 10px;margin-left:-20px;font-size:20px;font-weight:200;color:#777;text-shadow:0 1px 0 #fff}.navbar .brand:hover{text-decoration:none}.navbar-text{margin-bottom:0;line-height:40px;color:#777}.navbar-link{color:#777}.navbar-link:hover{color:#333}.navbar .divider-vertical{height:40px;margin:0 9px;border-right:1px solid #fff;border-left:1px solid #f2f2f2}.navbar .btn,.navbar .btn-group{margin-top:5px}.navbar .btn-group .btn,.navbar .input-prepend .btn,.navbar .input-append .btn{margin-top:0}.navbar-form{margin-bottom:0;*zoom:1}.navbar-form:before,.navbar-form:after{display:table;line-height:0;content:""}.navbar-form:after{clear:both}.navbar-form input,.navbar-form select,.navbar-form .radio,.navbar-form .checkbox{margin-top:5px}.navbar-form input,.navbar-form select,.navbar-form .btn{display:inline-block;margin-bottom:0}.navbar-form input[type="image"],.navbar-form input[type="checkbox"],.navbar-form input[type="radio"]{margin-top:3px}.navbar-form .input-append,.navbar-form .input-prepend{margin-top:5px;white-space:nowrap}.navbar-form .input-append input,.navbar-form .input-prepend input{margin-top:0}.navbar-search{position:relative;float:left;margin-top:5px;margin-bottom:0}.navbar-search .search-query{padding:4px 14px;margin-bottom:0;font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:13px;font-weight:normal;line-height:1;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.navbar-static-top{position:static;margin-bottom:0}.navbar-static-top .navbar-inner{-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030;margin-bottom:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{border-width:0 0 1px}.navbar-fixed-bottom .navbar-inner{border-width:1px 0 0}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding-right:0;padding-left:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0}.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:940px}.navbar-fixed-top{top:0}.navbar-fixed-top .navbar-inner,.navbar-static-top .navbar-inner{-webkit-box-shadow:0 1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 1px 10px rgba(0,0,0,0.1);box-shadow:0 1px 10px rgba(0,0,0,0.1)}.navbar-fixed-bottom{bottom:0}.navbar-fixed-bottom .navbar-inner{-webkit-box-shadow:0 -1px 10px rgba(0,0,0,0.1);-moz-box-shadow:0 -1px 10px rgba(0,0,0,0.1);box-shadow:0 -1px 10px rgba(0,0,0,0.1)}.navbar .nav{position:relative;left:0;display:block;float:left;margin:0 10px 0 0}.navbar .nav.pull-right{float:right;margin-right:0}.navbar .nav>li{float:left}.navbar .nav>li>a{float:none;padding:10px 15px 10px;color:#777;text-decoration:none;text-shadow:0 1px 0 #fff}.navbar .nav .dropdown-toggle .caret{margin-top:8px}.navbar .nav>li>a:focus,.navbar .nav>li>a:hover{color:#333;text-decoration:none;background-color:transparent}.navbar .nav>.active>a,.navbar .nav>.active>a:hover,.navbar .nav>.active>a:focus{color:#555;text-decoration:none;background-color:#e5e5e5;-webkit-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);-moz-box-shadow:inset 0 3px 8px rgba(0,0,0,0.125);box-shadow:inset 0 3px 8px rgba(0,0,0,0.125)}.navbar .btn-navbar{display:none;float:right;padding:7px 10px;margin-right:5px;margin-left:5px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#ededed;*background-color:#e5e5e5;background-image:-moz-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f2f2f2),to(#e5e5e5));background-image:-webkit-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:-o-linear-gradient(top,#f2f2f2,#e5e5e5);background-image:linear-gradient(to bottom,#f2f2f2,#e5e5e5);background-repeat:repeat-x;border-color:#e5e5e5 #e5e5e5 #bfbfbf;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff2f2f2',endColorstr='#ffe5e5e5',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false);-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.075)}.navbar .btn-navbar:hover,.navbar .btn-navbar:active,.navbar .btn-navbar.active,.navbar .btn-navbar.disabled,.navbar .btn-navbar[disabled]{color:#fff;background-color:#e5e5e5;*background-color:#d9d9d9}.navbar .btn-navbar:active,.navbar .btn-navbar.active{background-color:#ccc \9}.navbar .btn-navbar .icon-bar{display:block;width:18px;height:2px;background-color:#f5f5f5;-webkit-border-radius:1px;-moz-border-radius:1px;border-radius:1px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,0.25);-moz-box-shadow:0 1px 0 rgba(0,0,0,0.25);box-shadow:0 1px 0 rgba(0,0,0,0.25)}.btn-navbar .icon-bar+.icon-bar{margin-top:3px}.navbar .nav>li>.dropdown-menu:before{position:absolute;top:-7px;left:9px;display:inline-block;border-right:7px solid transparent;border-bottom:7px solid #ccc;border-left:7px solid transparent;border-bottom-color:rgba(0,0,0,0.2);content:''}.navbar .nav>li>.dropdown-menu:after{position:absolute;top:-6px;left:10px;display:inline-block;border-right:6px solid transparent;border-bottom:6px solid #fff;border-left:6px solid transparent;content:''}.navbar-fixed-bottom .nav>li>.dropdown-menu:before{top:auto;bottom:-7px;border-top:7px solid #ccc;border-bottom:0;border-top-color:rgba(0,0,0,0.2)}.navbar-fixed-bottom .nav>li>.dropdown-menu:after{top:auto;bottom:-6px;border-top:6px solid #fff;border-bottom:0}.navbar .nav li.dropdown>a:hover .caret{border-top-color:#555;border-bottom-color:#555}.navbar .nav li.dropdown.open>.dropdown-toggle,.navbar .nav li.dropdown.active>.dropdown-toggle,.navbar .nav li.dropdown.open.active>.dropdown-toggle{color:#555;background-color:#e5e5e5}.navbar .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#777;border-bottom-color:#777}.navbar .nav li.dropdown.open>.dropdown-toggle .caret,.navbar .nav li.dropdown.active>.dropdown-toggle .caret,.navbar .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#555;border-bottom-color:#555}.navbar .pull-right>li>.dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar .pull-right>li>.dropdown-menu:before,.navbar .nav>li>.dropdown-menu.pull-right:before{right:12px;left:auto}.navbar .pull-right>li>.dropdown-menu:after,.navbar .nav>li>.dropdown-menu.pull-right:after{right:13px;left:auto}.navbar .pull-right>li>.dropdown-menu .dropdown-menu,.navbar .nav>li>.dropdown-menu.pull-right .dropdown-menu{right:100%;left:auto;margin-right:-1px;margin-left:0;-webkit-border-radius:6px 0 6px 6px;-moz-border-radius:6px 0 6px 6px;border-radius:6px 0 6px 6px}.navbar-inverse .navbar-inner{background-color:#1b1b1b;background-image:-moz-linear-gradient(top,#222,#111);background-image:-webkit-gradient(linear,0 0,0 100%,from(#222),to(#111));background-image:-webkit-linear-gradient(top,#222,#111);background-image:-o-linear-gradient(top,#222,#111);background-image:linear-gradient(to bottom,#222,#111);background-repeat:repeat-x;border-color:#252525;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff222222',endColorstr='#ff111111',GradientType=0)}.navbar-inverse .brand,.navbar-inverse .nav>li>a{color:#999;text-shadow:0 -1px 0 rgba(0,0,0,0.25)}.navbar-inverse .brand:hover,.navbar-inverse .nav>li>a:hover{color:#fff}.navbar-inverse .brand{color:#999}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .nav>li>a:focus,.navbar-inverse .nav>li>a:hover{color:#fff;background-color:transparent}.navbar-inverse .nav .active>a,.navbar-inverse .nav .active>a:hover,.navbar-inverse .nav .active>a:focus{color:#fff;background-color:#111}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.navbar-inverse .divider-vertical{border-right-color:#222;border-left-color:#111}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle{color:#fff;background-color:#111}.navbar-inverse .nav li.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .nav li.dropdown>.dropdown-toggle .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .nav li.dropdown.open>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.active>.dropdown-toggle .caret,.navbar-inverse .nav li.dropdown.open.active>.dropdown-toggle .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-search .search-query{color:#fff;background-color:#515151;border-color:#111;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1),0 1px 0 rgba(255,255,255,0.15);-webkit-transition:none;-moz-transition:none;-o-transition:none;transition:none}.navbar-inverse .navbar-search .search-query:-moz-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:-ms-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query::-webkit-input-placeholder{color:#ccc}.navbar-inverse .navbar-search .search-query:focus,.navbar-inverse .navbar-search .search-query.focused{padding:5px 15px;color:#333;text-shadow:0 1px 0 #fff;background-color:#fff;border:0;outline:0;-webkit-box-shadow:0 0 3px rgba(0,0,0,0.15);-moz-box-shadow:0 0 3px rgba(0,0,0,0.15);box-shadow:0 0 3px rgba(0,0,0,0.15)}.navbar-inverse .btn-navbar{color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e0e0e;*background-color:#040404;background-image:-moz-linear-gradient(top,#151515,#040404);background-image:-webkit-gradient(linear,0 0,0 100%,from(#151515),to(#040404));background-image:-webkit-linear-gradient(top,#151515,#040404);background-image:-o-linear-gradient(top,#151515,#040404);background-image:linear-gradient(to bottom,#151515,#040404);background-repeat:repeat-x;border-color:#040404 #040404 #000;border-color:rgba(0,0,0,0.1) rgba(0,0,0,0.1) rgba(0,0,0,0.25);filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff151515',endColorstr='#ff040404',GradientType=0);filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.navbar-inverse .btn-navbar:hover,.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active,.navbar-inverse .btn-navbar.disabled,.navbar-inverse .btn-navbar[disabled]{color:#fff;background-color:#040404;*background-color:#000}.navbar-inverse .btn-navbar:active,.navbar-inverse .btn-navbar.active{background-color:#000 \9}.breadcrumb{padding:8px 15px;margin:0 0 20px;list-style:none;background-color:#f5f5f5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.breadcrumb>li{display:inline-block;*display:inline;text-shadow:0 1px 0 #fff;*zoom:1}.breadcrumb>li>.divider{padding:0 5px;color:#ccc}.breadcrumb>.active{color:#999}.pagination{margin:20px 0}.pagination ul{display:inline-block;*display:inline;margin-bottom:0;margin-left:0;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;*zoom:1;-webkit-box-shadow:0 1px 2px rgba(0,0,0,0.05);-moz-box-shadow:0 1px 2px rgba(0,0,0,0.05);box-shadow:0 1px 2px rgba(0,0,0,0.05)}.pagination ul>li{display:inline}.pagination ul>li>a,.pagination ul>li>span{float:left;padding:4px 12px;line-height:20px;text-decoration:none;background-color:#fff;border:1px solid #ddd;border-left-width:0}.pagination ul>li>a:hover,.pagination ul>.active>a,.pagination ul>.active>span{background-color:#f5f5f5}.pagination ul>.active>a,.pagination ul>.active>span{color:#999;cursor:default}.pagination ul>.disabled>span,.pagination ul>.disabled>a,.pagination ul>.disabled>a:hover{color:#999;cursor:default;background-color:transparent}.pagination ul>li:first-child>a,.pagination ul>li:first-child>span{border-left-width:1px;-webkit-border-bottom-left-radius:4px;border-bottom-left-radius:4px;-webkit-border-top-left-radius:4px;border-top-left-radius:4px;-moz-border-radius-bottomleft:4px;-moz-border-radius-topleft:4px}.pagination ul>li:last-child>a,.pagination ul>li:last-child>span{-webkit-border-top-right-radius:4px;border-top-right-radius:4px;-webkit-border-bottom-right-radius:4px;border-bottom-right-radius:4px;-moz-border-radius-topright:4px;-moz-border-radius-bottomright:4px}.pagination-centered{text-align:center}.pagination-right{text-align:right}.pagination-large ul>li>a,.pagination-large ul>li>span{padding:11px 19px;font-size:17.5px}.pagination-large ul>li:first-child>a,.pagination-large ul>li:first-child>span{-webkit-border-bottom-left-radius:6px;border-bottom-left-radius:6px;-webkit-border-top-left-radius:6px;border-top-left-radius:6px;-moz-border-radius-bottomleft:6px;-moz-border-radius-topleft:6px}.pagination-large ul>li:last-child>a,.pagination-large ul>li:last-child>span{-webkit-border-top-right-radius:6px;border-top-right-radius:6px;-webkit-border-bottom-right-radius:6px;border-bottom-right-radius:6px;-moz-border-radius-topright:6px;-moz-border-radius-bottomright:6px}.pagination-mini ul>li:first-child>a,.pagination-small ul>li:first-child>a,.pagination-mini ul>li:first-child>span,.pagination-small ul>li:first-child>span{-webkit-border-bottom-left-radius:3px;border-bottom-left-radius:3px;-webkit-border-top-left-radius:3px;border-top-left-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-topleft:3px}.pagination-mini ul>li:last-child>a,.pagination-small ul>li:last-child>a,.pagination-mini ul>li:last-child>span,.pagination-small ul>li:last-child>span{-webkit-border-top-right-radius:3px;border-top-right-radius:3px;-webkit-border-bottom-right-radius:3px;border-bottom-right-radius:3px;-moz-border-radius-topright:3px;-moz-border-radius-bottomright:3px}.pagination-small ul>li>a,.pagination-small ul>li>span{padding:2px 10px;font-size:11.9px}.pagination-mini ul>li>a,.pagination-mini ul>li>span{padding:0 6px;font-size:10.5px}.pager{margin:20px 0;text-align:center;list-style:none;*zoom:1}.pager:before,.pager:after{display:table;line-height:0;content:""}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;-webkit-border-radius:15px;-moz-border-radius:15px;border-radius:15px}.pager li>a:hover{text-decoration:none;background-color:#f5f5f5}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>span{color:#999;cursor:default;background-color:#fff}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;background-color:#000}.modal-backdrop.fade{opacity:0}.modal-backdrop,.modal-backdrop.fade.in{opacity:.8;filter:alpha(opacity=80)}.modal{position:fixed;top:10%;left:50%;z-index:1050;width:560px;margin-left:-280px;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.3);*border:1px solid #999;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;outline:0;-webkit-box-shadow:0 3px 7px rgba(0,0,0,0.3);-moz-box-shadow:0 3px 7px rgba(0,0,0,0.3);box-shadow:0 3px 7px rgba(0,0,0,0.3);-webkit-background-clip:padding-box;-moz-background-clip:padding-box;background-clip:padding-box}.modal.fade{top:-25%;-webkit-transition:opacity .3s linear,top .3s ease-out;-moz-transition:opacity .3s linear,top .3s ease-out;-o-transition:opacity .3s linear,top .3s ease-out;transition:opacity .3s linear,top .3s ease-out}.modal.fade.in{top:10%}.modal-header{padding:9px 15px;border-bottom:1px solid #eee}.modal-header .close{margin-top:2px}.modal-header h3{margin:0;line-height:30px}.modal-body{position:relative;max-height:400px;padding:15px;overflow-y:auto}.modal-form{margin-bottom:0}.modal-footer{padding:14px 15px 15px;margin-bottom:0;text-align:right;background-color:#f5f5f5;border-top:1px solid #ddd;-webkit-border-radius:0 0 6px 6px;-moz-border-radius:0 0 6px 6px;border-radius:0 0 6px 6px;*zoom:1;-webkit-box-shadow:inset 0 1px 0 #fff;-moz-box-shadow:inset 0 1px 0 #fff;box-shadow:inset 0 1px 0 #fff}.modal-footer:before,.modal-footer:after{display:table;line-height:0;content:""}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}.tooltip{position:absolute;z-index:1030;display:block;padding:5px;font-size:11px;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.8;filter:alpha(opacity=80)}.tooltip.top{margin-top:-3px}.tooltip.right{margin-left:3px}.tooltip.bottom{margin-top:3px}.tooltip.left{margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;width:236px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);-moz-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);-webkit-background-clip:padding-box;-moz-background-clip:padding;background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;-webkit-border-radius:5px 5px 0 0;-moz-border-radius:5px 5px 0 0;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0}.thumbnails{margin-left:-20px;list-style:none;*zoom:1}.thumbnails:before,.thumbnails:after{display:table;line-height:0;content:""}.thumbnails:after{clear:both}.row-fluid .thumbnails{margin-left:0}.thumbnails>li{float:left;margin-bottom:20px;margin-left:20px}.thumbnail{display:block;padding:4px;line-height:20px;border:1px solid #ddd;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,0.055);-moz-box-shadow:0 1px 3px rgba(0,0,0,0.055);box-shadow:0 1px 3px rgba(0,0,0,0.055);-webkit-transition:all .2s ease-in-out;-moz-transition:all .2s ease-in-out;-o-transition:all .2s ease-in-out;transition:all .2s ease-in-out}a.thumbnail:hover{border-color:#08c;-webkit-box-shadow:0 1px 4px rgba(0,105,214,0.25);-moz-box-shadow:0 1px 4px rgba(0,105,214,0.25);box-shadow:0 1px 4px rgba(0,105,214,0.25)}.thumbnail>img{display:block;max-width:100%;margin-right:auto;margin-left:auto}.thumbnail .caption{padding:9px;color:#555}.media,.media-body{overflow:hidden;*overflow:visible;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media .pull-left{margin-right:10px}.media .pull-right{margin-left:10px}.media-list{margin-left:0;list-style:none}.label,.badge{display:inline-block;padding:2px 4px;font-size:11.844px;font-weight:bold;line-height:14px;color:#fff;text-shadow:0 -1px 0 rgba(0,0,0,0.25);white-space:nowrap;vertical-align:baseline;background-color:#999}.label{-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.badge{padding-right:9px;padding-left:9px;-webkit-border-radius:9px;-moz-border-radius:9px;border-radius:9px}.label:empty,.badge:empty{display:none}a.label:hover,a.badge:hover{color:#fff;text-decoration:none;cursor:pointer}.label-important,.badge-important{background-color:#b94a48}.label-important[href],.badge-important[href]{background-color:#953b39}.label-warning,.badge-warning{background-color:#f89406}.label-warning[href],.badge-warning[href]{background-color:#c67605}.label-success,.badge-success{background-color:#468847}.label-success[href],.badge-success[href]{background-color:#356635}.label-info,.badge-info{background-color:#3a87ad}.label-info[href],.badge-info[href]{background-color:#2d6987}.label-inverse,.badge-inverse{background-color:#333}.label-inverse[href],.badge-inverse[href]{background-color:#1a1a1a}.btn .label,.btn .badge{position:relative;top:-1px}.btn-mini .label,.btn-mini .badge{top:0}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-ms-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f7f7f7;background-image:-moz-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#f5f5f5),to(#f9f9f9));background-image:-webkit-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:-o-linear-gradient(top,#f5f5f5,#f9f9f9);background-image:linear-gradient(to bottom,#f5f5f5,#f9f9f9);background-repeat:repeat-x;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fff5f5f5',endColorstr='#fff9f9f9',GradientType=0);-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);-moz-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress .bar{float:left;width:0;height:100%;font-size:12px;color:#fff;text-align:center;text-shadow:0 -1px 0 rgba(0,0,0,0.25);background-color:#0e90d2;background-image:-moz-linear-gradient(top,#149bdf,#0480be);background-image:-webkit-gradient(linear,0 0,0 100%,from(#149bdf),to(#0480be));background-image:-webkit-linear-gradient(top,#149bdf,#0480be);background-image:-o-linear-gradient(top,#149bdf,#0480be);background-image:linear-gradient(to bottom,#149bdf,#0480be);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff149bdf',endColorstr='#ff0480be',GradientType=0);-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;-webkit-transition:width .6s ease;-moz-transition:width .6s ease;-o-transition:width .6s ease;transition:width .6s ease}.progress .bar+.bar{-webkit-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);-moz-box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 1px 0 0 rgba(0,0,0,0.15),inset 0 -1px 0 rgba(0,0,0,0.15)}.progress-striped .bar{background-color:#149bdf;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);-webkit-background-size:40px 40px;-moz-background-size:40px 40px;-o-background-size:40px 40px;background-size:40px 40px}.progress.active .bar{-webkit-animation:progress-bar-stripes 2s linear infinite;-moz-animation:progress-bar-stripes 2s linear infinite;-ms-animation:progress-bar-stripes 2s linear infinite;-o-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-danger .bar,.progress .bar-danger{background-color:#dd514c;background-image:-moz-linear-gradient(top,#ee5f5b,#c43c35);background-image:-webkit-gradient(linear,0 0,0 100%,from(#ee5f5b),to(#c43c35));background-image:-webkit-linear-gradient(top,#ee5f5b,#c43c35);background-image:-o-linear-gradient(top,#ee5f5b,#c43c35);background-image:linear-gradient(to bottom,#ee5f5b,#c43c35);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffee5f5b',endColorstr='#ffc43c35',GradientType=0)}.progress-danger.progress-striped .bar,.progress-striped .bar-danger{background-color:#ee5f5b;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-success .bar,.progress .bar-success{background-color:#5eb95e;background-image:-moz-linear-gradient(top,#62c462,#57a957);background-image:-webkit-gradient(linear,0 0,0 100%,from(#62c462),to(#57a957));background-image:-webkit-linear-gradient(top,#62c462,#57a957);background-image:-o-linear-gradient(top,#62c462,#57a957);background-image:linear-gradient(to bottom,#62c462,#57a957);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff62c462',endColorstr='#ff57a957',GradientType=0)}.progress-success.progress-striped .bar,.progress-striped .bar-success{background-color:#62c462;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-info .bar,.progress .bar-info{background-color:#4bb1cf;background-image:-moz-linear-gradient(top,#5bc0de,#339bb9);background-image:-webkit-gradient(linear,0 0,0 100%,from(#5bc0de),to(#339bb9));background-image:-webkit-linear-gradient(top,#5bc0de,#339bb9);background-image:-o-linear-gradient(top,#5bc0de,#339bb9);background-image:linear-gradient(to bottom,#5bc0de,#339bb9);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff5bc0de',endColorstr='#ff339bb9',GradientType=0)}.progress-info.progress-striped .bar,.progress-striped .bar-info{background-color:#5bc0de;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-warning .bar,.progress .bar-warning{background-color:#faa732;background-image:-moz-linear-gradient(top,#fbb450,#f89406);background-image:-webkit-gradient(linear,0 0,0 100%,from(#fbb450),to(#f89406));background-image:-webkit-linear-gradient(top,#fbb450,#f89406);background-image:-o-linear-gradient(top,#fbb450,#f89406);background-image:linear-gradient(to bottom,#fbb450,#f89406);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#fffbb450',endColorstr='#fff89406',GradientType=0)}.progress-warning.progress-striped .bar,.progress-striped .bar-warning{background-color:#fbb450;background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-o-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.accordion{margin-bottom:20px}.accordion-group{margin-bottom:2px;border:1px solid #e5e5e5;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.accordion-heading{border-bottom:0}.accordion-heading .accordion-toggle{display:block;padding:8px 15px}.accordion-toggle{cursor:pointer}.accordion-inner{padding:9px 15px;border-top:1px solid #e5e5e5}.carousel{position:relative;margin-bottom:20px;line-height:1}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;-moz-transition:.6s ease-in-out left;-o-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img{display:block;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:40%;left:15px;width:40px;height:40px;margin-top:-20px;font-size:60px;font-weight:100;line-height:30px;color:#fff;text-align:center;background:#222;border:3px solid #fff;-webkit-border-radius:23px;-moz-border-radius:23px;border-radius:23px;opacity:.5;filter:alpha(opacity=50)}.carousel-control.right{right:15px;left:auto}.carousel-control:hover{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-caption{position:absolute;right:0;bottom:0;left:0;padding:15px;background:#333;background:rgba(0,0,0,0.75)}.carousel-caption h4,.carousel-caption p{line-height:20px;color:#fff}.carousel-caption h4{margin:0 0 5px}.carousel-caption p{margin-bottom:0}.hero-unit{padding:60px;margin-bottom:30px;font-size:18px;font-weight:200;line-height:30px;color:inherit;background-color:#eee;-webkit-border-radius:6px;-moz-border-radius:6px;border-radius:6px}.hero-unit h1{margin-bottom:0;font-size:60px;line-height:1;letter-spacing:-1px;color:inherit}.hero-unit li{line-height:30px}.pull-right{float:right}.pull-left{float:left}.hide{display:none}.show{display:block}.invisible{visibility:hidden}.affix{position:fixed}
5.13 +/*!
5.14 + * Bootstrap Responsive v2.2.2
5.15 + *
5.16 + * Copyright 2012 Twitter, Inc
5.17 + * Licensed under the Apache License v2.0
5.18 + * http://www.apache.org/licenses/LICENSE-2.0
5.19 + *
5.20 + * Designed and built with all the love in the world @twitter by @mdo and @fat.
5.21 + */@-ms-viewport{width:device-width}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;line-height:0;content:""}.clearfix:after{clear:both}.hide-text{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.input-block-level{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.hidden{display:none;visibility:hidden}.visible-phone{display:none!important}.visible-tablet{display:none!important}.hidden-desktop{display:none!important}.visible-desktop{display:inherit!important}@media(min-width:768px) and (max-width:979px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-tablet{display:inherit!important}.hidden-tablet{display:none!important}}@media(max-width:767px){.hidden-desktop{display:inherit!important}.visible-desktop{display:none!important}.visible-phone{display:inherit!important}.hidden-phone{display:none!important}}@media(min-width:1200px){.row{margin-left:-30px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:30px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:1170px}.span12{width:1170px}.span11{width:1070px}.span10{width:970px}.span9{width:870px}.span8{width:770px}.span7{width:670px}.span6{width:570px}.span5{width:470px}.span4{width:370px}.span3{width:270px}.span2{width:170px}.span1{width:70px}.offset12{margin-left:1230px}.offset11{margin-left:1130px}.offset10{margin-left:1030px}.offset9{margin-left:930px}.offset8{margin-left:830px}.offset7{margin-left:730px}.offset6{margin-left:630px}.offset5{margin-left:530px}.offset4{margin-left:430px}.offset3{margin-left:330px}.offset2{margin-left:230px}.offset1{margin-left:130px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.564102564102564%;*margin-left:2.5109110747408616%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.564102564102564%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.45299145299145%;*width:91.39979996362975%}.row-fluid .span10{width:82.90598290598291%;*width:82.8527914166212%}.row-fluid .span9{width:74.35897435897436%;*width:74.30578286961266%}.row-fluid .span8{width:65.81196581196582%;*width:65.75877432260411%}.row-fluid .span7{width:57.26495726495726%;*width:57.21176577559556%}.row-fluid .span6{width:48.717948717948715%;*width:48.664757228587014%}.row-fluid .span5{width:40.17094017094017%;*width:40.11774868157847%}.row-fluid .span4{width:31.623931623931625%;*width:31.570740134569924%}.row-fluid .span3{width:23.076923076923077%;*width:23.023731587561375%}.row-fluid .span2{width:14.52991452991453%;*width:14.476723040552828%}.row-fluid .span1{width:5.982905982905983%;*width:5.929714493544281%}.row-fluid .offset12{margin-left:105.12820512820512%;*margin-left:105.02182214948171%}.row-fluid .offset12:first-child{margin-left:102.56410256410257%;*margin-left:102.45771958537915%}.row-fluid .offset11{margin-left:96.58119658119658%;*margin-left:96.47481360247316%}.row-fluid .offset11:first-child{margin-left:94.01709401709402%;*margin-left:93.91071103837061%}.row-fluid .offset10{margin-left:88.03418803418803%;*margin-left:87.92780505546462%}.row-fluid .offset10:first-child{margin-left:85.47008547008548%;*margin-left:85.36370249136206%}.row-fluid .offset9{margin-left:79.48717948717949%;*margin-left:79.38079650845607%}.row-fluid .offset9:first-child{margin-left:76.92307692307693%;*margin-left:76.81669394435352%}.row-fluid .offset8{margin-left:70.94017094017094%;*margin-left:70.83378796144753%}.row-fluid .offset8:first-child{margin-left:68.37606837606839%;*margin-left:68.26968539734497%}.row-fluid .offset7{margin-left:62.393162393162385%;*margin-left:62.28677941443899%}.row-fluid .offset7:first-child{margin-left:59.82905982905982%;*margin-left:59.72267685033642%}.row-fluid .offset6{margin-left:53.84615384615384%;*margin-left:53.739770867430444%}.row-fluid .offset6:first-child{margin-left:51.28205128205128%;*margin-left:51.175668303327875%}.row-fluid .offset5{margin-left:45.299145299145295%;*margin-left:45.1927623204219%}.row-fluid .offset5:first-child{margin-left:42.73504273504273%;*margin-left:42.62865975631933%}.row-fluid .offset4{margin-left:36.75213675213675%;*margin-left:36.645753773413354%}.row-fluid .offset4:first-child{margin-left:34.18803418803419%;*margin-left:34.081651209310785%}.row-fluid .offset3{margin-left:28.205128205128204%;*margin-left:28.0987452264048%}.row-fluid .offset3:first-child{margin-left:25.641025641025642%;*margin-left:25.53464266230224%}.row-fluid .offset2{margin-left:19.65811965811966%;*margin-left:19.551736679396257%}.row-fluid .offset2:first-child{margin-left:17.094017094017094%;*margin-left:16.98763411529369%}.row-fluid .offset1{margin-left:11.11111111111111%;*margin-left:11.004728132387708%}.row-fluid .offset1:first-child{margin-left:8.547008547008547%;*margin-left:8.440625568285142%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:30px}input.span12,textarea.span12,.uneditable-input.span12{width:1156px}input.span11,textarea.span11,.uneditable-input.span11{width:1056px}input.span10,textarea.span10,.uneditable-input.span10{width:956px}input.span9,textarea.span9,.uneditable-input.span9{width:856px}input.span8,textarea.span8,.uneditable-input.span8{width:756px}input.span7,textarea.span7,.uneditable-input.span7{width:656px}input.span6,textarea.span6,.uneditable-input.span6{width:556px}input.span5,textarea.span5,.uneditable-input.span5{width:456px}input.span4,textarea.span4,.uneditable-input.span4{width:356px}input.span3,textarea.span3,.uneditable-input.span3{width:256px}input.span2,textarea.span2,.uneditable-input.span2{width:156px}input.span1,textarea.span1,.uneditable-input.span1{width:56px}.thumbnails{margin-left:-30px}.thumbnails>li{margin-left:30px}.row-fluid .thumbnails{margin-left:0}}@media(min-width:768px) and (max-width:979px){.row{margin-left:-20px;*zoom:1}.row:before,.row:after{display:table;line-height:0;content:""}.row:after{clear:both}[class*="span"]{float:left;min-height:1px;margin-left:20px}.container,.navbar-static-top .container,.navbar-fixed-top .container,.navbar-fixed-bottom .container{width:724px}.span12{width:724px}.span11{width:662px}.span10{width:600px}.span9{width:538px}.span8{width:476px}.span7{width:414px}.span6{width:352px}.span5{width:290px}.span4{width:228px}.span3{width:166px}.span2{width:104px}.span1{width:42px}.offset12{margin-left:764px}.offset11{margin-left:702px}.offset10{margin-left:640px}.offset9{margin-left:578px}.offset8{margin-left:516px}.offset7{margin-left:454px}.offset6{margin-left:392px}.offset5{margin-left:330px}.offset4{margin-left:268px}.offset3{margin-left:206px}.offset2{margin-left:144px}.offset1{margin-left:82px}.row-fluid{width:100%;*zoom:1}.row-fluid:before,.row-fluid:after{display:table;line-height:0;content:""}.row-fluid:after{clear:both}.row-fluid [class*="span"]{display:block;float:left;width:100%;min-height:30px;margin-left:2.7624309392265194%;*margin-left:2.709239449864817%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="span"]:first-child{margin-left:0}.row-fluid .controls-row [class*="span"]+[class*="span"]{margin-left:2.7624309392265194%}.row-fluid .span12{width:100%;*width:99.94680851063829%}.row-fluid .span11{width:91.43646408839778%;*width:91.38327259903608%}.row-fluid .span10{width:82.87292817679558%;*width:82.81973668743387%}.row-fluid .span9{width:74.30939226519337%;*width:74.25620077583166%}.row-fluid .span8{width:65.74585635359117%;*width:65.69266486422946%}.row-fluid .span7{width:57.18232044198895%;*width:57.12912895262725%}.row-fluid .span6{width:48.61878453038674%;*width:48.56559304102504%}.row-fluid .span5{width:40.05524861878453%;*width:40.00205712942283%}.row-fluid .span4{width:31.491712707182323%;*width:31.43852121782062%}.row-fluid .span3{width:22.92817679558011%;*width:22.87498530621841%}.row-fluid .span2{width:14.3646408839779%;*width:14.311449394616199%}.row-fluid .span1{width:5.801104972375691%;*width:5.747913483013988%}.row-fluid .offset12{margin-left:105.52486187845304%;*margin-left:105.41847889972962%}.row-fluid .offset12:first-child{margin-left:102.76243093922652%;*margin-left:102.6560479605031%}.row-fluid .offset11{margin-left:96.96132596685082%;*margin-left:96.8549429881274%}.row-fluid .offset11:first-child{margin-left:94.1988950276243%;*margin-left:94.09251204890089%}.row-fluid .offset10{margin-left:88.39779005524862%;*margin-left:88.2914070765252%}.row-fluid .offset10:first-child{margin-left:85.6353591160221%;*margin-left:85.52897613729868%}.row-fluid .offset9{margin-left:79.8342541436464%;*margin-left:79.72787116492299%}.row-fluid .offset9:first-child{margin-left:77.07182320441989%;*margin-left:76.96544022569647%}.row-fluid .offset8{margin-left:71.2707182320442%;*margin-left:71.16433525332079%}.row-fluid .offset8:first-child{margin-left:68.50828729281768%;*margin-left:68.40190431409427%}.row-fluid .offset7{margin-left:62.70718232044199%;*margin-left:62.600799341718584%}.row-fluid .offset7:first-child{margin-left:59.94475138121547%;*margin-left:59.838368402492065%}.row-fluid .offset6{margin-left:54.14364640883978%;*margin-left:54.037263430116376%}.row-fluid .offset6:first-child{margin-left:51.38121546961326%;*margin-left:51.27483249088986%}.row-fluid .offset5{margin-left:45.58011049723757%;*margin-left:45.47372751851417%}.row-fluid .offset5:first-child{margin-left:42.81767955801105%;*margin-left:42.71129657928765%}.row-fluid .offset4{margin-left:37.01657458563536%;*margin-left:36.91019160691196%}.row-fluid .offset4:first-child{margin-left:34.25414364640884%;*margin-left:34.14776066768544%}.row-fluid .offset3{margin-left:28.45303867403315%;*margin-left:28.346655695309746%}.row-fluid .offset3:first-child{margin-left:25.69060773480663%;*margin-left:25.584224756083227%}.row-fluid .offset2{margin-left:19.88950276243094%;*margin-left:19.783119783707537%}.row-fluid .offset2:first-child{margin-left:17.12707182320442%;*margin-left:17.02068884448102%}.row-fluid .offset1{margin-left:11.32596685082873%;*margin-left:11.219583872105325%}.row-fluid .offset1:first-child{margin-left:8.56353591160221%;*margin-left:8.457152932878806%}input,textarea,.uneditable-input{margin-left:0}.controls-row [class*="span"]+[class*="span"]{margin-left:20px}input.span12,textarea.span12,.uneditable-input.span12{width:710px}input.span11,textarea.span11,.uneditable-input.span11{width:648px}input.span10,textarea.span10,.uneditable-input.span10{width:586px}input.span9,textarea.span9,.uneditable-input.span9{width:524px}input.span8,textarea.span8,.uneditable-input.span8{width:462px}input.span7,textarea.span7,.uneditable-input.span7{width:400px}input.span6,textarea.span6,.uneditable-input.span6{width:338px}input.span5,textarea.span5,.uneditable-input.span5{width:276px}input.span4,textarea.span4,.uneditable-input.span4{width:214px}input.span3,textarea.span3,.uneditable-input.span3{width:152px}input.span2,textarea.span2,.uneditable-input.span2{width:90px}input.span1,textarea.span1,.uneditable-input.span1{width:28px}}@media(max-width:767px){body{padding-right:20px;padding-left:20px}.navbar-fixed-top,.navbar-fixed-bottom,.navbar-static-top{margin-right:-20px;margin-left:-20px}.container-fluid{padding:0}.dl-horizontal dt{float:none;width:auto;clear:none;text-align:left}.dl-horizontal dd{margin-left:0}.container{width:auto}.row-fluid{width:100%}.row,.thumbnails{margin-left:0}.thumbnails>li{float:none;margin-left:0}[class*="span"],.uneditable-input[class*="span"],.row-fluid [class*="span"]{display:block;float:none;width:100%;margin-left:0;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.span12,.row-fluid .span12{width:100%;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.row-fluid [class*="offset"]:first-child{margin-left:0}.input-large,.input-xlarge,.input-xxlarge,input[class*="span"],select[class*="span"],textarea[class*="span"],.uneditable-input{display:block;width:100%;min-height:30px;-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}.input-prepend input,.input-append input,.input-prepend input[class*="span"],.input-append input[class*="span"]{display:inline-block;width:auto}.controls-row [class*="span"]+[class*="span"]{margin-left:0}.modal{position:fixed;top:20px;right:20px;left:20px;width:auto;margin:0}.modal.fade{top:-100px}.modal.fade.in{top:20px}}@media(max-width:480px){.nav-collapse{-webkit-transform:translate3d(0,0,0)}.page-header h1 small{display:block;line-height:20px}input[type="checkbox"],input[type="radio"]{border:1px solid #ccc}.form-horizontal .control-label{float:none;width:auto;padding-top:0;text-align:left}.form-horizontal .controls{margin-left:0}.form-horizontal .control-list{padding-top:0}.form-horizontal .form-actions{padding-right:10px;padding-left:10px}.media .pull-left,.media .pull-right{display:block;float:none;margin-bottom:10px}.media-object{margin-right:0;margin-left:0}.modal{top:10px;right:10px;left:10px}.modal-header .close{padding:10px;margin:-10px}.carousel-caption{position:static}}@media(max-width:979px){body{padding-top:0}.navbar-fixed-top,.navbar-fixed-bottom{position:static}.navbar-fixed-top{margin-bottom:20px}.navbar-fixed-bottom{margin-top:20px}.navbar-fixed-top .navbar-inner,.navbar-fixed-bottom .navbar-inner{padding:5px}.navbar .container{width:auto;padding:0}.navbar .brand{padding-right:10px;padding-left:10px;margin:0 0 0 -5px}.nav-collapse{clear:both}.nav-collapse .nav{float:none;margin:0 0 10px}.nav-collapse .nav>li{float:none}.nav-collapse .nav>li>a{margin-bottom:2px}.nav-collapse .nav>.divider-vertical{display:none}.nav-collapse .nav .nav-header{color:#777;text-shadow:none}.nav-collapse .nav>li>a,.nav-collapse .dropdown-menu a{padding:9px 15px;font-weight:bold;color:#777;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px}.nav-collapse .btn{padding:4px 10px 4px;font-weight:normal;-webkit-border-radius:4px;-moz-border-radius:4px;border-radius:4px}.nav-collapse .dropdown-menu li+li a{margin-bottom:2px}.nav-collapse .nav>li>a:hover,.nav-collapse .dropdown-menu a:hover{background-color:#f2f2f2}.navbar-inverse .nav-collapse .nav>li>a,.navbar-inverse .nav-collapse .dropdown-menu a{color:#999}.navbar-inverse .nav-collapse .nav>li>a:hover,.navbar-inverse .nav-collapse .dropdown-menu a:hover{background-color:#111}.nav-collapse.in .btn-group{padding:0;margin-top:5px}.nav-collapse .dropdown-menu{position:static;top:auto;left:auto;display:none;float:none;max-width:none;padding:0;margin:0 15px;background-color:transparent;border:0;-webkit-border-radius:0;-moz-border-radius:0;border-radius:0;-webkit-box-shadow:none;-moz-box-shadow:none;box-shadow:none}.nav-collapse .open>.dropdown-menu{display:block}.nav-collapse .dropdown-menu:before,.nav-collapse .dropdown-menu:after{display:none}.nav-collapse .dropdown-menu .divider{display:none}.nav-collapse .nav>li>.dropdown-menu:before,.nav-collapse .nav>li>.dropdown-menu:after{display:none}.nav-collapse .navbar-form,.nav-collapse .navbar-search{float:none;padding:10px 15px;margin:10px 0;border-top:1px solid #f2f2f2;border-bottom:1px solid #f2f2f2;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);-moz-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}.navbar-inverse .nav-collapse .navbar-form,.navbar-inverse .nav-collapse .navbar-search{border-top-color:#111;border-bottom-color:#111}.navbar .nav-collapse .nav.pull-right{float:none;margin-left:0}.nav-collapse,.nav-collapse.collapse{height:0;overflow:hidden}.navbar .btn-navbar{display:block}.navbar-static .navbar-inner{padding-right:10px;padding-left:10px}}@media(min-width:980px){.nav-collapse.collapse{height:auto!important;overflow:visible!important}}
6.1 Binary file launcher/src/main/resources/org/apidesign/bck2brwsr/dew/img/glyphicons-halflings-white.png has changed
7.1 Binary file launcher/src/main/resources/org/apidesign/bck2brwsr/dew/img/glyphicons-halflings.png has changed
8.1 Binary file launcher/src/main/resources/org/apidesign/bck2brwsr/dew/img/html5.png has changed
9.1 Binary file launcher/src/main/resources/org/apidesign/bck2brwsr/dew/img/java.png has changed
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
10.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/index.html Tue Jan 15 15:56:45 2013 +0100
10.3 @@ -0,0 +1,59 @@
10.4 +<!--
10.5 +To change this template, choose Tools | Templates
10.6 +and open the template in the editor.
10.7 +-->
10.8 +<!DOCTYPE html>
10.9 +<html lang="en" ng-app="bck2brwsr" ng-controller="DevCtrl">
10.10 + <head>
10.11 + <title>Back2Browser - DEW</title>
10.12 + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
10.13 + <meta name="viewport" content="width=device-width, initial-scale=1.0">
10.14 + <link rel="stylesheet" href="css/bootstrap-combined.min.css"/>
10.15 + <link rel="stylesheet" href="js/codemirror/codemirror.css">
10.16 + <link rel="stylesheet" href="js/codemirror/theme/elegant.css"/>
10.17 + <link rel="stylesheet" href="css/app.css"/>
10.18 + </head>
10.19 + <body>
10.20 + <div class="container">
10.21 + <div class="breadcrumb"><h4 class="text-info">Java and HTML5 <small>- Together at Last!</small></h4></div>
10.22 +
10.23 + <ul class="nav nav-tabs">
10.24 + <li ng-class="tabActive('html')" ng-click="tab='html'"><a href="#"><i class="ic-html5"></i> HTML5</a></li>
10.25 + <li ng-class="tabActive('java')" ng-click="tab='java'"><a href="#"><i class="ic-java"></i> Java</a></li>
10.26 + </ul>
10.27 +
10.28 +
10.29 + <div ng-switch on="tab">
10.30 + <div ng-switch-when="html">
10.31 + <textarea ui-codemirror='{ lineNumbers : true, mode : "xml", theme : "elegant", matchBrackets : true, lineWrapping : true }' ng-model="$parent.html"></textarea>
10.32 + <div class="alert alert-error" ng-show="doc.modelError">
10.33 + <small>{{doc.modelError.toString()}}</small>
10.34 + </div>
10.35 + </div>
10.36 + <div ng-switch-when="java">
10.37 + <textarea ui-codemirror='{ lineNumbers : true, mode : "text/x-java", theme : "elegant", matchBrackets : true, lineWrapping : true }' ng-model="$parent.java"></textarea>
10.38 + <div class="alert alert-error" ng-show="doc.modelError">
10.39 + <small>{{doc.modelError.toString()}}</small>
10.40 + </div>
10.41 + </div>
10.42 + </div>
10.43 +
10.44 + <div> </div>
10.45 +
10.46 + <ul class="nav nav-tabs">
10.47 + <li ng-class="'active'"><a href="#">Result</a></li>
10.48 + </ul>
10.49 +
10.50 + <iframe id="result" frameborder="0" scrolling="no" width="100%" style="height: max-content; overflow: hidden; border: 1px solid #DFDFDF;" src="">
10.51 + <p>Your browser does not support iframes.</p>
10.52 + </iframe>
10.53 +
10.54 + </div>
10.55 +
10.56 + <script src="js/angular/angular.min.js"></script>
10.57 + <script src="js/codemirror/codemirror.js"></script>
10.58 + <script src="js/codemirror/mode/xml.js"></script>
10.59 + <script src="js/codemirror/mode/clike.js"></script>
10.60 + <script src="js/app.js"></script>
10.61 + </body>
10.62 +</html>
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
11.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/angular/angular.min.js Tue Jan 15 15:56:45 2013 +0100
11.3 @@ -0,0 +1,159 @@
11.4 +/*
11.5 + AngularJS v1.0.3
11.6 + (c) 2010-2012 Google, Inc. http://angularjs.org
11.7 + License: MIT
11.8 +*/
11.9 +(function(U,ca,p){'use strict';function m(b,a,c){var d;if(b)if(N(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!==m)b.forEach(a,c);else if(L(b)&&wa(b.length))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 lb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function ec(b,a,c){for(var d=lb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}
11.10 +function mb(b){return function(a,c){b(c,a)}}function xa(){for(var b=Z.length,a;b;){b--;a=Z[b].charCodeAt(0);if(a==57)return Z[b]="A",Z.join("");if(a==90)Z[b]="0";else return Z[b]=String.fromCharCode(a+1),Z.join("")}Z.unshift("0");return Z.join("")}function x(b){m(arguments,function(a){a!==b&&m(a,function(a,d){b[d]=a})});return b}function G(b){return parseInt(b,10)}function ya(b,a){return x(new (x(function(){},{prototype:b})),a)}function D(){}function ma(b){return b}function I(b){return function(){return b}}
11.11 +function t(b){return typeof b=="undefined"}function v(b){return typeof b!="undefined"}function L(b){return b!=null&&typeof b=="object"}function F(b){return typeof b=="string"}function wa(b){return typeof b=="number"}function na(b){return Sa.apply(b)=="[object Date]"}function J(b){return Sa.apply(b)=="[object Array]"}function N(b){return typeof b=="function"}function oa(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function R(b){return F(b)?b.replace(/^\s*/,"").replace(/\s*$/,""):b}function fc(b){return b&&
11.12 +(b.nodeName||b.bind&&b.find)}function Ta(b,a,c){var d=[];m(b,function(b,g,i){d.push(a.call(c,b,g,i))});return d}function gc(b,a){var c=0,d;if(J(b)||F(b))return b.length;else if(L(b))for(d in b)(!a||b.hasOwnProperty(d))&&c++;return c}function za(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 Ua(b,a){var c=za(b,a);c>=0&&b.splice(c,1);return a}function V(b,a){if(oa(b)||b&&b.$evalAsync&&b.$watch)throw B("Can't copy Window or Scope");if(a){if(b===
11.13 +a)throw B("Can't copy equivalent objects or arrays");if(J(b)){for(;a.length;)a.pop();for(var c=0;c<b.length;c++)a.push(V(b[c]))}else for(c in m(a,function(b,c){delete a[c]}),b)a[c]=V(b[c])}else(a=b)&&(J(b)?a=V(b,[]):na(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 ha(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&&
11.14 +c=="object")if(J(b)){if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ha(b[d],a[d]))return!1;return!0}}else if(na(b))return na(a)&&b.getTime()==a.getTime();else{if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||oa(b)||oa(a))return!1;c={};for(d in b){if(d.charAt(0)!=="$"&&!N(b[d])&&!ha(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c[d]&&d.charAt(0)!=="$"&&!N(a[d]))return!1;return!0}return!1}function Va(b,a){var c=arguments.length>2?ia.call(arguments,2):[];return N(a)&&!(a instanceof RegExp)?c.length?
11.15 +function(){return arguments.length?a.apply(b,c.concat(ia.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=p:oa(a)?c="$WINDOW":a&&ca===a?c="$DOCUMENT":a&&a.$evalAsync&&a.$watch&&(c="$SCOPE");return c}function da(b,a){return JSON.stringify(b,ic,a?" ":null)}function nb(b){return F(b)?JSON.parse(b):b}function Wa(b){b&&b.length!==0?(b=E(""+b),b=!(b=="f"||b=="0"||b=="false"||b=="no"||b=="n"||b=="[]")):b=!1;
11.16 +return b}function pa(b){b=u(b).clone();try{b.html("")}catch(a){}return u("<div>").append(b).html().match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+E(b)})}function Xa(b){var a={},c,d;m((b||"").split("&"),function(b){b&&(c=b.split("="),d=decodeURIComponent(c[0]),a[d]=v(c[1])?decodeURIComponent(c[1]):!0)});return a}function ob(b){var a=[];m(b,function(b,d){a.push(Ya(d,!0)+(b===!0?"":"="+Ya(b,!0)))});return a.length?a.join("&"):""}function Za(b){return Ya(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,
11.17 +"=").replace(/%2B/gi,"+")}function Ya(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(a?null:/%20/g,"+")}function jc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,i=["ng:app","ng-app","x-ng-app","data-ng-app"],f=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;m(i,function(a){i[a]=!0;c(ca.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(m(b.querySelectorAll("."+a),c),m(b.querySelectorAll("."+a+"\\:"),c),m(b.querySelectorAll("["+
11.18 +a+"]"),c))});m(d,function(a){if(!e){var b=f.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):m(a.attributes,function(b){if(!e&&i[b.name])e=a,g=b.value})}});e&&a(e,g?[g]:[])}function pb(b,a){b=u(b);a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");var c=qb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,i){a.$apply(function(){b.data("$injector",i);c(b)(a)})}]);return c}function $a(b,a){a=a||"_";return b.replace(kc,
11.19 +function(b,d){return(d?a:"")+b.toLowerCase()})}function qa(b,a,c){if(!b)throw new B("Argument '"+(a||"?")+"' is "+(c||"required"));return b}function ra(b,a,c){c&&J(b)&&(b=b[b.length-1]);qa(N(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,
11.20 +d,e){return function(){b[e||"push"]([c,d,arguments]);return j}}if(!e)throw B("No module: "+d);var b=[],c=[],k=a("$injector","invoke"),j={_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:k,run:function(a){c.push(a);
11.21 +return this}};g&&k(g);return j})}})}function rb(b){return b.replace(mc,function(a,b,d,e){return e?d.toUpperCase():d}).replace(nc,"Moz$1")}function ab(b,a){function c(){var e;for(var b=[this],c=a,i,f,h,k,j,l;b.length;){i=b.shift();f=0;for(h=i.length;f<h;f++){k=u(i[f]);c?k.triggerHandler("$destroy"):c=!c;j=0;for(e=(l=k.children()).length,k=e;j<k;j++)b.push(ja(l[j]))}}return d.apply(this,arguments)}var d=ja.fn[b],d=d.$original||d;c.$original=d;ja.fn[b]=c}function Q(b){if(b instanceof Q)return b;if(!(this instanceof
11.22 +Q)){if(F(b)&&b.charAt(0)!="<")throw B("selectors not implemented");return new Q(b)}if(F(b)){var a=ca.createElement("div");a.innerHTML="<div> </div>"+b;a.removeChild(a.firstChild);bb(this,a.childNodes);this.remove()}else bb(this,b)}function cb(b){return b.cloneNode(!0)}function sa(b){sb(b);for(var a=0,b=b.childNodes||[];a<b.length;a++)sa(b[a])}function tb(b,a,c){var d=$(b,"events");$(b,"handle")&&(t(a)?m(d,function(a,c){db(b,c,a);delete d[c]}):t(c)?(db(b,a,d[a]),delete d[a]):Ua(d[a],c))}function sb(b){var a=
11.23 +b[Aa],c=Ba[a];c&&(c.handle&&(c.events.$destroy&&c.handle({},"$destroy"),tb(b)),delete Ba[a],b[Aa]=p)}function $(b,a,c){var d=b[Aa],d=Ba[d||-1];if(v(c))d||(b[Aa]=d=++oc,d=Ba[d]={}),d[a]=c;else return d&&d[a]}function ub(b,a,c){var d=$(b,"data"),e=v(c),g=!e&&v(a),i=g&&!L(a);!d&&!i&&$(b,"data",d={});if(e)d[a]=c;else if(g)if(i)return d&&d[a];else x(d,a);else return d}function Ca(b,a){return(" "+b.className+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" ")>-1}function vb(b,a){a&&m(a.split(" "),function(a){b.className=
11.24 +R((" "+b.className+" ").replace(/[\n\t]/g," ").replace(" "+R(a)+" "," "))})}function wb(b,a){a&&m(a.split(" "),function(a){if(!Ca(b,a))b.className=R(b.className+" "+R(a))})}function bb(b,a){if(a)for(var a=!a.nodeName&&v(a.length)&&!oa(a)?a:[a],c=0;c<a.length;c++)b.push(a[c])}function xb(b,a){return Da(b,"$"+(a||"ngController")+"Controller")}function Da(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 yb(b,a){var c=Ea[a.toLowerCase()];
11.25 +return c&&zb[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||ca;if(t(c.defaultPrevented)){var g=c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;g.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented};m(a[e||c.type],function(a){a.call(b,c)});aa<=8?(c.preventDefault=null,
11.26 +c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function ga(b){var a=typeof b,c;if(a=="object"&&b!==null)if(typeof(c=b.$$hashKey)=="function")c=b.$$hashKey();else{if(c===p)c=b.$$hashKey=xa()}else c=b;return a+":"+c}function Fa(b){m(b,this.put,this)}function eb(){}function Ab(b){var a,c;if(typeof b=="function"){if(!(a=b.$inject))a=[],c=b.toString().replace(qc,""),c=c.match(rc),m(c[1].split(sc),function(b){b.replace(tc,
11.27 +function(b,c,d){a.push(d)})}),b.$inject=a}else J(b)?(c=b.length-1,ra(b[c],"fn"),a=b.slice(0,c)):ra(b,"fn",!0);return a}function qb(b){function a(a){return function(b,c){if(L(b))m(b,mb(a));else return a(b,c)}}function c(a,b){N(b)&&(b=l.instantiate(b));if(!b.$get)throw B("Provider "+a+" must define $get factory method.");return j[a+f]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[];m(a,function(a){if(!k.get(a))if(k.put(a,!0),F(a)){var c=ta(a);b=b.concat(e(c.requires)).concat(c._runBlocks);
11.28 +try{for(var d=c._invokeQueue,c=0,f=d.length;c<f;c++){var h=d[c],g=h[0]=="$injector"?l:l.get(h[0]);g[h[1]].apply(g,h[2])}}catch(n){throw n.message&&(n.message+=" from "+a),n;}}else if(N(a))try{b.push(l.invoke(a))}catch(i){throw i.message&&(i.message+=" from "+a),i;}else if(J(a))try{b.push(l.invoke(a))}catch(j){throw j.message&&(j.message+=" from "+String(a[a.length-1])),j;}else ra(a,"module")});return b}function g(a,b){function c(d){if(typeof d!=="string")throw B("Service name expected");if(a.hasOwnProperty(d)){if(a[d]===
11.29 +i)throw B("Circular dependency: "+h.join(" <- "));return a[d]}else try{return h.unshift(d),a[d]=i,a[d]=b(d)}finally{h.shift()}}function d(a,b,e){var f=[],k=Ab(a),g,n,i;n=0;for(g=k.length;n<g;n++)i=k[n],f.push(e&&e.hasOwnProperty(i)?e[i]:c(i,h));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],
11.30 +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=(J(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return L(e)?e:c},get:c,annotate:Ab}}var i={},f="Provider",h=[],k=new Fa,j={$provide:{provider:a(c),
11.31 +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){j[a]=b;o[a]=b}),decorator:function(a,b){var c=l.get(a+f),d=c.$get;c.$get=function(){var a=r.invoke(d,c);return r.invoke(b,null,{$delegate:a})}}}},l=g(j,function(){throw B("Unknown provider: "+h.join(" <- "));}),o={},r=o.$injector=g(o,function(a){a=l.get(a+f);return r.invoke(a.$get,a)});m(e(b),function(a){r.invoke(a||D)});return r}function uc(){var b=
11.32 +!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;m(a,function(a){!b&&E(a.nodeName)==="a"&&(b=a)});return b}function g(){var b=c.hash(),d;b?(d=i.getElementById(b))?d.scrollIntoView():(d=e(i.getElementsByName(b)))?d.scrollIntoView():b==="top"&&a.scrollTo(0,0):a.scrollTo(0,0)}var i=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,
11.33 +ia.call(arguments,1))}finally{if(n--,n===0)for(;w.length;)try{w.pop()()}catch(b){c.error(b)}}}function g(a,b){(function ea(){m(q,function(a){a()});s=b(ea,a)})()}function i(){O!=f.url()&&(O=f.url(),m(A,function(a){a(f.url())}))}var f=this,h=a[0],k=b.location,j=b.history,l=b.setTimeout,o=b.clearTimeout,r={};f.isMock=!1;var n=0,w=[];f.$$completeOutstandingRequest=e;f.$$incOutstandingRequestCount=function(){n++};f.notifyWhenNoOutstandingRequests=function(a){m(q,function(a){a()});n===0?a():w.push(a)};
11.34 +var q=[],s;f.addPollFn=function(a){t(s)&&g(100,l);q.push(a);return a};var O=k.href,C=a.find("base");f.url=function(a,b){if(a){if(O!=a)return O=a,d.history?b?j.replaceState(null,"",a):(j.pushState(null,"",a),C.attr("href",C.attr("href"))):b?k.replace(a):k.href=a,f}else return k.href.replace(/%27/g,"'")};var A=[],K=!1;f.onUrlChange=function(a){K||(d.history&&u(b).bind("popstate",i),d.hashchange?u(b).bind("hashchange",i):f.addPollFn(i),K=!0);A.push(a);return a};f.baseHref=function(){var a=C.attr("href");
11.35 +return a?a.replace(/^https?\:\/\/[^\/]*/,""):a};var W={},y="",M=f.baseHref();f.cookies=function(a,b){var d,e,f,k;if(a)if(b===p)h.cookie=escape(a)+"=;path="+M+";expires=Thu, 01 Jan 1970 00:00:00 GMT";else{if(F(b))d=(h.cookie=escape(a)+"="+escape(b)+";path="+M).length+1,d>4096&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"),W.length>20&&c.warn("Cookie '"+a+"' possibly not set or overflowed because too many cookies were already set ("+W.length+
11.36 +" > 20 )")}else{if(h.cookie!==y){y=h.cookie;d=y.split("; ");W={};for(f=0;f<d.length;f++)e=d[f],k=e.indexOf("="),k>0&&(W[unescape(e.substring(0,k))]=unescape(e.substring(k+1)))}return W}};f.defer=function(a,b){var c;n++;c=l(function(){delete r[c];e(a)},b||0);r[c]=!0;return c};f.defer.cancel=function(a){return r[a]?(delete r[a],o(a),e(D),!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,
11.37 +d){function e(a){if(a!=l){if(o){if(o==a)o=a.n}else o=a;g(a.n,a.p);g(a,l);l=a;l.n=null}}function g(a,b){if(a!=b){if(a)a.p=b;if(b)b.n=a}}if(b in a)throw B("cacheId "+b+" taken");var i=0,f=x({},d,{id:b}),h={},k=d&&d.capacity||Number.MAX_VALUE,j={},l=null,o=null;return a[b]={put:function(a,b){var c=j[a]||(j[a]={key:a});e(c);t(b)||(a in h||i++,h[a]=b,i>k&&this.remove(o.key))},get:function(a){var b=j[a];if(b)return e(b),h[a]},remove:function(a){var b=j[a];if(b){if(b==l)l=b.p;if(b==o)o=b.n;g(b.n,b.p);delete j[a];
11.38 +delete h[a];i--}},removeAll:function(){h={};i=0;j={};l=o=null},destroy:function(){j=f=h=null;delete a[b]},info:function(){return x({},f,{size:i})}}}var a={};b.info=function(){var b={};m(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 Bb(b){var a={},c="Directive",d=/^\s*directive\:\s*([\d\w\-_]+)\s+(.*)$/,e=/(([\d\w\-_]+)(?:\:([^;]+))?;?)/,g="Template must have exactly one root element. was: ";
11.39 +this.directive=function f(d,e){F(d)?(qa(e,"directive"),a.hasOwnProperty(d)||(a[d]=[],b.factory(d+c,["$injector","$exceptionHandler",function(b,c){var e=[];m(a[d],function(a){try{var f=b.invoke(a);if(N(f))f={compile:I(f)};else if(!f.compile&&f.link)f.compile=I(f.link);f.priority=f.priority||0;f.name=f.name||d;f.require=f.require||f.controller&&f.name;f.restrict=f.restrict||"A";e.push(f)}catch(k){c(k)}});return e}])),a[d].push(e)):m(d,mb(f));return this};this.$get=["$injector","$interpolate","$exceptionHandler",
11.40 +"$http","$templateCache","$parse","$controller","$rootScope",function(b,h,k,j,l,o,r,n){function w(a,b,c){a instanceof u||(a=u(a));m(a,function(b,c){b.nodeType==3&&(a[c]=u(b).wrap("<span></span>").parent()[0])});var d=s(a,b,a,c);return function(b,c){qa(b,"scope");var e=c?ua.clone.call(a):a;e.data("$scope",b);q(e,"ng-scope");c&&c(e,b);d&&d(b,e,e);return e}}function q(a,b){try{a.addClass(b)}catch(c){}}function s(a,b,c,d){function e(a,c,d,k){for(var g,h,j,n,o,l=0,r=0,q=f.length;l<q;r++)j=c[r],g=f[l++],
11.41 +h=f[l++],g?(g.scope?(n=a.$new(L(g.scope)),u(j).data("$scope",n)):n=a,(o=g.transclude)||!k&&b?g(h,n,j,d,function(b){return function(c){var d=a.$new();return b(d,c).bind("$destroy",Va(d,d.$destroy))}}(o||b)):g(h,n,j,p,k)):h&&h(a,j.childNodes,p,k)}for(var f=[],k,g,h,j=0;j<a.length;j++)g=new ea,k=O(a[j],[],g,d),g=(k=k.length?C(k,a[j],g,b,c):null)&&k.terminal||!a[j].childNodes.length?null:s(a[j].childNodes,k?k.transclude:b),f.push(k),f.push(g),h=h||k||g;return h?e:null}function O(a,b,c,f){var k=c.$attr,
11.42 +g;switch(a.nodeType){case 1:A(b,fa(Cb(a).toLowerCase()),"E",f);var h,j,n;g=a.attributes;for(var o=0,l=g&&g.length;o<l;o++)if(h=g[o],h.specified)j=h.name,n=fa(j.toLowerCase()),k[n]=j,c[n]=h=R(aa&&j=="href"?decodeURIComponent(a.getAttribute(j,2)):h.value),yb(a,n)&&(c[n]=!0),X(a,b,h,n),A(b,n,"A",f);a=a.className;if(F(a)&&a!=="")for(;g=e.exec(a);)n=fa(g[2]),A(b,n,"C",f)&&(c[n]=R(g[3])),a=a.substr(g.index+g[0].length);break;case 3:H(b,a.nodeValue);break;case 8:try{if(g=d.exec(a.nodeValue))n=fa(g[1]),A(b,
11.43 +n,"M",f)&&(c[n]=R(g[2]))}catch(r){}}b.sort(y);return b}function C(a,b,c,d,e){function f(a,b){if(a)a.require=z.require,l.push(a);if(b)b.require=z.require,ba.push(b)}function h(a,b){var c,d="data",e=!1;if(F(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 B("No controller: "+a);}else J(a)&&(c=[],m(a,function(a){c.push(h(a,b))}));return c}function j(a,d,e,f,g){var n,q,w,K,s;n=b===e?c:hc(c,new ea(u(e),c.$attr));q=n.$$element;
11.44 +if(C){var zc=/^\s*([@=&])\s*(\w*)\s*$/,O=d.$parent||d;m(C.scope,function(a,b){var c=a.match(zc)||[],e=c[2]||b,f,g,k;switch(c[1]){case "@":n.$observe(e,function(a){d[b]=a});n.$$observers[e].$$scope=O;break;case "=":g=o(n[e]);k=g.assign||function(){f=d[b]=g(O);throw B(Db+n[e]+" (directive: "+C.name+")");};f=d[b]=g(O);d.$watch(function(){var a=g(O);a!==d[b]&&(a!==f?f=d[b]=a:k(O,a=f=d[b]));return a});break;case "&":g=o(n[e]);d[b]=function(a){return g(O,a)};break;default:throw B("Invalid isolate scope definition for directive "+
11.45 +C.name+": "+a);}})}t&&m(t,function(a){var b={$scope:d,$element:q,$attrs:n,$transclude:g};s=a.controller;s=="@"&&(s=n[a.name]);q.data("$"+a.name+"Controller",r(s,b))});f=0;for(w=l.length;f<w;f++)try{K=l[f],K(d,q,n,K.require&&h(K.require,q))}catch(y){k(y,pa(q))}a&&a(d,e.childNodes,p,g);f=0;for(w=ba.length;f<w;f++)try{K=ba[f],K(d,q,n,K.require&&h(K.require,q))}catch(Ha){k(Ha,pa(q))}}for(var n=-Number.MAX_VALUE,l=[],ba=[],s=null,C=null,A=null,y=c.$$element=u(b),z,H,X,D,v=d,t,x,Y,E=0,G=a.length;E<G;E++){z=
11.46 +a[E];X=p;if(n>z.priority)break;if(Y=z.scope)M("isolated scope",C,z,y),L(Y)&&(q(y,"ng-isolate-scope"),C=z),q(y,"ng-scope"),s=s||z;H=z.name;if(Y=z.controller)t=t||{},M("'"+H+"' controller",t[H],z,y),t[H]=z;if(Y=z.transclude)M("transclusion",D,z,y),D=z,n=z.priority,Y=="element"?(X=u(b),y=c.$$element=u("<\!-- "+H+": "+c[H]+" --\>"),b=y[0],Ga(e,u(X[0]),b),v=w(X,d,n)):(X=u(cb(b)).contents(),y.html(""),v=w(X,d));if(Y=z.template)if(M("template",A,z,y),A=z,Y=Ha(Y),z.replace){X=u("<div>"+R(Y)+"</div>").contents();
11.47 +b=X[0];if(X.length!=1||b.nodeType!==1)throw new B(g+Y);Ga(e,y,b);H={$attr:{}};a=a.concat(O(b,a.splice(E+1,a.length-(E+1)),H));K(c,H);G=a.length}else y.html(Y);if(z.templateUrl)M("template",A,z,y),A=z,j=W(a.splice(E,a.length-E),j,y,c,e,z.replace,v),G=a.length;else if(z.compile)try{x=z.compile(y,c,v),N(x)?f(null,x):x&&f(x.pre,x.post)}catch(I){k(I,pa(y))}if(z.terminal)j.terminal=!0,n=Math.max(n,z.priority)}j.scope=s&&s.scope;j.transclude=D&&v;return j}function A(d,e,g,h){var j=!1;if(a.hasOwnProperty(e))for(var n,
11.48 +e=b.get(e+c),o=0,l=e.length;o<l;o++)try{if(n=e[o],(h===p||h>n.priority)&&n.restrict.indexOf(g)!=-1)d.push(n),j=!0}catch(r){k(r)}return j}function K(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;m(a,function(d,e){e.charAt(0)!="$"&&(b[e]&&(d+=(e==="style"?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});m(b,function(b,f){f=="class"?(q(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):f=="style"?e.attr("style",e.attr("style")+";"+b):f.charAt(0)!="$"&&!a.hasOwnProperty(f)&&(a[f]=b,d[f]=c[f])})}function W(a,b,c,d,e,
11.49 +f,k){var h=[],n,o,r=c[0],q=a.shift(),w=x({},q,{controller:null,templateUrl:null,transclude:null,scope:null});c.html("");j.get(q.templateUrl,{cache:l}).success(function(j){var l,q,j=Ha(j);if(f){q=u("<div>"+R(j)+"</div>").contents();l=q[0];if(q.length!=1||l.nodeType!==1)throw new B(g+j);j={$attr:{}};Ga(e,c,l);O(l,a,j);K(d,j)}else l=r,c.html(j);a.unshift(w);n=C(a,c,d,k);for(o=s(c.contents(),k);h.length;){var ba=h.pop(),j=h.pop();q=h.pop();var y=h.pop(),m=l;q!==r&&(m=cb(l),Ga(j,u(q),m));n(function(){b(o,
11.50 +y,m,e,ba)},y,m,e,ba)}h=null}).error(function(a,b,c,d){throw B("Failed to load template: "+d.url);});return function(a,c,d,e,f){h?(h.push(c),h.push(d),h.push(e),h.push(f)):n(function(){b(o,c,d,e,f)},c,d,e,f)}}function y(a,b){return b.priority-a.priority}function M(a,b,c,d){if(b)throw B("Multiple directives ["+b.name+", "+c.name+"] asking for "+a+" on: "+pa(d));}function H(a,b){var c=h(b,!0);c&&a.push({priority:0,compile:I(function(a,b){var d=b.parent(),e=d.data("$binding")||[];e.push(c);q(d.data("$binding",
11.51 +e),"ng-binding");a.$watch(c,function(a){b[0].nodeValue=a})})})}function X(a,b,c,d){var e=h(c,!0);e&&b.push({priority:100,compile:I(function(a,b,c){b=c.$$observers||(c.$$observers={});d==="class"&&(e=h(c[d],!0));c[d]=p;(b[d]||(b[d]=[])).$$inter=!0;(c.$$observers&&c.$$observers[d].$$scope||a).$watch(e,function(a){c.$set(d,a)})})})}function Ga(a,b,c){var d=b[0],e=d.parentNode,f,g;if(a){f=0;for(g=a.length;f<g;f++)if(a[f]==d){a[f]=c;break}}e&&e.replaceChild(c,d);c[u.expando]=d[u.expando];b[0]=c}var ea=
11.52 +function(a,b){this.$$element=a;this.$attr=b||{}};ea.prototype={$normalize:fa,$set:function(a,b,c,d){var e=yb(this.$$element[0],a),f=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,"-"));c!==!1&&(b===null||b===p?this.$$element.removeAttr(d):this.$$element.attr(d,b));f&&m(f[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);n.$evalAsync(function(){e.$$inter||
11.53 +b(c[a])});return b}};var D=h.startSymbol(),ba=h.endSymbol(),Ha=D=="{{"||ba=="}}"?ma:function(a){return a.replace(/\{\{/g,D).replace(/}}/g,ba)};return w}]}function fa(b){return rb(b.replace(Ac,""))}function Bc(){var b={};this.register=function(a,c){L(a)?x(b,a):b[a]=c};this.$get=["$injector","$window",function(a,c){return function(d,e){if(F(d)){var g=d,d=b.hasOwnProperty(g)?b[g]:fb(e.$scope,g,!0)||fb(c,g,!0);ra(d,g,!0)}return a.instantiate(d,e)}}]}function Cc(){this.$get=["$window",function(b){return u(b.document)}]}
11.54 +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 h,k,j=0,l=[],o=d.length,r=!1,n=[];j<o;)(h=d.indexOf(b,j))!=-1&&(k=d.indexOf(a,h+e))!=-1?(j!=h&&l.push(d.substring(j,h)),l.push(j=c(r=d.substring(h+e,k))),j.exp=r,j=k+g,r=!0):(j!=o&&l.push(d.substring(j)),j=o);if(!(o=
11.55 +l.length))l.push(""),o=1;if(!f||r)return n.length=o,j=function(a){for(var b=0,c=o,d;b<c;b++){if(typeof(d=l[b])=="function")d=d(a),d==null||d==p?d="":typeof d!="string"&&(d=da(d));n[b]=d}return n.join("")},j.exp=d,j.parts=l,j}var e=b.length,g=a.length;d.startSymbol=function(){return b};d.endSymbol=function(){return a};return d}]}function Eb(b){for(var b=b.split("/"),a=b.length;a--;)b[a]=Za(b[a]);return b.join("/")}function va(b,a){var c=Fb.exec(b),c={protocol:c[1],host:c[3],port:G(c[5])||Gb[c[1]]||
11.56 +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 ka(b,a,c){return b+"://"+a+(c==Gb[b]?"":":"+c)}function Fc(b,a,c){var d=va(b);return decodeURIComponent(d.path)!=a||t(d.hash)||d.hash.indexOf(c)!==0?b:ka(d.protocol,d.host,d.port)+a.substr(0,a.lastIndexOf("/"))+d.hash.substr(c.length)}function Gc(b,a,c){var d=va(b);if(decodeURIComponent(d.path)==a)return b;else{var e=d.search&&"?"+d.search||"",g=d.hash&&"#"+d.hash||"",i=a.substr(0,
11.57 +a.lastIndexOf("/")),f=d.path.substr(i.length);if(d.path.indexOf(i)!==0)throw B('Invalid url "'+b+'", missing path prefix "'+i+'" !');return ka(d.protocol,d.host,d.port)+a+"#"+c+f+e+g}}function gb(b,a,c){a=a||"";this.$$parse=function(b){var c=va(b,this);if(c.path.indexOf(a)!==0)throw B('Invalid url "'+b+'", missing path prefix "'+a+'" !');this.$$path=decodeURIComponent(c.path.substr(a.length));this.$$search=Xa(c.search);this.$$hash=c.hash&&decodeURIComponent(c.hash)||"";this.$$compose()};this.$$compose=
11.58 +function(){var b=ob(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Eb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(this.$$protocol,this.$$host,this.$$port)+a+this.$$url};this.$$rewriteAppUrl=function(a){if(a.indexOf(c)==0)return a};this.$$parse(b)}function Ia(b,a,c){var d;this.$$parse=function(b){var c=va(b,this);if(c.hash&&c.hash.indexOf(a)!==0)throw B('Invalid url "'+b+'", missing hash prefix "'+a+'" !');d=c.path+(c.search?"?"+c.search:"");c=Hc.exec((c.hash||"").substr(a.length));
11.59 +this.$$path=c[1]?(c[1].charAt(0)=="/"?"":"/")+decodeURIComponent(c[1]):"";this.$$search=Xa(c[3]);this.$$hash=c[5]&&decodeURIComponent(c[5])||"";this.$$compose()};this.$$compose=function(){var b=ob(this.$$search),c=this.$$hash?"#"+Za(this.$$hash):"";this.$$url=Eb(this.$$path)+(b?"?"+b:"")+c;this.$$absUrl=ka(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 Hb(b,a,c,d){Ia.apply(this,arguments);
11.60 +this.$$rewriteAppUrl=function(b){if(b.indexOf(c)==0)return c+d+"#"+a+b.substr(c.length)}}function Ja(b){return function(){return this[b]}}function Ib(b,a){return function(c){if(t(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Ic(){var b="",a=!1;this.hashPrefix=function(a){return v(a)?(b=a,this):b};this.html5Mode=function(b){return v(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,g){function i(a){c.$broadcast("$locationChangeSuccess",
11.61 +f.absUrl(),a)}var f,h,k,j=d.url(),l=va(j);a?(h=d.baseHref()||"/",k=h.substr(0,h.lastIndexOf("/")),l=ka(l.protocol,l.host,l.port)+k+"/",f=e.history?new gb(Fc(j,h,b),k,l):new Hb(Gc(j,h,b),b,l,h.substr(k.length+1))):(l=ka(l.protocol,l.host,l.port)+(l.path||"")+(l.search?"?"+l.search:"")+"#"+b+"/",f=new Ia(j,b,l));g.bind("click",function(a){if(!a.ctrlKey&&!(a.metaKey||a.which==2)){for(var b=u(a.target);E(b[0].nodeName)!=="a";)if(b[0]===g[0]||!(b=b.parent())[0])return;var d=b.prop("href"),e=f.$$rewriteAppUrl(d);
11.62 +d&&!b.attr("target")&&e&&(f.$$parse(e),c.$apply(),a.preventDefault(),U.angular["ff-684208-preventDefault"]=!0)}});f.absUrl()!=j&&d.url(f.absUrl(),!0);d.onUrlChange(function(a){f.absUrl()!=a&&(c.$evalAsync(function(){var b=f.absUrl();f.$$parse(a);i(b)}),c.$$phase||c.$digest())});var o=0;c.$watch(function(){var a=d.url(),b=f.$$replace;if(!o||a!=f.absUrl())o++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",f.absUrl(),a).defaultPrevented?f.$$parse(a):(d.url(f.absUrl(),b),i(a))});f.$$replace=
11.63 +!1;return o});return f}]}function Jc(){this.$get=["$window",function(b){function a(a){a instanceof B&&(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||D;return g.apply?function(){var b=[];m(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,
11.64 +a){function c(a){return a.indexOf(q)!=-1}function d(){return n+1<b.length?b.charAt(n+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 i(a){return"a"<=a&&a<="z"||"A"<=a&&a<="Z"||"_"==a||a=="$"}function f(a){return a=="-"||a=="+"||e(a)}function h(a,c,d){d=d||n;throw B("Lexer Error: "+a+" at column"+(v(c)?"s "+c+"-"+n+" ["+b.substring(c,d)+"]":" "+d)+" in expression ["+b+"].");}function k(){for(var a="",c=n;n<b.length;){var k=
11.65 +E(b.charAt(n));if(k=="."||e(k))a+=k;else{var g=d();if(k=="e"&&f(g))a+=k;else if(f(k)&&g&&e(g)&&a.charAt(a.length-1)=="e")a+=k;else if(f(k)&&(!g||!e(g))&&a.charAt(a.length-1)=="e")h("Invalid exponent");else break}n++}a*=1;o.push({index:c,text:a,json:!0,fn:function(){return a}})}function j(){for(var c="",d=n,f,k,h;n<b.length;){var j=b.charAt(n);if(j=="."||i(j)||e(j))j=="."&&(f=n),c+=j;else break;n++}if(f)for(k=n;k<b.length;){j=b.charAt(k);if(j=="("){h=c.substr(f-d+1);c=c.substr(0,f-d);n=k;break}if(g(j))k++;
11.66 +else break}d={index:d,text:c};if(Ka.hasOwnProperty(c))d.fn=d.json=Ka[c];else{var l=Jb(c,a);d.fn=x(function(a,b){return l(a,b)},{assign:function(a,b){return Kb(a,c,b)}})}o.push(d);h&&(o.push({index:f,text:".",json:!1}),o.push({index:f+1,text:h,json:!1}))}function l(a){var c=n;n++;for(var d="",e=a,f=!1;n<b.length;){var k=b.charAt(n);e+=k;if(f)k=="u"?(k=b.substring(n+1,n+5),k.match(/[\da-f]{4}/i)||h("Invalid unicode escape [\\u"+k+"]"),n+=4,d+=String.fromCharCode(parseInt(k,16))):(f=Lc[k],d+=f?f:k),
11.67 +f=!1;else if(k=="\\")f=!0;else if(k==a){n++;o.push({index:c,text:e,string:d,json:!0,fn:function(){return d}});return}else d+=k;n++}h("Unterminated quote",c)}for(var o=[],r,n=0,w=[],q,s=":";n<b.length;){q=b.charAt(n);if(c("\"'"))l(q);else if(e(q)||c(".")&&e(d()))k();else if(i(q)){if(j(),"{,".indexOf(s)!=-1&&w[0]=="{"&&(r=o[o.length-1]))r.json=r.text.indexOf(".")==-1}else if(c("(){}[].,;:"))o.push({index:n,text:q,json:":[,".indexOf(s)!=-1&&c("{[")||c("}]:,")}),c("{[")&&w.unshift(q),c("}]")&&w.shift(),
11.68 +n++;else if(g(q)){n++;continue}else{var m=q+d(),C=Ka[q],A=Ka[m];A?(o.push({index:n,text:m,fn:A}),n+=2):C?(o.push({index:n,text:q,fn:C,json:"[,:".indexOf(s)!=-1&&c("+-")}),n+=1):h("Unexpected next character ",n,n+1)}s=q}return o}function Mc(b,a,c,d){function e(a,c){throw B("Syntax Error: Token '"+c.text+"' "+a+" at column "+(c.index+1)+" of the expression ["+b+"] starting at ["+b.substring(c.index)+"].");}function g(){if(M.length===0)throw B("Unexpected end of expression: "+b);return M[0]}function i(a,
11.69 +b,c,d){if(M.length>0){var e=M[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=i(b,c,d,f))?(a&&!b.json&&e("is not valid json",b),M.shift(),b):!1}function h(a){f(a)||e("is unexpected, expecting ["+a+"]",i())}function k(a,b){return function(c,d){return a(c,d,b)}}function j(a,b,c){return function(d,e){return b(d,e,a,c)}}function l(){for(var a=[];;)if(M.length>0&&!i("}",")",";","]")&&a.push(v()),!f(";"))return a.length==1?a[0]:function(b,c){for(var d,
11.70 +e=0;e<a.length;e++){var f=a[e];f&&(d=f(b,c))}return d}}function o(){for(var a=f(),b=c(a.text),d=[];;)if(a=f(":"))d.push(H());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 r(){for(var a=n(),b;;)if(b=f("||"))a=j(a,b.fn,n());else return a}function n(){var a=w(),b;if(b=f("&&"))a=j(a,b.fn,n());return a}function w(){var a=q(),b;if(b=f("==","!="))a=j(a,b.fn,w());return a}function q(){var a;a=s();for(var b;b=f("+",
11.71 +"-");)a=j(a,b.fn,s());if(b=f("<",">","<=",">="))a=j(a,b.fn,q());return a}function s(){for(var a=m(),b;b=f("*","/","%");)a=j(a,b.fn,m());return a}function m(){var a;return f("+")?C():(a=f("-"))?j(W,a.fn,m()):(a=f("!"))?k(a.fn,m()):C()}function C(){var a;if(f("("))a=v(),h(")");else if(f("["))a=A();else if(f("{"))a=K();else{var b=f();(a=b.fn)||e("not a primary expression",b)}for(var c;b=f("(","[",".");)b.text==="("?(a=u(a,c),c=null):b.text==="["?(c=a,a=ea(a)):b.text==="."?(c=a,a=t(a)):e("IMPOSSIBLE");
11.72 +return a}function A(){var a=[];if(g().text!="]"){do a.push(H());while(f(","))}h("]");return function(b,c){for(var d=[],e=0;e<a.length;e++)d.push(a[e](b,c));return d}}function K(){var a=[];if(g().text!="}"){do{var b=f(),b=b.string||b.text;h(":");var c=H();a.push({key:b,value:c})}while(f(","))}h("}");return function(b,c){for(var d={},e=0;e<a.length;e++){var f=a[e],k=f.value(b,c);d[f.key]=k}return d}}var W=I(0),y,M=Kc(b,d),H=function(){var a=r(),c,d;return(d=f("="))?(a.assign||e("implies assignment but ["+
11.73 +b.substring(0,d.index)+"] can not be assigned to",d),c=r(),function(b,d){return a.assign(b,c(b,d),d)}):a},u=function(a,b){var c=[];if(g().text!=")"){do c.push(H());while(f(","))}h(")");return function(d,e){for(var f=[],k=b?b(d,e):d,h=0;h<c.length;h++)f.push(c[h](d,e));h=a(d,e)||D;return h.apply?h.apply(k,f):h(f[0],f[1],f[2],f[3],f[4])}},t=function(a){var b=f().text,c=Jb(b,d);return x(function(b,d){return c(a(b,d),d)},{assign:function(c,d,e){return Kb(a(c,e),b,d)}})},ea=function(a){var b=H();h("]");
11.74 +return x(function(c,d){var e=a(c,d),f=b(c,d),k;if(!e)return p;if((e=e[f])&&e.then){k=e;if(!("$$v"in e))k.$$v=p,k.then(function(a){k.$$v=a});e=e.$$v}return e},{assign:function(c,d,e){return a(c,e)[b(c,e)]=d}})},v=function(){for(var a=H(),b;;)if(b=f("|"))a=j(a,b.fn,o());else return a};a?(H=r,u=t=ea=v=function(){e("is not valid json",{text:b,index:0})},y=C()):y=l();M.length!==0&&e("is an unexpected token",M[0]);return y}function Kb(b,a,c){for(var a=a.split("."),d=0;a.length>1;d++){var e=a.shift(),g=
11.75 +b[e];g||(g={},b[e]=g);b=g}return b[a.shift()]=c}function fb(b,a,c){if(!a)return b;for(var a=a.split("."),d,e=b,g=a.length,i=0;i<g;i++)d=a[i],b&&(b=(e=b)[d]);return!c&&N(b)?Va(e,b):b}function Lb(b,a,c,d,e){return function(g,i){var f=i&&i.hasOwnProperty(b)?i:g,h;if(f===null||f===p)return f;if((f=f[b])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!a||f===null||f===p)return f;if((f=f[a])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!c||f===
11.76 +null||f===p)return f;if((f=f[c])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!d||f===null||f===p)return f;if((f=f[d])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}if(!e||f===null||f===p)return f;if((f=f[e])&&f.then){if(!("$$v"in f))h=f,h.$$v=p,h.then(function(a){h.$$v=a});f=f.$$v}return f}}function Jb(b,a){if(hb.hasOwnProperty(b))return hb[b];var c=b.split("."),d=c.length,e;if(a)e=d<6?Lb(c[0],c[1],c[2],c[3],c[4]):function(a,b){var e=0,
11.77 +k;do k=Lb(c[e++],c[e++],c[e++],c[e++],c[e++])(a,b),b=p,a=k;while(e<d);return k};else{var g="var l, fn, p;\n";m(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 hb[b]=e}function Nc(){var b={};this.$get=["$filter","$sniffer",
11.78 +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 D}}}]}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 i(a)}var e=function(){var f=[],h,k;return k={resolve:function(a){if(f){var c=f;f=p;h=g(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],h.then(a[0],
11.79 +a[1])})}},reject:function(a){k.resolve(i(a))},promise:{then:function(b,k){var g=e(),i=function(d){try{g.resolve((b||c)(d))}catch(e){a(e),g.reject(e)}},n=function(b){try{g.resolve((k||d)(b))}catch(c){a(c),g.reject(c)}};f?f.push([i,n]):h.then(i,n);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}}},i=function(a){return{then:function(c,k){var g=e();b(function(){g.resolve((k||d)(a))});return g.promise}}};return{defer:e,reject:i,
11.80 +when:function(f,h,k){var j=e(),l,o=function(b){try{return(h||c)(b)}catch(d){return a(d),i(d)}},r=function(b){try{return(k||d)(b)}catch(c){return a(c),i(c)}};b(function(){g(f).then(function(a){l||(l=!0,j.resolve(g(a).then(o,r)))},function(a){l||(l=!0,j.resolve(r(a)))})});return j.promise},all:function(a){var b=e(),c=a.length,d=[];c?m(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=
11.81 +function(a,c){b[a]=x({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,i,f){function h(){var b=k(),h=r.current;if(b&&h&&b.$route===h.$route&&ha(b.pathParams,h.pathParams)&&!b.reloadOnSearch&&!o)h.params=b.params,V(h.params,d),a.$broadcast("$routeUpdate",h);else if(b||
11.82 +h)o=!1,a.$broadcast("$routeChangeStart",b,h),(r.current=b)&&b.redirectTo&&(F(b.redirectTo)?c.path(j(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;m(b.resolve||{},function(b,d){a.push(d);c.push(F(b)?g.get(b):g.invoke(b))});if(!v(d=b.template))if(v(d=b.templateUrl))d=i.get(d,{cache:f}).then(function(a){return a.data});v(d)&&(a.push("$template"),c.push(d));return e.all(c).then(function(b){var c=
11.83 +{};m(b,function(b,d){c[a[d]]=b});return c})}}).then(function(c){if(b==r.current){if(b)b.locals=c,V(b.params,d);a.$broadcast("$routeChangeSuccess",b,h)}},function(c){b==r.current&&a.$broadcast("$routeChangeError",b,h,c)})}function k(){var a,d;m(b,function(b,e){if(!d&&(a=l(c.path(),e)))d=ya(b,{params:x({},c.search(),a),pathParams:a}),d.$route=b});return d||b[null]&&ya(b[null],{params:{},pathParams:{}})}function j(a,b){var c=[];m((a||"").split(":"),function(a,d){if(d==0)c.push(a);else{var e=a.match(/(\w+)(.*)/),
11.84 +f=e[1];c.push(b[f]);c.push(e[2]||"");delete b[f]}});return c.join("")}var l=function(a,b){var c="^"+b.replace(/([\.\\\(\)\^\$])/g,"\\$1")+"$",d=[],e={};m(b.split(/\W/),function(a){if(a){var b=RegExp(":"+a+"([\\W])");c.match(b)&&(c=c.replace(b,"([^\\/]*)$1"),d.push(a))}});var f=a.match(RegExp(c));f&&m(d,function(a,b){e[a]=f[b+1]});return f?e:null},o=!1,r={routes:b,reload:function(){o=!0;a.$evalAsync(h)}};a.$on("$locationChangeSuccess",h);return r}]}function Rc(){this.$get=I({})}function Sc(){var b=
11.85 +10;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse",function(a,c,d){function e(){this.$id=xa();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$asyncQueue=[];this.$$listeners={}}function g(a){if(h.$$phase)throw B(h.$$phase+" already in progress");h.$$phase=a}function i(a,b){var c=d(a);ra(c,b);return c}function f(){}e.prototype={$new:function(a){if(N(a))throw B("API-CHANGE: Use $controller to instantiate controllers.");
11.86 +a?(a=new e,a.$root=this.$root):(a=function(){},a.prototype=this,a=new a,a.$id=xa());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=i(a,"watch"),e=this.$$watchers,g={fn:b,last:f,get:d,exp:a,eq:!!c};if(!N(b)){var h=i(b||D,"listener");g.fn=function(a,b,
11.87 +c){h(c)}}if(!e)e=this.$$watchers=[];e.unshift(g);return function(){Ua(e,g)}},$digest:function(){var a,d,e,i,r,n,m,q=b,s,p=[],C,A;g("$digest");do{m=!1;s=this;do{for(r=s.$$asyncQueue;r.length;)try{s.$eval(r.shift())}catch(K){c(K)}if(i=s.$$watchers)for(n=i.length;n--;)try{if(a=i[n],(d=a.get(s))!==(e=a.last)&&!(a.eq?ha(d,e):typeof d=="number"&&typeof e=="number"&&isNaN(d)&&isNaN(e)))m=!0,a.last=a.eq?V(d):d,a.fn(d,e===f?d:e,s),q<5&&(C=4-q,p[C]||(p[C]=[]),A=N(a.exp)?"fn: "+(a.exp.name||a.exp.toString()):
11.88 +a.exp,A+="; newVal: "+da(d)+"; oldVal: "+da(e),p[C].push(A))}catch(W){c(W)}if(!(i=s.$$childHead||s!==this&&s.$$nextSibling))for(;s!==this&&!(i=s.$$nextSibling);)s=s.$parent}while(s=i);if(m&&!q--)throw h.$$phase=null,B(b+" $digest() iterations reached. Aborting!\nWatchers fired in the last 5 iterations: "+da(p));}while(m||r.length);h.$$phase=null},$destroy:function(){if(h!=this){var a=this.$parent;this.$broadcast("$destroy");if(a.$$childHead==this)a.$$childHead=this.$$nextSibling;if(a.$$childTail==
11.89 +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{h.$$phase=null;try{h.$digest()}catch(d){throw c(d),d;}}},
11.90 +$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);return function(){c[za(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},i=[h].concat(ia.call(arguments,1)),m,p;do{e=f.$$listeners[a]||d;h.currentScope=f;m=0;for(p=e.length;m<p;m++)if(e[m])try{if(e[m].apply(null,i),g)return h}catch(C){c(C)}else e.splice(m,1),m--,p--;f=f.$parent}while(f);
11.91 +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(ia.call(arguments,1)),h,i;do{d=e;f.currentScope=d;e=d.$$listeners[a]||[];h=0;for(i=e.length;h<i;h++)if(e[h])try{e[h].apply(null,g)}catch(m){c(m)}else e.splice(h,1),h--,i--;if(!(e=d.$$childHead||d!==this&&d.$$nextSibling))for(;d!==this&&!(e=d.$$nextSibling);)d=d.$parent}while(d=e);return f}};var h=new e;return h}]}function Tc(){this.$get=
11.92 +["$window",function(b){var a={},c=G((/android (\d+)/.exec(E(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"&&aa==9)return!1;if(t(a[c])){var e=b.document.createElement("div");a[c]="on"+c in e}return a[c]},csp:!1}}]}function Uc(){this.$get=I(U)}function Mb(b){var a={},c,d,e;if(!b)return a;m(b.split("\n"),function(b){e=b.indexOf(":");c=E(R(b.substr(0,
11.93 +e)));d=R(b.substr(e+1));c&&(a[c]?a[c]+=", "+d:a[c]=d)});return a}function Nb(b){var a=L(b)?b:p;return function(c){a||(a=Mb(b));return c?a[E(c)]||null:a}}function Ob(b,a,c){if(N(c))return c(b,a);m(c,function(c){b=c(b,a)});return b}function Vc(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d=this.defaults={transformResponse:[function(d){F(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=nb(d,!0)));return d}],transformRequest:[function(a){return L(a)&&Sa.apply(a)!=="[object File]"?da(a):a}],
11.94 +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,h,k,j){function l(a){function c(a){var b=x({},a,{data:Ob(a.data,a.headers,f)});return 200<=a.status&&a.status<300?b:k.reject(b)}a.method=la(a.method);var e=a.transformRequest||
11.95 +d.transformRequest,f=a.transformResponse||d.transformResponse,h=d.headers,h=x({"X-XSRF-TOKEN":b.cookies()["XSRF-TOKEN"]},h.common,h[E(a.method)],a.headers),e=Ob(a.data,Nb(h),e),g;t(a.data)&&delete h["Content-Type"];g=o(a,e,h);g=g.then(c,c);m(w,function(a){g=a(g)});g.success=function(b){g.then(function(c){b(c.data,c.status,c.headers,a)});return g};g.error=function(b){g.then(null,function(c){b(c.data,c.status,c.headers,a)});return g};return g}function o(b,c,d){function e(a,b,c){m&&(200<=a&&a<300?m.put(w,
11.96 +[a,b,Mb(c)]):m.remove(w));f(b,a,c);h.$apply()}function f(a,c,d){c=Math.max(c,0);(200<=c&&c<300?j.resolve:j.reject)({data:a,status:c,headers:Nb(d),config:b})}function i(){var a=za(l.pendingRequests,b);a!==-1&&l.pendingRequests.splice(a,1)}var j=k.defer(),o=j.promise,m,p,w=r(b.url,b.params);l.pendingRequests.push(b);o.then(i,i);b.cache&&b.method=="GET"&&(m=L(b.cache)?b.cache:n);if(m)if(p=m.get(w))if(p.then)return p.then(i,i),p;else J(p)?f(p[1],p[0],V(p[2])):f(p,200,{});else m.put(w,o);p||a(b.method,
11.97 +w,c,e,d,b.timeout,b.withCredentials);return o}function r(a,b){if(!b)return a;var c=[];ec(b,function(a,b){a==null||a==p||(L(a)&&(a=da(a)),c.push(encodeURIComponent(b)+"="+encodeURIComponent(a)))});return a+(a.indexOf("?")==-1?"?":"&")+c.join("&")}var n=c("$http"),w=[];m(e,function(a){w.push(F(a)?j.get(a):j.invoke(a))});l.pendingRequests=[];(function(a){m(arguments,function(a){l[a]=function(b,c){return l(x(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){m(arguments,function(a){l[a]=
11.98 +function(b,c,d){return l(x(d||{},{method:a,url:b,data:c}))}})})("post","put");l.defaults=d;return l}]}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 i(a,b){var c=e.createElement("script"),d=function(){e.body.removeChild(c);b&&b()};c.type="text/javascript";c.src=a;aa?c.onreadystatechange=function(){/loaded|complete/.test(c.readyState)&&d()}:c.onload=c.onerror=
11.99 +d;e.body.appendChild(c)}return function(e,h,k,j,l,o,r){function n(a,c,d,e){c=(h.match(Fb)||["",g])[1]=="file"?d?200:404:c;a(c==1223?204:c,d,e);b.$$completeOutstandingRequest(D)}b.$$incOutstandingRequestCount();h=h||b.url();if(E(e)=="jsonp"){var p="_"+(d.counter++).toString(36);d[p]=function(a){d[p].data=a};i(h.replace("JSON_CALLBACK","angular.callbacks."+p),function(){d[p].data?n(j,200,d[p].data):n(j,-2);delete d[p]})}else{var q=new a;q.open(e,h,!0);m(l,function(a,b){a&&q.setRequestHeader(b,a)});
11.100 +var s;q.onreadystatechange=function(){q.readyState==4&&n(j,s||q.status,q.responseText,q.getAllResponseHeaders())};if(r)q.withCredentials=!0;q.send(k||"");o>0&&c(function(){s=-1;q.abort()},o)}}}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:"$"},
11.101 +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",
11.102 +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,h){var k=c.defer(),j=k.promise,l=v(h)&&!h,f=a.defer(function(){try{k.resolve(e())}catch(a){k.reject(a),d(a)}l||b.$apply()},f),h=function(){delete g[j.$$timeoutId]};j.$$timeoutId=f;g[f]=k;j.then(h,h);return j}var g={};e.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),a.defer.cancel(b.$$timeoutId)):
11.103 +!1};return e}]}function Pb(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",Qb);a("date",Rb);a("filter",ad);a("json",bd);a("limitTo",cd);a("lowercase",dd);a("number",Sb);a("orderBy",Tb);a("uppercase",ed)}function ad(){return function(b,a){if(!(b instanceof Array))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)===
11.104 +"!")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=
11.105 +(""+a[e]).toLowerCase();f&&c.push(function(a){return d(fb(a,b),f)})}();break;case "function":c.push(a);break;default:return b}for(var g=[],i=0;i<b.length;i++){var f=b[i];c.check(f)&&g.push(f)}return g}}function Qb(b){var a=b.NUMBER_FORMATS;return function(b,d){if(t(d))d=a.CURRENCY_SYM;return Ub(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Sb(b){var a=b.NUMBER_FORMATS;return function(b,d){return Ub(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Ub(b,a,c,d,e){if(isNaN(b)||
11.106 +!isFinite(b))return"";var g=b<0,b=Math.abs(b),i=b+"",f="",h=[],k=!1;if(i.indexOf("e")!==-1){var j=i.match(/([\d\.]+)e(-?)(\d+)/);j&&j[2]=="-"&&j[3]>e+1?i="0":(f=i,k=!0)}if(!k){i=(i.split(Vb)[1]||"").length;t(e)&&(e=Math.min(Math.max(a.minFrac,i),a.maxFrac));var i=Math.pow(10,e),b=Math.round(b*i)/i,b=(""+b).split(Vb),i=b[0],b=b[1]||"",k=0,j=a.lgSize,l=a.gSize;if(i.length>=j+l)for(var k=i.length-j,o=0;o<k;o++)(k-o)%l===0&&o!==0&&(f+=c),f+=i.charAt(o);for(o=k;o<i.length;o++)(i.length-o)%j===0&&o!==0&&
11.107 +(f+=c),f+=i.charAt(o);for(;b.length<e;)b+="0";e&&(f+=d+b.substr(0,e))}h.push(g?a.negPre:a.posPre);h.push(f);h.push(g?a.negSuf:a.posSuf);return h.join("")}function ib(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 P(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 ib(e,a,d)}}function La(b,a){return function(c,d){var e=c["get"+b](),g=la(a?"SHORT"+b:b);return d[g][e]}}function Rb(b){function a(a){var b;
11.108 +if(b=a.match(c)){var a=new Date(0),g=0,i=0;b[9]&&(g=G(b[9]+b[10]),i=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)-i,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="",i=[],f,h,e=e||"mediumDate",e=b.DATETIME_FORMATS[e]||e;F(c)&&(c=fd.test(c)?G(c):a(c));wa(c)&&(c=new Date(c));if(!na(c))return c;for(;e;)(h=gd.exec(e))?(i=i.concat(ia.call(h,
11.109 +1)),e=i.pop()):(i.push(e),e=null);m(i,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 Tb(b){return function(a,c,d){function e(a,b){return Wa(b)?
11.110 +function(b,c){return a(c,b)}:a}if(!(a instanceof Array))return a;if(!c)return a;for(var c=J(c)?c:[c],c=Ta(c,function(a){var c=!1,d=a||ma;if(F(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=[],i=0;i<a.length;i++)g.push(a[i]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=
11.111 +c[d](a,b);if(e!==0)return e}return 0},d))}}function S(b){N(b)&&(b={link:b});b.restrict=b.restrict||"AC";return I(b)}function Wb(b,a){function c(a,c){c=c?"-"+$a(c,"-"):"";b.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}var d=this,e=b.parent().controller("form")||Oa,g=0,i=d.$error={};d.$name=a.name;d.$dirty=!1;d.$pristine=!0;d.$valid=!0;d.$invalid=!1;e.$addControl(d);b.addClass(Pa);c(!0);d.$addControl=function(a){a.$name&&!d.hasOwnProperty(a.$name)&&(d[a.$name]=a)};d.$removeControl=function(a){a.$name&&
11.112 +d[a.$name]===a&&delete d[a.$name];m(i,function(b,c){d.$setValidity(c,!0,a)})};d.$setValidity=function(a,b,k){var j=i[a];if(b){if(j&&(Ua(j,k),!j.length)){g--;if(!g)c(b),d.$valid=!0,d.$invalid=!1;i[a]=!1;c(!0,a);e.$setValidity(a,!0,d)}}else{g||c(b);if(j){if(za(j,k)!=-1)return}else i[a]=j=[],g++,c(!1,a),e.$setValidity(a,!1,d);j.push(k);d.$valid=!1;d.$invalid=!0}};d.$setDirty=function(){b.removeClass(Pa).addClass(Xb);d.$dirty=!0;d.$pristine=!1;e.$setDirty()}}function T(b){return t(b)||b===""||b===null||
11.113 +b!==b}function Qa(b,a,c,d,e,g){var i=function(){var c=R(a.val());d.$viewValue!==c&&b.$apply(function(){d.$setViewValue(c)})};if(e.hasEvent("input"))a.bind("input",i);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(){i();f=null}))});a.bind("change",i)}d.$render=function(){a.val(T(d.$viewValue)?"":d.$viewValue)};var h=c.ngPattern,k=function(a,b){return T(b)||a.test(b)?(d.$setValidity("pattern",!0),b):(d.$setValidity("pattern",!1),p)};h&&(h.match(/^\/(.*)\/$/)?
11.114 +(h=RegExp(h.substr(1,h.length-2)),e=function(a){return k(h,a)}):e=function(a){var c=b.$eval(h);if(!c||!c.test)throw new B("Expected "+h+" to be a RegExp but was "+c);return k(c,a)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var j=G(c.ngMinlength),e=function(a){return!T(a)&&a.length<j?(d.$setValidity("minlength",!1),p):(d.$setValidity("minlength",!0),a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var l=G(c.ngMaxlength),c=function(a){return!T(a)&&a.length>l?(d.$setValidity("maxlength",
11.115 +!1),p):(d.$setValidity("maxlength",!0),a)};d.$parsers.push(c);d.$formatters.push(c)}}function jb(b,a){b="ngClass"+b;return S(function(c,d,e){function g(b,d){if(a===!0||c.$index%2===a)d&&b!==d&&i(d),f(b)}function i(a){L(a)&&!J(a)&&(a=Ta(a,function(a,b){if(a)return b}));d.removeClass(J(a)?a.join(" "):a)}function f(a){L(a)&&!J(a)&&(a=Ta(a,function(a,b){if(a)return b}));a&&d.addClass(J(a)?a.join(" "):a)}c.$watch(e[b],g,!0);e.$observe("class",function(){var a=c.$eval(e[b]);g(a,a)});b!=="ngClass"&&c.$watch("$index",
11.116 +function(d,g){var j=d%2;j!==g%2&&(j==a?f(c.$eval(e[b])):i(c.$eval(e[b])))})})}var E=function(b){return F(b)?b.toLowerCase():b},la=function(b){return F(b)?b.toUpperCase():b},B=U.Error,aa=G((/msie (\d+)/.exec(E(navigator.userAgent))||[])[1]),u,ja,ia=[].slice,Ra=[].push,Sa=Object.prototype.toString,Yb=U.angular||(U.angular={}),ta,Cb,Z=["0","0","0"];D.$inject=[];ma.$inject=[];Cb=aa<9?function(b){b=b.nodeName?b:b[0];return b.scopeName&&b.scopeName!="HTML"?la(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?
11.117 +b.nodeName:b[0].nodeName};var kc=/[A-Z]/g,id={full:"1.0.3",major:1,minor:0,dot:3,codeName:"bouncy-thunder"},Ba=Q.cache={},Aa=Q.expando="ng-"+(new Date).getTime(),oc=1,Zb=U.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},db=U.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])/,ua=Q.prototype={ready:function(b){function a(){c||(c=!0,b())}
11.118 +var c=!1;this.bind("DOMContentLoaded",a);Q(U).bind("load",a)},toString:function(){var b=[];m(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:Ra,sort:[].sort,splice:[].splice},Ea={};m("multiple,selected,checked,disabled,readOnly,required".split(","),function(b){Ea[E(b)]=b});var zb={};m("input,select,option,textarea,button,form".split(","),function(b){zb[la(b)]=!0});m({data:ub,inheritedData:Da,scope:function(b){return Da(b,
11.119 +"$scope")},controller:xb,injector:function(b){return Da(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Ca,css:function(b,a,c){a=rb(a);if(v(c))b.style[a]=c;else{var d;aa<=8&&(d=b.currentStyle&&b.currentStyle[a],d===""&&(d="auto"));d=d||b.style[a];aa<=8&&(d=d===""?p:d);return d}},attr:function(b,a,c){var d=E(a);if(Ea[d])if(v(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||D).specified?d:p;else if(v(c))b.setAttribute(a,
11.120 +c);else if(b.getAttribute)return b=b.getAttribute(a,2),b===null?p:b},prop:function(b,a,c){if(v(c))b[a]=c;else return b[a]},text:x(aa<9?function(b,a){if(b.nodeType==1){if(t(a))return b.innerText;b.innerText=a}else{if(t(a))return b.nodeValue;b.nodeValue=a}}:function(b,a){if(t(a))return b.textContent;b.textContent=a},{$dv:""}),val:function(b,a){if(t(a))return b.value;b.value=a},html:function(b,a){if(t(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)sa(d[c]);b.innerHTML=a}},function(b,
11.121 +a){Q.prototype[a]=function(a,d){var e,g;if((b.length==2&&b!==Ca&&b!==xb?a:d)===p)if(L(a)){for(e=0;e<this.length;e++)if(b===ub)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}});m({removeData:sb,dealoc:sa,bind:function a(c,d,e){var g=$(c,"events"),i=$(c,"handle");g||$(c,"events",g={});i||$(c,"handle",i=pc(c,g));m(d.split(" "),function(d){var h=g[d];if(!h){if(d=="mouseenter"||
11.122 +d=="mouseleave"){var k=0;g.mouseenter=[];g.mouseleave=[];a(c,"mouseover",function(a){k++;k==1&&i(a,"mouseenter")});a(c,"mouseout",function(a){k--;k==0&&i(a,"mouseleave")})}else Zb(c,d,i),g[d]=[];h=g[d]}h.push(e)})},unbind:tb,replaceWith:function(a,c){var d,e=a.parentNode;sa(a);m(new Q(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];m(a.childNodes,function(a){a.nodeName!="#text"&&c.push(a)});return c},contents:function(a){return a.childNodes},
11.123 +append:function(a,c){m(new Q(c),function(c){a.nodeType===1&&a.appendChild(c)})},prepend:function(a,c){if(a.nodeType===1){var d=a.firstChild;m(new Q(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;m(new Q(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:wb,removeClass:vb,toggleClass:function(a,
11.124 +c,d){t(d)&&(d=!Ca(a,c));(d?wb:vb)(a,c)},parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},next:function(a){return a.nextSibling},find:function(a,c){return a.getElementsByTagName(c)},clone:cb,triggerHandler:function(a,c){var d=($(a,"events")||{})[c];m(d,function(c){c.call(a,null)})}},function(a,c){Q.prototype[c]=function(c,e){for(var g,i=0;i<this.length;i++)g==p?(g=a(this[i],c,e),g!==p&&(g=u(g))):bb(g,a(this[i],c,e));return g==p?this:g}});Fa.prototype={put:function(a,c){this[ga(a)]=
11.125 +c},get:function(a){return this[ga(a)]},remove:function(a){var c=this[a=ga(a)];delete this[a];return c}};eb.prototype={push:function(a,c){var d=this[a=ga(a)];d?d.push(c):this[a]=[c]},shift:function(a){var c=this[a=ga(a)];if(c)return c.length==1?(delete this[a],c[0]):c.shift()},peek:function(a){if(a=this[ga(a)])return a[0]}};var rc=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,sc=/,/,tc=/^\s*(_?)(\S+?)\1\s*$/,qc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Db="Non-assignable model expression: ";Bb.$inject=["$provide"];
11.126 +var Ac=/^(x[\:\-_]|data[\:\-_])/i,Fb=/^([^:]+):\/\/(\w+:{0,1}\w*@)?([\w\.-]*)(:([0-9]+))?(\/[^\?#]*)?(\?([^#]*))?(#(.*))?$/,$b=/^([^\?#]*)?(\?([^#]*))?(#(.*))?$/,Hc=$b,Gb={http:80,https:443,ftp:21};gb.prototype={$$replace:!1,absUrl:Ja("$$absUrl"),url:function(a,c){if(t(a))return this.$$url;var d=$b.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:Ja("$$protocol"),host:Ja("$$host"),port:Ja("$$port"),path:Ib("$$path",function(a){return a.charAt(0)==
11.127 +"/"?a:"/"+a}),search:function(a,c){if(t(a))return this.$$search;v(c)?c===null?delete this.$$search[a]:this.$$search[a]=c:this.$$search=F(a)?Xa(a):a;this.$$compose();return this},hash:Ib("$$hash",ma),replace:function(){this.$$replace=!0;return this}};Ia.prototype=ya(gb.prototype);Hb.prototype=ya(Ia.prototype);var Ka={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:D,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return v(d)?v(e)?d+e:d:v(e)?e:p},"-":function(a,
11.128 +c,d,e){d=d(a,c);e=e(a,c);return(v(d)?d:0)-(v(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)},"=":D,"==":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,
11.129 +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","'":"'",'"':'"'},hb={},Yc=U.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 new B("This browser does not support XMLHttpRequest.");
11.130 +};Pb.$inject=["$provide"];Qb.$inject=["$locale"];Sb.$inject=["$locale"];var Vb=".",hd={yyyy:P("FullYear",4),yy:P("FullYear",2,0,!0),y:P("FullYear",1),MMMM:La("Month"),MMM:La("Month",!0),MM:P("Month",2,1),M:P("Month",1,1),dd:P("Date",2),d:P("Date",1),HH:P("Hours",2),H:P("Hours",1),hh:P("Hours",2,-12),h:P("Hours",1,-12),mm:P("Minutes",2),m:P("Minutes",1),ss:P("Seconds",2),s:P("Seconds",1),EEEE:La("Day"),EEE:La("Day",!0),a:function(a,c){return a.getHours()<12?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=a.getTimezoneOffset();
11.131 +return ib(a/60,2)+ib(Math.abs(a%60),2)}},gd=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,fd=/^\d+$/;Rb.$inject=["$locale"];var dd=I(E),ed=I(la);Tb.$inject=["$parse"];var jd=I({restrict:"E",compile:function(a,c){c.href||c.$set("href","");return function(a,c){c.bind("click",function(a){if(!c.attr("href"))return a.preventDefault(),!1})}}}),kb={};m(Ea,function(a,c){var d=fa("ng-"+c);kb[d]=function(){return{priority:100,compile:function(){return function(a,g,i){a.$watch(i[d],
11.132 +function(a){i.$set(c,!!a)})}}}}});m(["src","href"],function(a){var c=fa("ng-"+a);kb[c]=function(){return{priority:99,link:function(d,e,g){g.$observe(c,function(c){c&&(g.$set(a,c),aa&&e.prop(a,c))})}}}});var Oa={$addControl:D,$removeControl:D,$setValidity:D,$setDirty:D};Wb.$inject=["$element","$attrs","$scope"];var Ra=function(a){return["$timeout",function(c){var d={name:"form",restrict:"E",controller:Wb,compile:function(){return{pre:function(a,d,i,f){if(!i.action){var h=function(a){a.preventDefault?
11.133 +a.preventDefault():a.returnValue=!1};Zb(d[0],"submit",h);d.bind("$destroy",function(){c(function(){db(d[0],"submit",h)},0,!1)})}var k=d.parent().controller("form"),j=i.name||i.ngForm;j&&(a[j]=f);k&&d.bind("$destroy",function(){k.$removeControl(f);j&&(a[j]=p);x(f,Oa)})}}}};return a?x(V(d),{restrict:"EAC"}):d}]},kd=Ra(),ld=Ra(!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*$/,
11.134 +ac={text:Qa,number:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);e.$parsers.push(function(a){var c=T(a);return c||od.test(a)?(e.$setValidity("number",!0),a===""?null:c?a:parseFloat(a)):(e.$setValidity("number",!1),p)});e.$formatters.push(function(a){return T(a)?"":""+a});if(d.min){var f=parseFloat(d.min),a=function(a){return!T(a)&&a<f?(e.$setValidity("min",!1),p):(e.$setValidity("min",!0),a)};e.$parsers.push(a);e.$formatters.push(a)}if(d.max){var h=parseFloat(d.max),d=function(a){return!T(a)&&a>h?(e.$setValidity("max",
11.135 +!1),p):(e.$setValidity("max",!0),a)};e.$parsers.push(d);e.$formatters.push(d)}e.$formatters.push(function(a){return T(a)||wa(a)?(e.$setValidity("number",!0),a):(e.$setValidity("number",!1),p)})},url:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);a=function(a){return T(a)||md.test(a)?(e.$setValidity("url",!0),a):(e.$setValidity("url",!1),p)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,g,i){Qa(a,c,d,e,g,i);a=function(a){return T(a)||nd.test(a)?(e.$setValidity("email",!0),a):(e.$setValidity("email",
11.136 +!1),p)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){t(d.name)&&c.attr("name",xa());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,i=d.ngFalseValue;F(g)||(g=!0);F(i)||(i=!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===
11.137 +g});e.$parsers.push(function(a){return a?g:i})},hidden:D,button:D,submit:D,reset:D},bc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",link:function(d,e,g,i){i&&(ac[E(g.type)]||ac.text)(d,e,g,i,c,a)}}}],Na="ng-valid",Ma="ng-invalid",Pa="ng-pristine",Xb="ng-dirty",pd=["$scope","$exceptionHandler","$attrs","$element","$parse",function(a,c,d,e,g){function i(a,c){c=c?"-"+$a(c,"-"):"";e.removeClass((a?Ma:Na)+c).addClass((a?Na:Ma)+c)}this.$modelValue=this.$viewValue=Number.NaN;
11.138 +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),h=f.assign;if(!h)throw B(Db+d.ngModel+" ("+pa(e)+")");this.$render=D;var k=e.inheritedData("$formController")||Oa,j=0,l=this.$error={};e.addClass(Pa);i(!0);this.$setValidity=function(a,c){if(l[a]!==!c){if(c){if(l[a]&&j--,!j)i(!0),this.$valid=!0,this.$invalid=!1}else i(!1),this.$invalid=!0,this.$valid=!1,j++;l[a]=!c;i(c,a);k.$setValidity(a,
11.139 +c,this)}};this.$setViewValue=function(d){this.$viewValue=d;if(this.$pristine)this.$dirty=!0,this.$pristine=!1,e.removeClass(Pa).addClass(Xb),k.$setDirty();m(this.$parsers,function(a){d=a(d)});if(this.$modelValue!==d)this.$modelValue=d,h(a,d),m(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};var o=this;a.$watch(function(){var c=f(a);if(o.$modelValue!==c){var d=o.$formatters,e=d.length;for(o.$modelValue=c;e--;)c=d[e](c);if(o.$viewValue!==c)o.$viewValue=c,o.$render()}})}],qd=function(){return{require:["ngModel",
11.140 +"^?form"],controller:pd,link:function(a,c,d,e){var g=e[0],i=e[1]||Oa;i.$addControl(g);c.bind("$destroy",function(){i.$removeControl(g)})}}},rd=I({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),cc=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var g=function(a){if(d.required&&(T(a)||a===!1))e.$setValidity("required",!1);else return e.$setValidity("required",!0),a};e.$formatters.push(g);e.$parsers.unshift(g);
11.141 +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&&m(a.split(g),function(a){a&&c.push(R(a))});return c});e.$formatters.push(function(a){return J(a)?a.join(", "):p})}}},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,
11.142 +c,g){a.$watch(g.ngValue,function(a){g.$set("value",a,!1)})}}}},vd=S(function(a,c,d){c.addClass("ng-binding").data("$binding",d.ngBind);a.$watch(d.ngBind,function(a){c.text(a==p?"":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,
11.143 +function(a){c.html(a||"")})}}],yd=jb("",!0),zd=jb("Odd",0),Ad=jb("Even",1),Bd=S({compile:function(a,c){c.$set("ngCloak",p);a.removeClass("ng-cloak")}}),Cd=[function(){return{scope:!0,controller:"@"}}],Dd=["$sniffer",function(a){return{priority:1E3,compile:function(){a.csp=!0}}}],dc={};m("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave".split(" "),function(a){var c=fa("ng-"+a);dc[c]=["$parse",function(d){return function(e,g,i){var f=d(i[c]);g.bind(E(a),function(a){e.$apply(function(){f(e,
11.144 +{$event:a})})})}}]});var Ed=S(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,i){var f=i.ngInclude||i.src,h=i.onload||"",k=i.autoscroll;return function(g,i){var o=0,m,n=function(){m&&(m.$destroy(),m=null);i.html("")};g.$watch(f,function(f){var p=++o;f?a.get(f,{cache:c}).success(function(a){p===o&&(m&&m.$destroy(),m=g.$new(),i.html(a),e(i.contents())(m),
11.145 +v(k)&&(!k||g.$eval(k))&&d(),m.$emit("$includeContentLoaded"),g.$eval(h))}).error(function(){p===o&&n()}):n()})}}}}],Gd=S({compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),Hd=S({terminal:!0,priority:1E3}),Id=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,g,i){var f=i.count,h=g.attr(i.$attr.when),k=i.offset||0,j=e.$eval(h),l={},o=c.startSymbol(),r=c.endSymbol();m(j,function(a,e){l[e]=c(a.replace(d,o+f+"-"+k+r))});e.$watch(function(){var c=
11.146 +parseFloat(e.$eval(f));return isNaN(c)?"":(j[c]||(c=a.pluralCat(c-k)),l[c](e,g,!0))},function(a){g.text(a)})}}}],Jd=S({transclude:"element",priority:1E3,terminal:!0,compile:function(a,c,d){return function(a,c,i){var f=i.ngRepeat,i=f.match(/^\s*(.+)\s+in\s+(.*)\s*$/),h,k,j;if(!i)throw B("Expected ngRepeat in form of '_item_ in _collection_' but got '"+f+"'.");f=i[1];h=i[2];i=f.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!i)throw B("'item' in 'item in collection' should be identifier or (key, value) but got '"+
11.147 +f+"'.");k=i[3]||i[1];j=i[2];var l=new eb;a.$watch(function(a){var e,f,i=a.$eval(h),m=gc(i,!0),p,u=new eb,C,A,v,t,y=c;if(J(i))v=i||[];else{v=[];for(C in i)i.hasOwnProperty(C)&&C.charAt(0)!="$"&&v.push(C);v.sort()}e=0;for(f=v.length;e<f;e++){C=i===v?e:v[e];A=i[C];if(t=l.shift(A)){p=t.scope;u.push(A,t);if(e!==t.index)t.index=e,y.after(t.element);y=t.element}else p=a.$new();p[k]=A;j&&(p[j]=C);p.$index=e;p.$first=e===0;p.$last=e===m-1;p.$middle=!(p.$first||p.$last);t||d(p,function(a){y.after(a);t={scope:p,
11.148 +element:y=a,index:e};u.push(A,t)})}for(C in l)if(l.hasOwnProperty(C))for(v=l[C];v.length;)A=v.pop(),A.element.remove(),A.scope.$destroy();l=u})}}}),Kd=S(function(a,c,d){a.$watch(d.ngShow,function(a){c.css("display",Wa(a)?"":"none")})}),Ld=S(function(a,c,d){a.$watch(d.ngHide,function(a){c.css("display",Wa(a)?"none":"")})}),Md=S(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&m(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Nd=I({restrict:"EA",compile:function(a,c){var d=c.ngSwitch||c.on,
11.149 +e={};a.data("ng-switch",e);return function(a,i){var f,h,k;a.$watch(d,function(d){h&&(k.$destroy(),h.remove(),h=k=null);if(f=e["!"+d]||e["?"])a.$eval(c.change),k=a.$new(),f(k,function(a){h=a;i.append(a)})})}}}),Od=S({transclude:"element",priority:500,compile:function(a,c,d){a=a.inheritedData("ng-switch");qa(a);a["!"+c.ngSwitchWhen]=d}}),Pd=S({transclude:"element",priority:500,compile:function(a,c,d){a=a.inheritedData("ng-switch");qa(a);a["?"]=d}}),Qd=S({controller:["$transclude","$element",function(a,
11.150 +c){a(function(a){c.append(a)})}]}),Rd=["$http","$templateCache","$route","$anchorScroll","$compile","$controller",function(a,c,d,e,g,i){return{restrict:"ECA",terminal:!0,link:function(a,c,k){function j(){var j=d.current&&d.current.locals,k=j&&j.$template;if(k){c.html(k);l&&(l.$destroy(),l=null);var k=g(c.contents()),p=d.current;l=p.scope=a.$new();if(p.controller)j.$scope=l,j=i(p.controller,j),c.contents().data("$ngControllerController",j);k(l);l.$emit("$viewContentLoaded");l.$eval(m);e()}else c.html(""),
11.151 +l&&(l.$destroy(),l=null)}var l,m=k.onload||"";a.$on("$routeChangeSuccess",j);j()}}}],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:D};return{restrict:"E",require:["select",
11.152 +"?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var h=this,k={},j=e,l;h.databound=d.ngModel;h.init=function(a,c,d){j=a;l=d};h.addOption=function(c){k[c]=!0;j.$viewValue==c&&(a.val(c),l.parent()&&l.remove())};h.removeOption=function(a){this.hasOption(a)&&(delete k[a],j.$viewValue==a&&this.renderUnknownOption(a))};h.renderUnknownOption=function(c){c="? "+ga(c)+" ?";l.val(c);a.prepend(l);a.val(c);l.prop("selected",!0)};h.hasOption=function(a){return k.hasOwnProperty(a)};c.$on("$destroy",
11.153 +function(){h.renderUnknownOption=D})}],link:function(e,i,f,h){function k(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(A.parent()&&A.remove(),c.val(a),a===""&&s.prop("selected",!0)):t(a)&&s?c.val(""):e.renderUnknownOption(a)};c.bind("change",function(){a.$apply(function(){A.parent()&&A.remove();d.$setViewValue(c.val())})})}function j(a,c,d){var e;d.$render=function(){var a=new Fa(d.$viewValue);m(c.children(),function(c){c.selected=v(a.get(c.value))})};a.$watch(function(){ha(e,d.$viewValue)||
11.154 +(e=V(d.$viewValue),d.$render())});c.bind("change",function(){a.$apply(function(){var a=[];m(c.children(),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function l(e,f,g){function h(){var a={"":[]},c=[""],d,i,s,t,u;s=g.$modelValue;t=r(e)||[];var y=l?lb(t):t,A,w,x;w={};u=!1;var z,B;if(n)u=new Fa(s);else if(s===null||q)a[""].push({selected:s===null,id:"",label:""}),u=!0;for(x=0;A=y.length,x<A;x++){w[k]=t[l?w[l]=y[x]:x];d=m(e,w)||"";if(!(i=a[d]))i=a[d]=[],c.push(d);n?d=u.remove(o(e,
11.155 +w))!=p:(d=s===o(e,w),u=u||d);z=j(e,w);z=z===p?"":z;i.push({id:l?y[x]:x,label:z,selected:d})}!n&&!u&&a[""].unshift({id:"?",label:"",selected:!0});w=0;for(y=c.length;w<y;w++){d=c[w];i=a[d];if(v.length<=w)s={element:C.clone().attr("label",d),label:i.label},t=[s],v.push(t),f.append(s.element);else if(t=v[w],s=t[0],s.label!=d)s.element.attr("label",s.label=d);z=null;x=0;for(A=i.length;x<A;x++)if(d=i[x],u=t[x+1]){z=u.element;if(u.label!==d.label)z.text(u.label=d.label);if(u.id!==d.id)z.val(u.id=d.id);if(u.element.selected!==
11.156 +d.selected)z.prop("selected",u.selected=d.selected)}else d.id===""&&q?B=q:(B=D.clone()).val(d.id).attr("selected",d.selected).text(d.label),t.push({element:B,label:d.label,id:d.id,selected:d.selected}),z?z.after(B):s.element.append(B),z=B;for(x++;t.length>x;)t.pop().element.remove()}for(;v.length>w;)v.pop()[0].element.remove()}var i;if(!(i=w.match(d)))throw B("Expected ngOptions in form of '_select_ (as _label_)? for (_key_,)?_value_ in _collection_' but got '"+w+"'.");var j=c(i[2]||i[1]),k=i[4]||
11.157 +i[6],l=i[5],m=c(i[3]||""),o=c(i[2]?i[1]:k),r=c(i[7]),v=[[{element:f,label:""}]];q&&(a(q)(e),q.removeClass("ng-scope"),q.remove());f.html("");f.bind("change",function(){e.$apply(function(){var a,c=r(e)||[],d={},h,i,j,m,q,s;if(n){i=[];m=0;for(s=v.length;m<s;m++){a=v[m];j=1;for(q=a.length;j<q;j++)if((h=a[j].element)[0].selected)h=h.val(),l&&(d[l]=h),d[k]=c[h],i.push(o(e,d))}}else h=f.val(),h=="?"?i=p:h==""?i=null:(d[k]=c[h],l&&(d[l]=h),i=o(e,d));g.$setViewValue(i)})});g.$render=h;e.$watch(h)}if(h[1]){for(var o=
11.158 +h[0],r=h[1],n=f.multiple,w=f.ngOptions,q=!1,s,D=u(ca.createElement("option")),C=u(ca.createElement("optgroup")),A=D.clone(),h=0,x=i.children(),E=x.length;h<E;h++)if(x[h].value==""){s=q=x.eq(h);break}o.init(r,q,A);if(n&&(f.required||f.ngRequired)){var y=function(a){r.$setValidity("required",!f.required||a&&a.length);return a};r.$parsers.push(y);r.$formatters.unshift(y);f.$observe("required",function(){y(r.$viewValue)})}w?l(e,i,r):n?j(e,i,r):k(e,i,r,o)}}}}],Vd=["$interpolate",function(a){var c={addOption:D,
11.159 +removeOption:D};return{restrict:"E",priority:100,compile:function(d,e){if(t(e.value)){var g=a(d.text(),!0);g||e.$set("value",d.text())}return function(a,d,e){var k=d.parent(),j=k.data("$selectController")||k.parent().data("$selectController");j&&j.databound?d.prop("selected",!1):j=c;g?a.$watch(g,function(a,c){e.$set("value",a);a!==c&&j.removeOption(c);j.addOption(a)}):j.addOption(e.value);d.bind("$destroy",function(){j.removeOption(e.value)})}}}}],Wd=I({restrict:"E",terminal:!0});(ja=U.jQuery)?(u=
11.160 +ja,x(ja.fn,{scope:ua.scope,controller:ua.controller,injector:ua.injector,inheritedData:ua.inheritedData}),ab("remove",!0),ab("empty"),ab("html")):u=Q;Yb.element=u;(function(a){x(a,{bootstrap:pb,copy:V,extend:x,equals:ha,element:u,forEach:m,injector:qb,noop:D,bind:Va,toJson:da,fromJson:nb,identity:ma,isUndefined:t,isDefined:v,isString:F,isFunction:N,isObject:L,isNumber:wa,isElement:fc,isArray:J,version:id,isDate:na,lowercase:E,uppercase:la,callbacks:{counter:0}});ta=lc(U);try{ta("ngLocale")}catch(c){ta("ngLocale",
11.161 +[]).provider("$locale",Zc)}ta("ng",["ngLocale"],["$provide",function(a){a.provider("$compile",Bb).directive({a:jd,input:bc,textarea:bc,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,
11.162 +ngModel:qd,ngList:sd,ngChange:rd,required:cc,ngRequired:cc,ngValue:ud}).directive(kb).directive(dc);a.provider({$anchorScroll:uc,$browser:wc,$cacheFactory:xc,$controller:Bc,$document:Cc,$exceptionHandler:Dc,$filter:Pb,$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})}])})(Yb);u(ca).ready(function(){jc(ca,pb)})})(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>');
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
12.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/app.js Tue Jan 15 15:56:45 2013 +0100
12.3 @@ -0,0 +1,91 @@
12.4 +// 'use strict';
12.5 +
12.6 +// Declare app level module which depends on filters, and services
12.7 +angular.module('bck2brwsr', []).
12.8 + directive('uiCodemirror', ['$timeout', function($timeout) {
12.9 + 'use strict';
12.10 +
12.11 + var events = ["cursorActivity", "viewportChange", "gutterClick", "focus", "blur", "scroll", "update"];
12.12 + return {
12.13 + restrict: 'A',
12.14 + require: 'ngModel',
12.15 + link: function(scope, elm, attrs, ngModel) {
12.16 + var options, opts, onChange, deferCodeMirror, codeMirror, timeoutId, val;
12.17 +
12.18 + if (elm[0].type !== 'textarea') {
12.19 + throw new Error('uiCodemirror3 can only be applied to a textarea element');
12.20 + }
12.21 +
12.22 + options = /* uiConfig.codemirror || */ {};
12.23 + opts = angular.extend({}, options, scope.$eval(attrs.uiCodemirror));
12.24 +
12.25 + onChange = function(instance, changeObj) {
12.26 + val = instance.getValue();
12.27 + $timeout.cancel(timeoutId);
12.28 + timeoutId = $timeout(function() {
12.29 + ngModel.$setViewValue(val);
12.30 + }, 500);
12.31 + };
12.32 +
12.33 + deferCodeMirror = function() {
12.34 + codeMirror = CodeMirror.fromTextArea(elm[0], opts);
12.35 + // codeMirror.on("change", onChange(opts.onChange));
12.36 + codeMirror.on("change", onChange);
12.37 +
12.38 + for (var i = 0, n = events.length, aEvent; i < n; ++i) {
12.39 + aEvent = opts["on" + events[i].charAt(0).toUpperCase() + events[i].slice(1)];
12.40 + if (aEvent === void 0)
12.41 + continue;
12.42 + if (typeof aEvent !== "function")
12.43 + continue;
12.44 +
12.45 + var bound = _.bind( aEvent, scope );
12.46 +
12.47 + codeMirror.on(events[i], bound);
12.48 + }
12.49 +
12.50 + // CodeMirror expects a string, so make sure it gets one.
12.51 + // This does not change the model.
12.52 + ngModel.$formatters.push(function(value) {
12.53 + if (angular.isUndefined(value) || value === null) {
12.54 + return '';
12.55 + }
12.56 + else if (angular.isObject(value) || angular.isArray(value)) {
12.57 + throw new Error('ui-codemirror cannot use an object or an array as a model');
12.58 + }
12.59 + return value;
12.60 + });
12.61 +
12.62 + // Override the ngModelController $render method, which is what gets called when the model is updated.
12.63 + // This takes care of the synchronizing the codeMirror element with the underlying model, in the case that it is changed by something else.
12.64 + ngModel.$render = function() {
12.65 + codeMirror.setValue(ngModel.$viewValue);
12.66 + };
12.67 +
12.68 + };
12.69 +
12.70 + $timeout(deferCodeMirror);
12.71 +
12.72 + }
12.73 + };
12.74 +}]);
12.75 +
12.76 +function DevCtrl( $scope ) {
12.77 +
12.78 + var htmlChange = function() {
12.79 + var frame = document.getElementById("result");
12.80 + frame.contentDocument.write($scope.html);
12.81 + };
12.82 +
12.83 + $scope.tab = "html";
12.84 + $scope.html= "";
12.85 + $scope.java = "";
12.86 +
12.87 + $scope.tabActive = function( tab ) {
12.88 + return tab === $scope.tab ? "active" : "";
12.89 + };
12.90 +
12.91 + $scope.$watch( "html", htmlChange );
12.92 +
12.93 +
12.94 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
13.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/codemirror.css Tue Jan 15 15:56:45 2013 +0100
13.3 @@ -0,0 +1,239 @@
13.4 +/* BASICS */
13.5 +
13.6 +.CodeMirror {
13.7 + /* Set height, width, borders, and global font properties here */
13.8 + font-family: monospace;
13.9 + height: 300px;
13.10 +}
13.11 +.CodeMirror-scroll {
13.12 + /* Set scrolling behaviour here */
13.13 + overflow: auto;
13.14 +}
13.15 +
13.16 +/* PADDING */
13.17 +
13.18 +.CodeMirror-lines {
13.19 + padding: 4px 0; /* Vertical padding around content */
13.20 +}
13.21 +.CodeMirror pre {
13.22 + padding: 0 4px; /* Horizontal padding of content */
13.23 +}
13.24 +
13.25 +.CodeMirror-scrollbar-filler {
13.26 + background-color: white; /* The little square between H and V scrollbars */
13.27 +}
13.28 +
13.29 +/* GUTTER */
13.30 +
13.31 +.CodeMirror-gutters {
13.32 + border-right: 1px solid #ddd;
13.33 + background-color: #f7f7f7;
13.34 +}
13.35 +.CodeMirror-linenumbers {}
13.36 +.CodeMirror-linenumber {
13.37 + padding: 0 3px 0 5px;
13.38 + min-width: 20px;
13.39 + text-align: right;
13.40 + color: #999;
13.41 +}
13.42 +
13.43 +/* CURSOR */
13.44 +
13.45 +.CodeMirror pre.CodeMirror-cursor {
13.46 + border-left: 1px solid black;
13.47 +}
13.48 +/* Shown when moving in bi-directional text */
13.49 +.CodeMirror pre.CodeMirror-secondarycursor {
13.50 + border-left: 1px solid silver;
13.51 +}
13.52 +.cm-keymap-fat-cursor pre.CodeMirror-cursor {
13.53 + width: auto;
13.54 + border: 0;
13.55 + background: transparent;
13.56 + background: rgba(0, 200, 0, .4);
13.57 + filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#6600c800, endColorstr=#4c00c800);
13.58 +}
13.59 +/* Kludge to turn off filter in ie9+, which also accepts rgba */
13.60 +.cm-keymap-fat-cursor pre.CodeMirror-cursor:not(#nonsense_id) {
13.61 + filter: progid:DXImageTransform.Microsoft.gradient(enabled=false);
13.62 +}
13.63 +/* Can style cursor different in overwrite (non-insert) mode */
13.64 +.CodeMirror pre.CodeMirror-cursor.CodeMirror-overwrite {}
13.65 +
13.66 +/* DEFAULT THEME */
13.67 +
13.68 +.cm-s-default .cm-keyword {color: #708;}
13.69 +.cm-s-default .cm-atom {color: #219;}
13.70 +.cm-s-default .cm-number {color: #164;}
13.71 +.cm-s-default .cm-def {color: #00f;}
13.72 +.cm-s-default .cm-variable {color: black;}
13.73 +.cm-s-default .cm-variable-2 {color: #05a;}
13.74 +.cm-s-default .cm-variable-3 {color: #085;}
13.75 +.cm-s-default .cm-property {color: black;}
13.76 +.cm-s-default .cm-operator {color: black;}
13.77 +.cm-s-default .cm-comment {color: #a50;}
13.78 +.cm-s-default .cm-string {color: #a11;}
13.79 +.cm-s-default .cm-string-2 {color: #f50;}
13.80 +.cm-s-default .cm-meta {color: #555;}
13.81 +.cm-s-default .cm-error {color: #f00;}
13.82 +.cm-s-default .cm-qualifier {color: #555;}
13.83 +.cm-s-default .cm-builtin {color: #30a;}
13.84 +.cm-s-default .cm-bracket {color: #997;}
13.85 +.cm-s-default .cm-tag {color: #170;}
13.86 +.cm-s-default .cm-attribute {color: #00c;}
13.87 +.cm-s-default .cm-header {color: blue;}
13.88 +.cm-s-default .cm-quote {color: #090;}
13.89 +.cm-s-default .cm-hr {color: #999;}
13.90 +.cm-s-default .cm-link {color: #00c;}
13.91 +
13.92 +.cm-negative {color: #d44;}
13.93 +.cm-positive {color: #292;}
13.94 +.cm-header, .cm-strong {font-weight: bold;}
13.95 +.cm-em {font-style: italic;}
13.96 +.cm-emstrong {font-style: italic; font-weight: bold;}
13.97 +.cm-link {text-decoration: underline;}
13.98 +
13.99 +.cm-invalidchar {color: #f00;}
13.100 +
13.101 +div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;}
13.102 +div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;}
13.103 +
13.104 +/* STOP */
13.105 +
13.106 +/* The rest of this file contains styles related to the mechanics of
13.107 + the editor. You probably shouldn't touch them. */
13.108 +
13.109 +.CodeMirror {
13.110 + line-height: 1;
13.111 + position: relative;
13.112 + overflow: hidden;
13.113 +}
13.114 +
13.115 +.CodeMirror-scroll {
13.116 + /* 30px is the magic margin used to hide the element's real scrollbars */
13.117 + /* See overflow: hidden in .CodeMirror, and the paddings in .CodeMirror-sizer */
13.118 + margin-bottom: -30px; margin-right: -30px;
13.119 + padding-bottom: 30px; padding-right: 30px;
13.120 + height: 100%;
13.121 + outline: none; /* Prevent dragging from highlighting the element */
13.122 + position: relative;
13.123 +}
13.124 +.CodeMirror-sizer {
13.125 + position: relative;
13.126 +}
13.127 +
13.128 +/* The fake, visible scrollbars. Used to force redraw during scrolling
13.129 + before actuall scrolling happens, thus preventing shaking and
13.130 + flickering artifacts. */
13.131 +.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler {
13.132 + position: absolute;
13.133 + z-index: 6;
13.134 + display: none;
13.135 +}
13.136 +.CodeMirror-vscrollbar {
13.137 + right: 0; top: 0;
13.138 + overflow-x: hidden;
13.139 + overflow-y: scroll;
13.140 +}
13.141 +.CodeMirror-hscrollbar {
13.142 + bottom: 0; left: 0;
13.143 + overflow-y: hidden;
13.144 + overflow-x: scroll;
13.145 +}
13.146 +.CodeMirror-scrollbar-filler {
13.147 + right: 0; bottom: 0;
13.148 + z-index: 6;
13.149 +}
13.150 +
13.151 +.CodeMirror-gutters {
13.152 + position: absolute; left: 0; top: 0;
13.153 + height: 100%;
13.154 + z-index: 3;
13.155 +}
13.156 +.CodeMirror-gutter {
13.157 + height: 100%;
13.158 + display: inline-block;
13.159 + /* Hack to make IE7 behave */
13.160 + *zoom:1;
13.161 + *display:inline;
13.162 +}
13.163 +.CodeMirror-gutter-elt {
13.164 + position: absolute;
13.165 + cursor: default;
13.166 + z-index: 4;
13.167 +}
13.168 +
13.169 +.CodeMirror-lines {
13.170 + cursor: text;
13.171 +}
13.172 +.CodeMirror pre {
13.173 + /* Reset some styles that the rest of the page might have set */
13.174 + -moz-border-radius: 0; -webkit-border-radius: 0; -o-border-radius: 0; border-radius: 0;
13.175 + border-width: 0;
13.176 + background: transparent;
13.177 + font-family: inherit;
13.178 + font-size: inherit;
13.179 + margin: 0;
13.180 + white-space: pre;
13.181 + word-wrap: normal;
13.182 + line-height: inherit;
13.183 + color: inherit;
13.184 + z-index: 2;
13.185 + position: relative;
13.186 + overflow: visible;
13.187 +}
13.188 +.CodeMirror-wrap pre {
13.189 + word-wrap: break-word;
13.190 + white-space: pre-wrap;
13.191 + word-break: normal;
13.192 +}
13.193 +.CodeMirror-linebackground {
13.194 + position: absolute;
13.195 + left: 0; right: 0; top: 0; bottom: 0;
13.196 + z-index: 0;
13.197 +}
13.198 +
13.199 +.CodeMirror-linewidget {
13.200 + position: relative;
13.201 + z-index: 2;
13.202 +}
13.203 +
13.204 +.CodeMirror-wrap .CodeMirror-scroll {
13.205 + overflow-x: hidden;
13.206 +}
13.207 +
13.208 +.CodeMirror-measure {
13.209 + position: absolute;
13.210 + width: 100%; height: 0px;
13.211 + overflow: hidden;
13.212 + visibility: hidden;
13.213 +}
13.214 +.CodeMirror-measure pre { position: static; }
13.215 +
13.216 +.CodeMirror pre.CodeMirror-cursor {
13.217 + position: absolute;
13.218 + visibility: hidden;
13.219 + border-right: none;
13.220 + width: 0;
13.221 +}
13.222 +.CodeMirror-focused pre.CodeMirror-cursor {
13.223 + visibility: visible;
13.224 +}
13.225 +
13.226 +.CodeMirror-selected { background: #d9d9d9; }
13.227 +.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
13.228 +
13.229 +.CodeMirror-searching {
13.230 + background: #ffa;
13.231 + background: rgba(255, 255, 0, .4);
13.232 +}
13.233 +
13.234 +/* IE7 hack to prevent it from returning funny offsetTops on the spans */
13.235 +.CodeMirror span { *vertical-align: text-bottom; }
13.236 +
13.237 +@media print {
13.238 + /* Hide the cursor when printing */
13.239 + .CodeMirror pre.CodeMirror-cursor {
13.240 + visibility: hidden;
13.241 + }
13.242 +}
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
14.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/codemirror.js Tue Jan 15 15:56:45 2013 +0100
14.3 @@ -0,0 +1,4553 @@
14.4 +// CodeMirror version 3.0
14.5 +//
14.6 +// CodeMirror is the only global var we claim
14.7 +window.CodeMirror = (function() {
14.8 + "use strict";
14.9 +
14.10 + // BROWSER SNIFFING
14.11 +
14.12 + // Crude, but necessary to handle a number of hard-to-feature-detect
14.13 + // bugs and behavior differences.
14.14 + var gecko = /gecko\/\d/i.test(navigator.userAgent);
14.15 + var ie = /MSIE \d/.test(navigator.userAgent);
14.16 + var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
14.17 + var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
14.18 + var webkit = /WebKit\//.test(navigator.userAgent);
14.19 + var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(navigator.userAgent);
14.20 + var chrome = /Chrome\//.test(navigator.userAgent);
14.21 + var opera = /Opera\//.test(navigator.userAgent);
14.22 + var safari = /Apple Computer/.test(navigator.vendor);
14.23 + var khtml = /KHTML\//.test(navigator.userAgent);
14.24 + var mac_geLion = /Mac OS X 1\d\D([7-9]|\d\d)\D/.test(navigator.userAgent);
14.25 + var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent);
14.26 + var phantom = /PhantomJS/.test(navigator.userAgent);
14.27 +
14.28 + var ios = /AppleWebKit/.test(navigator.userAgent) && /Mobile\/\w+/.test(navigator.userAgent);
14.29 + // This is woefully incomplete. Suggestions for alternative methods welcome.
14.30 + var mobile = ios || /Android|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent);
14.31 + var mac = ios || /Mac/.test(navigator.platform);
14.32 +
14.33 + // Optimize some code when these features are not used
14.34 + var sawReadOnlySpans = false, sawCollapsedSpans = false;
14.35 +
14.36 + // CONSTRUCTOR
14.37 +
14.38 + function CodeMirror(place, options) {
14.39 + if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
14.40 +
14.41 + this.options = options = options || {};
14.42 + // Determine effective options based on given values and defaults.
14.43 + for (var opt in defaults) if (!options.hasOwnProperty(opt) && defaults.hasOwnProperty(opt))
14.44 + options[opt] = defaults[opt];
14.45 + setGuttersForLineNumbers(options);
14.46 +
14.47 + var display = this.display = makeDisplay(place);
14.48 + display.wrapper.CodeMirror = this;
14.49 + updateGutters(this);
14.50 + if (options.autofocus && !mobile) focusInput(this);
14.51 +
14.52 + this.view = makeView(new BranchChunk([new LeafChunk([makeLine("", null, textHeight(display))])]));
14.53 + this.nextOpId = 0;
14.54 + loadMode(this);
14.55 + themeChanged(this);
14.56 + if (options.lineWrapping)
14.57 + this.display.wrapper.className += " CodeMirror-wrap";
14.58 +
14.59 + // Initialize the content.
14.60 + this.setValue(options.value || "");
14.61 + // Override magic textarea content restore that IE sometimes does
14.62 + // on our hidden textarea on reload
14.63 + if (ie) setTimeout(bind(resetInput, this, true), 20);
14.64 + this.view.history = makeHistory();
14.65 +
14.66 + registerEventHandlers(this);
14.67 + // IE throws unspecified error in certain cases, when
14.68 + // trying to access activeElement before onload
14.69 + var hasFocus; try { hasFocus = (document.activeElement == display.input); } catch(e) { }
14.70 + if (hasFocus || (options.autofocus && !mobile)) setTimeout(bind(onFocus, this), 20);
14.71 + else onBlur(this);
14.72 +
14.73 + operation(this, function() {
14.74 + for (var opt in optionHandlers)
14.75 + if (optionHandlers.propertyIsEnumerable(opt))
14.76 + optionHandlers[opt](this, options[opt], Init);
14.77 + for (var i = 0; i < initHooks.length; ++i) initHooks[i](this);
14.78 + })();
14.79 + }
14.80 +
14.81 + // DISPLAY CONSTRUCTOR
14.82 +
14.83 + function makeDisplay(place) {
14.84 + var d = {};
14.85 + var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
14.86 + input.setAttribute("wrap", "off"); input.setAttribute("autocorrect", "off"); input.setAttribute("autocapitalize", "off");
14.87 + // Wraps and hides input textarea
14.88 + d.inputDiv = elt("div", [input], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
14.89 + // The actual fake scrollbars.
14.90 + d.scrollbarH = elt("div", [elt("div", null, null, "height: 1px")], "CodeMirror-hscrollbar");
14.91 + d.scrollbarV = elt("div", [elt("div", null, null, "width: 1px")], "CodeMirror-vscrollbar");
14.92 + d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
14.93 + // DIVs containing the selection and the actual code
14.94 + d.lineDiv = elt("div");
14.95 + d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
14.96 + // Blinky cursor, and element used to ensure cursor fits at the end of a line
14.97 + d.cursor = elt("pre", "\u00a0", "CodeMirror-cursor");
14.98 + // Secondary cursor, shown when on a 'jump' in bi-directional text
14.99 + d.otherCursor = elt("pre", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor");
14.100 + // Used to measure text size
14.101 + d.measure = elt("div", null, "CodeMirror-measure");
14.102 + // Wraps everything that needs to exist inside the vertically-padded coordinate system
14.103 + d.lineSpace = elt("div", [d.measure, d.selectionDiv, d.lineDiv, d.cursor, d.otherCursor],
14.104 + null, "position: relative; outline: none");
14.105 + // Moved around its parent to cover visible view
14.106 + d.mover = elt("div", [elt("div", [d.lineSpace], "CodeMirror-lines")], null, "position: relative");
14.107 + // Set to the height of the text, causes scrolling
14.108 + d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
14.109 + // D is needed because behavior of elts with overflow: auto and padding is inconsistent across browsers
14.110 + d.heightForcer = elt("div", "\u00a0", null, "position: absolute; height: " + scrollerCutOff + "px");
14.111 + // Will contain the gutters, if any
14.112 + d.gutters = elt("div", null, "CodeMirror-gutters");
14.113 + d.lineGutter = null;
14.114 + // Helper element to properly size the gutter backgrounds
14.115 + var scrollerInner = elt("div", [d.sizer, d.heightForcer, d.gutters], null, "position: relative; min-height: 100%");
14.116 + // Provides scrolling
14.117 + d.scroller = elt("div", [scrollerInner], "CodeMirror-scroll");
14.118 + d.scroller.setAttribute("tabIndex", "-1");
14.119 + // The element in which the editor lives.
14.120 + d.wrapper = elt("div", [d.inputDiv, d.scrollbarH, d.scrollbarV,
14.121 + d.scrollbarFiller, d.scroller], "CodeMirror");
14.122 + // Work around IE7 z-index bug
14.123 + if (ie_lt8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
14.124 + if (place.appendChild) place.appendChild(d.wrapper); else place(d.wrapper);
14.125 +
14.126 + // Needed to hide big blue blinking cursor on Mobile Safari
14.127 + if (ios) input.style.width = "0px";
14.128 + if (!webkit) d.scroller.draggable = true;
14.129 + // Needed to handle Tab key in KHTML
14.130 + if (khtml) { d.inputDiv.style.height = "1px"; d.inputDiv.style.position = "absolute"; }
14.131 + // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
14.132 + else if (ie_lt8) d.scrollbarH.style.minWidth = d.scrollbarV.style.minWidth = "18px";
14.133 +
14.134 + // Current visible range (may be bigger than the view window).
14.135 + d.viewOffset = d.showingFrom = d.showingTo = d.lastSizeC = 0;
14.136 +
14.137 + // Used to only resize the line number gutter when necessary (when
14.138 + // the amount of lines crosses a boundary that makes its width change)
14.139 + d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
14.140 + // See readInput and resetInput
14.141 + d.prevInput = "";
14.142 + // Set to true when a non-horizontal-scrolling widget is added. As
14.143 + // an optimization, widget aligning is skipped when d is false.
14.144 + d.alignWidgets = false;
14.145 + // Flag that indicates whether we currently expect input to appear
14.146 + // (after some event like 'keypress' or 'input') and are polling
14.147 + // intensively.
14.148 + d.pollingFast = false;
14.149 + // Self-resetting timeout for the poller
14.150 + d.poll = new Delayed();
14.151 + // True when a drag from the editor is active
14.152 + d.draggingText = false;
14.153 +
14.154 + d.cachedCharWidth = d.cachedTextHeight = null;
14.155 + d.measureLineCache = [];
14.156 + d.measureLineCachePos = 0;
14.157 +
14.158 + // Tracks when resetInput has punted to just putting a short
14.159 + // string instead of the (large) selection.
14.160 + d.inaccurateSelection = false;
14.161 +
14.162 + // Used to adjust overwrite behaviour when a paste has been
14.163 + // detected
14.164 + d.pasteIncoming = false;
14.165 +
14.166 + return d;
14.167 + }
14.168 +
14.169 + // VIEW CONSTRUCTOR
14.170 +
14.171 + function makeView(doc) {
14.172 + var selPos = {line: 0, ch: 0};
14.173 + return {
14.174 + doc: doc,
14.175 + // frontier is the point up to which the content has been parsed,
14.176 + frontier: 0, highlight: new Delayed(),
14.177 + sel: {from: selPos, to: selPos, head: selPos, anchor: selPos, shift: false, extend: false},
14.178 + scrollTop: 0, scrollLeft: 0,
14.179 + overwrite: false, focused: false,
14.180 + // Tracks the maximum line length so that
14.181 + // the horizontal scrollbar can be kept
14.182 + // static when scrolling.
14.183 + maxLine: getLine(doc, 0),
14.184 + maxLineLength: 0,
14.185 + maxLineChanged: false,
14.186 + suppressEdits: false,
14.187 + goalColumn: null,
14.188 + cantEdit: false,
14.189 + keyMaps: []
14.190 + };
14.191 + }
14.192 +
14.193 + // STATE UPDATES
14.194 +
14.195 + // Used to get the editor into a consistent state again when options change.
14.196 +
14.197 + function loadMode(cm) {
14.198 + var doc = cm.view.doc;
14.199 + cm.view.mode = CodeMirror.getMode(cm.options, cm.options.mode);
14.200 + doc.iter(0, doc.size, function(line) { line.stateAfter = null; });
14.201 + cm.view.frontier = 0;
14.202 + startWorker(cm, 100);
14.203 + }
14.204 +
14.205 + function wrappingChanged(cm) {
14.206 + var doc = cm.view.doc, th = textHeight(cm.display);
14.207 + if (cm.options.lineWrapping) {
14.208 + cm.display.wrapper.className += " CodeMirror-wrap";
14.209 + var perLine = cm.display.scroller.clientWidth / charWidth(cm.display) - 3;
14.210 + doc.iter(0, doc.size, function(line) {
14.211 + if (line.height == 0) return;
14.212 + var guess = Math.ceil(line.text.length / perLine) || 1;
14.213 + if (guess != 1) updateLineHeight(line, guess * th);
14.214 + });
14.215 + cm.display.sizer.style.minWidth = "";
14.216 + } else {
14.217 + cm.display.wrapper.className = cm.display.wrapper.className.replace(" CodeMirror-wrap", "");
14.218 + computeMaxLength(cm.view);
14.219 + doc.iter(0, doc.size, function(line) {
14.220 + if (line.height != 0) updateLineHeight(line, th);
14.221 + });
14.222 + }
14.223 + regChange(cm, 0, doc.size);
14.224 + clearCaches(cm);
14.225 + setTimeout(function(){updateScrollbars(cm.display, cm.view.doc.height);}, 100);
14.226 + }
14.227 +
14.228 + function keyMapChanged(cm) {
14.229 + var style = keyMap[cm.options.keyMap].style;
14.230 + cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-keymap-\S+/g, "") +
14.231 + (style ? " cm-keymap-" + style : "");
14.232 + }
14.233 +
14.234 + function themeChanged(cm) {
14.235 + cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
14.236 + cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
14.237 + clearCaches(cm);
14.238 + }
14.239 +
14.240 + function guttersChanged(cm) {
14.241 + updateGutters(cm);
14.242 + updateDisplay(cm, true);
14.243 + }
14.244 +
14.245 + function updateGutters(cm) {
14.246 + var gutters = cm.display.gutters, specs = cm.options.gutters;
14.247 + removeChildren(gutters);
14.248 + for (var i = 0; i < specs.length; ++i) {
14.249 + var gutterClass = specs[i];
14.250 + var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
14.251 + if (gutterClass == "CodeMirror-linenumbers") {
14.252 + cm.display.lineGutter = gElt;
14.253 + gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
14.254 + }
14.255 + }
14.256 + gutters.style.display = i ? "" : "none";
14.257 + }
14.258 +
14.259 + function lineLength(doc, line) {
14.260 + if (line.height == 0) return 0;
14.261 + var len = line.text.length, merged, cur = line;
14.262 + while (merged = collapsedSpanAtStart(cur)) {
14.263 + var found = merged.find();
14.264 + cur = getLine(doc, found.from.line);
14.265 + len += found.from.ch - found.to.ch;
14.266 + }
14.267 + cur = line;
14.268 + while (merged = collapsedSpanAtEnd(cur)) {
14.269 + var found = merged.find();
14.270 + len -= cur.text.length - found.from.ch;
14.271 + cur = getLine(doc, found.to.line);
14.272 + len += cur.text.length - found.to.ch;
14.273 + }
14.274 + return len;
14.275 + }
14.276 +
14.277 + function computeMaxLength(view) {
14.278 + view.maxLine = getLine(view.doc, 0);
14.279 + view.maxLineLength = lineLength(view.doc, view.maxLine);
14.280 + view.maxLineChanged = true;
14.281 + view.doc.iter(1, view.doc.size, function(line) {
14.282 + var len = lineLength(view.doc, line);
14.283 + if (len > view.maxLineLength) {
14.284 + view.maxLineLength = len;
14.285 + view.maxLine = line;
14.286 + }
14.287 + });
14.288 + }
14.289 +
14.290 + // Make sure the gutters options contains the element
14.291 + // "CodeMirror-linenumbers" when the lineNumbers option is true.
14.292 + function setGuttersForLineNumbers(options) {
14.293 + var found = false;
14.294 + for (var i = 0; i < options.gutters.length; ++i) {
14.295 + if (options.gutters[i] == "CodeMirror-linenumbers") {
14.296 + if (options.lineNumbers) found = true;
14.297 + else options.gutters.splice(i--, 1);
14.298 + }
14.299 + }
14.300 + if (!found && options.lineNumbers)
14.301 + options.gutters.push("CodeMirror-linenumbers");
14.302 + }
14.303 +
14.304 + // SCROLLBARS
14.305 +
14.306 + // Re-synchronize the fake scrollbars with the actual size of the
14.307 + // content. Optionally force a scrollTop.
14.308 + function updateScrollbars(d /* display */, docHeight) {
14.309 + var totalHeight = docHeight + 2 * paddingTop(d);
14.310 + d.sizer.style.minHeight = d.heightForcer.style.top = totalHeight + "px";
14.311 + var scrollHeight = Math.max(totalHeight, d.scroller.scrollHeight);
14.312 + var needsH = d.scroller.scrollWidth > d.scroller.clientWidth;
14.313 + var needsV = scrollHeight > d.scroller.clientHeight;
14.314 + if (needsV) {
14.315 + d.scrollbarV.style.display = "block";
14.316 + d.scrollbarV.style.bottom = needsH ? scrollbarWidth(d.measure) + "px" : "0";
14.317 + d.scrollbarV.firstChild.style.height =
14.318 + (scrollHeight - d.scroller.clientHeight + d.scrollbarV.clientHeight) + "px";
14.319 + } else d.scrollbarV.style.display = "";
14.320 + if (needsH) {
14.321 + d.scrollbarH.style.display = "block";
14.322 + d.scrollbarH.style.right = needsV ? scrollbarWidth(d.measure) + "px" : "0";
14.323 + d.scrollbarH.firstChild.style.width =
14.324 + (d.scroller.scrollWidth - d.scroller.clientWidth + d.scrollbarH.clientWidth) + "px";
14.325 + } else d.scrollbarH.style.display = "";
14.326 + if (needsH && needsV) {
14.327 + d.scrollbarFiller.style.display = "block";
14.328 + d.scrollbarFiller.style.height = d.scrollbarFiller.style.width = scrollbarWidth(d.measure) + "px";
14.329 + } else d.scrollbarFiller.style.display = "";
14.330 +
14.331 + if (mac_geLion && scrollbarWidth(d.measure) === 0)
14.332 + d.scrollbarV.style.minWidth = d.scrollbarH.style.minHeight = mac_geMountainLion ? "18px" : "12px";
14.333 + }
14.334 +
14.335 + function visibleLines(display, doc, viewPort) {
14.336 + var top = display.scroller.scrollTop, height = display.wrapper.clientHeight;
14.337 + if (typeof viewPort == "number") top = viewPort;
14.338 + else if (viewPort) {top = viewPort.top; height = viewPort.bottom - viewPort.top;}
14.339 + top = Math.floor(top - paddingTop(display));
14.340 + var bottom = Math.ceil(top + height);
14.341 + return {from: lineAtHeight(doc, top), to: lineAtHeight(doc, bottom)};
14.342 + }
14.343 +
14.344 + // LINE NUMBERS
14.345 +
14.346 + function alignHorizontally(cm) {
14.347 + var display = cm.display;
14.348 + if (!display.alignWidgets && !display.gutters.firstChild) return;
14.349 + var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.view.scrollLeft;
14.350 + var gutterW = display.gutters.offsetWidth, l = comp + "px";
14.351 + for (var n = display.lineDiv.firstChild; n; n = n.nextSibling) if (n.alignable) {
14.352 + for (var i = 0, a = n.alignable; i < a.length; ++i) a[i].style.left = l;
14.353 + }
14.354 + display.gutters.style.left = (comp + gutterW) + "px";
14.355 + }
14.356 +
14.357 + function maybeUpdateLineNumberWidth(cm) {
14.358 + if (!cm.options.lineNumbers) return false;
14.359 + var doc = cm.view.doc, last = lineNumberFor(cm.options, doc.size - 1), display = cm.display;
14.360 + if (last.length != display.lineNumChars) {
14.361 + var test = display.measure.appendChild(elt("div", [elt("div", last)],
14.362 + "CodeMirror-linenumber CodeMirror-gutter-elt"));
14.363 + var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
14.364 + display.lineGutter.style.width = "";
14.365 + display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding);
14.366 + display.lineNumWidth = display.lineNumInnerWidth + padding;
14.367 + display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
14.368 + display.lineGutter.style.width = display.lineNumWidth + "px";
14.369 + return true;
14.370 + }
14.371 + return false;
14.372 + }
14.373 +
14.374 + function lineNumberFor(options, i) {
14.375 + return String(options.lineNumberFormatter(i + options.firstLineNumber));
14.376 + }
14.377 + function compensateForHScroll(display) {
14.378 + return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left;
14.379 + }
14.380 +
14.381 + // DISPLAY DRAWING
14.382 +
14.383 + function updateDisplay(cm, changes, viewPort) {
14.384 + var oldFrom = cm.display.showingFrom, oldTo = cm.display.showingTo;
14.385 + var updated = updateDisplayInner(cm, changes, viewPort);
14.386 + if (updated) {
14.387 + signalLater(cm, cm, "update", cm);
14.388 + if (cm.display.showingFrom != oldFrom || cm.display.showingTo != oldTo)
14.389 + signalLater(cm, cm, "viewportChange", cm, cm.display.showingFrom, cm.display.showingTo);
14.390 + }
14.391 + updateSelection(cm);
14.392 + updateScrollbars(cm.display, cm.view.doc.height);
14.393 +
14.394 + return updated;
14.395 + }
14.396 +
14.397 + // Uses a set of changes plus the current scroll position to
14.398 + // determine which DOM updates have to be made, and makes the
14.399 + // updates.
14.400 + function updateDisplayInner(cm, changes, viewPort) {
14.401 + var display = cm.display, doc = cm.view.doc;
14.402 + if (!display.wrapper.clientWidth) {
14.403 + display.showingFrom = display.showingTo = display.viewOffset = 0;
14.404 + return;
14.405 + }
14.406 +
14.407 + // Compute the new visible window
14.408 + // If scrollTop is specified, use that to determine which lines
14.409 + // to render instead of the current scrollbar position.
14.410 + var visible = visibleLines(display, doc, viewPort);
14.411 + // Bail out if the visible area is already rendered and nothing changed.
14.412 + if (changes !== true && changes.length == 0 &&
14.413 + visible.from > display.showingFrom && visible.to < display.showingTo)
14.414 + return;
14.415 +
14.416 + if (changes && maybeUpdateLineNumberWidth(cm))
14.417 + changes = true;
14.418 + display.sizer.style.marginLeft = display.scrollbarH.style.left = display.gutters.offsetWidth + "px";
14.419 +
14.420 + // When merged lines are present, the line that needs to be
14.421 + // redrawn might not be the one that was changed.
14.422 + if (changes !== true && sawCollapsedSpans)
14.423 + for (var i = 0; i < changes.length; ++i) {
14.424 + var ch = changes[i], merged;
14.425 + while (merged = collapsedSpanAtStart(getLine(doc, ch.from))) {
14.426 + var from = merged.find().from.line;
14.427 + if (ch.diff) ch.diff -= ch.from - from;
14.428 + ch.from = from;
14.429 + }
14.430 + }
14.431 +
14.432 + // Used to determine which lines need their line numbers updated
14.433 + var positionsChangedFrom = changes === true ? 0 : Infinity;
14.434 + if (cm.options.lineNumbers && changes && changes !== true)
14.435 + for (var i = 0; i < changes.length; ++i)
14.436 + if (changes[i].diff) { positionsChangedFrom = changes[i].from; break; }
14.437 +
14.438 + var from = Math.max(visible.from - cm.options.viewportMargin, 0);
14.439 + var to = Math.min(doc.size, visible.to + cm.options.viewportMargin);
14.440 + if (display.showingFrom < from && from - display.showingFrom < 20) from = display.showingFrom;
14.441 + if (display.showingTo > to && display.showingTo - to < 20) to = Math.min(doc.size, display.showingTo);
14.442 + if (sawCollapsedSpans) {
14.443 + from = lineNo(visualLine(doc, getLine(doc, from)));
14.444 + while (to < doc.size && lineIsHidden(getLine(doc, to))) ++to;
14.445 + }
14.446 +
14.447 + // Create a range of theoretically intact lines, and punch holes
14.448 + // in that using the change info.
14.449 + var intact = changes === true ? [] :
14.450 + computeIntact([{from: display.showingFrom, to: display.showingTo}], changes);
14.451 + // Clip off the parts that won't be visible
14.452 + var intactLines = 0;
14.453 + for (var i = 0; i < intact.length; ++i) {
14.454 + var range = intact[i];
14.455 + if (range.from < from) range.from = from;
14.456 + if (range.to > to) range.to = to;
14.457 + if (range.from >= range.to) intact.splice(i--, 1);
14.458 + else intactLines += range.to - range.from;
14.459 + }
14.460 + if (intactLines == to - from && from == display.showingFrom && to == display.showingTo)
14.461 + return;
14.462 + intact.sort(function(a, b) {return a.from - b.from;});
14.463 +
14.464 + if (intactLines < (to - from) * .7) display.lineDiv.style.display = "none";
14.465 + patchDisplay(cm, from, to, intact, positionsChangedFrom);
14.466 + display.lineDiv.style.display = "";
14.467 +
14.468 + var different = from != display.showingFrom || to != display.showingTo ||
14.469 + display.lastSizeC != display.wrapper.clientHeight;
14.470 + // This is just a bogus formula that detects when the editor is
14.471 + // resized or the font size changes.
14.472 + if (different) display.lastSizeC = display.wrapper.clientHeight;
14.473 + display.showingFrom = from; display.showingTo = to;
14.474 + startWorker(cm, 100);
14.475 +
14.476 + var prevBottom = display.lineDiv.offsetTop;
14.477 + for (var node = display.lineDiv.firstChild, height; node; node = node.nextSibling) if (node.lineObj) {
14.478 + if (ie_lt8) {
14.479 + var bot = node.offsetTop + node.offsetHeight;
14.480 + height = bot - prevBottom;
14.481 + prevBottom = bot;
14.482 + } else {
14.483 + var box = node.getBoundingClientRect();
14.484 + height = box.bottom - box.top;
14.485 + }
14.486 + var diff = node.lineObj.height - height;
14.487 + if (height < 2) height = textHeight(display);
14.488 + if (diff > .001 || diff < -.001)
14.489 + updateLineHeight(node.lineObj, height);
14.490 + }
14.491 + display.viewOffset = heightAtLine(cm, getLine(doc, from));
14.492 + // Position the mover div to align with the current virtual scroll position
14.493 + display.mover.style.top = display.viewOffset + "px";
14.494 + return true;
14.495 + }
14.496 +
14.497 + function computeIntact(intact, changes) {
14.498 + for (var i = 0, l = changes.length || 0; i < l; ++i) {
14.499 + var change = changes[i], intact2 = [], diff = change.diff || 0;
14.500 + for (var j = 0, l2 = intact.length; j < l2; ++j) {
14.501 + var range = intact[j];
14.502 + if (change.to <= range.from && change.diff) {
14.503 + intact2.push({from: range.from + diff, to: range.to + diff});
14.504 + } else if (change.to <= range.from || change.from >= range.to) {
14.505 + intact2.push(range);
14.506 + } else {
14.507 + if (change.from > range.from)
14.508 + intact2.push({from: range.from, to: change.from});
14.509 + if (change.to < range.to)
14.510 + intact2.push({from: change.to + diff, to: range.to + diff});
14.511 + }
14.512 + }
14.513 + intact = intact2;
14.514 + }
14.515 + return intact;
14.516 + }
14.517 +
14.518 + function getDimensions(cm) {
14.519 + var d = cm.display, left = {}, width = {};
14.520 + for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
14.521 + left[cm.options.gutters[i]] = n.offsetLeft;
14.522 + width[cm.options.gutters[i]] = n.offsetWidth;
14.523 + }
14.524 + return {fixedPos: compensateForHScroll(d),
14.525 + gutterTotalWidth: d.gutters.offsetWidth,
14.526 + gutterLeft: left,
14.527 + gutterWidth: width,
14.528 + wrapperWidth: d.wrapper.clientWidth};
14.529 + }
14.530 +
14.531 + function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
14.532 + var dims = getDimensions(cm);
14.533 + var display = cm.display, lineNumbers = cm.options.lineNumbers;
14.534 + // IE does bad things to nodes when .innerHTML = "" is used on a parent
14.535 + // we still need widgets and markers intact to add back to the new content later
14.536 + if (!intact.length && !ie && (!webkit || !cm.display.currentWheelTarget))
14.537 + removeChildren(display.lineDiv);
14.538 + var container = display.lineDiv, cur = container.firstChild;
14.539 +
14.540 + function rm(node) {
14.541 + var next = node.nextSibling;
14.542 + if (webkit && mac && cm.display.currentWheelTarget == node) {
14.543 + node.style.display = "none";
14.544 + node.lineObj = null;
14.545 + } else {
14.546 + container.removeChild(node);
14.547 + }
14.548 + return next;
14.549 + }
14.550 +
14.551 + var nextIntact = intact.shift(), lineNo = from;
14.552 + cm.view.doc.iter(from, to, function(line) {
14.553 + if (nextIntact && nextIntact.to == lineNo) nextIntact = intact.shift();
14.554 + if (lineIsHidden(line)) {
14.555 + if (line.height != 0) updateLineHeight(line, 0);
14.556 + } else if (nextIntact && nextIntact.from <= lineNo && nextIntact.to > lineNo) {
14.557 + // This line is intact. Skip to the actual node. Update its
14.558 + // line number if needed.
14.559 + while (cur.lineObj != line) cur = rm(cur);
14.560 + if (lineNumbers && updateNumbersFrom <= lineNo && cur.lineNumber)
14.561 + setTextContent(cur.lineNumber, lineNumberFor(cm.options, lineNo));
14.562 + cur = cur.nextSibling;
14.563 + } else {
14.564 + // This line needs to be generated.
14.565 + var lineNode = buildLineElement(cm, line, lineNo, dims);
14.566 + container.insertBefore(lineNode, cur);
14.567 + lineNode.lineObj = line;
14.568 + }
14.569 + ++lineNo;
14.570 + });
14.571 + while (cur) cur = rm(cur);
14.572 + }
14.573 +
14.574 + function buildLineElement(cm, line, lineNo, dims) {
14.575 + var lineElement = lineContent(cm, line);
14.576 + var markers = line.gutterMarkers, display = cm.display;
14.577 +
14.578 + if (!cm.options.lineNumbers && !markers && !line.bgClass && !line.wrapClass &&
14.579 + (!line.widgets || !line.widgets.length)) return lineElement;
14.580 +
14.581 + // Lines with gutter elements or a background class need
14.582 + // to be wrapped again, and have the extra elements added
14.583 + // to the wrapper div
14.584 +
14.585 + var wrap = elt("div", null, line.wrapClass, "position: relative");
14.586 + if (cm.options.lineNumbers || markers) {
14.587 + var gutterWrap = wrap.appendChild(elt("div", null, null, "position: absolute; left: " +
14.588 + dims.fixedPos + "px"));
14.589 + wrap.alignable = [gutterWrap];
14.590 + if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
14.591 + wrap.lineNumber = gutterWrap.appendChild(
14.592 + elt("div", lineNumberFor(cm.options, lineNo),
14.593 + "CodeMirror-linenumber CodeMirror-gutter-elt",
14.594 + "left: " + dims.gutterLeft["CodeMirror-linenumbers"] + "px; width: "
14.595 + + display.lineNumInnerWidth + "px"));
14.596 + if (markers)
14.597 + for (var k = 0; k < cm.options.gutters.length; ++k) {
14.598 + var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
14.599 + if (found)
14.600 + gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt", "left: " +
14.601 + dims.gutterLeft[id] + "px; width: " + dims.gutterWidth[id] + "px"));
14.602 + }
14.603 + }
14.604 + // Kludge to make sure the styled element lies behind the selection (by z-index)
14.605 + if (line.bgClass)
14.606 + wrap.appendChild(elt("div", "\u00a0", line.bgClass + " CodeMirror-linebackground"));
14.607 + wrap.appendChild(lineElement);
14.608 + if (line.widgets)
14.609 + for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
14.610 + var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
14.611 + node.widget = widget;
14.612 + if (widget.noHScroll) {
14.613 + (wrap.alignable || (wrap.alignable = [])).push(node);
14.614 + var width = dims.wrapperWidth;
14.615 + node.style.left = dims.fixedPos + "px";
14.616 + if (!widget.coverGutter) {
14.617 + width -= dims.gutterTotalWidth;
14.618 + node.style.paddingLeft = dims.gutterTotalWidth + "px";
14.619 + }
14.620 + node.style.width = width + "px";
14.621 + }
14.622 + if (widget.coverGutter) {
14.623 + node.style.zIndex = 5;
14.624 + node.style.position = "relative";
14.625 + if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px";
14.626 + }
14.627 + if (widget.above)
14.628 + wrap.insertBefore(node, cm.options.lineNumbers && line.height != 0 ? gutterWrap : lineElement);
14.629 + else
14.630 + wrap.appendChild(node);
14.631 + }
14.632 +
14.633 + if (ie_lt8) wrap.style.zIndex = 2;
14.634 + return wrap;
14.635 + }
14.636 +
14.637 + // SELECTION / CURSOR
14.638 +
14.639 + function updateSelection(cm) {
14.640 + var display = cm.display;
14.641 + var collapsed = posEq(cm.view.sel.from, cm.view.sel.to);
14.642 + if (collapsed || cm.options.showCursorWhenSelecting)
14.643 + updateSelectionCursor(cm);
14.644 + else
14.645 + display.cursor.style.display = display.otherCursor.style.display = "none";
14.646 + if (!collapsed)
14.647 + updateSelectionRange(cm);
14.648 + else
14.649 + display.selectionDiv.style.display = "none";
14.650 +
14.651 + // Move the hidden textarea near the cursor to prevent scrolling artifacts
14.652 + var headPos = cursorCoords(cm, cm.view.sel.head, "div");
14.653 + var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
14.654 + display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
14.655 + headPos.top + lineOff.top - wrapOff.top)) + "px";
14.656 + display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
14.657 + headPos.left + lineOff.left - wrapOff.left)) + "px";
14.658 + }
14.659 +
14.660 + // No selection, plain cursor
14.661 + function updateSelectionCursor(cm) {
14.662 + var display = cm.display, pos = cursorCoords(cm, cm.view.sel.head, "div");
14.663 + display.cursor.style.left = pos.left + "px";
14.664 + display.cursor.style.top = pos.top + "px";
14.665 + display.cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
14.666 + display.cursor.style.display = "";
14.667 +
14.668 + if (pos.other) {
14.669 + display.otherCursor.style.display = "";
14.670 + display.otherCursor.style.left = pos.other.left + "px";
14.671 + display.otherCursor.style.top = pos.other.top + "px";
14.672 + display.otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
14.673 + } else { display.otherCursor.style.display = "none"; }
14.674 + }
14.675 +
14.676 + // Highlight selection
14.677 + function updateSelectionRange(cm) {
14.678 + var display = cm.display, doc = cm.view.doc, sel = cm.view.sel;
14.679 + var fragment = document.createDocumentFragment();
14.680 + var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
14.681 +
14.682 + function add(left, top, width, bottom) {
14.683 + if (top < 0) top = 0;
14.684 + fragment.appendChild(elt("div", null, "CodeMirror-selected", "position: absolute; left: " + left +
14.685 + "px; top: " + top + "px; width: " + (width == null ? clientWidth - left : width) +
14.686 + "px; height: " + (bottom - top) + "px"));
14.687 + }
14.688 +
14.689 + function drawForLine(line, fromArg, toArg, retTop) {
14.690 + var lineObj = getLine(doc, line);
14.691 + var lineLen = lineObj.text.length, rVal = retTop ? Infinity : -Infinity;
14.692 + function coords(ch) {
14.693 + return charCoords(cm, {line: line, ch: ch}, "div", lineObj);
14.694 + }
14.695 +
14.696 + iterateBidiSections(getOrder(lineObj), fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir) {
14.697 + var leftPos = coords(dir == "rtl" ? to - 1 : from);
14.698 + var rightPos = coords(dir == "rtl" ? from : to - 1);
14.699 + var left = leftPos.left, right = rightPos.right;
14.700 + if (rightPos.top - leftPos.top > 3) { // Different lines, draw top part
14.701 + add(left, leftPos.top, null, leftPos.bottom);
14.702 + left = pl;
14.703 + if (leftPos.bottom < rightPos.top) add(left, leftPos.bottom, null, rightPos.top);
14.704 + }
14.705 + if (toArg == null && to == lineLen) right = clientWidth;
14.706 + if (fromArg == null && from == 0) left = pl;
14.707 + rVal = retTop ? Math.min(rightPos.top, rVal) : Math.max(rightPos.bottom, rVal);
14.708 + if (left < pl + 1) left = pl;
14.709 + add(left, rightPos.top, right - left, rightPos.bottom);
14.710 + });
14.711 + return rVal;
14.712 + }
14.713 +
14.714 + if (sel.from.line == sel.to.line) {
14.715 + drawForLine(sel.from.line, sel.from.ch, sel.to.ch);
14.716 + } else {
14.717 + var fromObj = getLine(doc, sel.from.line);
14.718 + var cur = fromObj, merged, path = [sel.from.line, sel.from.ch], singleLine;
14.719 + while (merged = collapsedSpanAtEnd(cur)) {
14.720 + var found = merged.find();
14.721 + path.push(found.from.ch, found.to.line, found.to.ch);
14.722 + if (found.to.line == sel.to.line) {
14.723 + path.push(sel.to.ch);
14.724 + singleLine = true;
14.725 + break;
14.726 + }
14.727 + cur = getLine(doc, found.to.line);
14.728 + }
14.729 +
14.730 + // This is a single, merged line
14.731 + if (singleLine) {
14.732 + for (var i = 0; i < path.length; i += 3)
14.733 + drawForLine(path[i], path[i+1], path[i+2]);
14.734 + } else {
14.735 + var middleTop, middleBot, toObj = getLine(doc, sel.to.line);
14.736 + if (sel.from.ch)
14.737 + // Draw the first line of selection.
14.738 + middleTop = drawForLine(sel.from.line, sel.from.ch, null, false);
14.739 + else
14.740 + // Simply include it in the middle block.
14.741 + middleTop = heightAtLine(cm, fromObj) - display.viewOffset;
14.742 +
14.743 + if (!sel.to.ch)
14.744 + middleBot = heightAtLine(cm, toObj) - display.viewOffset;
14.745 + else
14.746 + middleBot = drawForLine(sel.to.line, collapsedSpanAtStart(toObj) ? null : 0, sel.to.ch, true);
14.747 +
14.748 + if (middleTop < middleBot) add(pl, middleTop, null, middleBot);
14.749 + }
14.750 + }
14.751 +
14.752 + removeChildrenAndAdd(display.selectionDiv, fragment);
14.753 + display.selectionDiv.style.display = "";
14.754 + }
14.755 +
14.756 + // Cursor-blinking
14.757 + function restartBlink(cm) {
14.758 + var display = cm.display;
14.759 + clearInterval(display.blinker);
14.760 + var on = true;
14.761 + display.cursor.style.visibility = display.otherCursor.style.visibility = "";
14.762 + display.blinker = setInterval(function() {
14.763 + if (!display.cursor.offsetHeight) return;
14.764 + display.cursor.style.visibility = display.otherCursor.style.visibility = (on = !on) ? "" : "hidden";
14.765 + }, cm.options.cursorBlinkRate);
14.766 + }
14.767 +
14.768 + // HIGHLIGHT WORKER
14.769 +
14.770 + function startWorker(cm, time) {
14.771 + if (cm.view.frontier < cm.display.showingTo)
14.772 + cm.view.highlight.set(time, bind(highlightWorker, cm));
14.773 + }
14.774 +
14.775 + function highlightWorker(cm) {
14.776 + var view = cm.view, doc = view.doc;
14.777 + if (view.frontier >= cm.display.showingTo) return;
14.778 + var end = +new Date + cm.options.workTime;
14.779 + var state = copyState(view.mode, getStateBefore(cm, view.frontier));
14.780 + var changed = [], prevChange;
14.781 + doc.iter(view.frontier, Math.min(doc.size, cm.display.showingTo + 500), function(line) {
14.782 + if (view.frontier >= cm.display.showingFrom) { // Visible
14.783 + if (highlightLine(cm, line, state) && view.frontier >= cm.display.showingFrom) {
14.784 + if (prevChange && prevChange.end == view.frontier) prevChange.end++;
14.785 + else changed.push(prevChange = {start: view.frontier, end: view.frontier + 1});
14.786 + }
14.787 + line.stateAfter = copyState(view.mode, state);
14.788 + } else {
14.789 + processLine(cm, line, state);
14.790 + line.stateAfter = view.frontier % 5 == 0 ? copyState(view.mode, state) : null;
14.791 + }
14.792 + ++view.frontier;
14.793 + if (+new Date > end) {
14.794 + startWorker(cm, cm.options.workDelay);
14.795 + return true;
14.796 + }
14.797 + });
14.798 + if (changed.length)
14.799 + operation(cm, function() {
14.800 + for (var i = 0; i < changed.length; ++i)
14.801 + regChange(this, changed[i].start, changed[i].end);
14.802 + })();
14.803 + }
14.804 +
14.805 + // Finds the line to start with when starting a parse. Tries to
14.806 + // find a line with a stateAfter, so that it can start with a
14.807 + // valid state. If that fails, it returns the line with the
14.808 + // smallest indentation, which tends to need the least context to
14.809 + // parse correctly.
14.810 + function findStartLine(cm, n) {
14.811 + var minindent, minline, doc = cm.view.doc;
14.812 + for (var search = n, lim = n - 100; search > lim; --search) {
14.813 + if (search == 0) return 0;
14.814 + var line = getLine(doc, search-1);
14.815 + if (line.stateAfter) return search;
14.816 + var indented = countColumn(line.text, null, cm.options.tabSize);
14.817 + if (minline == null || minindent > indented) {
14.818 + minline = search - 1;
14.819 + minindent = indented;
14.820 + }
14.821 + }
14.822 + return minline;
14.823 + }
14.824 +
14.825 + function getStateBefore(cm, n) {
14.826 + var view = cm.view;
14.827 + var pos = findStartLine(cm, n), state = pos && getLine(view.doc, pos-1).stateAfter;
14.828 + if (!state) state = startState(view.mode);
14.829 + else state = copyState(view.mode, state);
14.830 + view.doc.iter(pos, n, function(line) {
14.831 + processLine(cm, line, state);
14.832 + var save = pos == n - 1 || pos % 5 == 0 || pos >= view.showingFrom && pos < view.showingTo;
14.833 + line.stateAfter = save ? copyState(view.mode, state) : null;
14.834 + ++pos;
14.835 + });
14.836 + return state;
14.837 + }
14.838 +
14.839 + // POSITION MEASUREMENT
14.840 +
14.841 + function paddingTop(display) {return display.lineSpace.offsetTop;}
14.842 + function paddingLeft(display) {
14.843 + var e = removeChildrenAndAdd(display.measure, elt("pre")).appendChild(elt("span", "x"));
14.844 + return e.offsetLeft;
14.845 + }
14.846 +
14.847 + function measureChar(cm, line, ch, data) {
14.848 + var data = data || measureLine(cm, line), dir = -1;
14.849 + for (var pos = ch;; pos += dir) {
14.850 + var r = data[pos];
14.851 + if (r) break;
14.852 + if (dir < 0 && pos == 0) dir = 1;
14.853 + }
14.854 + return {left: pos < ch ? r.right : r.left,
14.855 + right: pos > ch ? r.left : r.right,
14.856 + top: r.top, bottom: r.bottom};
14.857 + }
14.858 +
14.859 + function measureLine(cm, line) {
14.860 + // First look in the cache
14.861 + var display = cm.display, cache = cm.display.measureLineCache;
14.862 + for (var i = 0; i < cache.length; ++i) {
14.863 + var memo = cache[i];
14.864 + if (memo.text == line.text && memo.markedSpans == line.markedSpans &&
14.865 + display.scroller.clientWidth == memo.width)
14.866 + return memo.measure;
14.867 + }
14.868 +
14.869 + var measure = measureLineInner(cm, line);
14.870 + // Store result in the cache
14.871 + var memo = {text: line.text, width: display.scroller.clientWidth,
14.872 + markedSpans: line.markedSpans, measure: measure};
14.873 + if (cache.length == 16) cache[++display.measureLineCachePos % 16] = memo;
14.874 + else cache.push(memo);
14.875 + return measure;
14.876 + }
14.877 +
14.878 + function measureLineInner(cm, line) {
14.879 + var display = cm.display, measure = emptyArray(line.text.length);
14.880 + var pre = lineContent(cm, line, measure);
14.881 +
14.882 + // IE does not cache element positions of inline elements between
14.883 + // calls to getBoundingClientRect. This makes the loop below,
14.884 + // which gathers the positions of all the characters on the line,
14.885 + // do an amount of layout work quadratic to the number of
14.886 + // characters. When line wrapping is off, we try to improve things
14.887 + // by first subdividing the line into a bunch of inline blocks, so
14.888 + // that IE can reuse most of the layout information from caches
14.889 + // for those blocks. This does interfere with line wrapping, so it
14.890 + // doesn't work when wrapping is on, but in that case the
14.891 + // situation is slightly better, since IE does cache line-wrapping
14.892 + // information and only recomputes per-line.
14.893 + if (ie && !ie_lt8 && !cm.options.lineWrapping && pre.childNodes.length > 100) {
14.894 + var fragment = document.createDocumentFragment();
14.895 + var chunk = 10, n = pre.childNodes.length;
14.896 + for (var i = 0, chunks = Math.ceil(n / chunk); i < chunks; ++i) {
14.897 + var wrap = elt("div", null, null, "display: inline-block");
14.898 + for (var j = 0; j < chunk && n; ++j) {
14.899 + wrap.appendChild(pre.firstChild);
14.900 + --n;
14.901 + }
14.902 + fragment.appendChild(wrap);
14.903 + }
14.904 + pre.appendChild(fragment);
14.905 + }
14.906 +
14.907 + removeChildrenAndAdd(display.measure, pre);
14.908 +
14.909 + var outer = display.lineDiv.getBoundingClientRect();
14.910 + var vranges = [], data = emptyArray(line.text.length), maxBot = pre.offsetHeight;
14.911 + for (var i = 0, cur; i < measure.length; ++i) if (cur = measure[i]) {
14.912 + var size = cur.getBoundingClientRect();
14.913 + var top = Math.max(0, size.top - outer.top), bot = Math.min(size.bottom - outer.top, maxBot);
14.914 + for (var j = 0; j < vranges.length; j += 2) {
14.915 + var rtop = vranges[j], rbot = vranges[j+1];
14.916 + if (rtop > bot || rbot < top) continue;
14.917 + if (rtop <= top && rbot >= bot ||
14.918 + top <= rtop && bot >= rbot ||
14.919 + Math.min(bot, rbot) - Math.max(top, rtop) >= (bot - top) >> 1) {
14.920 + vranges[j] = Math.min(top, rtop);
14.921 + vranges[j+1] = Math.max(bot, rbot);
14.922 + break;
14.923 + }
14.924 + }
14.925 + if (j == vranges.length) vranges.push(top, bot);
14.926 + data[i] = {left: size.left - outer.left, right: size.right - outer.left, top: j};
14.927 + }
14.928 + for (var i = 0, cur; i < data.length; ++i) if (cur = data[i]) {
14.929 + var vr = cur.top;
14.930 + cur.top = vranges[vr]; cur.bottom = vranges[vr+1];
14.931 + }
14.932 + return data;
14.933 + }
14.934 +
14.935 + function clearCaches(cm) {
14.936 + cm.display.measureLineCache.length = cm.display.measureLineCachePos = 0;
14.937 + cm.display.cachedCharWidth = cm.display.cachedTextHeight = null;
14.938 + cm.view.maxLineChanged = true;
14.939 + }
14.940 +
14.941 + // Context is one of "line", "div" (display.lineDiv), "local"/null (editor), or "page"
14.942 + function intoCoordSystem(cm, lineObj, rect, context) {
14.943 + if (lineObj.widgets) for (var i = 0; i < lineObj.widgets.length; ++i) if (lineObj.widgets[i].above) {
14.944 + var size = lineObj.widgets[i].node.offsetHeight;
14.945 + rect.top += size; rect.bottom += size;
14.946 + }
14.947 + if (context == "line") return rect;
14.948 + if (!context) context = "local";
14.949 + var yOff = heightAtLine(cm, lineObj);
14.950 + if (context != "local") yOff -= cm.display.viewOffset;
14.951 + if (context == "page") {
14.952 + var lOff = cm.display.lineSpace.getBoundingClientRect();
14.953 + yOff += lOff.top + (window.pageYOffset || (document.documentElement || document.body).scrollTop);
14.954 + var xOff = lOff.left + (window.pageXOffset || (document.documentElement || document.body).scrollLeft);
14.955 + rect.left += xOff; rect.right += xOff;
14.956 + }
14.957 + rect.top += yOff; rect.bottom += yOff;
14.958 + return rect;
14.959 + }
14.960 +
14.961 + function charCoords(cm, pos, context, lineObj) {
14.962 + if (!lineObj) lineObj = getLine(cm.view.doc, pos.line);
14.963 + return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch), context);
14.964 + }
14.965 +
14.966 + function cursorCoords(cm, pos, context, lineObj, measurement) {
14.967 + lineObj = lineObj || getLine(cm.view.doc, pos.line);
14.968 + if (!measurement) measurement = measureLine(cm, lineObj);
14.969 + function get(ch, right) {
14.970 + var m = measureChar(cm, lineObj, ch, measurement);
14.971 + if (right) m.left = m.right; else m.right = m.left;
14.972 + return intoCoordSystem(cm, lineObj, m, context);
14.973 + }
14.974 + var order = getOrder(lineObj), ch = pos.ch;
14.975 + if (!order) return get(ch);
14.976 + var main, other, linedir = order[0].level;
14.977 + for (var i = 0; i < order.length; ++i) {
14.978 + var part = order[i], rtl = part.level % 2, nb, here;
14.979 + if (part.from < ch && part.to > ch) return get(ch, rtl);
14.980 + var left = rtl ? part.to : part.from, right = rtl ? part.from : part.to;
14.981 + if (left == ch) {
14.982 + // Opera and IE return bogus offsets and widths for edges
14.983 + // where the direction flips, but only for the side with the
14.984 + // lower level. So we try to use the side with the higher
14.985 + // level.
14.986 + if (i && part.level < (nb = order[i-1]).level) here = get(nb.level % 2 ? nb.from : nb.to - 1, true);
14.987 + else here = get(rtl && part.from != part.to ? ch - 1 : ch);
14.988 + if (rtl == linedir) main = here; else other = here;
14.989 + } else if (right == ch) {
14.990 + var nb = i < order.length - 1 && order[i+1];
14.991 + if (!rtl && nb && nb.from == nb.to) continue;
14.992 + if (nb && part.level < nb.level) here = get(nb.level % 2 ? nb.to - 1 : nb.from);
14.993 + else here = get(rtl ? ch : ch - 1, true);
14.994 + if (rtl == linedir) main = here; else other = here;
14.995 + }
14.996 + }
14.997 + if (linedir && !ch) other = get(order[0].to - 1);
14.998 + if (!main) return other;
14.999 + if (other) main.other = other;
14.1000 + return main;
14.1001 + }
14.1002 +
14.1003 + // Coords must be lineSpace-local
14.1004 + function coordsChar(cm, x, y) {
14.1005 + var doc = cm.view.doc;
14.1006 + y += cm.display.viewOffset;
14.1007 + if (y < 0) return {line: 0, ch: 0, outside: true};
14.1008 + var lineNo = lineAtHeight(doc, y);
14.1009 + if (lineNo >= doc.size) return {line: doc.size - 1, ch: getLine(doc, doc.size - 1).text.length};
14.1010 + if (x < 0) x = 0;
14.1011 +
14.1012 + for (;;) {
14.1013 + var lineObj = getLine(doc, lineNo);
14.1014 + var found = coordsCharInner(cm, lineObj, lineNo, x, y);
14.1015 + var merged = collapsedSpanAtEnd(lineObj);
14.1016 + if (merged && found.ch == lineRight(lineObj))
14.1017 + lineNo = merged.find().to.line;
14.1018 + else
14.1019 + return found;
14.1020 + }
14.1021 + }
14.1022 +
14.1023 + function coordsCharInner(cm, lineObj, lineNo, x, y) {
14.1024 + var innerOff = y - heightAtLine(cm, lineObj);
14.1025 + var wrongLine = false, cWidth = cm.display.wrapper.clientWidth;
14.1026 + var measurement = measureLine(cm, lineObj);
14.1027 +
14.1028 + function getX(ch) {
14.1029 + var sp = cursorCoords(cm, {line: lineNo, ch: ch}, "line",
14.1030 + lineObj, measurement);
14.1031 + wrongLine = true;
14.1032 + if (innerOff > sp.bottom) return Math.max(0, sp.left - cWidth);
14.1033 + else if (innerOff < sp.top) return sp.left + cWidth;
14.1034 + else wrongLine = false;
14.1035 + return sp.left;
14.1036 + }
14.1037 +
14.1038 + var bidi = getOrder(lineObj), dist = lineObj.text.length;
14.1039 + var from = lineLeft(lineObj), to = lineRight(lineObj);
14.1040 + var fromX = paddingLeft(cm.display), toX = getX(to);
14.1041 +
14.1042 + if (x > toX) return {line: lineNo, ch: to, outside: wrongLine};
14.1043 + // Do a binary search between these bounds.
14.1044 + for (;;) {
14.1045 + if (bidi ? to == from || to == moveVisually(lineObj, from, 1) : to - from <= 1) {
14.1046 + var after = x - fromX < toX - x, ch = after ? from : to;
14.1047 + while (isExtendingChar.test(lineObj.text.charAt(ch))) ++ch;
14.1048 + return {line: lineNo, ch: ch, after: after, outside: wrongLine};
14.1049 + }
14.1050 + var step = Math.ceil(dist / 2), middle = from + step;
14.1051 + if (bidi) {
14.1052 + middle = from;
14.1053 + for (var i = 0; i < step; ++i) middle = moveVisually(lineObj, middle, 1);
14.1054 + }
14.1055 + var middleX = getX(middle);
14.1056 + if (middleX > x) {to = middle; toX = middleX; if (wrongLine) toX += 1000; dist -= step;}
14.1057 + else {from = middle; fromX = middleX; dist = step;}
14.1058 + }
14.1059 + }
14.1060 +
14.1061 + var measureText;
14.1062 + function textHeight(display) {
14.1063 + if (display.cachedTextHeight != null) return display.cachedTextHeight;
14.1064 + if (measureText == null) {
14.1065 + measureText = elt("pre");
14.1066 + // Measure a bunch of lines, for browsers that compute
14.1067 + // fractional heights.
14.1068 + for (var i = 0; i < 49; ++i) {
14.1069 + measureText.appendChild(document.createTextNode("x"));
14.1070 + measureText.appendChild(elt("br"));
14.1071 + }
14.1072 + measureText.appendChild(document.createTextNode("x"));
14.1073 + }
14.1074 + removeChildrenAndAdd(display.measure, measureText);
14.1075 + var height = measureText.offsetHeight / 50;
14.1076 + if (height > 3) display.cachedTextHeight = height;
14.1077 + removeChildren(display.measure);
14.1078 + return height || 1;
14.1079 + }
14.1080 +
14.1081 + function charWidth(display) {
14.1082 + if (display.cachedCharWidth != null) return display.cachedCharWidth;
14.1083 + var anchor = elt("span", "x");
14.1084 + var pre = elt("pre", [anchor]);
14.1085 + removeChildrenAndAdd(display.measure, pre);
14.1086 + var width = anchor.offsetWidth;
14.1087 + if (width > 2) display.cachedCharWidth = width;
14.1088 + return width || 10;
14.1089 + }
14.1090 +
14.1091 + // OPERATIONS
14.1092 +
14.1093 + // Operations are used to wrap changes in such a way that each
14.1094 + // change won't have to update the cursor and display (which would
14.1095 + // be awkward, slow, and error-prone), but instead updates are
14.1096 + // batched and then all combined and executed at once.
14.1097 +
14.1098 + function startOperation(cm) {
14.1099 + if (cm.curOp) ++cm.curOp.depth;
14.1100 + else cm.curOp = {
14.1101 + // Nested operations delay update until the outermost one
14.1102 + // finishes.
14.1103 + depth: 1,
14.1104 + // An array of ranges of lines that have to be updated. See
14.1105 + // updateDisplay.
14.1106 + changes: [],
14.1107 + delayedCallbacks: [],
14.1108 + updateInput: null,
14.1109 + userSelChange: null,
14.1110 + textChanged: null,
14.1111 + selectionChanged: false,
14.1112 + updateMaxLine: false,
14.1113 + id: ++cm.nextOpId
14.1114 + };
14.1115 + }
14.1116 +
14.1117 + function endOperation(cm) {
14.1118 + var op = cm.curOp;
14.1119 + if (--op.depth) return;
14.1120 + cm.curOp = null;
14.1121 + var view = cm.view, display = cm.display;
14.1122 + if (op.updateMaxLine) computeMaxLength(view);
14.1123 + if (view.maxLineChanged && !cm.options.lineWrapping) {
14.1124 + var width = measureChar(cm, view.maxLine, view.maxLine.text.length).right;
14.1125 + display.sizer.style.minWidth = (width + 3 + scrollerCutOff) + "px";
14.1126 + view.maxLineChanged = false;
14.1127 + }
14.1128 + var newScrollPos, updated;
14.1129 + if (op.selectionChanged) {
14.1130 + var coords = cursorCoords(cm, view.sel.head);
14.1131 + newScrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
14.1132 + }
14.1133 + if (op.changes.length || newScrollPos && newScrollPos.scrollTop != null)
14.1134 + updated = updateDisplay(cm, op.changes, newScrollPos && newScrollPos.scrollTop);
14.1135 + if (!updated && op.selectionChanged) updateSelection(cm);
14.1136 + if (newScrollPos) scrollCursorIntoView(cm);
14.1137 + if (op.selectionChanged) restartBlink(cm);
14.1138 +
14.1139 + if (view.focused && op.updateInput)
14.1140 + resetInput(cm, op.userSelChange);
14.1141 +
14.1142 + if (op.textChanged)
14.1143 + signal(cm, "change", cm, op.textChanged);
14.1144 + if (op.selectionChanged) signal(cm, "cursorActivity", cm);
14.1145 + for (var i = 0; i < op.delayedCallbacks.length; ++i) op.delayedCallbacks[i](cm);
14.1146 + }
14.1147 +
14.1148 + // Wraps a function in an operation. Returns the wrapped function.
14.1149 + function operation(cm1, f) {
14.1150 + return function() {
14.1151 + var cm = cm1 || this;
14.1152 + startOperation(cm);
14.1153 + try {var result = f.apply(cm, arguments);}
14.1154 + finally {endOperation(cm);}
14.1155 + return result;
14.1156 + };
14.1157 + }
14.1158 +
14.1159 + function regChange(cm, from, to, lendiff) {
14.1160 + cm.curOp.changes.push({from: from, to: to, diff: lendiff});
14.1161 + }
14.1162 +
14.1163 + // INPUT HANDLING
14.1164 +
14.1165 + function slowPoll(cm) {
14.1166 + if (cm.view.pollingFast) return;
14.1167 + cm.display.poll.set(cm.options.pollInterval, function() {
14.1168 + readInput(cm);
14.1169 + if (cm.view.focused) slowPoll(cm);
14.1170 + });
14.1171 + }
14.1172 +
14.1173 + function fastPoll(cm) {
14.1174 + var missed = false;
14.1175 + cm.display.pollingFast = true;
14.1176 + function p() {
14.1177 + var changed = readInput(cm);
14.1178 + if (!changed && !missed) {missed = true; cm.display.poll.set(60, p);}
14.1179 + else {cm.display.pollingFast = false; slowPoll(cm);}
14.1180 + }
14.1181 + cm.display.poll.set(20, p);
14.1182 + }
14.1183 +
14.1184 + // prevInput is a hack to work with IME. If we reset the textarea
14.1185 + // on every change, that breaks IME. So we look for changes
14.1186 + // compared to the previous content instead. (Modern browsers have
14.1187 + // events that indicate IME taking place, but these are not widely
14.1188 + // supported or compatible enough yet to rely on.)
14.1189 + function readInput(cm) {
14.1190 + var input = cm.display.input, prevInput = cm.display.prevInput, view = cm.view, sel = view.sel;
14.1191 + if (!view.focused || hasSelection(input) || isReadOnly(cm)) return false;
14.1192 + var text = input.value;
14.1193 + if (text == prevInput && posEq(sel.from, sel.to)) return false;
14.1194 + startOperation(cm);
14.1195 + view.sel.shift = false;
14.1196 + var same = 0, l = Math.min(prevInput.length, text.length);
14.1197 + while (same < l && prevInput[same] == text[same]) ++same;
14.1198 + var from = sel.from, to = sel.to;
14.1199 + if (same < prevInput.length)
14.1200 + from = {line: from.line, ch: from.ch - (prevInput.length - same)};
14.1201 + else if (view.overwrite && posEq(from, to) && !cm.display.pasteIncoming)
14.1202 + to = {line: to.line, ch: Math.min(getLine(cm.view.doc, to.line).text.length, to.ch + (text.length - same))};
14.1203 + var updateInput = cm.curOp.updateInput;
14.1204 + updateDoc(cm, from, to, splitLines(text.slice(same)), "end",
14.1205 + cm.display.pasteIncoming ? "paste" : "input", {from: from, to: to});
14.1206 + cm.curOp.updateInput = updateInput;
14.1207 + if (text.length > 1000) input.value = cm.display.prevInput = "";
14.1208 + else cm.display.prevInput = text;
14.1209 + endOperation(cm);
14.1210 + cm.display.pasteIncoming = false;
14.1211 + return true;
14.1212 + }
14.1213 +
14.1214 + function resetInput(cm, user) {
14.1215 + var view = cm.view, minimal, selected;
14.1216 + if (!posEq(view.sel.from, view.sel.to)) {
14.1217 + cm.display.prevInput = "";
14.1218 + minimal = hasCopyEvent &&
14.1219 + (view.sel.to.line - view.sel.from.line > 100 || (selected = cm.getSelection()).length > 1000);
14.1220 + if (minimal) cm.display.input.value = "-";
14.1221 + else cm.display.input.value = selected || cm.getSelection();
14.1222 + if (view.focused) selectInput(cm.display.input);
14.1223 + } else if (user) cm.display.prevInput = cm.display.input.value = "";
14.1224 + cm.display.inaccurateSelection = minimal;
14.1225 + }
14.1226 +
14.1227 + function focusInput(cm) {
14.1228 + if (cm.options.readOnly != "nocursor" && (ie || document.activeElement != cm.display.input))
14.1229 + cm.display.input.focus();
14.1230 + }
14.1231 +
14.1232 + function isReadOnly(cm) {
14.1233 + return cm.options.readOnly || cm.view.cantEdit;
14.1234 + }
14.1235 +
14.1236 + // EVENT HANDLERS
14.1237 +
14.1238 + function registerEventHandlers(cm) {
14.1239 + var d = cm.display;
14.1240 + on(d.scroller, "mousedown", operation(cm, onMouseDown));
14.1241 + on(d.scroller, "dblclick", operation(cm, e_preventDefault));
14.1242 + on(d.lineSpace, "selectstart", function(e) {
14.1243 + if (!mouseEventInWidget(d, e)) e_preventDefault(e);
14.1244 + });
14.1245 + // Gecko browsers fire contextmenu *after* opening the menu, at
14.1246 + // which point we can't mess with it anymore. Context menu is
14.1247 + // handled in onMouseDown for Gecko.
14.1248 + if (!gecko) on(d.scroller, "contextmenu", function(e) {onContextMenu(cm, e);});
14.1249 +
14.1250 + on(d.scroller, "scroll", function() {
14.1251 + setScrollTop(cm, d.scroller.scrollTop);
14.1252 + setScrollLeft(cm, d.scroller.scrollLeft, true);
14.1253 + signal(cm, "scroll", cm);
14.1254 + });
14.1255 + on(d.scrollbarV, "scroll", function() {
14.1256 + setScrollTop(cm, d.scrollbarV.scrollTop);
14.1257 + });
14.1258 + on(d.scrollbarH, "scroll", function() {
14.1259 + setScrollLeft(cm, d.scrollbarH.scrollLeft);
14.1260 + });
14.1261 +
14.1262 + on(d.scroller, "mousewheel", function(e){onScrollWheel(cm, e);});
14.1263 + on(d.scroller, "DOMMouseScroll", function(e){onScrollWheel(cm, e);});
14.1264 +
14.1265 + function reFocus() { if (cm.view.focused) setTimeout(bind(focusInput, cm), 0); }
14.1266 + on(d.scrollbarH, "mousedown", reFocus);
14.1267 + on(d.scrollbarV, "mousedown", reFocus);
14.1268 + // Prevent wrapper from ever scrolling
14.1269 + on(d.wrapper, "scroll", function() { d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
14.1270 + on(window, "resize", function resizeHandler() {
14.1271 + // Might be a text scaling operation, clear size caches.
14.1272 + d.cachedCharWidth = d.cachedTextHeight = null;
14.1273 + clearCaches(cm);
14.1274 + if (d.wrapper.parentNode) updateDisplay(cm, true);
14.1275 + else off(window, "resize", resizeHandler);
14.1276 + });
14.1277 +
14.1278 + on(d.input, "keyup", operation(cm, function(e) {
14.1279 + if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
14.1280 + if (e_prop(e, "keyCode") == 16) cm.view.sel.shift = false;
14.1281 + }));
14.1282 + on(d.input, "input", bind(fastPoll, cm));
14.1283 + on(d.input, "keydown", operation(cm, onKeyDown));
14.1284 + on(d.input, "keypress", operation(cm, onKeyPress));
14.1285 + on(d.input, "focus", bind(onFocus, cm));
14.1286 + on(d.input, "blur", bind(onBlur, cm));
14.1287 +
14.1288 + function drag_(e) {
14.1289 + if (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return;
14.1290 + e_stop(e);
14.1291 + }
14.1292 + if (cm.options.dragDrop) {
14.1293 + on(d.scroller, "dragstart", function(e){onDragStart(cm, e);});
14.1294 + on(d.scroller, "dragenter", drag_);
14.1295 + on(d.scroller, "dragover", drag_);
14.1296 + on(d.scroller, "drop", operation(cm, onDrop));
14.1297 + }
14.1298 + on(d.scroller, "paste", function(){focusInput(cm); fastPoll(cm);});
14.1299 + on(d.input, "paste", function() {
14.1300 + d.pasteIncoming = true;
14.1301 + fastPoll(cm);
14.1302 + });
14.1303 +
14.1304 + function prepareCopy() {
14.1305 + if (d.inaccurateSelection) {
14.1306 + d.prevInput = "";
14.1307 + d.inaccurateSelection = false;
14.1308 + d.input.value = cm.getSelection();
14.1309 + selectInput(d.input);
14.1310 + }
14.1311 + }
14.1312 + on(d.input, "cut", prepareCopy);
14.1313 + on(d.input, "copy", prepareCopy);
14.1314 +
14.1315 + // Needed to handle Tab key in KHTML
14.1316 + if (khtml) on(d.sizer, "mouseup", function() {
14.1317 + if (document.activeElement == d.input) d.input.blur();
14.1318 + focusInput(cm);
14.1319 + });
14.1320 + }
14.1321 +
14.1322 + function mouseEventInWidget(display, e) {
14.1323 + for (var n = e_target(e); n != display.wrapper; n = n.parentNode)
14.1324 + if (/\bCodeMirror-(?:line)?widget\b/.test(n.className) ||
14.1325 + n.parentNode == display.sizer && n != display.mover) return true;
14.1326 + }
14.1327 +
14.1328 + function posFromMouse(cm, e, liberal) {
14.1329 + var display = cm.display;
14.1330 + if (!liberal) {
14.1331 + var target = e_target(e);
14.1332 + if (target == display.scrollbarH || target == display.scrollbarH.firstChild ||
14.1333 + target == display.scrollbarV || target == display.scrollbarV.firstChild ||
14.1334 + target == display.scrollbarFiller) return null;
14.1335 + }
14.1336 + var x, y, space = display.lineSpace.getBoundingClientRect();
14.1337 + // Fails unpredictably on IE[67] when mouse is dragged around quickly.
14.1338 + try { x = e.clientX; y = e.clientY; } catch (e) { return null; }
14.1339 + return coordsChar(cm, x - space.left, y - space.top);
14.1340 + }
14.1341 +
14.1342 + var lastClick, lastDoubleClick;
14.1343 + function onMouseDown(e) {
14.1344 + var cm = this, display = cm.display, view = cm.view, sel = view.sel, doc = view.doc;
14.1345 + sel.shift = e_prop(e, "shiftKey");
14.1346 +
14.1347 + if (mouseEventInWidget(display, e)) {
14.1348 + if (!webkit) {
14.1349 + display.scroller.draggable = false;
14.1350 + setTimeout(function(){display.scroller.draggable = true;}, 100);
14.1351 + }
14.1352 + return;
14.1353 + }
14.1354 + if (clickInGutter(cm, e)) return;
14.1355 + var start = posFromMouse(cm, e);
14.1356 +
14.1357 + switch (e_button(e)) {
14.1358 + case 3:
14.1359 + if (gecko) onContextMenu.call(cm, cm, e);
14.1360 + return;
14.1361 + case 2:
14.1362 + if (start) extendSelection(cm, start);
14.1363 + setTimeout(bind(focusInput, cm), 20);
14.1364 + e_preventDefault(e);
14.1365 + return;
14.1366 + }
14.1367 + // For button 1, if it was clicked inside the editor
14.1368 + // (posFromMouse returning non-null), we have to adjust the
14.1369 + // selection.
14.1370 + if (!start) {if (e_target(e) == display.scroller) e_preventDefault(e); return;}
14.1371 +
14.1372 + if (!view.focused) onFocus(cm);
14.1373 +
14.1374 + var now = +new Date, type = "single";
14.1375 + if (lastDoubleClick && lastDoubleClick.time > now - 400 && posEq(lastDoubleClick.pos, start)) {
14.1376 + type = "triple";
14.1377 + e_preventDefault(e);
14.1378 + setTimeout(bind(focusInput, cm), 20);
14.1379 + selectLine(cm, start.line);
14.1380 + } else if (lastClick && lastClick.time > now - 400 && posEq(lastClick.pos, start)) {
14.1381 + type = "double";
14.1382 + lastDoubleClick = {time: now, pos: start};
14.1383 + e_preventDefault(e);
14.1384 + var word = findWordAt(getLine(doc, start.line).text, start);
14.1385 + extendSelection(cm, word.from, word.to);
14.1386 + } else { lastClick = {time: now, pos: start}; }
14.1387 +
14.1388 + var last = start;
14.1389 + if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) &&
14.1390 + !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
14.1391 + var dragEnd = operation(cm, function(e2) {
14.1392 + if (webkit) display.scroller.draggable = false;
14.1393 + view.draggingText = false;
14.1394 + off(document, "mouseup", dragEnd);
14.1395 + off(display.scroller, "drop", dragEnd);
14.1396 + if (Math.abs(e.clientX - e2.clientX) + Math.abs(e.clientY - e2.clientY) < 10) {
14.1397 + e_preventDefault(e2);
14.1398 + extendSelection(cm, start);
14.1399 + focusInput(cm);
14.1400 + }
14.1401 + });
14.1402 + // Let the drag handler handle this.
14.1403 + if (webkit) display.scroller.draggable = true;
14.1404 + view.draggingText = dragEnd;
14.1405 + // IE's approach to draggable
14.1406 + if (display.scroller.dragDrop) display.scroller.dragDrop();
14.1407 + on(document, "mouseup", dragEnd);
14.1408 + on(display.scroller, "drop", dragEnd);
14.1409 + return;
14.1410 + }
14.1411 + e_preventDefault(e);
14.1412 + if (type == "single") extendSelection(cm, clipPos(doc, start));
14.1413 +
14.1414 + var startstart = sel.from, startend = sel.to;
14.1415 +
14.1416 + function doSelect(cur) {
14.1417 + if (type == "single") {
14.1418 + extendSelection(cm, clipPos(doc, start), cur);
14.1419 + return;
14.1420 + }
14.1421 +
14.1422 + startstart = clipPos(doc, startstart);
14.1423 + startend = clipPos(doc, startend);
14.1424 + if (type == "double") {
14.1425 + var word = findWordAt(getLine(doc, cur.line).text, cur);
14.1426 + if (posLess(cur, startstart)) extendSelection(cm, word.from, startend);
14.1427 + else extendSelection(cm, startstart, word.to);
14.1428 + } else if (type == "triple") {
14.1429 + if (posLess(cur, startstart)) extendSelection(cm, startend, clipPos(doc, {line: cur.line, ch: 0}));
14.1430 + else extendSelection(cm, startstart, clipPos(doc, {line: cur.line + 1, ch: 0}));
14.1431 + }
14.1432 + }
14.1433 +
14.1434 + var editorSize = display.wrapper.getBoundingClientRect();
14.1435 + // Used to ensure timeout re-tries don't fire when another extend
14.1436 + // happened in the meantime (clearTimeout isn't reliable -- at
14.1437 + // least on Chrome, the timeouts still happen even when cleared,
14.1438 + // if the clear happens after their scheduled firing time).
14.1439 + var counter = 0;
14.1440 +
14.1441 + function extend(e) {
14.1442 + var curCount = ++counter;
14.1443 + var cur = posFromMouse(cm, e, true);
14.1444 + if (!cur) return;
14.1445 + if (!posEq(cur, last)) {
14.1446 + if (!view.focused) onFocus(cm);
14.1447 + last = cur;
14.1448 + doSelect(cur);
14.1449 + var visible = visibleLines(display, doc);
14.1450 + if (cur.line >= visible.to || cur.line < visible.from)
14.1451 + setTimeout(operation(cm, function(){if (counter == curCount) extend(e);}), 150);
14.1452 + } else {
14.1453 + var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
14.1454 + if (outside) setTimeout(operation(cm, function() {
14.1455 + if (counter != curCount) return;
14.1456 + display.scroller.scrollTop += outside;
14.1457 + extend(e);
14.1458 + }), 50);
14.1459 + }
14.1460 + }
14.1461 +
14.1462 + function done(e) {
14.1463 + counter = Infinity;
14.1464 + var cur = posFromMouse(cm, e);
14.1465 + if (cur) doSelect(cur);
14.1466 + e_preventDefault(e);
14.1467 + focusInput(cm);
14.1468 + off(document, "mousemove", move);
14.1469 + off(document, "mouseup", up);
14.1470 + }
14.1471 +
14.1472 + var move = operation(cm, function(e) {
14.1473 + if (!ie && !e_button(e)) done(e);
14.1474 + else extend(e);
14.1475 + });
14.1476 + var up = operation(cm, done);
14.1477 + on(document, "mousemove", move);
14.1478 + on(document, "mouseup", up);
14.1479 + }
14.1480 +
14.1481 + function onDrop(e) {
14.1482 + var cm = this;
14.1483 + if (cm.options.onDragEvent && cm.options.onDragEvent(cm, addStop(e))) return;
14.1484 + e_preventDefault(e);
14.1485 + var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
14.1486 + if (!pos || isReadOnly(cm)) return;
14.1487 + if (files && files.length && window.FileReader && window.File) {
14.1488 + var n = files.length, text = Array(n), read = 0;
14.1489 + var loadFile = function(file, i) {
14.1490 + var reader = new FileReader;
14.1491 + reader.onload = function() {
14.1492 + text[i] = reader.result;
14.1493 + if (++read == n) {
14.1494 + pos = clipPos(cm.view.doc, pos);
14.1495 + operation(cm, function() {
14.1496 + var end = replaceRange(cm, text.join(""), pos, pos, "paste");
14.1497 + setSelection(cm, pos, end);
14.1498 + })();
14.1499 + }
14.1500 + };
14.1501 + reader.readAsText(file);
14.1502 + };
14.1503 + for (var i = 0; i < n; ++i) loadFile(files[i], i);
14.1504 + } else {
14.1505 + // Don't do a replace if the drop happened inside of the selected text.
14.1506 + if (cm.view.draggingText && !(posLess(pos, cm.view.sel.from) || posLess(cm.view.sel.to, pos))) {
14.1507 + cm.view.draggingText(e);
14.1508 + if (ie) setTimeout(bind(focusInput, cm), 50);
14.1509 + return;
14.1510 + }
14.1511 + try {
14.1512 + var text = e.dataTransfer.getData("Text");
14.1513 + if (text) {
14.1514 + var curFrom = cm.view.sel.from, curTo = cm.view.sel.to;
14.1515 + setSelection(cm, pos, pos);
14.1516 + if (cm.view.draggingText) replaceRange(cm, "", curFrom, curTo, "paste");
14.1517 + cm.replaceSelection(text, null, "paste");
14.1518 + focusInput(cm);
14.1519 + onFocus(cm);
14.1520 + }
14.1521 + }
14.1522 + catch(e){}
14.1523 + }
14.1524 + }
14.1525 +
14.1526 + function clickInGutter(cm, e) {
14.1527 + var display = cm.display;
14.1528 + try { var mX = e.clientX, mY = e.clientY; }
14.1529 + catch(e) { return false; }
14.1530 +
14.1531 + if (mX >= Math.floor(display.gutters.getBoundingClientRect().right)) return false;
14.1532 + e_preventDefault(e);
14.1533 + if (!hasHandler(cm, "gutterClick")) return true;
14.1534 +
14.1535 + var lineBox = display.lineDiv.getBoundingClientRect();
14.1536 + if (mY > lineBox.bottom) return true;
14.1537 + mY -= lineBox.top - display.viewOffset;
14.1538 +
14.1539 + for (var i = 0; i < cm.options.gutters.length; ++i) {
14.1540 + var g = display.gutters.childNodes[i];
14.1541 + if (g && g.getBoundingClientRect().right >= mX) {
14.1542 + var line = lineAtHeight(cm.view.doc, mY);
14.1543 + var gutter = cm.options.gutters[i];
14.1544 + signalLater(cm, cm, "gutterClick", cm, line, gutter, e);
14.1545 + break;
14.1546 + }
14.1547 + }
14.1548 + return true;
14.1549 + }
14.1550 +
14.1551 + function onDragStart(cm, e) {
14.1552 + var txt = cm.getSelection();
14.1553 + e.dataTransfer.setData("Text", txt);
14.1554 +
14.1555 + // Use dummy image instead of default browsers image.
14.1556 + // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
14.1557 + if (e.dataTransfer.setDragImage && !safari)
14.1558 + e.dataTransfer.setDragImage(elt('img'), 0, 0);
14.1559 + }
14.1560 +
14.1561 + function setScrollTop(cm, val) {
14.1562 + if (Math.abs(cm.view.scrollTop - val) < 2) return;
14.1563 + cm.view.scrollTop = val;
14.1564 + if (!gecko) updateDisplay(cm, [], val);
14.1565 + if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val;
14.1566 + if (cm.display.scrollbarV.scrollTop != val) cm.display.scrollbarV.scrollTop = val;
14.1567 + if (gecko) updateDisplay(cm, []);
14.1568 + }
14.1569 + function setScrollLeft(cm, val, isScroller) {
14.1570 + if (isScroller ? val == cm.view.scrollLeft : Math.abs(cm.view.scrollLeft - val) < 2) return;
14.1571 + cm.view.scrollLeft = val;
14.1572 + alignHorizontally(cm);
14.1573 + if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val;
14.1574 + if (cm.display.scrollbarH.scrollLeft != val) cm.display.scrollbarH.scrollLeft = val;
14.1575 + }
14.1576 +
14.1577 + // Since the delta values reported on mouse wheel events are
14.1578 + // unstandardized between browsers and even browser versions, and
14.1579 + // generally horribly unpredictable, this code starts by measuring
14.1580 + // the scroll effect that the first few mouse wheel events have,
14.1581 + // and, from that, detects the way it can convert deltas to pixel
14.1582 + // offsets afterwards.
14.1583 + //
14.1584 + // The reason we want to know the amount a wheel event will scroll
14.1585 + // is that it gives us a chance to update the display before the
14.1586 + // actual scrolling happens, reducing flickering.
14.1587 +
14.1588 + var wheelSamples = 0, wheelDX, wheelDY, wheelStartX, wheelStartY, wheelPixelsPerUnit = null;
14.1589 + // Fill in a browser-detected starting value on browsers where we
14.1590 + // know one. These don't have to be accurate -- the result of them
14.1591 + // being wrong would just be a slight flicker on the first wheel
14.1592 + // scroll (if it is large enough).
14.1593 + if (ie) wheelPixelsPerUnit = -.53;
14.1594 + else if (gecko) wheelPixelsPerUnit = 15;
14.1595 + else if (chrome) wheelPixelsPerUnit = -.7;
14.1596 + else if (safari) wheelPixelsPerUnit = -1/3;
14.1597 +
14.1598 + function onScrollWheel(cm, e) {
14.1599 + var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
14.1600 + if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
14.1601 + if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
14.1602 + else if (dy == null) dy = e.wheelDelta;
14.1603 +
14.1604 + // Webkit browsers on OS X abort momentum scrolls when the target
14.1605 + // of the scroll event is removed from the scrollable element.
14.1606 + // This hack (see related code in patchDisplay) makes sure the
14.1607 + // element is kept around.
14.1608 + if (dy && mac && webkit) {
14.1609 + for (var cur = e.target; cur != scroll; cur = cur.parentNode) {
14.1610 + if (cur.lineObj) {
14.1611 + cm.display.currentWheelTarget = cur;
14.1612 + break;
14.1613 + }
14.1614 + }
14.1615 + }
14.1616 +
14.1617 + var scroll = cm.display.scroller;
14.1618 + // On some browsers, horizontal scrolling will cause redraws to
14.1619 + // happen before the gutter has been realigned, causing it to
14.1620 + // wriggle around in a most unseemly way. When we have an
14.1621 + // estimated pixels/delta value, we just handle horizontal
14.1622 + // scrolling entirely here. It'll be slightly off from native, but
14.1623 + // better than glitching out.
14.1624 + if (dx && !gecko && !opera && wheelPixelsPerUnit != null) {
14.1625 + if (dy)
14.1626 + setScrollTop(cm, Math.max(0, Math.min(scroll.scrollTop + dy * wheelPixelsPerUnit, scroll.scrollHeight - scroll.clientHeight)));
14.1627 + setScrollLeft(cm, Math.max(0, Math.min(scroll.scrollLeft + dx * wheelPixelsPerUnit, scroll.scrollWidth - scroll.clientWidth)));
14.1628 + e_preventDefault(e);
14.1629 + wheelStartX = null; // Abort measurement, if in progress
14.1630 + return;
14.1631 + }
14.1632 +
14.1633 + if (dy && wheelPixelsPerUnit != null) {
14.1634 + var pixels = dy * wheelPixelsPerUnit;
14.1635 + var top = cm.view.scrollTop, bot = top + cm.display.wrapper.clientHeight;
14.1636 + if (pixels < 0) top = Math.max(0, top + pixels - 50);
14.1637 + else bot = Math.min(cm.view.doc.height, bot + pixels + 50);
14.1638 + updateDisplay(cm, [], {top: top, bottom: bot});
14.1639 + }
14.1640 +
14.1641 + if (wheelSamples < 20) {
14.1642 + if (wheelStartX == null) {
14.1643 + wheelStartX = scroll.scrollLeft; wheelStartY = scroll.scrollTop;
14.1644 + wheelDX = dx; wheelDY = dy;
14.1645 + setTimeout(function() {
14.1646 + if (wheelStartX == null) return;
14.1647 + var movedX = scroll.scrollLeft - wheelStartX;
14.1648 + var movedY = scroll.scrollTop - wheelStartY;
14.1649 + var sample = (movedY && wheelDY && movedY / wheelDY) ||
14.1650 + (movedX && wheelDX && movedX / wheelDX);
14.1651 + wheelStartX = wheelStartY = null;
14.1652 + if (!sample) return;
14.1653 + wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
14.1654 + ++wheelSamples;
14.1655 + }, 200);
14.1656 + } else {
14.1657 + wheelDX += dx; wheelDY += dy;
14.1658 + }
14.1659 + }
14.1660 + }
14.1661 +
14.1662 + function doHandleBinding(cm, bound, dropShift) {
14.1663 + if (typeof bound == "string") {
14.1664 + bound = commands[bound];
14.1665 + if (!bound) return false;
14.1666 + }
14.1667 + // Ensure previous input has been read, so that the handler sees a
14.1668 + // consistent view of the document
14.1669 + if (cm.display.pollingFast && readInput(cm)) cm.display.pollingFast = false;
14.1670 + var view = cm.view, prevShift = view.sel.shift;
14.1671 + try {
14.1672 + if (isReadOnly(cm)) view.suppressEdits = true;
14.1673 + if (dropShift) view.sel.shift = false;
14.1674 + bound(cm);
14.1675 + } catch(e) {
14.1676 + if (e != Pass) throw e;
14.1677 + return false;
14.1678 + } finally {
14.1679 + view.sel.shift = prevShift;
14.1680 + view.suppressEdits = false;
14.1681 + }
14.1682 + return true;
14.1683 + }
14.1684 +
14.1685 + function allKeyMaps(cm) {
14.1686 + var maps = cm.view.keyMaps.slice(0);
14.1687 + maps.push(cm.options.keyMap);
14.1688 + if (cm.options.extraKeys) maps.unshift(cm.options.extraKeys);
14.1689 + return maps;
14.1690 + }
14.1691 +
14.1692 + var maybeTransition;
14.1693 + function handleKeyBinding(cm, e) {
14.1694 + // Handle auto keymap transitions
14.1695 + var startMap = getKeyMap(cm.options.keyMap), next = startMap.auto;
14.1696 + clearTimeout(maybeTransition);
14.1697 + if (next && !isModifierKey(e)) maybeTransition = setTimeout(function() {
14.1698 + if (getKeyMap(cm.options.keyMap) == startMap)
14.1699 + cm.options.keyMap = (next.call ? next.call(null, cm) : next);
14.1700 + }, 50);
14.1701 +
14.1702 + var name = keyNames[e_prop(e, "keyCode")], handled = false;
14.1703 + var flipCtrlCmd = mac && (opera || qtwebkit);
14.1704 + if (name == null || e.altGraphKey) return false;
14.1705 + if (e_prop(e, "altKey")) name = "Alt-" + name;
14.1706 + if (e_prop(e, flipCtrlCmd ? "metaKey" : "ctrlKey")) name = "Ctrl-" + name;
14.1707 + if (e_prop(e, flipCtrlCmd ? "ctrlKey" : "metaKey")) name = "Cmd-" + name;
14.1708 +
14.1709 + var stopped = false;
14.1710 + function stop() { stopped = true; }
14.1711 + var keymaps = allKeyMaps(cm);
14.1712 +
14.1713 + if (e_prop(e, "shiftKey")) {
14.1714 + handled = lookupKey("Shift-" + name, keymaps,
14.1715 + function(b) {return doHandleBinding(cm, b, true);}, stop)
14.1716 + || lookupKey(name, keymaps, function(b) {
14.1717 + if (typeof b == "string" && /^go[A-Z]/.test(b)) return doHandleBinding(cm, b);
14.1718 + }, stop);
14.1719 + } else {
14.1720 + handled = lookupKey(name, keymaps,
14.1721 + function(b) { return doHandleBinding(cm, b); }, stop);
14.1722 + }
14.1723 + if (stopped) handled = false;
14.1724 + if (handled) {
14.1725 + e_preventDefault(e);
14.1726 + restartBlink(cm);
14.1727 + if (ie_lt9) { e.oldKeyCode = e.keyCode; e.keyCode = 0; }
14.1728 + }
14.1729 + return handled;
14.1730 + }
14.1731 +
14.1732 + function handleCharBinding(cm, e, ch) {
14.1733 + var handled = lookupKey("'" + ch + "'", allKeyMaps(cm),
14.1734 + function(b) { return doHandleBinding(cm, b, true); });
14.1735 + if (handled) {
14.1736 + e_preventDefault(e);
14.1737 + restartBlink(cm);
14.1738 + }
14.1739 + return handled;
14.1740 + }
14.1741 +
14.1742 + var lastStoppedKey = null;
14.1743 + function onKeyDown(e) {
14.1744 + var cm = this;
14.1745 + if (!cm.view.focused) onFocus(cm);
14.1746 + if (ie && e.keyCode == 27) { e.returnValue = false; }
14.1747 + if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
14.1748 + var code = e_prop(e, "keyCode");
14.1749 + // IE does strange things with escape.
14.1750 + cm.view.sel.shift = code == 16 || e_prop(e, "shiftKey");
14.1751 + // First give onKeyEvent option a chance to handle this.
14.1752 + var handled = handleKeyBinding(cm, e);
14.1753 + if (opera) {
14.1754 + lastStoppedKey = handled ? code : null;
14.1755 + // Opera has no cut event... we try to at least catch the key combo
14.1756 + if (!handled && code == 88 && !hasCopyEvent && e_prop(e, mac ? "metaKey" : "ctrlKey"))
14.1757 + cm.replaceSelection("");
14.1758 + }
14.1759 + }
14.1760 +
14.1761 + function onKeyPress(e) {
14.1762 + var cm = this;
14.1763 + if (cm.options.onKeyEvent && cm.options.onKeyEvent(cm, addStop(e))) return;
14.1764 + var keyCode = e_prop(e, "keyCode"), charCode = e_prop(e, "charCode");
14.1765 + if (opera && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return;}
14.1766 + if (((opera && (!e.which || e.which < 10)) || khtml) && handleKeyBinding(cm, e)) return;
14.1767 + var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
14.1768 + if (this.options.electricChars && this.view.mode.electricChars &&
14.1769 + this.options.smartIndent && !isReadOnly(this) &&
14.1770 + this.view.mode.electricChars.indexOf(ch) > -1)
14.1771 + setTimeout(operation(cm, function() {indentLine(cm, cm.view.sel.to.line, "smart");}), 75);
14.1772 + if (handleCharBinding(cm, e, ch)) return;
14.1773 + fastPoll(cm);
14.1774 + }
14.1775 +
14.1776 + function onFocus(cm) {
14.1777 + if (cm.options.readOnly == "nocursor") return;
14.1778 + if (!cm.view.focused) {
14.1779 + signal(cm, "focus", cm);
14.1780 + cm.view.focused = true;
14.1781 + if (cm.display.scroller.className.search(/\bCodeMirror-focused\b/) == -1)
14.1782 + cm.display.scroller.className += " CodeMirror-focused";
14.1783 + resetInput(cm, true);
14.1784 + }
14.1785 + slowPoll(cm);
14.1786 + restartBlink(cm);
14.1787 + }
14.1788 + function onBlur(cm) {
14.1789 + if (cm.view.focused) {
14.1790 + signal(cm, "blur", cm);
14.1791 + cm.view.focused = false;
14.1792 + cm.display.scroller.className = cm.display.scroller.className.replace(" CodeMirror-focused", "");
14.1793 + }
14.1794 + clearInterval(cm.display.blinker);
14.1795 + setTimeout(function() {if (!cm.view.focused) cm.view.sel.shift = false;}, 150);
14.1796 + }
14.1797 +
14.1798 + var detectingSelectAll;
14.1799 + function onContextMenu(cm, e) {
14.1800 + var display = cm.display, sel = cm.view.sel;
14.1801 + var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
14.1802 + if (!pos || opera) return; // Opera is difficult.
14.1803 + if (posEq(sel.from, sel.to) || posLess(pos, sel.from) || !posLess(pos, sel.to))
14.1804 + operation(cm, setSelection)(cm, pos, pos);
14.1805 +
14.1806 + var oldCSS = display.input.style.cssText;
14.1807 + display.inputDiv.style.position = "absolute";
14.1808 + display.input.style.cssText = "position: fixed; width: 30px; height: 30px; top: " + (e.clientY - 5) +
14.1809 + "px; left: " + (e.clientX - 5) + "px; z-index: 1000; background: white; outline: none;" +
14.1810 + "border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
14.1811 + focusInput(cm);
14.1812 + resetInput(cm, true);
14.1813 + // Adds "Select all" to context menu in FF
14.1814 + if (posEq(sel.from, sel.to)) display.input.value = display.prevInput = " ";
14.1815 +
14.1816 + function rehide() {
14.1817 + display.inputDiv.style.position = "relative";
14.1818 + display.input.style.cssText = oldCSS;
14.1819 + if (ie_lt9) display.scrollbarV.scrollTop = display.scroller.scrollTop = scrollPos;
14.1820 + slowPoll(cm);
14.1821 +
14.1822 + // Try to detect the user choosing select-all
14.1823 + if (display.input.selectionStart != null) {
14.1824 + clearTimeout(detectingSelectAll);
14.1825 + var extval = display.input.value = " " + (posEq(sel.from, sel.to) ? "" : display.input.value), i = 0;
14.1826 + display.prevInput = " ";
14.1827 + display.input.selectionStart = 1; display.input.selectionEnd = extval.length;
14.1828 + detectingSelectAll = setTimeout(function poll(){
14.1829 + if (display.prevInput == " " && display.input.selectionStart == 0)
14.1830 + operation(cm, commands.selectAll)(cm);
14.1831 + else if (i++ < 10) detectingSelectAll = setTimeout(poll, 500);
14.1832 + else resetInput(cm);
14.1833 + }, 200);
14.1834 + }
14.1835 + }
14.1836 +
14.1837 + if (gecko) {
14.1838 + e_stop(e);
14.1839 + on(window, "mouseup", function mouseup() {
14.1840 + off(window, "mouseup", mouseup);
14.1841 + setTimeout(rehide, 20);
14.1842 + });
14.1843 + } else {
14.1844 + setTimeout(rehide, 50);
14.1845 + }
14.1846 + }
14.1847 +
14.1848 + // UPDATING
14.1849 +
14.1850 + // Replace the range from from to to by the strings in newText.
14.1851 + // Afterwards, set the selection to selFrom, selTo.
14.1852 + function updateDoc(cm, from, to, newText, selUpdate, origin) {
14.1853 + // Possibly split or suppress the update based on the presence
14.1854 + // of read-only spans in its range.
14.1855 + var split = sawReadOnlySpans &&
14.1856 + removeReadOnlyRanges(cm.view.doc, from, to);
14.1857 + if (split) {
14.1858 + for (var i = split.length - 1; i >= 1; --i)
14.1859 + updateDocInner(cm, split[i].from, split[i].to, [""], origin);
14.1860 + if (split.length)
14.1861 + return updateDocInner(cm, split[0].from, split[0].to, newText, selUpdate, origin);
14.1862 + } else {
14.1863 + return updateDocInner(cm, from, to, newText, selUpdate, origin);
14.1864 + }
14.1865 + }
14.1866 +
14.1867 + function updateDocInner(cm, from, to, newText, selUpdate, origin) {
14.1868 + if (cm.view.suppressEdits) return;
14.1869 +
14.1870 + var view = cm.view, doc = view.doc, old = [];
14.1871 + doc.iter(from.line, to.line + 1, function(line) {
14.1872 + old.push(newHL(line.text, line.markedSpans));
14.1873 + });
14.1874 + var startSelFrom = view.sel.from, startSelTo = view.sel.to;
14.1875 + var lines = updateMarkedSpans(hlSpans(old[0]), hlSpans(lst(old)), from.ch, to.ch, newText);
14.1876 + var retval = updateDocNoUndo(cm, from, to, lines, selUpdate, origin);
14.1877 + if (view.history) addChange(cm, from.line, newText.length, old, origin,
14.1878 + startSelFrom, startSelTo, view.sel.from, view.sel.to);
14.1879 + return retval;
14.1880 + }
14.1881 +
14.1882 + function unredoHelper(cm, type) {
14.1883 + var doc = cm.view.doc, hist = cm.view.history;
14.1884 + var set = (type == "undo" ? hist.done : hist.undone).pop();
14.1885 + if (!set) return;
14.1886 + var anti = {events: [], fromBefore: set.fromAfter, toBefore: set.toAfter,
14.1887 + fromAfter: set.fromBefore, toAfter: set.toBefore};
14.1888 + for (var i = set.events.length - 1; i >= 0; i -= 1) {
14.1889 + hist.dirtyCounter += type == "undo" ? -1 : 1;
14.1890 + var change = set.events[i];
14.1891 + var replaced = [], end = change.start + change.added;
14.1892 + doc.iter(change.start, end, function(line) { replaced.push(newHL(line.text, line.markedSpans)); });
14.1893 + anti.events.push({start: change.start, added: change.old.length, old: replaced});
14.1894 + var selPos = i ? null : {from: set.fromBefore, to: set.toBefore};
14.1895 + updateDocNoUndo(cm, {line: change.start, ch: 0}, {line: end - 1, ch: getLine(doc, end-1).text.length},
14.1896 + change.old, selPos, type);
14.1897 + }
14.1898 + (type == "undo" ? hist.undone : hist.done).push(anti);
14.1899 + }
14.1900 +
14.1901 + function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
14.1902 + var view = cm.view, doc = view.doc, display = cm.display;
14.1903 + if (view.suppressEdits) return;
14.1904 +
14.1905 + var nlines = to.line - from.line, firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
14.1906 + var recomputeMaxLength = false, checkWidthStart = from.line;
14.1907 + if (!cm.options.lineWrapping) {
14.1908 + checkWidthStart = lineNo(visualLine(doc, firstLine));
14.1909 + doc.iter(checkWidthStart, to.line + 1, function(line) {
14.1910 + if (lineLength(doc, line) == view.maxLineLength) {
14.1911 + recomputeMaxLength = true;
14.1912 + return true;
14.1913 + }
14.1914 + });
14.1915 + }
14.1916 +
14.1917 + var lastHL = lst(lines), th = textHeight(display);
14.1918 +
14.1919 + // First adjust the line structure
14.1920 + if (from.ch == 0 && to.ch == 0 && hlText(lastHL) == "") {
14.1921 + // This is a whole-line replace. Treated specially to make
14.1922 + // sure line objects move the way they are supposed to.
14.1923 + var added = [];
14.1924 + for (var i = 0, e = lines.length - 1; i < e; ++i)
14.1925 + added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
14.1926 + updateLine(cm, lastLine, lastLine.text, hlSpans(lastHL));
14.1927 + if (nlines) doc.remove(from.line, nlines, cm);
14.1928 + if (added.length) doc.insert(from.line, added);
14.1929 + } else if (firstLine == lastLine) {
14.1930 + if (lines.length == 1) {
14.1931 + updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
14.1932 + firstLine.text.slice(to.ch), hlSpans(lines[0]));
14.1933 + } else {
14.1934 + for (var added = [], i = 1, e = lines.length - 1; i < e; ++i)
14.1935 + added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
14.1936 + added.push(makeLine(hlText(lastHL) + firstLine.text.slice(to.ch), hlSpans(lastHL), th));
14.1937 + updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
14.1938 + doc.insert(from.line + 1, added);
14.1939 + }
14.1940 + } else if (lines.length == 1) {
14.1941 + updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]) +
14.1942 + lastLine.text.slice(to.ch), hlSpans(lines[0]));
14.1943 + doc.remove(from.line + 1, nlines, cm);
14.1944 + } else {
14.1945 + var added = [];
14.1946 + updateLine(cm, firstLine, firstLine.text.slice(0, from.ch) + hlText(lines[0]), hlSpans(lines[0]));
14.1947 + updateLine(cm, lastLine, hlText(lastHL) + lastLine.text.slice(to.ch), hlSpans(lastHL));
14.1948 + for (var i = 1, e = lines.length - 1; i < e; ++i)
14.1949 + added.push(makeLine(hlText(lines[i]), hlSpans(lines[i]), th));
14.1950 + if (nlines > 1) doc.remove(from.line + 1, nlines - 1, cm);
14.1951 + doc.insert(from.line + 1, added);
14.1952 + }
14.1953 +
14.1954 + if (cm.options.lineWrapping) {
14.1955 + var perLine = Math.max(5, display.scroller.clientWidth / charWidth(display) - 3);
14.1956 + doc.iter(from.line, from.line + lines.length, function(line) {
14.1957 + if (line.height == 0) return;
14.1958 + var guess = (Math.ceil(line.text.length / perLine) || 1) * th;
14.1959 + if (guess != line.height) updateLineHeight(line, guess);
14.1960 + });
14.1961 + } else {
14.1962 + doc.iter(checkWidthStart, from.line + lines.length, function(line) {
14.1963 + var len = lineLength(doc, line);
14.1964 + if (len > view.maxLineLength) {
14.1965 + view.maxLine = line;
14.1966 + view.maxLineLength = len;
14.1967 + view.maxLineChanged = true;
14.1968 + recomputeMaxLength = false;
14.1969 + }
14.1970 + });
14.1971 + if (recomputeMaxLength) cm.curOp.updateMaxLine = true;
14.1972 + }
14.1973 +
14.1974 + // Adjust frontier, schedule worker
14.1975 + view.frontier = Math.min(view.frontier, from.line);
14.1976 + startWorker(cm, 400);
14.1977 +
14.1978 + var lendiff = lines.length - nlines - 1;
14.1979 + // Remember that these lines changed, for updating the display
14.1980 + regChange(cm, from.line, to.line + 1, lendiff);
14.1981 + if (hasHandler(cm, "change")) {
14.1982 + // Normalize lines to contain only strings, since that's what
14.1983 + // the change event handler expects
14.1984 + for (var i = 0; i < lines.length; ++i)
14.1985 + if (typeof lines[i] != "string") lines[i] = lines[i].text;
14.1986 + var changeObj = {from: from, to: to, text: lines, origin: origin};
14.1987 + if (cm.curOp.textChanged) {
14.1988 + for (var cur = cm.curOp.textChanged; cur.next; cur = cur.next) {}
14.1989 + cur.next = changeObj;
14.1990 + } else cm.curOp.textChanged = changeObj;
14.1991 + }
14.1992 +
14.1993 + // Update the selection
14.1994 + var newSelFrom, newSelTo, end = {line: from.line + lines.length - 1,
14.1995 + ch: hlText(lastHL).length + (lines.length == 1 ? from.ch : 0)};
14.1996 + if (selUpdate && typeof selUpdate != "string") {
14.1997 + if (selUpdate.from) { newSelFrom = selUpdate.from; newSelTo = selUpdate.to; }
14.1998 + else newSelFrom = newSelTo = selUpdate;
14.1999 + } else if (selUpdate == "end") {
14.2000 + newSelFrom = newSelTo = end;
14.2001 + } else if (selUpdate == "start") {
14.2002 + newSelFrom = newSelTo = from;
14.2003 + } else if (selUpdate == "around") {
14.2004 + newSelFrom = from; newSelTo = end;
14.2005 + } else {
14.2006 + var adjustPos = function(pos) {
14.2007 + if (posLess(pos, from)) return pos;
14.2008 + if (!posLess(to, pos)) return end;
14.2009 + var line = pos.line + lendiff;
14.2010 + var ch = pos.ch;
14.2011 + if (pos.line == to.line)
14.2012 + ch += hlText(lastHL).length - (to.ch - (to.line == from.line ? from.ch : 0));
14.2013 + return {line: line, ch: ch};
14.2014 + };
14.2015 + newSelFrom = adjustPos(view.sel.from);
14.2016 + newSelTo = adjustPos(view.sel.to);
14.2017 + }
14.2018 + setSelection(cm, newSelFrom, newSelTo, null, true);
14.2019 + return end;
14.2020 + }
14.2021 +
14.2022 + function replaceRange(cm, code, from, to, origin) {
14.2023 + if (!to) to = from;
14.2024 + if (posLess(to, from)) { var tmp = to; to = from; from = tmp; }
14.2025 + return updateDoc(cm, from, to, splitLines(code), null, origin);
14.2026 + }
14.2027 +
14.2028 + // SELECTION
14.2029 +
14.2030 + function posEq(a, b) {return a.line == b.line && a.ch == b.ch;}
14.2031 + function posLess(a, b) {return a.line < b.line || (a.line == b.line && a.ch < b.ch);}
14.2032 + function copyPos(x) {return {line: x.line, ch: x.ch};}
14.2033 +
14.2034 + function clipLine(doc, n) {return Math.max(0, Math.min(n, doc.size-1));}
14.2035 + function clipPos(doc, pos) {
14.2036 + if (pos.line < 0) return {line: 0, ch: 0};
14.2037 + if (pos.line >= doc.size) return {line: doc.size-1, ch: getLine(doc, doc.size-1).text.length};
14.2038 + var ch = pos.ch, linelen = getLine(doc, pos.line).text.length;
14.2039 + if (ch == null || ch > linelen) return {line: pos.line, ch: linelen};
14.2040 + else if (ch < 0) return {line: pos.line, ch: 0};
14.2041 + else return pos;
14.2042 + }
14.2043 + function isLine(doc, l) {return l >= 0 && l < doc.size;}
14.2044 +
14.2045 + // If shift is held, this will move the selection anchor. Otherwise,
14.2046 + // it'll set the whole selection.
14.2047 + function extendSelection(cm, pos, other, bias) {
14.2048 + var sel = cm.view.sel;
14.2049 + if (sel.shift || sel.extend) {
14.2050 + var anchor = sel.anchor;
14.2051 + if (other) {
14.2052 + var posBefore = posLess(pos, anchor);
14.2053 + if (posBefore != posLess(other, anchor)) {
14.2054 + anchor = pos;
14.2055 + pos = other;
14.2056 + } else if (posBefore != posLess(pos, other)) {
14.2057 + pos = other;
14.2058 + }
14.2059 + }
14.2060 + setSelection(cm, anchor, pos, bias);
14.2061 + } else {
14.2062 + setSelection(cm, pos, other || pos, bias);
14.2063 + }
14.2064 + cm.curOp.userSelChange = true;
14.2065 + }
14.2066 +
14.2067 + // Update the selection. Last two args are only used by
14.2068 + // updateDoc, since they have to be expressed in the line
14.2069 + // numbers before the update.
14.2070 + function setSelection(cm, anchor, head, bias, checkAtomic) {
14.2071 + cm.view.goalColumn = null;
14.2072 + var sel = cm.view.sel;
14.2073 + // Skip over atomic spans.
14.2074 + if (checkAtomic || !posEq(anchor, sel.anchor))
14.2075 + anchor = skipAtomic(cm, anchor, bias, checkAtomic != "push");
14.2076 + if (checkAtomic || !posEq(head, sel.head))
14.2077 + head = skipAtomic(cm, head, bias, checkAtomic != "push");
14.2078 +
14.2079 + if (posEq(sel.anchor, anchor) && posEq(sel.head, head)) return;
14.2080 +
14.2081 + sel.anchor = anchor; sel.head = head;
14.2082 + var inv = posLess(head, anchor);
14.2083 + sel.from = inv ? head : anchor;
14.2084 + sel.to = inv ? anchor : head;
14.2085 +
14.2086 + cm.curOp.updateInput = true;
14.2087 + cm.curOp.selectionChanged = true;
14.2088 + }
14.2089 +
14.2090 + function reCheckSelection(cm) {
14.2091 + setSelection(cm, cm.view.sel.from, cm.view.sel.to, null, "push");
14.2092 + }
14.2093 +
14.2094 + function skipAtomic(cm, pos, bias, mayClear) {
14.2095 + var doc = cm.view.doc, flipped = false, curPos = pos;
14.2096 + var dir = bias || 1;
14.2097 + cm.view.cantEdit = false;
14.2098 + search: for (;;) {
14.2099 + var line = getLine(doc, curPos.line), toClear;
14.2100 + if (line.markedSpans) {
14.2101 + for (var i = 0; i < line.markedSpans.length; ++i) {
14.2102 + var sp = line.markedSpans[i], m = sp.marker;
14.2103 + if ((sp.from == null || (m.inclusiveLeft ? sp.from <= curPos.ch : sp.from < curPos.ch)) &&
14.2104 + (sp.to == null || (m.inclusiveRight ? sp.to >= curPos.ch : sp.to > curPos.ch))) {
14.2105 + if (mayClear && m.clearOnEnter) {
14.2106 + (toClear || (toClear = [])).push(m);
14.2107 + continue;
14.2108 + } else if (!m.atomic) continue;
14.2109 + var newPos = m.find()[dir < 0 ? "from" : "to"];
14.2110 + if (posEq(newPos, curPos)) {
14.2111 + newPos.ch += dir;
14.2112 + if (newPos.ch < 0) {
14.2113 + if (newPos.line) newPos = clipPos(doc, {line: newPos.line - 1});
14.2114 + else newPos = null;
14.2115 + } else if (newPos.ch > line.text.length) {
14.2116 + if (newPos.line < doc.size - 1) newPos = {line: newPos.line + 1, ch: 0};
14.2117 + else newPos = null;
14.2118 + }
14.2119 + if (!newPos) {
14.2120 + if (flipped) {
14.2121 + // Driven in a corner -- no valid cursor position found at all
14.2122 + // -- try again *with* clearing, if we didn't already
14.2123 + if (!mayClear) return skipAtomic(cm, pos, bias, true);
14.2124 + // Otherwise, turn off editing until further notice, and return the start of the doc
14.2125 + cm.view.cantEdit = true;
14.2126 + return {line: 0, ch: 0};
14.2127 + }
14.2128 + flipped = true; newPos = pos; dir = -dir;
14.2129 + }
14.2130 + }
14.2131 + curPos = newPos;
14.2132 + continue search;
14.2133 + }
14.2134 + }
14.2135 + if (toClear) for (var i = 0; i < toClear.length; ++i) toClear[i].clear();
14.2136 + }
14.2137 + return curPos;
14.2138 + }
14.2139 + }
14.2140 +
14.2141 + // SCROLLING
14.2142 +
14.2143 + function scrollCursorIntoView(cm) {
14.2144 + var view = cm.view;
14.2145 + var coords = scrollPosIntoView(cm, view.sel.head);
14.2146 + if (!view.focused) return;
14.2147 + var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
14.2148 + if (coords.top + box.top < 0) doScroll = true;
14.2149 + else if (coords.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) doScroll = false;
14.2150 + if (doScroll != null && !phantom) {
14.2151 + var hidden = display.cursor.style.display == "none";
14.2152 + if (hidden) {
14.2153 + display.cursor.style.display = "";
14.2154 + display.cursor.style.left = coords.left + "px";
14.2155 + display.cursor.style.top = (coords.top - display.viewOffset) + "px";
14.2156 + }
14.2157 + display.cursor.scrollIntoView(doScroll);
14.2158 + if (hidden) display.cursor.style.display = "none";
14.2159 + }
14.2160 + }
14.2161 +
14.2162 + function scrollPosIntoView(cm, pos) {
14.2163 + for (;;) {
14.2164 + var changed = false, coords = cursorCoords(cm, pos);
14.2165 + var scrollPos = calculateScrollPos(cm, coords.left, coords.top, coords.left, coords.bottom);
14.2166 + var startTop = cm.view.scrollTop, startLeft = cm.view.scrollLeft;
14.2167 + if (scrollPos.scrollTop != null) {
14.2168 + setScrollTop(cm, scrollPos.scrollTop);
14.2169 + if (Math.abs(cm.view.scrollTop - startTop) > 1) changed = true;
14.2170 + }
14.2171 + if (scrollPos.scrollLeft != null) {
14.2172 + setScrollLeft(cm, scrollPos.scrollLeft);
14.2173 + if (Math.abs(cm.view.scrollLeft - startLeft) > 1) changed = true;
14.2174 + }
14.2175 + if (!changed) return coords;
14.2176 + }
14.2177 + }
14.2178 +
14.2179 + function scrollIntoView(cm, x1, y1, x2, y2) {
14.2180 + var scrollPos = calculateScrollPos(cm, x1, y1, x2, y2);
14.2181 + if (scrollPos.scrollTop != null) setScrollTop(cm, scrollPos.scrollTop);
14.2182 + if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft);
14.2183 + }
14.2184 +
14.2185 + function calculateScrollPos(cm, x1, y1, x2, y2) {
14.2186 + var display = cm.display, pt = paddingTop(display);
14.2187 + y1 += pt; y2 += pt;
14.2188 + var screen = display.scroller.clientHeight - scrollerCutOff, screentop = display.scroller.scrollTop, result = {};
14.2189 + var docBottom = cm.view.doc.height + 2 * pt;
14.2190 + var atTop = y1 < pt + 10, atBottom = y2 + pt > docBottom - 10;
14.2191 + if (y1 < screentop) result.scrollTop = atTop ? 0 : Math.max(0, y1);
14.2192 + else if (y2 > screentop + screen) result.scrollTop = (atBottom ? docBottom : y2) - screen;
14.2193 +
14.2194 + var screenw = display.scroller.clientWidth - scrollerCutOff, screenleft = display.scroller.scrollLeft;
14.2195 + x1 += display.gutters.offsetWidth; x2 += display.gutters.offsetWidth;
14.2196 + var gutterw = display.gutters.offsetWidth;
14.2197 + var atLeft = x1 < gutterw + 10;
14.2198 + if (x1 < screenleft + gutterw || atLeft) {
14.2199 + if (atLeft) x1 = 0;
14.2200 + result.scrollLeft = Math.max(0, x1 - 10 - gutterw);
14.2201 + } else if (x2 > screenw + screenleft - 3) {
14.2202 + result.scrollLeft = x2 + 10 - screenw;
14.2203 + }
14.2204 + return result;
14.2205 + }
14.2206 +
14.2207 + // API UTILITIES
14.2208 +
14.2209 + function indentLine(cm, n, how, aggressive) {
14.2210 + var doc = cm.view.doc;
14.2211 + if (!how) how = "add";
14.2212 + if (how == "smart") {
14.2213 + if (!cm.view.mode.indent) how = "prev";
14.2214 + else var state = getStateBefore(cm, n);
14.2215 + }
14.2216 +
14.2217 + var tabSize = cm.options.tabSize;
14.2218 + var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
14.2219 + var curSpaceString = line.text.match(/^\s*/)[0], indentation;
14.2220 + if (how == "smart") {
14.2221 + indentation = cm.view.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
14.2222 + if (indentation == Pass) {
14.2223 + if (!aggressive) return;
14.2224 + how = "prev";
14.2225 + }
14.2226 + }
14.2227 + if (how == "prev") {
14.2228 + if (n) indentation = countColumn(getLine(doc, n-1).text, null, tabSize);
14.2229 + else indentation = 0;
14.2230 + }
14.2231 + else if (how == "add") indentation = curSpace + cm.options.indentUnit;
14.2232 + else if (how == "subtract") indentation = curSpace - cm.options.indentUnit;
14.2233 + indentation = Math.max(0, indentation);
14.2234 +
14.2235 + var indentString = "", pos = 0;
14.2236 + if (cm.options.indentWithTabs)
14.2237 + for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";}
14.2238 + if (pos < indentation) indentString += spaceStr(indentation - pos);
14.2239 +
14.2240 + if (indentString != curSpaceString)
14.2241 + replaceRange(cm, indentString, {line: n, ch: 0}, {line: n, ch: curSpaceString.length}, "input");
14.2242 + line.stateAfter = null;
14.2243 + }
14.2244 +
14.2245 + function changeLine(cm, handle, op) {
14.2246 + var no = handle, line = handle, doc = cm.view.doc;
14.2247 + if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle));
14.2248 + else no = lineNo(handle);
14.2249 + if (no == null) return null;
14.2250 + if (op(line, no)) regChange(cm, no, no + 1);
14.2251 + else return null;
14.2252 + return line;
14.2253 + }
14.2254 +
14.2255 + function findPosH(cm, dir, unit, visually) {
14.2256 + var doc = cm.view.doc, end = cm.view.sel.head, line = end.line, ch = end.ch;
14.2257 + var lineObj = getLine(doc, line);
14.2258 + function findNextLine() {
14.2259 + var l = line + dir;
14.2260 + if (l < 0 || l == doc.size) return false;
14.2261 + line = l;
14.2262 + return lineObj = getLine(doc, l);
14.2263 + }
14.2264 + function moveOnce(boundToLine) {
14.2265 + var next = (visually ? moveVisually : moveLogically)(lineObj, ch, dir, true);
14.2266 + if (next == null) {
14.2267 + if (!boundToLine && findNextLine()) {
14.2268 + if (visually) ch = (dir < 0 ? lineRight : lineLeft)(lineObj);
14.2269 + else ch = dir < 0 ? lineObj.text.length : 0;
14.2270 + } else return false;
14.2271 + } else ch = next;
14.2272 + return true;
14.2273 + }
14.2274 + if (unit == "char") moveOnce();
14.2275 + else if (unit == "column") moveOnce(true);
14.2276 + else if (unit == "word") {
14.2277 + var sawWord = false;
14.2278 + for (;;) {
14.2279 + if (dir < 0) if (!moveOnce()) break;
14.2280 + if (isWordChar(lineObj.text.charAt(ch))) sawWord = true;
14.2281 + else if (sawWord) {if (dir < 0) {dir = 1; moveOnce();} break;}
14.2282 + if (dir > 0) if (!moveOnce()) break;
14.2283 + }
14.2284 + }
14.2285 + return skipAtomic(cm, {line: line, ch: ch}, dir, true);
14.2286 + }
14.2287 +
14.2288 + function findWordAt(line, pos) {
14.2289 + var start = pos.ch, end = pos.ch;
14.2290 + if (line) {
14.2291 + if (pos.after === false || end == line.length) --start; else ++end;
14.2292 + var startChar = line.charAt(start);
14.2293 + var check = isWordChar(startChar) ? isWordChar :
14.2294 + /\s/.test(startChar) ? function(ch) {return /\s/.test(ch);} :
14.2295 + function(ch) {return !/\s/.test(ch) && !isWordChar(ch);};
14.2296 + while (start > 0 && check(line.charAt(start - 1))) --start;
14.2297 + while (end < line.length && check(line.charAt(end))) ++end;
14.2298 + }
14.2299 + return {from: {line: pos.line, ch: start}, to: {line: pos.line, ch: end}};
14.2300 + }
14.2301 +
14.2302 + function selectLine(cm, line) {
14.2303 + extendSelection(cm, {line: line, ch: 0}, clipPos(cm.view.doc, {line: line + 1, ch: 0}));
14.2304 + }
14.2305 +
14.2306 + // PROTOTYPE
14.2307 +
14.2308 + // The publicly visible API. Note that operation(null, f) means
14.2309 + // 'wrap f in an operation, performed on its `this` parameter'
14.2310 +
14.2311 + CodeMirror.prototype = {
14.2312 + getValue: function(lineSep) {
14.2313 + var text = [], doc = this.view.doc;
14.2314 + doc.iter(0, doc.size, function(line) { text.push(line.text); });
14.2315 + return text.join(lineSep || "\n");
14.2316 + },
14.2317 +
14.2318 + setValue: operation(null, function(code) {
14.2319 + var doc = this.view.doc, top = {line: 0, ch: 0}, lastLen = getLine(doc, doc.size-1).text.length;
14.2320 + updateDocInner(this, top, {line: doc.size - 1, ch: lastLen}, splitLines(code), top, top, "setValue");
14.2321 + }),
14.2322 +
14.2323 + getSelection: function(lineSep) { return this.getRange(this.view.sel.from, this.view.sel.to, lineSep); },
14.2324 +
14.2325 + replaceSelection: operation(null, function(code, collapse, origin) {
14.2326 + var sel = this.view.sel;
14.2327 + updateDoc(this, sel.from, sel.to, splitLines(code), collapse || "around", origin);
14.2328 + }),
14.2329 +
14.2330 + focus: function(){window.focus(); focusInput(this); onFocus(this); fastPoll(this);},
14.2331 +
14.2332 + setOption: function(option, value) {
14.2333 + var options = this.options, old = options[option];
14.2334 + if (options[option] == value && option != "mode") return;
14.2335 + options[option] = value;
14.2336 + if (optionHandlers.hasOwnProperty(option))
14.2337 + operation(this, optionHandlers[option])(this, value, old);
14.2338 + },
14.2339 +
14.2340 + getOption: function(option) {return this.options[option];},
14.2341 +
14.2342 + getMode: function() {return this.view.mode;},
14.2343 +
14.2344 + addKeyMap: function(map) {
14.2345 + this.view.keyMaps.push(map);
14.2346 + },
14.2347 +
14.2348 + removeKeyMap: function(map) {
14.2349 + var maps = this.view.keyMaps;
14.2350 + for (var i = 0; i < maps.length; ++i)
14.2351 + if ((typeof map == "string" ? maps[i].name : maps[i]) == map) {
14.2352 + maps.splice(i, 1);
14.2353 + return true;
14.2354 + }
14.2355 + },
14.2356 +
14.2357 + undo: operation(null, function() {unredoHelper(this, "undo");}),
14.2358 + redo: operation(null, function() {unredoHelper(this, "redo");}),
14.2359 +
14.2360 + indentLine: operation(null, function(n, dir, aggressive) {
14.2361 + if (typeof dir != "string") {
14.2362 + if (dir == null) dir = this.options.smartIndent ? "smart" : "prev";
14.2363 + else dir = dir ? "add" : "subtract";
14.2364 + }
14.2365 + if (isLine(this.view.doc, n)) indentLine(this, n, dir, aggressive);
14.2366 + }),
14.2367 +
14.2368 + indentSelection: operation(null, function(how) {
14.2369 + var sel = this.view.sel;
14.2370 + if (posEq(sel.from, sel.to)) return indentLine(this, sel.from.line, how);
14.2371 + var e = sel.to.line - (sel.to.ch ? 0 : 1);
14.2372 + for (var i = sel.from.line; i <= e; ++i) indentLine(this, i, how);
14.2373 + }),
14.2374 +
14.2375 + historySize: function() {
14.2376 + var hist = this.view.history;
14.2377 + return {undo: hist.done.length, redo: hist.undone.length};
14.2378 + },
14.2379 +
14.2380 + clearHistory: function() {this.view.history = makeHistory();},
14.2381 +
14.2382 + markClean: function() {
14.2383 + this.view.history.dirtyCounter = 0;
14.2384 + this.view.history.lastOp = this.view.history.lastOrigin = null;
14.2385 + },
14.2386 +
14.2387 + isClean: function () {return this.view.history.dirtyCounter == 0;},
14.2388 +
14.2389 + getHistory: function() {
14.2390 + var hist = this.view.history;
14.2391 + function cp(arr) {
14.2392 + for (var i = 0, nw = [], nwelt; i < arr.length; ++i) {
14.2393 + var set = arr[i];
14.2394 + nw.push({events: nwelt = [], fromBefore: set.fromBefore, toBefore: set.toBefore,
14.2395 + fromAfter: set.fromAfter, toAfter: set.toAfter});
14.2396 + for (var j = 0, elt = set.events; j < elt.length; ++j) {
14.2397 + var old = [], cur = elt[j];
14.2398 + nwelt.push({start: cur.start, added: cur.added, old: old});
14.2399 + for (var k = 0; k < cur.old.length; ++k) old.push(hlText(cur.old[k]));
14.2400 + }
14.2401 + }
14.2402 + return nw;
14.2403 + }
14.2404 + return {done: cp(hist.done), undone: cp(hist.undone)};
14.2405 + },
14.2406 +
14.2407 + setHistory: function(histData) {
14.2408 + var hist = this.view.history = makeHistory();
14.2409 + hist.done = histData.done;
14.2410 + hist.undone = histData.undone;
14.2411 + },
14.2412 +
14.2413 + // Fetch the parser token for a given character. Useful for hacks
14.2414 + // that want to inspect the mode state (say, for completion).
14.2415 + getTokenAt: function(pos) {
14.2416 + var doc = this.view.doc;
14.2417 + pos = clipPos(doc, pos);
14.2418 + var state = getStateBefore(this, pos.line), mode = this.view.mode;
14.2419 + var line = getLine(doc, pos.line);
14.2420 + var stream = new StringStream(line.text, this.options.tabSize);
14.2421 + while (stream.pos < pos.ch && !stream.eol()) {
14.2422 + stream.start = stream.pos;
14.2423 + var style = mode.token(stream, state);
14.2424 + }
14.2425 + return {start: stream.start,
14.2426 + end: stream.pos,
14.2427 + string: stream.current(),
14.2428 + className: style || null, // Deprecated, use 'type' instead
14.2429 + type: style || null,
14.2430 + state: state};
14.2431 + },
14.2432 +
14.2433 + getStateAfter: function(line) {
14.2434 + var doc = this.view.doc;
14.2435 + line = clipLine(doc, line == null ? doc.size - 1: line);
14.2436 + return getStateBefore(this, line + 1);
14.2437 + },
14.2438 +
14.2439 + cursorCoords: function(start, mode) {
14.2440 + var pos, sel = this.view.sel;
14.2441 + if (start == null) pos = sel.head;
14.2442 + else if (typeof start == "object") pos = clipPos(this.view.doc, start);
14.2443 + else pos = start ? sel.from : sel.to;
14.2444 + return cursorCoords(this, pos, mode || "page");
14.2445 + },
14.2446 +
14.2447 + charCoords: function(pos, mode) {
14.2448 + return charCoords(this, clipPos(this.view.doc, pos), mode || "page");
14.2449 + },
14.2450 +
14.2451 + coordsChar: function(coords) {
14.2452 + var off = this.display.lineSpace.getBoundingClientRect();
14.2453 + return coordsChar(this, coords.left - off.left, coords.top - off.top);
14.2454 + },
14.2455 +
14.2456 + defaultTextHeight: function() { return textHeight(this.display); },
14.2457 +
14.2458 + markText: operation(null, function(from, to, options) {
14.2459 + return markText(this, clipPos(this.view.doc, from), clipPos(this.view.doc, to),
14.2460 + options, "range");
14.2461 + }),
14.2462 +
14.2463 + setBookmark: operation(null, function(pos, widget) {
14.2464 + pos = clipPos(this.view.doc, pos);
14.2465 + return markText(this, pos, pos, widget ? {replacedWith: widget} : {}, "bookmark");
14.2466 + }),
14.2467 +
14.2468 + findMarksAt: function(pos) {
14.2469 + var doc = this.view.doc;
14.2470 + pos = clipPos(doc, pos);
14.2471 + var markers = [], spans = getLine(doc, pos.line).markedSpans;
14.2472 + if (spans) for (var i = 0; i < spans.length; ++i) {
14.2473 + var span = spans[i];
14.2474 + if ((span.from == null || span.from <= pos.ch) &&
14.2475 + (span.to == null || span.to >= pos.ch))
14.2476 + markers.push(span.marker);
14.2477 + }
14.2478 + return markers;
14.2479 + },
14.2480 +
14.2481 + setGutterMarker: operation(null, function(line, gutterID, value) {
14.2482 + return changeLine(this, line, function(line) {
14.2483 + var markers = line.gutterMarkers || (line.gutterMarkers = {});
14.2484 + markers[gutterID] = value;
14.2485 + if (!value && isEmpty(markers)) line.gutterMarkers = null;
14.2486 + return true;
14.2487 + });
14.2488 + }),
14.2489 +
14.2490 + clearGutter: operation(null, function(gutterID) {
14.2491 + var i = 0, cm = this, doc = cm.view.doc;
14.2492 + doc.iter(0, doc.size, function(line) {
14.2493 + if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
14.2494 + line.gutterMarkers[gutterID] = null;
14.2495 + regChange(cm, i, i + 1);
14.2496 + if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null;
14.2497 + }
14.2498 + ++i;
14.2499 + });
14.2500 + }),
14.2501 +
14.2502 + addLineClass: operation(null, function(handle, where, cls) {
14.2503 + return changeLine(this, handle, function(line) {
14.2504 + var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
14.2505 + if (!line[prop]) line[prop] = cls;
14.2506 + else if (new RegExp("\\b" + cls + "\\b").test(line[prop])) return false;
14.2507 + else line[prop] += " " + cls;
14.2508 + return true;
14.2509 + });
14.2510 + }),
14.2511 +
14.2512 + removeLineClass: operation(null, function(handle, where, cls) {
14.2513 + return changeLine(this, handle, function(line) {
14.2514 + var prop = where == "text" ? "textClass" : where == "background" ? "bgClass" : "wrapClass";
14.2515 + var cur = line[prop];
14.2516 + if (!cur) return false;
14.2517 + else if (cls == null) line[prop] = null;
14.2518 + else {
14.2519 + var upd = cur.replace(new RegExp("^" + cls + "\\b\\s*|\\s*\\b" + cls + "\\b"), "");
14.2520 + if (upd == cur) return false;
14.2521 + line[prop] = upd || null;
14.2522 + }
14.2523 + return true;
14.2524 + });
14.2525 + }),
14.2526 +
14.2527 + addLineWidget: operation(null, function(handle, node, options) {
14.2528 + var widget = options || {};
14.2529 + widget.node = node;
14.2530 + if (widget.noHScroll) this.display.alignWidgets = true;
14.2531 + changeLine(this, handle, function(line) {
14.2532 + (line.widgets || (line.widgets = [])).push(widget);
14.2533 + widget.line = line;
14.2534 + return true;
14.2535 + });
14.2536 + return widget;
14.2537 + }),
14.2538 +
14.2539 + removeLineWidget: operation(null, function(widget) {
14.2540 + var ws = widget.line.widgets, no = lineNo(widget.line);
14.2541 + if (no == null) return;
14.2542 + for (var i = 0; i < ws.length; ++i) if (ws[i] == widget) ws.splice(i--, 1);
14.2543 + regChange(this, no, no + 1);
14.2544 + }),
14.2545 +
14.2546 + lineInfo: function(line) {
14.2547 + if (typeof line == "number") {
14.2548 + if (!isLine(this.view.doc, line)) return null;
14.2549 + var n = line;
14.2550 + line = getLine(this.view.doc, line);
14.2551 + if (!line) return null;
14.2552 + } else {
14.2553 + var n = lineNo(line);
14.2554 + if (n == null) return null;
14.2555 + }
14.2556 + return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
14.2557 + textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
14.2558 + widgets: line.widgets};
14.2559 + },
14.2560 +
14.2561 + getViewport: function() { return {from: this.display.showingFrom, to: this.display.showingTo};},
14.2562 +
14.2563 + addWidget: function(pos, node, scroll, vert, horiz) {
14.2564 + var display = this.display;
14.2565 + pos = cursorCoords(this, clipPos(this.view.doc, pos));
14.2566 + var top = pos.top, left = pos.left;
14.2567 + node.style.position = "absolute";
14.2568 + display.sizer.appendChild(node);
14.2569 + if (vert == "over") top = pos.top;
14.2570 + else if (vert == "near") {
14.2571 + var vspace = Math.max(display.wrapper.clientHeight, this.view.doc.height),
14.2572 + hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
14.2573 + if (pos.bottom + node.offsetHeight > vspace && pos.top > node.offsetHeight)
14.2574 + top = pos.top - node.offsetHeight;
14.2575 + if (left + node.offsetWidth > hspace)
14.2576 + left = hspace - node.offsetWidth;
14.2577 + }
14.2578 + node.style.top = (top + paddingTop(display)) + "px";
14.2579 + node.style.left = node.style.right = "";
14.2580 + if (horiz == "right") {
14.2581 + left = display.sizer.clientWidth - node.offsetWidth;
14.2582 + node.style.right = "0px";
14.2583 + } else {
14.2584 + if (horiz == "left") left = 0;
14.2585 + else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2;
14.2586 + node.style.left = left + "px";
14.2587 + }
14.2588 + if (scroll)
14.2589 + scrollIntoView(this, left, top, left + node.offsetWidth, top + node.offsetHeight);
14.2590 + },
14.2591 +
14.2592 + lineCount: function() {return this.view.doc.size;},
14.2593 +
14.2594 + clipPos: function(pos) {return clipPos(this.view.doc, pos);},
14.2595 +
14.2596 + getCursor: function(start) {
14.2597 + var sel = this.view.sel, pos;
14.2598 + if (start == null || start == "head") pos = sel.head;
14.2599 + else if (start == "anchor") pos = sel.anchor;
14.2600 + else if (start == "end" || start === false) pos = sel.to;
14.2601 + else pos = sel.from;
14.2602 + return copyPos(pos);
14.2603 + },
14.2604 +
14.2605 + somethingSelected: function() {return !posEq(this.view.sel.from, this.view.sel.to);},
14.2606 +
14.2607 + setCursor: operation(null, function(line, ch, extend) {
14.2608 + var pos = clipPos(this.view.doc, typeof line == "number" ? {line: line, ch: ch || 0} : line);
14.2609 + if (extend) extendSelection(this, pos);
14.2610 + else setSelection(this, pos, pos);
14.2611 + }),
14.2612 +
14.2613 + setSelection: operation(null, function(anchor, head) {
14.2614 + var doc = this.view.doc;
14.2615 + setSelection(this, clipPos(doc, anchor), clipPos(doc, head || anchor));
14.2616 + }),
14.2617 +
14.2618 + extendSelection: operation(null, function(from, to) {
14.2619 + var doc = this.view.doc;
14.2620 + extendSelection(this, clipPos(doc, from), to && clipPos(doc, to));
14.2621 + }),
14.2622 +
14.2623 + setExtending: function(val) {this.view.sel.extend = val;},
14.2624 +
14.2625 + getLine: function(line) {var l = this.getLineHandle(line); return l && l.text;},
14.2626 +
14.2627 + getLineHandle: function(line) {
14.2628 + var doc = this.view.doc;
14.2629 + if (isLine(doc, line)) return getLine(doc, line);
14.2630 + },
14.2631 +
14.2632 + getLineNumber: function(line) {return lineNo(line);},
14.2633 +
14.2634 + setLine: operation(null, function(line, text) {
14.2635 + if (isLine(this.view.doc, line))
14.2636 + replaceRange(this, text, {line: line, ch: 0}, {line: line, ch: getLine(this.view.doc, line).text.length});
14.2637 + }),
14.2638 +
14.2639 + removeLine: operation(null, function(line) {
14.2640 + if (isLine(this.view.doc, line))
14.2641 + replaceRange(this, "", {line: line, ch: 0}, clipPos(this.view.doc, {line: line+1, ch: 0}));
14.2642 + }),
14.2643 +
14.2644 + replaceRange: operation(null, function(code, from, to) {
14.2645 + var doc = this.view.doc;
14.2646 + from = clipPos(doc, from);
14.2647 + to = to ? clipPos(doc, to) : from;
14.2648 + return replaceRange(this, code, from, to);
14.2649 + }),
14.2650 +
14.2651 + getRange: function(from, to, lineSep) {
14.2652 + var doc = this.view.doc;
14.2653 + from = clipPos(doc, from); to = clipPos(doc, to);
14.2654 + var l1 = from.line, l2 = to.line;
14.2655 + if (l1 == l2) return getLine(doc, l1).text.slice(from.ch, to.ch);
14.2656 + var code = [getLine(doc, l1).text.slice(from.ch)];
14.2657 + doc.iter(l1 + 1, l2, function(line) { code.push(line.text); });
14.2658 + code.push(getLine(doc, l2).text.slice(0, to.ch));
14.2659 + return code.join(lineSep || "\n");
14.2660 + },
14.2661 +
14.2662 + triggerOnKeyDown: operation(null, onKeyDown),
14.2663 +
14.2664 + execCommand: function(cmd) {return commands[cmd](this);},
14.2665 +
14.2666 + // Stuff used by commands, probably not much use to outside code.
14.2667 + moveH: operation(null, function(dir, unit) {
14.2668 + var sel = this.view.sel, pos = dir < 0 ? sel.from : sel.to;
14.2669 + if (sel.shift || sel.extend || posEq(sel.from, sel.to)) pos = findPosH(this, dir, unit, true);
14.2670 + extendSelection(this, pos, pos, dir);
14.2671 + }),
14.2672 +
14.2673 + deleteH: operation(null, function(dir, unit) {
14.2674 + var sel = this.view.sel;
14.2675 + if (!posEq(sel.from, sel.to)) replaceRange(this, "", sel.from, sel.to, "delete");
14.2676 + else replaceRange(this, "", sel.from, findPosH(this, dir, unit, false), "delete");
14.2677 + this.curOp.userSelChange = true;
14.2678 + }),
14.2679 +
14.2680 + moveV: operation(null, function(dir, unit) {
14.2681 + var view = this.view, doc = view.doc, display = this.display;
14.2682 + var cur = view.sel.head, pos = cursorCoords(this, cur, "div");
14.2683 + var x = pos.left, y;
14.2684 + if (view.goalColumn != null) x = view.goalColumn;
14.2685 + if (unit == "page") {
14.2686 + var pageSize = Math.min(display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
14.2687 + y = pos.top + dir * pageSize;
14.2688 + } else if (unit == "line") {
14.2689 + y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
14.2690 + }
14.2691 + do {
14.2692 + var target = coordsChar(this, x, y);
14.2693 + y += dir * 5;
14.2694 + } while (target.outside && (dir < 0 ? y > 0 : y < doc.height));
14.2695 +
14.2696 + if (unit == "page") display.scrollbarV.scrollTop += charCoords(this, target, "div").top - pos.top;
14.2697 + extendSelection(this, target, target, dir);
14.2698 + view.goalColumn = x;
14.2699 + }),
14.2700 +
14.2701 + toggleOverwrite: function() {
14.2702 + if (this.view.overwrite = !this.view.overwrite)
14.2703 + this.display.cursor.className += " CodeMirror-overwrite";
14.2704 + else
14.2705 + this.display.cursor.className = this.display.cursor.className.replace(" CodeMirror-overwrite", "");
14.2706 + },
14.2707 +
14.2708 + posFromIndex: function(off) {
14.2709 + var lineNo = 0, ch, doc = this.view.doc;
14.2710 + doc.iter(0, doc.size, function(line) {
14.2711 + var sz = line.text.length + 1;
14.2712 + if (sz > off) { ch = off; return true; }
14.2713 + off -= sz;
14.2714 + ++lineNo;
14.2715 + });
14.2716 + return clipPos(doc, {line: lineNo, ch: ch});
14.2717 + },
14.2718 + indexFromPos: function (coords) {
14.2719 + if (coords.line < 0 || coords.ch < 0) return 0;
14.2720 + var index = coords.ch;
14.2721 + this.view.doc.iter(0, coords.line, function (line) {
14.2722 + index += line.text.length + 1;
14.2723 + });
14.2724 + return index;
14.2725 + },
14.2726 +
14.2727 + scrollTo: function(x, y) {
14.2728 + if (x != null) this.display.scrollbarH.scrollLeft = this.display.scroller.scrollLeft = x;
14.2729 + if (y != null) this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = y;
14.2730 + updateDisplay(this, []);
14.2731 + },
14.2732 + getScrollInfo: function() {
14.2733 + var scroller = this.display.scroller, co = scrollerCutOff;
14.2734 + return {left: scroller.scrollLeft, top: scroller.scrollTop,
14.2735 + height: scroller.scrollHeight - co, width: scroller.scrollWidth - co,
14.2736 + clientHeight: scroller.clientHeight - co, clientWidth: scroller.clientWidth - co};
14.2737 + },
14.2738 +
14.2739 + scrollIntoView: function(pos) {
14.2740 + if (typeof pos == "number") pos = {line: pos, ch: 0};
14.2741 + pos = pos ? clipPos(this.view.doc, pos) : this.view.sel.head;
14.2742 + scrollPosIntoView(this, pos);
14.2743 + },
14.2744 +
14.2745 + setSize: function(width, height) {
14.2746 + function interpret(val) {
14.2747 + return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val;
14.2748 + }
14.2749 + if (width != null) this.display.wrapper.style.width = interpret(width);
14.2750 + if (height != null) this.display.wrapper.style.height = interpret(height);
14.2751 + this.refresh();
14.2752 + },
14.2753 +
14.2754 + on: function(type, f) {on(this, type, f);},
14.2755 + off: function(type, f) {off(this, type, f);},
14.2756 +
14.2757 + operation: function(f){return operation(this, f)();},
14.2758 +
14.2759 + refresh: function() {
14.2760 + clearCaches(this);
14.2761 + if (this.display.scroller.scrollHeight > this.view.scrollTop)
14.2762 + this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = this.view.scrollTop;
14.2763 + updateDisplay(this, true);
14.2764 + },
14.2765 +
14.2766 + getInputField: function(){return this.display.input;},
14.2767 + getWrapperElement: function(){return this.display.wrapper;},
14.2768 + getScrollerElement: function(){return this.display.scroller;},
14.2769 + getGutterElement: function(){return this.display.gutters;}
14.2770 + };
14.2771 +
14.2772 + // OPTION DEFAULTS
14.2773 +
14.2774 + var optionHandlers = CodeMirror.optionHandlers = {};
14.2775 +
14.2776 + // The default configuration options.
14.2777 + var defaults = CodeMirror.defaults = {};
14.2778 +
14.2779 + function option(name, deflt, handle, notOnInit) {
14.2780 + CodeMirror.defaults[name] = deflt;
14.2781 + if (handle) optionHandlers[name] =
14.2782 + notOnInit ? function(cm, val, old) {if (old != Init) handle(cm, val, old);} : handle;
14.2783 + }
14.2784 +
14.2785 + var Init = CodeMirror.Init = {toString: function(){return "CodeMirror.Init";}};
14.2786 +
14.2787 + // These two are, on init, called from the constructor because they
14.2788 + // have to be initialized before the editor can start at all.
14.2789 + option("value", "", function(cm, val) {cm.setValue(val);}, true);
14.2790 + option("mode", null, loadMode, true);
14.2791 +
14.2792 + option("indentUnit", 2, loadMode, true);
14.2793 + option("indentWithTabs", false);
14.2794 + option("smartIndent", true);
14.2795 + option("tabSize", 4, function(cm) {
14.2796 + loadMode(cm);
14.2797 + clearCaches(cm);
14.2798 + updateDisplay(cm, true);
14.2799 + }, true);
14.2800 + option("electricChars", true);
14.2801 +
14.2802 + option("theme", "default", function(cm) {
14.2803 + themeChanged(cm);
14.2804 + guttersChanged(cm);
14.2805 + }, true);
14.2806 + option("keyMap", "default", keyMapChanged);
14.2807 + option("extraKeys", null);
14.2808 +
14.2809 + option("onKeyEvent", null);
14.2810 + option("onDragEvent", null);
14.2811 +
14.2812 + option("lineWrapping", false, wrappingChanged, true);
14.2813 + option("gutters", [], function(cm) {
14.2814 + setGuttersForLineNumbers(cm.options);
14.2815 + guttersChanged(cm);
14.2816 + }, true);
14.2817 + option("lineNumbers", false, function(cm) {
14.2818 + setGuttersForLineNumbers(cm.options);
14.2819 + guttersChanged(cm);
14.2820 + }, true);
14.2821 + option("firstLineNumber", 1, guttersChanged, true);
14.2822 + option("lineNumberFormatter", function(integer) {return integer;}, guttersChanged, true);
14.2823 + option("showCursorWhenSelecting", false, updateSelection, true);
14.2824 +
14.2825 + option("readOnly", false, function(cm, val) {
14.2826 + if (val == "nocursor") {onBlur(cm); cm.display.input.blur();}
14.2827 + else if (!val) resetInput(cm, true);
14.2828 + });
14.2829 + option("dragDrop", true);
14.2830 +
14.2831 + option("cursorBlinkRate", 530);
14.2832 + option("cursorHeight", 1);
14.2833 + option("workTime", 100);
14.2834 + option("workDelay", 100);
14.2835 + option("flattenSpans", true);
14.2836 + option("pollInterval", 100);
14.2837 + option("undoDepth", 40);
14.2838 + option("viewportMargin", 10, function(cm){cm.refresh();}, true);
14.2839 +
14.2840 + option("tabindex", null, function(cm, val) {
14.2841 + cm.display.input.tabIndex = val || "";
14.2842 + });
14.2843 + option("autofocus", null);
14.2844 +
14.2845 + // MODE DEFINITION AND QUERYING
14.2846 +
14.2847 + // Known modes, by name and by MIME
14.2848 + var modes = CodeMirror.modes = {}, mimeModes = CodeMirror.mimeModes = {};
14.2849 +
14.2850 + CodeMirror.defineMode = function(name, mode) {
14.2851 + if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name;
14.2852 + if (arguments.length > 2) {
14.2853 + mode.dependencies = [];
14.2854 + for (var i = 2; i < arguments.length; ++i) mode.dependencies.push(arguments[i]);
14.2855 + }
14.2856 + modes[name] = mode;
14.2857 + };
14.2858 +
14.2859 + CodeMirror.defineMIME = function(mime, spec) {
14.2860 + mimeModes[mime] = spec;
14.2861 + };
14.2862 +
14.2863 + CodeMirror.resolveMode = function(spec) {
14.2864 + if (typeof spec == "string" && mimeModes.hasOwnProperty(spec))
14.2865 + spec = mimeModes[spec];
14.2866 + else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec))
14.2867 + return CodeMirror.resolveMode("application/xml");
14.2868 + if (typeof spec == "string") return {name: spec};
14.2869 + else return spec || {name: "null"};
14.2870 + };
14.2871 +
14.2872 + CodeMirror.getMode = function(options, spec) {
14.2873 + var spec = CodeMirror.resolveMode(spec);
14.2874 + var mfactory = modes[spec.name];
14.2875 + if (!mfactory) return CodeMirror.getMode(options, "text/plain");
14.2876 + var modeObj = mfactory(options, spec);
14.2877 + if (modeExtensions.hasOwnProperty(spec.name)) {
14.2878 + var exts = modeExtensions[spec.name];
14.2879 + for (var prop in exts) {
14.2880 + if (!exts.hasOwnProperty(prop)) continue;
14.2881 + if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop];
14.2882 + modeObj[prop] = exts[prop];
14.2883 + }
14.2884 + }
14.2885 + modeObj.name = spec.name;
14.2886 + return modeObj;
14.2887 + };
14.2888 +
14.2889 + CodeMirror.defineMode("null", function() {
14.2890 + return {token: function(stream) {stream.skipToEnd();}};
14.2891 + });
14.2892 + CodeMirror.defineMIME("text/plain", "null");
14.2893 +
14.2894 + var modeExtensions = CodeMirror.modeExtensions = {};
14.2895 + CodeMirror.extendMode = function(mode, properties) {
14.2896 + var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
14.2897 + for (var prop in properties) if (properties.hasOwnProperty(prop))
14.2898 + exts[prop] = properties[prop];
14.2899 + };
14.2900 +
14.2901 + // EXTENSIONS
14.2902 +
14.2903 + CodeMirror.defineExtension = function(name, func) {
14.2904 + CodeMirror.prototype[name] = func;
14.2905 + };
14.2906 +
14.2907 + CodeMirror.defineOption = option;
14.2908 +
14.2909 + var initHooks = [];
14.2910 + CodeMirror.defineInitHook = function(f) {initHooks.push(f);};
14.2911 +
14.2912 + // MODE STATE HANDLING
14.2913 +
14.2914 + // Utility functions for working with state. Exported because modes
14.2915 + // sometimes need to do this.
14.2916 + function copyState(mode, state) {
14.2917 + if (state === true) return state;
14.2918 + if (mode.copyState) return mode.copyState(state);
14.2919 + var nstate = {};
14.2920 + for (var n in state) {
14.2921 + var val = state[n];
14.2922 + if (val instanceof Array) val = val.concat([]);
14.2923 + nstate[n] = val;
14.2924 + }
14.2925 + return nstate;
14.2926 + }
14.2927 + CodeMirror.copyState = copyState;
14.2928 +
14.2929 + function startState(mode, a1, a2) {
14.2930 + return mode.startState ? mode.startState(a1, a2) : true;
14.2931 + }
14.2932 + CodeMirror.startState = startState;
14.2933 +
14.2934 + CodeMirror.innerMode = function(mode, state) {
14.2935 + while (mode.innerMode) {
14.2936 + var info = mode.innerMode(state);
14.2937 + state = info.state;
14.2938 + mode = info.mode;
14.2939 + }
14.2940 + return info || {mode: mode, state: state};
14.2941 + };
14.2942 +
14.2943 + // STANDARD COMMANDS
14.2944 +
14.2945 + var commands = CodeMirror.commands = {
14.2946 + selectAll: function(cm) {cm.setSelection({line: 0, ch: 0}, {line: cm.lineCount() - 1});},
14.2947 + killLine: function(cm) {
14.2948 + var from = cm.getCursor(true), to = cm.getCursor(false), sel = !posEq(from, to);
14.2949 + if (!sel && cm.getLine(from.line).length == from.ch)
14.2950 + cm.replaceRange("", from, {line: from.line + 1, ch: 0}, "delete");
14.2951 + else cm.replaceRange("", from, sel ? to : {line: from.line}, "delete");
14.2952 + },
14.2953 + deleteLine: function(cm) {
14.2954 + var l = cm.getCursor().line;
14.2955 + cm.replaceRange("", {line: l, ch: 0}, {line: l}, "delete");
14.2956 + },
14.2957 + undo: function(cm) {cm.undo();},
14.2958 + redo: function(cm) {cm.redo();},
14.2959 + goDocStart: function(cm) {cm.extendSelection({line: 0, ch: 0});},
14.2960 + goDocEnd: function(cm) {cm.extendSelection({line: cm.lineCount() - 1});},
14.2961 + goLineStart: function(cm) {
14.2962 + cm.extendSelection(lineStart(cm, cm.getCursor().line));
14.2963 + },
14.2964 + goLineStartSmart: function(cm) {
14.2965 + var cur = cm.getCursor(), start = lineStart(cm, cur.line);
14.2966 + var line = cm.getLineHandle(start.line);
14.2967 + var order = getOrder(line);
14.2968 + if (!order || order[0].level == 0) {
14.2969 + var firstNonWS = Math.max(0, line.text.search(/\S/));
14.2970 + var inWS = cur.line == start.line && cur.ch <= firstNonWS && cur.ch;
14.2971 + cm.extendSelection({line: start.line, ch: inWS ? 0 : firstNonWS});
14.2972 + } else cm.extendSelection(start);
14.2973 + },
14.2974 + goLineEnd: function(cm) {
14.2975 + cm.extendSelection(lineEnd(cm, cm.getCursor().line));
14.2976 + },
14.2977 + goLineUp: function(cm) {cm.moveV(-1, "line");},
14.2978 + goLineDown: function(cm) {cm.moveV(1, "line");},
14.2979 + goPageUp: function(cm) {cm.moveV(-1, "page");},
14.2980 + goPageDown: function(cm) {cm.moveV(1, "page");},
14.2981 + goCharLeft: function(cm) {cm.moveH(-1, "char");},
14.2982 + goCharRight: function(cm) {cm.moveH(1, "char");},
14.2983 + goColumnLeft: function(cm) {cm.moveH(-1, "column");},
14.2984 + goColumnRight: function(cm) {cm.moveH(1, "column");},
14.2985 + goWordLeft: function(cm) {cm.moveH(-1, "word");},
14.2986 + goWordRight: function(cm) {cm.moveH(1, "word");},
14.2987 + delCharBefore: function(cm) {cm.deleteH(-1, "char");},
14.2988 + delCharAfter: function(cm) {cm.deleteH(1, "char");},
14.2989 + delWordBefore: function(cm) {cm.deleteH(-1, "word");},
14.2990 + delWordAfter: function(cm) {cm.deleteH(1, "word");},
14.2991 + indentAuto: function(cm) {cm.indentSelection("smart");},
14.2992 + indentMore: function(cm) {cm.indentSelection("add");},
14.2993 + indentLess: function(cm) {cm.indentSelection("subtract");},
14.2994 + insertTab: function(cm) {cm.replaceSelection("\t", "end", "input");},
14.2995 + defaultTab: function(cm) {
14.2996 + if (cm.somethingSelected()) cm.indentSelection("add");
14.2997 + else cm.replaceSelection("\t", "end", "input");
14.2998 + },
14.2999 + transposeChars: function(cm) {
14.3000 + var cur = cm.getCursor(), line = cm.getLine(cur.line);
14.3001 + if (cur.ch > 0 && cur.ch < line.length - 1)
14.3002 + cm.replaceRange(line.charAt(cur.ch) + line.charAt(cur.ch - 1),
14.3003 + {line: cur.line, ch: cur.ch - 1}, {line: cur.line, ch: cur.ch + 1});
14.3004 + },
14.3005 + newlineAndIndent: function(cm) {
14.3006 + operation(cm, function() {
14.3007 + cm.replaceSelection("\n", "end", "input");
14.3008 + cm.indentLine(cm.getCursor().line, null, true);
14.3009 + })();
14.3010 + },
14.3011 + toggleOverwrite: function(cm) {cm.toggleOverwrite();}
14.3012 + };
14.3013 +
14.3014 + // STANDARD KEYMAPS
14.3015 +
14.3016 + var keyMap = CodeMirror.keyMap = {};
14.3017 + keyMap.basic = {
14.3018 + "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
14.3019 + "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
14.3020 + "Delete": "delCharAfter", "Backspace": "delCharBefore", "Tab": "defaultTab", "Shift-Tab": "indentAuto",
14.3021 + "Enter": "newlineAndIndent", "Insert": "toggleOverwrite"
14.3022 + };
14.3023 + // Note that the save and find-related commands aren't defined by
14.3024 + // default. Unknown commands are simply ignored.
14.3025 + keyMap.pcDefault = {
14.3026 + "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
14.3027 + "Ctrl-Home": "goDocStart", "Alt-Up": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Down": "goDocEnd",
14.3028 + "Ctrl-Left": "goWordLeft", "Ctrl-Right": "goWordRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
14.3029 + "Ctrl-Backspace": "delWordBefore", "Ctrl-Delete": "delWordAfter", "Ctrl-S": "save", "Ctrl-F": "find",
14.3030 + "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
14.3031 + "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
14.3032 + fallthrough: "basic"
14.3033 + };
14.3034 + keyMap.macDefault = {
14.3035 + "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
14.3036 + "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goWordLeft",
14.3037 + "Alt-Right": "goWordRight", "Cmd-Left": "goLineStart", "Cmd-Right": "goLineEnd", "Alt-Backspace": "delWordBefore",
14.3038 + "Ctrl-Alt-Backspace": "delWordAfter", "Alt-Delete": "delWordAfter", "Cmd-S": "save", "Cmd-F": "find",
14.3039 + "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
14.3040 + "Cmd-[": "indentLess", "Cmd-]": "indentMore",
14.3041 + fallthrough: ["basic", "emacsy"]
14.3042 + };
14.3043 + keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
14.3044 + keyMap.emacsy = {
14.3045 + "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
14.3046 + "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
14.3047 + "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
14.3048 + "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars"
14.3049 + };
14.3050 +
14.3051 + // KEYMAP DISPATCH
14.3052 +
14.3053 + function getKeyMap(val) {
14.3054 + if (typeof val == "string") return keyMap[val];
14.3055 + else return val;
14.3056 + }
14.3057 +
14.3058 + function lookupKey(name, maps, handle, stop) {
14.3059 + function lookup(map) {
14.3060 + map = getKeyMap(map);
14.3061 + var found = map[name];
14.3062 + if (found === false) {
14.3063 + if (stop) stop();
14.3064 + return true;
14.3065 + }
14.3066 + if (found != null && handle(found)) return true;
14.3067 + if (map.nofallthrough) {
14.3068 + if (stop) stop();
14.3069 + return true;
14.3070 + }
14.3071 + var fallthrough = map.fallthrough;
14.3072 + if (fallthrough == null) return false;
14.3073 + if (Object.prototype.toString.call(fallthrough) != "[object Array]")
14.3074 + return lookup(fallthrough);
14.3075 + for (var i = 0, e = fallthrough.length; i < e; ++i) {
14.3076 + if (lookup(fallthrough[i])) return true;
14.3077 + }
14.3078 + return false;
14.3079 + }
14.3080 +
14.3081 + for (var i = 0; i < maps.length; ++i)
14.3082 + if (lookup(maps[i])) return true;
14.3083 + }
14.3084 + function isModifierKey(event) {
14.3085 + var name = keyNames[e_prop(event, "keyCode")];
14.3086 + return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod";
14.3087 + }
14.3088 + CodeMirror.isModifierKey = isModifierKey;
14.3089 +
14.3090 + // FROMTEXTAREA
14.3091 +
14.3092 + CodeMirror.fromTextArea = function(textarea, options) {
14.3093 + if (!options) options = {};
14.3094 + options.value = textarea.value;
14.3095 + if (!options.tabindex && textarea.tabindex)
14.3096 + options.tabindex = textarea.tabindex;
14.3097 + // Set autofocus to true if this textarea is focused, or if it has
14.3098 + // autofocus and no other element is focused.
14.3099 + if (options.autofocus == null) {
14.3100 + var hasFocus = document.body;
14.3101 + // doc.activeElement occasionally throws on IE
14.3102 + try { hasFocus = document.activeElement; } catch(e) {}
14.3103 + options.autofocus = hasFocus == textarea ||
14.3104 + textarea.getAttribute("autofocus") != null && hasFocus == document.body;
14.3105 + }
14.3106 +
14.3107 + function save() {textarea.value = cm.getValue();}
14.3108 + if (textarea.form) {
14.3109 + // Deplorable hack to make the submit method do the right thing.
14.3110 + on(textarea.form, "submit", save);
14.3111 + var form = textarea.form, realSubmit = form.submit;
14.3112 + try {
14.3113 + form.submit = function wrappedSubmit() {
14.3114 + save();
14.3115 + form.submit = realSubmit;
14.3116 + form.submit();
14.3117 + form.submit = wrappedSubmit;
14.3118 + };
14.3119 + } catch(e) {}
14.3120 + }
14.3121 +
14.3122 + textarea.style.display = "none";
14.3123 + var cm = CodeMirror(function(node) {
14.3124 + textarea.parentNode.insertBefore(node, textarea.nextSibling);
14.3125 + }, options);
14.3126 + cm.save = save;
14.3127 + cm.getTextArea = function() { return textarea; };
14.3128 + cm.toTextArea = function() {
14.3129 + save();
14.3130 + textarea.parentNode.removeChild(cm.getWrapperElement());
14.3131 + textarea.style.display = "";
14.3132 + if (textarea.form) {
14.3133 + off(textarea.form, "submit", save);
14.3134 + if (typeof textarea.form.submit == "function")
14.3135 + textarea.form.submit = realSubmit;
14.3136 + }
14.3137 + };
14.3138 + return cm;
14.3139 + };
14.3140 +
14.3141 + // STRING STREAM
14.3142 +
14.3143 + // Fed to the mode parsers, provides helper functions to make
14.3144 + // parsers more succinct.
14.3145 +
14.3146 + // The character stream used by a mode's parser.
14.3147 + function StringStream(string, tabSize) {
14.3148 + this.pos = this.start = 0;
14.3149 + this.string = string;
14.3150 + this.tabSize = tabSize || 8;
14.3151 + }
14.3152 +
14.3153 + StringStream.prototype = {
14.3154 + eol: function() {return this.pos >= this.string.length;},
14.3155 + sol: function() {return this.pos == 0;},
14.3156 + peek: function() {return this.string.charAt(this.pos) || undefined;},
14.3157 + next: function() {
14.3158 + if (this.pos < this.string.length)
14.3159 + return this.string.charAt(this.pos++);
14.3160 + },
14.3161 + eat: function(match) {
14.3162 + var ch = this.string.charAt(this.pos);
14.3163 + if (typeof match == "string") var ok = ch == match;
14.3164 + else var ok = ch && (match.test ? match.test(ch) : match(ch));
14.3165 + if (ok) {++this.pos; return ch;}
14.3166 + },
14.3167 + eatWhile: function(match) {
14.3168 + var start = this.pos;
14.3169 + while (this.eat(match)){}
14.3170 + return this.pos > start;
14.3171 + },
14.3172 + eatSpace: function() {
14.3173 + var start = this.pos;
14.3174 + while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos;
14.3175 + return this.pos > start;
14.3176 + },
14.3177 + skipToEnd: function() {this.pos = this.string.length;},
14.3178 + skipTo: function(ch) {
14.3179 + var found = this.string.indexOf(ch, this.pos);
14.3180 + if (found > -1) {this.pos = found; return true;}
14.3181 + },
14.3182 + backUp: function(n) {this.pos -= n;},
14.3183 + column: function() {return countColumn(this.string, this.start, this.tabSize);},
14.3184 + indentation: function() {return countColumn(this.string, null, this.tabSize);},
14.3185 + match: function(pattern, consume, caseInsensitive) {
14.3186 + if (typeof pattern == "string") {
14.3187 + var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;};
14.3188 + if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
14.3189 + if (consume !== false) this.pos += pattern.length;
14.3190 + return true;
14.3191 + }
14.3192 + } else {
14.3193 + var match = this.string.slice(this.pos).match(pattern);
14.3194 + if (match && match.index > 0) return null;
14.3195 + if (match && consume !== false) this.pos += match[0].length;
14.3196 + return match;
14.3197 + }
14.3198 + },
14.3199 + current: function(){return this.string.slice(this.start, this.pos);}
14.3200 + };
14.3201 + CodeMirror.StringStream = StringStream;
14.3202 +
14.3203 + // TEXTMARKERS
14.3204 +
14.3205 + function TextMarker(cm, type) {
14.3206 + this.lines = [];
14.3207 + this.type = type;
14.3208 + this.cm = cm;
14.3209 + }
14.3210 +
14.3211 + TextMarker.prototype.clear = function() {
14.3212 + if (this.explicitlyCleared) return;
14.3213 + startOperation(this.cm);
14.3214 + var min = null, max = null;
14.3215 + for (var i = 0; i < this.lines.length; ++i) {
14.3216 + var line = this.lines[i];
14.3217 + var span = getMarkedSpanFor(line.markedSpans, this);
14.3218 + if (span.to != null) max = lineNo(line);
14.3219 + line.markedSpans = removeMarkedSpan(line.markedSpans, span);
14.3220 + if (span.from != null)
14.3221 + min = lineNo(line);
14.3222 + else if (this.collapsed && !lineIsHidden(line))
14.3223 + updateLineHeight(line, textHeight(this.cm.display));
14.3224 + }
14.3225 + if (min != null) regChange(this.cm, min, max + 1);
14.3226 + this.lines.length = 0;
14.3227 + this.explicitlyCleared = true;
14.3228 + if (this.collapsed && this.cm.view.cantEdit) {
14.3229 + this.cm.view.cantEdit = false;
14.3230 + reCheckSelection(this.cm);
14.3231 + }
14.3232 + endOperation(this.cm);
14.3233 + signalLater(this.cm, this, "clear");
14.3234 + };
14.3235 +
14.3236 + TextMarker.prototype.find = function() {
14.3237 + var from, to;
14.3238 + for (var i = 0; i < this.lines.length; ++i) {
14.3239 + var line = this.lines[i];
14.3240 + var span = getMarkedSpanFor(line.markedSpans, this);
14.3241 + if (span.from != null || span.to != null) {
14.3242 + var found = lineNo(line);
14.3243 + if (span.from != null) from = {line: found, ch: span.from};
14.3244 + if (span.to != null) to = {line: found, ch: span.to};
14.3245 + }
14.3246 + }
14.3247 + if (this.type == "bookmark") return from;
14.3248 + return from && {from: from, to: to};
14.3249 + };
14.3250 +
14.3251 + function markText(cm, from, to, options, type) {
14.3252 + var doc = cm.view.doc;
14.3253 + var marker = new TextMarker(cm, type);
14.3254 + if (type == "range" && !posLess(from, to)) return marker;
14.3255 + if (options) for (var opt in options) if (options.hasOwnProperty(opt))
14.3256 + marker[opt] = options[opt];
14.3257 + if (marker.replacedWith) {
14.3258 + marker.collapsed = true;
14.3259 + marker.replacedWith = elt("span", [marker.replacedWith], "CodeMirror-widget");
14.3260 + }
14.3261 + if (marker.collapsed) sawCollapsedSpans = true;
14.3262 +
14.3263 + var curLine = from.line, size = 0, collapsedAtStart, collapsedAtEnd;
14.3264 + doc.iter(curLine, to.line + 1, function(line) {
14.3265 + var span = {from: null, to: null, marker: marker};
14.3266 + size += line.text.length;
14.3267 + if (curLine == from.line) {span.from = from.ch; size -= from.ch;}
14.3268 + if (curLine == to.line) {span.to = to.ch; size -= line.text.length - to.ch;}
14.3269 + if (marker.collapsed) {
14.3270 + if (curLine == to.line) collapsedAtEnd = collapsedSpanAt(line, to.ch);
14.3271 + if (curLine == from.line) collapsedAtStart = collapsedSpanAt(line, from.ch);
14.3272 + else updateLineHeight(line, 0);
14.3273 + }
14.3274 + addMarkedSpan(line, span);
14.3275 + if (marker.collapsed && curLine == from.line && lineIsHidden(line))
14.3276 + updateLineHeight(line, 0);
14.3277 + ++curLine;
14.3278 + });
14.3279 +
14.3280 + if (marker.readOnly) {
14.3281 + sawReadOnlySpans = true;
14.3282 + if (cm.view.history.done.length || cm.view.history.undone.length)
14.3283 + cm.clearHistory();
14.3284 + }
14.3285 + if (marker.collapsed) {
14.3286 + if (collapsedAtStart != collapsedAtEnd)
14.3287 + throw new Error("Inserting collapsed marker overlapping an existing one");
14.3288 + marker.size = size;
14.3289 + marker.atomic = true;
14.3290 + }
14.3291 + if (marker.className || marker.startStyle || marker.endStyle || marker.collapsed)
14.3292 + regChange(cm, from.line, to.line + 1);
14.3293 + if (marker.atomic) reCheckSelection(cm);
14.3294 + return marker;
14.3295 + }
14.3296 +
14.3297 + // TEXTMARKER SPANS
14.3298 +
14.3299 + function getMarkedSpanFor(spans, marker) {
14.3300 + if (spans) for (var i = 0; i < spans.length; ++i) {
14.3301 + var span = spans[i];
14.3302 + if (span.marker == marker) return span;
14.3303 + }
14.3304 + }
14.3305 + function removeMarkedSpan(spans, span) {
14.3306 + for (var r, i = 0; i < spans.length; ++i)
14.3307 + if (spans[i] != span) (r || (r = [])).push(spans[i]);
14.3308 + return r;
14.3309 + }
14.3310 + function addMarkedSpan(line, span) {
14.3311 + line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
14.3312 + span.marker.lines.push(line);
14.3313 + }
14.3314 +
14.3315 + function markedSpansBefore(old, startCh) {
14.3316 + if (old) for (var i = 0, nw; i < old.length; ++i) {
14.3317 + var span = old[i], marker = span.marker;
14.3318 + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
14.3319 + if (startsBefore || marker.type == "bookmark" && span.from == startCh) {
14.3320 + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);
14.3321 + (nw || (nw = [])).push({from: span.from,
14.3322 + to: endsAfter ? null : span.to,
14.3323 + marker: marker});
14.3324 + }
14.3325 + }
14.3326 + return nw;
14.3327 + }
14.3328 +
14.3329 + function markedSpansAfter(old, startCh, endCh) {
14.3330 + if (old) for (var i = 0, nw; i < old.length; ++i) {
14.3331 + var span = old[i], marker = span.marker;
14.3332 + var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
14.3333 + if (endsAfter || marker.type == "bookmark" && span.from == endCh && span.from != startCh) {
14.3334 + var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);
14.3335 + (nw || (nw = [])).push({from: startsBefore ? null : span.from - endCh,
14.3336 + to: span.to == null ? null : span.to - endCh,
14.3337 + marker: marker});
14.3338 + }
14.3339 + }
14.3340 + return nw;
14.3341 + }
14.3342 +
14.3343 + function updateMarkedSpans(oldFirst, oldLast, startCh, endCh, newText) {
14.3344 + if (!oldFirst && !oldLast) return newText;
14.3345 + // Get the spans that 'stick out' on both sides
14.3346 + var first = markedSpansBefore(oldFirst, startCh);
14.3347 + var last = markedSpansAfter(oldLast, startCh, endCh);
14.3348 +
14.3349 + // Next, merge those two ends
14.3350 + var sameLine = newText.length == 1, offset = lst(newText).length + (sameLine ? startCh : 0);
14.3351 + if (first) {
14.3352 + // Fix up .to properties of first
14.3353 + for (var i = 0; i < first.length; ++i) {
14.3354 + var span = first[i];
14.3355 + if (span.to == null) {
14.3356 + var found = getMarkedSpanFor(last, span.marker);
14.3357 + if (!found) span.to = startCh;
14.3358 + else if (sameLine) span.to = found.to == null ? null : found.to + offset;
14.3359 + }
14.3360 + }
14.3361 + }
14.3362 + if (last) {
14.3363 + // Fix up .from in last (or move them into first in case of sameLine)
14.3364 + for (var i = 0; i < last.length; ++i) {
14.3365 + var span = last[i];
14.3366 + if (span.to != null) span.to += offset;
14.3367 + if (span.from == null) {
14.3368 + var found = getMarkedSpanFor(first, span.marker);
14.3369 + if (!found) {
14.3370 + span.from = offset;
14.3371 + if (sameLine) (first || (first = [])).push(span);
14.3372 + }
14.3373 + } else {
14.3374 + span.from += offset;
14.3375 + if (sameLine) (first || (first = [])).push(span);
14.3376 + }
14.3377 + }
14.3378 + }
14.3379 +
14.3380 + var newMarkers = [newHL(newText[0], first)];
14.3381 + if (!sameLine) {
14.3382 + // Fill gap with whole-line-spans
14.3383 + var gap = newText.length - 2, gapMarkers;
14.3384 + if (gap > 0 && first)
14.3385 + for (var i = 0; i < first.length; ++i)
14.3386 + if (first[i].to == null)
14.3387 + (gapMarkers || (gapMarkers = [])).push({from: null, to: null, marker: first[i].marker});
14.3388 + for (var i = 0; i < gap; ++i)
14.3389 + newMarkers.push(newHL(newText[i+1], gapMarkers));
14.3390 + newMarkers.push(newHL(lst(newText), last));
14.3391 + }
14.3392 + return newMarkers;
14.3393 + }
14.3394 +
14.3395 + function removeReadOnlyRanges(doc, from, to) {
14.3396 + var markers = null;
14.3397 + doc.iter(from.line, to.line + 1, function(line) {
14.3398 + if (line.markedSpans) for (var i = 0; i < line.markedSpans.length; ++i) {
14.3399 + var mark = line.markedSpans[i].marker;
14.3400 + if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
14.3401 + (markers || (markers = [])).push(mark);
14.3402 + }
14.3403 + });
14.3404 + if (!markers) return null;
14.3405 + var parts = [{from: from, to: to}];
14.3406 + for (var i = 0; i < markers.length; ++i) {
14.3407 + var m = markers[i].find();
14.3408 + for (var j = 0; j < parts.length; ++j) {
14.3409 + var p = parts[j];
14.3410 + if (!posLess(m.from, p.to) || posLess(m.to, p.from)) continue;
14.3411 + var newParts = [j, 1];
14.3412 + if (posLess(p.from, m.from)) newParts.push({from: p.from, to: m.from});
14.3413 + if (posLess(m.to, p.to)) newParts.push({from: m.to, to: p.to});
14.3414 + parts.splice.apply(parts, newParts);
14.3415 + j += newParts.length - 1;
14.3416 + }
14.3417 + }
14.3418 + return parts;
14.3419 + }
14.3420 +
14.3421 + function collapsedSpanAt(line, ch) {
14.3422 + var sps = sawCollapsedSpans && line.markedSpans, found;
14.3423 + if (sps) for (var sp, i = 0; i < sps.length; ++i) {
14.3424 + sp = sps[i];
14.3425 + if (!sp.marker.collapsed) continue;
14.3426 + if ((sp.from == null || sp.from < ch) &&
14.3427 + (sp.to == null || sp.to > ch) &&
14.3428 + (!found || found.width < sp.marker.width))
14.3429 + found = sp.marker;
14.3430 + }
14.3431 + return found;
14.3432 + }
14.3433 + function collapsedSpanAtStart(line) { return collapsedSpanAt(line, -1); }
14.3434 + function collapsedSpanAtEnd(line) { return collapsedSpanAt(line, line.text.length + 1); }
14.3435 +
14.3436 + function visualLine(doc, line) {
14.3437 + var merged;
14.3438 + while (merged = collapsedSpanAtStart(line))
14.3439 + line = getLine(doc, merged.find().from.line);
14.3440 + return line;
14.3441 + }
14.3442 +
14.3443 + function lineIsHidden(line) {
14.3444 + var sps = sawCollapsedSpans && line.markedSpans;
14.3445 + if (sps) for (var sp, i = 0; i < sps.length; ++i) {
14.3446 + sp = sps[i];
14.3447 + if (!sp.marker.collapsed) continue;
14.3448 + if (sp.from == null) return true;
14.3449 + if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(line, sp))
14.3450 + return true;
14.3451 + }
14.3452 + }
14.3453 + window.lineIsHidden = lineIsHidden;
14.3454 + function lineIsHiddenInner(line, span) {
14.3455 + if (span.to == null || span.marker.inclusiveRight && span.to == line.text.length)
14.3456 + return true;
14.3457 + for (var sp, i = 0; i < line.markedSpans.length; ++i) {
14.3458 + sp = line.markedSpans[i];
14.3459 + if (sp.marker.collapsed && sp.from == span.to &&
14.3460 + (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
14.3461 + lineIsHiddenInner(line, sp)) return true;
14.3462 + }
14.3463 + }
14.3464 +
14.3465 + // hl stands for history-line, a data structure that can be either a
14.3466 + // string (line without markers) or a {text, markedSpans} object.
14.3467 + function hlText(val) { return typeof val == "string" ? val : val.text; }
14.3468 + function hlSpans(val) {
14.3469 + if (typeof val == "string") return null;
14.3470 + var spans = val.markedSpans, out = null;
14.3471 + for (var i = 0; i < spans.length; ++i) {
14.3472 + if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i); }
14.3473 + else if (out) out.push(spans[i]);
14.3474 + }
14.3475 + return !out ? spans : out.length ? out : null;
14.3476 + }
14.3477 + function newHL(text, spans) { return spans ? {text: text, markedSpans: spans} : text; }
14.3478 +
14.3479 + function detachMarkedSpans(line) {
14.3480 + var spans = line.markedSpans;
14.3481 + if (!spans) return;
14.3482 + for (var i = 0; i < spans.length; ++i) {
14.3483 + var lines = spans[i].marker.lines;
14.3484 + var ix = indexOf(lines, line);
14.3485 + lines.splice(ix, 1);
14.3486 + }
14.3487 + line.markedSpans = null;
14.3488 + }
14.3489 +
14.3490 + function attachMarkedSpans(line, spans) {
14.3491 + if (!spans) return;
14.3492 + for (var i = 0; i < spans.length; ++i)
14.3493 + spans[i].marker.lines.push(line);
14.3494 + line.markedSpans = spans;
14.3495 + }
14.3496 +
14.3497 + // LINE DATA STRUCTURE
14.3498 +
14.3499 + // Line objects. These hold state related to a line, including
14.3500 + // highlighting info (the styles array).
14.3501 + function makeLine(text, markedSpans, height) {
14.3502 + var line = {text: text, height: height};
14.3503 + attachMarkedSpans(line, markedSpans);
14.3504 + if (lineIsHidden(line)) line.height = 0;
14.3505 + return line;
14.3506 + }
14.3507 +
14.3508 + function updateLine(cm, line, text, markedSpans) {
14.3509 + line.text = text;
14.3510 + line.stateAfter = line.styles = null;
14.3511 + if (line.order != null) line.order = null;
14.3512 + detachMarkedSpans(line);
14.3513 + attachMarkedSpans(line, markedSpans);
14.3514 + if (lineIsHidden(line)) line.height = 0;
14.3515 + else if (!line.height) line.height = textHeight(cm.display);
14.3516 + signalLater(cm, line, "change");
14.3517 + }
14.3518 +
14.3519 + function cleanUpLine(line) {
14.3520 + line.parent = null;
14.3521 + detachMarkedSpans(line);
14.3522 + }
14.3523 +
14.3524 + // Run the given mode's parser over a line, update the styles
14.3525 + // array, which contains alternating fragments of text and CSS
14.3526 + // classes.
14.3527 + function highlightLine(cm, line, state) {
14.3528 + var mode = cm.view.mode, flattenSpans = cm.options.flattenSpans;
14.3529 + var changed = !line.styles, pos = 0, curText = "", curStyle = null;
14.3530 + var stream = new StringStream(line.text, cm.options.tabSize), st = line.styles || (line.styles = []);
14.3531 + if (line.text == "" && mode.blankLine) mode.blankLine(state);
14.3532 + while (!stream.eol()) {
14.3533 + var style = mode.token(stream, state), substr = stream.current();
14.3534 + stream.start = stream.pos;
14.3535 + if (!flattenSpans || curStyle != style) {
14.3536 + if (curText) {
14.3537 + changed = changed || pos >= st.length || curText != st[pos] || curStyle != st[pos+1];
14.3538 + st[pos++] = curText; st[pos++] = curStyle;
14.3539 + }
14.3540 + curText = substr; curStyle = style;
14.3541 + } else curText = curText + substr;
14.3542 + // Give up when line is ridiculously long
14.3543 + if (stream.pos > 5000) break;
14.3544 + }
14.3545 + if (curText) {
14.3546 + changed = changed || pos >= st.length || curText != st[pos] || curStyle != st[pos+1];
14.3547 + st[pos++] = curText; st[pos++] = curStyle;
14.3548 + }
14.3549 + if (stream.pos > 5000) { st[pos++] = line.text.slice(stream.pos); st[pos++] = null; }
14.3550 + if (pos != st.length) { st.length = pos; changed = true; }
14.3551 + return changed;
14.3552 + }
14.3553 +
14.3554 + // Lightweight form of highlight -- proceed over this line and
14.3555 + // update state, but don't save a style array.
14.3556 + function processLine(cm, line, state) {
14.3557 + var mode = cm.view.mode;
14.3558 + var stream = new StringStream(line.text, cm.options.tabSize);
14.3559 + if (line.text == "" && mode.blankLine) mode.blankLine(state);
14.3560 + while (!stream.eol() && stream.pos <= 5000) {
14.3561 + mode.token(stream, state);
14.3562 + stream.start = stream.pos;
14.3563 + }
14.3564 + }
14.3565 +
14.3566 + var styleToClassCache = {};
14.3567 + function styleToClass(style) {
14.3568 + if (!style) return null;
14.3569 + return styleToClassCache[style] ||
14.3570 + (styleToClassCache[style] = "cm-" + style.replace(/ +/g, " cm-"));
14.3571 + }
14.3572 +
14.3573 + function lineContent(cm, realLine, measure) {
14.3574 + var merged, line = realLine, lineBefore, sawBefore, simple = true;
14.3575 + while (merged = collapsedSpanAtStart(line)) {
14.3576 + simple = false;
14.3577 + line = getLine(cm.view.doc, merged.find().from.line);
14.3578 + if (!lineBefore) lineBefore = line;
14.3579 + }
14.3580 +
14.3581 + var builder = {pre: elt("pre"), col: 0, pos: 0, display: !measure,
14.3582 + measure: null, addedOne: false, cm: cm};
14.3583 + if (line.textClass) builder.pre.className = line.textClass;
14.3584 +
14.3585 + do {
14.3586 + if (!line.styles)
14.3587 + highlightLine(cm, line, line.stateAfter = getStateBefore(cm, lineNo(line)));
14.3588 + builder.measure = line == realLine && measure;
14.3589 + builder.pos = 0;
14.3590 + builder.addToken = builder.measure ? buildTokenMeasure : buildToken;
14.3591 + if (measure && sawBefore && line != realLine && !builder.addedOne) {
14.3592 + measure[0] = builder.pre.appendChild(zeroWidthElement(cm.display.measure));
14.3593 + builder.addedOne = true;
14.3594 + }
14.3595 + var next = insertLineContent(line, builder);
14.3596 + sawBefore = line == lineBefore;
14.3597 + if (next) {
14.3598 + line = getLine(cm.view.doc, next.to.line);
14.3599 + simple = false;
14.3600 + }
14.3601 + } while (next);
14.3602 +
14.3603 + if (measure && !builder.addedOne)
14.3604 + measure[0] = builder.pre.appendChild(simple ? elt("span", "\u00a0") : zeroWidthElement(cm.display.measure));
14.3605 + if (!builder.pre.firstChild && !lineIsHidden(realLine))
14.3606 + builder.pre.appendChild(document.createTextNode("\u00a0"));
14.3607 +
14.3608 + return builder.pre;
14.3609 + }
14.3610 +
14.3611 + var tokenSpecialChars = /[\t\u0000-\u0019\u200b\u2028\u2029\uFEFF]/g;
14.3612 + function buildToken(builder, text, style, startStyle, endStyle) {
14.3613 + if (!text) return;
14.3614 + if (!tokenSpecialChars.test(text)) {
14.3615 + builder.col += text.length;
14.3616 + var content = document.createTextNode(text);
14.3617 + } else {
14.3618 + var content = document.createDocumentFragment(), pos = 0;
14.3619 + while (true) {
14.3620 + tokenSpecialChars.lastIndex = pos;
14.3621 + var m = tokenSpecialChars.exec(text);
14.3622 + var skipped = m ? m.index - pos : text.length - pos;
14.3623 + if (skipped) {
14.3624 + content.appendChild(document.createTextNode(text.slice(pos, pos + skipped)));
14.3625 + builder.col += skipped;
14.3626 + }
14.3627 + if (!m) break;
14.3628 + pos += skipped + 1;
14.3629 + if (m[0] == "\t") {
14.3630 + var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
14.3631 + content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
14.3632 + builder.col += tabWidth;
14.3633 + } else {
14.3634 + var token = elt("span", "\u2022", "cm-invalidchar");
14.3635 + token.title = "\\u" + m[0].charCodeAt(0).toString(16);
14.3636 + content.appendChild(token);
14.3637 + builder.col += 1;
14.3638 + }
14.3639 + }
14.3640 + }
14.3641 + if (style || startStyle || endStyle || builder.measure) {
14.3642 + var fullStyle = style || "";
14.3643 + if (startStyle) fullStyle += startStyle;
14.3644 + if (endStyle) fullStyle += endStyle;
14.3645 + return builder.pre.appendChild(elt("span", [content], fullStyle));
14.3646 + }
14.3647 + builder.pre.appendChild(content);
14.3648 + }
14.3649 +
14.3650 + function buildTokenMeasure(builder, text, style, startStyle, endStyle) {
14.3651 + for (var i = 0; i < text.length; ++i) {
14.3652 + if (i && i < text.length - 1 &&
14.3653 + builder.cm.options.lineWrapping &&
14.3654 + spanAffectsWrapping.test(text.slice(i - 1, i + 1)))
14.3655 + builder.pre.appendChild(elt("wbr"));
14.3656 + builder.measure[builder.pos++] =
14.3657 + buildToken(builder, text.charAt(i), style,
14.3658 + i == 0 && startStyle, i == text.length - 1 && endStyle);
14.3659 + }
14.3660 + if (text.length) builder.addedOne = true;
14.3661 + }
14.3662 +
14.3663 + function buildCollapsedSpan(builder, size, widget) {
14.3664 + if (widget) {
14.3665 + if (!builder.display) widget = widget.cloneNode(true);
14.3666 + builder.pre.appendChild(widget);
14.3667 + if (builder.measure && size) {
14.3668 + builder.measure[builder.pos] = widget;
14.3669 + builder.addedOne = true;
14.3670 + }
14.3671 + }
14.3672 + builder.pos += size;
14.3673 + }
14.3674 +
14.3675 + // Outputs a number of spans to make up a line, taking highlighting
14.3676 + // and marked text into account.
14.3677 + function insertLineContent(line, builder) {
14.3678 + var st = line.styles, spans = line.markedSpans;
14.3679 + if (!spans) {
14.3680 + for (var i = 0; i < st.length; i+=2)
14.3681 + builder.addToken(builder, st[i], styleToClass(st[i+1]));
14.3682 + return;
14.3683 + }
14.3684 +
14.3685 + var allText = line.text, len = allText.length;
14.3686 + var pos = 0, i = 0, text = "", style;
14.3687 + var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed;
14.3688 + for (;;) {
14.3689 + if (nextChange == pos) { // Update current marker set
14.3690 + spanStyle = spanEndStyle = spanStartStyle = "";
14.3691 + collapsed = null; nextChange = Infinity;
14.3692 + var foundBookmark = null;
14.3693 + for (var j = 0; j < spans.length; ++j) {
14.3694 + var sp = spans[j], m = sp.marker;
14.3695 + if (sp.from <= pos && (sp.to == null || sp.to > pos)) {
14.3696 + if (sp.to != null && nextChange > sp.to) { nextChange = sp.to; spanEndStyle = ""; }
14.3697 + if (m.className) spanStyle += " " + m.className;
14.3698 + if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle;
14.3699 + if (m.endStyle && sp.to == nextChange) spanEndStyle += " " + m.endStyle;
14.3700 + if (m.collapsed && (!collapsed || collapsed.marker.width < m.width))
14.3701 + collapsed = sp;
14.3702 + } else if (sp.from > pos && nextChange > sp.from) {
14.3703 + nextChange = sp.from;
14.3704 + }
14.3705 + if (m.type == "bookmark" && sp.from == pos && m.replacedWith)
14.3706 + foundBookmark = m.replacedWith;
14.3707 + }
14.3708 + if (collapsed && (collapsed.from || 0) == pos) {
14.3709 + buildCollapsedSpan(builder, (collapsed.to == null ? len : collapsed.to) - pos,
14.3710 + collapsed.from != null && collapsed.marker.replacedWith);
14.3711 + if (collapsed.to == null) return collapsed.marker.find();
14.3712 + }
14.3713 + if (foundBookmark && !collapsed) buildCollapsedSpan(builder, 0, foundBookmark);
14.3714 + }
14.3715 + if (pos >= len) break;
14.3716 +
14.3717 + var upto = Math.min(len, nextChange);
14.3718 + while (true) {
14.3719 + if (text) {
14.3720 + var end = pos + text.length;
14.3721 + if (!collapsed) {
14.3722 + var tokenText = end > upto ? text.slice(0, upto - pos) : text;
14.3723 + builder.addToken(builder, tokenText, style + spanStyle,
14.3724 + spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "");
14.3725 + }
14.3726 + if (end >= upto) {text = text.slice(upto - pos); pos = upto; break;}
14.3727 + pos = end;
14.3728 + spanStartStyle = "";
14.3729 + }
14.3730 + text = st[i++]; style = styleToClass(st[i++]);
14.3731 + }
14.3732 + }
14.3733 + }
14.3734 +
14.3735 + // DOCUMENT DATA STRUCTURE
14.3736 +
14.3737 + function LeafChunk(lines) {
14.3738 + this.lines = lines;
14.3739 + this.parent = null;
14.3740 + for (var i = 0, e = lines.length, height = 0; i < e; ++i) {
14.3741 + lines[i].parent = this;
14.3742 + height += lines[i].height;
14.3743 + }
14.3744 + this.height = height;
14.3745 + }
14.3746 +
14.3747 + LeafChunk.prototype = {
14.3748 + chunkSize: function() { return this.lines.length; },
14.3749 + remove: function(at, n, cm) {
14.3750 + for (var i = at, e = at + n; i < e; ++i) {
14.3751 + var line = this.lines[i];
14.3752 + this.height -= line.height;
14.3753 + cleanUpLine(line);
14.3754 + signalLater(cm, line, "delete");
14.3755 + }
14.3756 + this.lines.splice(at, n);
14.3757 + },
14.3758 + collapse: function(lines) {
14.3759 + lines.splice.apply(lines, [lines.length, 0].concat(this.lines));
14.3760 + },
14.3761 + insertHeight: function(at, lines, height) {
14.3762 + this.height += height;
14.3763 + this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
14.3764 + for (var i = 0, e = lines.length; i < e; ++i) lines[i].parent = this;
14.3765 + },
14.3766 + iterN: function(at, n, op) {
14.3767 + for (var e = at + n; at < e; ++at)
14.3768 + if (op(this.lines[at])) return true;
14.3769 + }
14.3770 + };
14.3771 +
14.3772 + function BranchChunk(children) {
14.3773 + this.children = children;
14.3774 + var size = 0, height = 0;
14.3775 + for (var i = 0, e = children.length; i < e; ++i) {
14.3776 + var ch = children[i];
14.3777 + size += ch.chunkSize(); height += ch.height;
14.3778 + ch.parent = this;
14.3779 + }
14.3780 + this.size = size;
14.3781 + this.height = height;
14.3782 + this.parent = null;
14.3783 + }
14.3784 +
14.3785 + BranchChunk.prototype = {
14.3786 + chunkSize: function() { return this.size; },
14.3787 + remove: function(at, n, callbacks) {
14.3788 + this.size -= n;
14.3789 + for (var i = 0; i < this.children.length; ++i) {
14.3790 + var child = this.children[i], sz = child.chunkSize();
14.3791 + if (at < sz) {
14.3792 + var rm = Math.min(n, sz - at), oldHeight = child.height;
14.3793 + child.remove(at, rm, callbacks);
14.3794 + this.height -= oldHeight - child.height;
14.3795 + if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
14.3796 + if ((n -= rm) == 0) break;
14.3797 + at = 0;
14.3798 + } else at -= sz;
14.3799 + }
14.3800 + if (this.size - n < 25) {
14.3801 + var lines = [];
14.3802 + this.collapse(lines);
14.3803 + this.children = [new LeafChunk(lines)];
14.3804 + this.children[0].parent = this;
14.3805 + }
14.3806 + },
14.3807 + collapse: function(lines) {
14.3808 + for (var i = 0, e = this.children.length; i < e; ++i) this.children[i].collapse(lines);
14.3809 + },
14.3810 + insert: function(at, lines) {
14.3811 + var height = 0;
14.3812 + for (var i = 0, e = lines.length; i < e; ++i) height += lines[i].height;
14.3813 + this.insertHeight(at, lines, height);
14.3814 + },
14.3815 + insertHeight: function(at, lines, height) {
14.3816 + this.size += lines.length;
14.3817 + this.height += height;
14.3818 + for (var i = 0, e = this.children.length; i < e; ++i) {
14.3819 + var child = this.children[i], sz = child.chunkSize();
14.3820 + if (at <= sz) {
14.3821 + child.insertHeight(at, lines, height);
14.3822 + if (child.lines && child.lines.length > 50) {
14.3823 + while (child.lines.length > 50) {
14.3824 + var spilled = child.lines.splice(child.lines.length - 25, 25);
14.3825 + var newleaf = new LeafChunk(spilled);
14.3826 + child.height -= newleaf.height;
14.3827 + this.children.splice(i + 1, 0, newleaf);
14.3828 + newleaf.parent = this;
14.3829 + }
14.3830 + this.maybeSpill();
14.3831 + }
14.3832 + break;
14.3833 + }
14.3834 + at -= sz;
14.3835 + }
14.3836 + },
14.3837 + maybeSpill: function() {
14.3838 + if (this.children.length <= 10) return;
14.3839 + var me = this;
14.3840 + do {
14.3841 + var spilled = me.children.splice(me.children.length - 5, 5);
14.3842 + var sibling = new BranchChunk(spilled);
14.3843 + if (!me.parent) { // Become the parent node
14.3844 + var copy = new BranchChunk(me.children);
14.3845 + copy.parent = me;
14.3846 + me.children = [copy, sibling];
14.3847 + me = copy;
14.3848 + } else {
14.3849 + me.size -= sibling.size;
14.3850 + me.height -= sibling.height;
14.3851 + var myIndex = indexOf(me.parent.children, me);
14.3852 + me.parent.children.splice(myIndex + 1, 0, sibling);
14.3853 + }
14.3854 + sibling.parent = me.parent;
14.3855 + } while (me.children.length > 10);
14.3856 + me.parent.maybeSpill();
14.3857 + },
14.3858 + iter: function(from, to, op) { this.iterN(from, to - from, op); },
14.3859 + iterN: function(at, n, op) {
14.3860 + for (var i = 0, e = this.children.length; i < e; ++i) {
14.3861 + var child = this.children[i], sz = child.chunkSize();
14.3862 + if (at < sz) {
14.3863 + var used = Math.min(n, sz - at);
14.3864 + if (child.iterN(at, used, op)) return true;
14.3865 + if ((n -= used) == 0) break;
14.3866 + at = 0;
14.3867 + } else at -= sz;
14.3868 + }
14.3869 + }
14.3870 + };
14.3871 +
14.3872 + // LINE UTILITIES
14.3873 +
14.3874 + function getLine(chunk, n) {
14.3875 + while (!chunk.lines) {
14.3876 + for (var i = 0;; ++i) {
14.3877 + var child = chunk.children[i], sz = child.chunkSize();
14.3878 + if (n < sz) { chunk = child; break; }
14.3879 + n -= sz;
14.3880 + }
14.3881 + }
14.3882 + return chunk.lines[n];
14.3883 + }
14.3884 +
14.3885 + function updateLineHeight(line, height) {
14.3886 + var diff = height - line.height;
14.3887 + for (var n = line; n; n = n.parent) n.height += diff;
14.3888 + }
14.3889 +
14.3890 + function lineNo(line) {
14.3891 + if (line.parent == null) return null;
14.3892 + var cur = line.parent, no = indexOf(cur.lines, line);
14.3893 + for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
14.3894 + for (var i = 0;; ++i) {
14.3895 + if (chunk.children[i] == cur) break;
14.3896 + no += chunk.children[i].chunkSize();
14.3897 + }
14.3898 + }
14.3899 + return no;
14.3900 + }
14.3901 +
14.3902 + function lineAtHeight(chunk, h) {
14.3903 + var n = 0;
14.3904 + outer: do {
14.3905 + for (var i = 0, e = chunk.children.length; i < e; ++i) {
14.3906 + var child = chunk.children[i], ch = child.height;
14.3907 + if (h < ch) { chunk = child; continue outer; }
14.3908 + h -= ch;
14.3909 + n += child.chunkSize();
14.3910 + }
14.3911 + return n;
14.3912 + } while (!chunk.lines);
14.3913 + for (var i = 0, e = chunk.lines.length; i < e; ++i) {
14.3914 + var line = chunk.lines[i], lh = line.height;
14.3915 + if (h < lh) break;
14.3916 + h -= lh;
14.3917 + }
14.3918 + return n + i;
14.3919 + }
14.3920 +
14.3921 + function heightAtLine(cm, lineObj) {
14.3922 + lineObj = visualLine(cm.view.doc, lineObj);
14.3923 +
14.3924 + var h = 0, chunk = lineObj.parent;
14.3925 + for (var i = 0; i < chunk.lines.length; ++i) {
14.3926 + var line = chunk.lines[i];
14.3927 + if (line == lineObj) break;
14.3928 + else h += line.height;
14.3929 + }
14.3930 + for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
14.3931 + for (var i = 0; i < p.children.length; ++i) {
14.3932 + var cur = p.children[i];
14.3933 + if (cur == chunk) break;
14.3934 + else h += cur.height;
14.3935 + }
14.3936 + }
14.3937 + return h;
14.3938 + }
14.3939 +
14.3940 + function getOrder(line) {
14.3941 + var order = line.order;
14.3942 + if (order == null) order = line.order = bidiOrdering(line.text);
14.3943 + return order;
14.3944 + }
14.3945 +
14.3946 + // HISTORY
14.3947 +
14.3948 + function makeHistory() {
14.3949 + return {
14.3950 + // Arrays of history events. Doing something adds an event to
14.3951 + // done and clears undo. Undoing moves events from done to
14.3952 + // undone, redoing moves them in the other direction.
14.3953 + done: [], undone: [],
14.3954 + // Used to track when changes can be merged into a single undo
14.3955 + // event
14.3956 + lastTime: 0, lastOp: null, lastOrigin: null,
14.3957 + // Used by the isClean() method
14.3958 + dirtyCounter: 0
14.3959 + };
14.3960 + }
14.3961 +
14.3962 + function addChange(cm, start, added, old, origin, fromBefore, toBefore, fromAfter, toAfter) {
14.3963 + var history = cm.view.history;
14.3964 + history.undone.length = 0;
14.3965 + var time = +new Date, cur = lst(history.done);
14.3966 +
14.3967 + if (cur &&
14.3968 + (history.lastOp == cm.curOp.id ||
14.3969 + history.lastOrigin == origin && (origin == "input" || origin == "delete") &&
14.3970 + history.lastTime > time - 600)) {
14.3971 + // Merge this change into the last event
14.3972 + var last = lst(cur.events);
14.3973 + if (last.start > start + old.length || last.start + last.added < start) {
14.3974 + // Doesn't intersect with last sub-event, add new sub-event
14.3975 + cur.events.push({start: start, added: added, old: old});
14.3976 + } else {
14.3977 + // Patch up the last sub-event
14.3978 + var startBefore = Math.max(0, last.start - start),
14.3979 + endAfter = Math.max(0, (start + old.length) - (last.start + last.added));
14.3980 + for (var i = startBefore; i > 0; --i) last.old.unshift(old[i - 1]);
14.3981 + for (var i = endAfter; i > 0; --i) last.old.push(old[old.length - i]);
14.3982 + if (startBefore) last.start = start;
14.3983 + last.added += added - (old.length - startBefore - endAfter);
14.3984 + }
14.3985 + cur.fromAfter = fromAfter; cur.toAfter = toAfter;
14.3986 + } else {
14.3987 + // Can not be merged, start a new event.
14.3988 + cur = {events: [{start: start, added: added, old: old}],
14.3989 + fromBefore: fromBefore, toBefore: toBefore, fromAfter: fromAfter, toAfter: toAfter};
14.3990 + history.done.push(cur);
14.3991 + while (history.done.length > cm.options.undoDepth)
14.3992 + history.done.shift();
14.3993 + if (history.dirtyCounter < 0)
14.3994 + // The user has made a change after undoing past the last clean state.
14.3995 + // We can never get back to a clean state now until markClean() is called.
14.3996 + history.dirtyCounter = NaN;
14.3997 + else
14.3998 + history.dirtyCounter++;
14.3999 + }
14.4000 + history.lastTime = time;
14.4001 + history.lastOp = cm.curOp.id;
14.4002 + history.lastOrigin = origin;
14.4003 + }
14.4004 +
14.4005 + // EVENT OPERATORS
14.4006 +
14.4007 + function stopMethod() {e_stop(this);}
14.4008 + // Ensure an event has a stop method.
14.4009 + function addStop(event) {
14.4010 + if (!event.stop) event.stop = stopMethod;
14.4011 + return event;
14.4012 + }
14.4013 +
14.4014 + function e_preventDefault(e) {
14.4015 + if (e.preventDefault) e.preventDefault();
14.4016 + else e.returnValue = false;
14.4017 + }
14.4018 + function e_stopPropagation(e) {
14.4019 + if (e.stopPropagation) e.stopPropagation();
14.4020 + else e.cancelBubble = true;
14.4021 + }
14.4022 + function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
14.4023 + CodeMirror.e_stop = e_stop;
14.4024 + CodeMirror.e_preventDefault = e_preventDefault;
14.4025 + CodeMirror.e_stopPropagation = e_stopPropagation;
14.4026 +
14.4027 + function e_target(e) {return e.target || e.srcElement;}
14.4028 + function e_button(e) {
14.4029 + var b = e.which;
14.4030 + if (b == null) {
14.4031 + if (e.button & 1) b = 1;
14.4032 + else if (e.button & 2) b = 3;
14.4033 + else if (e.button & 4) b = 2;
14.4034 + }
14.4035 + if (mac && e.ctrlKey && b == 1) b = 3;
14.4036 + return b;
14.4037 + }
14.4038 +
14.4039 + // Allow 3rd-party code to override event properties by adding an override
14.4040 + // object to an event object.
14.4041 + function e_prop(e, prop) {
14.4042 + var overridden = e.override && e.override.hasOwnProperty(prop);
14.4043 + return overridden ? e.override[prop] : e[prop];
14.4044 + }
14.4045 +
14.4046 + // EVENT HANDLING
14.4047 +
14.4048 + function on(emitter, type, f) {
14.4049 + if (emitter.addEventListener)
14.4050 + emitter.addEventListener(type, f, false);
14.4051 + else if (emitter.attachEvent)
14.4052 + emitter.attachEvent("on" + type, f);
14.4053 + else {
14.4054 + var map = emitter._handlers || (emitter._handlers = {});
14.4055 + var arr = map[type] || (map[type] = []);
14.4056 + arr.push(f);
14.4057 + }
14.4058 + }
14.4059 +
14.4060 + function off(emitter, type, f) {
14.4061 + if (emitter.removeEventListener)
14.4062 + emitter.removeEventListener(type, f, false);
14.4063 + else if (emitter.detachEvent)
14.4064 + emitter.detachEvent("on" + type, f);
14.4065 + else {
14.4066 + var arr = emitter._handlers && emitter._handlers[type];
14.4067 + if (!arr) return;
14.4068 + for (var i = 0; i < arr.length; ++i)
14.4069 + if (arr[i] == f) { arr.splice(i, 1); break; }
14.4070 + }
14.4071 + }
14.4072 +
14.4073 + function signal(emitter, type /*, values...*/) {
14.4074 + var arr = emitter._handlers && emitter._handlers[type];
14.4075 + if (!arr) return;
14.4076 + var args = Array.prototype.slice.call(arguments, 2);
14.4077 + for (var i = 0; i < arr.length; ++i) arr[i].apply(null, args);
14.4078 + }
14.4079 +
14.4080 + function signalLater(cm, emitter, type /*, values...*/) {
14.4081 + var arr = emitter._handlers && emitter._handlers[type];
14.4082 + if (!arr) return;
14.4083 + var args = Array.prototype.slice.call(arguments, 3), flist = cm.curOp && cm.curOp.delayedCallbacks;
14.4084 + function bnd(f) {return function(){f.apply(null, args);};};
14.4085 + for (var i = 0; i < arr.length; ++i)
14.4086 + if (flist) flist.push(bnd(arr[i]));
14.4087 + else arr[i].apply(null, args);
14.4088 + }
14.4089 +
14.4090 + function hasHandler(emitter, type) {
14.4091 + var arr = emitter._handlers && emitter._handlers[type];
14.4092 + return arr && arr.length > 0;
14.4093 + }
14.4094 +
14.4095 + CodeMirror.on = on; CodeMirror.off = off; CodeMirror.signal = signal;
14.4096 +
14.4097 + // MISC UTILITIES
14.4098 +
14.4099 + // Number of pixels added to scroller and sizer to hide scrollbar
14.4100 + var scrollerCutOff = 30;
14.4101 +
14.4102 + // Returned or thrown by various protocols to signal 'I'm not
14.4103 + // handling this'.
14.4104 + var Pass = CodeMirror.Pass = {toString: function(){return "CodeMirror.Pass";}};
14.4105 +
14.4106 + function Delayed() {this.id = null;}
14.4107 + Delayed.prototype = {set: function(ms, f) {clearTimeout(this.id); this.id = setTimeout(f, ms);}};
14.4108 +
14.4109 + // Counts the column offset in a string, taking tabs into account.
14.4110 + // Used mostly to find indentation.
14.4111 + function countColumn(string, end, tabSize) {
14.4112 + if (end == null) {
14.4113 + end = string.search(/[^\s\u00a0]/);
14.4114 + if (end == -1) end = string.length;
14.4115 + }
14.4116 + for (var i = 0, n = 0; i < end; ++i) {
14.4117 + if (string.charAt(i) == "\t") n += tabSize - (n % tabSize);
14.4118 + else ++n;
14.4119 + }
14.4120 + return n;
14.4121 + }
14.4122 + CodeMirror.countColumn = countColumn;
14.4123 +
14.4124 + var spaceStrs = [""];
14.4125 + function spaceStr(n) {
14.4126 + while (spaceStrs.length <= n)
14.4127 + spaceStrs.push(lst(spaceStrs) + " ");
14.4128 + return spaceStrs[n];
14.4129 + }
14.4130 +
14.4131 + function lst(arr) { return arr[arr.length-1]; }
14.4132 +
14.4133 + function selectInput(node) {
14.4134 + if (ios) { // Mobile Safari apparently has a bug where select() is broken.
14.4135 + node.selectionStart = 0;
14.4136 + node.selectionEnd = node.value.length;
14.4137 + } else node.select();
14.4138 + }
14.4139 +
14.4140 + function indexOf(collection, elt) {
14.4141 + if (collection.indexOf) return collection.indexOf(elt);
14.4142 + for (var i = 0, e = collection.length; i < e; ++i)
14.4143 + if (collection[i] == elt) return i;
14.4144 + return -1;
14.4145 + }
14.4146 +
14.4147 + function emptyArray(size) {
14.4148 + for (var a = [], i = 0; i < size; ++i) a.push(undefined);
14.4149 + return a;
14.4150 + }
14.4151 +
14.4152 + function bind(f) {
14.4153 + var args = Array.prototype.slice.call(arguments, 1);
14.4154 + return function(){return f.apply(null, args);};
14.4155 + }
14.4156 +
14.4157 + var nonASCIISingleCaseWordChar = /[\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc]/;
14.4158 + function isWordChar(ch) {
14.4159 + return /\w/.test(ch) || ch > "\x80" &&
14.4160 + (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch));
14.4161 + }
14.4162 +
14.4163 + function isEmpty(obj) {
14.4164 + var c = 0;
14.4165 + for (var n in obj) if (obj.hasOwnProperty(n) && obj[n]) ++c;
14.4166 + return !c;
14.4167 + }
14.4168 +
14.4169 + var isExtendingChar = /[\u0300-\u036F\u0483-\u0487\u0488-\u0489\u0591-\u05BD\u05BF\u05C1-\u05C2\u05C4-\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7-\u06E8\u06EA-\u06ED\uA66F\uA670-\uA672\uA674-\uA67D\uA69F]/;
14.4170 +
14.4171 + // DOM UTILITIES
14.4172 +
14.4173 + function elt(tag, content, className, style) {
14.4174 + var e = document.createElement(tag);
14.4175 + if (className) e.className = className;
14.4176 + if (style) e.style.cssText = style;
14.4177 + if (typeof content == "string") setTextContent(e, content);
14.4178 + else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
14.4179 + return e;
14.4180 + }
14.4181 +
14.4182 + function removeChildren(e) {
14.4183 + e.innerHTML = "";
14.4184 + return e;
14.4185 + }
14.4186 +
14.4187 + function removeChildrenAndAdd(parent, e) {
14.4188 + return removeChildren(parent).appendChild(e);
14.4189 + }
14.4190 +
14.4191 + function setTextContent(e, str) {
14.4192 + if (ie_lt9) {
14.4193 + e.innerHTML = "";
14.4194 + e.appendChild(document.createTextNode(str));
14.4195 + } else e.textContent = str;
14.4196 + }
14.4197 +
14.4198 + // FEATURE DETECTION
14.4199 +
14.4200 + // Detect drag-and-drop
14.4201 + var dragAndDrop = function() {
14.4202 + // There is *some* kind of drag-and-drop support in IE6-8, but I
14.4203 + // couldn't get it to work yet.
14.4204 + if (ie_lt9) return false;
14.4205 + var div = elt('div');
14.4206 + return "draggable" in div || "dragDrop" in div;
14.4207 + }();
14.4208 +
14.4209 + // For a reason I have yet to figure out, some browsers disallow
14.4210 + // word wrapping between certain characters *only* if a new inline
14.4211 + // element is started between them. This makes it hard to reliably
14.4212 + // measure the position of things, since that requires inserting an
14.4213 + // extra span. This terribly fragile set of regexps matches the
14.4214 + // character combinations that suffer from this phenomenon on the
14.4215 + // various browsers.
14.4216 + var spanAffectsWrapping = /^$/; // Won't match any two-character string
14.4217 + if (gecko) spanAffectsWrapping = /$'/;
14.4218 + else if (safari) spanAffectsWrapping = /\-[^ \-?]|\?[^ !'\"\),.\-\/:;\?\]\}]/;
14.4219 + else if (chrome) spanAffectsWrapping = /\-[^ \-\.?]|\?[^ \-\.?\]\}:;!'\"\),\/]|[\.!\"#&%\)*+,:;=>\]|\}~][\(\{\[<]|\$'/;
14.4220 +
14.4221 + var knownScrollbarWidth;
14.4222 + function scrollbarWidth(measure) {
14.4223 + if (knownScrollbarWidth != null) return knownScrollbarWidth;
14.4224 + var test = elt("div", null, null, "width: 50px; height: 50px; overflow-x: scroll");
14.4225 + removeChildrenAndAdd(measure, test);
14.4226 + if (test.offsetWidth)
14.4227 + knownScrollbarWidth = test.offsetHeight - test.clientHeight;
14.4228 + return knownScrollbarWidth || 0;
14.4229 + }
14.4230 +
14.4231 + var zwspSupported;
14.4232 + function zeroWidthElement(measure) {
14.4233 + if (zwspSupported == null) {
14.4234 + var test = elt("span", "\u200b");
14.4235 + removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
14.4236 + if (measure.firstChild.offsetHeight != 0)
14.4237 + zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !ie_lt8;
14.4238 + }
14.4239 + if (zwspSupported) return elt("span", "\u200b");
14.4240 + else return elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
14.4241 + }
14.4242 +
14.4243 + // See if "".split is the broken IE version, if so, provide an
14.4244 + // alternative way to split lines.
14.4245 + var splitLines = "\n\nb".split(/\n/).length != 3 ? function(string) {
14.4246 + var pos = 0, result = [], l = string.length;
14.4247 + while (pos <= l) {
14.4248 + var nl = string.indexOf("\n", pos);
14.4249 + if (nl == -1) nl = string.length;
14.4250 + var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
14.4251 + var rt = line.indexOf("\r");
14.4252 + if (rt != -1) {
14.4253 + result.push(line.slice(0, rt));
14.4254 + pos += rt + 1;
14.4255 + } else {
14.4256 + result.push(line);
14.4257 + pos = nl + 1;
14.4258 + }
14.4259 + }
14.4260 + return result;
14.4261 + } : function(string){return string.split(/\r\n?|\n/);};
14.4262 + CodeMirror.splitLines = splitLines;
14.4263 +
14.4264 + var hasSelection = window.getSelection ? function(te) {
14.4265 + try { return te.selectionStart != te.selectionEnd; }
14.4266 + catch(e) { return false; }
14.4267 + } : function(te) {
14.4268 + try {var range = te.ownerDocument.selection.createRange();}
14.4269 + catch(e) {}
14.4270 + if (!range || range.parentElement() != te) return false;
14.4271 + return range.compareEndPoints("StartToEnd", range) != 0;
14.4272 + };
14.4273 +
14.4274 + var hasCopyEvent = (function() {
14.4275 + var e = elt("div");
14.4276 + if ("oncopy" in e) return true;
14.4277 + e.setAttribute("oncopy", "return;");
14.4278 + return typeof e.oncopy == 'function';
14.4279 + })();
14.4280 +
14.4281 + // KEY NAMING
14.4282 +
14.4283 + var keyNames = {3: "Enter", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
14.4284 + 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
14.4285 + 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
14.4286 + 46: "Delete", 59: ";", 91: "Mod", 92: "Mod", 93: "Mod", 109: "-", 107: "=", 127: "Delete",
14.4287 + 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
14.4288 + 221: "]", 222: "'", 63276: "PageUp", 63277: "PageDown", 63275: "End", 63273: "Home",
14.4289 + 63234: "Left", 63232: "Up", 63235: "Right", 63233: "Down", 63302: "Insert", 63272: "Delete"};
14.4290 + CodeMirror.keyNames = keyNames;
14.4291 + (function() {
14.4292 + // Number keys
14.4293 + for (var i = 0; i < 10; i++) keyNames[i + 48] = String(i);
14.4294 + // Alphabetic keys
14.4295 + for (var i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i);
14.4296 + // Function keys
14.4297 + for (var i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i;
14.4298 + })();
14.4299 +
14.4300 + // BIDI HELPERS
14.4301 +
14.4302 + function iterateBidiSections(order, from, to, f) {
14.4303 + if (!order) return f(from, to, "ltr");
14.4304 + for (var i = 0; i < order.length; ++i) {
14.4305 + var part = order[i];
14.4306 + if (part.from < to && part.to > from)
14.4307 + f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr");
14.4308 + }
14.4309 + }
14.4310 +
14.4311 + function bidiLeft(part) { return part.level % 2 ? part.to : part.from; }
14.4312 + function bidiRight(part) { return part.level % 2 ? part.from : part.to; }
14.4313 +
14.4314 + function lineLeft(line) { var order = getOrder(line); return order ? bidiLeft(order[0]) : 0; }
14.4315 + function lineRight(line) {
14.4316 + var order = getOrder(line);
14.4317 + if (!order) return line.text.length;
14.4318 + return bidiRight(lst(order));
14.4319 + }
14.4320 +
14.4321 + function lineStart(cm, lineN) {
14.4322 + var line = getLine(cm.view.doc, lineN);
14.4323 + var visual = visualLine(cm.view.doc, line);
14.4324 + if (visual != line) lineN = lineNo(visual);
14.4325 + var order = getOrder(visual);
14.4326 + var ch = !order ? 0 : order[0].level % 2 ? lineRight(visual) : lineLeft(visual);
14.4327 + return {line: lineN, ch: ch};
14.4328 + }
14.4329 + function lineEnd(cm, lineNo) {
14.4330 + var merged, line;
14.4331 + while (merged = collapsedSpanAtEnd(line = getLine(cm.view.doc, lineNo)))
14.4332 + lineNo = merged.find().to.line;
14.4333 + var order = getOrder(line);
14.4334 + var ch = !order ? line.text.length : order[0].level % 2 ? lineLeft(line) : lineRight(line);
14.4335 + return {line: lineNo, ch: ch};
14.4336 + }
14.4337 +
14.4338 + // This is somewhat involved. It is needed in order to move
14.4339 + // 'visually' through bi-directional text -- i.e., pressing left
14.4340 + // should make the cursor go left, even when in RTL text. The
14.4341 + // tricky part is the 'jumps', where RTL and LTR text touch each
14.4342 + // other. This often requires the cursor offset to move more than
14.4343 + // one unit, in order to visually move one unit.
14.4344 + function moveVisually(line, start, dir, byUnit) {
14.4345 + var bidi = getOrder(line);
14.4346 + if (!bidi) return moveLogically(line, start, dir, byUnit);
14.4347 + var moveOneUnit = byUnit ? function(pos, dir) {
14.4348 + do pos += dir;
14.4349 + while (pos > 0 && isExtendingChar.test(line.text.charAt(pos)));
14.4350 + return pos;
14.4351 + } : function(pos, dir) { return pos + dir; };
14.4352 + var linedir = bidi[0].level;
14.4353 + for (var i = 0; i < bidi.length; ++i) {
14.4354 + var part = bidi[i], sticky = part.level % 2 == linedir;
14.4355 + if ((part.from < start && part.to > start) ||
14.4356 + (sticky && (part.from == start || part.to == start))) break;
14.4357 + }
14.4358 + var target = moveOneUnit(start, part.level % 2 ? -dir : dir);
14.4359 +
14.4360 + while (target != null) {
14.4361 + if (part.level % 2 == linedir) {
14.4362 + if (target < part.from || target > part.to) {
14.4363 + part = bidi[i += dir];
14.4364 + target = part && (dir > 0 == part.level % 2 ? moveOneUnit(part.to, -1) : moveOneUnit(part.from, 1));
14.4365 + } else break;
14.4366 + } else {
14.4367 + if (target == bidiLeft(part)) {
14.4368 + part = bidi[--i];
14.4369 + target = part && bidiRight(part);
14.4370 + } else if (target == bidiRight(part)) {
14.4371 + part = bidi[++i];
14.4372 + target = part && bidiLeft(part);
14.4373 + } else break;
14.4374 + }
14.4375 + }
14.4376 +
14.4377 + return target < 0 || target > line.text.length ? null : target;
14.4378 + }
14.4379 +
14.4380 + function moveLogically(line, start, dir, byUnit) {
14.4381 + var target = start + dir;
14.4382 + if (byUnit) while (target > 0 && isExtendingChar.test(line.text.charAt(target))) target += dir;
14.4383 + return target < 0 || target > line.text.length ? null : target;
14.4384 + }
14.4385 +
14.4386 + // Bidirectional ordering algorithm
14.4387 + // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
14.4388 + // that this (partially) implements.
14.4389 +
14.4390 + // One-char codes used for character types:
14.4391 + // L (L): Left-to-Right
14.4392 + // R (R): Right-to-Left
14.4393 + // r (AL): Right-to-Left Arabic
14.4394 + // 1 (EN): European Number
14.4395 + // + (ES): European Number Separator
14.4396 + // % (ET): European Number Terminator
14.4397 + // n (AN): Arabic Number
14.4398 + // , (CS): Common Number Separator
14.4399 + // m (NSM): Non-Spacing Mark
14.4400 + // b (BN): Boundary Neutral
14.4401 + // s (B): Paragraph Separator
14.4402 + // t (S): Segment Separator
14.4403 + // w (WS): Whitespace
14.4404 + // N (ON): Other Neutrals
14.4405 +
14.4406 + // Returns null if characters are ordered as they appear
14.4407 + // (left-to-right), or an array of sections ({from, to, level}
14.4408 + // objects) in the order in which they occur visually.
14.4409 + var bidiOrdering = (function() {
14.4410 + // Character types for codepoints 0 to 0xff
14.4411 + var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";
14.4412 + // Character types for codepoints 0x600 to 0x6ff
14.4413 + var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";
14.4414 + function charType(code) {
14.4415 + if (code <= 0xff) return lowTypes.charAt(code);
14.4416 + else if (0x590 <= code && code <= 0x5f4) return "R";
14.4417 + else if (0x600 <= code && code <= 0x6ff) return arabicTypes.charAt(code - 0x600);
14.4418 + else if (0x700 <= code && code <= 0x8ac) return "r";
14.4419 + else return "L";
14.4420 + }
14.4421 +
14.4422 + var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
14.4423 + var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
14.4424 +
14.4425 + return function charOrdering(str) {
14.4426 + if (!bidiRE.test(str)) return false;
14.4427 + var len = str.length, types = [], startType = null;
14.4428 + for (var i = 0, type; i < len; ++i) {
14.4429 + types.push(type = charType(str.charCodeAt(i)));
14.4430 + if (startType == null) {
14.4431 + if (type == "L") startType = "L";
14.4432 + else if (type == "R" || type == "r") startType = "R";
14.4433 + }
14.4434 + }
14.4435 + if (startType == null) startType = "L";
14.4436 +
14.4437 + // W1. Examine each non-spacing mark (NSM) in the level run, and
14.4438 + // change the type of the NSM to the type of the previous
14.4439 + // character. If the NSM is at the start of the level run, it will
14.4440 + // get the type of sor.
14.4441 + for (var i = 0, prev = startType; i < len; ++i) {
14.4442 + var type = types[i];
14.4443 + if (type == "m") types[i] = prev;
14.4444 + else prev = type;
14.4445 + }
14.4446 +
14.4447 + // W2. Search backwards from each instance of a European number
14.4448 + // until the first strong type (R, L, AL, or sor) is found. If an
14.4449 + // AL is found, change the type of the European number to Arabic
14.4450 + // number.
14.4451 + // W3. Change all ALs to R.
14.4452 + for (var i = 0, cur = startType; i < len; ++i) {
14.4453 + var type = types[i];
14.4454 + if (type == "1" && cur == "r") types[i] = "n";
14.4455 + else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R"; }
14.4456 + }
14.4457 +
14.4458 + // W4. A single European separator between two European numbers
14.4459 + // changes to a European number. A single common separator between
14.4460 + // two numbers of the same type changes to that type.
14.4461 + for (var i = 1, prev = types[0]; i < len - 1; ++i) {
14.4462 + var type = types[i];
14.4463 + if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1";
14.4464 + else if (type == "," && prev == types[i+1] &&
14.4465 + (prev == "1" || prev == "n")) types[i] = prev;
14.4466 + prev = type;
14.4467 + }
14.4468 +
14.4469 + // W5. A sequence of European terminators adjacent to European
14.4470 + // numbers changes to all European numbers.
14.4471 + // W6. Otherwise, separators and terminators change to Other
14.4472 + // Neutral.
14.4473 + for (var i = 0; i < len; ++i) {
14.4474 + var type = types[i];
14.4475 + if (type == ",") types[i] = "N";
14.4476 + else if (type == "%") {
14.4477 + for (var end = i + 1; end < len && types[end] == "%"; ++end) {}
14.4478 + var replace = (i && types[i-1] == "!") || (end < len - 1 && types[end] == "1") ? "1" : "N";
14.4479 + for (var j = i; j < end; ++j) types[j] = replace;
14.4480 + i = end - 1;
14.4481 + }
14.4482 + }
14.4483 +
14.4484 + // W7. Search backwards from each instance of a European number
14.4485 + // until the first strong type (R, L, or sor) is found. If an L is
14.4486 + // found, then change the type of the European number to L.
14.4487 + for (var i = 0, cur = startType; i < len; ++i) {
14.4488 + var type = types[i];
14.4489 + if (cur == "L" && type == "1") types[i] = "L";
14.4490 + else if (isStrong.test(type)) cur = type;
14.4491 + }
14.4492 +
14.4493 + // N1. A sequence of neutrals takes the direction of the
14.4494 + // surrounding strong text if the text on both sides has the same
14.4495 + // direction. European and Arabic numbers act as if they were R in
14.4496 + // terms of their influence on neutrals. Start-of-level-run (sor)
14.4497 + // and end-of-level-run (eor) are used at level run boundaries.
14.4498 + // N2. Any remaining neutrals take the embedding direction.
14.4499 + for (var i = 0; i < len; ++i) {
14.4500 + if (isNeutral.test(types[i])) {
14.4501 + for (var end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
14.4502 + var before = (i ? types[i-1] : startType) == "L";
14.4503 + var after = (end < len - 1 ? types[end] : startType) == "L";
14.4504 + var replace = before || after ? "L" : "R";
14.4505 + for (var j = i; j < end; ++j) types[j] = replace;
14.4506 + i = end - 1;
14.4507 + }
14.4508 + }
14.4509 +
14.4510 + // Here we depart from the documented algorithm, in order to avoid
14.4511 + // building up an actual levels array. Since there are only three
14.4512 + // levels (0, 1, 2) in an implementation that doesn't take
14.4513 + // explicit embedding into account, we can build up the order on
14.4514 + // the fly, without following the level-based algorithm.
14.4515 + var order = [], m;
14.4516 + for (var i = 0; i < len;) {
14.4517 + if (countsAsLeft.test(types[i])) {
14.4518 + var start = i;
14.4519 + for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
14.4520 + order.push({from: start, to: i, level: 0});
14.4521 + } else {
14.4522 + var pos = i, at = order.length;
14.4523 + for (++i; i < len && types[i] != "L"; ++i) {}
14.4524 + for (var j = pos; j < i;) {
14.4525 + if (countsAsNum.test(types[j])) {
14.4526 + if (pos < j) order.splice(at, 0, {from: pos, to: j, level: 1});
14.4527 + var nstart = j;
14.4528 + for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
14.4529 + order.splice(at, 0, {from: nstart, to: j, level: 2});
14.4530 + pos = j;
14.4531 + } else ++j;
14.4532 + }
14.4533 + if (pos < i) order.splice(at, 0, {from: pos, to: i, level: 1});
14.4534 + }
14.4535 + }
14.4536 + if (order[0].level == 1 && (m = str.match(/^\s+/))) {
14.4537 + order[0].from = m[0].length;
14.4538 + order.unshift({from: 0, to: m[0].length, level: 0});
14.4539 + }
14.4540 + if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
14.4541 + lst(order).to -= m[0].length;
14.4542 + order.push({from: len - m[0].length, to: len, level: 0});
14.4543 + }
14.4544 + if (order[0].level != lst(order).level)
14.4545 + order.push({from: len, to: len, level: order[0].level});
14.4546 +
14.4547 + return order;
14.4548 + };
14.4549 + })();
14.4550 +
14.4551 + // THE END
14.4552 +
14.4553 + CodeMirror.version = "3.0";
14.4554 +
14.4555 + return CodeMirror;
14.4556 +})();
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
15.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/mode/clike.js Tue Jan 15 15:56:45 2013 +0100
15.3 @@ -0,0 +1,300 @@
15.4 +CodeMirror.defineMode("clike", function(config, parserConfig) {
15.5 + var indentUnit = config.indentUnit,
15.6 + statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
15.7 + keywords = parserConfig.keywords || {},
15.8 + builtin = parserConfig.builtin || {},
15.9 + blockKeywords = parserConfig.blockKeywords || {},
15.10 + atoms = parserConfig.atoms || {},
15.11 + hooks = parserConfig.hooks || {},
15.12 + multiLineStrings = parserConfig.multiLineStrings;
15.13 + var isOperatorChar = /[+\-*&%=<>!?|\/]/;
15.14 +
15.15 + var curPunc;
15.16 +
15.17 + function tokenBase(stream, state) {
15.18 + var ch = stream.next();
15.19 + if (hooks[ch]) {
15.20 + var result = hooks[ch](stream, state);
15.21 + if (result !== false) return result;
15.22 + }
15.23 + if (ch == '"' || ch == "'") {
15.24 + state.tokenize = tokenString(ch);
15.25 + return state.tokenize(stream, state);
15.26 + }
15.27 + if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
15.28 + curPunc = ch;
15.29 + return null;
15.30 + }
15.31 + if (/\d/.test(ch)) {
15.32 + stream.eatWhile(/[\w\.]/);
15.33 + return "number";
15.34 + }
15.35 + if (ch == "/") {
15.36 + if (stream.eat("*")) {
15.37 + state.tokenize = tokenComment;
15.38 + return tokenComment(stream, state);
15.39 + }
15.40 + if (stream.eat("/")) {
15.41 + stream.skipToEnd();
15.42 + return "comment";
15.43 + }
15.44 + }
15.45 + if (isOperatorChar.test(ch)) {
15.46 + stream.eatWhile(isOperatorChar);
15.47 + return "operator";
15.48 + }
15.49 + stream.eatWhile(/[\w\$_]/);
15.50 + var cur = stream.current();
15.51 + if (keywords.propertyIsEnumerable(cur)) {
15.52 + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
15.53 + return "keyword";
15.54 + }
15.55 + if (builtin.propertyIsEnumerable(cur)) {
15.56 + if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
15.57 + return "builtin";
15.58 + }
15.59 + if (atoms.propertyIsEnumerable(cur)) return "atom";
15.60 + return "variable";
15.61 + }
15.62 +
15.63 + function tokenString(quote) {
15.64 + return function(stream, state) {
15.65 + var escaped = false, next, end = false;
15.66 + while ((next = stream.next()) != null) {
15.67 + if (next == quote && !escaped) {end = true; break;}
15.68 + escaped = !escaped && next == "\\";
15.69 + }
15.70 + if (end || !(escaped || multiLineStrings))
15.71 + state.tokenize = null;
15.72 + return "string";
15.73 + };
15.74 + }
15.75 +
15.76 + function tokenComment(stream, state) {
15.77 + var maybeEnd = false, ch;
15.78 + while (ch = stream.next()) {
15.79 + if (ch == "/" && maybeEnd) {
15.80 + state.tokenize = null;
15.81 + break;
15.82 + }
15.83 + maybeEnd = (ch == "*");
15.84 + }
15.85 + return "comment";
15.86 + }
15.87 +
15.88 + function Context(indented, column, type, align, prev) {
15.89 + this.indented = indented;
15.90 + this.column = column;
15.91 + this.type = type;
15.92 + this.align = align;
15.93 + this.prev = prev;
15.94 + }
15.95 + function pushContext(state, col, type) {
15.96 + var indent = state.indented;
15.97 + if (state.context && state.context.type == "statement")
15.98 + indent = state.context.indented;
15.99 + return state.context = new Context(indent, col, type, null, state.context);
15.100 + }
15.101 + function popContext(state) {
15.102 + var t = state.context.type;
15.103 + if (t == ")" || t == "]" || t == "}")
15.104 + state.indented = state.context.indented;
15.105 + return state.context = state.context.prev;
15.106 + }
15.107 +
15.108 + // Interface
15.109 +
15.110 + return {
15.111 + startState: function(basecolumn) {
15.112 + return {
15.113 + tokenize: null,
15.114 + context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
15.115 + indented: 0,
15.116 + startOfLine: true
15.117 + };
15.118 + },
15.119 +
15.120 + token: function(stream, state) {
15.121 + var ctx = state.context;
15.122 + if (stream.sol()) {
15.123 + if (ctx.align == null) ctx.align = false;
15.124 + state.indented = stream.indentation();
15.125 + state.startOfLine = true;
15.126 + }
15.127 + if (stream.eatSpace()) return null;
15.128 + curPunc = null;
15.129 + var style = (state.tokenize || tokenBase)(stream, state);
15.130 + if (style == "comment" || style == "meta") return style;
15.131 + if (ctx.align == null) ctx.align = true;
15.132 +
15.133 + if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
15.134 + else if (curPunc == "{") pushContext(state, stream.column(), "}");
15.135 + else if (curPunc == "[") pushContext(state, stream.column(), "]");
15.136 + else if (curPunc == "(") pushContext(state, stream.column(), ")");
15.137 + else if (curPunc == "}") {
15.138 + while (ctx.type == "statement") ctx = popContext(state);
15.139 + if (ctx.type == "}") ctx = popContext(state);
15.140 + while (ctx.type == "statement") ctx = popContext(state);
15.141 + }
15.142 + else if (curPunc == ctx.type) popContext(state);
15.143 + else if (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement"))
15.144 + pushContext(state, stream.column(), "statement");
15.145 + state.startOfLine = false;
15.146 + return style;
15.147 + },
15.148 +
15.149 + indent: function(state, textAfter) {
15.150 + if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
15.151 + var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
15.152 + if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
15.153 + var closing = firstChar == ctx.type;
15.154 + if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
15.155 + else if (ctx.align) return ctx.column + (closing ? 0 : 1);
15.156 + else return ctx.indented + (closing ? 0 : indentUnit);
15.157 + },
15.158 +
15.159 + electricChars: "{}"
15.160 + };
15.161 +});
15.162 +
15.163 +(function() {
15.164 + function words(str) {
15.165 + var obj = {}, words = str.split(" ");
15.166 + for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
15.167 + return obj;
15.168 + }
15.169 + var cKeywords = "auto if break int case long char register continue return default short do sizeof " +
15.170 + "double static else struct entry switch extern typedef float union for unsigned " +
15.171 + "goto while enum void const signed volatile";
15.172 +
15.173 + function cppHook(stream, state) {
15.174 + if (!state.startOfLine) return false;
15.175 + for (;;) {
15.176 + if (stream.skipTo("\\")) {
15.177 + stream.next();
15.178 + if (stream.eol()) {
15.179 + state.tokenize = cppHook;
15.180 + break;
15.181 + }
15.182 + } else {
15.183 + stream.skipToEnd();
15.184 + state.tokenize = null;
15.185 + break;
15.186 + }
15.187 + }
15.188 + return "meta";
15.189 + }
15.190 +
15.191 + // C#-style strings where "" escapes a quote.
15.192 + function tokenAtString(stream, state) {
15.193 + var next;
15.194 + while ((next = stream.next()) != null) {
15.195 + if (next == '"' && !stream.eat('"')) {
15.196 + state.tokenize = null;
15.197 + break;
15.198 + }
15.199 + }
15.200 + return "string";
15.201 + }
15.202 +
15.203 + function mimes(ms, mode) {
15.204 + for (var i = 0; i < ms.length; ++i) CodeMirror.defineMIME(ms[i], mode);
15.205 + }
15.206 +
15.207 + mimes(["text/x-csrc", "text/x-c", "text/x-chdr"], {
15.208 + name: "clike",
15.209 + keywords: words(cKeywords),
15.210 + blockKeywords: words("case do else for if switch while struct"),
15.211 + atoms: words("null"),
15.212 + hooks: {"#": cppHook}
15.213 + });
15.214 + mimes(["text/x-c++src", "text/x-c++hdr"], {
15.215 + name: "clike",
15.216 + keywords: words(cKeywords + " asm dynamic_cast namespace reinterpret_cast try bool explicit new " +
15.217 + "static_cast typeid catch operator template typename class friend private " +
15.218 + "this using const_cast inline public throw virtual delete mutable protected " +
15.219 + "wchar_t"),
15.220 + blockKeywords: words("catch class do else finally for if struct switch try while"),
15.221 + atoms: words("true false null"),
15.222 + hooks: {"#": cppHook}
15.223 + });
15.224 + CodeMirror.defineMIME("text/x-java", {
15.225 + name: "clike",
15.226 + keywords: words("abstract assert boolean break byte case catch char class const continue default " +
15.227 + "do double else enum extends final finally float for goto if implements import " +
15.228 + "instanceof int interface long native new package private protected public " +
15.229 + "return short static strictfp super switch synchronized this throw throws transient " +
15.230 + "try void volatile while"),
15.231 + blockKeywords: words("catch class do else finally for if switch try while"),
15.232 + atoms: words("true false null"),
15.233 + hooks: {
15.234 + "@": function(stream) {
15.235 + stream.eatWhile(/[\w\$_]/);
15.236 + return "meta";
15.237 + }
15.238 + }
15.239 + });
15.240 + CodeMirror.defineMIME("text/x-csharp", {
15.241 + name: "clike",
15.242 + keywords: words("abstract as base break case catch checked class const continue" +
15.243 + " default delegate do else enum event explicit extern finally fixed for" +
15.244 + " foreach goto if implicit in interface internal is lock namespace new" +
15.245 + " operator out override params private protected public readonly ref return sealed" +
15.246 + " sizeof stackalloc static struct switch this throw try typeof unchecked" +
15.247 + " unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
15.248 + " global group into join let orderby partial remove select set value var yield"),
15.249 + blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
15.250 + builtin: words("Boolean Byte Char DateTime DateTimeOffset Decimal Double" +
15.251 + " Guid Int16 Int32 Int64 Object SByte Single String TimeSpan UInt16 UInt32" +
15.252 + " UInt64 bool byte char decimal double short int long object" +
15.253 + " sbyte float string ushort uint ulong"),
15.254 + atoms: words("true false null"),
15.255 + hooks: {
15.256 + "@": function(stream, state) {
15.257 + if (stream.eat('"')) {
15.258 + state.tokenize = tokenAtString;
15.259 + return tokenAtString(stream, state);
15.260 + }
15.261 + stream.eatWhile(/[\w\$_]/);
15.262 + return "meta";
15.263 + }
15.264 + }
15.265 + });
15.266 + CodeMirror.defineMIME("text/x-scala", {
15.267 + name: "clike",
15.268 + keywords: words(
15.269 +
15.270 + /* scala */
15.271 + "abstract case catch class def do else extends false final finally for forSome if " +
15.272 + "implicit import lazy match new null object override package private protected return " +
15.273 + "sealed super this throw trait try trye type val var while with yield _ : = => <- <: " +
15.274 + "<% >: # @ " +
15.275 +
15.276 + /* package scala */
15.277 + "assert assume require print println printf readLine readBoolean readByte readShort " +
15.278 + "readChar readInt readLong readFloat readDouble " +
15.279 +
15.280 + "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
15.281 + "Enumeration Equiv Error Exception Fractional Function IndexedSeq Integral Iterable " +
15.282 + "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
15.283 + "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
15.284 + "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector :: #:: " +
15.285 +
15.286 + /* package java.lang */
15.287 + "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
15.288 + "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
15.289 + "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
15.290 + "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
15.291 +
15.292 +
15.293 + ),
15.294 + blockKeywords: words("catch class do else finally for forSome if match switch try while"),
15.295 + atoms: words("true false null"),
15.296 + hooks: {
15.297 + "@": function(stream) {
15.298 + stream.eatWhile(/[\w\$_]/);
15.299 + return "meta";
15.300 + }
15.301 + }
15.302 + });
15.303 +}());
16.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
16.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/mode/xml.js Tue Jan 15 15:56:45 2013 +0100
16.3 @@ -0,0 +1,324 @@
16.4 +CodeMirror.defineMode("xml", function(config, parserConfig) {
16.5 + var indentUnit = config.indentUnit;
16.6 + var Kludges = parserConfig.htmlMode ? {
16.7 + autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
16.8 + 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
16.9 + 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
16.10 + 'track': true, 'wbr': true},
16.11 + implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
16.12 + 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
16.13 + 'th': true, 'tr': true},
16.14 + contextGrabbers: {
16.15 + 'dd': {'dd': true, 'dt': true},
16.16 + 'dt': {'dd': true, 'dt': true},
16.17 + 'li': {'li': true},
16.18 + 'option': {'option': true, 'optgroup': true},
16.19 + 'optgroup': {'optgroup': true},
16.20 + 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
16.21 + 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
16.22 + 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
16.23 + 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
16.24 + 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
16.25 + 'rp': {'rp': true, 'rt': true},
16.26 + 'rt': {'rp': true, 'rt': true},
16.27 + 'tbody': {'tbody': true, 'tfoot': true},
16.28 + 'td': {'td': true, 'th': true},
16.29 + 'tfoot': {'tbody': true},
16.30 + 'th': {'td': true, 'th': true},
16.31 + 'thead': {'tbody': true, 'tfoot': true},
16.32 + 'tr': {'tr': true}
16.33 + },
16.34 + doNotIndent: {"pre": true},
16.35 + allowUnquoted: true,
16.36 + allowMissing: true
16.37 + } : {
16.38 + autoSelfClosers: {},
16.39 + implicitlyClosed: {},
16.40 + contextGrabbers: {},
16.41 + doNotIndent: {},
16.42 + allowUnquoted: false,
16.43 + allowMissing: false
16.44 + };
16.45 + var alignCDATA = parserConfig.alignCDATA;
16.46 +
16.47 + // Return variables for tokenizers
16.48 + var tagName, type;
16.49 +
16.50 + function inText(stream, state) {
16.51 + function chain(parser) {
16.52 + state.tokenize = parser;
16.53 + return parser(stream, state);
16.54 + }
16.55 +
16.56 + var ch = stream.next();
16.57 + if (ch == "<") {
16.58 + if (stream.eat("!")) {
16.59 + if (stream.eat("[")) {
16.60 + if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
16.61 + else return null;
16.62 + }
16.63 + else if (stream.match("--")) return chain(inBlock("comment", "-->"));
16.64 + else if (stream.match("DOCTYPE", true, true)) {
16.65 + stream.eatWhile(/[\w\._\-]/);
16.66 + return chain(doctype(1));
16.67 + }
16.68 + else return null;
16.69 + }
16.70 + else if (stream.eat("?")) {
16.71 + stream.eatWhile(/[\w\._\-]/);
16.72 + state.tokenize = inBlock("meta", "?>");
16.73 + return "meta";
16.74 + }
16.75 + else {
16.76 + var isClose = stream.eat("/");
16.77 + tagName = "";
16.78 + var c;
16.79 + while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
16.80 + if (!tagName) return "error";
16.81 + type = isClose ? "closeTag" : "openTag";
16.82 + state.tokenize = inTag;
16.83 + return "tag";
16.84 + }
16.85 + }
16.86 + else if (ch == "&") {
16.87 + var ok;
16.88 + if (stream.eat("#")) {
16.89 + if (stream.eat("x")) {
16.90 + ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
16.91 + } else {
16.92 + ok = stream.eatWhile(/[\d]/) && stream.eat(";");
16.93 + }
16.94 + } else {
16.95 + ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
16.96 + }
16.97 + return ok ? "atom" : "error";
16.98 + }
16.99 + else {
16.100 + stream.eatWhile(/[^&<]/);
16.101 + return null;
16.102 + }
16.103 + }
16.104 +
16.105 + function inTag(stream, state) {
16.106 + var ch = stream.next();
16.107 + if (ch == ">" || (ch == "/" && stream.eat(">"))) {
16.108 + state.tokenize = inText;
16.109 + type = ch == ">" ? "endTag" : "selfcloseTag";
16.110 + return "tag";
16.111 + }
16.112 + else if (ch == "=") {
16.113 + type = "equals";
16.114 + return null;
16.115 + }
16.116 + else if (/[\'\"]/.test(ch)) {
16.117 + state.tokenize = inAttribute(ch);
16.118 + return state.tokenize(stream, state);
16.119 + }
16.120 + else {
16.121 + stream.eatWhile(/[^\s\u00a0=<>\"\']/);
16.122 + return "word";
16.123 + }
16.124 + }
16.125 +
16.126 + function inAttribute(quote) {
16.127 + return function(stream, state) {
16.128 + while (!stream.eol()) {
16.129 + if (stream.next() == quote) {
16.130 + state.tokenize = inTag;
16.131 + break;
16.132 + }
16.133 + }
16.134 + return "string";
16.135 + };
16.136 + }
16.137 +
16.138 + function inBlock(style, terminator) {
16.139 + return function(stream, state) {
16.140 + while (!stream.eol()) {
16.141 + if (stream.match(terminator)) {
16.142 + state.tokenize = inText;
16.143 + break;
16.144 + }
16.145 + stream.next();
16.146 + }
16.147 + return style;
16.148 + };
16.149 + }
16.150 + function doctype(depth) {
16.151 + return function(stream, state) {
16.152 + var ch;
16.153 + while ((ch = stream.next()) != null) {
16.154 + if (ch == "<") {
16.155 + state.tokenize = doctype(depth + 1);
16.156 + return state.tokenize(stream, state);
16.157 + } else if (ch == ">") {
16.158 + if (depth == 1) {
16.159 + state.tokenize = inText;
16.160 + break;
16.161 + } else {
16.162 + state.tokenize = doctype(depth - 1);
16.163 + return state.tokenize(stream, state);
16.164 + }
16.165 + }
16.166 + }
16.167 + return "meta";
16.168 + };
16.169 + }
16.170 +
16.171 + var curState, setStyle;
16.172 + function pass() {
16.173 + for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
16.174 + }
16.175 + function cont() {
16.176 + pass.apply(null, arguments);
16.177 + return true;
16.178 + }
16.179 +
16.180 + function pushContext(tagName, startOfLine) {
16.181 + var noIndent = Kludges.doNotIndent.hasOwnProperty(tagName) || (curState.context && curState.context.noIndent);
16.182 + curState.context = {
16.183 + prev: curState.context,
16.184 + tagName: tagName,
16.185 + indent: curState.indented,
16.186 + startOfLine: startOfLine,
16.187 + noIndent: noIndent
16.188 + };
16.189 + }
16.190 + function popContext() {
16.191 + if (curState.context) curState.context = curState.context.prev;
16.192 + }
16.193 +
16.194 + function element(type) {
16.195 + if (type == "openTag") {
16.196 + curState.tagName = tagName;
16.197 + return cont(attributes, endtag(curState.startOfLine));
16.198 + } else if (type == "closeTag") {
16.199 + var err = false;
16.200 + if (curState.context) {
16.201 + if (curState.context.tagName != tagName) {
16.202 + if (Kludges.implicitlyClosed.hasOwnProperty(curState.context.tagName.toLowerCase())) {
16.203 + popContext();
16.204 + }
16.205 + err = !curState.context || curState.context.tagName != tagName;
16.206 + }
16.207 + } else {
16.208 + err = true;
16.209 + }
16.210 + if (err) setStyle = "error";
16.211 + return cont(endclosetag(err));
16.212 + }
16.213 + return cont();
16.214 + }
16.215 + function endtag(startOfLine) {
16.216 + return function(type) {
16.217 + var tagName = curState.tagName;
16.218 + curState.tagName = null;
16.219 + if (type == "selfcloseTag" ||
16.220 + (type == "endTag" && Kludges.autoSelfClosers.hasOwnProperty(tagName.toLowerCase()))) {
16.221 + maybePopContext(tagName.toLowerCase());
16.222 + return cont();
16.223 + }
16.224 + if (type == "endTag") {
16.225 + maybePopContext(tagName.toLowerCase());
16.226 + pushContext(tagName, startOfLine);
16.227 + return cont();
16.228 + }
16.229 + return cont();
16.230 + };
16.231 + }
16.232 + function endclosetag(err) {
16.233 + return function(type) {
16.234 + if (err) setStyle = "error";
16.235 + if (type == "endTag") { popContext(); return cont(); }
16.236 + setStyle = "error";
16.237 + return cont(arguments.callee);
16.238 + };
16.239 + }
16.240 + function maybePopContext(nextTagName) {
16.241 + var parentTagName;
16.242 + while (true) {
16.243 + if (!curState.context) {
16.244 + return;
16.245 + }
16.246 + parentTagName = curState.context.tagName.toLowerCase();
16.247 + if (!Kludges.contextGrabbers.hasOwnProperty(parentTagName) ||
16.248 + !Kludges.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
16.249 + return;
16.250 + }
16.251 + popContext();
16.252 + }
16.253 + }
16.254 +
16.255 + function attributes(type) {
16.256 + if (type == "word") {setStyle = "attribute"; return cont(attribute, attributes);}
16.257 + if (type == "endTag" || type == "selfcloseTag") return pass();
16.258 + setStyle = "error";
16.259 + return cont(attributes);
16.260 + }
16.261 + function attribute(type) {
16.262 + if (type == "equals") return cont(attvalue, attributes);
16.263 + if (!Kludges.allowMissing) setStyle = "error";
16.264 + else if (type == "word") setStyle = "attribute";
16.265 + return (type == "endTag" || type == "selfcloseTag") ? pass() : cont();
16.266 + }
16.267 + function attvalue(type) {
16.268 + if (type == "string") return cont(attvaluemaybe);
16.269 + if (type == "word" && Kludges.allowUnquoted) {setStyle = "string"; return cont();}
16.270 + setStyle = "error";
16.271 + return (type == "endTag" || type == "selfCloseTag") ? pass() : cont();
16.272 + }
16.273 + function attvaluemaybe(type) {
16.274 + if (type == "string") return cont(attvaluemaybe);
16.275 + else return pass();
16.276 + }
16.277 +
16.278 + return {
16.279 + startState: function() {
16.280 + return {tokenize: inText, cc: [], indented: 0, startOfLine: true, tagName: null, context: null};
16.281 + },
16.282 +
16.283 + token: function(stream, state) {
16.284 + if (stream.sol()) {
16.285 + state.startOfLine = true;
16.286 + state.indented = stream.indentation();
16.287 + }
16.288 + if (stream.eatSpace()) return null;
16.289 +
16.290 + setStyle = type = tagName = null;
16.291 + var style = state.tokenize(stream, state);
16.292 + state.type = type;
16.293 + if ((style || type) && style != "comment") {
16.294 + curState = state;
16.295 + while (true) {
16.296 + var comb = state.cc.pop() || element;
16.297 + if (comb(type || style)) break;
16.298 + }
16.299 + }
16.300 + state.startOfLine = false;
16.301 + return setStyle || style;
16.302 + },
16.303 +
16.304 + indent: function(state, textAfter, fullLine) {
16.305 + var context = state.context;
16.306 + if ((state.tokenize != inTag && state.tokenize != inText) ||
16.307 + context && context.noIndent)
16.308 + return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
16.309 + if (alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
16.310 + if (context && /^<\//.test(textAfter))
16.311 + context = context.prev;
16.312 + while (context && !context.startOfLine)
16.313 + context = context.prev;
16.314 + if (context) return context.indent + indentUnit;
16.315 + else return 0;
16.316 + },
16.317 +
16.318 + electricChars: "/",
16.319 +
16.320 + configuration: parserConfig.htmlMode ? "html" : "xml"
16.321 + };
16.322 +});
16.323 +
16.324 +CodeMirror.defineMIME("text/xml", "xml");
16.325 +CodeMirror.defineMIME("application/xml", "xml");
16.326 +if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
16.327 + CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
17.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
17.2 +++ b/launcher/src/main/resources/org/apidesign/bck2brwsr/dew/js/codemirror/theme/elegant.css Tue Jan 15 15:56:45 2013 +0100
17.3 @@ -0,0 +1,10 @@
17.4 +.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
17.5 +.cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;}
17.6 +.cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;}
17.7 +.cm-s-elegant span.cm-variable {color: black;}
17.8 +.cm-s-elegant span.cm-variable-2 {color: #b11;}
17.9 +.cm-s-elegant span.cm-qualifier {color: #555;}
17.10 +.cm-s-elegant span.cm-keyword {color: #730;}
17.11 +.cm-s-elegant span.cm-builtin {color: #30a;}
17.12 +.cm-s-elegant span.cm-error {background-color: #fdd;}
17.13 +.cm-s-elegant span.cm-link {color: #762;}