From eaa8ccaccb1091820d0a8d1223996a6dd057347d Mon Sep 17 00:00:00 2001
From: Wu Cheng-Han
Date: Sun, 17 Jan 2016 14:28:04 -0600
Subject: Upgrade CodeMirror to 5.10.1 and now support fullscreen, jump-to-line
in editor
---
public/vendor/codemirror/addon/comment/comment.js | 27 +-
.../codemirror/addon/comment/continuecomment.js | 0
public/vendor/codemirror/addon/dialog/dialog.js | 0
.../vendor/codemirror/addon/display/autorefresh.js | 47 ++
.../vendor/codemirror/addon/display/fullscreen.css | 2 +-
.../vendor/codemirror/addon/display/fullscreen.js | 0
public/vendor/codemirror/addon/display/panel.js | 0
.../vendor/codemirror/addon/display/placeholder.js | 4 +-
public/vendor/codemirror/addon/display/rulers.js | 0
.../vendor/codemirror/addon/edit/closebrackets.js | 18 +-
public/vendor/codemirror/addon/edit/closetag.js | 11 +-
.../vendor/codemirror/addon/edit/continuelist.js | 8 +-
.../vendor/codemirror/addon/edit/matchbrackets.js | 0
public/vendor/codemirror/addon/edit/matchtags.js | 0
.../vendor/codemirror/addon/edit/trailingspace.js | 0
public/vendor/codemirror/addon/fold/brace-fold.js | 0
.../vendor/codemirror/addon/fold/comment-fold.js | 4 +-
public/vendor/codemirror/addon/fold/foldcode.js | 0
public/vendor/codemirror/addon/fold/foldgutter.css | 0
public/vendor/codemirror/addon/fold/foldgutter.js | 4 +-
public/vendor/codemirror/addon/fold/indent-fold.js | 0
.../vendor/codemirror/addon/fold/markdown-fold.js | 0
public/vendor/codemirror/addon/fold/xml-fold.js | 0
.../vendor/codemirror/addon/hint/anyword-hint.js | 2 +-
public/vendor/codemirror/addon/hint/css-hint.js | 0
public/vendor/codemirror/addon/hint/html-hint.js | 0
.../codemirror/addon/hint/javascript-hint.js | 0
public/vendor/codemirror/addon/hint/show-hint.css | 0
public/vendor/codemirror/addon/hint/show-hint.js | 119 +++--
public/vendor/codemirror/addon/hint/sql-hint.js | 0
public/vendor/codemirror/addon/hint/xml-hint.js | 0
.../codemirror/addon/lint/coffeescript-lint.js | 0
public/vendor/codemirror/addon/lint/css-lint.js | 0
public/vendor/codemirror/addon/lint/html-lint.js | 46 ++
.../codemirror/addon/lint/javascript-lint.js | 0
public/vendor/codemirror/addon/lint/json-lint.js | 0
public/vendor/codemirror/addon/lint/lint.css | 0
public/vendor/codemirror/addon/lint/lint.js | 34 +-
public/vendor/codemirror/addon/lint/yaml-lint.js | 0
public/vendor/codemirror/addon/merge/merge.css | 0
public/vendor/codemirror/addon/merge/merge.js | 13 +-
public/vendor/codemirror/addon/mode/loadmode.js | 0
public/vendor/codemirror/addon/mode/multiplex.js | 6 +-
.../vendor/codemirror/addon/mode/multiplex_test.js | 2 +-
public/vendor/codemirror/addon/mode/overlay.js | 0
public/vendor/codemirror/addon/mode/simple.js | 2 +-
public/vendor/codemirror/addon/runmode/colorize.js | 0
.../codemirror/addon/runmode/runmode-standalone.js | 0
public/vendor/codemirror/addon/runmode/runmode.js | 2 +-
.../codemirror/addon/runmode/runmode.node.js | 1 +
.../codemirror/addon/scroll/annotatescrollbar.js | 5 +-
.../codemirror/addon/scroll/scrollpastend.js | 0
.../codemirror/addon/scroll/simplescrollbars.js | 0
.../vendor/codemirror/addon/search/jump-to-line.js | 49 ++
.../codemirror/addon/search/match-highlighter.js | 43 +-
.../codemirror/addon/search/matchesonscrollbar.js | 0
public/vendor/codemirror/addon/search/search.js | 125 +++--
.../vendor/codemirror/addon/search/searchcursor.js | 0
.../codemirror/addon/selection/active-line.js | 0
.../codemirror/addon/selection/mark-selection.js | 0
.../addon/selection/selection-pointer.js | 0
public/vendor/codemirror/addon/tern/tern.css | 1 +
public/vendor/codemirror/addon/tern/tern.js | 14 +-
public/vendor/codemirror/addon/tern/worker.js | 0
public/vendor/codemirror/addon/wrap/hardwrap.js | 15 +-
public/vendor/codemirror/codemirror.min.js | 29 +-
public/vendor/codemirror/compress.sh | 3 +
public/vendor/codemirror/keymap/emacs.js | 2 +-
public/vendor/codemirror/keymap/sublime.js | 44 +-
public/vendor/codemirror/keymap/vim.js | 35 +-
public/vendor/codemirror/lib/codemirror.css | 55 +-
public/vendor/codemirror/lib/codemirror.js | 559 +++++++++++++--------
public/vendor/codemirror/mode/apl/apl.js | 0
public/vendor/codemirror/mode/apl/index.html | 0
.../codemirror/mode/asciiarmor/asciiarmor.js | 0
.../vendor/codemirror/mode/asciiarmor/index.html | 0
public/vendor/codemirror/mode/asn.1/asn.1.js | 0
public/vendor/codemirror/mode/asn.1/index.html | 3 +-
public/vendor/codemirror/mode/asterisk/asterisk.js | 0
public/vendor/codemirror/mode/asterisk/index.html | 0
.../vendor/codemirror/mode/brainfuck/brainfuck.js | 85 ++++
public/vendor/codemirror/mode/brainfuck/index.html | 85 ++++
public/vendor/codemirror/mode/clike/clike.js | 245 +++++++--
public/vendor/codemirror/mode/clike/index.html | 111 +++-
public/vendor/codemirror/mode/clike/scala.html | 0
public/vendor/codemirror/mode/clike/test.js | 18 +
public/vendor/codemirror/mode/clojure/clojure.js | 3 +
public/vendor/codemirror/mode/clojure/index.html | 3 +
public/vendor/codemirror/mode/cmake/cmake.js | 0
public/vendor/codemirror/mode/cmake/index.html | 0
public/vendor/codemirror/mode/cobol/cobol.js | 0
public/vendor/codemirror/mode/cobol/index.html | 0
.../codemirror/mode/coffeescript/coffeescript.js | 40 +-
.../vendor/codemirror/mode/coffeescript/index.html | 0
.../codemirror/mode/commonlisp/commonlisp.js | 0
.../vendor/codemirror/mode/commonlisp/index.html | 0
public/vendor/codemirror/mode/crystal/crystal.js | 391 ++++++++++++++
public/vendor/codemirror/mode/crystal/index.html | 119 +++++
public/vendor/codemirror/mode/css/css.js | 147 ++++--
public/vendor/codemirror/mode/css/gss.html | 103 ++++
public/vendor/codemirror/mode/css/gss_test.js | 17 +
public/vendor/codemirror/mode/css/index.html | 0
public/vendor/codemirror/mode/css/less.html | 0
public/vendor/codemirror/mode/css/less_test.js | 4 +-
public/vendor/codemirror/mode/css/scss.html | 0
public/vendor/codemirror/mode/css/scss_test.js | 2 +-
public/vendor/codemirror/mode/css/test.js | 22 +-
public/vendor/codemirror/mode/cypher/cypher.js | 6 +-
public/vendor/codemirror/mode/cypher/index.html | 0
public/vendor/codemirror/mode/d/d.js | 0
public/vendor/codemirror/mode/d/index.html | 0
public/vendor/codemirror/mode/dart/dart.js | 86 +++-
public/vendor/codemirror/mode/dart/index.html | 0
public/vendor/codemirror/mode/diff/diff.js | 0
public/vendor/codemirror/mode/diff/index.html | 0
public/vendor/codemirror/mode/django/django.js | 25 +-
public/vendor/codemirror/mode/django/index.html | 0
.../codemirror/mode/dockerfile/dockerfile.js | 5 +-
.../vendor/codemirror/mode/dockerfile/index.html | 0
public/vendor/codemirror/mode/dtd/dtd.js | 0
public/vendor/codemirror/mode/dtd/index.html | 0
public/vendor/codemirror/mode/dylan/dylan.js | 0
public/vendor/codemirror/mode/dylan/index.html | 0
public/vendor/codemirror/mode/ebnf/ebnf.js | 0
public/vendor/codemirror/mode/ebnf/index.html | 0
public/vendor/codemirror/mode/ecl/ecl.js | 0
public/vendor/codemirror/mode/ecl/index.html | 0
public/vendor/codemirror/mode/eiffel/eiffel.js | 0
public/vendor/codemirror/mode/eiffel/index.html | 0
public/vendor/codemirror/mode/elm/elm.js | 2 +-
public/vendor/codemirror/mode/elm/index.html | 0
public/vendor/codemirror/mode/erlang/erlang.js | 4 -
public/vendor/codemirror/mode/erlang/index.html | 0
public/vendor/codemirror/mode/factor/factor.js | 0
public/vendor/codemirror/mode/factor/index.html | 0
public/vendor/codemirror/mode/forth/forth.js | 0
public/vendor/codemirror/mode/forth/index.html | 0
public/vendor/codemirror/mode/fortran/fortran.js | 0
public/vendor/codemirror/mode/fortran/index.html | 0
public/vendor/codemirror/mode/gas/gas.js | 0
public/vendor/codemirror/mode/gas/index.html | 0
public/vendor/codemirror/mode/gfm/gfm.js | 45 +-
public/vendor/codemirror/mode/gfm/index.html | 0
public/vendor/codemirror/mode/gfm/test.js | 21 +-
public/vendor/codemirror/mode/gherkin/gherkin.js | 0
public/vendor/codemirror/mode/gherkin/index.html | 0
public/vendor/codemirror/mode/go/go.js | 2 +-
public/vendor/codemirror/mode/go/index.html | 0
public/vendor/codemirror/mode/groovy/groovy.js | 0
public/vendor/codemirror/mode/groovy/index.html | 0
public/vendor/codemirror/mode/haml/haml.js | 6 +-
public/vendor/codemirror/mode/haml/index.html | 0
public/vendor/codemirror/mode/haml/test.js | 0
.../codemirror/mode/handlebars/handlebars.js | 19 +-
.../vendor/codemirror/mode/handlebars/index.html | 15 +-
.../mode/haskell-literate/haskell-literate.js | 43 ++
.../codemirror/mode/haskell-literate/index.html | 282 +++++++++++
public/vendor/codemirror/mode/haskell/haskell.js | 0
public/vendor/codemirror/mode/haskell/index.html | 0
public/vendor/codemirror/mode/haxe/haxe.js | 165 +++---
public/vendor/codemirror/mode/haxe/index.html | 0
.../codemirror/mode/htmlembedded/htmlembedded.js | 0
.../vendor/codemirror/mode/htmlembedded/index.html | 0
.../vendor/codemirror/mode/htmlmixed/htmlmixed.js | 221 ++++----
public/vendor/codemirror/mode/htmlmixed/index.html | 0
public/vendor/codemirror/mode/http/http.js | 0
public/vendor/codemirror/mode/http/index.html | 0
public/vendor/codemirror/mode/idl/idl.js | 0
public/vendor/codemirror/mode/idl/index.html | 0
public/vendor/codemirror/mode/index.html | 15 +-
public/vendor/codemirror/mode/jade/index.html | 0
public/vendor/codemirror/mode/jade/jade.js | 6 +-
.../vendor/codemirror/mode/javascript/index.html | 0
.../codemirror/mode/javascript/javascript.js | 84 +++-
.../vendor/codemirror/mode/javascript/json-ld.html | 0
public/vendor/codemirror/mode/javascript/test.js | 55 +-
.../codemirror/mode/javascript/typescript.html | 0
public/vendor/codemirror/mode/jinja2/index.html | 0
public/vendor/codemirror/mode/jinja2/jinja2.js | 0
public/vendor/codemirror/mode/jsx/index.html | 89 ++++
public/vendor/codemirror/mode/jsx/jsx.js | 147 ++++++
public/vendor/codemirror/mode/jsx/test.js | 69 +++
public/vendor/codemirror/mode/julia/index.html | 0
public/vendor/codemirror/mode/julia/julia.js | 223 +++++---
public/vendor/codemirror/mode/kotlin/index.html | 89 ----
public/vendor/codemirror/mode/kotlin/kotlin.js | 284 -----------
.../vendor/codemirror/mode/livescript/index.html | 0
.../codemirror/mode/livescript/livescript.js | 0
public/vendor/codemirror/mode/lua/index.html | 0
public/vendor/codemirror/mode/lua/lua.js | 0
public/vendor/codemirror/mode/markdown/index.html | 4 +-
public/vendor/codemirror/mode/markdown/markdown.js | 192 +++----
public/vendor/codemirror/mode/markdown/test.js | 176 ++++++-
.../vendor/codemirror/mode/mathematica/index.html | 0
.../codemirror/mode/mathematica/mathematica.js | 0
public/vendor/codemirror/mode/meta.js | 20 +-
public/vendor/codemirror/mode/mirc/index.html | 0
public/vendor/codemirror/mode/mirc/mirc.js | 0
public/vendor/codemirror/mode/mllike/index.html | 0
public/vendor/codemirror/mode/mllike/mllike.js | 0
public/vendor/codemirror/mode/modelica/index.html | 0
public/vendor/codemirror/mode/modelica/modelica.js | 0
public/vendor/codemirror/mode/mscgen/index.html | 151 ++++++
public/vendor/codemirror/mode/mscgen/mscgen.js | 169 +++++++
.../vendor/codemirror/mode/mscgen/mscgen_test.js | 75 +++
.../vendor/codemirror/mode/mscgen/msgenny_test.js | 71 +++
public/vendor/codemirror/mode/mscgen/xu_test.js | 75 +++
public/vendor/codemirror/mode/mumps/index.html | 4 +-
public/vendor/codemirror/mode/mumps/mumps.js | 0
public/vendor/codemirror/mode/nginx/index.html | 4 +-
public/vendor/codemirror/mode/nginx/nginx.js | 2 +-
public/vendor/codemirror/mode/nsis/index.html | 80 +++
public/vendor/codemirror/mode/nsis/nsis.js | 95 ++++
public/vendor/codemirror/mode/ntriples/index.html | 0
public/vendor/codemirror/mode/ntriples/ntriples.js | 0
public/vendor/codemirror/mode/octave/index.html | 0
public/vendor/codemirror/mode/octave/octave.js | 0
public/vendor/codemirror/mode/oz/index.html | 59 +++
public/vendor/codemirror/mode/oz/oz.js | 252 ++++++++++
public/vendor/codemirror/mode/pascal/index.html | 0
public/vendor/codemirror/mode/pascal/pascal.js | 0
public/vendor/codemirror/mode/pegjs/index.html | 0
public/vendor/codemirror/mode/pegjs/pegjs.js | 0
public/vendor/codemirror/mode/perl/index.html | 0
public/vendor/codemirror/mode/perl/perl.js | 0
public/vendor/codemirror/mode/php/index.html | 0
public/vendor/codemirror/mode/php/php.js | 20 +-
public/vendor/codemirror/mode/php/test.js | 0
public/vendor/codemirror/mode/pig/index.html | 4 +-
public/vendor/codemirror/mode/pig/pig.js | 0
.../vendor/codemirror/mode/properties/index.html | 0
.../codemirror/mode/properties/properties.js | 0
public/vendor/codemirror/mode/puppet/index.html | 0
public/vendor/codemirror/mode/puppet/puppet.js | 0
public/vendor/codemirror/mode/python/index.html | 0
public/vendor/codemirror/mode/python/python.js | 45 +-
public/vendor/codemirror/mode/q/index.html | 0
public/vendor/codemirror/mode/q/q.js | 0
public/vendor/codemirror/mode/r/index.html | 0
public/vendor/codemirror/mode/r/r.js | 0
.../vendor/codemirror/mode/rpm/changes/index.html | 0
public/vendor/codemirror/mode/rpm/index.html | 0
public/vendor/codemirror/mode/rpm/rpm.js | 26 +-
public/vendor/codemirror/mode/rst/index.html | 0
public/vendor/codemirror/mode/rst/rst.js | 0
public/vendor/codemirror/mode/ruby/index.html | 0
public/vendor/codemirror/mode/ruby/ruby.js | 6 +-
public/vendor/codemirror/mode/ruby/test.js | 0
public/vendor/codemirror/mode/rust/index.html | 22 +-
public/vendor/codemirror/mode/rust/rust.js | 484 ++----------------
public/vendor/codemirror/mode/rust/test.js | 39 ++
public/vendor/codemirror/mode/sass/index.html | 0
public/vendor/codemirror/mode/sass/sass.js | 0
public/vendor/codemirror/mode/scheme/index.html | 0
public/vendor/codemirror/mode/scheme/scheme.js | 0
public/vendor/codemirror/mode/shell/index.html | 0
public/vendor/codemirror/mode/shell/shell.js | 0
public/vendor/codemirror/mode/shell/test.js | 0
public/vendor/codemirror/mode/sieve/index.html | 0
public/vendor/codemirror/mode/sieve/sieve.js | 0
public/vendor/codemirror/mode/slim/index.html | 0
public/vendor/codemirror/mode/slim/slim.js | 0
public/vendor/codemirror/mode/slim/test.js | 0
public/vendor/codemirror/mode/smalltalk/index.html | 0
.../vendor/codemirror/mode/smalltalk/smalltalk.js | 0
public/vendor/codemirror/mode/smarty/index.html | 0
public/vendor/codemirror/mode/smarty/smarty.js | 0
public/vendor/codemirror/mode/solr/index.html | 0
public/vendor/codemirror/mode/solr/solr.js | 0
public/vendor/codemirror/mode/soy/index.html | 0
public/vendor/codemirror/mode/soy/soy.js | 0
public/vendor/codemirror/mode/sparql/index.html | 0
public/vendor/codemirror/mode/sparql/sparql.js | 4 +-
.../vendor/codemirror/mode/spreadsheet/index.html | 0
.../codemirror/mode/spreadsheet/spreadsheet.js | 0
public/vendor/codemirror/mode/sql/index.html | 0
public/vendor/codemirror/mode/sql/sql.js | 2 +-
public/vendor/codemirror/mode/stex/index.html | 0
public/vendor/codemirror/mode/stex/stex.js | 0
public/vendor/codemirror/mode/stex/test.js | 0
public/vendor/codemirror/mode/stylus/index.html | 0
public/vendor/codemirror/mode/stylus/stylus.js | 19 +-
public/vendor/codemirror/mode/swift/index.html | 20 +-
public/vendor/codemirror/mode/swift/swift.js | 296 +++++------
public/vendor/codemirror/mode/tcl/index.html | 0
public/vendor/codemirror/mode/tcl/tcl.js | 0
public/vendor/codemirror/mode/textile/index.html | 0
public/vendor/codemirror/mode/textile/test.js | 0
public/vendor/codemirror/mode/textile/textile.js | 0
.../vendor/codemirror/mode/tiddlywiki/index.html | 0
.../codemirror/mode/tiddlywiki/tiddlywiki.css | 0
.../codemirror/mode/tiddlywiki/tiddlywiki.js | 0
public/vendor/codemirror/mode/tiki/index.html | 0
public/vendor/codemirror/mode/tiki/tiki.css | 2 +-
public/vendor/codemirror/mode/tiki/tiki.js | 0
public/vendor/codemirror/mode/toml/index.html | 0
public/vendor/codemirror/mode/toml/toml.js | 0
public/vendor/codemirror/mode/tornado/index.html | 0
public/vendor/codemirror/mode/tornado/tornado.js | 0
public/vendor/codemirror/mode/troff/index.html | 0
public/vendor/codemirror/mode/troff/troff.js | 0
public/vendor/codemirror/mode/ttcn-cfg/index.html | 0
public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js | 0
public/vendor/codemirror/mode/ttcn/index.html | 0
public/vendor/codemirror/mode/ttcn/ttcn.js | 0
public/vendor/codemirror/mode/turtle/index.html | 0
public/vendor/codemirror/mode/turtle/turtle.js | 0
public/vendor/codemirror/mode/twig/index.html | 0
public/vendor/codemirror/mode/twig/twig.js | 0
public/vendor/codemirror/mode/vb/index.html | 0
public/vendor/codemirror/mode/vb/vb.js | 0
public/vendor/codemirror/mode/vbscript/index.html | 0
public/vendor/codemirror/mode/vbscript/vbscript.js | 0
public/vendor/codemirror/mode/velocity/index.html | 0
public/vendor/codemirror/mode/velocity/velocity.js | 0
public/vendor/codemirror/mode/verilog/index.html | 0
public/vendor/codemirror/mode/verilog/test.js | 0
public/vendor/codemirror/mode/verilog/verilog.js | 0
public/vendor/codemirror/mode/vhdl/index.html | 95 ++++
public/vendor/codemirror/mode/vhdl/vhdl.js | 189 +++++++
public/vendor/codemirror/mode/vue/index.html | 69 +++
public/vendor/codemirror/mode/vue/vue.js | 69 +++
public/vendor/codemirror/mode/xml/index.html | 0
public/vendor/codemirror/mode/xml/test.js | 0
public/vendor/codemirror/mode/xml/xml.js | 148 +++---
public/vendor/codemirror/mode/xquery/index.html | 0
public/vendor/codemirror/mode/xquery/test.js | 0
public/vendor/codemirror/mode/xquery/xquery.js | 0
.../codemirror/mode/yaml-frontmatter/index.html | 121 +++++
.../mode/yaml-frontmatter/yaml-frontmatter.js | 68 +++
public/vendor/codemirror/mode/yaml/index.html | 0
public/vendor/codemirror/mode/yaml/yaml.js | 0
public/vendor/codemirror/mode/z80/index.html | 0
public/vendor/codemirror/mode/z80/z80.js | 0
public/vendor/codemirror/theme/3024-day.css | 45 +-
public/vendor/codemirror/theme/3024-night.css | 44 +-
public/vendor/codemirror/theme/abcdef.css | 32 ++
public/vendor/codemirror/theme/ambiance-mobile.css | 0
public/vendor/codemirror/theme/ambiance.css | 20 +-
public/vendor/codemirror/theme/base16-dark.css | 54 +-
public/vendor/codemirror/theme/base16-light.css | 54 +-
public/vendor/codemirror/theme/bespin.css | 34 ++
public/vendor/codemirror/theme/blackboard.css | 14 +-
public/vendor/codemirror/theme/cobalt.css | 12 +-
public/vendor/codemirror/theme/colorforth.css | 6 +-
public/vendor/codemirror/theme/dracula.css | 41 ++
public/vendor/codemirror/theme/eclipse.css | 42 +-
public/vendor/codemirror/theme/elegant.css | 24 +-
public/vendor/codemirror/theme/erlang-dark.css | 12 +-
public/vendor/codemirror/theme/hopscotch.css | 34 ++
public/vendor/codemirror/theme/icecoder.css | 43 ++
public/vendor/codemirror/theme/isotope.css | 34 ++
public/vendor/codemirror/theme/lesser-dark.css | 32 +-
public/vendor/codemirror/theme/liquibyte.css | 38 +-
public/vendor/codemirror/theme/material.css | 53 ++
public/vendor/codemirror/theme/mbo.css | 50 +-
public/vendor/codemirror/theme/mdn-like.css | 16 +-
public/vendor/codemirror/theme/midnight.css | 50 +-
public/vendor/codemirror/theme/monokai.css | 47 +-
public/vendor/codemirror/theme/neat.css | 6 +-
public/vendor/codemirror/theme/neo.css | 14 +-
public/vendor/codemirror/theme/night.css | 12 +-
public/vendor/codemirror/theme/paraiso-dark.css | 52 +-
public/vendor/codemirror/theme/paraiso-light.css | 52 +-
public/vendor/codemirror/theme/pastel-on-dark.css | 10 +-
public/vendor/codemirror/theme/railscasts.css | 34 ++
public/vendor/codemirror/theme/rubyblue.css | 10 +-
public/vendor/codemirror/theme/seti.css | 44 ++
public/vendor/codemirror/theme/solarized.css | 22 +-
public/vendor/codemirror/theme/the-matrix.css | 46 +-
.../codemirror/theme/tomorrow-night-bright.css | 48 +-
.../codemirror/theme/tomorrow-night-eighties.css | 52 +-
public/vendor/codemirror/theme/ttcn.css | 91 ++--
public/vendor/codemirror/theme/twilight.css | 18 +-
public/vendor/codemirror/theme/vibrant-ink.css | 22 +-
public/vendor/codemirror/theme/xq-dark.css | 44 +-
public/vendor/codemirror/theme/xq-light.css | 36 +-
public/vendor/codemirror/theme/yeti.css | 44 ++
public/vendor/codemirror/theme/zenburn.css | 6 +-
379 files changed, 6744 insertions(+), 2664 deletions(-)
mode change 100755 => 100644 public/vendor/codemirror/addon/comment/comment.js
mode change 100755 => 100644 public/vendor/codemirror/addon/comment/continuecomment.js
mode change 100755 => 100644 public/vendor/codemirror/addon/dialog/dialog.js
create mode 100644 public/vendor/codemirror/addon/display/autorefresh.js
mode change 100755 => 100644 public/vendor/codemirror/addon/display/fullscreen.css
mode change 100755 => 100644 public/vendor/codemirror/addon/display/fullscreen.js
mode change 100755 => 100644 public/vendor/codemirror/addon/display/panel.js
mode change 100755 => 100644 public/vendor/codemirror/addon/display/placeholder.js
mode change 100755 => 100644 public/vendor/codemirror/addon/display/rulers.js
mode change 100755 => 100644 public/vendor/codemirror/addon/edit/closebrackets.js
mode change 100755 => 100644 public/vendor/codemirror/addon/edit/closetag.js
mode change 100755 => 100644 public/vendor/codemirror/addon/edit/continuelist.js
mode change 100755 => 100644 public/vendor/codemirror/addon/edit/matchbrackets.js
mode change 100755 => 100644 public/vendor/codemirror/addon/edit/matchtags.js
mode change 100755 => 100644 public/vendor/codemirror/addon/edit/trailingspace.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/brace-fold.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/comment-fold.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/foldcode.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/foldgutter.css
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/foldgutter.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/indent-fold.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/markdown-fold.js
mode change 100755 => 100644 public/vendor/codemirror/addon/fold/xml-fold.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/anyword-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/css-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/html-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/javascript-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/show-hint.css
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/show-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/sql-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/hint/xml-hint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/coffeescript-lint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/css-lint.js
create mode 100644 public/vendor/codemirror/addon/lint/html-lint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/javascript-lint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/json-lint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/lint.css
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/lint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/lint/yaml-lint.js
mode change 100755 => 100644 public/vendor/codemirror/addon/merge/merge.css
mode change 100755 => 100644 public/vendor/codemirror/addon/merge/merge.js
mode change 100755 => 100644 public/vendor/codemirror/addon/mode/loadmode.js
mode change 100755 => 100644 public/vendor/codemirror/addon/mode/multiplex.js
mode change 100755 => 100644 public/vendor/codemirror/addon/mode/multiplex_test.js
mode change 100755 => 100644 public/vendor/codemirror/addon/mode/overlay.js
mode change 100755 => 100644 public/vendor/codemirror/addon/mode/simple.js
mode change 100755 => 100644 public/vendor/codemirror/addon/runmode/colorize.js
mode change 100755 => 100644 public/vendor/codemirror/addon/runmode/runmode-standalone.js
mode change 100755 => 100644 public/vendor/codemirror/addon/runmode/runmode.js
mode change 100755 => 100644 public/vendor/codemirror/addon/runmode/runmode.node.js
mode change 100755 => 100644 public/vendor/codemirror/addon/scroll/annotatescrollbar.js
mode change 100755 => 100644 public/vendor/codemirror/addon/scroll/scrollpastend.js
mode change 100755 => 100644 public/vendor/codemirror/addon/scroll/simplescrollbars.js
create mode 100644 public/vendor/codemirror/addon/search/jump-to-line.js
mode change 100755 => 100644 public/vendor/codemirror/addon/search/match-highlighter.js
mode change 100755 => 100644 public/vendor/codemirror/addon/search/matchesonscrollbar.js
mode change 100755 => 100644 public/vendor/codemirror/addon/search/search.js
mode change 100755 => 100644 public/vendor/codemirror/addon/search/searchcursor.js
mode change 100755 => 100644 public/vendor/codemirror/addon/selection/active-line.js
mode change 100755 => 100644 public/vendor/codemirror/addon/selection/mark-selection.js
mode change 100755 => 100644 public/vendor/codemirror/addon/selection/selection-pointer.js
mode change 100755 => 100644 public/vendor/codemirror/addon/tern/tern.css
mode change 100755 => 100644 public/vendor/codemirror/addon/tern/tern.js
mode change 100755 => 100644 public/vendor/codemirror/addon/tern/worker.js
mode change 100755 => 100644 public/vendor/codemirror/addon/wrap/hardwrap.js
mode change 100755 => 100644 public/vendor/codemirror/keymap/emacs.js
mode change 100755 => 100644 public/vendor/codemirror/keymap/sublime.js
mode change 100755 => 100644 public/vendor/codemirror/keymap/vim.js
mode change 100755 => 100644 public/vendor/codemirror/lib/codemirror.css
mode change 100755 => 100644 public/vendor/codemirror/lib/codemirror.js
mode change 100755 => 100644 public/vendor/codemirror/mode/apl/apl.js
mode change 100755 => 100644 public/vendor/codemirror/mode/apl/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/asciiarmor/asciiarmor.js
mode change 100755 => 100644 public/vendor/codemirror/mode/asciiarmor/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/asn.1/asn.1.js
mode change 100755 => 100644 public/vendor/codemirror/mode/asn.1/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/asterisk/asterisk.js
mode change 100755 => 100644 public/vendor/codemirror/mode/asterisk/index.html
create mode 100644 public/vendor/codemirror/mode/brainfuck/brainfuck.js
create mode 100644 public/vendor/codemirror/mode/brainfuck/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/clike/clike.js
mode change 100755 => 100644 public/vendor/codemirror/mode/clike/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/clike/scala.html
mode change 100755 => 100644 public/vendor/codemirror/mode/clike/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/clojure/clojure.js
mode change 100755 => 100644 public/vendor/codemirror/mode/clojure/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/cmake/cmake.js
mode change 100755 => 100644 public/vendor/codemirror/mode/cmake/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/cobol/cobol.js
mode change 100755 => 100644 public/vendor/codemirror/mode/cobol/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/coffeescript/coffeescript.js
mode change 100755 => 100644 public/vendor/codemirror/mode/coffeescript/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/commonlisp/commonlisp.js
mode change 100755 => 100644 public/vendor/codemirror/mode/commonlisp/index.html
create mode 100644 public/vendor/codemirror/mode/crystal/crystal.js
create mode 100644 public/vendor/codemirror/mode/crystal/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/css/css.js
create mode 100644 public/vendor/codemirror/mode/css/gss.html
create mode 100644 public/vendor/codemirror/mode/css/gss_test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/css/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/css/less.html
mode change 100755 => 100644 public/vendor/codemirror/mode/css/less_test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/css/scss.html
mode change 100755 => 100644 public/vendor/codemirror/mode/css/scss_test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/css/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/cypher/cypher.js
mode change 100755 => 100644 public/vendor/codemirror/mode/cypher/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/d/d.js
mode change 100755 => 100644 public/vendor/codemirror/mode/d/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/dart/dart.js
mode change 100755 => 100644 public/vendor/codemirror/mode/dart/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/diff/diff.js
mode change 100755 => 100644 public/vendor/codemirror/mode/diff/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/django/django.js
mode change 100755 => 100644 public/vendor/codemirror/mode/django/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/dockerfile/dockerfile.js
mode change 100755 => 100644 public/vendor/codemirror/mode/dockerfile/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/dtd/dtd.js
mode change 100755 => 100644 public/vendor/codemirror/mode/dtd/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/dylan/dylan.js
mode change 100755 => 100644 public/vendor/codemirror/mode/dylan/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/ebnf/ebnf.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ebnf/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/ecl/ecl.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ecl/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/eiffel/eiffel.js
mode change 100755 => 100644 public/vendor/codemirror/mode/eiffel/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/elm/elm.js
mode change 100755 => 100644 public/vendor/codemirror/mode/elm/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/erlang/erlang.js
mode change 100755 => 100644 public/vendor/codemirror/mode/erlang/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/factor/factor.js
mode change 100755 => 100644 public/vendor/codemirror/mode/factor/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/forth/forth.js
mode change 100755 => 100644 public/vendor/codemirror/mode/forth/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/fortran/fortran.js
mode change 100755 => 100644 public/vendor/codemirror/mode/fortran/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/gas/gas.js
mode change 100755 => 100644 public/vendor/codemirror/mode/gas/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/gfm/gfm.js
mode change 100755 => 100644 public/vendor/codemirror/mode/gfm/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/gfm/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/gherkin/gherkin.js
mode change 100755 => 100644 public/vendor/codemirror/mode/gherkin/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/go/go.js
mode change 100755 => 100644 public/vendor/codemirror/mode/go/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/groovy/groovy.js
mode change 100755 => 100644 public/vendor/codemirror/mode/groovy/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/haml/haml.js
mode change 100755 => 100644 public/vendor/codemirror/mode/haml/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/haml/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/handlebars/handlebars.js
mode change 100755 => 100644 public/vendor/codemirror/mode/handlebars/index.html
create mode 100644 public/vendor/codemirror/mode/haskell-literate/haskell-literate.js
create mode 100644 public/vendor/codemirror/mode/haskell-literate/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/haskell/haskell.js
mode change 100755 => 100644 public/vendor/codemirror/mode/haskell/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/haxe/haxe.js
mode change 100755 => 100644 public/vendor/codemirror/mode/haxe/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/htmlembedded/htmlembedded.js
mode change 100755 => 100644 public/vendor/codemirror/mode/htmlembedded/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/htmlmixed/htmlmixed.js
mode change 100755 => 100644 public/vendor/codemirror/mode/htmlmixed/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/http/http.js
mode change 100755 => 100644 public/vendor/codemirror/mode/http/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/idl/idl.js
mode change 100755 => 100644 public/vendor/codemirror/mode/idl/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/jade/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/jade/jade.js
mode change 100755 => 100644 public/vendor/codemirror/mode/javascript/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/javascript/javascript.js
mode change 100755 => 100644 public/vendor/codemirror/mode/javascript/json-ld.html
mode change 100755 => 100644 public/vendor/codemirror/mode/javascript/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/javascript/typescript.html
mode change 100755 => 100644 public/vendor/codemirror/mode/jinja2/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/jinja2/jinja2.js
create mode 100644 public/vendor/codemirror/mode/jsx/index.html
create mode 100644 public/vendor/codemirror/mode/jsx/jsx.js
create mode 100644 public/vendor/codemirror/mode/jsx/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/julia/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/julia/julia.js
delete mode 100755 public/vendor/codemirror/mode/kotlin/index.html
delete mode 100755 public/vendor/codemirror/mode/kotlin/kotlin.js
mode change 100755 => 100644 public/vendor/codemirror/mode/livescript/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/livescript/livescript.js
mode change 100755 => 100644 public/vendor/codemirror/mode/lua/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/lua/lua.js
mode change 100755 => 100644 public/vendor/codemirror/mode/markdown/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/markdown/markdown.js
mode change 100755 => 100644 public/vendor/codemirror/mode/markdown/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/mathematica/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/mathematica/mathematica.js
mode change 100755 => 100644 public/vendor/codemirror/mode/meta.js
mode change 100755 => 100644 public/vendor/codemirror/mode/mirc/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/mirc/mirc.js
mode change 100755 => 100644 public/vendor/codemirror/mode/mllike/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/mllike/mllike.js
mode change 100755 => 100644 public/vendor/codemirror/mode/modelica/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/modelica/modelica.js
create mode 100644 public/vendor/codemirror/mode/mscgen/index.html
create mode 100644 public/vendor/codemirror/mode/mscgen/mscgen.js
create mode 100644 public/vendor/codemirror/mode/mscgen/mscgen_test.js
create mode 100644 public/vendor/codemirror/mode/mscgen/msgenny_test.js
create mode 100644 public/vendor/codemirror/mode/mscgen/xu_test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/mumps/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/mumps/mumps.js
mode change 100755 => 100644 public/vendor/codemirror/mode/nginx/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/nginx/nginx.js
create mode 100644 public/vendor/codemirror/mode/nsis/index.html
create mode 100644 public/vendor/codemirror/mode/nsis/nsis.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ntriples/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/ntriples/ntriples.js
mode change 100755 => 100644 public/vendor/codemirror/mode/octave/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/octave/octave.js
create mode 100644 public/vendor/codemirror/mode/oz/index.html
create mode 100644 public/vendor/codemirror/mode/oz/oz.js
mode change 100755 => 100644 public/vendor/codemirror/mode/pascal/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/pascal/pascal.js
mode change 100755 => 100644 public/vendor/codemirror/mode/pegjs/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/pegjs/pegjs.js
mode change 100755 => 100644 public/vendor/codemirror/mode/perl/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/perl/perl.js
mode change 100755 => 100644 public/vendor/codemirror/mode/php/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/php/php.js
mode change 100755 => 100644 public/vendor/codemirror/mode/php/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/pig/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/pig/pig.js
mode change 100755 => 100644 public/vendor/codemirror/mode/properties/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/properties/properties.js
mode change 100755 => 100644 public/vendor/codemirror/mode/puppet/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/puppet/puppet.js
mode change 100755 => 100644 public/vendor/codemirror/mode/python/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/python/python.js
mode change 100755 => 100644 public/vendor/codemirror/mode/q/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/q/q.js
mode change 100755 => 100644 public/vendor/codemirror/mode/r/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/r/r.js
mode change 100755 => 100644 public/vendor/codemirror/mode/rpm/changes/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/rpm/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/rpm/rpm.js
mode change 100755 => 100644 public/vendor/codemirror/mode/rst/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/rst/rst.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ruby/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/ruby/ruby.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ruby/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/rust/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/rust/rust.js
create mode 100644 public/vendor/codemirror/mode/rust/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/sass/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/sass/sass.js
mode change 100755 => 100644 public/vendor/codemirror/mode/scheme/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/scheme/scheme.js
mode change 100755 => 100644 public/vendor/codemirror/mode/shell/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/shell/shell.js
mode change 100755 => 100644 public/vendor/codemirror/mode/shell/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/sieve/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/sieve/sieve.js
mode change 100755 => 100644 public/vendor/codemirror/mode/slim/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/slim/slim.js
mode change 100755 => 100644 public/vendor/codemirror/mode/slim/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/smalltalk/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/smalltalk/smalltalk.js
mode change 100755 => 100644 public/vendor/codemirror/mode/smarty/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/smarty/smarty.js
mode change 100755 => 100644 public/vendor/codemirror/mode/solr/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/solr/solr.js
mode change 100755 => 100644 public/vendor/codemirror/mode/soy/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/soy/soy.js
mode change 100755 => 100644 public/vendor/codemirror/mode/sparql/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/sparql/sparql.js
mode change 100755 => 100644 public/vendor/codemirror/mode/spreadsheet/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/spreadsheet/spreadsheet.js
mode change 100755 => 100644 public/vendor/codemirror/mode/sql/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/sql/sql.js
mode change 100755 => 100644 public/vendor/codemirror/mode/stex/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/stex/stex.js
mode change 100755 => 100644 public/vendor/codemirror/mode/stex/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/stylus/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/stylus/stylus.js
mode change 100755 => 100644 public/vendor/codemirror/mode/swift/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/swift/swift.js
mode change 100755 => 100644 public/vendor/codemirror/mode/tcl/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/tcl/tcl.js
mode change 100755 => 100644 public/vendor/codemirror/mode/textile/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/textile/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/textile/textile.js
mode change 100755 => 100644 public/vendor/codemirror/mode/tiddlywiki/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/tiddlywiki/tiddlywiki.css
mode change 100755 => 100644 public/vendor/codemirror/mode/tiddlywiki/tiddlywiki.js
mode change 100755 => 100644 public/vendor/codemirror/mode/tiki/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/tiki/tiki.css
mode change 100755 => 100644 public/vendor/codemirror/mode/tiki/tiki.js
mode change 100755 => 100644 public/vendor/codemirror/mode/toml/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/toml/toml.js
mode change 100755 => 100644 public/vendor/codemirror/mode/tornado/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/tornado/tornado.js
mode change 100755 => 100644 public/vendor/codemirror/mode/troff/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/troff/troff.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ttcn-cfg/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/ttcn-cfg/ttcn-cfg.js
mode change 100755 => 100644 public/vendor/codemirror/mode/ttcn/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/ttcn/ttcn.js
mode change 100755 => 100644 public/vendor/codemirror/mode/turtle/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/turtle/turtle.js
mode change 100755 => 100644 public/vendor/codemirror/mode/twig/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/twig/twig.js
mode change 100755 => 100644 public/vendor/codemirror/mode/vb/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/vb/vb.js
mode change 100755 => 100644 public/vendor/codemirror/mode/vbscript/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/vbscript/vbscript.js
mode change 100755 => 100644 public/vendor/codemirror/mode/velocity/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/velocity/velocity.js
mode change 100755 => 100644 public/vendor/codemirror/mode/verilog/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/verilog/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/verilog/verilog.js
create mode 100644 public/vendor/codemirror/mode/vhdl/index.html
create mode 100644 public/vendor/codemirror/mode/vhdl/vhdl.js
create mode 100644 public/vendor/codemirror/mode/vue/index.html
create mode 100644 public/vendor/codemirror/mode/vue/vue.js
mode change 100755 => 100644 public/vendor/codemirror/mode/xml/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/xml/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/xml/xml.js
mode change 100755 => 100644 public/vendor/codemirror/mode/xquery/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/xquery/test.js
mode change 100755 => 100644 public/vendor/codemirror/mode/xquery/xquery.js
create mode 100644 public/vendor/codemirror/mode/yaml-frontmatter/index.html
create mode 100644 public/vendor/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js
mode change 100755 => 100644 public/vendor/codemirror/mode/yaml/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/yaml/yaml.js
mode change 100755 => 100644 public/vendor/codemirror/mode/z80/index.html
mode change 100755 => 100644 public/vendor/codemirror/mode/z80/z80.js
mode change 100755 => 100644 public/vendor/codemirror/theme/3024-day.css
mode change 100755 => 100644 public/vendor/codemirror/theme/3024-night.css
create mode 100644 public/vendor/codemirror/theme/abcdef.css
mode change 100755 => 100644 public/vendor/codemirror/theme/ambiance-mobile.css
mode change 100755 => 100644 public/vendor/codemirror/theme/ambiance.css
mode change 100755 => 100644 public/vendor/codemirror/theme/base16-dark.css
mode change 100755 => 100644 public/vendor/codemirror/theme/base16-light.css
create mode 100644 public/vendor/codemirror/theme/bespin.css
mode change 100755 => 100644 public/vendor/codemirror/theme/blackboard.css
mode change 100755 => 100644 public/vendor/codemirror/theme/cobalt.css
mode change 100755 => 100644 public/vendor/codemirror/theme/colorforth.css
create mode 100644 public/vendor/codemirror/theme/dracula.css
mode change 100755 => 100644 public/vendor/codemirror/theme/eclipse.css
mode change 100755 => 100644 public/vendor/codemirror/theme/elegant.css
mode change 100755 => 100644 public/vendor/codemirror/theme/erlang-dark.css
create mode 100644 public/vendor/codemirror/theme/hopscotch.css
create mode 100644 public/vendor/codemirror/theme/icecoder.css
create mode 100644 public/vendor/codemirror/theme/isotope.css
mode change 100755 => 100644 public/vendor/codemirror/theme/lesser-dark.css
mode change 100755 => 100644 public/vendor/codemirror/theme/liquibyte.css
create mode 100644 public/vendor/codemirror/theme/material.css
mode change 100755 => 100644 public/vendor/codemirror/theme/mbo.css
mode change 100755 => 100644 public/vendor/codemirror/theme/mdn-like.css
mode change 100755 => 100644 public/vendor/codemirror/theme/midnight.css
mode change 100755 => 100644 public/vendor/codemirror/theme/monokai.css
mode change 100755 => 100644 public/vendor/codemirror/theme/neat.css
mode change 100755 => 100644 public/vendor/codemirror/theme/neo.css
mode change 100755 => 100644 public/vendor/codemirror/theme/night.css
mode change 100755 => 100644 public/vendor/codemirror/theme/paraiso-dark.css
mode change 100755 => 100644 public/vendor/codemirror/theme/paraiso-light.css
mode change 100755 => 100644 public/vendor/codemirror/theme/pastel-on-dark.css
create mode 100644 public/vendor/codemirror/theme/railscasts.css
mode change 100755 => 100644 public/vendor/codemirror/theme/rubyblue.css
create mode 100644 public/vendor/codemirror/theme/seti.css
mode change 100755 => 100644 public/vendor/codemirror/theme/solarized.css
mode change 100755 => 100644 public/vendor/codemirror/theme/the-matrix.css
mode change 100755 => 100644 public/vendor/codemirror/theme/tomorrow-night-bright.css
mode change 100755 => 100644 public/vendor/codemirror/theme/tomorrow-night-eighties.css
mode change 100755 => 100644 public/vendor/codemirror/theme/ttcn.css
mode change 100755 => 100644 public/vendor/codemirror/theme/twilight.css
mode change 100755 => 100644 public/vendor/codemirror/theme/vibrant-ink.css
mode change 100755 => 100644 public/vendor/codemirror/theme/xq-dark.css
mode change 100755 => 100644 public/vendor/codemirror/theme/xq-light.css
create mode 100644 public/vendor/codemirror/theme/yeti.css
mode change 100755 => 100644 public/vendor/codemirror/theme/zenburn.css
(limited to 'public/vendor')
diff --git a/public/vendor/codemirror/addon/comment/comment.js b/public/vendor/codemirror/addon/comment/comment.js
old mode 100755
new mode 100644
index 2dd114d3..3aa46808
--- a/public/vendor/codemirror/addon/comment/comment.js
+++ b/public/vendor/codemirror/addon/comment/comment.js
@@ -21,22 +21,28 @@
}
CodeMirror.commands.toggleComment = function(cm) {
- var minLine = Infinity, ranges = cm.listSelections(), mode = null;
+ cm.toggleComment();
+ };
+
+ CodeMirror.defineExtension("toggleComment", function(options) {
+ if (!options) options = noOptions;
+ var cm = this;
+ var minLine = Infinity, ranges = this.listSelections(), mode = null;
for (var i = ranges.length - 1; i >= 0; i--) {
var from = ranges[i].from(), to = ranges[i].to();
if (from.line >= minLine) continue;
if (to.line >= minLine) to = Pos(minLine, 0);
minLine = from.line;
if (mode == null) {
- if (cm.uncomment(from, to)) mode = "un";
- else { cm.lineComment(from, to); mode = "line"; }
+ if (cm.uncomment(from, to, options)) mode = "un";
+ else { cm.lineComment(from, to, options); mode = "line"; }
} else if (mode == "un") {
- cm.uncomment(from, to);
+ cm.uncomment(from, to, options);
} else {
- cm.lineComment(from, to);
+ cm.lineComment(from, to, options);
}
}
- };
+ });
CodeMirror.defineExtension("lineComment", function(from, to, options) {
if (!options) options = noOptions;
@@ -57,7 +63,14 @@
self.operation(function() {
if (options.indent) {
- var baseString = firstLine.slice(0, firstNonWS(firstLine));
+ var baseString = null;
+ for (var i = from.line; i < end; ++i) {
+ var line = self.getLine(i);
+ var whitespace = line.slice(0, firstNonWS(line));
+ if (baseString == null || baseString.length > whitespace.length) {
+ baseString = whitespace;
+ }
+ }
for (var i = from.line; i < end; ++i) {
var line = self.getLine(i), cut = baseString.length;
if (!blankLines && !nonWS.test(line)) continue;
diff --git a/public/vendor/codemirror/addon/comment/continuecomment.js b/public/vendor/codemirror/addon/comment/continuecomment.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/dialog/dialog.js b/public/vendor/codemirror/addon/dialog/dialog.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/display/autorefresh.js b/public/vendor/codemirror/addon/display/autorefresh.js
new file mode 100644
index 00000000..1e0e8504
--- /dev/null
+++ b/public/vendor/codemirror/addon/display/autorefresh.js
@@ -0,0 +1,47 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"))
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror"], mod)
+ else // Plain browser env
+ mod(CodeMirror)
+})(function(CodeMirror) {
+ "use strict"
+
+ CodeMirror.defineOption("autoRefresh", false, function(cm, val) {
+ if (cm.state.autoRefresh) {
+ stopListening(cm, cm.state.autoRefresh)
+ cm.state.autoRefresh = null
+ }
+ if (val && cm.display.wrapper.offsetHeight == 0)
+ startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250})
+ })
+
+ function startListening(cm, state) {
+ function check() {
+ if (cm.display.wrapper.offsetHeight) {
+ stopListening(cm, state)
+ if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight)
+ cm.refresh()
+ } else {
+ state.timeout = setTimeout(check, state.delay)
+ }
+ }
+ state.timeout = setTimeout(check, state.delay)
+ state.hurry = function() {
+ clearTimeout(state.timeout)
+ state.timeout = setTimeout(check, 50)
+ }
+ CodeMirror.on(window, "mouseup", state.hurry)
+ CodeMirror.on(window, "keyup", state.hurry)
+ }
+
+ function stopListening(_cm, state) {
+ clearTimeout(state.timeout)
+ CodeMirror.off(window, "mouseup", state.hurry)
+ CodeMirror.off(window, "keyup", state.hurry)
+ }
+});
diff --git a/public/vendor/codemirror/addon/display/fullscreen.css b/public/vendor/codemirror/addon/display/fullscreen.css
old mode 100755
new mode 100644
index 437acd89..e258ad66
--- a/public/vendor/codemirror/addon/display/fullscreen.css
+++ b/public/vendor/codemirror/addon/display/fullscreen.css
@@ -2,5 +2,5 @@
position: fixed;
top: 0; left: 0; right: 0; bottom: 0;
height: auto;
- z-index: 9;
+ z-index: 2000;
}
diff --git a/public/vendor/codemirror/addon/display/fullscreen.js b/public/vendor/codemirror/addon/display/fullscreen.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/display/panel.js b/public/vendor/codemirror/addon/display/panel.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/display/placeholder.js b/public/vendor/codemirror/addon/display/placeholder.js
old mode 100755
new mode 100644
index bb0c3931..babddfb1
--- a/public/vendor/codemirror/addon/display/placeholder.js
+++ b/public/vendor/codemirror/addon/display/placeholder.js
@@ -37,7 +37,9 @@
var elt = cm.state.placeholder = document.createElement("pre");
elt.style.cssText = "height: 0; overflow: visible";
elt.className = "CodeMirror-placeholder";
- elt.appendChild(document.createTextNode(cm.getOption("placeholder")));
+ var placeHolder = cm.getOption("placeholder")
+ if (typeof placeHolder == "string") placeHolder = document.createTextNode(placeHolder)
+ elt.appendChild(placeHolder)
cm.display.lineSpace.insertBefore(elt, cm.display.lineSpace.firstChild);
}
diff --git a/public/vendor/codemirror/addon/display/rulers.js b/public/vendor/codemirror/addon/display/rulers.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/edit/closebrackets.js b/public/vendor/codemirror/addon/edit/closebrackets.js
old mode 100755
new mode 100644
index 1ceda4e3..3eb9d8ea
--- a/public/vendor/codemirror/addon/edit/closebrackets.js
+++ b/public/vendor/codemirror/addon/edit/closebrackets.js
@@ -79,7 +79,7 @@
if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
}
cm.operation(function() {
- cm.replaceSelection("\n\n", null, "+input");
+ cm.replaceSelection("\n\n", null);
cm.execCommand("goCharLeft");
ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++) {
@@ -90,6 +90,12 @@
});
}
+ function contractSelection(sel) {
+ var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
+ return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
+ head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
+ }
+
function handleChar(cm, ch) {
var conf = getConfig(cm);
if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
@@ -144,13 +150,17 @@
var sels = cm.getSelections();
for (var i = 0; i < sels.length; i++)
sels[i] = left + sels[i] + right;
- cm.replaceSelections(sels, "around", "+input");
+ cm.replaceSelections(sels, "around");
+ sels = cm.listSelections().slice();
+ for (var i = 0; i < sels.length; i++)
+ sels[i] = contractSelection(sels[i]);
+ cm.setSelections(sels);
} else if (type == "both") {
- cm.replaceSelection(left + right, null, "+input");
+ cm.replaceSelection(left + right, null);
cm.triggerElectric(left + right);
cm.execCommand("goCharLeft");
} else if (type == "addFour") {
- cm.replaceSelection(left + left + left + left, "before", "+input");
+ cm.replaceSelection(left + left + left + left, "before");
cm.execCommand("goCharRight");
}
});
diff --git a/public/vendor/codemirror/addon/edit/closetag.js b/public/vendor/codemirror/addon/edit/closetag.js
old mode 100755
new mode 100644
index c2d2263e..a518da3e
--- a/public/vendor/codemirror/addon/edit/closetag.js
+++ b/public/vendor/codemirror/addon/edit/closetag.js
@@ -108,21 +108,24 @@
// when completing in JS/CSS snippet in htmlmixed mode. Does not
// work for other XML embedded languages (there is no general
// way to go from a mixed mode to its current XML state).
+ var replacement;
if (inner.mode.name != "xml") {
if (cm.getMode().name == "htmlmixed" && inner.mode.name == "javascript")
- replacements[i] = head + "script>";
+ replacement = head + "script";
else if (cm.getMode().name == "htmlmixed" && inner.mode.name == "css")
- replacements[i] = head + "style>";
+ replacement = head + "style";
else
return CodeMirror.Pass;
} else {
if (!state.context || !state.context.tagName ||
closingTagExists(cm, state.context.tagName, pos, state))
return CodeMirror.Pass;
- replacements[i] = head + state.context.tagName + ">";
+ replacement = head + state.context.tagName;
}
+ if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
+ replacements[i] = replacement;
}
- cm.replaceSelections(replacements, null, '+input');
+ cm.replaceSelections(replacements);
ranges = cm.listSelections();
for (var i = 0; i < ranges.length; i++)
if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
diff --git a/public/vendor/codemirror/addon/edit/continuelist.js b/public/vendor/codemirror/addon/edit/continuelist.js
old mode 100755
new mode 100644
index a0941d4f..df5179fe
--- a/public/vendor/codemirror/addon/edit/continuelist.js
+++ b/public/vendor/codemirror/addon/edit/continuelist.js
@@ -11,8 +11,8 @@
})(function(CodeMirror) {
"use strict";
- var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\[\s\]\s|\[x\]\s|\s*)/,
- emptyListRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)[.)])(\[\s\]\s*|\[x\]\s|\s*)$/,
+ var listRE = /^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/,
+ emptyListRE = /^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/,
unorderedListRE = /[*+-]\s/;
CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
@@ -34,7 +34,7 @@
line: pos.line, ch: 0
}, {
line: pos.line, ch: pos.ch + 1
- }, "+delete");
+ });
replacements[i] = "\n";
} else {
var indent = match[1], after = match[5];
@@ -46,6 +46,6 @@
}
}
- cm.replaceSelections(replacements, null, "+input");
+ cm.replaceSelections(replacements);
};
});
diff --git a/public/vendor/codemirror/addon/edit/matchbrackets.js b/public/vendor/codemirror/addon/edit/matchbrackets.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/edit/matchtags.js b/public/vendor/codemirror/addon/edit/matchtags.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/edit/trailingspace.js b/public/vendor/codemirror/addon/edit/trailingspace.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/fold/brace-fold.js b/public/vendor/codemirror/addon/fold/brace-fold.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/fold/comment-fold.js b/public/vendor/codemirror/addon/fold/comment-fold.js
old mode 100755
new mode 100644
index b75db7ea..60fa3e43
--- a/public/vendor/codemirror/addon/fold/comment-fold.js
+++ b/public/vendor/codemirror/addon/fold/comment-fold.js
@@ -28,7 +28,9 @@ CodeMirror.registerGlobalHelper("fold", "comment", function(mode) {
continue;
}
if (pass == 1 && found < start.ch) return;
- if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1)))) {
+ if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
+ (lineText.slice(found - endToken.length, found) == endToken ||
+ !/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
startCh = found + startToken.length;
break;
}
diff --git a/public/vendor/codemirror/addon/fold/foldcode.js b/public/vendor/codemirror/addon/fold/foldcode.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/fold/foldgutter.css b/public/vendor/codemirror/addon/fold/foldgutter.css
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/fold/foldgutter.js b/public/vendor/codemirror/addon/fold/foldgutter.js
old mode 100755
new mode 100644
index ed7bd87d..f101e267
--- a/public/vendor/codemirror/addon/fold/foldgutter.js
+++ b/public/vendor/codemirror/addon/fold/foldgutter.js
@@ -20,7 +20,7 @@
cm.off("viewportChange", onViewportChange);
cm.off("fold", onFold);
cm.off("unfold", onFold);
- cm.off("swapDoc", updateInViewport);
+ cm.off("swapDoc", onChange);
}
if (val) {
cm.state.foldGutter = new State(parseOptions(val));
@@ -30,7 +30,7 @@
cm.on("viewportChange", onViewportChange);
cm.on("fold", onFold);
cm.on("unfold", onFold);
- cm.on("swapDoc", updateInViewport);
+ cm.on("swapDoc", onChange);
}
});
diff --git a/public/vendor/codemirror/addon/fold/indent-fold.js b/public/vendor/codemirror/addon/fold/indent-fold.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/fold/markdown-fold.js b/public/vendor/codemirror/addon/fold/markdown-fold.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/fold/xml-fold.js b/public/vendor/codemirror/addon/fold/xml-fold.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/hint/anyword-hint.js b/public/vendor/codemirror/addon/hint/anyword-hint.js
old mode 100755
new mode 100644
index 8e74a920..dae78e2e
--- a/public/vendor/codemirror/addon/hint/anyword-hint.js
+++ b/public/vendor/codemirror/addon/hint/anyword-hint.js
@@ -21,7 +21,7 @@
while (start && word.test(curLine.charAt(start - 1))) --start;
var curWord = start != end && curLine.slice(start, end);
- var list = [], seen = {};
+ var list = options && options.list || [], seen = {};
var re = new RegExp(word.source, "g");
for (var dir = -1; dir <= 1; dir += 2) {
var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir;
diff --git a/public/vendor/codemirror/addon/hint/css-hint.js b/public/vendor/codemirror/addon/hint/css-hint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/hint/html-hint.js b/public/vendor/codemirror/addon/hint/html-hint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/hint/javascript-hint.js b/public/vendor/codemirror/addon/hint/javascript-hint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/hint/show-hint.css b/public/vendor/codemirror/addon/hint/show-hint.css
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/hint/show-hint.js b/public/vendor/codemirror/addon/hint/show-hint.js
old mode 100755
new mode 100644
index d228fc88..cbe3b39a
--- a/public/vendor/codemirror/addon/hint/show-hint.js
+++ b/public/vendor/codemirror/addon/hint/show-hint.js
@@ -25,8 +25,18 @@
};
CodeMirror.defineExtension("showHint", function(options) {
- // We want a single cursor position.
- if (this.listSelections().length > 1 || this.somethingSelected()) return;
+ options = parseOptions(this, this.getCursor("start"), options);
+ var selections = this.listSelections()
+ if (selections.length > 1) return;
+ // By default, don't allow completion when something is selected.
+ // A hint function can have a `supportsSelection` property to
+ // indicate that it can handle selections.
+ if (this.somethingSelected()) {
+ if (!options.hint.supportsSelection) return;
+ // Don't try with cross-line selections
+ for (var i = 0; i < selections.length; i++)
+ if (selections[i].head.line != selections[i].anchor.line) return;
+ }
if (this.state.completionActive) this.state.completionActive.close();
var completion = this.state.completionActive = new Completion(this, options);
@@ -38,12 +48,12 @@
function Completion(cm, options) {
this.cm = cm;
- this.options = this.buildOptions(options);
+ this.options = options;
this.widget = null;
this.debounce = 0;
this.tick = 0;
- this.startPos = this.cm.getCursor();
- this.startLen = this.cm.getLine(this.startPos.line).length;
+ this.startPos = this.cm.getCursor("start");
+ this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
var self = this;
cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
@@ -99,7 +109,6 @@
update: function(first) {
if (this.tick == null) return;
- if (this.data) CodeMirror.signal(this.data, "update");
if (!this.options.hint.async) {
this.finishUpdate(this.options.hint(this.cm, this.options), first);
} else {
@@ -111,6 +120,8 @@
},
finishUpdate: function(data, first) {
+ if (this.data) CodeMirror.signal(this.data, "update");
+ if (data && this.data && CodeMirror.cmpPos(data.from, this.data.from)) data = null;
this.data = data;
var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
@@ -123,20 +134,21 @@
CodeMirror.signal(data, "shown");
}
}
- },
-
- buildOptions: function(options) {
- var editor = this.cm.options.hintOptions;
- var out = {};
- for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
- if (editor) for (var prop in editor)
- if (editor[prop] !== undefined) out[prop] = editor[prop];
- if (options) for (var prop in options)
- if (options[prop] !== undefined) out[prop] = options[prop];
- return out;
}
};
+ function parseOptions(cm, pos, options) {
+ var editor = cm.options.hintOptions;
+ var out = {};
+ for (var prop in defaultOptions) out[prop] = defaultOptions[prop];
+ if (editor) for (var prop in editor)
+ if (editor[prop] !== undefined) out[prop] = editor[prop];
+ if (options) for (var prop in options)
+ if (options[prop] !== undefined) out[prop] = options[prop];
+ if (out.hint.resolve) out.hint = out.hint.resolve(cm, pos)
+ return out;
+ }
+
function getText(completion) {
if (typeof completion == "string") return completion;
else return completion.text;
@@ -335,34 +347,79 @@
}
};
- CodeMirror.registerHelper("hint", "auto", function(cm, options) {
- var helpers = cm.getHelpers(cm.getCursor(), "hint"), words;
+ function applicableHelpers(cm, helpers) {
+ if (!cm.somethingSelected()) return helpers
+ var result = []
+ for (var i = 0; i < helpers.length; i++)
+ if (helpers[i].supportsSelection) result.push(helpers[i])
+ return result
+ }
+
+ function resolveAutoHints(cm, pos) {
+ var helpers = cm.getHelpers(pos, "hint"), words
if (helpers.length) {
- for (var i = 0; i < helpers.length; i++) {
- var cur = helpers[i](cm, options);
- if (cur && cur.list.length) return cur;
+ var async = false, resolved
+ for (var i = 0; i < helpers.length; i++) if (helpers[i].async) async = true
+ if (async) {
+ resolved = function(cm, callback, options) {
+ var app = applicableHelpers(cm, helpers)
+ function run(i, result) {
+ if (i == app.length) return callback(null)
+ var helper = app[i]
+ if (helper.async) {
+ helper(cm, function(result) {
+ if (result) callback(result)
+ else run(i + 1)
+ }, options)
+ } else {
+ var result = helper(cm, options)
+ if (result) callback(result)
+ else run(i + 1)
+ }
+ }
+ run(0)
+ }
+ resolved.async = true
+ } else {
+ resolved = function(cm, options) {
+ var app = applicableHelpers(cm, helpers)
+ for (var i = 0; i < app.length; i++) {
+ var cur = app[i](cm, options)
+ if (cur && cur.list.length) return cur
+ }
+ }
}
+ resolved.supportsSelection = true
+ return resolved
} else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
- if (words) return CodeMirror.hint.fromList(cm, {words: words});
+ return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
} else if (CodeMirror.hint.anyword) {
- return CodeMirror.hint.anyword(cm, options);
+ return function(cm, options) { return CodeMirror.hint.anyword(cm, options) }
+ } else {
+ return function() {}
}
+ }
+
+ CodeMirror.registerHelper("hint", "auto", {
+ resolve: resolveAutoHints
});
CodeMirror.registerHelper("hint", "fromList", function(cm, options) {
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
+ var to = CodeMirror.Pos(cur.line, token.end);
+ if (token.string && /\w/.test(token.string[token.string.length - 1])) {
+ var term = token.string, from = CodeMirror.Pos(cur.line, token.start);
+ } else {
+ var term = "", from = to;
+ }
var found = [];
for (var i = 0; i < options.words.length; i++) {
var word = options.words[i];
- if (word.slice(0, token.string.length) == token.string)
+ if (word.slice(0, term.length) == term)
found.push(word);
}
- if (found.length) return {
- list: found,
- from: CodeMirror.Pos(cur.line, token.start),
- to: CodeMirror.Pos(cur.line, token.end)
- };
+ if (found.length) return {list: found, from: from, to: to};
});
CodeMirror.commands.autocomplete = CodeMirror.showHint;
@@ -373,7 +430,7 @@
alignWithWord: true,
closeCharacters: /[\s()\[\]{};:>,]/,
closeOnUnfocus: true,
- completeOnSingleClick: false,
+ completeOnSingleClick: true,
container: null,
customKeys: null,
extraKeys: null
diff --git a/public/vendor/codemirror/addon/hint/sql-hint.js b/public/vendor/codemirror/addon/hint/sql-hint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/hint/xml-hint.js b/public/vendor/codemirror/addon/hint/xml-hint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/lint/coffeescript-lint.js b/public/vendor/codemirror/addon/lint/coffeescript-lint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/lint/css-lint.js b/public/vendor/codemirror/addon/lint/css-lint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/lint/html-lint.js b/public/vendor/codemirror/addon/lint/html-lint.js
new file mode 100644
index 00000000..1e841709
--- /dev/null
+++ b/public/vendor/codemirror/addon/lint/html-lint.js
@@ -0,0 +1,46 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
+
+// declare global: HTMLHint
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"), require("htmlhint"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "htmlhint"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ var defaultRules = {
+ "tagname-lowercase": true,
+ "attr-lowercase": true,
+ "attr-value-double-quotes": true,
+ "doctype-first": false,
+ "tag-pair": true,
+ "spec-char-escape": true,
+ "id-unique": true,
+ "src-not-empty": true,
+ "attr-no-duplication": true
+ };
+
+ CodeMirror.registerHelper("lint", "html", function(text, options) {
+ var found = [];
+ if (!window.HTMLHint) return found;
+ var messages = HTMLHint.verify(text, options && options.rules || defaultRules);
+ for (var i = 0; i < messages.length; i++) {
+ var message = messages[i];
+ var startLine = message.line - 1, endLine = message.line - 1, startCol = message.col - 1, endCol = message.col;
+ found.push({
+ from: CodeMirror.Pos(startLine, startCol),
+ to: CodeMirror.Pos(endLine, endCol),
+ message: message.message,
+ severity : message.type
+ });
+ }
+ return found;
+ });
+});
diff --git a/public/vendor/codemirror/addon/lint/javascript-lint.js b/public/vendor/codemirror/addon/lint/javascript-lint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/lint/json-lint.js b/public/vendor/codemirror/addon/lint/json-lint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/lint/lint.css b/public/vendor/codemirror/addon/lint/lint.css
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/lint/lint.js b/public/vendor/codemirror/addon/lint/lint.js
old mode 100755
new mode 100644
index 3eea203c..5afe49d0
--- a/public/vendor/codemirror/addon/lint/lint.js
+++ b/public/vendor/codemirror/addon/lint/lint.js
@@ -61,6 +61,7 @@
this.timeout = null;
this.hasGutter = hasGutter;
this.onMouseOver = function(e) { onMouseOver(cm, e); };
+ this.waitingFor = 0
}
function parseOptions(_cm, options) {
@@ -115,15 +116,32 @@
return tip;
}
+ function lintAsync(cm, getAnnotations, passOptions) {
+ var state = cm.state.lint
+ var id = ++state.waitingFor
+ function abort() {
+ id = -1
+ cm.off("change", abort)
+ }
+ cm.on("change", abort)
+ getAnnotations(cm.getValue(), function(annotations, arg2) {
+ cm.off("change", abort)
+ if (state.waitingFor != id) return
+ if (arg2 && annotations instanceof CodeMirror) annotations = arg2
+ updateLinting(cm, annotations)
+ }, passOptions, cm);
+ }
+
function startLinting(cm) {
var state = cm.state.lint, options = state.options;
var passOptions = options.options || options; // Support deprecated passing of `options` property in options
var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
if (!getAnnotations) return;
- if (options.async || getAnnotations.async)
- getAnnotations(cm.getValue(), updateLinting, passOptions, cm);
- else
+ if (options.async || getAnnotations.async) {
+ lintAsync(cm, getAnnotations, passOptions)
+ } else {
updateLinting(cm, getAnnotations(cm.getValue(), passOptions, cm));
+ }
}
function updateLinting(cm, annotationsNotSorted) {
@@ -187,7 +205,8 @@
CodeMirror.defineOption("lint", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
clearMarks(cm);
- cm.off("change", onChange);
+ if (cm.state.lint.options.lintOnChange !== false)
+ cm.off("change", onChange);
CodeMirror.off(cm.getWrapperElement(), "mouseover", cm.state.lint.onMouseOver);
clearTimeout(cm.state.lint.timeout);
delete cm.state.lint;
@@ -197,11 +216,16 @@
var gutters = cm.getOption("gutters"), hasLintGutter = false;
for (var i = 0; i < gutters.length; ++i) if (gutters[i] == GUTTER_ID) hasLintGutter = true;
var state = cm.state.lint = new LintState(cm, parseOptions(cm, val), hasLintGutter);
- cm.on("change", onChange);
+ if (state.options.lintOnChange !== false)
+ cm.on("change", onChange);
if (state.options.tooltips != false)
CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
startLinting(cm);
}
});
+
+ CodeMirror.defineExtension("performLint", function() {
+ if (this.state.lint) startLinting(this);
+ });
});
diff --git a/public/vendor/codemirror/addon/lint/yaml-lint.js b/public/vendor/codemirror/addon/lint/yaml-lint.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/merge/merge.css b/public/vendor/codemirror/addon/merge/merge.css
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/merge/merge.js b/public/vendor/codemirror/addon/merge/merge.js
old mode 100755
new mode 100644
index 5b04b032..830a5f02
--- a/public/vendor/codemirror/addon/merge/merge.js
+++ b/public/vendor/codemirror/addon/merge/merge.js
@@ -5,12 +5,12 @@
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"), require("diff_match_patch"));
+ mod(require("../../lib/codemirror")); // Note non-packaged dependency diff_match_patch
else if (typeof define == "function" && define.amd) // AMD
define(["../../lib/codemirror", "diff_match_patch"], mod);
else // Plain browser env
- mod(CodeMirror, diff_match_patch);
-})(function(CodeMirror, diff_match_patch) {
+ mod(CodeMirror);
+})(function(CodeMirror) {
"use strict";
var Pos = CodeMirror.Pos;
var svgNS = "http://www.w3.org/2000/svg";
@@ -471,13 +471,10 @@
if (left) left.init(leftPane, origLeft, options);
if (right) right.init(rightPane, origRight, options);
- if (options.collapseIdentical) {
- updating = true;
+ if (options.collapseIdentical)
this.editor().operation(function() {
collapseIdenticalStretches(self, options.collapseIdentical);
});
- updating = false;
- }
if (options.connect == "align") {
this.aligners = [];
alignChunks(this.left || this.right, true);
@@ -640,7 +637,7 @@
mark.clear();
cm.removeLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
}
- widget.addEventListener("click", clear);
+ CodeMirror.on(widget, "click", clear);
return {mark: mark, clear: clear};
}
diff --git a/public/vendor/codemirror/addon/mode/loadmode.js b/public/vendor/codemirror/addon/mode/loadmode.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/mode/multiplex.js b/public/vendor/codemirror/addon/mode/multiplex.js
old mode 100755
new mode 100644
index fe48c7fb..3d8b34c4
--- a/public/vendor/codemirror/addon/mode/multiplex.js
+++ b/public/vendor/codemirror/addon/mode/multiplex.js
@@ -51,7 +51,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
if (!other.parseDelimiters) stream.match(other.open);
state.innerActive = other;
state.inner = CodeMirror.startState(other.mode, outer.indent ? outer.indent(state.outer, "") : 0);
- return other.delimStyle;
+ return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
} else if (found != -1 && found < cutOff) {
cutOff = found;
}
@@ -70,7 +70,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
if (found == stream.pos && !curInner.parseDelimiters) {
stream.match(curInner.close);
state.innerActive = state.inner = null;
- return curInner.delimStyle;
+ return curInner.delimStyle && (curInner.delimStyle + " " + curInner.delimStyle + "-close");
}
if (found > -1) stream.string = oldContent.slice(0, found);
var innerToken = curInner.mode.token(stream, state.inner);
@@ -80,7 +80,7 @@ CodeMirror.multiplexingMode = function(outer /*, others */) {
state.innerActive = state.inner = null;
if (curInner.innerStyle) {
- if (innerToken) innerToken = innerToken + ' ' + curInner.innerStyle;
+ if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;
else innerToken = curInner.innerStyle;
}
diff --git a/public/vendor/codemirror/addon/mode/multiplex_test.js b/public/vendor/codemirror/addon/mode/multiplex_test.js
old mode 100755
new mode 100644
index d3394342..24e5e670
--- a/public/vendor/codemirror/addon/mode/multiplex_test.js
+++ b/public/vendor/codemirror/addon/mode/multiplex_test.js
@@ -29,5 +29,5 @@
MT(
"stexInsideMarkdown",
- "[strong **Equation:**] [delim $][inner&tag \\pi][delim $]");
+ "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]");
})();
diff --git a/public/vendor/codemirror/addon/mode/overlay.js b/public/vendor/codemirror/addon/mode/overlay.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/mode/simple.js b/public/vendor/codemirror/addon/mode/simple.js
old mode 100755
new mode 100644
index 795328b8..df663365
--- a/public/vendor/codemirror/addon/mode/simple.js
+++ b/public/vendor/codemirror/addon/mode/simple.js
@@ -60,7 +60,7 @@
function ensureState(states, name) {
if (!states.hasOwnProperty(name))
- throw new Error("Undefined state " + name + "in simple mode");
+ throw new Error("Undefined state " + name + " in simple mode");
}
function toRegex(val, caret) {
diff --git a/public/vendor/codemirror/addon/runmode/colorize.js b/public/vendor/codemirror/addon/runmode/colorize.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/runmode/runmode-standalone.js b/public/vendor/codemirror/addon/runmode/runmode-standalone.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/runmode/runmode.js b/public/vendor/codemirror/addon/runmode/runmode.js
old mode 100755
new mode 100644
index 07d2279f..a51c6d0d
--- a/public/vendor/codemirror/addon/runmode/runmode.js
+++ b/public/vendor/codemirror/addon/runmode/runmode.js
@@ -16,7 +16,7 @@ CodeMirror.runMode = function(string, modespec, callback, options) {
var ie = /MSIE \d/.test(navigator.userAgent);
var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
- if (callback.nodeType == 1) {
+ if (callback.appendChild) {
var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
var node = callback, col = 0;
node.innerHTML = "";
diff --git a/public/vendor/codemirror/addon/runmode/runmode.node.js b/public/vendor/codemirror/addon/runmode/runmode.node.js
old mode 100755
new mode 100644
index 8f345a32..b22a5187
--- a/public/vendor/codemirror/addon/runmode/runmode.node.js
+++ b/public/vendor/codemirror/addon/runmode/runmode.node.js
@@ -176,3 +176,4 @@ exports.runMode = function(string, modespec, callback, options) {
};
require.cache[require.resolve("../../lib/codemirror")] = require.cache[require.resolve("./runmode.node")];
+require.cache[require.resolve("../../addon/runmode/runmode")] = require.cache[require.resolve("./runmode.node")];
diff --git a/public/vendor/codemirror/addon/scroll/annotatescrollbar.js b/public/vendor/codemirror/addon/scroll/annotatescrollbar.js
old mode 100755
new mode 100644
index bbbfa59c..3f80f483
--- a/public/vendor/codemirror/addon/scroll/annotatescrollbar.js
+++ b/public/vendor/codemirror/addon/scroll/annotatescrollbar.js
@@ -51,7 +51,7 @@
Annotation.prototype.computeScale = function() {
var cm = this.cm;
var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /
- cm.heightAtLine(cm.lastLine() + 1, "local");
+ cm.getScrollerElement().scrollHeight
if (hScale != this.hScale) {
this.hScale = hScale;
return true;
@@ -100,6 +100,9 @@
elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth * 1.5, 2) + "px; top: "
+ (top + this.buttonHeight) + "px; height: " + height + "px";
elt.className = this.options.className;
+ if (ann.id) {
+ elt.setAttribute("annotation-id", ann.id);
+ }
}
this.div.textContent = "";
this.div.appendChild(frag);
diff --git a/public/vendor/codemirror/addon/scroll/scrollpastend.js b/public/vendor/codemirror/addon/scroll/scrollpastend.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/scroll/simplescrollbars.js b/public/vendor/codemirror/addon/scroll/simplescrollbars.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/search/jump-to-line.js b/public/vendor/codemirror/addon/search/jump-to-line.js
new file mode 100644
index 00000000..8b599cbc
--- /dev/null
+++ b/public/vendor/codemirror/addon/search/jump-to-line.js
@@ -0,0 +1,49 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/LICENSE
+
+// Defines jumpToLine command. Uses dialog.js if present.
+
+(function(mod) {
+ if (typeof exports == "object" && typeof module == "object") // CommonJS
+ mod(require("../../lib/codemirror"), require("../dialog/dialog"));
+ else if (typeof define == "function" && define.amd) // AMD
+ define(["../../lib/codemirror", "../dialog/dialog"], mod);
+ else // Plain browser env
+ mod(CodeMirror);
+})(function(CodeMirror) {
+ "use strict";
+
+ function dialog(cm, text, shortText, deflt, f) {
+ if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
+ else f(prompt(shortText, deflt));
+ }
+
+ var jumpDialog =
+ 'Jump to line: (Use line:column or scroll% syntax)';
+
+ function interpretLine(cm, string) {
+ var num = Number(string)
+ if (/^[-+]/.test(string)) return cm.getCursor().line + num
+ else return num - 1
+ }
+
+ CodeMirror.commands.jumpToLine = function(cm) {
+ var cur = cm.getCursor();
+ dialog(cm, jumpDialog, "Jump to line:", (cur.line + 1) + ":" + cur.ch, function(posStr) {
+ if (!posStr) return;
+
+ var match;
+ if (match = /^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(posStr)) {
+ cm.setCursor(interpretLine(cm, match[1]), Number(match[2]))
+ } else if (match = /^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(posStr)) {
+ var line = Math.round(cm.lineCount() * Number(match[1]) / 100);
+ if (/^[-+]/.test(match[1])) line = cur.line + line + 1;
+ cm.setCursor(line - 1, cur.ch);
+ } else if (match = /^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr)) {
+ cm.setCursor(interpretLine(cm, match[1]), cur.ch);
+ }
+ });
+ };
+
+ CodeMirror.keyMap["default"]["Alt-G"] = "jumpToLine";
+});
diff --git a/public/vendor/codemirror/addon/search/match-highlighter.js b/public/vendor/codemirror/addon/search/match-highlighter.js
old mode 100755
new mode 100644
index e9a22721..8f02f01c
--- a/public/vendor/codemirror/addon/search/match-highlighter.js
+++ b/public/vendor/codemirror/addon/search/match-highlighter.js
@@ -16,13 +16,14 @@
// highlighted only if the selected text is a word. showToken, when enabled,
// will cause the current token to be highlighted when nothing is selected.
// delay is used to specify how much time to wait, in milliseconds, before
-// highlighting the matches.
+// highlighting the matches. If annotateScrollbar is enabled, the occurances
+// will be highlighted on the scrollbar via the matchesonscrollbar addon.
(function(mod) {
if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
+ mod(require("../../lib/codemirror"), require("./matchesonscrollbar"));
else if (typeof define == "function" && define.amd) // AMD
- define(["../../lib/codemirror"], mod);
+ define(["../../lib/codemirror", "./matchesonscrollbar"], mod);
else // Plain browser env
mod(CodeMirror);
})(function(CodeMirror) {
@@ -40,18 +41,19 @@
this.showToken = options.showToken;
this.delay = options.delay;
this.wordsOnly = options.wordsOnly;
+ this.annotateScrollbar = options.annotateScrollbar;
}
if (this.style == null) this.style = DEFAULT_TOKEN_STYLE;
if (this.minChars == null) this.minChars = DEFAULT_MIN_CHARS;
if (this.delay == null) this.delay = DEFAULT_DELAY;
if (this.wordsOnly == null) this.wordsOnly = DEFAULT_WORDS_ONLY;
this.overlay = this.timeout = null;
+ this.matchesonscroll = null;
}
CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {
if (old && old != CodeMirror.Init) {
- var over = cm.state.matchHighlighter.overlay;
- if (over) cm.removeOverlay(over);
+ removeOverlay(cm);
clearTimeout(cm.state.matchHighlighter.timeout);
cm.state.matchHighlighter = null;
cm.off("cursorActivity", cursorActivity);
@@ -69,20 +71,39 @@
state.timeout = setTimeout(function() {highlightMatches(cm);}, state.delay);
}
+ function addOverlay(cm, query, hasBoundary, style) {
+ var state = cm.state.matchHighlighter;
+ cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style));
+ if (state.annotateScrollbar) {
+ var searchFor = hasBoundary ? new RegExp("\\b" + query + "\\b") : query;
+ state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, true,
+ {className: "CodeMirror-selection-highlight-scrollbar"});
+ }
+ }
+
+ function removeOverlay(cm) {
+ var state = cm.state.matchHighlighter;
+ if (state.overlay) {
+ cm.removeOverlay(state.overlay);
+ state.overlay = null;
+ if (state.annotateScrollbar) {
+ state.matchesonscroll.clear();
+ state.matchesonscroll = null;
+ }
+ }
+ }
+
function highlightMatches(cm) {
cm.operation(function() {
var state = cm.state.matchHighlighter;
- if (state.overlay) {
- cm.removeOverlay(state.overlay);
- state.overlay = null;
- }
+ removeOverlay(cm);
if (!cm.somethingSelected() && state.showToken) {
var re = state.showToken === true ? /[\w$]/ : state.showToken;
var cur = cm.getCursor(), line = cm.getLine(cur.line), start = cur.ch, end = start;
while (start && re.test(line.charAt(start - 1))) --start;
while (end < line.length && re.test(line.charAt(end))) ++end;
if (start < end)
- cm.addOverlay(state.overlay = makeOverlay(line.slice(start, end), re, state.style));
+ addOverlay(cm, line.slice(start, end), re, state.style);
return;
}
var from = cm.getCursor("from"), to = cm.getCursor("to");
@@ -90,7 +111,7 @@
if (state.wordsOnly && !isWord(cm, from, to)) return;
var selection = cm.getRange(from, to).replace(/^\s+|\s+$/g, "");
if (selection.length >= state.minChars)
- cm.addOverlay(state.overlay = makeOverlay(selection, false, state.style));
+ addOverlay(cm, selection, false, state.style);
});
}
diff --git a/public/vendor/codemirror/addon/search/matchesonscrollbar.js b/public/vendor/codemirror/addon/search/matchesonscrollbar.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/search/search.js b/public/vendor/codemirror/addon/search/search.js
old mode 100755
new mode 100644
index afa85ebe..93e90b36
--- a/public/vendor/codemirror/addon/search/search.js
+++ b/public/vendor/codemirror/addon/search/search.js
@@ -18,6 +18,7 @@
mod(CodeMirror);
})(function(CodeMirror) {
"use strict";
+
function searchOverlay(query, caseInsensitive) {
if (typeof query == "string")
query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
@@ -28,7 +29,7 @@
query.lastIndex = stream.pos;
var match = query.exec(stream.string);
if (match && match.index == stream.pos) {
- stream.pos += match[0].length;
+ stream.pos += match[0].length || 1;
return "searching";
} else if (match) {
stream.pos = match.index;
@@ -42,57 +43,106 @@
this.posFrom = this.posTo = this.lastQuery = this.query = null;
this.overlay = null;
}
+
function getSearchState(cm) {
return cm.state.search || (cm.state.search = new SearchState());
}
+
function queryCaseInsensitive(query) {
return typeof query == "string" && query == query.toLowerCase();
}
+
function getSearchCursor(cm, query, pos) {
// Heuristic: if the query string is all lowercase, do a case insensitive search.
return cm.getSearchCursor(query, pos, queryCaseInsensitive(query));
}
+
+ function persistentDialog(cm, text, deflt, f) {
+ cm.openDialog(text, f, {
+ value: deflt,
+ selectValueOnOpen: true,
+ closeOnEnter: false,
+ onClose: function() { clearSearch(cm); }
+ });
+ }
+
function dialog(cm, text, shortText, deflt, f) {
if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true});
else f(prompt(shortText, deflt));
}
+
function confirmDialog(cm, text, shortText, fs) {
if (cm.openConfirm) cm.openConfirm(text, fs);
else if (confirm(shortText)) fs[0]();
}
+
+ function parseString(string) {
+ return string.replace(/\\(.)/g, function(_, ch) {
+ if (ch == "n") return "\n"
+ if (ch == "r") return "\r"
+ return ch
+ })
+ }
+
function parseQuery(query) {
var isRE = query.match(/^\/(.*)\/([a-z]*)$/);
if (isRE) {
try { query = new RegExp(isRE[1], isRE[2].indexOf("i") == -1 ? "" : "i"); }
catch(e) {} // Not a regular expression after all, do a string search
+ } else {
+ query = parseString(query)
}
if (typeof query == "string" ? query == "" : query.test(""))
query = /x^/;
return query;
}
+
var queryDialog =
'Search: (Use /re/ syntax for regexp search)';
- function doSearch(cm, rev) {
+
+ function startSearch(cm, state, query) {
+ state.queryText = query;
+ state.query = parseQuery(query);
+ cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
+ state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
+ cm.addOverlay(state.overlay);
+ if (cm.showMatchesOnScrollbar) {
+ if (state.annotate) { state.annotate.clear(); state.annotate = null; }
+ state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
+ }
+ }
+
+ function doSearch(cm, rev, persistent) {
var state = getSearchState(cm);
if (state.query) return findNext(cm, rev);
var q = cm.getSelection() || state.lastQuery;
- dialog(cm, queryDialog, "Search for:", q, function(query) {
- cm.operation(function() {
- if (!query || state.query) return;
- state.query = parseQuery(query);
- cm.removeOverlay(state.overlay, queryCaseInsensitive(state.query));
- state.overlay = searchOverlay(state.query, queryCaseInsensitive(state.query));
- cm.addOverlay(state.overlay);
- if (cm.showMatchesOnScrollbar) {
- if (state.annotate) { state.annotate.clear(); state.annotate = null; }
- state.annotate = cm.showMatchesOnScrollbar(state.query, queryCaseInsensitive(state.query));
- }
- state.posFrom = state.posTo = cm.getCursor();
- findNext(cm, rev);
+ if (persistent && cm.openDialog) {
+ var hiding = null
+ persistentDialog(cm, queryDialog, q, function(query, event) {
+ CodeMirror.e_stop(event);
+ if (!query) return;
+ if (query != state.queryText) startSearch(cm, state, query);
+ if (hiding) hiding.style.opacity = 1
+ findNext(cm, event.shiftKey, function(_, to) {
+ var dialog
+ if (to.line < 3 && document.querySelector &&
+ (dialog = cm.display.wrapper.querySelector(".CodeMirror-dialog")) &&
+ dialog.getBoundingClientRect().bottom - 4 > cm.cursorCoords(to, "window").top)
+ (hiding = dialog).style.opacity = .4
+ })
});
- });
+ } else {
+ dialog(cm, queryDialog, "Search for:", q, function(query) {
+ if (query && !state.query) cm.operation(function() {
+ startSearch(cm, state, query);
+ state.posFrom = state.posTo = cm.getCursor();
+ findNext(cm, rev);
+ });
+ });
+ }
}
- function findNext(cm, rev) {cm.operation(function() {
+
+ function findNext(cm, rev, callback) {cm.operation(function() {
var state = getSearchState(cm);
var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
if (!cursor.find(rev)) {
@@ -100,38 +150,47 @@
if (!cursor.find(rev)) return;
}
cm.setSelection(cursor.from(), cursor.to());
- cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
+ cm.scrollIntoView({from: cursor.from(), to: cursor.to()}, 20);
state.posFrom = cursor.from(); state.posTo = cursor.to();
+ if (callback) callback(cursor.from(), cursor.to())
});}
+
function clearSearch(cm) {cm.operation(function() {
var state = getSearchState(cm);
state.lastQuery = state.query;
if (!state.query) return;
- state.query = null;
+ state.query = state.queryText = null;
cm.removeOverlay(state.overlay);
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
});}
var replaceQueryDialog =
- 'Replace: (Use /re/ syntax for regexp search)';
+ ' (Use /re/ syntax for regexp search)';
var replacementQueryDialog = 'With: ';
- var doReplaceConfirm = "Replace? ";
+ var doReplaceConfirm = "Replace? ";
+
+ function replaceAll(cm, query, text) {
+ cm.operation(function() {
+ for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
+ if (typeof query != "string") {
+ var match = cm.getRange(cursor.from(), cursor.to()).match(query);
+ cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
+ } else cursor.replace(text);
+ }
+ });
+ }
+
function replace(cm, all) {
if (cm.getOption("readOnly")) return;
var query = cm.getSelection() || getSearchState(cm).lastQuery;
- dialog(cm, replaceQueryDialog, "Replace:", query, function(query) {
+ var dialogText = all ? "Replace all:" : "Replace:"
+ dialog(cm, dialogText + replaceQueryDialog, dialogText, query, function(query) {
if (!query) return;
query = parseQuery(query);
dialog(cm, replacementQueryDialog, "Replace with:", "", function(text) {
+ text = parseString(text)
if (all) {
- cm.operation(function() {
- for (var cursor = getSearchCursor(cm, query); cursor.findNext();) {
- if (typeof query != "string") {
- var match = cm.getRange(cursor.from(), cursor.to()).match(query);
- cursor.replace(text.replace(/\$(\d)/g, function(_, i) {return match[i];}), "+input");
- } else cursor.replace(text, "+input");
- }
- });
+ replaceAll(cm, query, text)
} else {
clearSearch(cm);
var cursor = getSearchCursor(cm, query, cm.getCursor());
@@ -145,11 +204,12 @@
cm.setSelection(cursor.from(), cursor.to());
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
confirmDialog(cm, doReplaceConfirm, "Replace?",
- [function() {doReplace(match);}, advance]);
+ [function() {doReplace(match);}, advance,
+ function() {replaceAll(cm, query, text)}]);
};
var doReplace = function(match) {
cursor.replace(typeof query == "string" ? text :
- text.replace(/\$(\d)/g, function(_, i) {return match[i];}), "+input");
+ text.replace(/\$(\d)/g, function(_, i) {return match[i];}));
advance();
};
advance();
@@ -159,6 +219,7 @@
}
CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
+ CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};
CodeMirror.commands.findNext = doSearch;
CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
CodeMirror.commands.clearSearch = clearSearch;
diff --git a/public/vendor/codemirror/addon/search/searchcursor.js b/public/vendor/codemirror/addon/search/searchcursor.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/selection/active-line.js b/public/vendor/codemirror/addon/selection/active-line.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/selection/mark-selection.js b/public/vendor/codemirror/addon/selection/mark-selection.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/selection/selection-pointer.js b/public/vendor/codemirror/addon/selection/selection-pointer.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/tern/tern.css b/public/vendor/codemirror/addon/tern/tern.css
old mode 100755
new mode 100644
index 76fba33d..c4b8a2f7
--- a/public/vendor/codemirror/addon/tern/tern.css
+++ b/public/vendor/codemirror/addon/tern/tern.css
@@ -1,6 +1,7 @@
.CodeMirror-Tern-completion {
padding-left: 22px;
position: relative;
+ line-height: 1.5;
}
.CodeMirror-Tern-completion:before {
position: absolute;
diff --git a/public/vendor/codemirror/addon/tern/tern.js b/public/vendor/codemirror/addon/tern/tern.js
old mode 100755
new mode 100644
index dfb19b84..c345c497
--- a/public/vendor/codemirror/addon/tern/tern.js
+++ b/public/vendor/codemirror/addon/tern/tern.js
@@ -135,6 +135,7 @@
},
destroy: function () {
+ closeArgHints(this)
if (this.worker) {
this.worker.terminate();
this.worker = null;
@@ -216,7 +217,7 @@
var completion = data.completions[i], className = typeToIcon(completion.type);
if (data.guess) className += " " + cls + "guess";
completions.push({text: completion.name + after,
- displayText: completion.name,
+ displayText: completion.displayName || completion.name,
className: className,
data: completion});
}
@@ -266,7 +267,7 @@
child.target = "_blank";
}
}
- tempTooltip(cm, tip);
+ tempTooltip(cm, tip, ts);
if (c) c();
}, pos);
}
@@ -466,11 +467,12 @@
ts.request(cm, {type: "refs"}, function(error, data) {
if (error) return showError(ts, cm, error);
var ranges = [], cur = 0;
+ var curPos = cm.getCursor();
for (var i = 0; i < data.refs.length; i++) {
var ref = data.refs[i];
if (ref.file == name) {
ranges.push({anchor: ref.start, head: ref.end});
- if (cmpPos(cur, ref.start) >= 0 && cmpPos(cur, ref.end) <= 0)
+ if (cmpPos(curPos, ref.start) >= 0 && cmpPos(curPos, ref.end) <= 0)
cur = ranges.length - 1;
}
}
@@ -592,7 +594,7 @@
// Tooltips
- function tempTooltip(cm, content) {
+ function tempTooltip(cm, content, ts) {
if (cm.state.ternTooltip) remove(cm.state.ternTooltip);
var where = cm.cursorCoords();
var tip = cm.state.ternTooltip = makeTooltip(where.right + 1, where.bottom, content);
@@ -616,7 +618,7 @@
else mouseOnTip = false;
}
});
- setTimeout(maybeClear, 1700);
+ setTimeout(maybeClear, ts.options.hintDelay ? ts.options.hintDelay : 1700);
cm.on("cursorActivity", clear);
cm.on('blur', clear);
cm.on('scroll', clear);
@@ -644,7 +646,7 @@
if (ts.options.showError)
ts.options.showError(cm, msg);
else
- tempTooltip(cm, String(msg));
+ tempTooltip(cm, String(msg), ts);
}
function closeArgHints(ts) {
diff --git a/public/vendor/codemirror/addon/tern/worker.js b/public/vendor/codemirror/addon/tern/worker.js
old mode 100755
new mode 100644
diff --git a/public/vendor/codemirror/addon/wrap/hardwrap.js b/public/vendor/codemirror/addon/wrap/hardwrap.js
old mode 100755
new mode 100644
index fe9b4dd6..8806fbe2
--- a/public/vendor/codemirror/addon/wrap/hardwrap.js
+++ b/public/vendor/codemirror/addon/wrap/hardwrap.js
@@ -32,11 +32,13 @@
function findBreakPoint(text, column, wrapOn, killTrailingSpace) {
for (var at = column; at > 0; --at)
if (wrapOn.test(text.slice(at - 1, at + 1))) break;
- if (at == 0) at = column;
- var endOfText = at;
- if (killTrailingSpace)
- while (text.charAt(endOfText - 1) == " ") --endOfText;
- return {from: endOfText, to: at};
+ for (var first = true;; first = false) {
+ var endOfText = at;
+ if (killTrailingSpace)
+ while (text.charAt(endOfText - 1) == " ") --endOfText;
+ if (endOfText == 0 && first) at = column;
+ else return {from: endOfText, to: at};
+ }
}
function wrapRange(cm, from, to, options) {
@@ -86,7 +88,8 @@
if (changes.length) cm.operation(function() {
for (var i = 0; i < changes.length; ++i) {
var change = changes[i];
- cm.replaceRange(change.text, change.from, change.to);
+ if (change.text || CodeMirror.cmpPos(change.from, change.to))
+ cm.replaceRange(change.text, change.from, change.to);
}
});
return changes.length ? {from: changes[0].from, to: CodeMirror.changeEnd(changes[changes.length - 1])} : null;
diff --git a/public/vendor/codemirror/codemirror.min.js b/public/vendor/codemirror/codemirror.min.js
index 41c476ac..f2200a12 100644
--- a/public/vendor/codemirror/codemirror.min.js
+++ b/public/vendor/codemirror/codemirror.min.js
@@ -1,19 +1,16 @@
-!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);this.CodeMirror=e()}}(function(){"use strict";function e(n,r){if(!(this instanceof e))return new e(n,r);this.options=r=r?Ii(r):{},Ii(Xo,r,!1),p(r);var i=r.value;"string"==typeof i&&(i=new ba(i,r.mode)),this.doc=i;var o=new e.inputStyles[r.inputStyle](this),a=this.display=new t(n,i,o);a.wrapper.CodeMirror=this,c(this),l(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!So&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,draggingText:!1,highlight:new Li,keySeq:null,specialChars:null};var s=this;mo&&11>go&&setTimeout(function(){s.display.input.reset(!0)},20),Ht(this),Gi(),xt(this),this.curOp.forceUpdate=!0,Kr(this,i),r.autofocus&&!So||s.hasFocus()?setTimeout(Pi(mn,this),20):gn(this);for(var u in Zo)Zo.hasOwnProperty(u)&&Zo[u](this,r[u],Yo);k(this),r.finishInit&&r.finishInit(this);for(var f=0;fgo&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),vo||fo&&So||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,Re(e,100),e.state.modeGen++,e.curOp&&It(e)}function i(e){e.options.lineWrapping?(Ua(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ba(e.display.wrapper,"CodeMirror-wrap"),d(e)),a(e),It(e),lt(e),setTimeout(function(){y(e)},100)}function o(e){var t=yt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/bt(e.display)-3);return function(i){if(xr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function p(e){var t=Ei(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Be(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ve(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=Wi("div",[Wi("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=Wi("div",[Wi("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),Sa(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),Sa(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedOverlay=!1,mo&&8>go&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ba(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),Sa(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?nn(t,e):tn(t,e)},t),t.display.scrollbars.addClass&&Ua(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&E(e),b(e,h(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function x(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-$e(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ei(t,r),a=ei(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;o>l?(o=l,a=ei(t,ti(Xr(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ei(t,ti(Xr(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function _(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Ft(e))return!1;k(e)&&(Dt(e),t.dims=q(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Oo&&(o=yr(e.doc,o),a=br(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Wt(e,o,a),n.viewOffset=ti(Xr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Ft(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=$i();return s>4&&(n.lineDiv.style.display="none"),N(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&$i()!=c&&c.offsetHeight&&c.focus(),Fi(n.cursorDiv),Fi(n.selectionDiv),n.gutters.style.height=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,Re(e,400)),n.updateLineNumbers=null,!0}function T(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Ge(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Be(e.display)-Ke(e),n.top)}),t.visible=x(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&L(e,t);r=!1){E(e);var i=h(e);Ne(e),z(e,i),y(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var n=new S(e,t);if(L(e,n)){E(e),T(e,n);var r=h(e);Ne(e),z(e,r),y(e,r),n.finish()}}function z(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Ve(e),t.clientHeight)+"px"}function E(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;rgo){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=yt(t)),(s>.001||-.001>s)&&(Qr(o.line,i),O(o.line),o.rest))for(var c=0;c=t&&f.lineNumber;f.changes&&(Ei(f.changes,"gutter")>-1&&(d=!1),I(e,f,c,n)),d&&(Fi(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(w(e.options,c)))),l=f.node.nextSibling}else{var p=B(e,f,c,n);a.insertBefore(p,l)}c+=f.size}for(;l;)l=r(l)}function I(e,t,n,r){for(var i=0;igo&&(e.node.style.zIndex=2)),e.node}function D(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=P(e);e.background=n.insertBefore(Wi("div",null,t),n.firstChild)}}function j(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Pr(e,t)}function R(e,t){var n=t.text.className,r=j(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,W(t)):n&&(t.text.className=n)}function W(e){D(e),e.line.wrapClass?P(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function F(e,t,n,r){t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null);var i=t.line.gutterMarkers;if(e.options.lineNumbers||i){var o=P(t),a=t.gutter=Wi("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px");if(e.display.input.setUneditable(a),o.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||i&&i["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild(Wi("div",w(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),i)for(var l=0;l1&&(Io&&Io.join("\n")==t?s=r.ranges.length%Io.length==0&&Oi(Io,Ka):l.length==r.ranges.length&&(s=Oi(l,function(e){return[e]})));for(var c=r.ranges.length-1;c>=0;c--){var u=r.ranges[c],f=u.from(),d=u.to();u.empty()&&(n&&n>0?f=qo(f.line,f.ch-n):e.state.overwrite&&!a&&(d=qo(d.line,Math.min(Xr(o,d.line).text.length,d.ch+zi(l).length))));var p=e.curOp.updateInput,h={from:f,to:d,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Cn(e.doc,h),_i(e,"inputRead",e,h)}t&&!a&&te(e,t),Pn(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function ee(e,t){var n=e.clipboardData&&e.clipboardData.getData("text/plain");return n?(e.preventDefault(),At(t,function(){J(t,n,0,null,"paste")}),!0):void 0}function te(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=jn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Xr(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=jn(e,i.head.line,"smart"));a&&_i(e,"electricInput",e,i.head.line)}}}function ne(e){for(var t=[],n=[],r=0;ri?c.map:u[i],a=0;ai?e.line:e.rest[i]),f=o[a]+r;return(0>r||l!=t)&&(f=o[a+(r?1:0)]),qo(s,f)}}}var i=e.text.firstChild,o=!1;if(!t||!Fa(i,t))return se(qo(Jr(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?zi(e.rest):e.line;return se(qo(Jr(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,f=r(l,s,n);if(f)return se(f,o);for(var d=s.nextSibling,p=l?l.nodeValue.length-n:0;d;d=d.nextSibling){if(f=r(d,d.firstChild,0))return se(qo(f.line,f.ch-p),o);p+=d.textContent.length}for(var h=s.previousSibling,p=n;h;h=h.previousSibling){if(f=r(h,h.firstChild,-1))return se(qo(f.line,f.ch+p),o);p+=d.textContent.length}}function fe(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(l+=n);var c,u=t.getAttribute("cm-marker");if(u){var f=e.findMarks(qo(r,0),qo(i+1,0),o(+u));return void(f.length&&(c=f[0].find())&&(l+=Zr(e.doc,c.from,c.to).join("\n")))}if("false"==t.getAttribute("contenteditable"))return;for(var d=0;d=0){var a=Z(o.from(),i.from()),l=X(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new pe(s?l:a,s?a:l))}}return new de(e,t)}function me(e,t){return new de([new pe(e,t||e)],0)}function ge(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ve(e,t){if(t.linen?qo(n,Xr(e,n).text.length):ye(t,Xr(e,t.line).text.length)}function ye(e,t){var n=e.ch;return null==n||n>t?qo(e.line,t):0>n?qo(e.line,0):e}function be(e,t){return t>=e.first&&t=o.ch:c.to>o.ch))){if(r&&(La(u,"beforeCursorEnter"),u.explicitlyCleared)){if(l.markedSpans){--s;continue}break}if(!u.atomic)continue;var f=u.find(0>a?-1:1);if(0==No(f,o)&&(f.ch+=a,f.ch<0?f=f.line>e.first?ve(e,qo(f.line-1)):null:f.ch>l.text.length&&(f=f.linet&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild(Wi("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?u-e:n)+"px; height: "+(r-t)+"px"))}function i(t,n,i){function o(n,r){return dt(e,qo(t,n),"div",f,r)}var l,s,f=Xr(a,t),d=f.text.length;return Qi(ni(f),n||0,null==i?d:i,function(e,t,a){var f,p,h,m=o(e,"left");if(e==t)f=m,p=h=m.left;else{if(f=o(t-1,"right"),"rtl"==a){var g=m;m=f,f=g}p=m.left,h=f.right}null==n&&0==e&&(p=c),f.top-m.top>3&&(r(p,m.top,null,m.bottom),p=c,m.bottoms.bottom||f.bottom==s.bottom&&f.right>s.right)&&(s=f),c+1>p&&(p=c),r(p,f.top,h-p,f.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ue(e.display),c=s.left,u=Math.max(o.sizerWidth,Ge(e)-o.sizer.offsetLeft)-s.right,f=t.from(),d=t.to();if(f.line==d.line)i(f.line,f.ch,d.ch);else{var p=Xr(a,f.line),h=Xr(a,d.line),m=gr(p)==gr(h),g=i(f.line,f.ch,m?p.text.length+1:null).end,v=i(d.line,m?0:null,d.ch).start;m&&(g.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Re(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ra(t.mode,He(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=Or(e,o,r,!0);o.styles=l.styles;var s=o.styleClasses,c=l.classes;c?o.styleClasses=c:s&&(o.styleClasses=null);for(var u=!a||a.length!=o.styles.length||s!=c&&(!s||!c||s.bgClass!=c.bgClass||s.textClass!=c.textClass),f=0;!u&&fn?(Re(e,e.options.workDelay),!0):void 0}),i.length&&At(e,function(){for(var t=0;ta;--l){if(l<=o.first)return o.first;var s=Xr(o,l-1);if(s.stateAfter&&(!n||l<=o.frontier))return l;var c=Na(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}function He(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=Fe(e,t,n),a=o>r.first&&Xr(r,o-1).stateAfter;return a=a?ra(r.mode,a):ia(r.mode),r.iter(o,t,function(n){Nr(e,n.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ze(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Ye(e,t){t=gr(t);var n=Jr(t),r=e.display.externalMeasured=new qt(e.doc,t,n);r.lineN=n;var i=r.built=Pr(e,r);return r.text=i.pre,Hi(e.display.lineMeasure,i.pre),r}function Qe(e,t,n,r){return tt(e,et(e,t),n,r)}function Je(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[l+2],s==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[(l-=3)+2],a="left";if("right"==n&&i==c-s)for(;lu;u++){for(;l&&Ri(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+sgo&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(mo&&e.options.lineWrapping){var f=Da(a,l,s).getClientRects();i=f.length?f["right"==r?f.length-1:0]:Ro}else i=Da(a,l,s).getBoundingClientRect()||Ro;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}mo&&11>go&&(i=it(e.display.measure,i));
+!function(e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else{if("function"==typeof define&&define.amd)return define([],e);(this||window).CodeMirror=e()}}(function(){"use strict";function e(n,r){if(!(this instanceof e))return new e(n,r);this.options=r=r?ji(r):{},ji(ea,r,!1),p(r);var i=r.value;"string"==typeof i&&(i=new Ca(i,r.mode,null,r.lineSeparator)),this.doc=i;var o=new e.inputStyles[r.inputStyle](this),a=this.display=new t(n,i,o);a.wrapper.CodeMirror=this,c(this),l(this),r.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),r.autofocus&&!zo&&a.input.focus(),v(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Ei,keySeq:null,specialChars:null};var s=this;xo&&11>ko&&setTimeout(function(){s.display.input.reset(!0)},20),$t(this),Xi(),kt(this),this.curOp.forceUpdate=!0,Yr(this,i),r.autofocus&&!zo||s.hasFocus()?setTimeout(Ri(yn,this),20):bn(this);for(var u in ta)ta.hasOwnProperty(u)&&ta[u](this,r[u],na);_(this),r.finishInit&&r.finishInit(this);for(var d=0;dko&&(r.gutters.style.zIndex=-1,r.scroller.style.paddingRight=0),_o||vo&&zo||(r.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(r.wrapper):e(r.wrapper)),r.viewFrom=r.viewTo=t.first,r.reportedViewFrom=r.reportedViewTo=t.first,r.view=[],r.renderedView=null,r.externalMeasured=null,r.viewOffset=0,r.lastWrapHeight=r.lastWrapWidth=0,r.updateLineNumbers=null,r.nativeBarWidth=r.barHeight=r.barWidth=0,r.scrollbarsClipped=!1,r.lineNumWidth=r.lineNumInnerWidth=r.lineNumChars=null,r.alignWidgets=!1,r.cachedCharWidth=r.cachedTextHeight=r.cachedPaddingH=null,r.maxLine=null,r.maxLineLength=0,r.maxLineChanged=!1,r.wheelDX=r.wheelDY=r.wheelStartX=r.wheelStartY=null,r.shift=!1,r.selForContextMenu=null,r.activeTouch=null,n.init(r)}function n(t){t.doc.mode=e.getMode(t.options,t.doc.modeOption),r(t)}function r(e){e.doc.iter(function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)}),e.doc.frontier=e.doc.first,We(e,100),e.state.modeGen++,e.curOp&&It(e)}function i(e){e.options.lineWrapping?(Qa(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(Ya(e.display.wrapper,"CodeMirror-wrap"),f(e)),a(e),It(e),st(e),setTimeout(function(){y(e)},100)}function o(e){var t=bt(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/xt(e.display)-3);return function(i){if(wr(e.doc,i))return 0;var o=0;if(i.widgets)for(var a=0;at.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)})}function p(e){var t=Ni(e.gutters,"CodeMirror-linenumbers");-1==t&&e.lineNumbers?e.gutters=e.gutters.concat(["CodeMirror-linenumbers"]):t>-1&&!e.lineNumbers&&(e.gutters=e.gutters.slice(0),e.gutters.splice(t,1))}function h(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ue(e.display));return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?n:0,docHeight:r,scrollHeight:r+Ge(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}function m(e,t,n){this.cm=n;var r=this.vert=$i("div",[$i("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=$i("div",[$i("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");e(r),e(i),za(r,"scroll",function(){r.clientHeight&&t(r.scrollTop,"vertical")}),za(i,"scroll",function(){i.clientWidth&&t(i.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,xo&&8>ko&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}function g(){}function v(t){t.display.scrollbars&&(t.display.scrollbars.clear(),t.display.scrollbars.addClass&&Ya(t.display.wrapper,t.display.scrollbars.addClass)),t.display.scrollbars=new e.scrollbarModel[t.options.scrollbarStyle](function(e){t.display.wrapper.insertBefore(e,t.display.scrollbarFiller),za(e,"mousedown",function(){t.state.focused&&setTimeout(function(){t.display.input.focus()},0)}),e.setAttribute("cm-not-content","true")},function(e,n){"horizontal"==n?an(t,e):on(t,e)},t),t.display.scrollbars.addClass&&Qa(t.display.wrapper,t.display.scrollbars.addClass)}function y(e,t){t||(t=h(e));var n=e.display.barWidth,r=e.display.barHeight;b(e,t);for(var i=0;4>i&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&E(e),b(e,h(e)),n=e.display.barWidth,r=e.display.barHeight}function b(e,t){var n=e.display,r=n.scrollbars.update(t);n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}function x(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop;r=Math.floor(r-Be(e));var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=ri(t,r),a=ri(t,i);if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line;o>l?(o=l,a=ri(t,ii(Qr(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=ri(t,ii(Qr(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function k(e){var t=e.display,n=t.view;if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=C(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==Ht(e))return!1;_(e)&&(jt(e),t.dims=q(e));var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin);n.viewFroma&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Do&&(o=kr(e.doc,o),a=_r(e.doc,a));var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth;Ft(e,o,a),n.viewOffset=ii(Qr(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px";var s=Ht(e);if(!l&&0==s&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1;var c=Vi();return s>4&&(n.lineDiv.style.display="none"),N(e,n.updateLineNumbers,t.dims),s>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,c&&Vi()!=c&&c.offsetHeight&&c.focus(),Bi(n.cursorDiv),Bi(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,We(e,400)),n.updateLineNumbers=null,!0}function T(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Ke(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ue(e.display)-Ze(e),n.top)}),t.visible=x(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&L(e,t);r=!1){E(e);var i=h(e);Pe(e),z(e,i),y(e,i)}t.signal(e,"update",e),(e.display.viewFrom!=e.display.reportedViewFrom||e.display.viewTo!=e.display.reportedViewTo)&&(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function A(e,t){var n=new S(e,t);if(L(e,n)){E(e),T(e,n);var r=h(e);Pe(e),z(e,r),y(e,r),n.finish()}}function z(e,t){e.display.sizer.style.minHeight=t.docHeight+"px";var n=t.docHeight+e.display.barHeight;e.display.heightForcer.style.top=n+"px",e.display.gutters.style.height=Math.max(n+Ge(e),t.clientHeight)+"px"}function E(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;rko){var a=o.node.offsetTop+o.node.offsetHeight;i=a-n,n=a}else{var l=o.node.getBoundingClientRect();i=l.bottom-l.top}var s=o.line.height-i;if(2>i&&(i=bt(t)),(s>.001||-.001>s)&&(ti(o.line,i),O(o.line),o.rest))for(var c=0;c=t&&d.lineNumber;d.changes&&(Ni(d.changes,"gutter")>-1&&(f=!1),P(e,d,c,n)),f&&(Bi(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(w(e.options,c)))),l=d.node.nextSibling}else{var p=B(e,d,c,n);a.insertBefore(p,l)}c+=d.size}for(;l;)l=r(l)}function P(e,t,n,r){for(var i=0;iko&&(e.node.style.zIndex=2)),e.node}function D(e){var t=e.bgClass?e.bgClass+" "+(e.line.bgClass||""):e.line.bgClass;if(t&&(t+=" CodeMirror-linebackground"),e.background)t?e.background.className=t:(e.background.parentNode.removeChild(e.background),e.background=null);else if(t){var n=I(e);e.background=n.insertBefore($i("div",null,t),n.firstChild)}}function j(e,t){var n=e.display.externalMeasured;return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Rr(e,t)}function R(e,t){var n=t.text.className,r=j(e,t);t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,W(t)):n&&(t.text.className=n)}function W(e){D(e),e.line.wrapClass?I(e).className=e.line.wrapClass:e.node!=e.text&&(e.node.className="");var t=e.textClass?e.textClass+" "+(e.line.textClass||""):e.line.textClass;e.text.className=t||""}function F(e,t,n,r){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=I(t);t.gutterBackground=$i("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers;if(e.options.lineNumbers||o){var i=I(t),a=t.gutter=$i("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px");if(e.display.input.setUneditable(a),i.insertBefore(a,t.text),t.line.gutterClass&&(a.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=a.appendChild($i("div",w(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var l=0;l1)if(Wo&&Wo.join("\n")==t){if(r.ranges.length%Wo.length==0){s=[];for(var c=0;c=0;c--){var u=r.ranges[c],d=u.from(),f=u.to();u.empty()&&(n&&n>0?d=jo(d.line,d.ch-n):e.state.overwrite&&!a&&(f=jo(f.line,Math.min(Qr(o,f.line).text.length,f.ch+qi(l).length))));var p=e.curOp.updateInput,h={from:d,to:f,text:s?s[c%s.length]:l,origin:i||(a?"paste":e.state.cutIncoming?"cut":"+input")};Ln(e.doc,h),Si(e,"inputRead",e,h)}t&&!a&&ee(e,t),Rn(e),e.curOp.updateInput=p,e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=!1}function J(e,t){var n=e.clipboardData&&e.clipboardData.getData("text/plain");return n?(e.preventDefault(),t.isReadOnly()||t.options.disableInput||zt(t,function(){Q(t,n,0,null,"paste")}),!0):void 0}function ee(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r];if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1;if(o.electricChars){for(var l=0;l-1){a=Fn(e,i.head.line,"smart");break}}else o.electricInput&&o.electricInput.test(Qr(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Fn(e,i.head.line,"smart"));a&&Si(e,"electricInput",e,i.head.line)}}}function te(e){for(var t=[],n=[],r=0;ri?c.map:u[i],a=0;ai?e.line:e.rest[i]),d=o[a]+r;return(0>r||l!=t)&&(d=o[a+(r?1:0)]),jo(s,d)}}}var i=e.text.firstChild,o=!1;if(!t||!Ka(i,t))return le(jo(ni(e.line),0),!0);if(t==i&&(o=!0,t=i.childNodes[n],n=0,!t)){var a=e.rest?qi(e.rest):e.line;return le(jo(ni(a),a.text.length),o)}var l=3==t.nodeType?t:null,s=t;for(l||1!=t.childNodes.length||3!=t.firstChild.nodeType||(l=t.firstChild,n&&(n=l.nodeValue.length));s.parentNode!=i;)s=s.parentNode;var c=e.measure,u=c.maps,d=r(l,s,n);if(d)return le(d,o);for(var f=s.nextSibling,p=l?l.nodeValue.length-n:0;f;f=f.nextSibling){if(d=r(f,f.firstChild,0))return le(jo(d.line,d.ch-p),o);p+=f.textContent.length}for(var h=s.previousSibling,p=n;h;h=h.previousSibling){if(d=r(h,h.firstChild,-1))return le(jo(d.line,d.ch+p),o);p+=f.textContent.length}}function ue(e,t,n,r,i){function o(e){return function(t){return t.id==e}}function a(t){if(1==t.nodeType){var n=t.getAttribute("cm-text");if(null!=n)return""==n&&(n=t.textContent.replace(/\u200b/g,"")),void(l+=n);var u,d=t.getAttribute("cm-marker");if(d){var f=e.findMarks(jo(r,0),jo(i+1,0),o(+d));return void(f.length&&(u=f[0].find())&&(l+=Jr(e.doc,u.from,u.to).join(c)))}if("false"==t.getAttribute("contenteditable"))return;for(var p=0;p=0){var a=X(o.from(),i.from()),l=Z(o.to(),i.to()),s=o.empty()?i.from()==i.head:o.from()==o.head;t>=r&&--t,e.splice(--r,2,new fe(s?l:a,s?a:l))}}return new de(e,t)}function he(e,t){return new de([new fe(e,t||e)],0)}function me(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function ge(e,t){if(t.linen?jo(n,Qr(e,n).text.length):ve(t,Qr(e,t.line).text.length)}function ve(e,t){var n=e.ch;return null==n||n>t?jo(e.line,t):0>n?jo(e.line,0):e}function ye(e,t){return t>=e.first&&t=t.ch:l.to>t.ch))){if(i&&(qa(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a;continue}break}if(!s.atomic)continue;if(n){var c,u=s.find(0>r?1:-1);if((0>r?s.inclusiveRight:s.inclusiveLeft)&&(u=Ne(e,u,-r,o)),u&&u.line==t.line&&(c=Ro(u,n))&&(0>r?0>c:c>0))return Oe(e,u,t,r,i)}var d=s.find(0>r?-1:1);return(0>r?s.inclusiveLeft:s.inclusiveRight)&&(d=Ne(e,d,r,o)),d?Oe(e,d,t,r,i):null}}return t}function qe(e,t,n,r,i){var o=r||1,a=Oe(e,t,n,o,i)||!i&&Oe(e,t,n,o,!0)||Oe(e,t,n,-o,i)||!i&&Oe(e,t,n,-o,!0);return a?a:(e.cantEdit=!0,jo(e.first,0))}function Ne(e,t,n,r){return 0>n&&0==t.ch?t.line>e.first?ge(e,jo(t.line-1)):null:n>0&&t.ch==(r||Qr(e,t.line)).text.length?t.linet&&(t=0),t=Math.round(t),r=Math.round(r),l.appendChild($i("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px; top: "+t+"px; width: "+(null==n?u-e:n)+"px; height: "+(r-t)+"px"))}function i(t,n,i){function o(n,r){return pt(e,jo(t,n),"div",d,r)}var l,s,d=Qr(a,t),f=d.text.length;return to(oi(d),n||0,null==i?f:i,function(e,t,a){var d,p,h,m=o(e,"left");if(e==t)d=m,p=h=m.left;else{if(d=o(t-1,"right"),"rtl"==a){var g=m;m=d,d=g}p=m.left,h=d.right}null==n&&0==e&&(p=c),d.top-m.top>3&&(r(p,m.top,null,m.bottom),p=c,m.bottoms.bottom||d.bottom==s.bottom&&d.right>s.right)&&(s=d),c+1>p&&(p=c),r(p,d.top,h-p,d.bottom)}),{start:l,end:s}}var o=e.display,a=e.doc,l=document.createDocumentFragment(),s=Ve(e.display),c=s.left,u=Math.max(o.sizerWidth,Ke(e)-o.sizer.offsetLeft)-s.right,d=t.from(),f=t.to();if(d.line==f.line)i(d.line,d.ch,f.ch);else{var p=Qr(a,d.line),h=Qr(a,f.line),m=br(p)==br(h),g=i(d.line,d.ch,m?p.text.length+1:null).end,v=i(f.line,m?0:null,f.ch).start;m&&(g.top0?t.blinker=setInterval(function(){t.cursorDiv.style.visibility=(n=!n)?"":"hidden"},e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function We(e,t){e.doc.mode.startState&&e.doc.frontier=e.display.viewTo)){var n=+new Date+e.options.workTime,r=sa(t.mode,$e(e,t.frontier)),i=[];t.iter(t.frontier,Math.min(t.first+t.size,e.display.viewTo+500),function(o){if(t.frontier>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength,s=Pr(e,o,l?sa(t.mode,r):r,!0);o.styles=s.styles;var c=o.styleClasses,u=s.classes;u?o.styleClasses=u:c&&(o.styleClasses=null);for(var d=!a||a.length!=o.styles.length||c!=u&&(!c||!u||c.bgClass!=u.bgClass||c.textClass!=u.textClass),f=0;!d&&fn?(We(e,e.options.workDelay),!0):void 0}),i.length&&zt(e,function(){for(var t=0;ta;--l){if(l<=o.first)return o.first;var s=Qr(o,l-1);if(s.stateAfter&&(!n||l<=o.frontier))return l;var c=Wa(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}function $e(e,t,n){var r=e.doc,i=e.display;if(!r.mode.startState)return!0;var o=He(e,t,n),a=o>r.first&&Qr(r,o-1).stateAfter;return a=a?sa(r.mode,a):ca(r.mode),r.iter(o,t,function(n){Dr(e,n.text,a);var l=o==t-1||o%5==0||o>=i.viewFrom&&o2&&o.push((s.bottom+c.top)/2-n.top)}}o.push(n.bottom-n.top)}}function Ye(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache};for(var r=0;rn)return{map:e.measure.maps[r],cache:e.measure.caches[r],before:!0}}function Qe(e,t){t=br(t);var n=ni(t),r=e.display.externalMeasured=new Nt(e.doc,t,n);r.lineN=n;var i=r.built=Rr(e,r);return r.text=i.pre,Ui(e.display.lineMeasure,i.pre),r}function Je(e,t,n,r){return nt(e,tt(e,t),n,r)}function et(e,t){if(t>=e.display.viewFrom&&t=n.lineN&&tt?(i=0,o=1,a="left"):c>t?(i=t-s,o=i+1):(l==e.length-3||t==c&&e[l+3]>t)&&(o=c-s,i=o-1,t>=c&&(a="right")),null!=i){if(r=e[l+2],s==c&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;l&&e[l-2]==e[l-3]&&e[l-1].insertLeft;)r=e[(l-=3)+2],a="left";if("right"==n&&i==c-s)for(;lu;u++){for(;l&&Hi(t.line.text.charAt(o.coverStart+l));)--l;for(;o.coverStart+sko&&0==l&&s==o.coverEnd-o.coverStart)i=a.parentNode.getBoundingClientRect();else if(xo&&e.options.lineWrapping){var d=Ba(a,l,s).getClientRects();i=d.length?d["right"==r?d.length-1:0]:Bo}else i=Ba(a,l,s).getBoundingClientRect()||Bo;if(i.left||i.right||0==l)break;s=l,l-=1,c="right"}xo&&11>ko&&(i=ot(e.display.measure,i))}else{l>0&&(c=r="right");var d;i=e.options.lineWrapping&&(d=a.getClientRects()).length>1?d["right"==r?d.length-1:0]:a.getBoundingClientRect()}if(xo&&9>ko&&!l&&(!i||!i.left&&!i.right)){var f=a.parentNode.getClientRects()[0];i=f?{left:f.left,right:f.left+xt(e.display),top:f.top,bottom:f.bottom}:Bo}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;un.from?a(e-1):a(e,r)}r=r||Qr(e.doc,t.line),i||(i=tt(e,r));var s=oi(r),c=t.ch;if(!s)return a(c);var u=uo(s,c),d=l(c,u);return null!=al&&(d.other=l(c,al)),d}function mt(e,t){var n=0,t=ge(e.doc,t);e.options.lineWrapping||(n=xt(e.display)*t.ch);var r=Qr(e.doc,t.line),i=ii(r)+Be(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function gt(e,t,n,r){var i=jo(e,t);return i.xRel=r,n&&(i.outside=!0),i}function vt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return gt(r.first,0,!0,-1);var i=ri(r,n),o=r.first+r.size-1;if(i>o)return gt(r.first+r.size-1,Qr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Qr(r,i);;){var l=yt(e,a,i,t,n),s=vr(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=ni(a=c.to.line)}}function yt(e,t,n,r,i){function o(r){var i=ht(e,jo(n,r),"line",t,c);return l=!0,a>i.bottom?i.left-s:ag)return gt(n,p,v,1);for(;;){if(u?p==f||p==po(t,f,1):1>=p-f){for(var y=h>r||g-r>=r-h?f:p,b=r-(y==f?h:g);Hi(t.text.charAt(y));)++y;var x=gt(n,y,y==f?m:v,-1>b?-1:b>1?1:0);return x}var k=Math.ceil(d/2),_=f+k;if(u){_=f;for(var w=0;k>w;++w)_=po(t,_,1)}var C=o(_);C>r?(p=_,g=C,(v=l)&&(g+=1e3),d=k):(f=_,h=C,m=l,d-=k)}}function bt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Fo){Fo=$i("pre");for(var t=0;49>t;++t)Fo.appendChild(document.createTextNode("x")),Fo.appendChild($i("br"));Fo.appendChild(document.createTextNode("x"))}Ui(e.measure,Fo);var n=Fo.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Bi(e.measure),n||1}function xt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=$i("span","xxxxxxxxxx"),n=$i("pre",[t]);Ui(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function kt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Vo},Uo?Uo.ops.push(e.curOp):e.curOp.ownsGroup=Uo={ops:[e.curOp],delayedCallbacks:[]}}function _t(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Mt(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Lt(e){var t=e.cm,n=t.display;e.updatedDisplay&&E(t),e.barMeasure=h(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Je(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ge(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ke(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Tt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=r){var a=new Nt(e.doc,Qr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function It(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Do&&kr(e.doc,t)i.viewFrom?jt(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)jt(e);else if(t<=i.viewFrom){var o=Wt(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):jt(e)}else if(n>=i.viewTo){var o=Wt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):jt(e)}else{var a=Wt(e,t,t,-1),l=Wt(e,n,n+r,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Pt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):jt(e)}var s=i.externalMeasured;s&&(n=i.lineN&&t=r.viewTo)){var o=r.view[Rt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Ni(a,n)&&a.push(n)}}}function jt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function Rt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,r=0;rt)return r}function Wt(e,t,n,r){var i,o=Rt(e,t),a=e.display.view;if(!Do||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;kr(e.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:n}}function Ft(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Pt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Pt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,Rt(e,n)))),r.viewTo=n}function Ht(e){for(var t=e.display.view,n=0,r=0;r400}var i=e.display;za(i.scroller,"mousedown",Et(e,Kt)),xo&&11>ko?za(i.scroller,"dblclick",Et(e,function(t){if(!Li(e,t)){var n=Gt(e,t);if(n&&!Jt(e,t)&&!Vt(e.display,t)){La(t);var r=e.findWordAt(n);ke(e.doc,r.anchor,r.head)}}})):za(i.scroller,"dblclick",function(t){Li(e,t)||La(t)}),Po||za(i.scroller,"contextmenu",function(t){xn(e,t)});var o,a={end:0};za(i.scroller,"touchstart",function(t){if(!Li(e,t)&&!n(t)){clearTimeout(o);var r=+new Date;i.activeTouch={start:r,moved:!1,prev:r-a.end<=300?a:null},1==t.touches.length&&(i.activeTouch.left=t.touches[0].pageX,i.activeTouch.top=t.touches[0].pageY)}}),za(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),za(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Vt(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new fe(l,l):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(l):new fe(jo(l.line,0),ge(e.doc,jo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),La(n)}t()}),za(i.scroller,"touchcancel",t),za(i.scroller,"scroll",function(){i.scroller.clientHeight&&(on(e,i.scroller.scrollTop),an(e,i.scroller.scrollLeft,!0),qa(e,"scroll",e))}),za(i.scroller,"mousewheel",function(t){ln(e,t)}),za(i.scroller,"DOMMouseScroll",function(t){ln(e,t)}),za(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={enter:function(t){Li(e,t)||Aa(t)},over:function(t){Li(e,t)||(nn(e,t),Aa(t))},start:function(t){tn(e,t)},drop:Et(e,en),leave:function(){rn(e)}};var l=i.input.getField();za(l,"keyup",function(t){mn.call(e,t)}),za(l,"keydown",Et(e,pn)),za(l,"keypress",Et(e,gn)),za(l,"focus",Ri(yn,e)),za(l,"blur",Ri(bn,e))}function Bt(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?za:Oa;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.enter),a(t.display.scroller,"dragover",o.over),a(t.display.scroller,"dragleave",o.leave),a(t.display.scroller,"drop",o.drop)}}function Ut(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Vt(e,t){for(var n=_i(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Gt(e,t,n,r){var i=e.display;if(!n&&"true"==_i(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=vt(e,o,a);if(r&&1==c.xRel&&(s=Qr(e.doc,c.line).text).length==c.ch){var u=Wa(s,s.length,e.options.tabSize)-s.length;c=jo(c.line,Math.max(0,Math.round((o-Ve(e.display).left)/xt(e.display))-u))}return c}function Kt(e){var t=this,n=t.display;if(!(Li(t,e)||n.activeTouch&&n.input.supportsTouch())){if(n.shift=e.shiftKey,Vt(n,e))return void(_o||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Jt(t,e)){var r=Gt(t,e);switch(window.focus(),wi(e)){case 1:t.state.selectingText?t.state.selectingText(e):r?Zt(t,e,r):_i(e)==n.scroller&&La(e);break;case 2:_o&&(t.state.lastMiddleDown=+new Date),r&&ke(t.doc,r),setTimeout(function(){n.input.focus()},20),La(e);break;case 3:Po?xn(t,e):vn(t)}}}}function Zt(e,t,n){xo?setTimeout(Ri(Y,e),0):e.curOp.focus=Vi();var r,i=+new Date;$o&&$o.time>i-400&&0==Ro($o.pos,n)?r="triple":Ho&&Ho.time>i-400&&0==Ro(Ho.pos,n)?(r="double",$o={time:i,pos:n}):(r="single",Ho={time:i,pos:n});var o,a=e.doc.sel,l=Eo?t.metaKey:t.ctrlKey;e.options.dragDrop&&el&&!e.isReadOnly()&&"single"==r&&(o=a.contains(n))>-1&&(Ro((o=a.ranges[o]).from(),n)<0||n.xRel>0)&&(Ro(o.to(),n)>0||n.xRel<0)?Xt(e,t,n,l):Yt(e,t,n,r,l)}function Xt(e,t,n,r){var i=e.display,o=+new Date,a=Et(e,function(l){_o&&(i.scroller.draggable=!1),e.state.draggingText=!1,Oa(document,"mouseup",a),Oa(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(La(l),!r&&+new Date-200=h;h++){var v=Qr(c,h).text,y=Fa(v,s,o);s==p?i.push(new fe(jo(h,y),jo(h,y))):v.length>y&&i.push(new fe(jo(h,y),jo(h,Fa(v,p,o))))}i.length||i.push(new fe(n,n)),Le(c,pe(f.ranges.slice(0,d).concat(i),d),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,x=b.anchor,k=t;if("single"!=r){if("double"==r)var _=e.findWordAt(t);else var _=new fe(jo(t.line,0),ge(c,jo(t.line+1,0)));Ro(_.anchor,x)>0?(k=_.head,x=X(b.from(),_.anchor)):(k=_.anchor,x=Z(b.to(),_.head))}var i=f.ranges.slice(0);i[d]=new fe(ge(c,x),k),Le(c,pe(i,d),ja)}}function a(t){var n=++y,i=Gt(e,t,!0,"rect"==r);if(i)if(0!=Ro(i,g)){e.curOp.focus=Vi(),o(i);var l=x(s,c);(i.line>=l.to||i.linev.bottom?20:0;u&&setTimeout(Et(e,function(){y==n&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(t){e.state.selectingText=!1,y=1/0,La(t),s.input.focus(),Oa(document,"mousemove",b),Oa(document,"mouseup",k),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;La(t);var u,d,f=c.sel,p=f.ranges;if(i&&!t.shiftKey?(d=c.sel.contains(n),u=d>-1?p[d]:new fe(n,n)):(u=c.sel.primary(),d=c.sel.primIndex),t.altKey)r="rect",i||(u=new fe(n,n)),n=Gt(e,t,!0,!0),d=-1;else if("double"==r){var h=e.findWordAt(n);u=e.display.shift||c.extend?xe(c,u,h.anchor,h.head):h}else if("triple"==r){var m=new fe(jo(n.line,0),ge(c,jo(n.line+1,0)));u=e.display.shift||c.extend?xe(c,u,m.anchor,m.head):m}else u=xe(c,u,n);i?-1==d?(d=p.length,Le(c,pe(p.concat([u]),d),{scroll:!1,origin:"*mouse"})):p.length>1&&p[d].empty()&&"single"==r&&!t.shiftKey?(Le(c,pe(p.slice(0,d).concat(p.slice(d+1)),0),{scroll:!1,origin:"*mouse"}),f=c.sel):we(c,d,u,ja):(d=0,Le(c,new de([u],0),ja),f=c.sel);var g=n,v=s.wrapper.getBoundingClientRect(),y=0,b=Et(e,function(e){wi(e)?a(e):l(e)}),k=Et(e,l);e.state.selectingText=k,za(document,"mousemove",b),za(document,"mouseup",k)}function Qt(e,t,n,r){try{var i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&La(t);var a=e.display,l=a.lineDiv.getBoundingClientRect();if(o>l.bottom||!Ai(e,n))return ki(t);o-=l.top-a.viewOffset;for(var s=0;s=i){var u=ri(e.doc,o),d=e.options.gutters[s];return qa(e,n,e,u,d,t),ki(t)}}}function Jt(e,t){return Qt(e,t,"gutterClick",!0)}function en(e){var t=this;if(rn(t),!Li(t,e)&&!Vt(t.display,e)){La(e),xo&&(Go=+new Date);var n=Gt(t,e,!0),r=e.dataTransfer.files;if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,l=function(e,r){if(!t.options.allowDropFileTypes||-1!=Ni(t.options.allowDropFileTypes,e.type)){var l=new FileReader;l.onload=Et(t,function(){var e=l.result;if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++a==i){n=ge(t.doc,n);var s={from:n,to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"};Ln(t.doc,s),Me(t.doc,he(n,Jo(s)))}}),l.readAsText(e)}},s=0;i>s;++s)l(r[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Eo?e.altKey:e.ctrlKey))var c=t.listSelections();if(Te(t.doc,he(n,n)),c)for(var s=0;sa.clientWidth,s=a.scrollHeight>a.clientHeight;if(r&&l||i&&s){if(i&&Eo&&_o)e:for(var c=t.target,u=o.view;c!=a;c=c.parentNode)for(var d=0;df?p=Math.max(0,p+f-50):h=Math.min(e.doc.height,h+f+50),A(e,{top:p,bottom:h})}20>Ko&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Zo=(Zo*Ko+n)/(Ko+1),++Ko)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function sn(e,t,n){if("string"==typeof t&&(t=ua[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=Ia}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function cn(e,t,n){for(var r=0;rko&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=dn(t,e);So&&(Qo=r?n:null,!r&&88==n&&!rl&&(Eo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||hn(t)}}function hn(e){function t(e){18!=e.keyCode&&e.altKey||(Ya(n,"CodeMirror-crosshair"),Oa(document,"keyup",t),Oa(document,"mouseover",t))}var n=e.display.lineDiv;Qa(n,"CodeMirror-crosshair"),za(document,"keyup",t),za(document,"mouseover",t)}function mn(e){16==e.keyCode&&(this.doc.sel.shift=!1),Li(this,e)}function gn(e){var t=this;if(!(Vt(t.display,e)||Li(t,e)||e.ctrlKey&&!e.altKey||Eo&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(So&&n==Qo)return Qo=null,void La(e);if(!So||e.which&&!(e.which<10)||!dn(t,e)){var i=String.fromCharCode(null==r?n:r);fn(t,e,i)||t.display.input.onKeyPress(e)}}}function vn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,bn(e))},100)}function yn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(qa(e,"focus",e),e.state.focused=!0,Qa(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),_o&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),Re(e))}function bn(e){e.state.delayingBlurEvent||(e.state.focused&&(qa(e,"blur",e),e.state.focused=!1,Ya(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function xn(e,t){Vt(e.display,t)||kn(e,t)||Li(e,t,"contextmenu")||e.display.input.onContextMenu(t)}function kn(e,t){return Ai(e,"gutterContextMenu")?Qt(e,t,"gutterContextMenu",!1):!1}function _n(e,t){if(Ro(e,t.from)<0)return e;if(Ro(e,t.to)<=0)return Jo(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Jo(t).ch-t.to.ch),jo(n,r)}function wn(e,t){for(var n=[],r=0;r=0;--i)Tn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Tn(e,t)}}function Tn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=Ro(t.from,t.to)){var n=wn(e,t);ui(e,t,n,e.cm?e.cm.curOp.id:0/0),En(e,t,n,ar(e,t));var r=[];Xr(e,function(e,n){n||-1!=Ni(r,e.history)||(xi(e.history,t),r.push(e.history)),En(e,t,null,ar(e,t))})}}function An(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s=0;--s){var d=r.changes[s];if(d.origin=t,u&&!Mn(e,d,!1))return void(a.length=0);c.push(li(e,d));var f=s?wn(e,d):qi(a);En(e,d,f,sr(e,d)),!s&&e.cm&&e.cm.scrollIntoView({from:d.from,to:Jo(d)});var p=[];Xr(e,function(e,t){t||-1!=Ni(p,e.history)||(xi(e.history,d),p.push(e.history)),En(e,d,null,sr(e,d))})}}}}function zn(e,t){if(0!=t&&(e.first+=t,e.sel=new de(Pi(e.sel.ranges,function(e){return new fe(jo(e.anchor.line+t,e.anchor.ch),jo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){It(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:jo(o,Qr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Jr(e,t.from,t.to),n||(n=wn(e,t)),e.cm?On(e.cm,t,r):Gr(e,t,r),Te(e,n,Da)}}function On(e,t,n){var r=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=ni(br(Qr(r,a.line))),r.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&Ti(e),Gr(r,t,n,o(e)),e.options.lineWrapping||(r.iter(c,a.line+t.text.length,function(e){var t=d(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),We(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?It(e):a.line!=l.line||1!=t.text.length||Vr(e.doc,t)?It(e,a.line,l.line+1,u):Dt(e,a.line,"text");var f=Ai(e,"changes"),p=Ai(e,"change");if(p||f){var h={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};p&&Si(e,"change",e,h),f&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function qn(e,t,n,r,i){if(r||(r=n),Ro(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=e.splitLines(t)),Ln(e,{from:n,to:r,text:t,origin:i})}function Nn(e,t){if(!Li(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!To){var o=$i("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-Be(e.display))+"px; height: "+(t.bottom-t.top+Ge(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function Pn(e,t,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=ht(e,t),l=n&&n!=t?ht(e,n):a,s=Dn(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-r,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(on(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(an(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function In(e,t,n,r,i){var o=Dn(e,t,n,r,i);null!=o.scrollTop&&on(e,o.scrollTop),null!=o.scrollLeft&&an(e,o.scrollLeft)}function Dn(e,t,n,r,i){var o=e.display,a=bt(e.display);0>n&&(n=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=Ze(e),c={};i-n>s&&(i=n+s);var u=e.doc.height+Ue(o),d=a>n,f=i>u-a;if(l>n)c.scrollTop=d?0:n;else if(i>l+s){var p=Math.min(n,(f?u:i)-s);p!=l&&(c.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ke(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?c.scrollLeft=0:h>t?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+h-3&&(c.scrollLeft=r+(g?0:10)-m),c}function jn(e,t,n){(null!=t||null!=n)&&Wn(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Rn(e){Wn(e);
-}else{l>0&&(c=r="right");var f;i=e.options.lineWrapping&&(f=a.getClientRects()).length>1?f["right"==r?f.length-1:0]:a.getBoundingClientRect()}if(mo&&9>go&&!l&&(!i||!i.left&&!i.right)){var d=a.parentNode.getClientRects()[0];i=d?{left:d.left,right:d.left+bt(e.display),top:d.top,bottom:d.bottom}:Ro}for(var p=i.top-t.rect.top,h=i.bottom-t.rect.top,m=(p+h)/2,g=t.view.measure.heights,u=0;un.from?a(e-1):a(e,r)}r=r||Xr(e.doc,t.line),i||(i=et(e,r));var s=ni(r),c=t.ch;if(!s)return a(c);var u=lo(s,c),f=l(c,u);return null!=Ja&&(f.other=l(c,Ja)),f}function ht(e,t){var n=0,t=ve(e.doc,t);e.options.lineWrapping||(n=bt(e.display)*t.ch);var r=Xr(e.doc,t.line),i=ti(r)+$e(e.display);return{left:n,right:n,top:i,bottom:i+r.height}}function mt(e,t,n,r){var i=qo(e,t);return i.xRel=r,n&&(i.outside=!0),i}function gt(e,t,n){var r=e.doc;if(n+=e.display.viewOffset,0>n)return mt(r.first,0,!0,-1);var i=ei(r,n),o=r.first+r.size-1;if(i>o)return mt(r.first+r.size-1,Xr(r,o).text.length,!0,1);0>t&&(t=0);for(var a=Xr(r,i);;){var l=vt(e,a,i,t,n),s=hr(a),c=s&&s.find(0,!0);if(!s||!(l.ch>c.from.ch||l.ch==c.from.ch&&l.xRel>0))return l;i=Jr(a=c.to.line)}}function vt(e,t,n,r,i){function o(r){var i=pt(e,qo(n,r),"line",t,c);return l=!0,a>i.bottom?i.left-s:ag)return mt(n,p,v,1);for(;;){if(u?p==d||p==co(t,d,1):1>=p-d){for(var y=h>r||g-r>=r-h?d:p,b=r-(y==d?h:g);Ri(t.text.charAt(y));)++y;var x=mt(n,y,y==d?m:v,-1>b?-1:b>1?1:0);return x}var _=Math.ceil(f/2),k=d+_;if(u){k=d;for(var w=0;_>w;++w)k=co(t,k,1)}var C=o(k);C>r?(p=k,g=C,(v=l)&&(g+=1e3),f=_):(d=k,h=C,m=l,f-=_)}}function yt(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight;if(null==Po){Po=Wi("pre");for(var t=0;49>t;++t)Po.appendChild(document.createTextNode("x")),Po.appendChild(Wi("br"));Po.appendChild(document.createTextNode("x"))}Hi(e.measure,Po);var n=Po.offsetHeight/50;return n>3&&(e.cachedTextHeight=n),Fi(e.measure),n||1}function bt(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth;var t=Wi("span","xxxxxxxxxx"),n=Wi("pre",[t]);Hi(e.measure,n);var r=t.getBoundingClientRect(),i=(r.right-r.left)/10;return i>2&&(e.cachedCharWidth=i),i||10}function xt(e){e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Fo},Wo?Wo.ops.push(e.curOp):e.curOp.ownsGroup=Wo={ops:[e.curOp],delayedCallbacks:[]}}function _t(e){var t=e.delayedCallbacks,n=0;do{for(;n=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new S(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function St(e){e.updatedDisplay=e.mustUpdate&&L(e.cm,e.update)}function Mt(e){var t=e.cm,n=t.display;e.updatedDisplay&&E(t),e.barMeasure=h(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Qe(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Ve(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Ge(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Lt(e){var t=e.cm;null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLefto;o=r){var a=new qt(e.doc,Xr(e.doc,o),o);r=o+a.size,i.push(a)}return i}function It(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0);var i=e.display;if(r&&nt)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Oo&&yr(e.doc,t)i.viewFrom?Dt(e):(i.viewFrom+=r,i.viewTo+=r);else if(t<=i.viewFrom&&n>=i.viewTo)Dt(e);else if(t<=i.viewFrom){var o=Rt(e,n,n+r,1);o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):Dt(e)}else if(n>=i.viewTo){var o=Rt(e,t,t,-1);o?(i.view=i.view.slice(0,o.index),i.viewTo=o.lineN):Dt(e)}else{var a=Rt(e,t,t,-1),l=Rt(e,n,n+r,1);a&&l?(i.view=i.view.slice(0,a.index).concat(Nt(e,a.lineN,l.lineN)).concat(i.view.slice(l.index)),i.viewTo+=r):Dt(e)}var s=i.externalMeasured;s&&(n=i.lineN&&t=r.viewTo)){var o=r.view[jt(e,t)];if(null!=o.node){var a=o.changes||(o.changes=[]);-1==Ei(a,n)&&a.push(n)}}}function Dt(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function jt(e,t){if(t>=e.display.viewTo)return null;if(t-=e.display.viewFrom,0>t)return null;for(var n=e.display.view,r=0;rt)return r}function Rt(e,t,n,r){var i,o=jt(e,t),a=e.display.view;if(!Oo||n==e.doc.first+e.doc.size)return{index:o,lineN:n};for(var l=0,s=e.display.viewFrom;o>l;l++)s+=a[l].size;if(s!=t){if(r>0){if(o==a.length-1)return null;i=s+a[o].size-t,o++}else i=s-t;t+=i,n+=i}for(;yr(e.doc,n)!=n;){if(o==(0>r?0:a.length-1))return null;n+=r*a[o-(0>r?1:0)].size,o+=r}return{index:o,lineN:n}}function Wt(e,t,n){var r=e.display,i=r.view;0==i.length||t>=r.viewTo||n<=r.viewFrom?(r.view=Nt(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=Nt(e,t,r.viewFrom).concat(r.view):r.viewFromn&&(r.view=r.view.slice(0,jt(e,n)))),r.viewTo=n}function Ft(e){for(var t=e.display.view,n=0,r=0;r400}var i=e.display;Sa(i.scroller,"mousedown",zt(e,Gt)),mo&&11>go?Sa(i.scroller,"dblclick",zt(e,function(t){if(!wi(e,t)){var n=Vt(e,t);if(n&&!Qt(e,t)&&!Ut(e.display,t)){ka(t);var r=e.findWordAt(n);ke(e.doc,r.anchor,r.head)}}})):Sa(i.scroller,"dblclick",function(t){wi(e,t)||ka(t)}),zo||Sa(i.scroller,"contextmenu",function(t){vn(e,t)});var o,a={end:0};Sa(i.scroller,"touchstart",function(e){if(!n(e)){clearTimeout(o);var t=+new Date;i.activeTouch={start:t,moved:!1,prev:t-a.end<=300?a:null},1==e.touches.length&&(i.activeTouch.left=e.touches[0].pageX,i.activeTouch.top=e.touches[0].pageY)}}),Sa(i.scroller,"touchmove",function(){i.activeTouch&&(i.activeTouch.moved=!0)}),Sa(i.scroller,"touchend",function(n){var o=i.activeTouch;if(o&&!Ut(i,n)&&null!=o.left&&!o.moved&&new Date-o.start<300){var a,l=e.coordsChar(i.activeTouch,"page");a=!o.prev||r(o,o.prev)?new pe(l,l):!o.prev.prev||r(o,o.prev.prev)?e.findWordAt(l):new pe(qo(l.line,0),ve(e.doc,qo(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),ka(n)}t()}),Sa(i.scroller,"touchcancel",t),Sa(i.scroller,"scroll",function(){i.scroller.clientHeight&&(tn(e,i.scroller.scrollTop),nn(e,i.scroller.scrollLeft,!0),La(e,"scroll",e))}),Sa(i.scroller,"mousewheel",function(t){rn(e,t)}),Sa(i.scroller,"DOMMouseScroll",function(t){rn(e,t)}),Sa(i.wrapper,"scroll",function(){i.wrapper.scrollTop=i.wrapper.scrollLeft=0}),i.dragFunctions={simple:function(t){wi(e,t)||Ca(t)},start:function(t){en(e,t)},drop:zt(e,Jt)};var l=i.input.getField();Sa(l,"keyup",function(t){dn.call(e,t)}),Sa(l,"keydown",zt(e,un)),Sa(l,"keypress",zt(e,pn)),Sa(l,"focus",Pi(mn,e)),Sa(l,"blur",Pi(gn,e))}function $t(t,n,r){var i=r&&r!=e.Init;if(!n!=!i){var o=t.display.dragFunctions,a=n?Sa:Ma;a(t.display.scroller,"dragstart",o.start),a(t.display.scroller,"dragenter",o.simple),a(t.display.scroller,"dragover",o.simple),a(t.display.scroller,"drop",o.drop)}}function Bt(e){var t=e.display;(t.lastWrapHeight!=t.wrapper.clientHeight||t.lastWrapWidth!=t.wrapper.clientWidth)&&(t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize())}function Ut(e,t){for(var n=bi(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Vt(e,t,n,r){var i=e.display;if(!n&&"true"==bi(t).getAttribute("cm-not-content"))return null;var o,a,l=i.lineSpace.getBoundingClientRect();try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,c=gt(e,o,a);if(r&&1==c.xRel&&(s=Xr(e.doc,c.line).text).length==c.ch){var u=Na(s,s.length,e.options.tabSize)-s.length;c=qo(c.line,Math.max(0,Math.round((o-Ue(e.display).left)/bt(e.display))-u))}return c}function Gt(e){var t=this,n=t.display;if(!(n.activeTouch&&n.input.supportsTouch()||wi(t,e))){if(n.shift=e.shiftKey,Ut(n,e))return void(vo||(n.scroller.draggable=!1,setTimeout(function(){n.scroller.draggable=!0},100)));if(!Qt(t,e)){var r=Vt(t,e);switch(window.focus(),xi(e)){case 1:r?Kt(t,e,r):bi(e)==n.scroller&&ka(e);break;case 2:vo&&(t.state.lastMiddleDown=+new Date),r&&ke(t.doc,r),setTimeout(function(){n.input.focus()},20),ka(e);break;case 3:zo?vn(t,e):hn(t)}}}}function Kt(e,t,n){mo?setTimeout(Pi(Y,e),0):e.curOp.focus=$i();var r,i=+new Date;jo&&jo.time>i-400&&0==No(jo.pos,n)?r="triple":Do&&Do.time>i-400&&0==No(Do.pos,n)?(r="double",jo={time:i,pos:n}):(r="single",Do={time:i,pos:n});var o,a=e.doc.sel,l=Mo?t.metaKey:t.ctrlKey;e.options.dragDrop&&Ga&&!Q(e)&&"single"==r&&(o=a.contains(n))>-1&&(No((o=a.ranges[o]).from(),n)<0||n.xRel>0)&&(No(o.to(),n)>0||n.xRel<0)?Xt(e,t,n,l):Zt(e,t,n,r,l)}function Xt(e,t,n,r){var i=e.display,o=+new Date,a=zt(e,function(l){vo&&(i.scroller.draggable=!1),e.state.draggingText=!1,Ma(document,"mouseup",a),Ma(i.scroller,"drop",a),Math.abs(t.clientX-l.clientX)+Math.abs(t.clientY-l.clientY)<10&&(ka(l),!r&&+new Date-200=h;h++){var v=Xr(c,h).text,y=Ti(v,s,o);s==p?i.push(new pe(qo(h,y),qo(h,y))):v.length>y&&i.push(new pe(qo(h,y),qo(h,Ti(v,p,o))))}i.length||i.push(new pe(n,n)),Te(c,he(d.ranges.slice(0,f).concat(i),f),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b=u,x=b.anchor,_=t;if("single"!=r){if("double"==r)var k=e.findWordAt(t);else var k=new pe(qo(t.line,0),ve(c,qo(t.line+1,0)));No(k.anchor,x)>0?(_=k.head,x=Z(b.from(),k.anchor)):(_=k.anchor,x=X(b.to(),k.head))}var i=d.ranges.slice(0);i[f]=new pe(ve(c,x),_),Te(c,he(i,f),Oa)}}function a(t){var n=++y,i=Vt(e,t,!0,"rect"==r);if(i)if(0!=No(i,g)){e.curOp.focus=$i(),o(i);var l=x(s,c);(i.line>=l.to||i.linev.bottom?20:0;u&&setTimeout(zt(e,function(){y==n&&(s.scroller.scrollTop+=u,a(t))}),50)}}function l(e){y=1/0,ka(e),s.input.focus(),Ma(document,"mousemove",b),Ma(document,"mouseup",_),c.history.lastSelOrigin=null}var s=e.display,c=e.doc;ka(t);var u,f,d=c.sel,p=d.ranges;if(i&&!t.shiftKey?(f=c.sel.contains(n),u=f>-1?p[f]:new pe(n,n)):(u=c.sel.primary(),f=c.sel.primIndex),t.altKey)r="rect",i||(u=new pe(n,n)),n=Vt(e,t,!0,!0),f=-1;else if("double"==r){var h=e.findWordAt(n);u=e.display.shift||c.extend?_e(c,u,h.anchor,h.head):h}else if("triple"==r){var m=new pe(qo(n.line,0),ve(c,qo(n.line+1,0)));u=e.display.shift||c.extend?_e(c,u,m.anchor,m.head):m}else u=_e(c,u,n);i?-1==f?(f=p.length,Te(c,he(p.concat([u]),f),{scroll:!1,origin:"*mouse"})):p.length>1&&p[f].empty()&&"single"==r&&!t.shiftKey?(Te(c,he(p.slice(0,f).concat(p.slice(f+1)),0)),d=c.sel):Ce(c,f,u,Oa):(f=0,Te(c,new de([u],0),Oa),d=c.sel);var g=n,v=s.wrapper.getBoundingClientRect(),y=0,b=zt(e,function(e){xi(e)?a(e):l(e)}),_=zt(e,l);Sa(document,"mousemove",b),Sa(document,"mouseup",_)}function Yt(e,t,n,r,i){try{var o=t.clientX,a=t.clientY}catch(t){return!1}if(o>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1;r&&ka(t);var l=e.display,s=l.lineDiv.getBoundingClientRect();if(a>s.bottom||!Si(e,n))return yi(t);a-=s.top-l.viewOffset;for(var c=0;c=o){var f=ei(e.doc,a),d=e.options.gutters[c];return i(e,n,e,f,d,t),yi(t)}}}function Qt(e,t){return Yt(e,t,"gutterClick",!0,_i)}function Jt(e){var t=this;if(!wi(t,e)&&!Ut(t.display,e)){ka(e),mo&&(Ho=+new Date);var n=Vt(t,e,!0),r=e.dataTransfer.files;if(n&&!Q(t))if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),a=0,l=function(e,r){var l=new FileReader;l.onload=zt(t,function(){if(o[r]=l.result,++a==i){n=ve(t.doc,n);var e={from:n,to:n,text:Ka(o.join("\n")),origin:"paste"};Cn(t.doc,e),Le(t.doc,me(n,Ko(e)))}}),l.readAsText(e)},s=0;i>s;++s)l(r[s],s);else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout(function(){t.display.input.focus()},20);try{var o=e.dataTransfer.getData("Text");if(o){if(t.state.draggingText&&!(Mo?e.altKey:e.ctrlKey))var c=t.listSelections();if(Ae(t.doc,me(n,n)),c)for(var s=0;sa.clientWidth||i&&a.scrollHeight>a.clientHeight){if(i&&Mo&&vo)e:for(var l=t.target,s=o.view;l!=a;l=l.parentNode)for(var c=0;cu?f=Math.max(0,f+u-50):d=Math.min(e.doc.height,d+u+50),A(e,{top:f,bottom:d})}20>$o&&(null==o.wheelStartX?(o.wheelStartX=a.scrollLeft,o.wheelStartY=a.scrollTop,o.wheelDX=r,o.wheelDY=i,setTimeout(function(){if(null!=o.wheelStartX){var e=a.scrollLeft-o.wheelStartX,t=a.scrollTop-o.wheelStartY,n=t&&o.wheelDY&&t/o.wheelDY||e&&o.wheelDX&&e/o.wheelDX;o.wheelStartX=o.wheelStartY=null,n&&(Bo=(Bo*$o+n)/($o+1),++$o)}},200)):(o.wheelDX+=r,o.wheelDY+=i))}}function on(e,t,n){if("string"==typeof t&&(t=oa[t],!t))return!1;e.display.input.ensurePolled();var r=e.display.shift,i=!1;try{Q(e)&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=za}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}function an(e,t,n){for(var r=0;rgo&&27==e.keyCode&&(e.returnValue=!1);var n=e.keyCode;t.display.shift=16==n||e.shiftKey;var r=sn(t,e);xo&&(Go=r?n:null,!r&&88==n&&!Za&&(Mo?e.metaKey:e.ctrlKey)&&t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||fn(t)}}function fn(e){function t(e){18!=e.keyCode&&e.altKey||(Ba(n,"CodeMirror-crosshair"),Ma(document,"keyup",t),Ma(document,"mouseover",t))}var n=e.display.lineDiv;Ua(n,"CodeMirror-crosshair"),Sa(document,"keyup",t),Sa(document,"mouseover",t)}function dn(e){16==e.keyCode&&(this.doc.sel.shift=!1),wi(this,e)}function pn(e){var t=this;if(!(Ut(t.display,e)||wi(t,e)||e.ctrlKey&&!e.altKey||Mo&&e.metaKey)){var n=e.keyCode,r=e.charCode;if(xo&&n==Go)return Go=null,void ka(e);if(!xo||e.which&&!(e.which<10)||!sn(t,e)){var i=String.fromCharCode(null==r?n:r);cn(t,e,i)||t.display.input.onKeyPress(e)}}}function hn(e){e.state.delayingBlurEvent=!0,setTimeout(function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,gn(e))},100)}function mn(e){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(La(e,"focus",e),e.state.focused=!0,Ua(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),vo&&setTimeout(function(){e.display.input.reset(!0)},20)),e.display.input.receivedFocus()),je(e))}function gn(e){e.state.delayingBlurEvent||(e.state.focused&&(La(e,"blur",e),e.state.focused=!1,Ba(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout(function(){e.state.focused||(e.display.shift=!1)},150))}function vn(e,t){Ut(e.display,t)||yn(e,t)||e.display.input.onContextMenu(t)}function yn(e,t){return Si(e,"gutterContextMenu")?Yt(e,t,"gutterContextMenu",!1,La):!1}function bn(e,t){if(No(e,t.from)<0)return e;if(No(e,t.to)<=0)return Ko(t);var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch;return e.line==t.to.line&&(r+=Ko(t).ch-t.to.ch),qo(n,r)}function xn(e,t){for(var n=[],r=0;r=0;--i)Sn(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text});else Sn(e,t)}}function Sn(e,t){if(1!=t.text.length||""!=t.text[0]||0!=No(t.from,t.to)){var n=xn(e,t);li(e,t,n,e.cm?e.cm.curOp.id:0/0),Tn(e,t,n,rr(e,t));var r=[];Gr(e,function(e,n){n||-1!=Ei(r,e.history)||(vi(e.history,t),r.push(e.history)),Tn(e,t,null,rr(e,t))})}}function Mn(e,t,n){if(!e.cm||!e.cm.state.suppressEdits){for(var r,i=e.history,o=e.sel,a="undo"==t?i.done:i.undone,l="undo"==t?i.undone:i.done,s=0;s=0;--s){var f=r.changes[s];if(f.origin=t,u&&!wn(e,f,!1))return void(a.length=0);c.push(ii(e,f));var d=s?xn(e,f):zi(a);Tn(e,f,d,or(e,f)),!s&&e.cm&&e.cm.scrollIntoView({from:f.from,to:Ko(f)});var p=[];Gr(e,function(e,t){t||-1!=Ei(p,e.history)||(vi(e.history,f),p.push(e.history)),Tn(e,f,null,or(e,f))})}}}}function Ln(e,t){if(0!=t&&(e.first+=t,e.sel=new de(Oi(e.sel.ranges,function(e){return new pe(qo(e.anchor.line+t,e.anchor.ch),qo(e.head.line+t,e.head.ch))}),e.sel.primIndex),e.cm)){It(e.cm,e.first,e.first-t,t);for(var n=e.cm.display,r=n.viewFrom;re.lastLine())){if(t.from.lineo&&(t={from:t.from,to:qo(o,Xr(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Zr(e,t.from,t.to),n||(n=xn(e,t)),e.cm?An(e.cm,t,r):Br(e,t,r),Ae(e,n,Ea)}}function An(e,t,n){var r=e.doc,i=e.display,a=t.from,l=t.to,s=!1,c=a.line;e.options.lineWrapping||(c=Jr(gr(Xr(r,a.line))),r.iter(c,l.line+1,function(e){return e==i.maxLine?(s=!0,!0):void 0})),r.sel.contains(t.from,t.to)>-1&&Ci(e),Br(r,t,n,o(e)),e.options.lineWrapping||(r.iter(c,a.line+t.text.length,function(e){var t=f(e);t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,s=!1)}),s&&(e.curOp.updateMaxLine=!0)),r.frontier=Math.min(r.frontier,a.line),Re(e,400);var u=t.text.length-(l.line-a.line)-1;t.full?It(e):a.line!=l.line||1!=t.text.length||$r(e.doc,t)?It(e,a.line,l.line+1,u):Pt(e,a.line,"text");var d=Si(e,"changes"),p=Si(e,"change");if(p||d){var h={from:a,to:l,text:t.text,removed:t.removed,origin:t.origin};p&&_i(e,"change",e,h),d&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(h)}e.display.selForContextMenu=null}function zn(e,t,n,r,i){if(r||(r=n),No(r,n)<0){var o=r;r=n,n=o}"string"==typeof t&&(t=Ka(t)),Cn(e,{from:n,to:r,text:t,origin:i})}function En(e,t){if(!wi(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null;if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!wo){var o=Wi("div","",null,"position: absolute; top: "+(t.top-n.viewOffset-$e(e.display))+"px; height: "+(t.bottom-t.top+Ve(e)+n.barHeight)+"px; left: "+t.left+"px; width: 2px;");e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}function On(e,t,n,r){null==r&&(r=0);for(var i=0;5>i;i++){var o=!1,a=pt(e,t),l=n&&n!=t?pt(e,n):a,s=Nn(e,Math.min(a.left,l.left),Math.min(a.top,l.top)-r,Math.max(a.left,l.left),Math.max(a.bottom,l.bottom)+r),c=e.doc.scrollTop,u=e.doc.scrollLeft;if(null!=s.scrollTop&&(tn(e,s.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(o=!0)),null!=s.scrollLeft&&(nn(e,s.scrollLeft),Math.abs(e.doc.scrollLeft-u)>1&&(o=!0)),!o)break}return a}function qn(e,t,n,r,i){var o=Nn(e,t,n,r,i);null!=o.scrollTop&&tn(e,o.scrollTop),null!=o.scrollLeft&&nn(e,o.scrollLeft)}function Nn(e,t,n,r,i){var o=e.display,a=yt(e.display);0>n&&(n=0);var l=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:o.scroller.scrollTop,s=Ke(e),c={};i-n>s&&(i=n+s);var u=e.doc.height+Be(o),f=a>n,d=i>u-a;if(l>n)c.scrollTop=f?0:n;else if(i>l+s){var p=Math.min(n,(d?u:i)-s);p!=l&&(c.scrollTop=p)}var h=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:o.scroller.scrollLeft,m=Ge(e)-(e.options.fixedGutter?o.gutters.offsetWidth:0),g=r-t>m;return g&&(r=t+m),10>t?c.scrollLeft=0:h>t?c.scrollLeft=Math.max(0,t-(g?0:10)):r>m+h-3&&(c.scrollLeft=r+(g?0:10)-m),c}function In(e,t,n){(null!=t||null!=n)&&Dn(e),null!=t&&(e.curOp.scrollLeft=(null==e.curOp.scrollLeft?e.doc.scrollLeft:e.curOp.scrollLeft)+t),null!=n&&(e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+n)}function Pn(e){Dn(e);var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?qo(t.line,t.ch-1):t,r=qo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function Dn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=ht(e,t.from),r=ht(e,t.to),i=Nn(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function jn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=He(e,t):n="prev");var a=e.options.tabSize,l=Xr(o,t),s=Na(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==za||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Na(Xr(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var f="",d=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)d+=a,f+=" ";if(c>d&&(f+=Ai(c-d)),f!=u)return zn(o,f,qo(t,0),qo(t,u.length),"+input"),l.stateAfter=null,!0;for(var p=0;p=0;t--)zn(e.doc,"",r[t].from,r[t].to,"+delete");Pn(e)})}function Fn(e,t,n,r,i){function o(){var t=l+n;return t=e.first+e.size?f=!1:(l=t,u=Xr(e,t))}function a(e){var t=(i?co:uo)(u,s,n,!0);if(null==t){if(e||!o())return f=!1;s=i?(0>n?no:to)(u):0>n?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=n,u=Xr(e,l),f=!0;
+var t=e.getCursor(),n=t,r=t;e.options.lineWrapping||(n=t.ch?jo(t.line,t.ch-1):t,r=jo(t.line,t.ch+1)),e.curOp.scrollToPos={from:n,to:r,margin:e.options.cursorScrollMargin,isCursor:!0}}function Wn(e){var t=e.curOp.scrollToPos;if(t){e.curOp.scrollToPos=null;var n=mt(e,t.from),r=mt(e,t.to),i=Dn(e,Math.min(n.left,r.left),Math.min(n.top,r.top)-t.margin,Math.max(n.right,r.right),Math.max(n.bottom,r.bottom)+t.margin);e.scrollTo(i.scrollLeft,i.scrollTop)}}function Fn(e,t,n,r){var i,o=e.doc;null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=$e(e,t):n="prev");var a=e.options.tabSize,l=Qr(o,t),s=Wa(l.text,null,a);l.stateAfter&&(l.stateAfter=null);var c,u=l.text.match(/^\s*/)[0];if(r||/\S/.test(l.text)){if("smart"==n&&(c=o.mode.indent(i,l.text.slice(u.length),l.text),c==Ia||c>150)){if(!r)return;n="prev"}}else c=0,n="not";"prev"==n?c=t>o.first?Wa(Qr(o,t-1).text,null,a):0:"add"==n?c=s+e.options.indentUnit:"subtract"==n?c=s-e.options.indentUnit:"number"==typeof n&&(c=s+n),c=Math.max(0,c);var d="",f=0;if(e.options.indentWithTabs)for(var p=Math.floor(c/a);p;--p)f+=a,d+=" ";if(c>f&&(d+=Oi(c-f)),d!=u)return qn(o,d,jo(t,0),jo(t,u.length),"+input"),l.stateAfter=null,!0;for(var p=0;p=0;t--)qn(e.doc,"",r[t].from,r[t].to,"+delete");Rn(e)})}function Bn(e,t,n,r,i){function o(){var t=l+n;return t=e.first+e.size?!1:(l=t,u=Qr(e,t))}function a(e){var t=(i?po:ho)(u,s,n,!0);if(null==t){if(e||!o())return!1;s=i?(0>n?oo:io)(u):0>n?u.text.length:0}else s=t;return!0}var l=t.line,s=t.ch,c=n,u=Qr(e,l);if("char"==r)a();else if("column"==r)a(!0);else if("word"==r||"group"==r)for(var d=null,f="group"==r,p=e.cm&&e.cm.getHelper(t,"wordChars"),h=!0;!(0>n)||a(!h);h=!1){var m=u.text.charAt(s)||"\n",g=Wi(m,p)?"w":f&&"\n"==m?"n":!f||/\s/.test(m)?null:"p";if(!f||h||g||(g="s"),d&&d!=g){0>n&&(n=1,a());break}if(g&&(d=g),n>0&&!a(!h))break}var v=qe(e,jo(l,s),t,c,!0);return Ro(t,v)||(v.hitSide=!0),v}function Un(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(l-(0>n?1.5:.5)*bt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var s=vt(e,a,i);if(!s.outside)break;if(0>n?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*n}return s}function Vn(t,n,r,i){e.defaults[t]=n,r&&(ta[t]=i?function(e,t,n){n!=na&&r(e,t,n)}:r)}function Gn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=$i("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(yr(e,t.line,t,n,o)||t.line!=n.line&&yr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Do=!0}o.addToHistory&&ui(e,{from:t,to:n,origin:"markText"},e.sel,0/0);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&br(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&ti(e,0),rr(e,new er(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){wr(e,t)&&ti(t,0)}),o.clearOnEnter&&za(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Io=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ga,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)It(c,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=n.line;u++)Dt(c,u,"text");o.atomic&&ze(c.doc),Si(c,"markerAdded",c,o)}return o}function Xn(e,t,n,r,i){r=ji(r),r.shared=!1;var o=[Zn(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Xr(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Zn(e,ge(e,t),ge(e,n),r,i));for(var s=0;s=t:o.to>t);(r||(r=[])).push(new er(a,o.from,s?null:o.to))}}return r}function or(e,t,n){if(e)for(var r,i=0;i=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var d=0;dd;++d)h.push(m);h.push(s)}return h}function lr(e){for(var t=0;t0)){var u=[s,1],d=Ro(c.from,l.from),f=Ro(c.to,l.to);(0>d||!a.inclusiveLeft&&!d)&&u.push({from:c.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function ur(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&0>=d||0>=u&&d>=0)&&(0>=u&&(Ro(c.to,n)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(Ro(c.from,r)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function br(e){for(var t;t=gr(e);)e=t.find(-1,!0).line;return e}function xr(e){for(var t,n;t=vr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function kr(e,t){var n=Qr(e,t),r=br(n);return n==r?t:ni(r)}function _r(e,t){if(t>e.lastLine())return t;var n,r=Qr(e,t);if(!wr(e,r))return t;for(;n=vr(r);)r=n.find(1,!0).line;return ni(r)+1}function wr(e,t){var n=Do&&t.markedSpans;if(n)for(var r,i=0;io;o++){i&&(i[0]=e.innerMode(t,r).mode);var a=t.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function qr(e,t,n,r){function i(e){return{start:d.start,end:d.pos,string:d.current(),type:o||null,state:e?sa(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ge(a,t);var s,c=Qr(a,t.line),u=$e(e,t.line,n),d=new ma(c.text,e.options.tabSize);for(r&&(s=[]);(r||d.pose.options.maxHighlightLength?(l=!1,a&&Dr(e,t,r,d.pos),d.pos=t.length,s=null):s=zr(Or(n,d,r,f),o),f){var p=f[0].name;p&&(s="m-"+(s?p+" "+s:p))}if(!l||u!=s){for(;cc;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"cm-overlay "+t),s=n+2;else for(;s>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function Ir(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=$e(e,ni(t)),i=Pr(e,t,t.text.length>e.options.maxHighlightLength?sa(e.doc.mode,r):r);t.stateAfter=r,t.styles=i.styles,i.classes?t.styleClasses=i.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Dr(e,t,n,r){var i=e.doc.mode,o=new ma(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Er(i,n);!o.eol();)Or(i,o,n),o.start=o.pos}function jr(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?_a:ka;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Rr(e,t){var n=$i("span",null,null,_o?"padding-right: .1px":null),r={pre:$i("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,splitSpaces:(xo||_o)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=Fr,Ji(e.display.measure)&&(o=oi(a))&&(r.addToken=$r(r.addToken,o)),r.map=[];var l=t!=e.display.externalMeasured&&ni(a);Ur(a,r,Ir(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=Ki(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=Ki(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Qi(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return _o&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),qa(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ki(r.pre.className,r.textClass||"")),r}function Wr(e){var t=$i("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Fr(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Hr):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),d=0;;){s.lastIndex=d;var f=s.exec(t),p=f?f.index-d:t.length-d;if(p){var h=document.createTextNode(l.slice(d,d+p));u.appendChild(xo&&9>ko?$i("span",[h]):h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!f)break;if(d+=p+1," "==f[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild($i("span",Oi(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text"," "),e.col+=g}else if("\r"==f[0]||"\n"==f[0]){var h=u.appendChild($i("span","\r"==f[0]?"␍":"","cm-invalidchar"));h.setAttribute("cm-text",f[0]),e.col+=1}else{var h=e.cm.options.specialCharPlaceholder(f[0]);h.setAttribute("cm-text",f[0]),u.appendChild(xo&&9>ko?$i("span",[h]):h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),xo&&9>ko&&(c=!0),e.pos+=t.length}if(n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=$i("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Hr(e){for(var t=" ",n=0;nc&&f.from<=c)break}if(f.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,f.to-c),i,o,null,l,s),o=null,r=r.slice(f.to-c),c=f.to}}}function Br(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Ur(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,d,f,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){s=c=u=d=l="",f=null,v=1/0;for(var y,b=[],x=0;xh||_.collapsed&&k.to==h&&k.from==h)?(null!=k.to&&k.to!=h&&v>k.to&&(v=k.to,c=""),_.className&&(s+=" "+_.className),_.css&&(l=(l?l+";":"")+_.css),_.startStyle&&k.from==h&&(u+=" "+_.startStyle),_.endStyle&&k.to==v&&(y||(y=[])).push(_.endStyle,k.to),_.title&&!d&&(d=_.title),_.collapsed&&(!f||hr(f.marker,_)<0)&&(f=k)):k.from>h&&v>k.from&&(v=k.from)}if(y)for(var x=0;x=p)break;for(var w=Math.min(p,v);;){if(g){var C=h+g.length;if(!f){var S=C>w?g.slice(0,w-h):g;t.addToken(t,S,a?a+s:s,u,h+S.length==v?c:"",d,l)}if(C>=w){g=g.slice(w-h),h=w;break}h=C,u=""}g=i.slice(o,o=n[m++]),a=jr(n[m++],t.cm.options)}}else for(var m=1;mn;++n)o.push(new xa(c[n],i(n),r));return o}var l=t.from,s=t.to,c=t.text,u=Qr(e,l.line),d=Qr(e,s.line),f=qi(c),p=i(c.length-1),h=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if(Vr(e,t)){var m=a(0,c.length-1);o(d,d.text,p),h&&e.remove(l.line,h),m.length&&e.insert(l.line,m)}else if(u==d)if(1==c.length)o(u,u.text.slice(0,l.ch)+f+u.text.slice(s.ch),p);else{var m=a(1,c.length-1);m.push(new xa(f+u.text.slice(s.ch),p,r)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,h);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(d,f+d.text.slice(s.ch),p);var m=a(1,c.length-1);h>1&&e.remove(l.line+1,h-1),e.insert(l.line+1,m)}Si(e,"change",e,t)}function Kr(e){this.lines=e,this.parent=null;for(var t=0,n=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(o>t){n=i;break}t-=o}return n.lines[t]}function Jr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function ei(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function ti(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function ni(e){if(null==e.parent)return null;for(var t=e.parent,n=Ni(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ri(e,t){var n=e.first;e:do{for(var r=0;rt){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;rt)break;t-=l}return n+r}function ii(e){e=br(e);for(var t=0,n=e.parent,r=0;r1&&!e.done[e.done.length-2].ranges?(e.done.pop(),qi(e.done)):void 0}function ui(e,t,n,r){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ci(i,i.lastOp==r))){var l=qi(o.changes);0==Ro(t.from,t.to)&&0==Ro(t.from,l.to)?l.to=Jo(t):o.changes.push(li(e,t))}else{var s=qi(i.done);for(s&&s.ranges||pi(e.sel,i.done),o={changes:[li(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||qa(e,"historyAdded")}}function di(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function fi(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||di(e,o,qi(i.done),t))?i.done[i.done.length-1]=t:pi(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&si(i.undone)}function pi(e,t){var n=qi(t);n&&n.ranges&&n.equals(e)||t.push(e)}function hi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function mi(e){if(!e)return null;for(var t,n=0;n-1&&(qi(l)[d]=u[d],delete u[d])}}}return i}function yi(e,t,n,r){n0?r.slice():Ea:r||Ea}function Si(e,t){function n(e){return function(){e.apply(null,o)}}var r=Ci(e,t,!1);if(r.length){var i,o=Array.prototype.slice.call(arguments,2);Uo?i=Uo.delayedCallbacks:Na?i=Na:(i=Na=[],setTimeout(Mi,0));for(var a=0;a0}function zi(e){e.prototype.on=function(e,t){za(this,e,t)},e.prototype.off=function(e,t){Oa(this,e,t)}}function Ei(){this.id=null}function Oi(e){for(;Ha.length<=e;)Ha.push(qi(Ha)+" ");return Ha[e]}function qi(e){return e[e.length-1]}function Ni(e,t){for(var n=0;n-1&&Va(e)?!0:t.test(e):Va(e)}function Fi(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Hi(e){return e.charCodeAt(0)>=768&&Ga.test(e)}function $i(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Ui(e,t){return Bi(e).appendChild(t)}function Vi(){for(var e=document.activeElement;e&&e.root&&e.root.activeElement;)e=e.root.activeElement;return e}function Gi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Ki(e,t){for(var n=e.split(" "),r=0;r2&&!(xo&&8>ko))}var n=Za?$i("span",""):$i("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Ji(e){if(null!=Xa)return Xa;var t=Ui(e,document.createTextNode("AخA")),n=Ba(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Ba(t,1,2).getBoundingClientRect();return Xa=r.right-n.right<3}function eo(e){if(null!=il)return il;var t=Ui(e,$i("span","x")),n=t.getBoundingClientRect(),r=Ba(t,0,1).getBoundingClientRect();return il=Math.abs(n.left-r.left)>1}function to(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function no(e){return e.level%2?e.to:e.from}function ro(e){return e.level%2?e.from:e.to}function io(e){var t=oi(e);return t?no(t[0]):0}function oo(e){var t=oi(e);return t?ro(qi(t)):e.text.length}function ao(e,t){var n=Qr(e.doc,t),r=br(n);r!=n&&(t=ni(r));var i=oi(r),o=i?i[0].level%2?oo(r):io(r):0;return jo(t,o)}function lo(e,t){for(var n,r=Qr(e.doc,t);n=vr(r);)r=n.find(1,!0).line,t=null;var i=oi(r),o=i?i[0].level%2?io(r):oo(r):r.text.length;return jo(null==t?ni(r):t,o)}function so(e,t){var n=ao(e,t.line),r=Qr(e.doc,n.line),i=oi(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return jo(n.line,a?0:o)}return n}function co(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:n>t}function uo(e,t){al=null;for(var n,r=0;rt)return r;if(i.from==t||i.to==t){if(null!=n)return co(e,i.level,e[n].level)?(i.from!=i.to&&(al=n),r):(i.from!=i.to&&(al=r),n);n=r}}return n}function fo(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Hi(e.text.charAt(t)));return t}function po(e,t,n,r){var i=oi(e);if(!i)return ho(e,t,n,r);for(var o=uo(i,t),a=i[o],l=fo(e,t,a.level%2?-n:n,r);;){if(l>a.from&&l0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;l=n>0==a.level%2?fo(e,a.to,-1,r):fo(e,a.from,1,r)}}function ho(e,t,n,r){var i=t+n;if(r)for(;i>0&&Hi(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var mo=navigator.userAgent,go=navigator.platform,vo=/gecko\/\d/i.test(mo),yo=/MSIE \d/.test(mo),bo=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(mo),xo=yo||bo,ko=xo&&(yo?document.documentMode||6:bo[1]),_o=/WebKit\//.test(mo),wo=_o&&/Qt\/\d+\.\d+/.test(mo),Co=/Chrome\//.test(mo),So=/Opera\//.test(mo),Mo=/Apple Computer/.test(navigator.vendor),Lo=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(mo),To=/PhantomJS/.test(mo),Ao=/AppleWebKit/.test(mo)&&/Mobile\/\w+/.test(mo),zo=Ao||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(mo),Eo=Ao||/Mac/.test(go),Oo=/win/i.test(go),qo=So&&mo.match(/Version\/(\d*\.\d*)/);qo&&(qo=Number(qo[1])),qo&&qo>=15&&(So=!1,_o=!0);var No=Eo&&(wo||So&&(null==qo||12.11>qo)),Po=vo||xo&&ko>=9,Io=!1,Do=!1;m.prototype=ji({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert)},zeroWidthHack:function(){var e=Eo&&!Lo?"12px":"18px";this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Ei,this.disableVert=new Ei},enableZeroWidthBar:function(e,t){function n(){var r=e.getBoundingClientRect(),i=document.elementFromPoint(r.left+1,r.bottom-1);i!=e?e.style.pointerEvents="none":t.set(1e3,n)}e.style.pointerEvents="auto",t.set(1e3,n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=ji({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={
+"native":m,"null":g},S.prototype.signal=function(e,t){Ai(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),za(o,"paste",function(e){Li(r,e)||J(e,r)||(r.state.pasteIncoming=!0,n.fastPoll())}),za(o,"cut",t),za(o,"copy",t),za(e.scroller,"paste",function(t){Vt(e,t)||Li(r,t)||(r.state.pasteIncoming=!0,n.focus())}),za(e.lineSpace,"selectstart",function(t){Vt(e,t)||La(t)}),za(o,"compositionstart",function(){var e=r.getCursor("from");n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),za(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=Ie(e);if(e.options.moveInputWithCursor){var i=ht(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;Ui(n.cursorDiv,e.cursors),Ui(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=rl&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.composing||(this.textarea.value=a),r.state.focused&&$a(this.textarea),xo&&ko>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),xo&&ko>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!zo||Vi()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||nl(t)&&!n&&!this.composing||e.isReadOnly()||e.options.disableInput||e.state.keySeq)return!1;var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(xo&&ko>=9&&this.hasSelection===r||Eo&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);a>o&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var l=this;return zt(e,function(){Q(e,r.slice(o),n.length-o,null,l.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=r,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){xo&&ko>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.position="relative",a.style.cssText=u,xo&&9>ko&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!xo||xo&&9>ko)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==r.prevInput?Et(i,ua.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,l=Gt(i,e),s=o.scroller.scrollTop;if(l&&!So){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&Et(i,Le)(i.doc,he(l),Da);var u=a.style.cssText;if(r.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(xo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",_o)var d=window.scrollY;if(o.input.focus(),_o&&window.scrollTo(null,d),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),xo&&ko>=9&&t(),Po){Aa(e);var f=function(){Oa(window,"mouseup",f),setTimeout(n,20)};za(window,"mouseup",f)}else setTimeout(n,50)}},readOnlyChanged:function(e){e||this.reset()},setUneditable:Ii,needsContentAttribute:!1},re.prototype),oe.prototype=ji({init:function(e){function t(e){if(!Li(r,e)){if(r.somethingSelected())Wo=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=te(r);Wo=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Da),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Ao)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Wo.join("\n"));else{var n=ie(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Wo.join("\n");var o=document.activeElement;$a(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}}var n=this,r=n.cm,i=n.div=e.lineDiv;ne(i),za(i,"paste",function(e){Li(r,e)||J(e,r)}),za(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(n.composing.sel=he(jo(i.head.line,a),jo(i.head.line,a+t.length)))}}),za(i,"compositionupdate",function(e){n.composing.data=e.data}),za(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t),n.composing==t&&(n.composing=null)},50))}),za(i,"touchstart",function(){n.forceCompositionEnd()}),za(i,"input",function(){n.composing||(r.isReadOnly()||!n.pollContent())&&zt(n.cm,function(){It(r)})}),za(i,"copy",t),za(i,"cut",t)},prepareSelection:function(){var e=Ie(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=se(this.cm,e.anchorNode,e.anchorOffset),r=se(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=Ro(X(n,r),t.from())||0!=Ro(Z(n,r),t.to())){var i=ae(this.cm,t.from()),o=ae(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Ba(i.node,i.offset,o.offset,o.node)}catch(d){}u&&(!vo&&this.cm.state.focused?(e.collapse(i.node,i.offset),u.collapsed||e.addRange(u)):(e.removeAllRanges(),e.addRange(u)),l&&null==e.anchorNode?e.addRange(l):vo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Ui(this.cm.display.cursorDiv,e.cursors),Ui(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Ka(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():zt(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=se(t,e.anchorNode,e.anchorOffset),r=se(t,e.focusNode,e.focusOffset);n&&r&&zt(t,function(){Le(t.doc,he(n,r),Da),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.linet.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=Rt(e,r.line)))var a=ni(t.view[0].line),l=t.view[0].node;else var a=ni(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=Rt(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=ni(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var d=e.doc.splitLines(ue(e,l,u,a,c)),f=Jr(e.doc,jo(a,0),jo(c,Qr(e.doc,c).text.length));d.length>1&&f.length>1;)if(qi(d)==qi(f))d.pop(),f.pop(),c--;else{if(d[0]!=f[0])break;d.shift(),f.shift(),a++}for(var p=0,h=0,m=d[0],g=f[0],v=Math.min(m.length,g.length);v>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=qi(d),b=qi(f),x=Math.min(y.length-(1==d.length?p:0),b.length-(1==f.length?p:0));x>h&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;d[d.length-1]=y.slice(0,y.length-h),d[0]=d[0].slice(p);var k=jo(a,p),_=jo(c,f.length?qi(f).length-h:0);return d.length>1||d[0]||Ro(k,_)?(qn(e.doc,d,k,_,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){this.cm.isReadOnly()?Et(this.cm,It)(this.cm):e.data&&e.data!=e.startData&&Et(this.cm,Q)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.contentEditable="false"},onKeyPress:function(e){e.preventDefault(),this.cm.isReadOnly()||Et(this.cm,Q)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},readOnlyChanged:function(e){this.div.contentEditable=String("nocursor"!=e)},onContextMenu:Ii,resetPosition:Ii,needsContentAttribute:!0},oe.prototype),e.inputStyles={textarea:re,contenteditable:oe},de.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&Ro(e,r.to())<=0)return n}return-1}},fe.prototype={from:function(){return X(this.anchor,this.head)},to:function(){return Z(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Fo,Ho,$o,Bo={left:0,right:0,top:0,bottom:0},Uo=null,Vo=0,Go=0,Ko=0,Zo=null;xo?Zo=-.53:vo?Zo=15:Co?Zo=-.7:Mo&&(Zo=-1/3);var Xo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=Xo(e);return t.x*=Zo,t.y*=Zo,t};var Yo=new Ei,Qo=null,Jo=e.changeEnd=function(e){return e.text?jo(e.from.line+e.text.length-1,qi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];(n[e]!=t||"mode"==e)&&(n[e]=t,ta.hasOwnProperty(e)&&Et(this,ta[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Kn(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(Fn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Rn(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;n>s;++s)Fn(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&we(this.doc,r,new fe(o,c[r].to()),Da)}}}),getTokenAt:function(e,t){return qr(this,e,t)},getLineTokens:function(e,t){return qr(this,jo(e),t,!0)},getTokenTypeAt:function(e){e=ge(this.doc,e);var t,n=Ir(this,Qr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!la.hasOwnProperty(t))return n;var r=la[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,r=!0),n=Qr(this.doc,e)}else n=e;return dt(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-ii(n):0)},defaultTextHeight:function(){return bt(this.display)},defaultCharWidth:function(){return xt(this.display)},setGutterMarker:Ot(function(e,t,n){return Hn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&Fi(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Ot(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Dt(t,r,"gutter"),Fi(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!ye(this.doc,e))return null;var t=e;if(e=Qr(this.doc,e),!e)return null}else{var t=ni(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=ht(this,ge(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&In(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Ot(pn),triggerOnKeyPress:Ot(gn),triggerOnKeyUp:mn,execCommand:function(e){return ua.hasOwnProperty(e)?ua[e].call(null,this):void 0},triggerElectric:Ot(function(e){ee(this,e)}),findPosH:function(e,t,n,r){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ge(this.doc,e);t>o&&(a=Bn(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:Ot(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Bn(n.doc,r.head,e,t,n.options.rtlMoveVisually):0>e?r.from():r.to()},Ra)}),deleteH:Ot(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):$n(this,function(n){var i=Bn(r,n.head,e,t,!1);return 0>e?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;0>t&&(i=-1,t=-t);for(var a=0,l=ge(this.doc,e);t>a;++a){var s=ht(this,l,"div");if(null==o?o=s.left:s.left=o,l=Un(this,s,i,n),l.hitSide)break}return l},moveV:Ot(function(e,t){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=ht(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Un(n,l,e,t);return"page"==t&&a==r.sel.primary()&&jn(n,null,pt(n,s,"div").top-l.top),s},Ra),i.length)for(var a=0;a0&&l(n.charAt(r-1));)--r;for(;i.5)&&a(this),qa(this,"refresh",this)}),swapDoc:Ot(function(e){var t=this.doc;return t.cm=null,Yr(this,e),st(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,Si(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},zi(e);var ea=e.defaults={},ta=e.optionHandlers={},na=e.Init={toString:function(){return"CodeMirror.Init"}};Vn("value","",function(e,t){e.setValue(t)},!0),Vn("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),Vn("indentUnit",2,n,!0),Vn("indentWithTabs",!1),Vn("smartIndent",!0),Vn("tabSize",4,function(e){r(e),st(e),It(e)},!0),Vn("lineSeparator",null,function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first;e.doc.iter(function(e){for(var i=0;;){var o=e.text.indexOf(t,i);if(-1==o)break;i=o+t.length,n.push(jo(r,o))}r++});for(var i=n.length-1;i>=0;i--)qn(e.doc,t,n[i],jo(n[i].line,n[i].ch+t.length))}}),Vn("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),r!=e.Init&&t.refresh()}),Vn("specialCharPlaceholder",Wr,function(e){e.refresh()},!0),Vn("electricChars",!0),Vn("inputStyle",zo?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),Vn("rtlMoveVisually",!Oo),Vn("wholeLineUpdateBefore",!0),Vn("theme","default",function(e){l(e),s(e)},!0),Vn("keyMap","default",function(t,n,r){var i=Kn(n),o=r!=e.Init&&Kn(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),Vn("extraKeys",null),Vn("lineWrapping",!1,i,!0),Vn("gutters",[],function(e){p(e.options),s(e)},!0),Vn("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),Vn("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),Vn("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),Vn("lineNumbers",!1,function(e){p(e.options),s(e)},!0),Vn("firstLineNumber",1,s,!0),Vn("lineNumberFormatter",function(e){return e},s,!0),Vn("showCursorWhenSelecting",!1,Pe,!0),Vn("resetSelectionOnContextMenu",!0),Vn("lineWiseCopyCut",!0),Vn("readOnly",!1,function(e,t){"nocursor"==t?(bn(e),e.display.input.blur(),e.display.disabled=!0):e.display.disabled=!1,e.display.input.readOnlyChanged(t)}),Vn("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),Vn("dragDrop",!0,Bt),Vn("allowDropFileTypes",null),Vn("cursorBlinkRate",530),Vn("cursorScrollMargin",0),Vn("cursorHeight",1,Pe,!0),Vn("singleCursorHeightPerLine",!0,Pe,!0),Vn("workTime",100),Vn("workDelay",100),Vn("flattenSpans",!0,r,!0),Vn("addModeClass",!1,r,!0),Vn("pollInterval",100),Vn("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),Vn("historyEventDelay",1250),Vn("viewportMargin",10,function(e){e.refresh()},!0),Vn("maxHighlightLength",1e4,r,!0),Vn("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),Vn("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),Vn("autofocus",null);var ra=e.modes={},ia=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),ra[t]=n},e.defineMIME=function(e,t){ia[e]=t},e.resolveMode=function(t){if("string"==typeof t&&ia.hasOwnProperty(t))t=ia[t];else if(t&&"string"==typeof t.name&&ia.hasOwnProperty(t.name)){var n=ia[t.name];"string"==typeof n&&(n={name:n}),t=Di(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=ra[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(oa.hasOwnProperty(n.name)){var o=oa[n.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var oa=e.modeExtensions={};e.extendMode=function(e,t){var n=oa.hasOwnProperty(e)?oa[e]:oa[e]={};ji(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){Ca.prototype[e]=t},e.defineOption=Vn;var aa=[];e.defineInitHook=function(e){aa.push(e)};var la=e.helpers={};e.registerHelper=function(t,n,r){la.hasOwnProperty(t)||(la[t]=e[t]={_global:[]}),la[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),la[t]._global.push({pred:r,val:i})};var sa=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},ca=e.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var ua=e.commands={selectAll:function(e){e.setSelection(jo(e.firstLine(),0),jo(e.lastLine()),Da)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Da)},killLine:function(e){$n(e,function(t){if(t.empty()){var n=Qr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new jo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),jo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Qr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),jo(i.line-1,a.length-1),jo(i.line,1),"+transpose")}n.push(new fe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){zt(e,function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];e.replaceRange(e.doc.lineSeparator(),r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0)}Rn(e)})},toggleOverwrite:function(e){e.toggleOverwrite()}},da=e.keyMap={};da.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",
+Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},da.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},da.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},da.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},da["default"]=Eo?da.macDefault:da.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Pi(n.split(" "),Gn),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var ga=0,va=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ga};zi(va),va.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&kt(e),Ai(this,"clear")){var n=this.find();n&&Si(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&It(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&ze(e.doc)),e&&Si(e,"markerCleared",e,this),t&&wt(e),this.parent&&this.parent.clear()}},va.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,r,i=0;in;++n){var i=this.lines[n];this.height-=i.height,Ar(i),Si(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;re;++e)if(n(this.lines[e]))return!0}},Zr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;ne){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Kr))){var l=[];this.collapse(l),this.children=[new Kr(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new Kr(a);i.height-=l.height,this.children.splice(r+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Zr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Ni(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Zr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var wa=0,Ca=e.Doc=function(e,t,n,r){if(!(this instanceof Ca))return new Ca(e,t,n,r);null==n&&(n=0),Zr.call(this,[new Kr([new xa("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var i=jo(n,0);this.sel=he(i),this.history=new ai(null),this.id=++wa,this.modeOption=t,this.lineSep=r,this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Gr(this,{from:i,to:i,text:e}),Le(this,he(i),Da)};Ca.prototype=Di(Zr.prototype,{constructor:Ca,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r=0;o--)Ln(this,r[o]);l?Me(this,l):this.cm&&Rn(this.cm)}),undo:qt(function(){An(this,"undo")}),redo:qt(function(){An(this,"redo")}),undoSelection:qt(function(){An(this,"undo",!0)}),redoSelection:qt(function(){An(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ge(this,e),t=ge(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;ls.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(t=e,!0):(e-=i,void++n)}),ge(this,jo(n,t))},indexFromPos:function(e){e=ge(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.tol||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}},Fa=e.findColumn=function(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}},Ha=[""],$a=function(e){e.select()};Ao?$a=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:xo&&($a=function(e){try{e.select()}catch(t){}});var Ba,Ua=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Va=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Ua.test(e))},Ga=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Ba=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Ka=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};xo&&11>ko&&(Vi=function(){try{return document.activeElement}catch(e){return document.body}});var Za,Xa,Ya=e.rmClass=function(e,t){var n=e.className,r=Gi(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},Qa=e.addClass=function(e,t){var n=e.className;Gi(t).test(n)||(e.className+=(n?" ":"")+t)},Ja=!1,el=function(){if(xo&&9>ko)return!1;var e=$i("div");return"draggable"in e||"dragDrop"in e}(),tl=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;r>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},nl=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},rl=function(){var e=$i("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),il=null,ol=e.keyNames={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};!function(){for(var e=0;10>e;e++)ol[e+48]=ol[e+96]=String(e);for(var e=65;90>=e;e++)ol[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)ol[e+111]=ol[e+63235]="F"+e}();var al,ll=function(){function e(e){return 247>=e?n.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?r.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,d=[],f=0;u>f;++f)d.push(r=e(n.charCodeAt(f)));for(var f=0,p=c;u>f;++f){var r=d[f];"m"==r?d[f]=p:p=r}for(var f=0,h=c;u>f;++f){var r=d[f];"1"==r&&"r"==h?d[f]="n":a.test(r)&&(h=r,"r"==r&&(d[f]="R"))}for(var f=1,p=d[0];u-1>f;++f){var r=d[f];"+"==r&&"1"==p&&"1"==d[f+1]?d[f]="1":","!=r||p!=d[f+1]||"1"!=p&&"n"!=p||(d[f]=p),p=r}for(var f=0;u>f;++f){var r=d[f];if(","==r)d[f]="N";else if("%"==r){for(var m=f+1;u>m&&"%"==d[m];++m);for(var g=f&&"!"==d[f-1]||u>m&&"1"==d[m]?"1":"N",v=f;m>v;++v)d[v]=g;f=m-1}}for(var f=0,h=c;u>f;++f){var r=d[f];"L"==h&&"1"==r?d[f]="L":a.test(r)&&(h=r)}for(var f=0;u>f;++f)if(o.test(d[f])){for(var m=f+1;u>m&&o.test(d[m]);++m);for(var y="L"==(f?d[f-1]:c),b="L"==(u>m?d[m]:c),g=y||b?"L":"R",v=f;m>v;++v)d[v]=g;f=m-1}for(var x,k=[],f=0;u>f;)if(l.test(d[f])){var _=f;for(++f;u>f&&l.test(d[f]);++f);k.push(new t(0,_,f))}else{var w=f,C=k.length;for(++f;u>f&&"L"!=d[f];++f);for(var v=w;f>v;)if(s.test(d[v])){v>w&&k.splice(C,0,new t(1,w,v));var S=v;for(++v;f>v&&s.test(d[v]);++v);k.splice(C,0,new t(2,S,v)),w=v}else++v;f>w&&k.splice(C,0,new t(1,w,f))}return 1==k[0].level&&(x=n.match(/^\s+/))&&(k[0].from=x[0].length,k.unshift(new t(0,0,x[0].length))),1==qi(k).level&&(x=n.match(/\s+$/))&&(qi(k).to-=x[0].length,k.push(new t(0,u-x[0].length,u))),2==k[0].level&&k.unshift(new t(1,k[0].to,k[0].to)),k[0].level!=qi(k).level&&k.push(new t(k[0].level,u,u)),k}}();return e.version="5.10.1",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)2){r.pending=[];for(var f=2;f-1)return e.Pass;var a=r.indent.length-1,l=t[r.state];e:for(;;){for(var c=0;ca?0:r.indent[a]}}e.defineSimpleMode=function(t,n){e.defineMode(t,function(t){return e.simpleMode(t,n)})},e.simpleMode=function(n,r){t(r,"start");var a={},l=r.meta||{},s=!1;for(var u in r)if(u!=l&&r.hasOwnProperty(u))for(var d=a[u]=[],f=r[u],p=0;p-1?i+t.length:i}var o=t.exec(n?e.slice(n):e);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,l=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var s=a.close?n(l,a.close,i.pos,a.parseDelimiters):-1;if(s==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle&&a.delimStyle+" "+a.delimStyle+"-close";s>-1&&(i.string=l.slice(0,s));var c=a.mode.token(i,o.inner);return s>-1&&(i.string=l),s==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,l=i.string,d=0;ds&&(u=s)}u!=1/0&&(i.string=l.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=l),p},indent:function(n,r){var i=n.innerActive?n.innerActive.mode:t;return i.indent?i.indent(n.innerActive?n.inner:n.outer,r):e.Pass},blankLine:function(n){var i=n.innerActive?n.innerActive.mode:t;if(i.blankLine&&i.blankLine(n.innerActive?n.inner:n.outer),n.innerActive)"\n"===n.innerActive.close&&(n.innerActive=n.inner=null);else for(var o=0;o-1)return u=n(s,c,u),{from:r(o.line,u),to:r(o.line,u+a.length)}}else{var s=e.getLine(o.line).slice(o.ch),c=l(s),u=c.indexOf(t);if(u>-1)return u=n(s,c,u)+o.ch,{from:r(o.line,u),to:r(o.line,u+a.length)}}}:function(){};else{var c=a.split("\n");this.matches=function(t,n){var i=s.length-1;if(t){if(n.line-(s.length-1)=1;--u,--a)if(s[u]!=l(e.getLine(a)))return;var d=e.getLine(a),f=d.length-c[0].length;if(l(d.slice(f))!=s[0])return;return{from:r(a,f),to:o}}if(!(n.line+(s.length-1)>e.lastLine())){var d=e.getLine(n.line),f=d.length-c[0].length;if(l(d.slice(f))==s[0]){for(var p=r(n.line,f),a=n.line+1,u=1;i>u;++u,++a)if(s[u]!=l(e.getLine(a)))return;if(l(e.getLine(a).slice(0,c[i].length))==s[i])return{from:p,to:r(a,c[i].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var r=Math.min(n,e.length);;){var i=e.slice(0,r).toLowerCase().length;if(n>i)++r;else{if(!(i>n))return r;--r}}}var r=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=r(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=r(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=r(i.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t,n){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,n),this.pos.to=r(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),e.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)}),e.defineExtension("selectMatches",function(t,n){for(var r=[],i=this.getSearchCursor(t,this.getCursor("from"),n);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length||1,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function r(e){return e.state.search||(e.state.search=new n)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,n){return e.getSearchCursor(t,n,i(t))}function a(e,t,n,r){e.openDialog(t,r,{value:n,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){h(e)}})}function l(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function s(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function c(e){return e.replace(/\\(.)/g,function(e,t){return"n"==t?"\n":"r"==t?"\r":t})}function u(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(n){}else e=c(e);return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function d(e,n,r){n.queryText=r,n.query=u(r),e.removeOverlay(n.overlay,i(n.query)),n.overlay=t(n.query,i(n.query)),e.addOverlay(n.overlay),e.showMatchesOnScrollbar&&(n.annotate&&(n.annotate.clear(),n.annotate=null),n.annotate=e.showMatchesOnScrollbar(n.query,i(n.query)))}function f(t,n,i){var o=r(t);if(o.query)return p(t,n);var s=t.getSelection()||o.lastQuery;if(i&&t.openDialog){var c=null;a(t,v,s,function(n,r){e.e_stop(r),n&&(n!=o.queryText&&d(t,o,n),c&&(c.style.opacity=1),p(t,r.shiftKey,function(e,n){var r;n.line<3&&document.querySelector&&(r=t.display.wrapper.querySelector(".CodeMirror-dialog"))&&r.getBoundingClientRect().bottom-4>t.cursorCoords(n,"window").top&&((c=r).style.opacity=.4)}))})}else l(t,v,"Search for:",s,function(e){e&&!o.query&&t.operation(function(){d(t,o,e),o.posFrom=o.posTo=t.getCursor(),p(t,n)})})}function p(t,n,i){t.operation(function(){var a=r(t),l=o(t,a.query,n?a.posFrom:a.posTo);(l.find(n)||(l=o(t,a.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),l.find(n)))&&(t.setSelection(l.from(),l.to()),t.scrollIntoView({from:l.from(),to:l.to()},20),a.posFrom=l.from(),a.posTo=l.to(),i&&i(l.from(),l.to()))})}function h(e){e.operation(function(){var t=r(e);t.lastQuery=t.query,t.query&&(t.query=t.queryText=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function m(e,t,n){e.operation(function(){for(var r=o(e,t);r.findNext();)if("string"!=typeof t){var i=e.getRange(r.from(),r.to()).match(t);r.replace(n.replace(/\$(\d)/g,function(e,t){return i[t]}))}else r.replace(n)})}function g(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||r(e).lastQuery,i=t?"Replace all:":"Replace:";l(e,i+y,i,n,function(n){n&&(n=u(n),l(e,b,"Replace with:","",function(r){if(r=c(r),t)m(e,n,r);else{h(e);var i=o(e,n,e.getCursor()),a=function(){var t,c=i.from();!(t=i.findNext())&&(i=o(e,n),!(t=i.findNext())||c&&i.from().line==c.line&&i.from().ch==c.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),s(e,x,"Replace?",[function(){l(t)},a,function(){m(e,n,r)}]))},l=function(e){i.replace("string"==typeof n?r:r.replace(/\$(\d)/g,function(t,n){return e[n]})),a()};a()}}))})}}var v='Search: (Use /re/ syntax for regexp search)',y=' (Use /re/ syntax for regexp search)',b='With: ',x="Replace? ";e.commands.find=function(e){h(e),f(e)},e.commands.findPersistent=function(e){h(e),f(e,!1,!0)},e.commands.findNext=f,e.commands.findPrev=function(e){f(e,!0)},e.commands.clearSearch=h,e.commands.replace=g,e.commands.replaceAll=function(e){g(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function n(e,t){var n=Number(t);return/^[-+]/.test(t)?e.getCursor().line+n:n-1}var r='Jump to line: (Use line:column or scroll% syntax)';e.commands.jumpToLine=function(e){var i=e.getCursor();t(e,r,"Jump to line:",i.line+1+":"+i.ch,function(t){if(t){var r;if(r=/^\s*([\+\-]?\d+)\s*\:\s*(\d+)\s*$/.exec(t))e.setCursor(n(e,r[1]),Number(r[2]));else if(r=/^\s*([\+\-]?\d+(\.\d+)?)\%\s*/.exec(t)){var o=Math.round(e.lineCount()*Number(r[1])/100);/^[-+]/.test(r[1])&&(o=i.line+o+1),e.setCursor(o-1,i.ch)}else(r=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(t))&&e.setCursor(n(e,r[1]),i.ch)}})},e.keyMap["default"]["Alt-G"]="jumpToLine"}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r){this.cm=e,this.options=r;var i={listenForChanges:!1};for(var o in r)i[o]=r[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=n,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function n(e,t,n){return t>=e?e:Math.max(t,e+n)}e.defineExtension("showMatchesOnScrollbar",function(e,n,r){return"string"==typeof r&&(r={className:r}),r||(r={}),new t(this,e,n,r)});var r=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;n.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||r;i.findNext();){var n={from:i.from(),to:i.to()};if(n.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,n),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var r=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(n(this.gap.from,r,o),t.from.line),this.gap.to=Math.max(n(this.gap.to,r,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;as&&r(e,l.slice(s,c),n,t.style))}var u=e.getCursor("from"),d=e.getCursor("to");if(u.line==d.line&&(!t.wordsOnly||a(e,u,d))){var f=e.getRange(u,d).replace(/^\s+|\s+$/g,"");f.length>=t.minChars&&r(e,f,!1,t.style)}})}function a(e,t,n){var r=e.getRange(t,n);if(null!==r.match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(n.chr.right?1:0:t.clientYr.bottom?1:0,o.moveTo(o.pos+n*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function n(e,n,r){this.addClass=e,this.horiz=new t(e,"horizontal",r),n(this.horiz.node),this.vert=new t(e,"vertical",r),n(this.vert.node),this.width=null}t.prototype.moveTo=function(e,t){0>e&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),e!=this.pos&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",t!==!1&&this.scroll(e,this.orientation))};var r=10;t.prototype.update=function(e,t,n){this.screen=t,this.total=e,this.size=n;var i=this.screen*(this.size/this.total);r>i&&(this.size-=r-i,i=r),this.inner.style["horizontal"==this.orientation?"width":"height"]=i+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},n.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var n=this.width||0,r=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=r?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(r?n:0)),this.vert.node.style.display="block",this.vert.node.style.bottom=r?n+"px":"0"),r&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?n:0)-e.barLeft),this.horiz.node.style.right=i?n+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?n:0,bottom:r?n:0}},n.prototype.setScrollTop=function(e){this.vert.moveTo(e,!1)},n.prototype.setScrollLeft=function(e){this.horiz.moveTo(e,!1)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function n(e){clearTimeout(r.doRedraw),r.doRedraw=setTimeout(function(){r.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var r=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(r.doUpdate),r.doUpdate=setTimeout(function(){r.computeScale()&&n(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){n(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.getScrollerElement().scrollHeight;return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(s!=e.line&&(s=e.line,c=n.getLineHandle(s)),a&&c.height>l)return n.charCoords(e,"local")[t?"top":"bottom"];var r=n.heightAtLine(c,"local");return r+(t?0:c.height)}e!==!1&&this.computeScale();var n=this.cm,r=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=n.getOption("lineWrapping"),l=a&&1.5*n.defaultTextHeight(),s=null,c=null;if(n.display.barWidth)for(var u,d=0;dh+.9));)f=o[++d],h=t(f.to,!1)*r;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(1.5*n.display.barWidth,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className,f.id&&g.setAttribute("annotation-id",f.id)}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,r){this.cm=e,this.node=t,this.options=n,this.height=r,this.cleared=!1}function n(e){var t=e.getWrapperElement(),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r=parseInt(n.height),i=e.state.panels={setHeight:t.style.height,heightLeft:r,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(i.wrapper,t);var o=e.hasFocus();i.wrapper.appendChild(t),o&&e.focus(),e._setSize=e.setSize,null!=r&&(e.setSize=function(t,n){if(null==n)return this._setSize(t,n);if(i.setHeight=n,"number"!=typeof n){var o=/^(\d+\.?\d*)px$/.exec(n);o?n=Number(o[1]):(i.wrapper.style.height=n,n=i.wrapper.offsetHeight,i.wrapper.style.height="")}e._setSize(t,i.heightLeft+=n-r),r=n})}function r(e){var t=e.state.panels;e.state.panels=null;var n=e.getWrapperElement();t.wrapper.parentNode.replaceChild(n,t.wrapper),n.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}e.defineExtension("addPanel",function(e,r){r=r||{},this.state.panels||n(this);var i=this.state.panels,o=i.wrapper,a=this.getWrapperElement();r.after instanceof t&&!r.after.cleared?o.insertBefore(e,r.before.node.nextSibling):r.before instanceof t&&!r.before.cleared?o.insertBefore(e,r.before.node):r.replace instanceof t&&!r.replace.cleared?(o.insertBefore(e,r.replace.node),r.replace.clear()):"bottom"==r.position?o.appendChild(e):"before-bottom"==r.position?o.insertBefore(e,a.nextSibling):"after-top"==r.position?o.insertBefore(e,a):o.insertBefore(e,o.firstChild);var l=r&&r.height||e.offsetHeight;return this._setSize(null,i.heightLeft-=l),i.panels++,new t(this,e,r,l)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),e.wrapper.removeChild(this.node),0==--e.panels&&r(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,n=this.cm.state.panels;this.cm._setSize(null,n.height+=t-this.height),this.height=t}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.className="CodeMirror-placeholder";var r=e.getOption("placeholder");"string"==typeof r&&(r=document.createTextNode(r)),n.appendChild(r),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){o(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=o(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(n,o,a){var l=a&&a!=e.Init;if(o&&!l)n.on("blur",r),n.on("change",i),i(n);else if(!o&&l){n.off("blur",r),n.off("change",i),t(n);var s=n.getWrapperElement();s.className=s.className.replace(" CodeMirror-empty","")}o&&!n.hasFocus()&&r(n)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.getWrapperElement();e.state.fullScreenRestore={scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset,width:t.style.width,height:t.style.height},t.style.width="",t.style.height="auto",t.className+=" CodeMirror-fullscreen",document.documentElement.style.overflow="hidden",e.refresh()}function n(e){var t=e.getWrapperElement();t.className=t.className.replace(/\s*CodeMirror-fullscreen\b/,""),document.documentElement.style.overflow="";var n=e.state.fullScreenRestore;t.style.width=n.width,t.style.height=n.height,window.scrollTo(n.scrollLeft,n.scrollTop),e.refresh()}e.defineOption("fullScreen",!1,function(r,i,o){o==e.Init&&(o=!1),!o!=!i&&(i?t(r):n(r))})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,r){function i(){t.display.wrapper.offsetHeight?(n(t,r),t.display.lastWrapHeight!=t.display.wrapper.clientHeight&&t.refresh()):r.timeout=setTimeout(i,r.delay)}r.timeout=setTimeout(i,r.delay),r.hurry=function(){clearTimeout(r.timeout),r.timeout=setTimeout(i,50)},e.on(window,"mouseup",r.hurry),e.on(window,"keyup",r.hurry)}function n(t,n){clearTimeout(n.timeout),e.off(window,"mouseup",n.hurry),e.off(window,"keyup",n.hurry)}e.defineOption("autoRefresh",!1,function(e,r){e.state.autoRefresh&&(n(e,e.state.autoRefresh),e.state.autoRefresh=null),r&&0==e.display.wrapper.offsetHeight&&t(e,e.state.autoRefresh={delay:r.delay||250})})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n){var r,i=e.getWrapperElement();return r=i.appendChild(document.createElement("div")),r.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(r,i,o){function a(e){if("string"==typeof e)d.value=e;else{if(c)return;c=!0,s.parentNode.removeChild(s),u.focus(),o.onClose&&o.onClose(s)}}o||(o={}),n(this,null);var l,s=t(this,r,o.bottom),c=!1,u=this,d=s.getElementsByTagName("input")[0];return d?(o.value&&(d.value=o.value,o.selectValueOnOpen!==!1&&d.select()),o.onInput&&e.on(d,"input",function(e){o.onInput(e,d.value,a)}),o.onKeyUp&&e.on(d,"keyup",function(e){o.onKeyUp(e,d.value,a)}),e.on(d,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,d.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(d.blur(),e.e_stop(t),a()),13==t.keyCode&&i(d.value,t))}),o.closeOnBlur!==!1&&e.on(d,"blur",a),d.focus()):(l=s.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(l,"blur",a),l.focus()),a}),e.defineExtension("openConfirm",function(r,i,o){function a(){c||(c=!0,l.parentNode.removeChild(l),u.focus())}n(this,null);var l=t(this,r,o&&o.bottom),s=l.getElementsByTagName("button"),c=!1,u=this,d=1;s[0].focus();for(var f=0;f=d&&a()},200)}),e.on(p,"focus",function(){++d})}}),e.defineExtension("openNotification",function(r,i){function o(){s||(s=!0,clearTimeout(a),l.parentNode.removeChild(l))}n(this,o);var a,l=t(this,r,i&&i.bottom),s=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(l,"click",function(t){e.e_preventDefault(t),o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,i){var o=e.getLineHandle(t.line),s=t.ch-1,c=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(s==t.ch))return null;var d=e.getTokenTypeAt(a(t.line,s+1)),f=n(e,a(t.line,s+(u>0?1:0)),u,d||null,i);return null==f?null:{from:a(t.line,s),to:f&&f.pos,match:f&&f.ch==c.charAt(0),forward:u>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,d=n>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),f=t.line;f!=d;f+=n){var p=e.getLine(f);if(p){var h=n>0?0:p.length-1,m=n>0?p.length:-1;if(!(p.length>o))for(f==t.line&&(h=t.ch-(0>n?1:0));h!=m;h+=n){var g=p.charAt(h);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(f,h+1))==r)){var v=l[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(f,h),ch:g};c.pop()}}}}}return f-n==(n>0?e.lastLine():e.firstLine())?!1:null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;cn)||a(!m);m=!1){var g=u.text.charAt(s)||"\n",v=Di(g,h)?"w":p&&"\n"==g?"n":!p||/\s/.test(g)?null:"p";if(!p||m||v||(v="s"),d&&d!=v){0>n&&(n=1,a());break}if(v&&(d=v),n>0&&!a(!m))break}var y=qe(e,qo(l,s),c,!0);return f||(y.hitSide=!0),y}function Hn(e,t,n,r){var i,o=e.doc,a=t.left;if("page"==r){var l=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight);i=t.top+n*(l-(0>n?1.5:.5)*yt(e.display))}else"line"==r&&(i=n>0?t.bottom+3:t.top-3);for(;;){var s=gt(e,a,i);if(!s.outside)break;if(0>n?0>=i:i>=o.height){s.hitSide=!0;break}i+=5*n}return s}function $n(t,n,r,i){e.defaults[t]=n,r&&(Zo[t]=i?function(e,t,n){n!=Yo&&r(e,t,n)}:r)}function Bn(e){for(var t,n,r,i,o=e.split(/-(?!$)/),e=o[o.length-1],a=0;a0||0==a&&o.clearWhenEmpty!==!1)return o;if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=Wi("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(mr(e,t.line,t,n,o)||t.line!=n.line&&mr(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one");Oo=!0}o.addToHistory&&li(e,{from:t,to:n,origin:"markText"},e.sel,0/0);var l,s=t.line,c=e.cm;if(e.iter(s,n.line+1,function(e){c&&o.collapsed&&!c.options.lineWrapping&&gr(e)==c.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Qr(e,0),er(e,new Yn(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s}),o.collapsed&&e.iter(t.line,n.line+1,function(t){xr(e,t)&&Qr(t,0)}),o.clearOnEnter&&Sa(o,"beforeCursorEnter",function(){o.clear()}),o.readOnly&&(Eo=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++fa,o.atomic=!0),c){if(l&&(c.curOp.updateMaxLine=!0),o.collapsed)It(c,t.line,n.line+1);else if(o.className||o.title||o.startStyle||o.endStyle||o.css)for(var u=t.line;u<=n.line;u++)Pt(c,u,"text");o.atomic&&Ee(c.doc),_i(c,"markerAdded",c,o)}return o}function Gn(e,t,n,r,i){r=Ii(r),r.shared=!1;var o=[Vn(e,t,n,r,i)],a=o[0],l=r.widgetNode;return Gr(e,function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Vn(e,ve(e,t),ve(e,n),r,i));for(var s=0;s=t:o.to>t);(r||(r=[])).push(new Yn(a,o.from,s?null:o.to))}}return r}function nr(e,t,n){if(e)for(var r,i=0;i=t:o.to>t);if(l||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var s=null==o.from||(a.inclusiveLeft?o.from<=t:o.from0&&l)for(var f=0;ff;++f)h.push(m);h.push(s)}return h}function ir(e){for(var t=0;t0)){var u=[s,1],f=No(c.from,l.from),d=No(c.to,l.to);(0>f||!a.inclusiveLeft&&!f)&&u.push({from:c.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&u.push({from:l.to,to:c.to}),i.splice.apply(i,u),s+=u.length-1}}return i}function lr(e){var t=e.markedSpans;if(t){for(var n=0;n=0&&0>=f||0>=u&&f>=0)&&(0>=u&&(No(c.to,n)>0||s.marker.inclusiveRight&&i.inclusiveLeft)||u>=0&&(No(c.from,r)<0||s.marker.inclusiveLeft&&i.inclusiveRight)))return!0}}}function gr(e){for(var t;t=pr(e);)e=t.find(-1,!0).line;return e}function vr(e){for(var t,n;t=hr(e);)e=t.find(1,!0).line,(n||(n=[])).push(e);return n}function yr(e,t){var n=Xr(e,t),r=gr(n);return n==r?t:Jr(r)}function br(e,t){if(t>e.lastLine())return t;var n,r=Xr(e,t);if(!xr(e,r))return t;for(;n=hr(r);)r=n.find(1,!0).line;return Jr(r)+1}function xr(e,t){var n=Oo&&t.markedSpans;if(n)for(var r,i=0;io;o++){i&&(i[0]=e.innerMode(t,r).mode);var a=t.token(n,r);if(n.pos>n.start)return a}throw new Error("Mode "+t.name+" failed to advance stream.")}function zr(e,t,n,r){function i(e){return{start:f.start,end:f.pos,string:f.current(),type:o||null,state:e?ra(a.mode,u):u}}var o,a=e.doc,l=a.mode;t=ve(a,t);var s,c=Xr(a,t.line),u=He(e,t.line,n),f=new ua(c.text,e.options.tabSize);for(r&&(s=[]);(r||f.pose.options.maxHighlightLength?(l=!1,a&&Nr(e,t,r,f.pos),f.pos=t.length,s=null):s=Lr(Ar(n,f,r,d),o),d){var p=d[0].name;p&&(s="m-"+(s?p+" "+s:p))}if(!l||u!=s){for(;cc;){var r=i[s];r>e&&i.splice(s,1,e,i[s+1],r),s+=2,c=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"cm-overlay "+t),s=n+2;else for(;s>n;n+=2){var o=i[n+1];i[n+1]=(o?o+" ":"")+"cm-overlay "+t}},o)}return{styles:i,classes:o.bgClass||o.textClass?o:null}}function qr(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=Or(e,t,t.stateAfter=He(e,Jr(t)));t.styles=r.styles,r.classes?t.styleClasses=r.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.frontier&&e.doc.frontier++}return t.styles}function Nr(e,t,n,r){var i=e.doc.mode,o=new ua(t,e.options.tabSize);for(o.start=o.pos=r||0,""==t&&Tr(i,n);!o.eol()&&o.pos<=e.options.maxHighlightLength;)Ar(i,o,n),o.start=o.pos}function Ir(e,t){if(!e||/^\s*$/.test(e))return null;var n=t.addModeClass?va:ga;return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Pr(e,t){var n=Wi("span",null,null,vo?"padding-right: .1px":null),r={pre:Wi("pre",[n]),content:n,col:0,pos:0,cm:e,splitSpaces:(mo||vo)&&e.getOption("lineWrapping")};t.measure={};for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o,a=i?t.rest[i-1]:t.line;r.pos=0,r.addToken=jr,Zi(e.display.measure)&&(o=ni(a))&&(r.addToken=Wr(r.addToken,o)),r.map=[];var l=t!=e.display.externalMeasured&&Jr(a);Hr(a,r,qr(e,a,l)),a.styleClasses&&(a.styleClasses.bgClass&&(r.bgClass=Ui(a.styleClasses.bgClass,r.bgClass||"")),a.styleClasses.textClass&&(r.textClass=Ui(a.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Xi(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}return vo&&/\bcm-tab\b/.test(r.content.lastChild.className)&&(r.content.className="cm-tab-wrap-hack"),La(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=Ui(r.pre.className,r.textClass||"")),r}function Dr(e){var t=Wi("span","•","cm-invalidchar");return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function jr(e,t,n,r,i,o,a){if(t){var l=e.splitSpaces?t.replace(/ {3,}/g,Rr):t,s=e.cm.state.specialChars,c=!1;if(s.test(t))for(var u=document.createDocumentFragment(),f=0;;){s.lastIndex=f;var d=s.exec(t),p=d?d.index-f:t.length-f;if(p){var h=document.createTextNode(l.slice(f,f+p));u.appendChild(mo&&9>go?Wi("span",[h]):h),e.map.push(e.pos,e.pos+p,h),e.col+=p,e.pos+=p}if(!d)break;if(f+=p+1," "==d[0]){var m=e.cm.options.tabSize,g=m-e.col%m,h=u.appendChild(Wi("span",Ai(g),"cm-tab"));h.setAttribute("role","presentation"),h.setAttribute("cm-text"," "),e.col+=g}else{var h=e.cm.options.specialCharPlaceholder(d[0]);h.setAttribute("cm-text",d[0]),u.appendChild(mo&&9>go?Wi("span",[h]):h),e.col+=1}e.map.push(e.pos,e.pos+1,h),e.pos++}else{e.col+=t.length;var u=document.createTextNode(l);e.map.push(e.pos,e.pos+t.length,u),mo&&9>go&&(c=!0),e.pos+=t.length}if(n||r||i||c||a){var v=n||"";r&&(v+=r),i&&(v+=i);var y=Wi("span",[u],v,a);return o&&(y.title=o),e.content.appendChild(y)}e.content.appendChild(u)}}function Rr(e){for(var t=" ",n=0;nc&&d.from<=c)break}if(d.to>=u)return e(n,r,i,o,a,l,s);e(n,r.slice(0,d.to-c),i,o,null,l,s),o=null,r=r.slice(d.to-c),c=d.to}}}function Fr(e,t,n,r){var i=!r&&n.widgetNode;i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t}function Hr(e,t,n){var r=e.markedSpans,i=e.text,o=0;if(r)for(var a,l,s,c,u,f,d,p=i.length,h=0,m=1,g="",v=0;;){if(v==h){s=c=u=f=l="",d=null,v=1/0;for(var y=[],b=0;bh||_.collapsed&&x.to==h&&x.from==h)?(null!=x.to&&x.to!=h&&v>x.to&&(v=x.to,c=""),_.className&&(s+=" "+_.className),_.css&&(l=_.css),_.startStyle&&x.from==h&&(u+=" "+_.startStyle),_.endStyle&&x.to==v&&(c+=" "+_.endStyle),_.title&&!f&&(f=_.title),_.collapsed&&(!d||fr(d.marker,_)<0)&&(d=x)):x.from>h&&v>x.from&&(v=x.from)}if(d&&(d.from||0)==h){if(Fr(t,(null==d.to?p+1:d.to)-h,d.marker,null==d.from),null==d.to)return;d.to==h&&(d=!1)}if(!d&&y.length)for(var b=0;b=p)break;for(var k=Math.min(p,v);;){if(g){var w=h+g.length;if(!d){var C=w>k?g.slice(0,k-h):g;t.addToken(t,C,a?a+s:s,u,h+C.length==v?c:"",f,l)}if(w>=k){g=g.slice(k-h),h=k;break}h=w,u=""}g=i.slice(o,o=n[m++]),a=Ir(n[m++],t.cm.options)}}else for(var m=1;mn;++n)o.push(new ma(c[n],i(n),r));return o}var l=t.from,s=t.to,c=t.text,u=Xr(e,l.line),f=Xr(e,s.line),d=zi(c),p=i(c.length-1),h=s.line-l.line;if(t.full)e.insert(0,a(0,c.length)),e.remove(c.length,e.size-c.length);else if($r(e,t)){var m=a(0,c.length-1);o(f,f.text,p),h&&e.remove(l.line,h),m.length&&e.insert(l.line,m)}else if(u==f)if(1==c.length)o(u,u.text.slice(0,l.ch)+d+u.text.slice(s.ch),p);else{var m=a(1,c.length-1);m.push(new ma(d+u.text.slice(s.ch),p,r)),o(u,u.text.slice(0,l.ch)+c[0],i(0)),e.insert(l.line+1,m)}else if(1==c.length)o(u,u.text.slice(0,l.ch)+c[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,h);else{o(u,u.text.slice(0,l.ch)+c[0],i(0)),o(f,d+f.text.slice(s.ch),p);var m=a(1,c.length-1);h>1&&e.remove(l.line+1,h-1),e.insert(l.line+1,m)}_i(e,"change",e,t)}function Ur(e){this.lines=e,this.parent=null;for(var t=0,n=0;tt||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.");for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize();if(o>t){n=i;break}t-=o}return n.lines[t]}function Zr(e,t,n){var r=[],i=t.line;return e.iter(t.line,n.line+1,function(e){var o=e.text;i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i}),r}function Yr(e,t,n){var r=[];return e.iter(t,n,function(e){r.push(e.text)}),r}function Qr(e,t){var n=t-e.height;if(n)for(var r=e;r;r=r.parent)r.height+=n}function Jr(e){if(null==e.parent)return null;for(var t=e.parent,n=Ei(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize();return n+t.first}function ei(e,t){var n=e.first;e:do{for(var r=0;rt){e=i;continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines);for(var r=0;rt)break;t-=l}return n+r}function ti(e){e=gr(e);for(var t=0,n=e.parent,r=0;r1&&!e.done[e.done.length-2].ranges?(e.done.pop(),zi(e.done)):void 0}function li(e,t,n,r){if("ignoreHistory"!=t.origin){var i=e.history;i.undone.length=0;var o,a=+new Date;if((i.lastOp==r||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&e.cm&&i.lastModTime>a-e.cm.options.historyEventDelay||"*"==t.origin.charAt(0)))&&(o=ai(i,i.lastOp==r))){var l=zi(o.changes);0==No(t.from,t.to)&&0==No(t.from,l.to)?l.to=Ko(t):o.changes.push(ii(e,t))}else{var s=zi(i.done);for(s&&s.ranges||ui(e.sel,i.done),o={changes:[ii(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=a,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,l||La(e,"historyAdded")}}function si(e,t,n,r){var i=t.charAt(0);return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}function ci(e,t,n,r){var i=e.history,o=r&&r.origin;n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||si(e,o,zi(i.done),t))?i.done[i.done.length-1]=t:ui(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&r.clearRedo!==!1&&oi(i.undone)}function ui(e,t){var n=zi(t);n&&n.ranges&&n.equals(e)||t.push(e)}function fi(e,t,n,r){var i=t["spans_"+e.id],o=0;e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o})}function di(e){if(!e)return null;for(var t,n=0;n-1&&(zi(l)[f]=u[f],delete u[f])}}}return i}function mi(e,t,n,r){n0}function Mi(e){e.prototype.on=function(e,t){Sa(this,e,t)},e.prototype.off=function(e,t){Ma(this,e,t)}}function Li(){this.id=null}function Ti(e,t,n){for(var r=0,i=0;;){var o=e.indexOf(" ",r);-1==o&&(o=e.length);var a=o-r;if(o==e.length||i+a>=t)return r+Math.min(a,t-i);if(i+=o-r,i+=n-i%n,r=o+1,i>=t)return r}}function Ai(e){for(;Ia.length<=e;)Ia.push(zi(Ia)+" ");return Ia[e]}function zi(e){return e[e.length-1]}function Ei(e,t){for(var n=0;n-1&&Ra(e)?!0:t.test(e):Ra(e)}function ji(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1;return!0}function Ri(e){return e.charCodeAt(0)>=768&&Wa.test(e)}function Wi(e,t,n,r){var i=document.createElement(e);if(n&&(i.className=n),r&&(i.style.cssText=r),"string"==typeof t)i.appendChild(document.createTextNode(t));else if(t)for(var o=0;o0;--t)e.removeChild(e.firstChild);return e}function Hi(e,t){return Fi(e).appendChild(t)}function $i(){return document.activeElement}function Bi(e){return new RegExp("(^|\\s)"+e+"(?:$|\\s)\\s*")}function Ui(e,t){for(var n=e.split(" "),r=0;r2&&!(mo&&8>go))}var n=Ha?Wi("span",""):Wi("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return n.setAttribute("cm-text",""),n}function Zi(e){if(null!=$a)return $a;var t=Hi(e,document.createTextNode("AخA")),n=Da(t,0,1).getBoundingClientRect();if(!n||n.left==n.right)return!1;var r=Da(t,1,2).getBoundingClientRect();return $a=r.right-n.right<3}function Yi(e){if(null!=Ya)return Ya;var t=Hi(e,Wi("span","x")),n=t.getBoundingClientRect(),r=Da(t,0,1).getBoundingClientRect();return Ya=Math.abs(n.left-r.left)>1}function Qi(e,t,n,r){if(!e)return r(t,n,"ltr");for(var i=!1,o=0;ot||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr"),i=!0)}i||r(t,n,"ltr")}function Ji(e){return e.level%2?e.to:e.from}function eo(e){return e.level%2?e.from:e.to}function to(e){var t=ni(e);return t?Ji(t[0]):0}function no(e){var t=ni(e);return t?eo(zi(t)):e.text.length}function ro(e,t){var n=Xr(e.doc,t),r=gr(n);r!=n&&(t=Jr(r));var i=ni(r),o=i?i[0].level%2?no(r):to(r):0;return qo(t,o)}function io(e,t){for(var n,r=Xr(e.doc,t);n=hr(r);)r=n.find(1,!0).line,t=null;var i=ni(r),o=i?i[0].level%2?to(r):no(r):r.text.length;return qo(null==t?Jr(r):t,o)}function oo(e,t){var n=ro(e,t.line),r=Xr(e.doc,n.line),i=ni(r);if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch;return qo(n.line,a?0:o)}return n}function ao(e,t,n){var r=e[0].level;return t==r?!0:n==r?!1:n>t}function lo(e,t){Ja=null;for(var n,r=0;rt)return r;if(i.from==t||i.to==t){if(null!=n)return ao(e,i.level,e[n].level)?(i.from!=i.to&&(Ja=n),r):(i.from!=i.to&&(Ja=r),n);n=r}}return n}function so(e,t,n,r){if(!r)return t+n;do t+=n;while(t>0&&Ri(e.text.charAt(t)));return t}function co(e,t,n,r){var i=ni(e);if(!i)return uo(e,t,n,r);for(var o=lo(i,t),a=i[o],l=so(e,t,a.level%2?-n:n,r);;){if(l>a.from&&l0==a.level%2?a.to:a.from);if(a=i[o+=n],!a)return null;l=n>0==a.level%2?so(e,a.to,-1,r):so(e,a.from,1,r)}}function uo(e,t,n,r){var i=t+n;if(r)for(;i>0&&Ri(e.text.charAt(i));)i+=n;return 0>i||i>e.text.length?null:i}var fo=/gecko\/\d/i.test(navigator.userAgent),po=/MSIE \d/.test(navigator.userAgent),ho=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),mo=po||ho,go=mo&&(po?document.documentMode||6:ho[1]),vo=/WebKit\//.test(navigator.userAgent),yo=vo&&/Qt\/\d+\.\d+/.test(navigator.userAgent),bo=/Chrome\//.test(navigator.userAgent),xo=/Opera\//.test(navigator.userAgent),_o=/Apple Computer/.test(navigator.vendor),ko=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(navigator.userAgent),wo=/PhantomJS/.test(navigator.userAgent),Co=/AppleWebKit/.test(navigator.userAgent)&&/Mobile\/\w+/.test(navigator.userAgent),So=Co||/Android|webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(navigator.userAgent),Mo=Co||/Mac/.test(navigator.platform),Lo=/win/i.test(navigator.platform),To=xo&&navigator.userAgent.match(/Version\/(\d*\.\d*)/);To&&(To=Number(To[1])),To&&To>=15&&(xo=!1,vo=!0);var Ao=Mo&&(yo||xo&&(null==To||12.11>To)),zo=fo||mo&&go>=9,Eo=!1,Oo=!1;m.prototype=Ii({update:function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth;if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0";var i=e.viewHeight-(t?r:0);this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px";var o=e.viewWidth-e.barLeft-(n?r:0);this.horiz.firstChild.style.width=e.scrollWidth-e.clientWidth+o+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedOverlay&&e.clientHeight>0&&(0==r&&this.overlayHack(),this.checkedOverlay=!0),{right:n?r:0,bottom:t?r:0}},setScrollLeft:function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e)},setScrollTop:function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e)},overlayHack:function(){var e=Mo&&!ko?"12px":"18px";this.horiz.style.minHeight=this.vert.style.minWidth=e;var t=this,n=function(e){bi(e)!=t.vert&&bi(e)!=t.horiz&&zt(t.cm,Gt)(e)};Sa(this.vert,"mousedown",n),Sa(this.horiz,"mousedown",n)},clear:function(){var e=this.horiz.parentNode;e.removeChild(this.horiz),e.removeChild(this.vert)}},m.prototype),g.prototype=Ii({update:function(){return{bottom:0,right:0}},setScrollLeft:function(){},setScrollTop:function(){},clear:function(){}},g.prototype),e.scrollbarModel={"native":m,"null":g},S.prototype.signal=function(e,t){Si(e,t)&&this.events.push(arguments)},S.prototype.finish=function(){for(var e=0;e=9&&n.hasSelection&&(n.hasSelection=null),n.poll()}),Sa(o,"paste",function(e){return ee(e,r)?!0:(r.state.pasteIncoming=!0,void n.fastPoll())}),Sa(o,"cut",t),Sa(o,"copy",t),Sa(e.scroller,"paste",function(t){Ut(e,t)||(r.state.pasteIncoming=!0,n.focus())}),Sa(e.lineSpace,"selectstart",function(t){Ut(e,t)||ka(t)}),Sa(o,"compositionstart",function(){var e=r.getCursor("from");n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}}),Sa(o,"compositionend",function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)})},prepareSelection:function(){var e=this.cm,t=e.display,n=e.doc,r=Ie(e);if(e.options.moveInputWithCursor){var i=pt(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect();r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},showSelection:function(e){var t=this.cm,n=t.display;Hi(n.cursorDiv,e.cursors),Hi(n.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},reset:function(e){if(!this.contextMenuPending){var t,n,r=this.cm,i=r.doc;if(r.somethingSelected()){this.prevInput="";var o=i.sel.primary();t=Za&&(o.to().line-o.from().line>100||(n=r.getSelection()).length>1e3);var a=t?"-":n||r.getSelection();this.composing||(this.textarea.value=a),r.state.focused&&Pa(this.textarea),
-mo&&go>=9&&(this.hasSelection=a)}else e||(this.composing||(this.prevInput=this.textarea.value=""),mo&&go>=9&&(this.hasSelection=null));this.inaccurateSelection=t}},getField:function(){return this.textarea},supportsTouch:function(){return!1},focus:function(){if("nocursor"!=this.cm.options.readOnly&&(!So||$i()!=this.textarea))try{this.textarea.focus()}catch(e){}},blur:function(){this.textarea.blur()},resetPosition:function(){this.wrapper.style.top=this.wrapper.style.left=0},receivedFocus:function(){this.slowPoll()},slowPoll:function(){var e=this;e.pollingFast||e.polling.set(this.cm.options.pollInterval,function(){e.poll(),e.cm.state.focused&&e.slowPoll()})},fastPoll:function(){function e(){var r=n.poll();r||t?(n.pollingFast=!1,n.slowPoll()):(t=!0,n.polling.set(60,e))}var t=!1,n=this;n.pollingFast=!0,n.polling.set(20,e)},poll:function(){var e=this.cm,t=this.textarea,n=this.prevInput;if(this.contextMenuPending||!e.state.focused||Xa(t)&&!n||Q(e)||e.options.disableInput||e.state.keySeq)return!1;var r=t.value;if(r==n&&!e.somethingSelected())return!1;if(mo&&go>=9&&this.hasSelection===r||Mo&&/[\uf700-\uf7ff]/.test(r))return e.display.input.reset(),!1;if(e.doc.sel==e.display.selForContextMenu){var i=r.charCodeAt(0);if(8203!=i||n||(n=""),8666==i)return this.reset(),this.cm.execCommand("undo")}for(var o=0,a=Math.min(n.length,r.length);a>o&&n.charCodeAt(o)==r.charCodeAt(o);)++o;var l=this;return At(e,function(){J(e,r.slice(o),n.length-o,null,l.composing?"*compose":null),r.length>1e3||r.indexOf("\n")>-1?t.value=l.prevInput="":l.prevInput=r,l.composing&&(l.composing.range.clear(),l.composing.range=e.markText(l.composing.start,e.getCursor("to"),{className:"CodeMirror-composing"}))}),!0},ensurePolled:function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},onKeyPress:function(){mo&&go>=9&&(this.hasSelection=null),this.fastPoll()},onContextMenu:function(e){function t(){if(null!=a.selectionStart){var e=i.somethingSelected(),t=""+(e?a.value:"");a.value="⇚",a.value=t,r.prevInput=e?"":"",a.selectionStart=1,a.selectionEnd=t.length,o.selForContextMenu=i.doc.sel}}function n(){if(r.contextMenuPending=!1,r.wrapper.style.position="relative",a.style.cssText=u,mo&&9>go&&o.scrollbars.setScrollTop(o.scroller.scrollTop=s),null!=a.selectionStart){(!mo||mo&&9>go)&&t();var e=0,n=function(){o.selForContextMenu==i.doc.sel&&0==a.selectionStart&&a.selectionEnd>0&&""==r.prevInput?zt(i,oa.selectAll)(i):e++<10?o.detectingSelectAll=setTimeout(n,500):o.input.reset()};o.detectingSelectAll=setTimeout(n,200)}}var r=this,i=r.cm,o=i.display,a=r.textarea,l=Vt(i,e),s=o.scroller.scrollTop;if(l&&!xo){var c=i.options.resetSelectionOnContextMenu;c&&-1==i.doc.sel.contains(l)&&zt(i,Te)(i.doc,me(l),Ea);var u=a.style.cssText;if(r.wrapper.style.position="absolute",a.style.cssText="position: fixed; width: 30px; height: 30px; top: "+(e.clientY-5)+"px; left: "+(e.clientX-5)+"px; z-index: 1000; background: "+(mo?"rgba(255, 255, 255, .05)":"transparent")+"; outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",vo)var f=window.scrollY;if(o.input.focus(),vo&&window.scrollTo(null,f),o.input.reset(),i.somethingSelected()||(a.value=r.prevInput=" "),r.contextMenuPending=!0,o.selForContextMenu=i.doc.sel,clearTimeout(o.detectingSelectAll),mo&&go>=9&&t(),zo){Ca(e);var d=function(){Ma(window,"mouseup",d),setTimeout(n,20)};Sa(window,"mouseup",d)}else setTimeout(n,50)}},setUneditable:qi,needsContentAttribute:!1},ie.prototype),ae.prototype=Ii({init:function(e){function t(e){if(r.somethingSelected())Io=r.getSelections(),"cut"==e.type&&r.replaceSelection("",null,"cut");else{if(!r.options.lineWiseCopyCut)return;var t=ne(r);Io=t.text,"cut"==e.type&&r.operation(function(){r.setSelections(t.ranges,0,Ea),r.replaceSelection("",null,"cut")})}if(e.clipboardData&&!Co)e.preventDefault(),e.clipboardData.clearData(),e.clipboardData.setData("text/plain",Io.join("\n"));else{var n=oe(),i=n.firstChild;r.display.lineSpace.insertBefore(n,r.display.lineSpace.firstChild),i.value=Io.join("\n");var o=document.activeElement;Pa(i),setTimeout(function(){r.display.lineSpace.removeChild(n),o.focus()},50)}}var n=this,r=n.cm,i=n.div=e.lineDiv;i.contentEditable="true",re(i),Sa(i,"paste",function(e){ee(e,r)}),Sa(i,"compositionstart",function(e){var t=e.data;if(n.composing={sel:r.doc.sel,data:t,startData:t},t){var i=r.doc.sel.primary(),o=r.getLine(i.head.line),a=o.indexOf(t,Math.max(0,i.head.ch-t.length));a>-1&&a<=i.head.ch&&(n.composing.sel=me(qo(i.head.line,a),qo(i.head.line,a+t.length)))}}),Sa(i,"compositionupdate",function(e){n.composing.data=e.data}),Sa(i,"compositionend",function(e){var t=n.composing;t&&(e.data==t.startData||/\u200b/.test(e.data)||(t.data=e.data),setTimeout(function(){t.handled||n.applyComposition(t),n.composing==t&&(n.composing=null)},50))}),Sa(i,"touchstart",function(){n.forceCompositionEnd()}),Sa(i,"input",function(){n.composing||n.pollContent()||At(n.cm,function(){It(r)})}),Sa(i,"copy",t),Sa(i,"cut",t)},prepareSelection:function(){var e=Ie(this.cm,!1);return e.focus=this.cm.state.focused,e},showSelection:function(e){e&&this.cm.display.view.length&&(e.focus&&this.showPrimarySelection(),this.showMultipleSelections(e))},showPrimarySelection:function(){var e=window.getSelection(),t=this.cm.doc.sel.primary(),n=ce(this.cm,e.anchorNode,e.anchorOffset),r=ce(this.cm,e.focusNode,e.focusOffset);if(!n||n.bad||!r||r.bad||0!=No(Z(n,r),t.from())||0!=No(X(n,r),t.to())){var i=le(this.cm,t.from()),o=le(this.cm,t.to());if(i||o){var a=this.cm.display.view,l=e.rangeCount&&e.getRangeAt(0);if(i){if(!o){var s=a[a.length-1].measure,c=s.maps?s.maps[s.maps.length-1]:s.map;o={node:c[c.length-1],offset:c[c.length-2]-c[c.length-3]}}}else i={node:a[0].measure.map[2],offset:0};try{var u=Da(i.node,i.offset,o.offset,o.node)}catch(f){}u&&(e.removeAllRanges(),e.addRange(u),l&&null==e.anchorNode?e.addRange(l):fo&&this.startGracePeriod()),this.rememberSelection()}}},startGracePeriod:function(){var e=this;clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout(function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation(function(){e.cm.curOp.selectionChanged=!0})},20)},showMultipleSelections:function(e){Hi(this.cm.display.cursorDiv,e.cursors),Hi(this.cm.display.selectionDiv,e.selection)},rememberSelection:function(){var e=window.getSelection();this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},selectionInEditor:function(){var e=window.getSelection();if(!e.rangeCount)return!1;var t=e.getRangeAt(0).commonAncestorContainer;return Fa(this.div,t)},focus:function(){"nocursor"!=this.cm.options.readOnly&&this.div.focus()},blur:function(){this.div.blur()},getField:function(){return this.div},supportsTouch:function(){return!0},receivedFocus:function(){function e(){t.cm.state.focused&&(t.pollSelection(),t.polling.set(t.cm.options.pollInterval,e))}var t=this;this.selectionInEditor()?this.pollSelection():At(this.cm,function(){t.cm.curOp.selectionChanged=!0}),this.polling.set(this.cm.options.pollInterval,e)},selectionChanged:function(){var e=window.getSelection();return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},pollSelection:function(){if(!this.composing&&!this.gracePeriod&&this.selectionChanged()){var e=window.getSelection(),t=this.cm;this.rememberSelection();var n=ce(t,e.anchorNode,e.anchorOffset),r=ce(t,e.focusNode,e.focusOffset);n&&r&&At(t,function(){Te(t.doc,me(n,r),Ea),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)})}},pollContent:function(){var e=this.cm,t=e.display,n=e.doc.sel.primary(),r=n.from(),i=n.to();if(r.linet.viewTo-1)return!1;var o;if(r.line==t.viewFrom||0==(o=jt(e,r.line)))var a=Jr(t.view[0].line),l=t.view[0].node;else var a=Jr(t.view[o].line),l=t.view[o-1].node.nextSibling;var s=jt(e,i.line);if(s==t.view.length-1)var c=t.viewTo-1,u=t.lineDiv.lastChild;else var c=Jr(t.view[s+1].line)-1,u=t.view[s+1].node.previousSibling;for(var f=Ka(fe(e,l,u,a,c)),d=Zr(e.doc,qo(a,0),qo(c,Xr(e.doc,c).text.length));f.length>1&&d.length>1;)if(zi(f)==zi(d))f.pop(),d.pop(),c--;else{if(f[0]!=d[0])break;f.shift(),d.shift(),a++}for(var p=0,h=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);v>p&&m.charCodeAt(p)==g.charCodeAt(p);)++p;for(var y=zi(f),b=zi(d),x=Math.min(y.length-(1==f.length?p:0),b.length-(1==d.length?p:0));x>h&&y.charCodeAt(y.length-h-1)==b.charCodeAt(b.length-h-1);)++h;f[f.length-1]=y.slice(0,y.length-h),f[0]=f[0].slice(p);var _=qo(a,p),k=qo(c,d.length?zi(d).length-h:0);return f.length>1||f[0]||No(_,k)?(zn(e.doc,f,_,k,"+input"),!0):void 0},ensurePolled:function(){this.forceCompositionEnd()},reset:function(){this.forceCompositionEnd()},forceCompositionEnd:function(){this.composing&&!this.composing.handled&&(this.applyComposition(this.composing),this.composing.handled=!0,this.div.blur(),this.div.focus())},applyComposition:function(e){e.data&&e.data!=e.startData&&zt(this.cm,J)(this.cm,e.data,0,e.sel)},setUneditable:function(e){e.setAttribute("contenteditable","false")},onKeyPress:function(e){e.preventDefault(),zt(this.cm,J)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0)},onContextMenu:qi,resetPosition:qi,needsContentAttribute:!0},ae.prototype),e.inputStyles={textarea:ie,contenteditable:ae},de.prototype={primary:function(){return this.ranges[this.primIndex]},equals:function(e){if(e==this)return!0;if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1;for(var t=0;t=0&&No(e,r.to())<=0)return n}return-1}},pe.prototype={from:function(){return Z(this.anchor,this.head)},to:function(){return X(this.anchor,this.head)},empty:function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch}};var Po,Do,jo,Ro={left:0,right:0,top:0,bottom:0},Wo=null,Fo=0,Ho=0,$o=0,Bo=null;mo?Bo=-.53:fo?Bo=15:bo?Bo=-.7:_o&&(Bo=-1/3);var Uo=function(e){var t=e.wheelDeltaX,n=e.wheelDeltaY;return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}};e.wheelEventPixels=function(e){var t=Uo(e);return t.x*=Bo,t.y*=Bo,t};var Vo=new Li,Go=null,Ko=e.changeEnd=function(e){return e.text?qo(e.from.line+e.text.length-1,zi(e.text).length+(1==e.text.length?e.from.ch:0)):e.to};e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,t){var n=this.options,r=n[e];(n[e]!=t||"mode"==e)&&(n[e]=t,Zo.hasOwnProperty(e)&&zt(this,Zo[e])(this,t,r))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"](Un(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;nn&&(jn(this,i.head.line,e,!0),n=i.head.line,r==this.doc.sel.primIndex&&Pn(this));else{var o=i.from(),a=i.to(),l=Math.max(n,o.line);n=Math.min(this.lastLine(),a.line-(a.ch?0:1))+1;for(var s=l;n>s;++s)jn(this,s,e);var c=this.doc.sel.ranges;0==o.ch&&t.length==c.length&&c[r].from().ch>0&&Ce(this.doc,r,new pe(o,c[r].to()),Ea)}}}),getTokenAt:function(e,t){return zr(this,e,t)},getLineTokens:function(e,t){return zr(this,qo(e),t,!0)},getTokenTypeAt:function(e){e=ve(this.doc,e);var t,n=qr(this,Xr(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch;if(0==o)t=n[2];else for(;;){var a=r+i>>1;if((a?n[2*a-1]:0)>=o)i=a;else{if(!(n[2*a+1]l?t:0==l?null:t.slice(0,l-1)},getModeAt:function(t){var n=this.doc.mode;return n.innerMode?e.innerMode(n,this.getTokenAt(t).state).mode:n},getHelper:function(e,t){return this.getHelpers(e,t)[0]},getHelpers:function(e,t){var n=[];if(!na.hasOwnProperty(t))return n;var r=na[t],i=this.getModeAt(e);if("string"==typeof i[t])r[i[t]]&&n.push(r[i[t]]);else if(i[t])for(var o=0;oi&&(e=i,r=!0),n=Xr(this.doc,e)}else n=e;return ut(this,n,{top:0,left:0},t||"page").top+(r?this.doc.height-ti(n):0)},defaultTextHeight:function(){return yt(this.display)},defaultCharWidth:function(){return bt(this.display)},setGutterMarker:Et(function(e,t,n){return Rn(this.doc,e,"gutter",function(e){var r=e.gutterMarkers||(e.gutterMarkers={});return r[t]=n,!n&&ji(r)&&(e.gutterMarkers=null),!0})}),clearGutter:Et(function(e){var t=this,n=t.doc,r=n.first;n.iter(function(n){n.gutterMarkers&&n.gutterMarkers[e]&&(n.gutterMarkers[e]=null,Pt(t,r,"gutter"),ji(n.gutterMarkers)&&(n.gutterMarkers=null)),++r})}),lineInfo:function(e){if("number"==typeof e){if(!be(this.doc,e))return null;var t=e;if(e=Xr(this.doc,e),!e)return null}else{var t=Jr(e);if(null==t)return null}return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o=this.display;e=pt(this,ve(this.doc,e));var a=e.bottom,l=e.left;if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),o.sizer.appendChild(t),"over"==r)a=e.top;else if("above"==r||"near"==r){var s=Math.max(o.wrapper.clientHeight,this.doc.height),c=Math.max(o.sizer.clientWidth,o.lineSpace.clientWidth);("above"==r||e.bottom+t.offsetHeight>s)&&e.top>t.offsetHeight?a=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=s&&(a=e.bottom),l+t.offsetWidth>c&&(l=c-t.offsetWidth)}t.style.top=a+"px",t.style.left=t.style.right="","right"==i?(l=o.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?l=0:"middle"==i&&(l=(o.sizer.clientWidth-t.offsetWidth)/2),t.style.left=l+"px"),n&&qn(this,l,a,l+t.offsetWidth,a+t.offsetHeight)},triggerOnKeyDown:Et(un),triggerOnKeyPress:Et(pn),triggerOnKeyUp:dn,execCommand:function(e){return oa.hasOwnProperty(e)?oa[e](this):void 0},triggerElectric:Et(function(e){te(this,e)}),findPosH:function(e,t,n,r){var i=1;0>t&&(i=-1,t=-t);for(var o=0,a=ve(this.doc,e);t>o&&(a=Fn(this.doc,a,i,n,r),!a.hitSide);++o);return a},moveH:Et(function(e,t){var n=this;n.extendSelectionsBy(function(r){return n.display.shift||n.doc.extend||r.empty()?Fn(n.doc,r.head,e,t,n.options.rtlMoveVisually):0>e?r.from():r.to()},qa)}),deleteH:Et(function(e,t){var n=this.doc.sel,r=this.doc;n.somethingSelected()?r.replaceSelection("",null,"+delete"):Wn(this,function(n){var i=Fn(r,n.head,e,t,!1);return 0>e?{from:i,to:n.head}:{from:n.head,to:i}})}),findPosV:function(e,t,n,r){var i=1,o=r;0>t&&(i=-1,t=-t);for(var a=0,l=ve(this.doc,e);t>a;++a){var s=pt(this,l,"div");if(null==o?o=s.left:s.left=o,l=Hn(this,s,i,n),l.hitSide)break}return l},moveV:Et(function(e,t){var n=this,r=this.doc,i=[],o=!n.display.shift&&!r.extend&&r.sel.somethingSelected();if(r.extendSelectionsBy(function(a){if(o)return 0>e?a.from():a.to();var l=pt(n,a.head,"div");null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left);var s=Hn(n,l,e,t);return"page"==t&&a==r.sel.primary()&&In(n,null,dt(n,s,"div").top-l.top),s},qa),i.length)for(var a=0;a0&&l(n.charAt(r-1));)--r;for(;i.5)&&a(this),La(this,"refresh",this)}),swapDoc:Et(function(e){var t=this.doc;return t.cm=null,Kr(this,e),lt(this),this.display.input.reset(),this.scrollTo(e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,_i(this,"swapDoc",this,t),t}),getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},Mi(e);var Xo=e.defaults={},Zo=e.optionHandlers={},Yo=e.Init={toString:function(){return"CodeMirror.Init"}};$n("value","",function(e,t){e.setValue(t)},!0),$n("mode",null,function(e,t){e.doc.modeOption=t,n(e)},!0),$n("indentUnit",2,n,!0),$n("indentWithTabs",!1),$n("smartIndent",!0),$n("tabSize",4,function(e){r(e),lt(e),It(e)},!0),$n("specialChars",/[\t\u0000-\u0019\u00ad\u200b-\u200f\u2028\u2029\ufeff]/g,function(t,n,r){t.state.specialChars=new RegExp(n.source+(n.test(" ")?"":"| "),"g"),r!=e.Init&&t.refresh()}),$n("specialCharPlaceholder",Dr,function(e){e.refresh()},!0),$n("electricChars",!0),$n("inputStyle",So?"contenteditable":"textarea",function(){throw new Error("inputStyle can not (yet) be changed in a running editor")},!0),$n("rtlMoveVisually",!Lo),$n("wholeLineUpdateBefore",!0),$n("theme","default",function(e){l(e),s(e)},!0),$n("keyMap","default",function(t,n,r){var i=Un(n),o=r!=e.Init&&Un(r);o&&o.detach&&o.detach(t,i),i.attach&&i.attach(t,o||null)}),$n("extraKeys",null),$n("lineWrapping",!1,i,!0),$n("gutters",[],function(e){p(e.options),s(e)},!0),$n("fixedGutter",!0,function(e,t){e.display.gutters.style.left=t?C(e.display)+"px":"0",e.refresh()},!0),$n("coverGutterNextToScrollbar",!1,function(e){y(e)},!0),$n("scrollbarStyle","native",function(e){v(e),y(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)},!0),$n("lineNumbers",!1,function(e){p(e.options),s(e)},!0),$n("firstLineNumber",1,s,!0),$n("lineNumberFormatter",function(e){return e},s,!0),$n("showCursorWhenSelecting",!1,Ne,!0),$n("resetSelectionOnContextMenu",!0),$n("lineWiseCopyCut",!0),$n("readOnly",!1,function(e,t){"nocursor"==t?(gn(e),e.display.input.blur(),e.display.disabled=!0):(e.display.disabled=!1,t||e.display.input.reset())}),$n("disableInput",!1,function(e,t){t||e.display.input.reset()},!0),$n("dragDrop",!0,$t),$n("cursorBlinkRate",530),$n("cursorScrollMargin",0),$n("cursorHeight",1,Ne,!0),$n("singleCursorHeightPerLine",!0,Ne,!0),$n("workTime",100),$n("workDelay",100),$n("flattenSpans",!0,r,!0),$n("addModeClass",!1,r,!0),$n("pollInterval",100),$n("undoDepth",200,function(e,t){e.doc.history.undoDepth=t}),$n("historyEventDelay",1250),$n("viewportMargin",10,function(e){e.refresh()},!0),$n("maxHighlightLength",1e4,r,!0),$n("moveInputWithCursor",!0,function(e,t){t||e.display.input.resetPosition()}),$n("tabindex",null,function(e,t){e.display.input.getField().tabIndex=t||""}),$n("autofocus",null);var Qo=e.modes={},Jo=e.mimeModes={};e.defineMode=function(t,n){e.defaults.mode||"null"==t||(e.defaults.mode=t),arguments.length>2&&(n.dependencies=Array.prototype.slice.call(arguments,2)),Qo[t]=n},e.defineMIME=function(e,t){Jo[e]=t},e.resolveMode=function(t){if("string"==typeof t&&Jo.hasOwnProperty(t))t=Jo[t];else if(t&&"string"==typeof t.name&&Jo.hasOwnProperty(t.name)){var n=Jo[t.name];"string"==typeof n&&(n={name:n}),t=Ni(n,t),t.name=n.name}else if("string"==typeof t&&/^[\w\-]+\/[\w\-]+\+xml$/.test(t))return e.resolveMode("application/xml");return"string"==typeof t?{name:t}:t||{name:"null"}},e.getMode=function(t,n){var n=e.resolveMode(n),r=Qo[n.name];if(!r)return e.getMode(t,"text/plain");var i=r(t,n);if(ea.hasOwnProperty(n.name)){var o=ea[n.name];for(var a in o)o.hasOwnProperty(a)&&(i.hasOwnProperty(a)&&(i["_"+a]=i[a]),i[a]=o[a])}if(i.name=n.name,n.helperType&&(i.helperType=n.helperType),n.modeProps)for(var a in n.modeProps)i[a]=n.modeProps[a];return i},e.defineMode("null",function(){return{token:function(e){e.skipToEnd()}}}),e.defineMIME("text/plain","null");var ea=e.modeExtensions={};e.extendMode=function(e,t){var n=ea.hasOwnProperty(e)?ea[e]:ea[e]={};Ii(t,n)},e.defineExtension=function(t,n){e.prototype[t]=n},e.defineDocExtension=function(e,t){ba.prototype[e]=t},e.defineOption=$n;var ta=[];e.defineInitHook=function(e){ta.push(e)};var na=e.helpers={};e.registerHelper=function(t,n,r){na.hasOwnProperty(t)||(na[t]=e[t]={_global:[]}),na[t][n]=r},e.registerGlobalHelper=function(t,n,r,i){e.registerHelper(t,n,i),na[t]._global.push({pred:r,val:i})};var ra=e.copyState=function(e,t){if(t===!0)return t;if(e.copyState)return e.copyState(t);var n={};for(var r in t){var i=t[r];i instanceof Array&&(i=i.concat([])),n[r]=i}return n},ia=e.startState=function(e,t,n){return e.startState?e.startState(t,n):!0};e.innerMode=function(e,t){for(;e.innerMode;){var n=e.innerMode(t);if(!n||n.mode==e)break;t=n.state,e=n.mode}return n||{mode:e,state:t}};var oa=e.commands={selectAll:function(e){e.setSelection(qo(e.firstLine(),0),qo(e.lastLine()),Ea)},singleSelection:function(e){e.setSelection(e.getCursor("anchor"),e.getCursor("head"),Ea)},killLine:function(e){Wn(e,function(t){if(t.empty()){var n=Xr(e.doc,t.head.line).text.length;return t.head.ch==n&&t.head.line0)i=new qo(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),qo(i.line,i.ch-2),i,"+transpose");else if(i.line>e.doc.first){var a=Xr(e.doc,i.line-1).text;a&&e.replaceRange(o.charAt(0)+"\n"+a.charAt(a.length-1),qo(i.line-1,a.length-1),qo(i.line,1),"+transpose")}n.push(new pe(i,i))}e.setSelections(n)})},newlineAndIndent:function(e){At(e,function(){for(var t=e.listSelections().length,n=0;t>n;n++){var r=e.listSelections()[n];e.replaceRange("\n",r.anchor,r.head,"+input"),e.indentLine(r.from().line+1,null,!0),Pn(e)}})},toggleOverwrite:function(e){e.toggleOverwrite()}},aa=e.keyMap={};aa.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},aa.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},aa.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars"},aa.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},aa["default"]=Mo?aa.macDefault:aa.pcDefault,e.normalizeKeyMap=function(e){var t={};for(var n in e)if(e.hasOwnProperty(n)){var r=e[n];if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue;if("..."==r){delete e[n];continue}for(var i=Oi(n.split(" "),Bn),o=0;o=this.string.length},sol:function(){return this.pos==this.lineStart},peek:function(){return this.string.charAt(this.pos)||void 0},next:function(){return this.post},eatSpace:function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>e},skipToEnd:function(){this.pos=this.string.length},skipTo:function(e){var t=this.string.indexOf(e,this.pos);return t>-1?(this.pos=t,!0):void 0},backUp:function(e){this.pos-=e},column:function(){return this.lastColumnPos0?null:(r&&t!==!1&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e},o=this.string.substr(this.pos,e.length);return i(o)==i(e)?(t!==!1&&(this.pos+=e.length),!0):void 0},current:function(){return this.string.slice(this.start,this.pos)},hideFirstChars:function(e,t){this.lineStart+=e;try{return t()}finally{this.lineStart-=e}}};var fa=0,da=e.TextMarker=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++fa};Mi(da),da.prototype.clear=function(){if(!this.explicitlyCleared){var e=this.doc.cm,t=e&&!e.curOp;if(t&&xt(e),Si(this,"clear")){var n=this.find();n&&_i(this,"clear",n.from,n.to)}for(var r=null,i=null,o=0;oe.display.maxLineLength&&(e.display.maxLine=s,e.display.maxLineLength=c,e.display.maxLineChanged=!0)}null!=r&&e&&this.collapsed&&It(e,r,i+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,e&&Ee(e.doc)),e&&_i(e,"markerCleared",e,this),t&&kt(e),this.parent&&this.parent.clear()}},da.prototype.find=function(e,t){null==e&&"bookmark"==this.type&&(e=1);for(var n,r,i=0;in;++n){var i=this.lines[n];this.height-=i.height,Mr(i),_i(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e));for(var r=0;re;++e)if(n(this.lines[e]))return!0}},Vr.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){this.size-=t;for(var n=0;ne){var o=Math.min(t,i-e),a=r.height;if(r.removeInner(e,o),this.height-=a-r.height,i==o&&(this.children.splice(n--,1),r.parent=null),0==(t-=o))break;e=0}else e-=i}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof Ur))){var l=[];this.collapse(l),this.children=[new Ur(l)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t=e){if(i.insertInner(e,t,n),i.lines&&i.lines.length>50){for(;i.lines.length>50;){var a=i.lines.splice(i.lines.length-25,25),l=new Ur(a);i.height-=l.height,this.children.splice(r+1,0,l),l.parent=this}this.maybeSpill()}break}e-=o}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this;do{var t=e.children.splice(e.children.length-5,5),n=new Vr(t);if(e.parent){e.size-=n.size,e.height-=n.height;var r=Ei(e.parent.children,e);e.parent.children.splice(r+1,0,n)}else{var i=new Vr(e.children);i.parent=e,e.children=[i,n],e=i}n.parent=e.parent}while(e.children.length>10);e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;re){var a=Math.min(t,o-e);if(i.iterN(e,a,n))return!0;if(0==(t-=a))break;e=0}else e-=o}}};var ya=0,ba=e.Doc=function(e,t,n){if(!(this instanceof ba))return new ba(e,t,n);null==n&&(n=0),Vr.call(this,[new Ur([new ma("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.frontier=n;var r=qo(n,0);this.sel=me(r),this.history=new ri(null),this.id=++ya,this.modeOption=t,"string"==typeof e&&(e=Ka(e)),Br(this,{from:r,to:r,text:e}),Te(this,me(r),Ea)};ba.prototype=Ni(Vr.prototype,{constructor:ba,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r=0;o--)Cn(this,r[o]);l?Le(this,l):this.cm&&Pn(this.cm)}),undo:Ot(function(){Mn(this,"undo")}),redo:Ot(function(){Mn(this,"redo")}),undoSelection:Ot(function(){Mn(this,"undo",!0)}),redoSelection:Ot(function(){Mn(this,"redo",!0)}),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,n){e=ve(this,e),t=ve(this,t);var r=[],i=e.line;return this.iter(e.line,t.line+1,function(o){var a=o.markedSpans;if(a)for(var l=0;ls.to||null==s.from&&i!=e.line||i==t.line&&s.from>t.ch||n&&!n(s.marker)||r.push(s.marker.parent||s.marker)}++i}),r},getAllMarks:function(){var e=[];return this.iter(function(t){var n=t.markedSpans;if(n)for(var r=0;re?(t=e,!0):(e-=i,void++n)}),ve(this,qo(n,t))},indexFromPos:function(e){e=ve(this,e);var t=e.ch;return e.linet&&(t=e.from),null!=e.to&&e.tol||l>=t)return a+(t-o);a+=l-o,a+=n-a%n,o=l+1}},Ia=[""],Pa=function(e){e.select()};Co?Pa=function(e){e.selectionStart=0,e.selectionEnd=e.value.length}:mo&&(Pa=function(e){try{e.select()}catch(t){}});var Da,ja=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Ra=e.isWordChar=function(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||ja.test(e))},Wa=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;Da=document.createRange?function(e,t,n,r){var i=document.createRange();return i.setEnd(r||e,n),i.setStart(e,t),i}:function(e,t,n){var r=document.body.createTextRange();try{r.moveToElementText(e.parentNode)}catch(i){return r}return r.collapse(!0),r.moveEnd("character",n),r.moveStart("character",t),r};var Fa=e.contains=function(e,t){if(3==t.nodeType&&(t=t.parentNode),e.contains)return e.contains(t);do if(11==t.nodeType&&(t=t.host),t==e)return!0;while(t=t.parentNode)};mo&&11>go&&($i=function(){try{return document.activeElement}catch(e){return document.body}});var Ha,$a,Ba=e.rmClass=function(e,t){var n=e.className,r=Bi(t).exec(n);if(r){var i=n.slice(r.index+r[0].length);e.className=n.slice(0,r.index)+(i?r[1]+i:"")}},Ua=e.addClass=function(e,t){var n=e.className;Bi(t).test(n)||(e.className+=(n?" ":"")+t)},Va=!1,Ga=function(){if(mo&&9>go)return!1;var e=Wi("div");return"draggable"in e||"dragDrop"in e}(),Ka=e.splitLines=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;r>=t;){var i=e.indexOf("\n",t);-1==i&&(i=e.length);var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Xa=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(t){return!1}}:function(e){try{var t=e.ownerDocument.selection.createRange()}catch(n){}return t&&t.parentElement()==e?0!=t.compareEndPoints("StartToEnd",t):!1},Za=function(){var e=Wi("div");return"oncopy"in e?!0:(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy)}(),Ya=null,Qa={3:"Enter",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",107:"=",109:"-",127:"Delete",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"};e.keyNames=Qa,function(){for(var e=0;10>e;e++)Qa[e+48]=Qa[e+96]=String(e);for(var e=65;90>=e;e++)Qa[e]=String.fromCharCode(e);for(var e=1;12>=e;e++)Qa[e+111]=Qa[e+63235]="F"+e}();var Ja,el=function(){function e(e){return 247>=e?n.charAt(e):e>=1424&&1524>=e?"R":e>=1536&&1773>=e?r.charAt(e-1536):e>=1774&&2220>=e?"r":e>=8192&&8203>=e?"w":8204==e?"b":"L"}function t(e,t,n){this.level=e,this.from=t,this.to=n}var n="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",r="rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmm",i=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,o=/[stwN]/,a=/[LRr]/,l=/[Lb1n]/,s=/[1n]/,c="L";return function(n){if(!i.test(n))return!1;for(var r,u=n.length,f=[],d=0;u>d;++d)f.push(r=e(n.charCodeAt(d)));for(var d=0,p=c;u>d;++d){var r=f[d];"m"==r?f[d]=p:p=r}for(var d=0,h=c;u>d;++d){var r=f[d];"1"==r&&"r"==h?f[d]="n":a.test(r)&&(h=r,"r"==r&&(f[d]="R"))}for(var d=1,p=f[0];u-1>d;++d){var r=f[d];"+"==r&&"1"==p&&"1"==f[d+1]?f[d]="1":","!=r||p!=f[d+1]||"1"!=p&&"n"!=p||(f[d]=p),p=r}for(var d=0;u>d;++d){var r=f[d];if(","==r)f[d]="N";else if("%"==r){for(var m=d+1;u>m&&"%"==f[m];++m);for(var g=d&&"!"==f[d-1]||u>m&&"1"==f[m]?"1":"N",v=d;m>v;++v)f[v]=g;d=m-1}}for(var d=0,h=c;u>d;++d){var r=f[d];"L"==h&&"1"==r?f[d]="L":a.test(r)&&(h=r)}for(var d=0;u>d;++d)if(o.test(f[d])){for(var m=d+1;u>m&&o.test(f[m]);++m);for(var y="L"==(d?f[d-1]:c),b="L"==(u>m?f[m]:c),g=y||b?"L":"R",v=d;m>v;++v)f[v]=g;d=m-1}for(var x,_=[],d=0;u>d;)if(l.test(f[d])){var k=d;for(++d;u>d&&l.test(f[d]);++d);_.push(new t(0,k,d))}else{var w=d,C=_.length;for(++d;u>d&&"L"!=f[d];++d);for(var v=w;d>v;)if(s.test(f[v])){v>w&&_.splice(C,0,new t(1,w,v));var S=v;for(++v;d>v&&s.test(f[v]);++v);_.splice(C,0,new t(2,S,v)),w=v}else++v;d>w&&_.splice(C,0,new t(1,w,d))}return 1==_[0].level&&(x=n.match(/^\s+/))&&(_[0].from=x[0].length,_.unshift(new t(0,0,x[0].length))),1==zi(_).level&&(x=n.match(/\s+$/))&&(zi(_).to-=x[0].length,_.push(new t(0,u-x[0].length,u))),2==_[0].level&&_.unshift(new t(1,_[0].to,_[0].to)),_[0].level!=zi(_).level&&_.push(new t(_[0].level,u,u)),_}}();return e.version="5.4.0",e}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)2){r.pending=[];for(var d=2;d-1)return e.Pass;var a=r.indent.length-1,l=t[r.state];e:for(;;){for(var c=0;ca?0:r.indent[a]}}e.defineSimpleMode=function(t,n){e.defineMode(t,function(t){return e.simpleMode(t,n)})},e.simpleMode=function(n,r){t(r,"start");var a={},l=r.meta||{},s=!1;for(var u in r)if(u!=l&&r.hasOwnProperty(u))for(var f=a[u]=[],d=r[u],p=0;p-1?i+t.length:i}var o=t.exec(n?e.slice(n):e);return o?o.index+n+(r?o[0].length:0):-1}var r=Array.prototype.slice.call(arguments,1);return{startState:function(){return{outer:e.startState(t),innerActive:null,inner:null}},copyState:function(n){return{outer:e.copyState(t,n.outer),innerActive:n.innerActive,inner:n.innerActive&&e.copyState(n.innerActive.mode,n.inner)}},token:function(i,o){if(o.innerActive){var a=o.innerActive,l=i.string;if(!a.close&&i.sol())return o.innerActive=o.inner=null,this.token(i,o);var s=a.close?n(l,a.close,i.pos,a.parseDelimiters):-1;if(s==i.pos&&!a.parseDelimiters)return i.match(a.close),o.innerActive=o.inner=null,a.delimStyle;s>-1&&(i.string=l.slice(0,s));var c=a.mode.token(i,o.inner);return s>-1&&(i.string=l),s==i.pos&&a.parseDelimiters&&(o.innerActive=o.inner=null),a.innerStyle&&(c=c?c+" "+a.innerStyle:a.innerStyle),c}for(var u=1/0,l=i.string,f=0;fs&&(u=s)}u!=1/0&&(i.string=l.slice(0,u));var p=t.token(i,o.outer);return u!=1/0&&(i.string=l),p},indent:function(n,r){var i=n.innerActive?n.innerActive.mode:t;return i.indent?i.indent(n.innerActive?n.inner:n.outer,r):e.Pass},blankLine:function(n){var i=n.innerActive?n.innerActive.mode:t;if(i.blankLine&&i.blankLine(n.innerActive?n.inner:n.outer),n.innerActive)"\n"===n.innerActive.close&&(n.innerActive=n.inner=null);else for(var o=0;o-1)return u=n(s,c,u),{from:r(o.line,u),to:r(o.line,u+a.length)}}else{var s=e.getLine(o.line).slice(o.ch),c=l(s),u=c.indexOf(t);if(u>-1)return u=n(s,c,u)+o.ch,{from:r(o.line,u),to:r(o.line,u+a.length)}}}:function(){};else{var c=a.split("\n");this.matches=function(t,n){var i=s.length-1;if(t){if(n.line-(s.length-1)=1;--u,--a)if(s[u]!=l(e.getLine(a)))return;var f=e.getLine(a),d=f.length-c[0].length;if(l(f.slice(d))!=s[0])return;return{from:r(a,d),to:o}}if(!(n.line+(s.length-1)>e.lastLine())){var f=e.getLine(n.line),d=f.length-c[0].length;if(l(f.slice(d))==s[0]){for(var p=r(n.line,d),a=n.line+1,u=1;i>u;++u,++a)if(s[u]!=l(e.getLine(a)))return;if(l(e.getLine(a).slice(0,c[i].length))==s[i])return{from:p,to:r(a,c[i].length)}}}}}}}function n(e,t,n){if(e.length==t.length)return n;for(var r=Math.min(n,e.length);;){var i=e.slice(0,r).toLowerCase().length;if(n>i)++r;else{if(!(i>n))return r;--r}}}var r=e.Pos;t.prototype={findNext:function(){return this.find(!1)},findPrevious:function(){return this.find(!0)},find:function(e){function t(e){var t=r(e,0);return n.pos={from:t,to:t},n.atOccurrence=!1,!1}for(var n=this,i=this.doc.clipPos(e?this.pos.from:this.pos.to);;){if(this.pos=this.matches(e,i))return this.atOccurrence=!0,this.pos.match||!0;if(e){if(!i.line)return t(0);i=r(i.line-1,this.doc.getLine(i.line-1).length)}else{var o=this.doc.lineCount();if(i.line==o-1)return t(o);i=r(i.line+1,0)}}},from:function(){return this.atOccurrence?this.pos.from:void 0},to:function(){return this.atOccurrence?this.pos.to:void 0},replace:function(t,n){if(this.atOccurrence){var i=e.splitLines(t);this.doc.replaceRange(i,this.pos.from,this.pos.to,n),this.pos.to=r(this.pos.from.line+i.length-1,i[i.length-1].length+(1==i.length?this.pos.from.ch:0))}}},e.defineExtension("getSearchCursor",function(e,n,r){return new t(this.doc,e,n,r)}),e.defineDocExtension("getSearchCursor",function(e,n,r){return new t(this,e,n,r)}),e.defineExtension("selectMatches",function(t,n){for(var r=[],i=this.getSearchCursor(t,this.getCursor("from"),n);i.findNext()&&!(e.cmpPos(i.to(),this.getCursor("to"))>0);)r.push({anchor:i.from(),head:i.to()});r.length&&this.setSelections(r,0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../dialog/dialog"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){return"string"==typeof e?e=new RegExp(e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),t?"gi":"g"):e.global||(e=new RegExp(e.source,e.ignoreCase?"gi":"g")),{token:function(t){e.lastIndex=t.pos;var n=e.exec(t.string);return n&&n.index==t.pos?(t.pos+=n[0].length,"searching"):void(n?t.pos=n.index:t.skipToEnd())}}}function n(){this.posFrom=this.posTo=this.lastQuery=this.query=null,this.overlay=null}function r(e){return e.state.search||(e.state.search=new n)}function i(e){return"string"==typeof e&&e==e.toLowerCase()}function o(e,t,n){return e.getSearchCursor(t,n,i(t))}function a(e,t,n,r,i){e.openDialog?e.openDialog(t,i,{value:r,selectValueOnOpen:!0}):i(prompt(n,r))}function l(e,t,n,r){e.openConfirm?e.openConfirm(t,r):confirm(n)&&r[0]()}function s(e){var t=e.match(/^\/(.*)\/([a-z]*)$/);if(t)try{e=new RegExp(t[1],-1==t[2].indexOf("i")?"":"i")}catch(n){}return("string"==typeof e?""==e:e.test(""))&&(e=/x^/),e}function c(e,n){var o=r(e);if(o.query)return u(e,n);var l=e.getSelection()||o.lastQuery;a(e,p,"Search for:",l,function(r){e.operation(function(){r&&!o.query&&(o.query=s(r),e.removeOverlay(o.overlay,i(o.query)),o.overlay=t(o.query,i(o.query)),e.addOverlay(o.overlay),e.showMatchesOnScrollbar&&(o.annotate&&(o.annotate.clear(),o.annotate=null),o.annotate=e.showMatchesOnScrollbar(o.query,i(o.query))),o.posFrom=o.posTo=e.getCursor(),u(e,n))})})}function u(t,n){t.operation(function(){var i=r(t),a=o(t,i.query,n?i.posFrom:i.posTo);(a.find(n)||(a=o(t,i.query,n?e.Pos(t.lastLine()):e.Pos(t.firstLine(),0)),a.find(n)))&&(t.setSelection(a.from(),a.to()),t.scrollIntoView({from:a.from(),to:a.to()}),i.posFrom=a.from(),i.posTo=a.to())})}function f(e){e.operation(function(){var t=r(e);t.lastQuery=t.query,t.query&&(t.query=null,e.removeOverlay(t.overlay),t.annotate&&(t.annotate.clear(),t.annotate=null))})}function d(e,t){if(!e.getOption("readOnly")){var n=e.getSelection()||r(e).lastQuery;a(e,h,"Replace:",n,function(n){n&&(n=s(n),a(e,m,"Replace with:","",function(r){if(t)e.operation(function(){for(var t=o(e,n);t.findNext();)if("string"!=typeof n){var i=e.getRange(t.from(),t.to()).match(n);t.replace(r.replace(/\$(\d)/g,function(e,t){return i[t]}),"+input")}else t.replace(r,"+input")});else{f(e);var i=o(e,n,e.getCursor()),a=function(){var t,r=i.from();!(t=i.findNext())&&(i=o(e,n),!(t=i.findNext())||r&&i.from().line==r.line&&i.from().ch==r.ch)||(e.setSelection(i.from(),i.to()),e.scrollIntoView({from:i.from(),to:i.to()}),l(e,g,"Replace?",[function(){s(t)},a]))},s=function(e){i.replace("string"==typeof n?r:r.replace(/\$(\d)/g,function(t,n){return e[n]}),"+input"),a()};a()}}))})}}var p='Search: (Use /re/ syntax for regexp search)',h='Replace: (Use /re/ syntax for regexp search)',m='With: ',g="Replace? ";e.commands.find=function(e){f(e),c(e)},e.commands.findNext=c,e.commands.findPrev=function(e){c(e,!0)},e.commands.clearSearch=f,e.commands.replace=d,e.commands.replaceAll=function(e){d(e,!0)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./searchcursor"),require("../scroll/annotatescrollbar")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./searchcursor","../scroll/annotatescrollbar"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t,n,r){this.cm=e,this.options=r;var i={listenForChanges:!1};for(var o in r)i[o]=r[o];i.className||(i.className="CodeMirror-search-match"),this.annotation=e.annotateScrollbar(i),this.query=t,this.caseFold=n,this.gap={from:e.firstLine(),to:e.lastLine()+1},this.matches=[],this.update=null,this.findMatches(),this.annotation.update(this.matches);var a=this;e.on("change",this.changeHandler=function(e,t){a.onChange(t)})}function n(e,t,n){return t>=e?e:Math.max(t,e+n)}e.defineExtension("showMatchesOnScrollbar",function(e,n,r){return"string"==typeof r&&(r={className:r}),r||(r={}),new t(this,e,n,r)});var r=1e3;t.prototype.findMatches=function(){if(this.gap){for(var t=0;t=this.gap.to)break;n.to.line>=this.gap.from&&this.matches.splice(t--,1)}for(var i=this.cm.getSearchCursor(this.query,e.Pos(this.gap.from,0),this.caseFold),o=this.options&&this.options.maxMatches||r;i.findNext();){var n={from:i.from(),to:i.to()};if(n.from.line>=this.gap.to)break;if(this.matches.splice(t++,0,n),this.matches.length>o)break}this.gap=null}},t.prototype.onChange=function(t){var r=t.from.line,i=e.changeEnd(t).line,o=i-t.to.line;if(this.gap?(this.gap.from=Math.min(n(this.gap.from,r,o),t.from.line),this.gap.to=Math.max(n(this.gap.to,r,o),t.from.line)):this.gap={from:t.from.line,to:i+1},o)for(var a=0;al&&e.addOverlay(t.overlay=a(o.slice(l,s),n,t.style)))}var c=e.getCursor("from"),u=e.getCursor("to");if(c.line==u.line&&(!t.wordsOnly||i(e,c,u))){var f=e.getRange(c,u).replace(/^\s+|\s+$/g,"");f.length>=t.minChars&&e.addOverlay(t.overlay=a(f,!1,t.style))}})}function i(e,t,n){var r=e.getRange(t,n);if(null!==r.match(/^\w+$/)){if(t.ch>0){var i={line:t.line,ch:t.ch-1},o=e.getRange(i,t);if(null===o.match(/\W/))return!1}if(n.chr.right?1:0:t.clientYr.bottom?1:0,o.moveTo(o.pos+n*o.screen)}),e.on(this.node,"mousewheel",i),e.on(this.node,"DOMMouseScroll",i)}function n(e,n,r){this.addClass=e,this.horiz=new t(e,"horizontal",r),n(this.horiz.node),this.vert=new t(e,"vertical",r),n(this.vert.node),this.width=null}t.prototype.moveTo=function(e,t){0>e&&(e=0),e>this.total-this.screen&&(e=this.total-this.screen),e!=this.pos&&(this.pos=e,this.inner.style["horizontal"==this.orientation?"left":"top"]=e*(this.size/this.total)+"px",t!==!1&&this.scroll(e,this.orientation))};var r=10;t.prototype.update=function(e,t,n){this.screen=t,this.total=e,this.size=n;var i=this.screen*(this.size/this.total);r>i&&(this.size-=r-i,i=r),this.inner.style["horizontal"==this.orientation?"width":"height"]=i+"px",this.inner.style["horizontal"==this.orientation?"left":"top"]=this.pos*(this.size/this.total)+"px"},n.prototype.update=function(e){if(null==this.width){var t=window.getComputedStyle?window.getComputedStyle(this.horiz.node):this.horiz.node.currentStyle;t&&(this.width=parseInt(t.height))}var n=this.width||0,r=e.scrollWidth>e.clientWidth+1,i=e.scrollHeight>e.clientHeight+1;return this.vert.node.style.display=i?"block":"none",this.horiz.node.style.display=r?"block":"none",i&&(this.vert.update(e.scrollHeight,e.clientHeight,e.viewHeight-(r?n:0)),this.vert.node.style.display="block",this.vert.node.style.bottom=r?n+"px":"0"),r&&(this.horiz.update(e.scrollWidth,e.clientWidth,e.viewWidth-(i?n:0)-e.barLeft),this.horiz.node.style.right=i?n+"px":"0",this.horiz.node.style.left=e.barLeft+"px"),{right:i?n:0,bottom:r?n:0}},n.prototype.setScrollTop=function(e){this.vert.moveTo(e,!1)},n.prototype.setScrollLeft=function(e){this.horiz.moveTo(e,!1)},n.prototype.clear=function(){var e=this.horiz.node.parentNode;e.removeChild(this.horiz.node),e.removeChild(this.vert.node)},e.scrollbarModel.simple=function(e,t){return new n("CodeMirror-simplescroll",e,t)},e.scrollbarModel.overlay=function(e,t){return new n("CodeMirror-overlayscroll",e,t)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e,t){function n(e){clearTimeout(r.doRedraw),r.doRedraw=setTimeout(function(){r.redraw()},e)}this.cm=e,this.options=t,this.buttonHeight=t.scrollButtonHeight||e.getOption("scrollButtonHeight"),this.annotations=[],this.doRedraw=this.doUpdate=null,this.div=e.getWrapperElement().appendChild(document.createElement("div")),this.div.style.cssText="position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none",this.computeScale();var r=this;e.on("refresh",this.resizeHandler=function(){clearTimeout(r.doUpdate),r.doUpdate=setTimeout(function(){r.computeScale()&&n(20)},100)}),e.on("markerAdded",this.resizeHandler),e.on("markerCleared",this.resizeHandler),t.listenForChanges!==!1&&e.on("change",this.changeHandler=function(){n(250)})}e.defineExtension("annotateScrollbar",function(e){return"string"==typeof e&&(e={className:e}),new t(this,e)}),e.defineOption("scrollButtonHeight",0),t.prototype.computeScale=function(){var e=this.cm,t=(e.getWrapperElement().clientHeight-e.display.barHeight-2*this.buttonHeight)/e.heightAtLine(e.lastLine()+1,"local");return t!=this.hScale?(this.hScale=t,!0):void 0},t.prototype.update=function(e){this.annotations=e,this.redraw()},t.prototype.redraw=function(e){function t(e,t){if(s!=e.line&&(s=e.line,c=n.getLineHandle(s)),a&&c.height>l)return n.charCoords(e,"local")[t?"top":"bottom"];var r=n.heightAtLine(c,"local");return r+(t?0:c.height)}e!==!1&&this.computeScale();var n=this.cm,r=this.hScale,i=document.createDocumentFragment(),o=this.annotations,a=n.getOption("lineWrapping"),l=a&&1.5*n.defaultTextHeight(),s=null,c=null;if(n.display.barWidth)for(var u,f=0;fh+.9));)d=o[++f],h=t(d.to,!1)*r;if(h!=p){var m=Math.max(h-p,3),g=i.appendChild(document.createElement("div"));g.style.cssText="position: absolute; right: 0px; width: "+Math.max(1.5*n.display.barWidth,2)+"px; top: "+(p+this.buttonHeight)+"px; height: "+m+"px",g.className=this.options.className}}this.div.textContent="",this.div.appendChild(i)},t.prototype.clear=function(){this.cm.off("refresh",this.resizeHandler),this.cm.off("markerAdded",this.resizeHandler),this.cm.off("markerCleared",this.resizeHandler),this.changeHandler&&this.cm.off("change",this.changeHandler),this.div.parentNode.removeChild(this.div)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n,r){this.cm=e,this.node=t,this.options=n,this.height=r,this.cleared=!1}function n(e){var t=e.getWrapperElement(),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r=parseInt(n.height),i=e.state.panels={setHeight:t.style.height,heightLeft:r,panels:0,wrapper:document.createElement("div")};t.parentNode.insertBefore(i.wrapper,t);var o=e.hasFocus();i.wrapper.appendChild(t),o&&e.focus(),e._setSize=e.setSize,null!=r&&(e.setSize=function(t,n){if(null==n)return this._setSize(t,n);if(i.setHeight=n,"number"!=typeof n){var o=/^(\d+\.?\d*)px$/.exec(n);o?n=Number(o[1]):(i.wrapper.style.height=n,n=i.wrapper.offsetHeight,i.wrapper.style.height="")}e._setSize(t,i.heightLeft+=n-r),r=n})}function r(e){var t=e.state.panels;e.state.panels=null;var n=e.getWrapperElement();t.wrapper.parentNode.replaceChild(n,t.wrapper),n.style.height=t.setHeight,e.setSize=e._setSize,e.setSize()}e.defineExtension("addPanel",function(e,r){r=r||{},this.state.panels||n(this);var i=this.state.panels,o=i.wrapper,a=this.getWrapperElement();r.after instanceof t&&!r.after.cleared?o.insertBefore(e,r.before.node.nextSibling):r.before instanceof t&&!r.before.cleared?o.insertBefore(e,r.before.node):r.replace instanceof t&&!r.replace.cleared?(o.insertBefore(e,r.replace.node),r.replace.clear()):"bottom"==r.position?o.appendChild(e):"before-bottom"==r.position?o.insertBefore(e,a.nextSibling):"after-top"==r.position?o.insertBefore(e,a):o.insertBefore(e,o.firstChild);var l=r&&r.height||e.offsetHeight;return this._setSize(null,i.heightLeft-=l),i.panels++,new t(this,e,r,l)}),t.prototype.clear=function(){if(!this.cleared){this.cleared=!0;var e=this.cm.state.panels;this.cm._setSize(null,e.heightLeft+=this.height),e.wrapper.removeChild(this.node),0==--e.panels&&r(this.cm)}},t.prototype.changed=function(e){var t=null==e?this.node.offsetHeight:e,n=this.cm.state.panels;this.cm._setSize(null,n.height+=t-this.height),this.height=t}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e){e.state.placeholder&&(e.state.placeholder.parentNode.removeChild(e.state.placeholder),e.state.placeholder=null)}function n(e){t(e);var n=e.state.placeholder=document.createElement("pre");n.style.cssText="height: 0; overflow: visible",n.className="CodeMirror-placeholder",n.appendChild(document.createTextNode(e.getOption("placeholder"))),e.display.lineSpace.insertBefore(n,e.display.lineSpace.firstChild)}function r(e){o(e)&&n(e)}function i(e){var r=e.getWrapperElement(),i=o(e);r.className=r.className.replace(" CodeMirror-empty","")+(i?" CodeMirror-empty":""),i?n(e):t(e)}function o(e){return 1===e.lineCount()&&""===e.getLine(0)}e.defineOption("placeholder","",function(n,o,a){var l=a&&a!=e.Init;if(o&&!l)n.on("blur",r),n.on("change",i),i(n);else if(!o&&l){n.off("blur",r),n.off("change",i),t(n);var s=n.getWrapperElement();s.className=s.className.replace(" CodeMirror-empty","")}o&&!n.hasFocus()&&r(n)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,n){var r,i=e.getWrapperElement();return r=i.appendChild(document.createElement("div")),r.className=n?"CodeMirror-dialog CodeMirror-dialog-bottom":"CodeMirror-dialog CodeMirror-dialog-top","string"==typeof t?r.innerHTML=t:r.appendChild(t),r}function n(e,t){e.state.currentNotificationClose&&e.state.currentNotificationClose(),e.state.currentNotificationClose=t}e.defineExtension("openDialog",function(r,i,o){function a(e){if("string"==typeof e)f.value=e;else{if(c)return;c=!0,s.parentNode.removeChild(s),u.focus(),o.onClose&&o.onClose(s)}}o||(o={}),n(this,null);var l,s=t(this,r,o.bottom),c=!1,u=this,f=s.getElementsByTagName("input")[0];return f?(o.value&&(f.value=o.value,o.selectValueOnOpen!==!1&&f.select()),o.onInput&&e.on(f,"input",function(e){o.onInput(e,f.value,a)}),o.onKeyUp&&e.on(f,"keyup",function(e){o.onKeyUp(e,f.value,a)}),e.on(f,"keydown",function(t){o&&o.onKeyDown&&o.onKeyDown(t,f.value,a)||((27==t.keyCode||o.closeOnEnter!==!1&&13==t.keyCode)&&(f.blur(),e.e_stop(t),a()),13==t.keyCode&&i(f.value,t))}),o.closeOnBlur!==!1&&e.on(f,"blur",a),f.focus()):(l=s.getElementsByTagName("button")[0])&&(e.on(l,"click",function(){a(),u.focus()}),o.closeOnBlur!==!1&&e.on(l,"blur",a),l.focus()),a}),e.defineExtension("openConfirm",function(r,i,o){function a(){c||(c=!0,l.parentNode.removeChild(l),u.focus())}n(this,null);var l=t(this,r,o&&o.bottom),s=l.getElementsByTagName("button"),c=!1,u=this,f=1;s[0].focus();for(var d=0;d=f&&a()},200)}),e.on(p,"focus",function(){++f})}}),e.defineExtension("openNotification",function(r,i){function o(){s||(s=!0,clearTimeout(a),l.parentNode.removeChild(l))}n(this,o);var a,l=t(this,r,i&&i.bottom),s=!1,c=i&&"undefined"!=typeof i.duration?i.duration:5e3;return e.on(l,"click",function(t){e.e_preventDefault(t),o()}),c&&(a=setTimeout(o,c)),o})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t,r,i){var o=e.getLineHandle(t.line),s=t.ch-1,c=s>=0&&l[o.text.charAt(s)]||l[o.text.charAt(++s)];if(!c)return null;var u=">"==c.charAt(1)?1:-1;if(r&&u>0!=(s==t.ch))return null;var f=e.getTokenTypeAt(a(t.line,s+1)),d=n(e,a(t.line,s+(u>0?1:0)),u,f||null,i);return null==d?null:{from:a(t.line,s),to:d&&d.pos,match:d&&d.ch==c.charAt(0),forward:u>0}}function n(e,t,n,r,i){for(var o=i&&i.maxScanLineLength||1e4,s=i&&i.maxScanLines||1e3,c=[],u=i&&i.bracketRegex?i.bracketRegex:/[(){}[\]]/,f=n>0?Math.min(t.line+s,e.lastLine()+1):Math.max(e.firstLine()-1,t.line-s),d=t.line;d!=f;d+=n){var p=e.getLine(d);if(p){var h=n>0?0:p.length-1,m=n>0?p.length:-1;if(!(p.length>o))for(d==t.line&&(h=t.ch-(0>n?1:0));h!=m;h+=n){var g=p.charAt(h);if(u.test(g)&&(void 0===r||e.getTokenTypeAt(a(d,h+1))==r)){var v=l[g];if(">"==v.charAt(1)==n>0)c.push(g);else{if(!c.length)return{pos:a(d,h),ch:g};c.pop()}}}}}return d-n==(n>0?e.lastLine():e.firstLine())?!1:null}function r(e,n,r){for(var i=e.state.matchBrackets.maxHighlightLineLength||1e3,l=[],s=e.listSelections(),c=0;c",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",i),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return t(this,e,n,r)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:u[t]}function n(e){return function(t){return a(t,e)}}function r(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function i(n){var i=r(n);if(!i||n.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=n.listSelections(),l=0;l=0;l--){var u=a[l].head;n.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1),"+delete")}}function o(n){var i=r(n),o=i&&t(i,"explode");if(!o||n.getOption("disableInput"))return e.Pass;for(var a=n.listSelections(),l=0;l1&&p.indexOf(i)>=0&&n.getRange(f(x.line,x.ch-2),x)==i+i&&(x.ch<=2||n.getRange(f(x.line,x.ch-3),f(x.line,x.ch-2))!=i))y="addFour";else if(h){if(e.isWordChar(d)||!c(n,x,i))return e.Pass;y="both"}else{if(!g||n.getLine(x.line).length!=x.ch&&!l(d,a)&&!/\s/.test(d))return e.Pass;y="both"}else y=p.indexOf(i)>=0&&n.getRange(x,f(x.line,x.ch+3))==i+i+i?"skipThree":"skip";if(u){if(u!=y)return e.Pass}else u=y}var _=s%2?a.charAt(s-1):i,k=s%2?i:a.charAt(s+1);n.operation(function(){if("skip"==u)n.execCommand("goCharRight");else if("skipThree"==u)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==u){for(var t=n.getSelections(),e=0;e-1&&n%2==1}function s(e,t){var n=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return 2==n.length?n:null}function c(t,n,r){var i=t.getLine(n.line),o=t.getTokenAt(n);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(a.pos=a.start=o.start;;){var l=t.getMode().token(a,o.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}var u={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},f=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(p),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(p))});for(var d=u.pairs+"`",p={Backspace:i,Enter:o},h=0;hc.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==d.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,d,!0))return e.Pass;var b=g&&i(g,y)>-1;r[s]={indent:b,text:">"+(b?"\n\n":"")+""+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=n.length-1;s>=0;s--){var x=r[s];t.replaceRange(x.text,n[s].head,n[s].anchor,"+insert");var _=t.listSelections().slice(0);_[s]={head:x.newPos,anchor:x.newPos},t.setSelections(_),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var r=t.listSelections(),i=[],a=n?"/":"",l=0;l";else{if("htmlmixed"!=t.getMode().name||"css"!=u.mode.name)return e.Pass;i[l]=a+"style>"}else{if(!f.context||!f.context.tagName||o(t,f.context.tagName,s,f))return e.Pass;i[l]=a+f.context.tagName+">"}}t.replaceSelections(i,null,"+input"),r=t.listSelections();for(var l=0;ln;++n)if(e[n]==t)return n;return-1}function o(t,n,r,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,r.line+500),l=e.scanForClosingTag(t,r,null,a);if(!l||l.tag!=n)return!1;
+}}if(l.length){o&&e.state.focused&&e.focus();var f=function(){e.operation(function(){for(var e=0;e",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<"},s=null;e.defineOption("matchBrackets",!1,function(t,n,r){r&&r!=e.Init&&t.off("cursorActivity",i),n&&(t.state.matchBrackets="object"==typeof n?n:{},t.on("cursorActivity",i))}),e.defineExtension("matchBrackets",function(){r(this,!0)}),e.defineExtension("findMatchingBracket",function(e,n,r){return t(this,e,n,r)}),e.defineExtension("scanForBracket",function(e,t,r,i){return n(this,e,t,r,i)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(e,t){return"pairs"==t&&"string"==typeof e?e:"object"==typeof e&&null!=e[t]?e[t]:d[t]}function n(e){return function(t){return l(t,e)}}function r(e){var t=e.state.closeBrackets;if(!t)return null;var n=e.getModeAt(e.getCursor());return n.closeBrackets||t}function i(n){var i=r(n);if(!i||n.getOption("disableInput"))return e.Pass;for(var o=t(i,"pairs"),a=n.listSelections(),l=0;l=0;l--){var u=a[l].head;n.replaceRange("",f(u.line,u.ch-1),f(u.line,u.ch+1),"+delete")}}function o(n){var i=r(n),o=i&&t(i,"explode");if(!o||n.getOption("disableInput"))return e.Pass;for(var a=n.listSelections(),l=0;l0;return{anchor:new f(t.anchor.line,t.anchor.ch+(n?-1:1)),head:new f(t.head.line,t.head.ch+(n?1:-1))}}function l(n,i){var o=r(n);if(!o||n.getOption("disableInput"))return e.Pass;var l=t(o,"pairs"),c=l.indexOf(i);if(-1==c)return e.Pass;for(var d,p,h=t(o,"triples"),m=l.charAt(c+1)==i,g=n.listSelections(),v=c%2==0,y=0;y1&&h.indexOf(i)>=0&&n.getRange(f(k.line,k.ch-2),k)==i+i&&(k.ch<=2||n.getRange(f(k.line,k.ch-3),f(k.line,k.ch-2))!=i))b="addFour";else if(m){if(e.isWordChar(p)||!u(n,k,i))return e.Pass;b="both"}else{if(!v||n.getLine(k.line).length!=k.ch&&!s(p,l)&&!/\s/.test(p))return e.Pass;b="both"}else b=h.indexOf(i)>=0&&n.getRange(k,f(k.line,k.ch+3))==i+i+i?"skipThree":"skip";if(d){if(d!=b)return e.Pass}else d=b}var _=c%2?l.charAt(c-1):i,w=c%2?i:l.charAt(c+1);n.operation(function(){if("skip"==d)n.execCommand("goCharRight");else if("skipThree"==d)for(var e=0;3>e;e++)n.execCommand("goCharRight");else if("surround"==d){for(var t=n.getSelections(),e=0;e-1&&n%2==1}function c(e,t){var n=e.getRange(f(t.line,t.ch-1),f(t.line,t.ch+1));return 2==n.length?n:null}function u(t,n,r){var i=t.getLine(n.line),o=t.getTokenAt(n);if(/\bstring2?\b/.test(o.type))return!1;var a=new e.StringStream(i.slice(0,n.ch)+r+i.slice(n.ch),4);for(a.pos=a.start=o.start;;){var l=t.getMode().token(a,o.state);if(a.pos>=n.ch+1)return/\bstring2?\b/.test(l);a.start=a.pos}}var d={pairs:"()[]{}''\"\"",triples:"",explode:"[]{}"},f=e.Pos;e.defineOption("autoCloseBrackets",!1,function(t,n,r){r&&r!=e.Init&&(t.removeKeyMap(h),t.state.closeBrackets=null),n&&(t.state.closeBrackets=n,t.addKeyMap(h))});for(var p=d.pairs+"`",h={Backspace:i,Enter:o},m=0;mc.ch&&(v=v.slice(0,v.length-u.end+c.ch));var y=v.toLowerCase();if(!v||"string"==u.type&&(u.end!=c.ch||!/[\"\']/.test(u.string.charAt(u.string.length-1))||1==u.string.length)||"tag"==u.type&&"closeTag"==f.type||u.string.indexOf("/")==u.string.length-1||m&&i(m,y)>-1||o(t,v,c,f,!0))return e.Pass;var b=g&&i(g,y)>-1;r[s]={indent:b,text:">"+(b?"\n\n":"")+""+v+">",newPos:b?e.Pos(c.line+1,0):e.Pos(c.line,c.ch+1)}}for(var s=n.length-1;s>=0;s--){var x=r[s];t.replaceRange(x.text,n[s].head,n[s].anchor,"+insert");var k=t.listSelections().slice(0);k[s]={head:x.newPos,anchor:x.newPos},t.setSelections(k),x.indent&&(t.indentLine(x.newPos.line,null,!0),t.indentLine(x.newPos.line+1,null,!0))}}function n(t,n){for(var r=t.listSelections(),i=[],a=n?"/":"",l=0;l"!=t.getLine(s.line).charAt(c.end)&&(f+=">"),i[l]=f}t.replaceSelections(i),r=t.listSelections();for(var l=0;ln;++n)if(e[n]==t)return n;return-1}function o(t,n,r,i,o){if(!e.scanForClosingTag)return!1;var a=Math.min(t.lastLine()+1,r.line+500),l=e.scanForClosingTag(t,r,null,a);if(!l||l.tag!=n)return!1;for(var s=i.context,c=o?1:0;s&&s.tagName==n;s=s.prev)++c;r=l.to;for(var u=1;c>u;u++){var d=e.scanForClosingTag(t,r,null,a);if(!d||d.tag!=n)return!1;r=d.to}return!0}e.defineOption("autoCloseTags",!1,function(n,i,o){if(o!=e.Init&&o&&n.removeKeyMap("autoCloseTags"),i){var a={name:"autoCloseTags"};("object"!=typeof i||i.whenClosing)&&(a["'/'"]=function(e){return r(e)}),("object"!=typeof i||i.whenOpening)&&(a["'>'"]=function(e){return t(e)}),n.addKeyMap(a)}});var a=["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],l=["applet","blockquote","body","button","div","dl","fieldset","form","frameset","h1","h2","h3","h4","h5","h6","head","html","iframe","layer","legend","object","ol","p","select","table","ul"];e.commands.closeTag=function(e){return n(e)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";var t=/^(\s*)(>[> ]*|[*+-]\s|(\d+)([.)]))(\s*)/,n=/^(\s*)(>[> ]*|[*+-]|(\d+)[.)])(\s*)$/,r=/[*+-]\s/;e.commands.newlineAndIndentContinueMarkdownList=function(i){if(i.getOption("disableInput"))return e.Pass;for(var o=i.listSelections(),a=[],l=0;l")>=0?p[2]:parseInt(p[3],10)+1+p[4];a[l]="\n"+h+g+m}}i.replaceSelections(a)}}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(e){var t=e.search(r);return-1==t?0:t}var n={},r=/[^\s\u00a0]/,i=e.Pos;e.commands.toggleComment=function(e){e.toggleComment()},e.defineExtension("toggleComment",function(e){e||(e=n);for(var t=this,r=1/0,o=this.listSelections(),a=null,l=o.length-1;l>=0;l--){var s=o[l].from(),c=o[l].to();s.line>=r||(c.line>=r&&(c=i(r,0)),r=s.line,null==a?t.uncomment(s,c,e)?a="un":(t.lineComment(s,c,e),a="line"):"un"==a?t.uncomment(s,c,e):t.lineComment(s,c,e))}}),e.defineExtension("lineComment",function(e,o,a){a||(a=n);var l=this,s=l.getModeAt(e),c=a.lineComment||s.lineComment;if(!c)return void((a.blockCommentStart||s.blockCommentStart)&&(a.fullLines=!0,l.blockComment(e,o,a)));var u=l.getLine(e.line);if(null!=u){var d=Math.min(0!=o.ch||o.line==e.line?o.line+1:o.line,l.lastLine()+1),f=null==a.padding?" ":a.padding,p=a.commentBlankLines||e.line==o.line;l.operation(function(){if(a.indent){for(var n=null,o=e.line;d>o;++o){var s=l.getLine(o),u=s.slice(0,t(s));(null==n||n.length>u.length)&&(n=u)}for(var o=e.line;d>o;++o){var s=l.getLine(o),h=n.length;(p||r.test(s))&&(s.slice(0,h)!=n&&(h=t(s)),l.replaceRange(n+c+f,i(o,0),i(o,h)))}}else for(var o=e.line;d>o;++o)(p||r.test(l.getLine(o)))&&l.replaceRange(c+f,i(o,0))})}}),e.defineExtension("blockComment",function(e,t,o){o||(o=n);var a=this,l=a.getModeAt(e),s=o.blockCommentStart||l.blockCommentStart,c=o.blockCommentEnd||l.blockCommentEnd;if(!s||!c)return void((o.lineComment||l.lineComment)&&0!=o.fullLines&&a.lineComment(e,t,o));var u=Math.min(t.line,a.lastLine());u!=e.line&&0==t.ch&&r.test(a.getLine(u))&&--u;var d=null==o.padding?" ":o.padding;e.line>u||a.operation(function(){if(0!=o.fullLines){var n=r.test(a.getLine(u));a.replaceRange(d+c,i(u)),a.replaceRange(s+d,i(e.line,0));var f=o.blockCommentLead||l.blockCommentLead;if(null!=f)for(var p=e.line+1;u>=p;++p)(p!=u||n)&&a.replaceRange(f+d,i(p,0))}else a.replaceRange(c,t),a.replaceRange(s,e)})}),e.defineExtension("uncomment",function(e,t,o){o||(o=n);var a,l=this,s=l.getModeAt(e),c=Math.min(0!=t.ch||t.line==e.line?t.line:t.line-1,l.lastLine()),u=Math.min(e.line,c),d=o.lineComment||s.lineComment,f=[],p=null==o.padding?" ":o.padding;e:if(d){for(var h=u;c>=h;++h){var m=l.getLine(h),g=m.indexOf(d);if(g>-1&&!/comment/.test(l.getTokenTypeAt(i(h,g+1)))&&(g=-1),-1==g&&(h!=c||h==u)&&r.test(m))break e;if(g>-1&&r.test(m.slice(0,g)))break e;f.push(m)}if(l.operation(function(){for(var e=u;c>=e;++e){var t=f[e-u],n=t.indexOf(d),r=n+d.length;0>n||(t.slice(r,r+p.length)==p&&(r+=p.length),a=!0,l.replaceRange("",i(e,n),i(e,r)))}}),a)return!0}var v=o.blockCommentStart||s.blockCommentStart,y=o.blockCommentEnd||s.blockCommentEnd;if(!v||!y)return!1;var b=o.blockCommentLead||s.blockCommentLead,x=l.getLine(u),k=c==u?x:l.getLine(c),_=x.indexOf(v),w=k.lastIndexOf(y);if(-1==w&&u!=c&&(k=l.getLine(--c),w=k.lastIndexOf(y)),-1==_||-1==w||!/comment/.test(l.getTokenTypeAt(i(u,_+1)))||!/comment/.test(l.getTokenTypeAt(i(c,w+1))))return!1;var C=x.lastIndexOf(v,e.ch),S=-1==C?-1:x.slice(0,e.ch).indexOf(y,C+v.length);if(-1!=C&&-1!=S&&S+y.length!=e.ch)return!1;S=k.indexOf(y,t.ch);var M=k.slice(t.ch).lastIndexOf(v,S-t.ch);return C=-1==S||-1==M?-1:t.ch+M,-1!=S&&-1!=C&&C!=t.ch?!1:(l.operation(function(){l.replaceRange("",i(c,w-(p&&k.slice(w-p.length,w)==p?p.length:0)),i(c,w+y.length));var e=_+v.length;if(p&&x.slice(e,e+p.length)==p&&(e+=p.length),l.replaceRange("",i(u,_),i(u,e)),b)for(var t=u+1;c>=t;++t){var n=l.getLine(t),o=n.indexOf(b);if(-1!=o&&!r.test(n.slice(0,o))){var a=o+b.length;p&&n.slice(a,a+p.length)==p&&(a+=p.length),l.replaceRange("",i(t,o),i(t,a))}}}),!0)})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){function t(t){if(t.getOption("disableInput"))return e.Pass;for(var r,i=t.listSelections(),o=[],a=0;a=f);else if(0==s.string.indexOf(r.blockCommentStart)){if(u=p.slice(0,s.start),!/^\s*$/.test(u)){u="";for(var h=0;hs.start&&/^\s*$/.test(p.slice(0,d))&&(u=p.slice(0,d));null!=u&&(u+=r.blockCommentContinue)}if(null==u&&r.lineComment&&n(t)){var m=t.getLine(l.line),d=m.indexOf(r.lineComment);d>-1&&(u=m.slice(0,d),/\S/.test(u)?u=null:u+=r.lineComment+m.slice(d+r.lineComment.length).match(/^\s*/)[0])}if(null==u)return e.Pass;o[a]="\n"+u}t.operation(function(){for(var e=i.length-1;e>=0;e--)t.replaceRange(o[e],i[e].from(),i[e].to(),"+insert")})}function n(e){var t=e.getOption("continueComments");return t&&"object"==typeof t?t.continueLineComment!==!1:!0}for(var r=["clike","css","javascript"],i=0;io;--i){var a=e.getLine(i);if(r&&r.test(a))break;if(!/\S/.test(a)){++i;break}}for(var l=n.paragraphEnd||e.getHelper(t,"paragraphEnd"),s=t.line+1,c=e.lastLine();c>=s;++s){var a=e.getLine(s);if(l&&l.test(a)){++s;break}if(!/\S/.test(a))break}return{from:i,to:s}}function n(e,t,n,r){for(var i=t;i>0&&!n.test(e.slice(i-1,i+1));--i);for(var o=!0;;o=!1){var a=i;if(r)for(;" "==e.charAt(a-1);)--a;if(0!=a||!o)return{from:a,to:i};i=t}}function r(t,r,o,a){r=t.clipPos(r),o=t.clipPos(o);var l=a.column||80,s=a.wrapOn||/\s\S|-[^\.\d]/,c=a.killTrailingSpace!==!1,u=[],d="",f=r.line,p=t.getRange(r,o,!1);if(!p.length)return null;for(var h=p[0].match(/^[ \t]*/)[0],m=0;ml&&h==b&&n(d,l,s,c);x&&x.from==v&&x.to==v+y?(d=h+g,++f):u.push({text:[y?" ":""],from:i(f,v),to:i(f+1,b.length)})}for(;d.length>l;){var k=n(d,l,s,c);u.push({text:["",h],from:i(f,k.from),to:i(f,k.to)}),d=h+d.slice(k.to),++f}}return u.length&&t.operation(function(){for(var n=0;n=0;a--){var l,s=n[a];if(s.empty()){var c=t(e,s.head,{});l={from:i(c.from,0),to:i(c.to-1)}}else l={from:s.from(),to:s.to()};l.to.line>=o||(o=l.from.line,r(e,l.from,l.to,{}))}})},e.defineExtension("wrapRange",function(e,t,n){return r(this,e,t,n||{})}),e.defineExtension("wrapParagraphsInRange",function(e,n,o){o=o||{};for(var a=this,l=[],s=e.line;s<=n.line;){var c=t(a,i(s,0),o);l.push(c),s=c.to}var u=!1;return l.length&&a.operation(function(){for(var e=l.length-1;e>=0;--e)u=u||r(a,i(l[e].from,0),i(l[e].to-1),o)}),u})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}(function(e){"use strict";function t(t,i,o,a){function l(e){var n=s(t,i);if(!n||n.to.line-n.from.linet.firstLine();)i=e.Pos(i.line-1,0),u=l(!1);if(u&&!u.cleared&&"unfold"!==a){var d=n(t,o);e.on(d,"mousedown",function(t){f.clear(),e.e_preventDefault(t)});var f=t.markText(u.from,u.to,{replacedWith:d,clearOnEnter:!0,__isFold:!0});f.on("clear",function(n,r){e.signal(t,"unfold",t,n,r)}),e.signal(t,"fold",t,u.from,u.to)}}function n(e,t){var n=r(e,t,"widget");if("string"==typeof n){var i=document.createTextNode(n);n=document.createElement("span"),n.appendChild(i),n.className="CodeMirror-foldmarker"}return n}function r(e,t,n){if(t&&void 0!==t[n])return t[n];var r=e.options.foldOptions;return r&&void 0!==r[n]?r[n]:i[n]}e.newFoldFunction=function(e,n){return function(r,i){t(r,i,{rangeFinder:e,widget:n})}},e.defineExtension("foldCode",function(e,n,r){t(this,e,n,r)}),e.defineExtension("isFolded",function(e){for(var t=this.findMarksAt(e),n=0;n=n;n++)t.foldCode(e.Pos(n,0),null,"fold")})},e.commands.unfoldAll=function(t){t.operation(function(){for(var n=t.firstLine(),r=t.lastLine();r>=n;n++)t.foldCode(e.Pos(n,0),null,"unfold")})},e.registerHelper("fold","combine",function(){var e=Array.prototype.slice.call(arguments,0);return function(t,n){for(var r=0;r=i?-1:l.lastIndexOf(r,i-1);if(-1!=c){if(1==s&&c=h;++h)for(var m=t.getLine(h),g=h==a?i:0;;){var v=m.indexOf(s,g),y=m.indexOf(c,g);if(0>v&&(v=m.length),0>y&&(y=m.length),g=Math.min(v,y),g==m.length)break;if(t.getTokenTypeAt(e.Pos(h,g+1))==o)if(g==v)++f;else if(!--f){u=h,d=g;break e}++g}if(null!=u&&(a!=u||d!=i))return{from:e.Pos(a,i),to:e.Pos(u,d)}}}),e.registerHelper("fold","import",function(t,n){function r(n){if(nt.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));if(/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"keyword"!=r.type||"import"!=r.string)return null;for(var i=n,o=Math.min(t.lastLine(),n+10);o>=i;++i){var a=t.getLine(i),l=a.indexOf(";");if(-1!=l)return{startCh:r.end,end:e.Pos(i,l)}}}var i,n=n.line,o=r(n);if(!o||r(n-1)||(i=r(n-2))&&i.end.line==n-1)return null;for(var a=o.end;;){var l=r(a.line+1);if(null==l)break;a=l.end}return{from:t.clipPos(e.Pos(n,o.startCh+1)),to:a}}),e.registerHelper("fold","include",function(t,n){function r(n){if(nt.lastLine())return null;var r=t.getTokenAt(e.Pos(n,1));return/\S/.test(r.string)||(r=t.getTokenAt(e.Pos(n,r.end+1))),"meta"==r.type&&"#include"==r.string.slice(0,8)?r.start+8:void 0}var n=n.line,i=r(n);if(null==i||null!=r(n-1))return null;for(var o=n;;){var a=r(o+1);if(null==a)break;++o}return{from:e.Pos(n,i+1),to:t.clipPos(e.Pos(o))}})}),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror"),require("./foldcode")):"function"==typeof define&&define.amd?define(["../../lib/codemirror","./foldcode"],e):e(CodeMirror)}(function(e){"use strict";function t(e){this.options=e,this.from=this.to=0}function n(e){return e===!0&&(e={}),null==e.gutter&&(e.gutter="CodeMirror-foldgutter"),null==e.indicatorOpen&&(e.indicatorOpen="CodeMirror-foldgutter-open"),null==e.indicatorFolded&&(e.indicatorFolded="CodeMirror-foldgutter-folded"),e}function r(e,t){for(var n=e.findMarksAt(d(t)),r=0;r