changeset 0:78edf6b517a0 draft

24.10
author Coffee CMS <info@coffee-cms.ru>
date Fri, 11 Oct 2024 22:40:23 +0000
parents
children 1d486627aa1e
files .cms/.unlicense.txt .cms/admin.cms/html.php .cms/css/admin.css .cms/css/base.css .cms/css/menu.css .cms/css/pages.css .cms/css/rss.css .cms/css/sitemap.css .cms/css/template.css .cms/img/favicon.svg .cms/img/icon.default.svg .cms/img/icon.doc.svg .cms/img/icon.docx.svg .cms/img/icon.exe.svg .cms/img/icon.flac.svg .cms/img/icon.m4a.svg .cms/img/icon.mkv.svg .cms/img/icon.mp3.svg .cms/img/icon.mp4.svg .cms/img/icon.ogg.svg .cms/img/icon.pdf.svg .cms/img/icon.rar.svg .cms/img/icon.webm.svg .cms/img/icon.xls.svg .cms/img/icon.xlsx.svg .cms/img/icon.zip.svg .cms/img/noise-dark.png .cms/img/noise-light.png .cms/js/admin.js .cms/js/menu.js .cms/js/pages.js .cms/js/rss.js .cms/js/sitemap.js .cms/js/template.js .cms/lang/en_US.UTF-8/admin.mod.php .cms/lang/en_US.UTF-8/base.mod.php .cms/lang/en_US.UTF-8/menu.mod.php .cms/lang/en_US.UTF-8/pages.mod.php .cms/lang/en_US.UTF-8/rss.mod.php .cms/lang/en_US.UTF-8/sitemap.mod.php .cms/lang/en_US.UTF-8/template.mod.php .cms/lang/ru_RU.UTF-8/admin.mod.php .cms/lang/ru_RU.UTF-8/base.mod.php .cms/lang/ru_RU.UTF-8/menu.mod.php .cms/lang/ru_RU.UTF-8/pages.mod.php .cms/lang/ru_RU.UTF-8/rss.mod.php .cms/lang/ru_RU.UTF-8/sitemap.mod.php .cms/lang/ru_RU.UTF-8/template.mod.php .cms/lang/ru_RU.UTF-8/translit.php .cms/lang/uk_UA.UTF-8/admin.mod.php .cms/lang/uk_UA.UTF-8/base.mod.php .cms/lang/uk_UA.UTF-8/menu.mod.php .cms/lang/uk_UA.UTF-8/pages.mod.php .cms/lang/uk_UA.UTF-8/rss.mod.php .cms/lang/uk_UA.UTF-8/sitemap.mod.php .cms/lang/uk_UA.UTF-8/template.mod.php .cms/lang/uk_UA.UTF-8/translit.php .cms/lib/codemirror/AUTHORS .cms/lib/codemirror/CHANGELOG.md .cms/lib/codemirror/CONTRIBUTING.md .cms/lib/codemirror/LICENSE .cms/lib/codemirror/README.md .cms/lib/codemirror/addon/comment/comment.js .cms/lib/codemirror/addon/comment/continuecomment.js .cms/lib/codemirror/addon/dialog/dialog.css .cms/lib/codemirror/addon/dialog/dialog.js .cms/lib/codemirror/addon/display/autorefresh.js .cms/lib/codemirror/addon/display/fullscreen.css .cms/lib/codemirror/addon/display/fullscreen.js .cms/lib/codemirror/addon/display/panel.js .cms/lib/codemirror/addon/display/placeholder.js .cms/lib/codemirror/addon/display/rulers.js .cms/lib/codemirror/addon/edit/closebrackets.js .cms/lib/codemirror/addon/edit/closetag.js .cms/lib/codemirror/addon/edit/continuelist.js .cms/lib/codemirror/addon/edit/matchbrackets.js .cms/lib/codemirror/addon/edit/matchtags.js .cms/lib/codemirror/addon/edit/trailingspace.js .cms/lib/codemirror/addon/fold/brace-fold.js .cms/lib/codemirror/addon/fold/comment-fold.js .cms/lib/codemirror/addon/fold/foldcode.js .cms/lib/codemirror/addon/fold/foldgutter.css .cms/lib/codemirror/addon/fold/foldgutter.js .cms/lib/codemirror/addon/fold/indent-fold.js .cms/lib/codemirror/addon/fold/markdown-fold.js .cms/lib/codemirror/addon/fold/xml-fold.js .cms/lib/codemirror/addon/hint/anyword-hint.js .cms/lib/codemirror/addon/hint/css-hint.js .cms/lib/codemirror/addon/hint/html-hint.js .cms/lib/codemirror/addon/hint/javascript-hint.js .cms/lib/codemirror/addon/hint/show-hint.css .cms/lib/codemirror/addon/hint/show-hint.js .cms/lib/codemirror/addon/hint/sql-hint.js .cms/lib/codemirror/addon/hint/xml-hint.js .cms/lib/codemirror/addon/lint/coffeescript-lint.js .cms/lib/codemirror/addon/lint/css-lint.js .cms/lib/codemirror/addon/lint/html-lint.js .cms/lib/codemirror/addon/lint/javascript-lint.js .cms/lib/codemirror/addon/lint/json-lint.js .cms/lib/codemirror/addon/lint/lint.css .cms/lib/codemirror/addon/lint/lint.js .cms/lib/codemirror/addon/lint/yaml-lint.js .cms/lib/codemirror/addon/merge/merge.css .cms/lib/codemirror/addon/merge/merge.js .cms/lib/codemirror/addon/mode/loadmode.js .cms/lib/codemirror/addon/mode/multiplex.js .cms/lib/codemirror/addon/mode/multiplex_test.js .cms/lib/codemirror/addon/mode/overlay.js .cms/lib/codemirror/addon/mode/simple.js .cms/lib/codemirror/addon/runmode/colorize.js .cms/lib/codemirror/addon/runmode/runmode-standalone.js .cms/lib/codemirror/addon/runmode/runmode.js .cms/lib/codemirror/addon/runmode/runmode.node.js .cms/lib/codemirror/addon/scroll/annotatescrollbar.js .cms/lib/codemirror/addon/scroll/scrollpastend.js .cms/lib/codemirror/addon/scroll/simplescrollbars.css .cms/lib/codemirror/addon/scroll/simplescrollbars.js .cms/lib/codemirror/addon/search/jump-to-line.js .cms/lib/codemirror/addon/search/match-highlighter.js .cms/lib/codemirror/addon/search/matchesonscrollbar.css .cms/lib/codemirror/addon/search/matchesonscrollbar.js .cms/lib/codemirror/addon/search/search.js .cms/lib/codemirror/addon/search/searchcursor.js .cms/lib/codemirror/addon/selection/active-line.js .cms/lib/codemirror/addon/selection/mark-selection.js .cms/lib/codemirror/addon/selection/selection-pointer.js .cms/lib/codemirror/addon/tern/tern.css .cms/lib/codemirror/addon/tern/tern.js .cms/lib/codemirror/addon/tern/worker.js .cms/lib/codemirror/addon/wrap/hardwrap.js .cms/lib/codemirror/bin/authors.sh .cms/lib/codemirror/bin/lint .cms/lib/codemirror/bin/release .cms/lib/codemirror/bin/source-highlight .cms/lib/codemirror/bin/upload-release.js .cms/lib/codemirror/demo/activeline.html .cms/lib/codemirror/demo/anywordhint.html .cms/lib/codemirror/demo/bidi.html .cms/lib/codemirror/demo/btree.html .cms/lib/codemirror/demo/buffers.html .cms/lib/codemirror/demo/changemode.html .cms/lib/codemirror/demo/closebrackets.html .cms/lib/codemirror/demo/closetag.html .cms/lib/codemirror/demo/complete.html .cms/lib/codemirror/demo/emacs.html .cms/lib/codemirror/demo/folding.html .cms/lib/codemirror/demo/fullscreen.html .cms/lib/codemirror/demo/hardwrap.html .cms/lib/codemirror/demo/html5complete.html .cms/lib/codemirror/demo/indentwrap.html .cms/lib/codemirror/demo/lint.html .cms/lib/codemirror/demo/loadmode.html .cms/lib/codemirror/demo/marker.html .cms/lib/codemirror/demo/markselection.html .cms/lib/codemirror/demo/matchhighlighter.html .cms/lib/codemirror/demo/matchtags.html .cms/lib/codemirror/demo/merge.html .cms/lib/codemirror/demo/multiplex.html .cms/lib/codemirror/demo/mustache.html .cms/lib/codemirror/demo/panel.html .cms/lib/codemirror/demo/placeholder.html .cms/lib/codemirror/demo/preview.html .cms/lib/codemirror/demo/requirejs.html .cms/lib/codemirror/demo/resize.html .cms/lib/codemirror/demo/rulers.html .cms/lib/codemirror/demo/runmode-standalone.html .cms/lib/codemirror/demo/runmode.html .cms/lib/codemirror/demo/search.html .cms/lib/codemirror/demo/simplemode.html .cms/lib/codemirror/demo/simplescrollbars.html .cms/lib/codemirror/demo/spanaffectswrapping_shim.html .cms/lib/codemirror/demo/sublime.html .cms/lib/codemirror/demo/tern.html .cms/lib/codemirror/demo/theme.html .cms/lib/codemirror/demo/trailingspace.html .cms/lib/codemirror/demo/variableheight.html .cms/lib/codemirror/demo/vim.html .cms/lib/codemirror/demo/visibletabs.html .cms/lib/codemirror/demo/widget.html .cms/lib/codemirror/demo/xmlcomplete.html .cms/lib/codemirror/doc/activebookmark.js .cms/lib/codemirror/doc/docs.css .cms/lib/codemirror/doc/internals.html .cms/lib/codemirror/doc/logo.png .cms/lib/codemirror/doc/logo.svg .cms/lib/codemirror/doc/manual.html .cms/lib/codemirror/doc/releases.html .cms/lib/codemirror/doc/reporting.html .cms/lib/codemirror/doc/source_sans.woff .cms/lib/codemirror/doc/upgrade_v2.2.html .cms/lib/codemirror/doc/upgrade_v3.html .cms/lib/codemirror/doc/upgrade_v4.html .cms/lib/codemirror/doc/yinyang.png .cms/lib/codemirror/index.html .cms/lib/codemirror/keymap/emacs.js .cms/lib/codemirror/keymap/sublime.js .cms/lib/codemirror/keymap/vim.js .cms/lib/codemirror/lib/codemirror.css .cms/lib/codemirror/lib/codemirror.js .cms/lib/codemirror/mode/apl/apl.js .cms/lib/codemirror/mode/apl/index.html .cms/lib/codemirror/mode/asciiarmor/asciiarmor.js .cms/lib/codemirror/mode/asciiarmor/index.html .cms/lib/codemirror/mode/asn.1/asn.1.js .cms/lib/codemirror/mode/asn.1/index.html .cms/lib/codemirror/mode/asterisk/asterisk.js .cms/lib/codemirror/mode/asterisk/index.html .cms/lib/codemirror/mode/brainfuck/brainfuck.js .cms/lib/codemirror/mode/brainfuck/index.html .cms/lib/codemirror/mode/clike/clike.js .cms/lib/codemirror/mode/clike/index.html .cms/lib/codemirror/mode/clike/scala.html .cms/lib/codemirror/mode/clike/test.js .cms/lib/codemirror/mode/clojure/clojure.js .cms/lib/codemirror/mode/clojure/index.html .cms/lib/codemirror/mode/clojure/test.js .cms/lib/codemirror/mode/cmake/cmake.js .cms/lib/codemirror/mode/cmake/index.html .cms/lib/codemirror/mode/cobol/cobol.js .cms/lib/codemirror/mode/cobol/index.html .cms/lib/codemirror/mode/coffeescript/coffeescript.js .cms/lib/codemirror/mode/coffeescript/index.html .cms/lib/codemirror/mode/commonlisp/commonlisp.js .cms/lib/codemirror/mode/commonlisp/index.html .cms/lib/codemirror/mode/crystal/crystal.js .cms/lib/codemirror/mode/crystal/index.html .cms/lib/codemirror/mode/css/css.js .cms/lib/codemirror/mode/css/gss.html .cms/lib/codemirror/mode/css/gss_test.js .cms/lib/codemirror/mode/css/index.html .cms/lib/codemirror/mode/css/less.html .cms/lib/codemirror/mode/css/less_test.js .cms/lib/codemirror/mode/css/scss.html .cms/lib/codemirror/mode/css/scss_test.js .cms/lib/codemirror/mode/css/test.js .cms/lib/codemirror/mode/cypher/cypher.js .cms/lib/codemirror/mode/cypher/index.html .cms/lib/codemirror/mode/cypher/test.js .cms/lib/codemirror/mode/d/d.js .cms/lib/codemirror/mode/d/index.html .cms/lib/codemirror/mode/d/test.js .cms/lib/codemirror/mode/dart/dart.js .cms/lib/codemirror/mode/dart/index.html .cms/lib/codemirror/mode/diff/diff.js .cms/lib/codemirror/mode/diff/index.html .cms/lib/codemirror/mode/django/django.js .cms/lib/codemirror/mode/django/index.html .cms/lib/codemirror/mode/dockerfile/dockerfile.js .cms/lib/codemirror/mode/dockerfile/index.html .cms/lib/codemirror/mode/dockerfile/test.js .cms/lib/codemirror/mode/dtd/dtd.js .cms/lib/codemirror/mode/dtd/index.html .cms/lib/codemirror/mode/dylan/dylan.js .cms/lib/codemirror/mode/dylan/index.html .cms/lib/codemirror/mode/dylan/test.js .cms/lib/codemirror/mode/ebnf/ebnf.js .cms/lib/codemirror/mode/ebnf/index.html .cms/lib/codemirror/mode/ecl/ecl.js .cms/lib/codemirror/mode/ecl/index.html .cms/lib/codemirror/mode/eiffel/eiffel.js .cms/lib/codemirror/mode/eiffel/index.html .cms/lib/codemirror/mode/elm/elm.js .cms/lib/codemirror/mode/elm/index.html .cms/lib/codemirror/mode/erlang/erlang.js .cms/lib/codemirror/mode/erlang/index.html .cms/lib/codemirror/mode/factor/factor.js .cms/lib/codemirror/mode/factor/index.html .cms/lib/codemirror/mode/fcl/fcl.js .cms/lib/codemirror/mode/fcl/index.html .cms/lib/codemirror/mode/forth/forth.js .cms/lib/codemirror/mode/forth/index.html .cms/lib/codemirror/mode/fortran/fortran.js .cms/lib/codemirror/mode/fortran/index.html .cms/lib/codemirror/mode/gas/gas.js .cms/lib/codemirror/mode/gas/index.html .cms/lib/codemirror/mode/gfm/gfm.js .cms/lib/codemirror/mode/gfm/index.html .cms/lib/codemirror/mode/gfm/test.js .cms/lib/codemirror/mode/gherkin/gherkin.js .cms/lib/codemirror/mode/gherkin/index.html .cms/lib/codemirror/mode/go/go.js .cms/lib/codemirror/mode/go/index.html .cms/lib/codemirror/mode/groovy/groovy.js .cms/lib/codemirror/mode/groovy/index.html .cms/lib/codemirror/mode/haml/haml.js .cms/lib/codemirror/mode/haml/index.html .cms/lib/codemirror/mode/haml/test.js .cms/lib/codemirror/mode/handlebars/handlebars.js .cms/lib/codemirror/mode/handlebars/index.html .cms/lib/codemirror/mode/haskell-literate/haskell-literate.js .cms/lib/codemirror/mode/haskell-literate/index.html .cms/lib/codemirror/mode/haskell/haskell.js .cms/lib/codemirror/mode/haskell/index.html .cms/lib/codemirror/mode/haxe/haxe.js .cms/lib/codemirror/mode/haxe/index.html .cms/lib/codemirror/mode/htmlembedded/htmlembedded.js .cms/lib/codemirror/mode/htmlembedded/index.html .cms/lib/codemirror/mode/htmlmixed/htmlmixed.js .cms/lib/codemirror/mode/htmlmixed/index.html .cms/lib/codemirror/mode/http/http.js .cms/lib/codemirror/mode/http/index.html .cms/lib/codemirror/mode/idl/idl.js .cms/lib/codemirror/mode/idl/index.html .cms/lib/codemirror/mode/index.html .cms/lib/codemirror/mode/javascript/index.html .cms/lib/codemirror/mode/javascript/javascript.js .cms/lib/codemirror/mode/javascript/json-ld.html .cms/lib/codemirror/mode/javascript/test.js .cms/lib/codemirror/mode/javascript/typescript.html .cms/lib/codemirror/mode/jinja2/index.html .cms/lib/codemirror/mode/jinja2/jinja2.js .cms/lib/codemirror/mode/jsx/index.html .cms/lib/codemirror/mode/jsx/jsx.js .cms/lib/codemirror/mode/jsx/test.js .cms/lib/codemirror/mode/julia/index.html .cms/lib/codemirror/mode/julia/julia.js .cms/lib/codemirror/mode/livescript/index.html .cms/lib/codemirror/mode/livescript/livescript.js .cms/lib/codemirror/mode/lua/index.html .cms/lib/codemirror/mode/lua/lua.js .cms/lib/codemirror/mode/markdown/index.html .cms/lib/codemirror/mode/markdown/markdown.js .cms/lib/codemirror/mode/markdown/test.js .cms/lib/codemirror/mode/mathematica/index.html .cms/lib/codemirror/mode/mathematica/mathematica.js .cms/lib/codemirror/mode/mbox/index.html .cms/lib/codemirror/mode/mbox/mbox.js .cms/lib/codemirror/mode/meta.js .cms/lib/codemirror/mode/mirc/index.html .cms/lib/codemirror/mode/mirc/mirc.js .cms/lib/codemirror/mode/mllike/index.html .cms/lib/codemirror/mode/mllike/mllike.js .cms/lib/codemirror/mode/modelica/index.html .cms/lib/codemirror/mode/modelica/modelica.js .cms/lib/codemirror/mode/mscgen/index.html .cms/lib/codemirror/mode/mscgen/mscgen.js .cms/lib/codemirror/mode/mscgen/mscgen_test.js .cms/lib/codemirror/mode/mscgen/msgenny_test.js .cms/lib/codemirror/mode/mscgen/xu_test.js .cms/lib/codemirror/mode/mumps/index.html .cms/lib/codemirror/mode/mumps/mumps.js .cms/lib/codemirror/mode/nginx/index.html .cms/lib/codemirror/mode/nginx/nginx.js .cms/lib/codemirror/mode/nsis/index.html .cms/lib/codemirror/mode/nsis/nsis.js .cms/lib/codemirror/mode/ntriples/index.html .cms/lib/codemirror/mode/ntriples/ntriples.js .cms/lib/codemirror/mode/octave/index.html .cms/lib/codemirror/mode/octave/octave.js .cms/lib/codemirror/mode/oz/index.html .cms/lib/codemirror/mode/oz/oz.js .cms/lib/codemirror/mode/pascal/index.html .cms/lib/codemirror/mode/pascal/pascal.js .cms/lib/codemirror/mode/pegjs/index.html .cms/lib/codemirror/mode/pegjs/pegjs.js .cms/lib/codemirror/mode/perl/index.html .cms/lib/codemirror/mode/perl/perl.js .cms/lib/codemirror/mode/php/index.html .cms/lib/codemirror/mode/php/php.js .cms/lib/codemirror/mode/php/test.js .cms/lib/codemirror/mode/pig/index.html .cms/lib/codemirror/mode/pig/pig.js .cms/lib/codemirror/mode/powershell/index.html .cms/lib/codemirror/mode/powershell/powershell.js .cms/lib/codemirror/mode/powershell/test.js .cms/lib/codemirror/mode/properties/index.html .cms/lib/codemirror/mode/properties/properties.js .cms/lib/codemirror/mode/protobuf/index.html .cms/lib/codemirror/mode/protobuf/protobuf.js .cms/lib/codemirror/mode/pug/index.html .cms/lib/codemirror/mode/pug/pug.js .cms/lib/codemirror/mode/puppet/index.html .cms/lib/codemirror/mode/puppet/puppet.js .cms/lib/codemirror/mode/python/index.html .cms/lib/codemirror/mode/python/python.js .cms/lib/codemirror/mode/python/test.js .cms/lib/codemirror/mode/q/index.html .cms/lib/codemirror/mode/q/q.js .cms/lib/codemirror/mode/r/index.html .cms/lib/codemirror/mode/r/r.js .cms/lib/codemirror/mode/rpm/changes/index.html .cms/lib/codemirror/mode/rpm/index.html .cms/lib/codemirror/mode/rpm/rpm.js .cms/lib/codemirror/mode/rst/index.html .cms/lib/codemirror/mode/rst/rst.js .cms/lib/codemirror/mode/ruby/index.html .cms/lib/codemirror/mode/ruby/ruby.js .cms/lib/codemirror/mode/ruby/test.js .cms/lib/codemirror/mode/rust/index.html .cms/lib/codemirror/mode/rust/rust.js .cms/lib/codemirror/mode/rust/test.js .cms/lib/codemirror/mode/sas/index.html .cms/lib/codemirror/mode/sas/sas.js .cms/lib/codemirror/mode/sass/index.html .cms/lib/codemirror/mode/sass/sass.js .cms/lib/codemirror/mode/sass/test.js .cms/lib/codemirror/mode/scheme/index.html .cms/lib/codemirror/mode/scheme/scheme.js .cms/lib/codemirror/mode/shell/index.html .cms/lib/codemirror/mode/shell/shell.js .cms/lib/codemirror/mode/shell/test.js .cms/lib/codemirror/mode/sieve/index.html .cms/lib/codemirror/mode/sieve/sieve.js .cms/lib/codemirror/mode/slim/index.html .cms/lib/codemirror/mode/slim/slim.js .cms/lib/codemirror/mode/slim/test.js .cms/lib/codemirror/mode/smalltalk/index.html .cms/lib/codemirror/mode/smalltalk/smalltalk.js .cms/lib/codemirror/mode/smarty/index.html .cms/lib/codemirror/mode/smarty/smarty.js .cms/lib/codemirror/mode/solr/index.html .cms/lib/codemirror/mode/solr/solr.js .cms/lib/codemirror/mode/soy/index.html .cms/lib/codemirror/mode/soy/soy.js .cms/lib/codemirror/mode/soy/test.js .cms/lib/codemirror/mode/sparql/index.html .cms/lib/codemirror/mode/sparql/sparql.js .cms/lib/codemirror/mode/spreadsheet/index.html .cms/lib/codemirror/mode/spreadsheet/spreadsheet.js .cms/lib/codemirror/mode/sql/index.html .cms/lib/codemirror/mode/sql/sql.js .cms/lib/codemirror/mode/stex/index.html .cms/lib/codemirror/mode/stex/stex.js .cms/lib/codemirror/mode/stex/test.js .cms/lib/codemirror/mode/stylus/index.html .cms/lib/codemirror/mode/stylus/stylus.js .cms/lib/codemirror/mode/swift/index.html .cms/lib/codemirror/mode/swift/swift.js .cms/lib/codemirror/mode/swift/test.js .cms/lib/codemirror/mode/tcl/index.html .cms/lib/codemirror/mode/tcl/tcl.js .cms/lib/codemirror/mode/textile/index.html .cms/lib/codemirror/mode/textile/test.js .cms/lib/codemirror/mode/textile/textile.js .cms/lib/codemirror/mode/tiddlywiki/index.html .cms/lib/codemirror/mode/tiddlywiki/tiddlywiki.css .cms/lib/codemirror/mode/tiddlywiki/tiddlywiki.js .cms/lib/codemirror/mode/tiki/index.html .cms/lib/codemirror/mode/tiki/tiki.css .cms/lib/codemirror/mode/tiki/tiki.js .cms/lib/codemirror/mode/toml/index.html .cms/lib/codemirror/mode/toml/toml.js .cms/lib/codemirror/mode/tornado/index.html .cms/lib/codemirror/mode/tornado/tornado.js .cms/lib/codemirror/mode/troff/index.html .cms/lib/codemirror/mode/troff/troff.js .cms/lib/codemirror/mode/ttcn-cfg/index.html .cms/lib/codemirror/mode/ttcn-cfg/ttcn-cfg.js .cms/lib/codemirror/mode/ttcn/index.html .cms/lib/codemirror/mode/ttcn/ttcn.js .cms/lib/codemirror/mode/turtle/index.html .cms/lib/codemirror/mode/turtle/turtle.js .cms/lib/codemirror/mode/twig/index.html .cms/lib/codemirror/mode/twig/twig.js .cms/lib/codemirror/mode/vb/index.html .cms/lib/codemirror/mode/vb/vb.js .cms/lib/codemirror/mode/vbscript/index.html .cms/lib/codemirror/mode/vbscript/vbscript.js .cms/lib/codemirror/mode/velocity/index.html .cms/lib/codemirror/mode/velocity/velocity.js .cms/lib/codemirror/mode/verilog/index.html .cms/lib/codemirror/mode/verilog/test.js .cms/lib/codemirror/mode/verilog/verilog.js .cms/lib/codemirror/mode/vhdl/index.html .cms/lib/codemirror/mode/vhdl/vhdl.js .cms/lib/codemirror/mode/vue/index.html .cms/lib/codemirror/mode/vue/vue.js .cms/lib/codemirror/mode/wast/index.html .cms/lib/codemirror/mode/wast/test.js .cms/lib/codemirror/mode/wast/wast.js .cms/lib/codemirror/mode/webidl/index.html .cms/lib/codemirror/mode/webidl/webidl.js .cms/lib/codemirror/mode/xml/index.html .cms/lib/codemirror/mode/xml/test.js .cms/lib/codemirror/mode/xml/xml.js .cms/lib/codemirror/mode/xquery/index.html .cms/lib/codemirror/mode/xquery/test.js .cms/lib/codemirror/mode/xquery/xquery.js .cms/lib/codemirror/mode/yacas/index.html .cms/lib/codemirror/mode/yacas/yacas.js .cms/lib/codemirror/mode/yaml-frontmatter/index.html .cms/lib/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js .cms/lib/codemirror/mode/yaml/index.html .cms/lib/codemirror/mode/yaml/yaml.js .cms/lib/codemirror/mode/z80/index.html .cms/lib/codemirror/mode/z80/z80.js .cms/lib/codemirror/package.json .cms/lib/codemirror/rollup.config.js .cms/lib/codemirror/src/addon/runmode/codemirror-standalone.js .cms/lib/codemirror/src/addon/runmode/codemirror.node.js .cms/lib/codemirror/src/addon/runmode/runmode-standalone.js .cms/lib/codemirror/src/addon/runmode/runmode.node.js .cms/lib/codemirror/src/codemirror.js .cms/lib/codemirror/src/display/Display.js .cms/lib/codemirror/src/display/focus.js .cms/lib/codemirror/src/display/gutters.js .cms/lib/codemirror/src/display/highlight_worker.js .cms/lib/codemirror/src/display/line_numbers.js .cms/lib/codemirror/src/display/mode_state.js .cms/lib/codemirror/src/display/operations.js .cms/lib/codemirror/src/display/scroll_events.js .cms/lib/codemirror/src/display/scrollbars.js .cms/lib/codemirror/src/display/scrolling.js .cms/lib/codemirror/src/display/selection.js .cms/lib/codemirror/src/display/update_display.js .cms/lib/codemirror/src/display/update_line.js .cms/lib/codemirror/src/display/update_lines.js .cms/lib/codemirror/src/display/view_tracking.js .cms/lib/codemirror/src/edit/CodeMirror.js .cms/lib/codemirror/src/edit/commands.js .cms/lib/codemirror/src/edit/deleteNearSelection.js .cms/lib/codemirror/src/edit/drop_events.js .cms/lib/codemirror/src/edit/fromTextArea.js .cms/lib/codemirror/src/edit/global_events.js .cms/lib/codemirror/src/edit/key_events.js .cms/lib/codemirror/src/edit/legacy.js .cms/lib/codemirror/src/edit/main.js .cms/lib/codemirror/src/edit/methods.js .cms/lib/codemirror/src/edit/mouse_events.js .cms/lib/codemirror/src/edit/options.js .cms/lib/codemirror/src/edit/utils.js .cms/lib/codemirror/src/input/ContentEditableInput.js .cms/lib/codemirror/src/input/TextareaInput.js .cms/lib/codemirror/src/input/indent.js .cms/lib/codemirror/src/input/input.js .cms/lib/codemirror/src/input/keymap.js .cms/lib/codemirror/src/input/keynames.js .cms/lib/codemirror/src/input/movement.js .cms/lib/codemirror/src/line/highlight.js .cms/lib/codemirror/src/line/line_data.js .cms/lib/codemirror/src/line/pos.js .cms/lib/codemirror/src/line/saw_special_spans.js .cms/lib/codemirror/src/line/spans.js .cms/lib/codemirror/src/line/utils_line.js .cms/lib/codemirror/src/measurement/position_measurement.js .cms/lib/codemirror/src/measurement/widgets.js .cms/lib/codemirror/src/model/Doc.js .cms/lib/codemirror/src/model/change_measurement.js .cms/lib/codemirror/src/model/changes.js .cms/lib/codemirror/src/model/chunk.js .cms/lib/codemirror/src/model/document_data.js .cms/lib/codemirror/src/model/history.js .cms/lib/codemirror/src/model/line_widget.js .cms/lib/codemirror/src/model/mark_text.js .cms/lib/codemirror/src/model/selection.js .cms/lib/codemirror/src/model/selection_updates.js .cms/lib/codemirror/src/modes.js .cms/lib/codemirror/src/util/StringStream.js .cms/lib/codemirror/src/util/bidi.js .cms/lib/codemirror/src/util/browser.js .cms/lib/codemirror/src/util/dom.js .cms/lib/codemirror/src/util/event.js .cms/lib/codemirror/src/util/feature_detection.js .cms/lib/codemirror/src/util/misc.js .cms/lib/codemirror/src/util/operation_group.js .cms/lib/codemirror/test/annotatescrollbar.js .cms/lib/codemirror/test/comment_test.js .cms/lib/codemirror/test/contenteditable_test.js .cms/lib/codemirror/test/doc_test.js .cms/lib/codemirror/test/driver.js .cms/lib/codemirror/test/emacs_test.js .cms/lib/codemirror/test/html-hint-test.js .cms/lib/codemirror/test/index.html .cms/lib/codemirror/test/lint.js .cms/lib/codemirror/test/mode_test.css .cms/lib/codemirror/test/mode_test.js .cms/lib/codemirror/test/multi_test.js .cms/lib/codemirror/test/run.js .cms/lib/codemirror/test/scroll_test.js .cms/lib/codemirror/test/search_test.js .cms/lib/codemirror/test/sql-hint-test.js .cms/lib/codemirror/test/sublime_test.js .cms/lib/codemirror/test/test.js .cms/lib/codemirror/theme/3024-day.css .cms/lib/codemirror/theme/3024-night.css .cms/lib/codemirror/theme/abbott.css .cms/lib/codemirror/theme/abcdef.css .cms/lib/codemirror/theme/ambiance-mobile.css .cms/lib/codemirror/theme/ambiance.css .cms/lib/codemirror/theme/ayu-dark.css .cms/lib/codemirror/theme/ayu-mirage.css .cms/lib/codemirror/theme/base16-dark.css .cms/lib/codemirror/theme/base16-light.css .cms/lib/codemirror/theme/bespin.css .cms/lib/codemirror/theme/blackboard.css .cms/lib/codemirror/theme/cobalt.css .cms/lib/codemirror/theme/colorforth.css .cms/lib/codemirror/theme/darcula.css .cms/lib/codemirror/theme/dracula.css .cms/lib/codemirror/theme/duotone-dark.css .cms/lib/codemirror/theme/duotone-light.css .cms/lib/codemirror/theme/eclipse.css .cms/lib/codemirror/theme/elegant.css .cms/lib/codemirror/theme/erlang-dark.css .cms/lib/codemirror/theme/gruvbox-dark.css .cms/lib/codemirror/theme/hopscotch.css .cms/lib/codemirror/theme/icecoder.css .cms/lib/codemirror/theme/idea.css .cms/lib/codemirror/theme/isotope.css .cms/lib/codemirror/theme/juejin.css .cms/lib/codemirror/theme/lesser-dark.css .cms/lib/codemirror/theme/liquibyte.css .cms/lib/codemirror/theme/lucario.css .cms/lib/codemirror/theme/material-darker.css .cms/lib/codemirror/theme/material-ocean.css .cms/lib/codemirror/theme/material-palenight.css .cms/lib/codemirror/theme/material.css .cms/lib/codemirror/theme/mbo.css .cms/lib/codemirror/theme/mdn-like.css .cms/lib/codemirror/theme/midnight.css .cms/lib/codemirror/theme/monokai.css .cms/lib/codemirror/theme/moxer.css .cms/lib/codemirror/theme/neat.css .cms/lib/codemirror/theme/neo.css .cms/lib/codemirror/theme/night.css .cms/lib/codemirror/theme/nord.css .cms/lib/codemirror/theme/oceanic-next.css .cms/lib/codemirror/theme/panda-syntax.css .cms/lib/codemirror/theme/paraiso-dark.css .cms/lib/codemirror/theme/paraiso-light.css .cms/lib/codemirror/theme/pastel-on-dark.css .cms/lib/codemirror/theme/railscasts.css .cms/lib/codemirror/theme/rubyblue.css .cms/lib/codemirror/theme/seti.css .cms/lib/codemirror/theme/shadowfox.css .cms/lib/codemirror/theme/solarized.css .cms/lib/codemirror/theme/ssms.css .cms/lib/codemirror/theme/the-matrix.css .cms/lib/codemirror/theme/tomorrow-night-bright.css .cms/lib/codemirror/theme/tomorrow-night-eighties.css .cms/lib/codemirror/theme/ttcn.css .cms/lib/codemirror/theme/twilight.css .cms/lib/codemirror/theme/vibrant-ink.css .cms/lib/codemirror/theme/xq-dark.css .cms/lib/codemirror/theme/xq-light.css .cms/lib/codemirror/theme/yeti.css .cms/lib/codemirror/theme/yonce.css .cms/lib/codemirror/theme/zenburn.css .cms/man/css/prism.css .cms/man/css/styles.css .cms/man/js/prism.js .cms/man/ru_RU.UTF-8/book.html .cms/man/ru_RU.UTF-8/codemirror.html .cms/man/ru_RU.UTF-8/example.html .cms/man/ru_RU.UTF-8/hint_css.html .cms/man/ru_RU.UTF-8/hint_html.html .cms/man/ru_RU.UTF-8/hint_php.html .cms/man/ru_RU.UTF-8/menu.html .cms/mini/404.en_US.UTF-8.php .cms/mini/404.ru_RU.UTF-8.php .cms/mini/404.uk_UA.UTF-8.php .cms/mini/banner.jpg .cms/mini/blog.php .cms/mini/favicon.svg .cms/mini/frontpage.php .cms/mini/html.php .cms/mini/instruction.ru_RU.UTF-8.html .cms/mini/page.php .cms/mini/page.teaser.php .cms/mini/post.php .cms/mini/styles.css .cms/mini/template.settings.php .cms/mini/tpl.mod.php .cms/mod/admin.mod.php .cms/mod/base.mod.php .cms/mod/menu.mod.php .cms/mod/pages.mod.php .cms/mod/rss.mod.php .cms/mod/sitemap.mod.php .cms/mod/template.mod.php .cms/update.php .cms/update.sql .htaccess .nginx.conf uploads/.keep
diffstat 673 files changed, 134873 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/.unlicense.txt	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,24 @@
+This is free and unencumbered software released into the public domain.
+
+Anyone is free to copy, modify, publish, use, compile, sell, or
+distribute this software, either in source code form or as a compiled
+binary, for any purpose, commercial or non-commercial, and by any
+means.
+
+In jurisdictions that recognize copyright laws, the author or authors
+of this software dedicate any and all copyright interest in the
+software to the public domain. We make this dedication for the benefit
+of the public at large and to the detriment of our heirs and
+successors. We intend this dedication to be an overt act of
+relinquishment in perpetuity of all present and future rights to this
+software under copyright law.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+OTHER DEALINGS IN THE SOFTWARE.
+
+For more information, please refer to <http://unlicense.org/>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/admin.cms/html.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,467 @@
+<?php
+
+    // Время истечения cookie входа
+    $expire_days = 365;
+    $expire = time() + $expire_days * 24 * 60 * 60;
+    // Продлевать если истекают через
+    $expire_less = 180;
+
+    // Продление куки входа
+    if ( is_admin() ) {
+        $sess = $_COOKIE["sess"];
+        $expire = (int) $cms["config"]["logged"][$sess]["expire"];
+        $pre_expire = $expire - $expire_less * 24 * 60 * 60;
+        $now = time();
+        if ( $now > $pre_expire ) {
+            $new_expire = time() + $expire_days * 24 * 60 * 60;
+            if ( PHP_VERSION_ID < 70300 ) {
+                setcookie( "sess", $sess, $new_expire );
+            } else {
+                setcookie( "sess", $sess, array( "SameSite" => "Lax", "expires" => $new_expire ) );
+            }
+            // Так же запомнить в конфиге
+            $cms["config"]["logged"][$sess]["expire"] = $new_expire;
+            cms_save_config();
+        }
+    }
+
+    // Для работы выпадающего списка
+    if ( empty( $cms["config"]["locale"] ) ) {
+        $cms["config"]["locale"] = "en_US.UTF-8";
+        $cms["config"]["lang"]   = "en";
+    }
+    if ( ! empty( $_GET["locale"] ) ) {
+        $cms["config"]["locale"] = $_GET["locale"];
+        $cms["config"]["lang"]   = substr( $_GET["locale"], 0, 2 );
+    }
+    
+    // Login
+    if ( isset( $_POST["login"] ) && isset( $_POST["password"] ) ) {
+
+        // Install process
+        if ( empty( $cms["config"]["admin.mod.php"]["admin_login"] )
+         && empty( $cms["config"]["admin.mod.php"]["admin_password"] )
+         && ( ! empty( $_POST["login"] ) || ! empty( $_POST["password"] ) ) ) {
+            $cms["config"]["admin.mod.php"]["admin_login"]    = $_POST["login"];
+            $cms["config"]["admin.mod.php"]["admin_password"] = $_POST["password"];
+            $cms["config"]["admin.mod.php"]["admin_salt"]     = cms_uid();
+            $cms["config"]["admin.mod.php"]["admin_url"]      = "-admin";
+            $link = "{$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}";
+            
+            // Set Locale and Timezone
+            $cms["config"]["locale"] = $_POST["locale"];
+            $cms["config"]["lang"]   = substr( $cms["config"]["locale"], 0, 2 );
+            cms_save_config();
+
+            if ( is_email( $cms["config"]["admin.mod.php"]["admin_login"] ) ) {
+                $subject = __( "install_finished" );
+                $body  = __( "congrat" ) . "\n\n";
+                $body .= __( "install_finished" ) . "\n\n";
+                $body .= __( "login_info" ) . "\n\n";
+                $body .= __( "login_url" ) . ": {$link}\n\n";
+                $body .= __( "login" ) . ": {$_POST['login']}\n\n";
+                $body .= __( "password" ) . ": {$_POST['password']}";
+                cms_email( array(
+                    "type" => "text/plain",
+                    "from_email" => "noreply@" . $cms["url"]["host"],
+                    "from_name"  => $cms["url"]["host"],
+                    "to_email"   => $_POST["login"],
+                    "subject"    => $subject,
+                    "email_body" => $body,
+                ) );
+            }
+        }
+        // Check login and password
+        if ( $_POST["login"]    === $cms["config"]["admin.mod.php"]["admin_login"] && 
+             $_POST["password"] === $cms["config"]["admin.mod.php"]["admin_password"] )
+        {
+
+            $d        = date( "Y-m-d H:i:s" );
+            $sess    = sha1( $cms["config"]["admin.mod.php"]["admin_login"] . $cms["config"]["admin.mod.php"]["admin_salt"] . $d );
+            
+            // Prepend New Session
+            if ( ! isset( $cms["config"]["logged"] ) ) {
+                $cms["config"]["logged"] = array();
+            }
+            $cms["config"]["logged"] = array(
+                $sess => array(
+                    "ip"         => $_SERVER["REMOTE_ADDR"],
+                    "date"       => $d,
+                    "user_agent" => $_SERVER["HTTP_USER_AGENT"],
+                    "expire"     => $expire,
+                )
+            ) + $cms["config"]["logged"];
+
+            // Set Locale and Timezone
+            $cms["config"]["locale"] = $_POST["locale"];
+            $cms["config"]["lang"]   = substr( $cms["config"]["locale"], 0, 2 );
+
+            if ( cms_save_config() ) {
+                
+                if ( PHP_VERSION_ID < 70300 ) {
+                    setcookie( "sess", $sess, $expire );
+                } else {
+                    setcookie( "sess", $sess, array( "SameSite" => "Lax", "expires" => $expire ) );
+                }
+                
+                $cms["status"] = "302";
+                $cms["status_302_location"] = $cms["base_path"] . $cms["config"]["admin.mod.php"]["admin_url"];
+                return;
+
+            } else {
+                
+                $error_message = __( "cant_write_config" ) . " .cms/config.php";
+
+            }
+
+        } else {
+            
+            $error_message = __( "access_denied" );
+
+        }
+    }
+
+    // Тема
+    if ( isset( $_COOKIE["theme"] ) && in_array( $_COOKIE["theme"], array( 0, 2 ) ) ) {
+        $pref_bg = "#1e1d1d";
+    } else {
+        $pref_bg = "#e9e0dd";
+    }
+    $styles = array( "dark", "light", "dark classic" );
+    if ( isset( $_COOKIE["theme"] ) ) {
+        $html_classes = $styles[ $_COOKIE["theme"] ];
+    } else {
+        $html_classes = "dark";
+    }    
+
+?>
+<!doctype html>
+<html lang="<?php echo $cms["config"]["lang"]; ?>" class="<?php echo $html_classes; ?>">
+    <head>
+        <meta charset="utf-8">
+        <meta name="viewport" content="width=device-width, initial-scale=1.0, interactive-widget=resizes-content">
+        <title><?php echo $cms['url']['host']; ?></title>
+        <link rel="icon" href="<?php echo $cms["base_path"]; ?>img/favicon.svg">
+        <style>
+            html {
+                background-color: <?php echo $pref_bg; ?>;
+            }
+        </style>
+
+
+        <?php
+        echo "<link rel=stylesheet href='{$cms['base_path']}css/admin.css'>";
+
+        echo "<script>\nadmin_styles = " . json_encode( $styles ) . ";\n";
+        if ( is_admin() && ! empty( $cms["config"]["locale"] ) ) {
+            $lang = json_encode( $cms["lang"] ); // Переводы
+            $tr   = json_encode( $cms["tr"] ); // Транслитерация
+            $modules = json_encode( $cms["modules"] );
+            if ( is_admin() ) {
+                echo "cms = {};
+                cms.base_path = '{$cms['base_path']}';
+                cms.async_api = true;
+                cms.api = '{$cms['base_path']}{$cms['config']['admin.mod.php']['api_url']}';
+                cms.locale = '{$cms['config']['locale']}';
+                cms.modules = {$modules};
+                cms.lang = {$lang};
+                cms.tr = {$tr};";
+            }
+        }
+        echo "</script>\n";
+        ?>
+
+        <?php do_hook( "admin_header" ); ?>
+
+    </head>
+
+
+<?php if ( is_admin() ) : ?>
+
+<body class=logged>
+    <header>
+        <div class=burger>
+            <div class=menu-icon>
+                <span class=line-1></span>
+                <span class=line-2></span>
+            </div>
+        </div>
+
+        <div class=menu>
+            <a href="<?php echo $cms["base_path"]; ?>" data-front target=_blank>
+                <?php echo __( "home_link" ); ?>
+            </a>
+            <div class=clear-cache>
+                <?php echo __( "cache_btn" ); ?>
+            </div>
+            <div class=theme-switcher>
+                <?php echo __( "theme_btn" ); ?>
+            </div>
+            <div data-logout>
+                <?php echo __( "logout_btn" ); ?>
+            </div>
+        </div>
+    </header>
+
+    <aside>
+
+<?php
+foreach( $cms["admin_sections"] as $section_name => $section ) {
+    if ( empty( $section["hide"] ) ) {
+        // Не выводим пустые секции
+        if ( ! empty( $cms["admin_sections"][$section_name]["items"] ) ) {
+            
+            echo "<section sort={$section["sort"]}>";
+            echo "<div>{$cms['admin_sections'][$section_name]['title']}</div>";
+
+            foreach( $cms["admin_sections"][$section_name]["items"] as $page_name => $page ) {
+                if ( empty( $page["hide"] ) ) {
+                    $title = __( $page["title"], $page["module"] );
+                    // for highlite
+                    if ( ! empty( $page["class"] ) ) {
+                        $class = "class='{$page['class']}'";
+                    } else {
+                        $class = "";
+                    }
+                    if ( empty( $page["url"] ) ) {
+                        echo "<a href=#{$page_name} {$class} sort={$page['sort']}>{$title}</a>";
+                    } else {
+                        echo "<a href='{$page['url']}' target=_blank {$class} sort={$page['sort']}>{$title}</a>";
+                    }
+                }
+            }
+            echo "</section>";
+        }
+    }
+}
+?>
+
+    </aside>
+
+
+    <main>
+
+<?php
+    $hello = __( "hello" );
+    if ( cms_base_connect() === false ) {
+        $base_ok = "<p>" . __( "hello_set_base" ) . "</p>";
+    } else {
+        $base_ok = "";
+    }
+    
+    echo "
+<section id=start>
+    <div>
+        <div>{$hello}</div>
+        {$base_ok}
+    </div>
+</section>";
+
+    foreach( $cms["admin_pages"] as $name => $page ) {
+        echo "<section id={$name}>{$page}</section>";
+    }
+    
+?>
+
+    </main>
+
+    <div class=milk></div>
+
+    <div class=log-info-box>
+        <!-- div for messages -->
+    </div>
+
+<?php else : ?>
+
+<body class=login>
+  
+    <header>
+        <div class=menu>
+            <div class=theme-switcher>
+                <?php echo __( "theme_btn" ); ?>
+            </div>
+        </div>
+    </header>
+
+    
+
+    <div class=aside-main>
+        <div class=center-box>
+            <div class=setup-error>
+                <?php
+                // Если файл существует, то не перезаписывать его,
+                // иначе можно менять языки не заходя в админку
+                // Но проверку оставить, могут быть сменены права позже
+                if ( is_file( $cms["config_file"] ) ) {
+                    if ( ! is_writable( $cms["config_file"] ) ) {
+                        echo __( "cant_write_config" ) . " {$cms["config_file"]}";
+                    }
+                }
+                // config.php not writeable
+                elseif ( cms_save_config() === false ) {
+                    echo __( "cant_write_config" ) . " {$cms["config_file"]}";
+                }
+
+                // Error login and password
+                if ( isset( $error_message ) ) {
+                    echo __( $error_message );
+                }
+                ?>
+            </div>
+            
+            <?php
+                // Scan all locales
+                $options = "";
+                foreach( glob( "lang/*.UTF-8",  GLOB_ONLYDIR ) as $locale ) {
+                    include( $locale . "/admin.mod.php" );
+                    $locale = preg_replace( "/.*\//u", "", $locale );
+
+                    // translate
+                    $lang = $cms["lang"]["admin.mod.php"][$locale][$locale];
+
+                    $options .= "<div class=option value='{$locale}'>{$lang}</div>";
+                }
+            ?>
+            <div class=lang-selector>
+                <div class=lang-select-grid>
+                    <div class=field-select data-lang='<?php echo $cms["config"]["locale"]; ?>'>
+                        <div class=value>
+                            <?php echo $cms["lang"]["admin.mod.php"][$cms["config"]["locale"]][$cms["config"]["locale"]]; ?>
+                        </div>
+                        <div class=icon></div>
+                    </div>
+                    <div class=field-options>
+                        <?php echo $options; ?>
+                    </div>
+                </div>
+            </div>
+            <div class=setup-auth>
+                <?php
+                if ( empty( $cms["config"]["admin.mod.php"]["admin_login"] ) && empty( $cms["config"]["admin.mod.php"]["admin_password"] ) ) {
+                    echo __( "set_login_and_password" );
+                }
+                ?>
+            </div>
+
+            <script>
+            <?php
+            $form = "
+            <form class=login-and-password method=post>
+                <div class=login>
+                    <input placeholder=\"" . __( "login_or_password" ) . "\" name=login type=text>
+                </div>
+                <div class=password>
+                    <input placeholder=\"" . __( "password" ) . "\" name=password type=password>
+                    <div class=password-eye></div>
+                    <button title=\"" . __( "login_btn" ) . "\"></button>
+                </div>
+                <input type=hidden name=locale value=\"{$cms["config"]["locale"]}\">
+            </form>";
+            $form = base64_encode( $form );
+            ?>
+            let f = decodeURIComponent( escape( window.atob( "<?php echo $form; ?>" ) ) );
+            document.write( f );
+
+            document.querySelectorAll( ".login-and-password .login input" ).forEach( function( login ) {
+                login.focus();
+            } );
+
+            function get_cookie( name ) {
+                let cookies = document.cookie.split( ";" );
+                for ( let line of cookies ) {
+                    let cookie = line.split( "=" );
+                    if ( name == cookie[ 0 ].trim() ) {
+                        return decodeURIComponent( cookie[ 1 ] );
+                    }
+                }
+                return "";
+            }
+
+            function set_cookie( name, value ) {
+                document.cookie = encodeURIComponent( name ) + "=" + encodeURIComponent( value ) + ";SameSite=Lax";
+            }
+
+            // Theme switcher
+            document.querySelectorAll( ".theme-switcher" ).forEach( function( el ) {
+                el.addEventListener( "click", function( event ) {
+                    event.preventDefault();
+                    let n = get_cookie( "theme" ) || 0;
+                    let styles2 = admin_styles[n];
+                    let styles = styles2.split( " " );
+                    styles.forEach( function( style ) {
+                        document.documentElement.classList.remove( style );
+                    } );
+                    n = (+n+1) % admin_styles.length;
+                    styles2 = admin_styles[n];
+                    styles = styles2.split( " " );
+                    styles.forEach( function( style ) {
+                        document.documentElement.classList.add( style );
+                    } );
+                    set_cookie( "theme" , n );
+                } );
+            } );
+
+            // Select language. Select
+            document.querySelectorAll( ".login .field-select" ).forEach( function( select ) {
+                select.addEventListener( "click", function( e ) {
+                    e.stopPropagation();
+                    select.nextElementSibling.classList.toggle( "open" );
+                    select.closest( ".lang-select-grid" ).classList.toggle( "open" );
+                } );
+            } );
+
+            // Select language. Option
+            document.querySelectorAll( ".login .field-options .option" ).forEach( function( select ) {
+                select.addEventListener( "click", function( e ) {
+                    let input = this.closest( ".lang-select-grid" ).querySelector( ".field-select" );
+                    input.setAttribute( "data-lang", this.getAttribute( "value" ) );
+                    input.querySelector( ".value" ).innerText = this.innerText;
+                    //e.stopPropagation(); убираем чтобы закрылось автоматически
+                    let locale = this.getAttribute( "value" );
+                    let search = window.location.search.replace( /&*locale=[^&]+/, "" );
+                    if ( search == "" ) { 
+                        search += "?locale=" + locale;
+                    } else if ( search == "?" ) {
+                        search += "locale=" + locale;
+                    } else {
+                        search += "&locale=" + locale;
+                    }
+                    window.location.search = search;
+                } );
+            } );
+
+            // Клик по молоку
+            document.body.addEventListener( "click", function( e ) {
+                let select = document.querySelector( ".login .lang-select-grid" );
+                select.classList.remove( "open" );
+                select.querySelector( ".field-options" ).classList.remove( "open" );
+            } );
+
+            // Show/Hide password
+            document.querySelectorAll( ".password-eye" ).forEach( function( eye ) {
+                eye.addEventListener( "click", function( e ) {
+                    this.classList.toggle( "showed" );
+                    let inp = this.previousElementSibling;
+                    let t   = inp.getAttribute( "type" );
+                    if ( t == "password" ) {
+                        inp.setAttribute( "type", "text" );
+                    } else {
+                        inp.setAttribute( "type", "password" );
+                    }
+                    inp.focus();
+                } );
+            } );
+            </script>
+
+            <div class=flatfree></div>
+            <div class=support-box>
+                <a target=_blank href='<?php echo __( "support_url" ); ?>'><?php echo __( "support" ); ?></a>
+            </div>
+        </div>
+    </div>
+
+    
+<?php endif; ?>
+    
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/admin.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,3483 @@
+:root {
+    --sans-serif: "Segoe UI", "Nunito", "Noto Sans", "Ubuntu", system-ui, sans-serif;
+    --monospace:  "Consolas", "Hack", "Ubuntu Mono", monospace;
+}
+/* FreeBSD: pkg install google-fonts */
+
+
+/*#region Colors Dark*/
+html.dark {
+    color-scheme: dark; /*Scroll*/
+    /*Colors*/
+    /*Backgrounds Universal*/
+    --bg-2: #111111;
+    --bg-3: #1e1d1d;
+    --bg-4: #383433;
+    --bg-5: #171717;
+
+    /*Border Mediateka*/
+    --w-1: #000000;
+    --br-3: #333333;
+    --br-active: #a79080;
+    --file-input: #1e1d1d;
+    --file-border: #383433;
+    --font-bg: #1e1d1d;
+    --ext: #ffe3cf;
+    /*End*/
+
+    /*Colors*/
+    --white: #ffffff;
+    --black: #000000;
+    --orange: #ff4e00;
+    --green-3: #5d7d25;
+    --changes: #00ffff;
+
+    --focus-orange: #ff4d0021;
+    --saved-bg: #405200;
+    /*End*/
+
+    --windows: #2e2b2b;
+    --windows-hover: #282525;
+    --windows-font: #d5bfae;
+
+    --input-bg: var(--bg-3);
+    --input-border: var(--bg-4);
+    --input-font: var(--text);
+    --button-bg: var(--bg-3);
+    --button-border: var(--bg-3);
+    /*End*/
+
+    /*Modules Universal Properties*/
+    --buttons-font: #a79080;
+    --buttons-hover: #e9c3a6;
+    --buttons-open: #e4845a;
+
+    --link: #d09074;
+    --link-hover: #ffcab3;
+    --link-none: #d5bdac;
+
+    --names: #b98675;
+    --text: #cccccc;
+
+    --add-page-btn-br: #383433;
+    --add-page-btn-font: #9b8b84;
+    /*End*/
+    
+    /*Admin-Header*/
+    --header-menu-hover: #f0743f;
+    --menu-icon-span: #d09074;
+
+    /*Admin-Info-Notice*/
+    --info-success: #e9e0ddcc;
+    --info-error: #940002c4;
+    --info-fonts-success: #000000;
+    --info-fonts-error: #ffffff;
+
+    /*Admin-Aside*/
+    --aside-section-div: #8f786f;
+    --aside-section-a: #eabca9;
+    --aside-section-a-hover: #38343340;
+    --aside-section-a-active: #38343373;
+    --aside-section-a-red: #9f2624;
+    
+    /*Admin-Modul-Auth*/
+    --setup-auth: #b5978e;
+    --sess-table-font: #b3aaa3;
+    --sess-table-current: #78ca78;
+    --auth-del-sess-hover: var(--bg-4);
+
+    /*Milk*/
+    --mobile-menu-open-milk: #18101071;
+
+    /*Template*/
+    --template-files-file: #a38174;
+    --template-files-file-hover: #c49b8c;
+
+    /*Admin Menu*/
+
+
+    /*PHP Info*/
+    --phpinfo-font: #a38173;
+    --phpinfo-h-bg: #373434;
+    --phpinfo-v-i-font: #b39393;
+    --phpinfo-hr-bg: #615858;
+
+    /*Pages*/
+    --page-search: #1b1a1a;
+    
+    --add-page-btn-hover: var(--bg-4);
+    --add-page-btn-svg-b-plus: #9b8b84;
+    --saved: #87d94f;
+    --error: #a00000;
+    --hidden: #a71a1a;
+
+    --del-pages-btn-svg: #9b8b84;
+
+    --pages-grid-div-open: #181717;
+    --pages-grid-div-open-shadow: #b26044;
+
+    --page-date: #9b8b84;
+    --page-date-planned: #ffe4c4;
+    
+    --main-footer-pager-div-hover: #d09074;
+    --main-footer-pager-div-active-font: #ffcab3;
+    --pages-main-footer-pager-div-bg-active: #e875432e;
+
+    --lbox-window: #000000dd;
+    --shadows: 0 2px 2px 0 #00000033;
+
+    /*Tags*/
+    --tags-bg: #282525;
+    --tags-font: darkgray;
+
+    /*Codemirror*/
+    --codemirror-bg: #302c2c;
+    --codemirror-text: #d5d0cc;
+    --codemirror-numbeslines: #897067;
+    --codemirror-numbes-bg: #343232;
+
+    /*Menu*/
+    --open-menu: #191919;
+    --menu-menu-open-prop: var(--buttons-open);
+    --save-menu: #8bc34a;
+
+
+    --menu-input-bg: var(--bg-3);
+    --menu-input-border: var(--bg-4);
+
+    --menu-item-bg-hover-open: var(--windows);
+
+    --menu-item-a: var(--link);
+    --menu-item-a-hover: var(--link-hover);
+    --menu-item-a-none-link: var(--link-none);
+
+    --menu-item-open-prop: var(--buttons-open);
+
+    --menu-menu-buttons-div: var(--buttons-font);
+    --menu-menu-buttons-div-hover: var(--buttons-hover);
+
+    --menu-input-select-font-disabled: #746c6a;
+    
+    --menu-item-select-dropdown-font: #d7c0b6;
+    --menu-item-field-search-input-bg: #101010;
+    --menu-item-field-search-input-focus: #786050;
+    --menu-item-list-search-li-hover-active: #101010;
+
+    --sub-line: #00c0d8;
+
+    
+    /*Modules*/
+    --modules-grid-div-disabled: #2a2828;
+    --modules-grid-div-disabled-hover: #2a2828;
+    --disabled-module: #6c6565;
+    --enabled-module-description: #a08c81;
+    --disabled-module-sw-btn: #89d3be;
+    --shadow: #00000073;
+    --blur-bg: #1e1d1d73;
+    --blur-font: #d5bfae;
+
+    /*Individual*/
+    --category-parents: #726a6a;
+
+    /*Icons*/
+    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 489.68 489.68'%3E%3Cdefs%3E%3Cstyle%3E.a-search%7Bfill:%23d09074;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a-search' d='M0,196.4C0,304.9,88,392.83,196.5,392.8A196.53,196.53,0,0,0,320.1,349l135,135A20.44,20.44,0,0,0,484,455.1l-135-135c68.29-84.31,55.3-208-29-276.3A196.42,196.42,0,0,0,196.4,0C88,0,0,87.9,0,196.4Zm40.8,0A155.6,155.6,0,1,1,196.4,352h0A155.66,155.66,0,0,1,40.8,196.4Z'/%3E%3C/svg%3E");
+
+    --select-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23888888' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
+
+    --pages-pin-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16.46'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;%7D.b%7Bfill:none;stroke:%23b26044;stroke-miterlimit:10;stroke-width:2px;%7D%3C/style%3E%3C/defs%3E%3Cpolygon class='a' points='1 0 1 14.72 7 11.22 13 14.72 13 0 1 0'/%3E%3Cpolyline class='b' points='1 0 1 14.72 7 11.22 13 14.72 13 0'/%3E%3C/svg%3E");
+
+    --pages-pin-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16.46'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:%23b26044;%7D%3C/style%3E%3C/defs%3E%3Cpolygon class='a' points='14 16.46 7 12.38 0 16.46 0 0 14 0 14 16.46'/%3E%3C/svg%3E");
+
+    --check-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
+
+    --eye-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 111 111'%3E%3Cdefs%3E%3Cstyle%3E.a,.c%7Bfill:none;%7D.b%7Bfill:%23beafa2;%7D.c%7Bstroke:%23beafa2;stroke-miterlimit:10;stroke-width:7px;%7D%3C/style%3E%3C/defs%3E%3Crect class='a' width='111' height='111'/%3E%3Cpath class='b' d='M55.61,93A57.36,57.36,0,0,1,2,56.45l-.5-1.28L2,53.88A57.36,57.36,0,0,1,55.61,17.37h0a57.36,57.36,0,0,1,53.65,36.51l.49,1.27-.48,1.27C101,77.94,79,93,55.61,93ZM9,55.17A50.39,50.39,0,0,0,55.61,86c20.06,0,39-12.6,46.61-30.8A50.37,50.37,0,0,0,55.61,24.37h0A50.37,50.37,0,0,0,9,55.17Z' transform='translate(-0.11)'/%3E%3Cpath class='b' d='M55.61,80.17a25,25,0,1,1,25-25A25,25,0,0,1,55.61,80.17Zm0-41.55A16.55,16.55,0,1,0,72.16,55.17,16.57,16.57,0,0,0,55.61,38.62Z' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M103.77,88.28' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M19.55,7.34' transform='translate(-0.11)'/%3E%3C/svg%3E");
+    
+    --eye-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 111 111'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;%7D.b%7Bstroke:%23beafa2;stroke-miterlimit:10;stroke-width:7px;%7D.c%7Bfill:%23beafa2;%7D%3C/style%3E%3C/defs%3E%3Crect class='a' width='111' height='111'/%3E%3Cpath class='b' d='M103.77,88.28' transform='translate(-0.11)'/%3E%3Cpath class='b' d='M19.55,7.34' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M78.12,66A25,25,0,0,0,44.75,32.66l6.55,6.55A16.49,16.49,0,0,1,71.57,59.48Z' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M109.26,53.88A57.36,57.36,0,0,0,55.61,17.37h0a58.11,58.11,0,0,0-21.89,4.26l5.44,5.44a51.16,51.16,0,0,1,16.45-2.7,50.37,50.37,0,0,1,46.61,30.81A49.46,49.46,0,0,1,87,74.93l5,5a56.18,56.18,0,0,0,17.29-23.47l.48-1.27Z' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M86.21,84l-5.08-5.08h0l-7-7-6-6L44.83,42.64l-6-6L32.22,30h0l-5.16-5.17h0L12.17,10,7.22,14.93,21.07,28.78A57.62,57.62,0,0,0,2,53.88l-.5,1.29L2,56.45A57.36,57.36,0,0,0,55.61,93,57,57,0,0,0,79.79,87.5L97,104.67l5-5L86.2,84ZM62.5,70.21a16.37,16.37,0,0,1-6.89,1.51A16.56,16.56,0,0,1,39.06,55.17a16.3,16.3,0,0,1,1.52-6.88ZM55.61,86A50.39,50.39,0,0,1,9,55.17,50.55,50.55,0,0,1,26.09,33.8l8.26,8.26a24.73,24.73,0,0,0-3.74,13.11A25,25,0,0,0,68.73,76.44l5.76,5.76A49.74,49.74,0,0,1,55.61,86Z' transform='translate(-0.11)'/%3E%3C/svg%3E");
+
+
+    --inter-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31.5 31.5'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;%7D.a%7Bstroke:%23d09074;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M404.15,357.31l6-6-6-6' transform='translate(-386.5 -335.5)'/%3E%3Cline class='a' x1='7.75' y1='15.75' x2='22.75' y2='15.75'/%3E%3Ccircle class='a' cx='15.75' cy='15.75' r='14'/%3E%3Crect class='b' width='31.5' height='31.5'/%3E%3C/svg%3E");
+
+    --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 37.47 37.61'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;stroke:%23d09074;stroke-linecap:round;stroke-width:5px;%7D.b%7Bstroke-linejoin:round;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M4.17,18.91H35.22' transform='translate(-0.25 -0.1)'/%3E%3Cpolyline class='b' points='18.81 35.12 2.5 18.81 18.81 2.5'/%3E%3C/svg%3E");
+
+    --icon-sub-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 39.97 37.62'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%23d09074;stroke-linecap:round;stroke-linejoin:round;stroke-width:5px;%7D%3C/style%3E%3C/defs%3E%3Cpolyline class='a' points='18.81 35.13 2.5 18.82 18.81 2.5'/%3E%3Cpolyline class='a' points='37.47 35.12 21.16 18.81 37.47 2.5'/%3E%3C/svg%3E");
+
+    --icon-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.86 18.94'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%23d09074;stroke-linecap:round;stroke-width:3px;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M22.06,10.83H27.7a8,8,0,0,1,8,8h0a8,8,0,0,1-8,8H22.06' transform='translate(-0.3 -9.33)'/%3E%3Cpath class='a' d='M15.41,26.78H9.77a8,8,0,0,1-8-8h0a8,8,0,0,1,8-8h5.64' transform='translate(-0.3 -9.33)'/%3E%3Cline class='a' x1='8.31' y1='9.47' x2='28.56' y2='9.47'/%3E%3C/svg%3E");
+
+    --icon-clear: url("data:image/svg+xml,%0A%3Csvg version='1.1' viewBox='0 0 37.819 37.819' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E.a-clear%7Bfill:none;stroke-linecap:round;stroke-width:5;stroke:%23d09074%7D%3C/style%3E%3Cg transform='translate(-32.072 -86.124)'%3E%3Cpath class='a-clear' d='m32.34 86.392 37.284 37.284'/%3E%3Cpath class='a-clear' d='m69.624 86.392-37.284 37.284'/%3E%3C/g%3E%3C/svg%3E");
+
+    --icon-clear-wb: url("data:image/svg+xml,%0A%3Csvg version='1.1' viewBox='0 0 37.819 37.819' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E.a-clear%7Bfill:none;stroke-linecap:round;stroke-width:5;stroke:%23ffffff%7D%3C/style%3E%3Cg transform='translate(-32.072 -86.124)'%3E%3Cpath class='a-clear' d='m32.34 86.392 37.284 37.284'/%3E%3Cpath class='a-clear' d='m69.624 86.392-37.284 37.284'/%3E%3C/g%3E%3C/svg%3E");
+
+    --icon-save: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 769.83 769.83'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%23d09074;stroke-miterlimit:10;stroke-width:55px;%7D%3C/style%3E%3C/defs%3E%3Ccircle class='a' cx='384.91' cy='384.91' r='102.48'/%3E%3Cpath class='a' d='M750.91,258.62V687.83a63.08,63.08,0,0,1-63.08,63.08H89.17a63.08,63.08,0,0,1-63.08-63.08h0V89.17A63.08,63.08,0,0,1,89.17,26.09H518.38A98.74,98.74,0,0,1,588.17,55L722,188.83A98.74,98.74,0,0,1,750.91,258.62Z' transform='translate(-3.59 -3.59)'/%3E%3Cpath class='a' d='M464.15,26.09V129.44A46.11,46.11,0,0,1,418,175.55H187.48a46.11,46.11,0,0,1-46.11-46.11V26.09' transform='translate(-3.59 -3.59)'/%3E%3C/svg%3E");
+
+    --icon-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 35 35'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;%7D.a%7Bstroke:%239b8b84;stroke-miterlimit:10;stroke-width:1.7px;%7D%3C/style%3E%3C/defs%3E%3Cline class='a' x1='9.63' y1='12.04' x2='25.38' y2='12.04'/%3E%3Cline class='a' x1='15.14' y1='8.75' x2='19.86' y2='8.75'/%3E%3Cpath class='a' d='M23.87,14.77v8.84a2.68,2.68,0,0,1-2.68,2.64H13.82a2.68,2.68,0,0,1-2.64-2.64V14.77'/%3E%3Cline class='a' x1='15.33' y1='15.89' x2='15.33' y2='21.96'/%3E%3Cline class='a' x1='19.69' y1='15.89' x2='19.69' y2='21.96'/%3E%3Crect class='b' width='35' height='35'/%3E%3C/svg%3E");
+
+    --noise: url(../img/noise-dark.png);
+}
+/*#endregion Color Dark*/
+
+/*#region Colors Light*/
+html.light {
+    color-scheme: light;  /*Scroll*/
+    /*Colors*/
+    /*Backgrounds Universal*/
+    --bg-2: #f8f2f2;
+    --bg-3: #e9e0dd;
+    --bg-4: #fffbfb;
+    --bg-5: #e9e0dd;
+
+    /*Border Mediateka*/
+    --w-1: #ffffff;
+    --br-3: #fbf0ed;
+    --br-active: #a79080;
+    --file-input: #1e1d1d;
+    --file-border: #383433;
+    --font-bg: #e9e0dd;
+    --ext: #8f572f;
+    /*End*/
+
+    /*Colors*/
+    --white: #ffffff;
+    --black: #000000;
+    --orange: #ff4e00;
+    --green-3: #71b300;
+    --changes: #ea8000;
+    
+    --focus-orange: #ff4d0021;
+    --saved-bg: #ddffab;
+    /*End*/
+
+    --windows: #f7efee;
+    --windows-hover: #fbf5f5;
+    --windows-font: #604c44;
+
+    --input-bg: var(--bg-4);
+    --input-border: #c9bfbc;
+    --input-font: var(--text);
+    --button-bg: var(--bg-4);
+    --button-border: var(--bg-4);
+    /*End*/
+
+    /*Modules Universal Properties*/
+    --buttons-font: #604c44;
+    --buttons-hover: #93614e;
+    --buttons-open: #c12a1b;
+
+    --link: #764646;
+    --link-hover: #bb381a;
+    --link-none: #7a7a7a;
+
+    --names: #4f3b58;
+    --text: #333333;
+
+    --add-page-btn-br: #c9bfbc;
+    --add-page-btn-font: #534e4c;
+    /*End*/
+    
+    /*Admin-Header*/
+    --header-menu-hover: #9b2e00;
+    --menu-icon-span: #c33b00;
+
+    /*Admin-Info-Notice*/
+    --info-success: #4c3a36bf;
+    --info-error: #940002c4;
+    --info-fonts-success: #ffffff;
+    --info-fonts-error: #ffffff;
+
+    /*Admin-Aside*/
+    --aside-section-div: #8f786f;
+    --aside-section-a: #382218;
+    --aside-section-a-hover: #fffbfb4d;
+    --aside-section-a-active: #fffbfb91;
+    --aside-section-a-red: #ff8585;
+    
+    /*Admin-Modul-Auth*/
+    --setup-auth: #b5978e;
+    --sess-table-font: #52473d;
+    --sess-table-current: #008917;
+    --auth-del-sess-hover: var(--bg-4);
+
+    /*Milk*/
+    --mobile-menu-open-milk: #18101071;
+
+    /*Template*/
+    --template-files-file: #563d40;
+    --template-files-file-hover: #9b4d4d;
+
+    /*Admin Menu*/
+
+
+    /*PHP Info*/
+    --phpinfo-font: #563939;
+    --phpinfo-h-bg: #d7cac7;
+    --phpinfo-v-i-font: #b39393;
+    --phpinfo-hr-bg: #615858;
+
+    /*Pages*/
+    --page-search: #f7efee;
+    
+    --add-page-btn-hover: var(--bg-4);
+    --add-page-btn-svg-b-plus: #9b8b84;
+    --saved: #157800;
+    --error: #e20000;
+    --hidden: #dd10c7;
+
+    --del-pages-btn-svg: #9b8b84;
+
+    --pages-grid-div-open: #e9e0dd;
+    --pages-grid-div-open-shadow: #ff8562;
+
+    --page-date: #8d5f4b;
+    --page-date-planned: #cf390c;
+
+    --main-footer-pager-div-hover: #bb381a;
+    --main-footer-pager-div-active-font: #bb381a;
+    --pages-main-footer-pager-div-bg-active: #d5bfaeeb;
+
+    --lbox-window: #000000dd;
+    --shadows:0 2px 2px 0 #00000012;
+
+    /*Tags*/
+    --tags-bg: #f9f4f4;
+    --tags-font: #958484;
+
+    /*Codemirror*/
+    --codemirror-bg: white;
+    --codemirror-text: #454545;
+    --codemirror-numbeslines: #897067;
+    --codemirror-numbes-bg: #343232;
+
+    /*Menu*/
+    --open-menu: #e1d6d2;
+    --menu-menu-open-prop: var(--buttons-open);
+    --save-menu: #008203;
+
+    --menu-input-bg: var(--w-1);
+    --menu-input-border: var(--bg-3);
+
+    --menu-item-bg-hover-open: var(--windows);
+
+    --menu-item-a: var(--link);
+    --menu-item-a-hover: var(--link-hover);
+    --menu-item-a-none-link: var(--link-none);
+
+    --menu-item-open-prop: var(--buttons-open);
+
+    --menu-menu-buttons-div: var(--buttons-font);
+    --menu-menu-buttons-div-hover: var(--buttons-hover);
+
+    --menu-input-select-font-disabled: #746c6a;
+
+    --menu-item-select-dropdown-font: #333333;
+    --menu-item-field-search-input-bg: var(--bg-4);
+    --menu-item-field-search-input-focus: #786050;
+    --menu-item-list-search-li-hover-active: var(--bg-4);
+
+    --sub-line: #0000ee;
+
+    
+    /*Modules*/
+    --modules-grid-div-disabled: #f3f3f3;
+    --modules-grid-div-disabled-hover: #f3f3f3;
+    --disabled-module: #a39595;
+    --disabled-module-description: #a39595;
+    --disabled-module-sw-btn: #009468;
+    --shadow: #00000030;
+    --blur-bg: #ffffff00;
+    --blur-font: #1c1313;
+
+    /*Individual*/
+    --category-parents: #918383;
+
+    /*Icons*/
+    --search-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 489.68 489.68'%3E%3Cdefs%3E%3Cstyle%3E.a-search%7Bfill:%239b8b84;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a-search' d='M0,196.4C0,304.9,88,392.83,196.5,392.8A196.53,196.53,0,0,0,320.1,349l135,135A20.44,20.44,0,0,0,484,455.1l-135-135c68.29-84.31,55.3-208-29-276.3A196.42,196.42,0,0,0,196.4,0C88,0,0,87.9,0,196.4Zm40.8,0A155.6,155.6,0,1,1,196.4,352h0A155.66,155.66,0,0,1,40.8,196.4Z'/%3E%3C/svg%3E");
+
+    --select-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23b9a097' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
+
+    --pages-pin-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16.46'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;%7D.b%7Bfill:none;stroke:%23ff8562;stroke-miterlimit:10;stroke-width:2px;%7D%3C/style%3E%3C/defs%3E%3Cpolygon class='a' points='1 0 1 14.72 7 11.22 13 14.72 13 0 1 0'/%3E%3Cpolyline class='b' points='1 0 1 14.72 7 11.22 13 14.72 13 0'/%3E%3C/svg%3E");
+
+    --pages-pin-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 14 16.46'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:%23ff8562;%7D%3C/style%3E%3C/defs%3E%3Cpolygon class='a' points='14 16.46 7 12.38 0 16.46 0 0 14 0 14 16.46'/%3E%3C/svg%3E");
+
+    --check-icon: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3e%3cpath fill='none' stroke='%23fff' stroke-linecap='round' stroke-linejoin='round' stroke-width='3' d='M6 10l3 3l6-6'/%3e%3c/svg%3e");
+
+    --eye-on: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 111 111'%3E%3Cdefs%3E%3Cstyle%3E.a,.c%7Bfill:none;%7D.b%7Bfill:%239b8b84;%7D.c%7Bstroke:%239b8b84;stroke-miterlimit:10;stroke-width:7px;%7D%3C/style%3E%3C/defs%3E%3Crect class='a' width='111' height='111'/%3E%3Cpath class='b' d='M55.61,93A57.36,57.36,0,0,1,2,56.45l-.5-1.28L2,53.88A57.36,57.36,0,0,1,55.61,17.37h0a57.36,57.36,0,0,1,53.65,36.51l.49,1.27-.48,1.27C101,77.94,79,93,55.61,93ZM9,55.17A50.39,50.39,0,0,0,55.61,86c20.06,0,39-12.6,46.61-30.8A50.37,50.37,0,0,0,55.61,24.37h0A50.37,50.37,0,0,0,9,55.17Z' transform='translate(-0.11)'/%3E%3Cpath class='b' d='M55.61,80.17a25,25,0,1,1,25-25A25,25,0,0,1,55.61,80.17Zm0-41.55A16.55,16.55,0,1,0,72.16,55.17,16.57,16.57,0,0,0,55.61,38.62Z' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M103.77,88.28' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M19.55,7.34' transform='translate(-0.11)'/%3E%3C/svg%3E");
+    
+    --eye-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 111 111'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;%7D.b%7Bstroke:%239b8b84;stroke-miterlimit:10;stroke-width:7px;%7D.c%7Bfill:%239b8b84;%7D%3C/style%3E%3C/defs%3E%3Crect class='a' width='111' height='111'/%3E%3Cpath class='b' d='M103.77,88.28' transform='translate(-0.11)'/%3E%3Cpath class='b' d='M19.55,7.34' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M78.12,66A25,25,0,0,0,44.75,32.66l6.55,6.55A16.49,16.49,0,0,1,71.57,59.48Z' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M109.26,53.88A57.36,57.36,0,0,0,55.61,17.37h0a58.11,58.11,0,0,0-21.89,4.26l5.44,5.44a51.16,51.16,0,0,1,16.45-2.7,50.37,50.37,0,0,1,46.61,30.81A49.46,49.46,0,0,1,87,74.93l5,5a56.18,56.18,0,0,0,17.29-23.47l.48-1.27Z' transform='translate(-0.11)'/%3E%3Cpath class='c' d='M86.21,84l-5.08-5.08h0l-7-7-6-6L44.83,42.64l-6-6L32.22,30h0l-5.16-5.17h0L12.17,10,7.22,14.93,21.07,28.78A57.62,57.62,0,0,0,2,53.88l-.5,1.29L2,56.45A57.36,57.36,0,0,0,55.61,93,57,57,0,0,0,79.79,87.5L97,104.67l5-5L86.2,84ZM62.5,70.21a16.37,16.37,0,0,1-6.89,1.51A16.56,16.56,0,0,1,39.06,55.17a16.3,16.3,0,0,1,1.52-6.88ZM55.61,86A50.39,50.39,0,0,1,9,55.17,50.55,50.55,0,0,1,26.09,33.8l8.26,8.26a24.73,24.73,0,0,0-3.74,13.11A25,25,0,0,0,68.73,76.44l5.76,5.76A49.74,49.74,0,0,1,55.61,86Z' transform='translate(-0.11)'/%3E%3C/svg%3E");
+
+    --inter-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 31.5 31.5'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;%7D.a%7Bstroke:%23d09074;stroke-linecap:round;stroke-linejoin:round;stroke-width:2px;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M404.15,357.31l6-6-6-6' transform='translate(-386.5 -335.5)'/%3E%3Cline class='a' x1='7.75' y1='15.75' x2='22.75' y2='15.75'/%3E%3Ccircle class='a' cx='15.75' cy='15.75' r='14'/%3E%3Crect class='b' width='31.5' height='31.5'/%3E%3C/svg%3E");
+
+    --icon-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 37.47 37.61'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;stroke:%239b8b84;stroke-linecap:round;stroke-width:5px;%7D.b%7Bstroke-linejoin:round;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M4.17,18.91H35.22' transform='translate(-0.25 -0.1)'/%3E%3Cpolyline class='b' points='18.81 35.12 2.5 18.81 18.81 2.5'/%3E%3C/svg%3E");
+
+    --icon-sub-close: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 39.97 37.62'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%239b8b84;stroke-linecap:round;stroke-linejoin:round;stroke-width:5px;%7D%3C/style%3E%3C/defs%3E%3Cpolyline class='a' points='18.81 35.13 2.5 18.82 18.81 2.5'/%3E%3Cpolyline class='a' points='37.47 35.12 21.16 18.81 37.47 2.5'/%3E%3C/svg%3E");
+
+    --icon-link: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36.86 18.94'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%239b8b84;stroke-linecap:round;stroke-width:3px;%7D%3C/style%3E%3C/defs%3E%3Cpath class='a' d='M22.06,10.83H27.7a8,8,0,0,1,8,8h0a8,8,0,0,1-8,8H22.06' transform='translate(-0.3 -9.33)'/%3E%3Cpath class='a' d='M15.41,26.78H9.77a8,8,0,0,1-8-8h0a8,8,0,0,1,8-8h5.64' transform='translate(-0.3 -9.33)'/%3E%3Cline class='a' x1='8.31' y1='9.47' x2='28.56' y2='9.47'/%3E%3C/svg%3E");
+
+    --icon-clear: url("data:image/svg+xml,%0A%3Csvg version='1.1' viewBox='0 0 37.819 37.819' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E.a-clear%7Bfill:none;stroke-linecap:round;stroke-width:5;stroke:%239b8b84%7D%3C/style%3E%3Cg transform='translate(-32.072 -86.124)'%3E%3Cpath class='a-clear' d='m32.34 86.392 37.284 37.284'/%3E%3Cpath class='a-clear' d='m69.624 86.392-37.284 37.284'/%3E%3C/g%3E%3C/svg%3E");
+
+    --icon-clear-wb: url("data:image/svg+xml,%0A%3Csvg version='1.1' viewBox='0 0 37.819 37.819' xmlns='http://www.w3.org/2000/svg'%3E%3Cstyle%3E.a-clear%7Bfill:none;stroke-linecap:round;stroke-width:5;stroke:%23ffffff%7D%3C/style%3E%3Cg transform='translate(-32.072 -86.124)'%3E%3Cpath class='a-clear' d='m32.34 86.392 37.284 37.284'/%3E%3Cpath class='a-clear' d='m69.624 86.392-37.284 37.284'/%3E%3C/g%3E%3C/svg%3E");
+
+    --icon-save: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 769.83 769.83'%3E%3Cdefs%3E%3Cstyle%3E.a%7Bfill:none;stroke:%239b8b84;stroke-miterlimit:10;stroke-width:55px;%7D%3C/style%3E%3C/defs%3E%3Ccircle class='a' cx='384.91' cy='384.91' r='102.48'/%3E%3Cpath class='a' d='M750.91,258.62V687.83a63.08,63.08,0,0,1-63.08,63.08H89.17a63.08,63.08,0,0,1-63.08-63.08h0V89.17A63.08,63.08,0,0,1,89.17,26.09H518.38A98.74,98.74,0,0,1,588.17,55L722,188.83A98.74,98.74,0,0,1,750.91,258.62Z' transform='translate(-3.59 -3.59)'/%3E%3Cpath class='a' d='M464.15,26.09V129.44A46.11,46.11,0,0,1,418,175.55H187.48a46.11,46.11,0,0,1-46.11-46.11V26.09' transform='translate(-3.59 -3.59)'/%3E%3C/svg%3E");
+
+    --icon-trash: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 35 35'%3E%3Cdefs%3E%3Cstyle%3E.a,.b%7Bfill:none;%7D.a%7Bstroke:%239b8b84;stroke-miterlimit:10;stroke-width:1.7px;%7D%3C/style%3E%3C/defs%3E%3Cline class='a' x1='9.63' y1='12.04' x2='25.38' y2='12.04'/%3E%3Cline class='a' x1='15.14' y1='8.75' x2='19.86' y2='8.75'/%3E%3Cpath class='a' d='M23.87,14.77v8.84a2.68,2.68,0,0,1-2.68,2.64H13.82a2.68,2.68,0,0,1-2.64-2.64V14.77'/%3E%3Cline class='a' x1='15.33' y1='15.89' x2='15.33' y2='21.96'/%3E%3Cline class='a' x1='19.69' y1='15.89' x2='19.69' y2='21.96'/%3E%3Crect class='b' width='35' height='35'/%3E%3C/svg%3E");
+
+    --noise: url(../img/noise-light.png);
+}
+/*#endregion Colors Light*/
+
+
+
+*, *::before, *::after {
+    box-sizing: border-box;
+    padding: 0;
+    margin: 0;
+}
+
+@media (max-width: 1024px) {
+    .classic * {
+        -webkit-tap-highlight-color: transparent;
+    }
+}
+
+input, textarea {
+    font-family: var(--sans-serif);
+}
+input[type="date"], input[type="time"]  {
+    font-family: revert;
+}
+
+:active, :hover, :focus {
+    outline: none; /* firefox fix */
+}
+
+html {
+    height: 100%;
+    overflow: hidden; /* disable swipe */
+}
+
+body {
+    display: grid;
+    height: 100%;
+    font-family: var(--sans-serif);
+    font-size: 1.04rem;
+    background-color: var(--bg-3);
+    background-image: var(--noise);
+}
+@media (max-width: 1023px) {
+    body {
+        grid-template-rows: 3rem 1fr;
+        grid-template-areas: 
+            "header" 
+            "main";
+    }
+}
+@media (min-width: 1024px) {
+    body {
+        grid-template-rows: 1.9rem 1fr;
+    }
+    body.login {
+        grid-template-areas:
+            "header"
+            "main";
+    }
+    body.logged {
+        grid-template-columns: 14rem 1fr;
+        grid-template-areas:
+            "aside header"
+            "aside main";
+    }
+}
+
+header {
+    grid-area: header;
+    display: grid;
+    z-index: 777;
+}
+
+@media (max-width: 1023px) {
+    body.logged header {
+        grid-template-columns: 3rem 1fr;
+        gap: 0.3rem;
+    }
+    body.mobile-menu-open header {
+        background-color: var(--bg-3);
+    }
+}
+
+
+@media (max-width: 1023px) {
+    header .burger {
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        position: relative;
+    }
+
+    .menu-icon {
+        width: 1.7rem;
+        height: 0.75rem;
+        position: relative;
+        z-index:7;
+    }
+    .menu-icon span {
+        display: block;
+        position: absolute;
+        left: 0;
+        width: 100%;
+        height: 0.13rem;
+        transform: rotate(0);
+        transition: transform 0.1s ease;
+        background-color: var(--menu-icon-span);
+    }
+    .menu-icon span.line-1 {
+          top: 0;
+    }
+    .menu-icon span.line-2 {
+          bottom: 0;
+    }
+    .mobile-menu-open .menu-icon span.line-1 {
+        top: 5px;
+        transform: rotate(45deg);
+    }
+    .mobile-menu-open .menu-icon span.line-2 {
+        top: 5px;
+        transform: rotate(-45deg);
+    }
+}
+@media (min-width: 1024px) {
+    header .burger {
+        display: none;
+    }
+}
+
+header .menu {
+    display: flex;
+    justify-content: right;
+}
+
+header .menu > * {
+    display: flex;
+    align-items: center;
+    height: 100%;
+    cursor: pointer;
+    text-decoration: none;
+    user-select: none;
+    padding: 0 0.7rem 0 0.7rem;
+    color: var(--link);
+}
+
+@media (max-width: 1023px) {
+    header .menu > *:active {
+        color: var(--header-menu-hover);
+    }
+}
+@media (min-width: 1024px) {
+    header .menu > *:hover {
+        color: var(--header-menu-hover);
+    }
+}
+
+/* Auth. Start */
+.setup-auth {
+    text-align: center;
+    padding: 5px;
+    font-size: 1rem;
+}
+.setup-error {
+    display: flex;
+    align-items: center;
+	text-align: center;
+	padding: 5px;
+	font-size: 0.9rem;
+    min-height: 4rem;
+	color: red;
+}
+
+.aside-main {
+    grid-area: main;
+    display: grid;
+    grid-template-areas: ". center-box .";
+    grid-template-columns: 1fr minmax(auto,19rem) 1fr;
+    overflow-y: auto;
+}
+.center-box {
+    display: grid;
+    grid-template-rows:auto auto auto auto 1fr auto;
+    grid-area: center-box;
+    gap: 1rem;
+}
+
+/* Select */
+.lang-selector {
+    padding: 0.5rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    border-radius: 0.3rem;
+    background-color: var(--bg-4);
+}
+
+.login .lang-select-grid {
+    text-align: left;
+    position: relative;
+    user-select: none;
+    cursor: pointer;
+    -webkit-tap-highlight-color: transparent; /* Del blue click in Chrome Mobile */
+}
+.login .field-select  {
+    display: grid;
+    grid-template-columns: 1fr 26px;
+	background-color: var(--bg-3);
+    border-radius: 0.2rem;
+    line-height: 2;
+    height: 100%;
+}
+.login .field-select .value {
+    line-height: 2;
+    font-size: 0.875rem;
+    color: var(--windows-font);
+    padding: 0 0.54rem;
+}
+.login .field-select .icon {
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: 12px;
+    background-image: var(--select-icon);
+}
+
+
+.login .lang-select-grid .field-options {
+    display: grid;
+    position: absolute;
+    height: 0;
+    overflow: hidden;
+    width: 100%;
+    border-radius: 0.25rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    max-height: 17rem;
+    z-index: 777;
+}
+.login .lang-select-grid .field-options.open {
+    background-color: var(--bg-3);
+    border: 2px solid var(--bg-4);
+    color: var(--text);
+    overflow: auto;
+    height: auto;
+}
+.login .lang-select-grid .field-options .option {
+    padding: 0.4rem 0.44rem;
+    cursor: pointer;
+    font-size: 0.9rem;
+}
+.login .lang-select-grid .field-options .option:hover {
+    background-color: var(--bg-2);
+}
+
+
+.setup-auth {
+    display: flex;
+    justify-content: center;
+    font-size: 0.9rem;
+    color: var(--setup-auth);
+}
+
+.login-and-password {
+    display: grid;
+    gap: 2px;
+    padding: 10px 10px 10px 10px;
+    background-color: var(--bg-4);
+    box-shadow: 0 2px 3px 0 #00000033;
+    border-radius: 0.25rem;
+}
+.login-and-password .login {
+    position: relative;
+}
+.login-and-password .password {
+    display: grid;
+    grid-template-columns:  1fr auto auto;
+    gap: 5px;
+    position: relative;
+}
+.login-and-password .login input, .login-and-password .password input {
+    width: 100%;
+    background-color: var(--bg-3);
+    border: none;
+    font-size: 1rem;
+    color: var(--windows-font);
+    font-family: var(--monospace);
+    line-height: 2;
+    min-height: 34px;
+    position: relative;
+}
+
+.login-and-password .login input { 
+    height: 34px;
+    border-radius: 0.25rem 0.25rem 0 0;
+    padding: 0 8px 0 8px;
+}
+.login-and-password .password input {
+    grid-row: 1/2;
+    grid-column: 1/-1;
+    height: 34px;
+    padding: 0 85px 0 8px;
+    border-radius: 0 0 0.25rem 0.25rem;
+}
+.login-and-password .login input:autofill, .login-and-password .password input:autofill {
+    background-image: none;
+}
+
+
+.login-and-password .password-eye {
+    grid-row: 1/2;
+    grid-column: 2/3;
+    height: 33px; 
+    width: 33px;
+    cursor: pointer;
+    background-size: 20px;
+    background-position: center;
+    background-repeat: no-repeat;
+    background-image: var(--eye-off);
+    z-index: 1;
+}
+.login-and-password .password-eye.showed {
+    background-image: var(--eye-on);
+}
+
+.login-and-password .password button {
+    grid-row: 1/2;
+    grid-column: 3/4;
+    cursor: pointer;
+    height: 33px; 
+    width: 33px;
+    min-height: unset;
+    z-index: 7;
+    border: transparent;
+    background-color: transparent;
+    background-size: 22px;
+    background-position: center center;
+    background-repeat: no-repeat;
+    background-image: var(--inter-icon);
+}
+
+.support-box {
+    display: flex;
+    justify-content: center;
+    padding-bottom: 2rem;
+}
+.support-box a {
+    font-size: 0.9rem;
+    padding: 0.2rem 0.8rem 0.3rem 0.8rem;
+    color: var(--windows-font);
+    text-decoration: none;
+}
+/* Auth. End */
+
+aside {
+    overflow-y: auto;
+    scrollbar-width: none; /* FireFox */
+}
+@media (max-width: 1023px) {
+    aside {
+        position: fixed;
+        width: 14rem;
+        min-height: 100%;
+        left: 0;
+        top: 0;
+        bottom: 0;
+        transform: translate3d(-270px, 0, 0);
+        transition: transform 0.25s ease;
+        z-index: 700;
+        padding: 3rem 0 3rem 0;
+        background-color: var(--bg-3);
+        background-image: var(--noise);
+    }
+
+    .mobile-menu-open aside {
+        transform: translate3d(0, 0, 0);
+    }
+}
+@media (min-width: 1024px) {
+    aside {
+        grid-area: aside;
+        padding: 1.9rem 0 1.9rem 0;
+    }
+}
+
+aside::-webkit-scrollbar {
+    width: 0;
+}
+
+
+aside section {
+    padding:9px 0 10px 0;
+}
+aside section div {
+    padding: 5px 5px 5px 20px;
+    font-size: 0.94rem;
+    color: var(--aside-section-div);
+}
+aside section a {
+    padding: 5px 5px 5px 36px;
+    text-decoration: none;
+    display: block; 
+    font-size: 0.94rem;
+    color: var(--aside-section-a);
+}
+@media (min-width: 1024px) {
+    aside section a {
+        border-radius: 0 0.3rem 0.3rem 0;
+    }
+}
+aside section a:hover {
+    background-color: var(--aside-section-a-hover);
+}
+aside section a.active {
+    background-color: var(--aside-section-a-active);
+}
+aside section a.red {
+    background-color: var(--aside-section-a-red);
+    
+}
+
+main {
+    grid-area: main;
+    overflow: hidden;
+}
+
+body > main > section:not(:target) {
+    display: none !important;
+}
+
+/* Start Secion */
+#start {
+    overflow-y: auto;
+    max-height: 100%;
+}
+@media (max-width: 1023px) {
+    #start {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+    }
+}
+@media (min-width: 1024px) {
+    #start {
+        padding: 1rem;
+    }
+}
+#start > div {
+    display: grid;
+    gap: 1rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+}
+@media (max-width: 1023px) {
+    #start > div {
+        padding: 1rem 0.7rem 1.4rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #start > div {
+        padding: 1rem;
+    }
+}
+#start div > div {
+    color: var(--windows-font);
+}
+#start div > p {
+    color: var(--text);
+}
+#start div > p a {
+    color: var(--link);
+}
+/* End */
+
+/* Auth Start */
+#auth {
+    display: grid;
+	height: 100%;
+    overflow-y: auto;
+    row-gap: 1rem;
+    grid-auto-rows: max-content;
+}
+@media (max-width: 1023px) {
+    #auth {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+    }
+}
+@media (min-width: 1024px) {
+    #auth {
+        padding: 1rem;
+    }
+}
+#auth form {
+    display: grid;
+    background-color: var(--windows);
+    background-image: var(--noise);
+    border-radius: 0.3rem;
+    box-shadow: var(--shadows);
+}
+@media (max-width: 1370px) {
+    #auth form {
+        row-gap: 10px;
+        padding: 1rem 0.7rem 1.4rem 0.7rem;
+    }
+}
+@media (min-width: 1371px) {
+    #auth form {
+        grid-auto-columns: max-content;
+        grid-auto-flow: column;
+        grid-column-gap: 1rem;
+        justify-content: center;
+        padding: 1rem;
+    }    
+}
+
+#auth form > div {
+    position: relative;
+}
+#auth form .password-widget {
+    display: grid;
+    grid-template-columns: 1fr auto;
+    gap: 5px;
+}
+
+#auth form input {
+    border-radius: 4px;
+    font-size: 0.875rem;
+    font-family: var(--monospace);
+    padding: 0 0.54rem;
+    min-height: 35px;
+    width: 100%;
+    color: var(--input-font);
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+}
+html:not(.classic) #auth form input[name="admin_password"] {
+    padding-right: 2.2rem;
+    grid-column: 1 / -1;
+    grid-row: 1 / 2;
+  }
+
+#auth input[type="submit"] {
+    cursor: pointer;
+}
+
+
+#auth form .admin-url, #auth form .login-title, #auth form .passwd-title { 
+    color: var(--windows-font);
+}
+@media (min-width: 1024px) {
+    #auth form .admin-url, #auth form .login-title, #auth form .passwd-title { 
+        display: grid;
+        align-items: center;
+        padding-bottom: 3px;
+    }
+}
+
+#auth form .password-eye {
+    grid-column: 2 / 3;
+    grid-row: 1 / 2;
+    width: 34px;
+    height: 34px;
+    cursor: pointer;
+    background-size: 20px;
+    background-position: center;
+    background-repeat: no-repeat;
+    background-image: var(--eye-off);
+}
+#auth form .password-eye.showed {
+    background-image: var(--eye-on);
+}
+@media (max-width: 1023px) {
+    .current-sess {
+        padding: 1rem 0 1rem 0;
+    }
+    .history-sess {
+        padding: 1rem 0 1rem 0;
+    }
+}
+#auth .table-title {
+    padding: 0 0.5rem 0.5rem 0.7rem;
+    color: var(--windows-font);
+}
+.sess-table {
+    display: grid;
+    gap: 5px;
+}
+.sess-table > div {
+    color: var(--sess-table-font);
+    background-color: var(--windows);
+    background-image: var(--noise);
+    border-radius: 0.3rem;
+}
+@media (max-width: 1023px) {
+    .sess-table > div {
+        display: block;
+        padding: 0.4rem 0.3125rem 0.5rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    .sess-table > div {
+        display: grid;
+        grid-auto-flow: column;
+        column-gap: 3px;
+        grid-template-columns: 2rem 10rem 8rem auto;
+        padding: 0.3125rem;
+    }
+}
+.sess-table .current {
+    color: var(--sess-table-current);
+}
+#auth .del-sess {
+    width: 1.6rem;
+    height: 1.6rem;
+    justify-self: center;
+    cursor: pointer;
+    border-radius: 4px;
+    float: right;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 44%;
+    background-image: var(--icon-clear);
+}
+#auth .del-sess:hover {
+    background-color: var(--auth-del-sess-hover);
+}
+.sess-table > div > div {
+    padding: 2px; 
+    font-size: 0.875rem;
+}
+/* End */
+
+/* PHP Info Start */
+#phpinfo {color: var(--phpinfo-font); font-family: var(--sans-serif); overflow-y: scroll; height: 100%; padding: 1rem;}
+@media (max-width: 1023px) {
+    #phpinfo {padding: 0 0.4rem 0.4rem 0.4rem;}
+    #phpinfo .e {word-break: break-word; min-width: 100px; max-width: 33%;}
+    #phpinfo .h {word-break: break-word;}
+    #phpinfo .v {word-break: break-word;}
+}
+@media (min-width: 1024px) {
+    #phpinfo .e {min-width: 200px;width: 33%;}
+    #phpinfo .v {word-break: break-word;}
+}
+#phpinfo td a img { display: none; }
+#phpinfo pre {margin: 0; font-family: monospace;}
+#phpinfo table {border-collapse: collapse; border: 0; width: 100%;}
+#phpinfo .center {text-align: center;}
+@media (min-width: 1024px) {#phpinfo .center table:first-child {margin-top: 0;}}
+#phpinfo .center table {margin: 1rem auto; text-align: left;}
+#phpinfo td, th {border: 1px solid var(--bg-4); font-size: 75%; vertical-align: baseline; padding: 4px 5px;}
+#phpinfo th {position: sticky; top: 0; background-color: inherit;}
+#phpinfo h1 {font-size: 150%;}
+#phpinfo h2 {font-size: 125%;}
+#phpinfo .p {text-align: left; margin: 0;}
+#phpinfo .e {background-color: var(--bg-3); font-weight: bold; }
+#phpinfo .h {background-color: var(--phpinfo-h-bg); font-weight: bold; }
+#phpinfo .v {background-color: var(--bg-3); overflow-x: auto; }
+#phpinfo .v i {color: var(--phpinfo-v-i-font);}
+#phpinfo img {float: right; border: 0;}
+#phpinfo hr {width: 100%; background-color: var(--phpinfo-hr-bg); border: 0; height: 1px;}
+#phpinfo th { border-color: transparent;}
+#phpinfo tr:hover td {background-color: var(--bg-2);}
+/* End */
+
+
+/* Modules */
+#modules {
+    display: grid;
+    height: 100%;
+    overflow-y: auto;
+    grid-auto-rows: max-content;
+    row-gap: 1rem;
+}
+
+@media (max-width: 1023px) {
+    #modules {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+        display: flex; /*Samsung Browser - padding-bottom*/
+        flex-direction: column; /*Samsung Browser - padding-bottom*/
+    }
+    
+}
+@media (min-width: 1024px) {
+    #modules {
+        padding: 1rem;
+    }
+}
+
+#modules > div {
+    display: grid;
+    row-gap: 0.5rem;
+}
+
+#modules .upload_dnd {
+    height: 40px;
+    position: relative;
+    margin-top: 0.5rem;
+    padding: 9px 11px 5px 11px;
+    border-radius: 0.3rem;
+	color: var(--windows-font);
+	background-color: var(--bg-4);
+    white-space: nowrap;
+    width: max-content;
+    font-size: 0.9rem;
+    user-select: none;
+}
+#modules .upload_dnd #module-upload {
+	width: 100%;
+	height: 100%;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+	opacity: 0;
+	overflow: hidden;
+	position: absolute;
+	z-index: 7;
+    cursor: pointer;
+}
+
+label[for=module-upload] {
+    display: block;
+	white-space: nowrap;
+    width: max-content;
+    font-size: 0.9rem;
+    user-select: none;
+}
+
+input[type="file" i]::-webkit-file-upload-button {
+    cursor: pointer;
+}
+
+#modules .modules-grid > div {
+    display: grid;
+    grid-template-areas:
+        "module-name module-version"
+        "module-description module-description"
+        "module-sw-btn module-del-btn";
+    grid-template-columns: 1fr auto;
+    overflow: hidden;
+    border-radius: 0.3rem;
+    padding: 0.7rem;
+    column-gap: 0.7rem;
+    box-shadow: var(--shadows);
+    row-gap: 0.1rem;
+    background-image: var(--noise);
+}
+
+#modules .modules-grid > div.enabled  {
+    background-color: var(--windows);
+}
+@media (min-width: 1024px) {
+    #modules .modules-grid > div.enabled:hover {
+        background-color: var(--windows-hover);
+    }
+}
+
+#modules .modules-grid > div.disabled {
+    background-color: var(--modules-grid-div-disabled);
+}
+@media (min-width: 1024px) {
+    #modules .modules-grid > div.disabled:hover {
+        background-color: var(--modules-grid-div-disabled-hover);
+    }
+}
+
+#modules .module-name {
+    grid-area: module-name;
+    margin-top: -5px;
+    font-size: 1rem;
+    font-weight: 600;
+}
+#modules .enabled .module-name {
+    color: var(--windows-font);
+}
+#modules .disabled .module-name {
+    color: var(--disabled-module);
+}
+
+#modules .module-version {
+    grid-area: module-version;
+    margin-top: -5px;
+    font-size: 1rem;
+    color: var(--text);
+}
+#modules .module-description {
+    grid-area: module-description;
+    font-size: 0.9rem;
+}
+#modules .enabled .module-description {
+    color: var(--enabled-module-description);
+}
+#modules .enabled .module-description a {
+    color: var(--link);
+    text-decoration: none;
+}
+#modules .disabled .module-description {
+    color: var(--disabled-module);
+}
+
+#modules .module-del-btn {
+    grid-area: module-del-btn;
+    font-size: 0.9rem;
+    color: var(--link);
+    cursor: pointer;
+    text-align: right;
+    user-select: none;
+}
+
+#modules .module-sw-btn {
+    grid-area: module-sw-btn;
+    width: max-content;
+    font-size: 0.9rem;
+    user-select: none;
+    cursor: pointer;
+}
+#modules .enabled .module-sw-btn {
+    color: var(--link);
+}
+#modules .disabled .module-sw-btn {
+    color: var(--disabled-module-sw-btn);
+}
+/* End */
+
+
+
+/* Admin Menu */
+#admin_menu {
+    display: grid;
+    height: 100%;
+    overflow-y: auto;
+    grid-auto-rows: max-content;
+}
+
+#admin_menu .main-main {
+    display: grid;
+    gap: 1rem;
+}
+@media (max-width: 1023px) {
+    #admin_menu .main-main {
+        padding: 1rem 0.7rem 0.3rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #admin_menu .main-main {
+        padding: 1rem 1rem 0.3rem 1rem;
+    }
+}
+
+
+@media (max-width: 1023px) {
+    #admin_menu .main-footer {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #admin_menu .main-footer {
+        padding: 1rem;
+    }
+}
+
+
+
+#admin_menu [data-am-type="section"] {
+    display: grid;
+    grid-template-areas:
+        "title   sort"
+        "buttons buttons";
+    grid-template-columns: 1fr auto;
+    column-gap: 1rem;
+    row-gap: 0.7rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+    border-radius: 0.3rem;
+    position: relative;
+    min-height: 4rem;
+    overflow: hidden;
+    padding: 0.7rem;
+}
+
+#admin_menu [data-am-type="section"].hidden::before {
+    content: "";
+    position: absolute;
+    right: 2px;
+    bottom: 2px;
+    z-index: 1;
+    width: 7px;
+    height: 7px;
+    border-radius: 50%;
+    background-color: var(--orange);
+}
+
+#admin_menu .items-grid {
+    display: grid;
+    row-gap: 0.3rem;
+    padding: 0.8rem 0 0.5rem 0.5rem;
+    margin-top: -5px;
+    background-color: var(--windows);
+    border-radius: 0 0 0.3rem 0.3rem;
+}
+
+#admin_menu [data-am-type="section"] input[name=title] {
+    grid-area: title;
+    width: 100%;
+    background-color: var(--menu-input-bg);
+	border: 2px solid var(--menu-input-border);
+}
+
+#admin_menu [data-am-type="section"] input[name=sort] {
+    grid-area: sort;
+    width: 4rem;
+    justify-self: right;
+    text-align: center;
+    background-color: var(--menu-input-bg);
+	border: 2px solid var(--menu-input-border);
+}
+#admin_menu input {
+    border-radius: 4px;
+    min-height: 30px;
+    height: 100%;
+    background-color: var(--bg-4);
+    border: 1px solid var(--bg-4);
+    color: var(--text);
+}
+#admin_menu input {
+    padding: 0 0.54rem;
+    font-size: 0.94rem;
+}
+
+
+#admin_menu .section-select-grid {
+    grid-area: select;
+    position: relative;
+}
+#admin_menu .field-select {
+    display: grid;
+	grid-template-columns: 1fr 28px;
+	height: 100%;
+	min-height: 30px;
+	cursor: pointer;
+	background-color: var(--bg-4);
+	border: 1px solid var(--bg-4);
+	border-radius: 4px;
+    user-select: none;
+}
+#admin_menu .field-select > .value {
+	padding: 0 0.1rem 0 0.54rem;
+    white-space: nowrap;
+    overflow: hidden;
+	line-height: 26px;
+    font-size: 0.9rem;
+	color: var(--text);
+}
+#admin_menu .field-select > .icon {
+    background-image: var(--select-icon);
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: 12px;
+}
+
+#admin_menu .field-options {
+    display: grid;
+    position: absolute;
+    height: 0;
+    overflow: hidden;
+    width: 100%;
+    border-radius: 0.25rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    max-height: 17rem;
+    z-index: 777;
+}
+#admin_menu .field-options.open {
+    background-color: var(--bg-3);
+    border: 2px solid var(--bg-4);
+    color: var(--text);
+    overflow: auto;
+    height: auto;
+    min-width: max-content;
+    margin-top: 2px;
+}
+#admin_menu .field-options .option {
+    padding: 0.4rem 0.44rem;
+    cursor: pointer;
+    font-size: 0.9rem;
+}
+#admin_menu .field-options .option:hover {
+    background-color: var(--bg-2);
+}
+
+
+
+
+
+#admin_menu .am-grid {
+    display: grid;
+    row-gap: 1rem;
+}
+
+#admin_menu .am-grid > div {
+    box-shadow: 0 0 3px 0 #00000096;
+    border-radius: 0.3rem;
+}
+
+#admin_menu .main-footer {
+	grid-auto-flow: column;
+	display: grid;
+	justify-content: start;
+	grid-column-gap: 1rem;
+}
+
+#admin_menu .add-section, #admin_menu .reset-all {
+    display: block;
+    width: max-content;
+    padding: 0.4rem 0.7rem 0.5rem 0.7rem;
+    background-color: var(--bg-4);
+    text-decoration: none;
+    font-size: 0.9rem;
+    color: var(--windows-font);
+    border-radius: 0.3rem;
+    user-select: none;
+    cursor: pointer;
+}
+
+
+#admin_menu [data-am-type="item"] {
+    display: grid;
+    grid-template-areas:
+        "item-name select  sort"
+        "buttons   buttons buttons";
+    grid-template-columns: 1fr  auto auto;
+    column-gap: 1rem;
+    row-gap: 0.7rem;
+    background-color: var(--bg-3);
+    background-image: var(--noise);
+    border-radius: 0.3rem 0 0  0.3rem;
+    position: relative;
+    min-height: 4rem;
+    padding: 0.7rem;
+}
+#admin_menu [data-am-type="item"]:hover {
+    background-color: var(--open-menu);
+}
+#admin_menu [data-am-type="item"].hidden::before {
+    content: "";
+    position: absolute;
+    right: 2px;
+    bottom: 2px;
+    z-index: 1;
+    width: 7px;
+    height: 7px;
+    border-radius: 50%;
+    background-color: var(--orange);
+}
+
+#admin_menu .item-name {
+    grid-area: item-name;
+    font-size: 1rem;
+    align-self: center;
+    margin-top: -5px;
+    color: var(--aside-section-a);
+    white-space: pre;
+    overflow: hidden;
+    text-overflow: ellipsis;
+}
+#admin_menu [data-am-type="item"].hidden .item-name {
+    opacity: 0.3;
+    user-select: none;
+}
+
+#admin_menu select {
+    grid-area: select;
+}
+#admin_menu [data-am-type] .buttons {
+    grid-area: buttons;
+    display: grid;
+    grid-template-columns: auto auto auto;
+    justify-content: right;
+    column-gap: 1rem;
+    font-size: 0.9rem;
+}
+#admin_menu [data-am-type] .buttons > a  {
+    cursor: pointer;
+    color: var(--buttons-font);
+    user-select: none;
+}
+#admin_menu [data-am-type] .buttons > a:hover  {
+    color: var(--buttons-hover);
+}
+
+#admin_menu input[name="sort"] {
+    width: 4rem;
+    text-align: center;
+}
+/* End */
+
+
+
+@media (max-width: 1023px) {
+    .mobile-menu-open .milk {
+        display: block;
+        position: fixed;
+        left: 0;
+        right: 0;
+        top: 0;
+        bottom: 0;
+        opacity: 0.7;
+        z-index: 10;
+        background-color: var(--mobile-menu-open-milk);
+    }
+}
+
+/* Service Messages */
+.log-info-box {
+    position: fixed;
+    z-index: 770;
+    display: inline-grid;
+}
+@media (max-width: 1023px) {
+    .log-info-box {
+        top: 3rem;
+        right: 0.3rem;
+    }
+}
+@media (min-width: 1024px) {
+    .log-info-box {
+        top: 2.5rem;
+        right: 0.3rem;
+    }
+}
+
+.log-info-box > div {
+    padding: 15px;
+    font-size: 0.875rem;
+    margin-bottom: 10px;
+    border-radius: 5px;
+    justify-self: right;
+}
+
+.info-success {
+    background-color: var(--info-success);
+    color: var(--info-fonts-success);
+    box-shadow: 0 2px 3px 0 rgba(0,0,0,0.2);
+}
+.info-success a {
+    color: var(--info-fonts-success);
+}
+
+.info-error {
+    background-color: var(--info-error);
+    color: var(--info-fonts-error);
+    box-shadow: 0 2px 3px 0 #00000033;
+}
+.info-error a {
+    color: var(--info-fonts-error);
+}
+.log-info-box > .timeout {
+    overflow: hidden;
+    height: 0 !important;
+    transition: height 0.5s, opacity 0.2s, padding 0.5s, margin 0.5s;
+    opacity: 0;
+    padding-top: 0;
+    padding-bottom: 0;
+    margin-bottom: 0;
+}
+
+
+/* Checks */
+input[type="checkbox"] {
+    width: 1.4rem;
+    height: 1.4rem;
+    border-radius: 0.25rem;
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: contain;
+    appearance: none;
+    border: 2px solid;
+    background-color: var(--bg-3);
+    border-color: var(--bg-4);
+    cursor: pointer;
+}
+input[type="checkbox"]:checked {
+    background-color: var(--orange);
+    border-color: var(--orange);
+    box-shadow: 0 0 0 0.25rem var(--focus-orange);
+    background-image: var(--check-icon);
+}
+
+@-moz-document url-prefix()
+{
+    .enable-cache {
+        transform: translateY(-1px);
+    }
+}
+
+/* Buttons */
+button {
+    display: flex;
+    justify-content: center;
+    min-height: 35px;
+    padding: 5px 12px 0 12px;
+    border-radius: 0.25rem;
+    background-color: var(--button-bg);
+    border: 1px solid var(--button-border);
+    color: var(--windows-font);
+    font-family: var(--sans-serif);
+    font-size: 1rem;
+    user-select: none;
+    cursor: pointer;
+}
+
+.CodeMirror-dialog button {
+    display: grid;
+    min-height: auto;
+    margin: 4px 0;
+    padding: 2px 10px 3px 10px;
+}
+.CodeMirror-search-label {
+    align-self: center;
+}
+.CodeMirror-dialog-top {
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: left;
+    gap: 7px;
+}
+.CodeMirror-dialog button {
+    display: grid;
+    background-color: var(--bg-3);
+}
+
+
+.CodeMirror-dialog button:active {
+    margin: 4px 0;
+    padding: 2px 10px 2px 10px;
+}
+.classic .CodeMirror-dialog button {
+    height: 24px;
+    padding: 2px 10px 0 10px;
+    margin: 2px 0;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #4c4949;
+    border-left: 1px solid #4c4949;
+    outline: 1px solid #131313;
+    outline-offset: 0px;
+}
+.classic .CodeMirror-dialog button:active {
+    height: 24px;
+    padding: 4px 10px 0 10px;
+    margin: 2px 0;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+}
+
+
+/* Menu */
+.classic aside section a {
+    padding: 3px 5px 3px 36px;
+    border-color: transparent;
+    border-style: solid;
+    border-left-width: 0;
+    border-right-width: 2px;
+    border-top-width: 2px;
+    border-bottom-width: 2px;
+    border-radius: 0;
+}
+.classic aside section a:hover {
+    border-color: #393737;
+}
+.classic section a.active {
+    border-color: #393737;
+    background-color: var(--bg-2);
+}
+.classic section a.red {
+    border-color: red;
+}
+.classic section a.red:hover {
+    border-color: red;
+}
+
+/* Messages Info */
+.classic .log-info-box > div {
+    border-width: 2px;
+    border-color: #999999;
+    border-style: solid;
+    border-radius: 0;
+}
+.classic .log-info-box .timeout {
+    border-width: 0;
+}
+.classic .info-success {
+    background-color: #292827ed;
+    color: #ffffff;
+    box-shadow: 4px 5px 0px 0 #00000077;
+}
+.classic .info-error {
+    box-shadow: 4px 5px 0px 0 #00000077;
+}
+
+/* Update */
+#modules .dev-window.developers_only {
+    display: none;
+}
+#modules > div {
+    background-image: var(--noise);
+}
+
+
+#modules .update-window {
+    display: grid;
+    grid-auto-rows: max-content;
+    row-gap: 0.7rem;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+}
+#modules .update-window div p {
+    font-size: 1rem;
+    color: var(--text);
+}
+#modules .update-window div p:last-child {
+    margin-bottom: 0.5rem;
+}
+#modules .update-window > div:first-child, #modules .dev-window > div:first-child {
+    color: var(--windows-font);
+    font-size: 1rem;
+    font-weight: 600;
+}
+@media (max-width: 1023px) {
+    #modules .update-window {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #modules .update-window {
+        padding: 1rem;
+    }
+}
+
+#modules .dev-window {
+    display: grid;
+    grid-auto-rows: max-content;
+    row-gap: 1rem;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+}
+#modules > .dev-window > div {
+    color: var(--windows-font);
+}
+#modules .dev-window p {
+    font-size: 1rem;
+    color: var(--text);
+}
+#modules .dev-window p a {
+    color: var(--link);
+}
+
+@media (max-width: 1023px) {
+    #modules .dev-window {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #modules .dev-window {
+        padding: 1rem;
+    }
+}
+
+
+#modules .update-window .buttons, #modules .dev-window .buttons {
+    gap: 1rem;
+}
+#modules .update-window .buttons a {
+    width: fit-content;    /* для моб */
+    justify-self: center;  /* для моб */
+    color: var(--link);
+    text-decoration: none;
+    font-size: 0.9rem;
+}
+@media (max-width: 767px) {
+    #modules .update-window .buttons, #modules .dev-window .buttons {
+        display: grid;
+    }
+}
+@media (min-width: 768px) {
+    #modules .dev-window .buttons {
+        display: flex;
+        justify-content: start;
+    }
+    #modules .update-window .buttons {
+        display: grid;
+        grid-template-columns: auto auto 1fr [book] auto [dev] auto;
+    }
+    #modules .update-window .buttons a {
+        grid-column-start: book;
+        align-self: center;
+    }
+    #modules .update-window .buttons [data-show-dev] {
+        grid-column-start: dev;
+    }
+    /*#modules .update-window .buttons > button {
+        justify-self: right;
+    }*/
+}
+
+
+#modules .update-window > div, #modules .dev-window > div {
+    display: grid;
+    row-gap: 0.5rem;
+}
+
+#modules .changed-files {
+    display: grid;
+    grid-auto-rows: max-content;
+    row-gap: 1rem;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    color: var(--template-files-file);
+    font-size: 13px;
+    font-family: var(--monospace);
+    padding: 10px;
+}
+
+
+
+.classic #start > div {
+    border-radius: 0;
+    border: 2px solid #393737;
+}
+
+
+/*#region Page Classic*/
+
+.classic .lang-selector,
+.classic .login .field-select,
+.classic .login .lang-select-grid .field-options,
+.classic .login-and-password,
+.classic .login-and-password .login input,
+.classic .login-and-password .password input,
+.classic .login-and-password .password button {
+    border-radius: 0;
+}
+.classic .login-and-password {
+    gap: 7px;
+}
+
+.classic .login .field-select,
+.classic .login-and-password .login input,
+.classic .login-and-password .password input {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #181616;
+}
+
+.classic .login-and-password .password input {
+    grid-column: 1 / 2;
+}
+
+.classic .login-and-password .password-eye {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+}
+.classic .login-and-password .password-eye:active {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #312e2d;
+    background-size: 19px;
+}
+.classic .login-and-password .password-eye.showed {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #312e2d;
+    background-size: 19px;
+}
+.classic .login-and-password .password button {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+}
+.classic .login-and-password .password button:active {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #312e2d;
+    background-size: 21px;
+}
+
+.classic .login .lang-select-grid .field-options.open {
+    border: 2px solid #5b5756;
+    box-shadow: 0 2px 3px 0 #000000cc;
+}
+
+
+@media (min-width: 1025px) {
+    .classic #pages .pages-grid {
+        row-gap: 3px;
+    }
+}
+.classic #pages .pages-grid > div {
+    border-radius: 0;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    row-gap: 1px;
+}
+.classic #pages .pages-grid a.page-name {
+    margin-bottom: 3px;
+}
+.classic #pages .page-buttons {
+    column-gap: 0.3rem;
+}
+
+.dark.classic #pages .page-date {
+    border-bottom: 1px solid #413e3e;
+    border-right: 1px solid #413e3e;
+    border-top: 1px solid #111;
+    border-left: 1px solid #111;
+    background-color: #292727;
+}
+.dark.classic #pages input[type="checkbox"] {
+    border-radius: 0;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #111111;
+    border-left: 2px solid #111111;
+}
+.classic #pages input[type="checkbox"]:checked {
+    background-color: var(--orange);
+    border-bottom: 2px solid #bd3900;
+    border-right: 2px solid #bd3900;
+    border-top: 2px solid #762300;
+    border-left: 2px solid #762300;
+    box-shadow: 0 0 3px 0.5rem var(--focus-orange);
+}
+
+.classic #pages .page-search {
+    border-radius: 0;
+    border-bottom: 2px solid #292727;
+    border-right: 2px solid #292727;
+    border-top: 2px solid #111111;
+    border-left: 2px solid #111111;
+}
+
+.classic #pages .page-prop input, .classic .page-prop textarea, .classic #pages .page-properties input, .classic #pages .page-properties textarea {
+    border-radius: 0;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+.classic #pages .page-prop .field-select, .classic #pages .page-properties .field-select {
+    border-radius: 0;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+
+.classic .login .field-select .icon,
+.classic #pages .page-prop .field-select > .icon, 
+.classic #pages .page-properties .field-select > .icon {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+    background-color: #383433;
+    margin: 1px;
+}
+
+.classic .login .field-select:active > .icon,
+.classic #pages .page-prop .field-select:active > .icon, 
+.classic #pages .page-properties .field-select:active > .icon {
+    border-radius: 0;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic .login .lang-select-grid.open .field-select > .icon,
+.classic #pages .page-prop .template-select-grid.open .field-select > .icon, 
+.classic #pages .page-properties .template-select-grid.open .field-select > .icon {
+    border-radius: 0;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+
+
+
+
+.classic #pages .page-prop .field-select, .classic #pages .page-properties .field-select {
+    grid-template-columns: 1fr 26px;
+}
+.classic #pages .page-prop .template-select-grid .field-options.open, .classic #pages .page-properties .template-select-grid .field-options.open {
+    border-radius: 0;
+    margin-left: 1px;
+    width: calc(100% - 1px);
+    border: 2px solid #5b5756;
+    box-shadow: 0 2px 3px 0 #000000cc;
+}
+
+.classic #pages .page-buttons .page-edit-btn {
+    margin-left: -5px;
+}
+.classic #pages .pages-grid > div.open {
+    background-color: #282525;
+}
+
+.classic #pages .page-buttons div {
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    padding: 0px 5px 2px 5px;
+    outline: 1px solid #1b1a1a;
+    outline-offset: 0px;
+}
+@media (max-width: 320px) {
+    .classic #pages .page-buttons div {
+        height: 20px;
+    }
+}
+.classic #pages .pages-grid > div.open .page-prop-btn {
+    padding-top: 1px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+}
+.classic #pages .page-buttons div:active {
+    padding-top: 1px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+}
+
+.classic  #pages .page-prop .title, .classic  #pages .page-properties .title {
+    user-select: none;
+}
+
+.classic .page-prop .url-input, .classic .page-properties .url-input {
+    gap: 5px;
+}
+.classic .page-prop .url-input > input, .classic #pages .page-properties .url-input > input {
+    grid-column: 1 / 2;
+    padding-right: 0;
+}
+.classic .page-prop .url-input .url-translit, .classic #pages .page-properties .url-input .url-translit {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    background-size: 22px;
+    outline-offset: 0px;
+}
+.classic .page-prop .url-input .url-translit {
+    outline: 1px solid #1b1a1a;
+}
+.classic #pages .page-properties .url-input .url-translit {
+    outline: 1px solid #131313;
+}
+
+.classic .page-prop .url-input .url-translit:active, .classic #pages .page-properties .url-input .url-translit:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #1e1d1d;
+    background-size: 21px;
+}
+
+.classic #pages .counters input {
+    border-radius: 0;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #111111;
+    border-left: 2px solid #111111;
+}
+
+
+
+.classic #pages .page-editor {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    margin: 0 5px 0 5px;
+}
+.classic #pages .page-editor-grid > .tags {
+    background-color: #1e1d1d;
+    margin: 2px 5px 0 0;
+}
+.classic #pages .tags-grid > div {
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    background-color:  #292727;
+    user-select: none;
+}
+.classic #pages .tags-grid > div:active {
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 1px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color:  #292727;
+}
+.classic #pages .tags-grid {
+    padding: 0;
+    gap: 2px;
+}
+
+
+
+.classic #pages .search-wrapper {
+    gap: 7px;
+}
+.classic #pages .page-search {
+    grid-column: 1 / 3;
+}
+
+
+.classic #pages .reset {
+    border-radius: 0;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+.classic #pages .reset:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #pages .reset:hover {
+    background-color: transparent;
+}
+
+.classic #pages .page-search-button {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    border-radius: 0;
+}
+.classic #pages .page-search-button:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+
+
+.classic #pages .add-page-btn {
+    width: 35px;
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    border-radius: 0;
+}
+.classic #pages .add-page-btn:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+.classic #pages .add-page-btn:active .x1 {
+    height: 14px;
+}
+.classic #pages .add-page-btn:active .x2 {
+    width: 14px;
+}
+.classic #pages .add-page-btn:hover {
+    background-color: unset;
+}
+
+@media (max-width: 1023px) {
+    .classic #pages .add-page-btn .add-page-label {
+        display: none;
+    }
+}
+@media (min-width: 1024px) {
+    .classic #pages .add-page-btn {
+        width: auto;
+        border: 0;
+        border-radius: 0;
+    }
+    .classic #pages .add-page-btn:active {
+        border: 0;
+    }
+    .classic #pages .add-page-btn:hover {
+        border: 0;
+    }
+    .classic #pages .add-page-btn .add-page-label {
+        padding: 4px 10px 4px 10px;
+        border-radius: 0;
+        border-bottom: 2px solid #0c0c0c;
+        border-right: 2px solid #0c0c0c;
+        border-top: 2px solid #393737;
+        border-left: 2px solid #393737;
+    }
+    .classic #pages .add-page-btn .add-page-label:active {
+        padding-top: 5px;
+        border-bottom: 2px solid #393737;
+        border-right: 2px solid #393737;
+        border-top: 2px solid #0c0c0c;
+        border-left: 2px solid #0c0c0c;
+    }
+    .classic #pages .add-page-btn .add-page-label:hover {
+        background-color: unset;
+    }
+    .classic #pages .add-page-btn .x1, .classic #pages .add-page-btn .x2 {
+        display: none;
+    }
+}
+
+
+.classic #pages .del-pages-btn {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    border-radius: 0;
+}
+
+.classic #pages .del-pages-btn:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #pages .del-pages-btn:hover {
+    background-color: unset;
+}
+
+
+.classic #pages .page-editor-grid {
+    border-radius: 0;
+    border: 2px solid #393737;
+}
+@media (max-width: 1023px) {
+    .classic #pages .page-editor-grid {
+        border-top: 2px solid #393737;
+        border-bottom: 2px solid #393737;
+        border-right: 0;
+        border-left: 0;
+    }
+}
+
+.classic #pages .close-page-button {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    border-radius: 0;
+}
+.classic #pages .close-page-button:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #pages .close-page-button:hover {
+    background-color: unset;
+}
+
+.classic #pages .page-editor-buttons {
+    gap: 4px;
+}
+@media (min-width: 1024px) {
+    .classic #pages .page-editor-buttons {
+        padding: 10px 14px 10px 11px;
+    }
+}
+
+.classic #pages .save-page-button, 
+.classic #pages .open-properties,
+.classic #pages .classic .page-editor-grid.properties, 
+.classic #pages .open-mediateka {
+    height: 25px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    padding: 0px 5px 2px 5px;
+}
+.classic #pages .page-editor-buttons > div {
+    outline: 1px solid #131313;
+    outline-offset: 0px;
+}
+.classic #pages .save-page-button:active, 
+.classic #pages .open-properties:active,
+.classic #pages .classic .page-editor-grid.properties:active, 
+.classic #pages .open-mediateka:active {
+    height: 25px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+
+.classic #pages .page-editor-buttons .save-page-button:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+.classic #pages .page-editor-grid .tags-helper {
+    height: 25px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    padding: 0px 5px 2px 5px;
+}
+.classic #pages .page-editor-grid.tags-opened .tags-helper {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+.classic #pages .page-editor-grid .tags-helper:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+
+.classic #pages .page-editor-grid.properties .open-properties {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+.classic #pages .page-editor-grid.mediateka .open-mediateka {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+
+.classic #pages .codemirror-replace {
+    height: 25px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    padding: 0px 5px 2px 5px;
+}
+.classic #pages .codemirror-replace:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+
+.classic #pages .page-editor-buttons a, .classic #pages .page-editor-buttons a {
+    padding: 0px 5px 2px 5px;
+}
+
+
+
+
+
+
+
+
+.classic #pages .file-block {
+    border-radius: 0;
+    border: 2px solid var(--br-3);
+}
+
+
+
+
+
+.classic #pages .upload-files {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+}
+.classic #pages .upload-files:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #000000;
+    border-left: 2px solid #000000;
+}
+.classic #pages .mediateka-buttons .inputfile + label {
+    padding-top: 9px;
+}
+.classic #pages .upload-files:active label {
+    padding-top: 10px;
+}
+
+.classic #pages .link-file {
+    border-bottom: 1px solid #413e3e;
+    border-right: 1px solid #413e3e;
+    border-top: 1px solid #000000;
+    border-left: 1px solid #000000;
+    border-radius: 0;
+}
+.classic #pages .link-file-copy-btn {
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    border-radius: 0;
+    height: 32px;
+    line-height: 28px;
+    align-items: unset;
+}
+.classic #pages .link-file-copy-btn:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    border-radius: 0;
+    padding-top: 1px;
+}
+
+.classic #pages .del-uploaded-files.disabled {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    box-shadow: unset;
+    border-radius: 0;
+}
+.classic #pages .del-uploaded-files.disabled:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding-top: 10px;
+}
+
+.classic #pages .del-uploaded-files {
+    border-bottom: 1px solid #ff6b29;
+    border-right: 1px solid #ff6b29;
+    border-top: 1px solid #ff844d;
+    border-left: 1px solid #ff844d;
+    box-shadow: 0 0 3px 5px var(--focus-orange);
+    border-radius: 0;
+    height: 40px;
+    padding-top: 10px;
+    align-items: unset;
+    user-select: none;
+}
+.classic #pages .del-uploaded-files:hover {
+    box-shadow: 0 0 3px 5px var(--focus-orange);
+}
+.classic #pages .del-uploaded-files:active {
+    border-bottom: 1px solid #ff6b29;
+    border-right: 1px solid #ff6b29;
+    border-top: 1px solid #ffb492;
+    border-left: 1px solid #ffb492;
+    padding-top: 11px;
+}
+
+/*#endregion Page Classic*/
+
+
+
+
+
+/*#region Menu Classic*/
+
+
+.classic #menu .menu,
+.classic #menu .item,
+.classic #menu .items-grid,
+.classic #menu input[type="text"],
+.classic #menu .menu-prop .field-select-menu,
+.classic #menu .menu-prop .area-select-grid .field-options.open,
+.classic #menu .menu-prop .field-select,
+.classic #menu .target-blank input[type="checkbox"],
+.classic #menu .select-grid .select-dropdown,
+.classic #menu .menu-prop .parent-select-grid .field-options,
+.classic #menu .menu-grid > div > .items-grid {
+    border-radius: 0;
+}
+
+.classic #menu .menu-grid > div {
+    border: 2px solid #393737;
+    border-radius: 0;
+}
+
+.classic #menu .item {
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+
+.classic #menu .menu .menu-buttons, .classic #menu .item .menu-buttons {
+    column-gap: 0.3rem;
+}
+.classic #menu .menu .menu-buttons > div {
+    outline: 1px solid #1b1a1a;
+    outline-offset: 0px;
+}
+.classic #menu .item .menu-buttons > div {
+    outline: 1px solid #111111;
+    outline-offset: 0px;
+}
+.classic #menu .will-be-deleted .item .menu-buttons .del {
+    outline: 1px dashed red;
+    outline-offset: 2px;
+}
+
+.classic #menu .menu-buttons div {
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    padding: 0px 5px 2px 5px;
+}
+.classic #menu .menu-buttons div:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+.classic #menu .menu-grid > div.will-be-deleted .del, .classic #menu .will-be-deleted .item .del {
+    border-radius: 0;
+}
+
+.classic #menu .menu .save {
+    opacity: 0;
+    pointer-events: none;
+}
+.classic #menu .menu.changed .save {
+    opacity: 1;
+    color: var(--save-menu);
+    pointer-events: all;
+}
+
+.classic #menu .item .save {
+    opacity: 0;
+    pointer-events: none;
+}
+.classic #menu .item.changed .save {
+    opacity: 1;
+    color: var(--save-menu);
+    pointer-events: all;
+}
+
+.classic #menu .menu.open .prop {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+
+.classic #menu .item.open .prop {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+
+
+.classic #menu .item.highlite-children::after {
+    margin-left: -16px;
+    width: 16px;
+}
+@media (max-width: 767px) {
+    .classic #menu .item.highlite-children::after {
+        margin-left: -8px;
+        width: 8px;
+    }
+}
+
+.classic #menu .menu .area.title, .classic #menu .menu .classes.title, .classic #menu .item .menu-prop > .title {
+    user-select: none;
+}
+.classic #menu .menu input[name=title], 
+.classic #menu .menu input[name=classes],
+.classic #menu .menu input[name=sort] {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+
+.classic #menu .menu-prop .field-select-menu {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+
+.classic #menu .menu-prop .field-select-menu > .icon, 
+.classic #menu .menu-prop .field-select > .icon {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+    background-color: #383433;
+}
+
+.classic #menu .menu-prop .field-select-menu:active  > .icon, .classic #menu .menu-prop .field-select:active  > .icon {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #menu .menu-prop .area-select-grid.open .field-select-menu  > .icon,
+.classic #menu .menu-prop .select-grid.open .field-select  > .icon,
+.classic #menu .menu-prop .parent-select-grid.open .field-select  > .icon {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+
+.classic #menu .menu-prop .area-select-grid.open .field-options,
+.classic #menu .menu-prop .select-grid.open .select-dropdown, 
+.classic #menu .menu-prop .parent-select-grid.open .field-options {
+    border: 2px solid #5b5756;
+}
+
+.classic #menu .menu-prop .field-select, 
+.classic #menu .item input[name=title],
+.classic #menu .item input[name=tag_title],
+.classic #menu .item input[name=url],
+.classic #menu .item input[name=classes],
+.classic #menu .item input[name=sort] {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+.classic #menu .target-blank input[type="checkbox"] {
+    margin-top: 2px;
+}
+.classic #menu .main-footer .create {
+    border-radius: 0;
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #4c4949;
+    border-left: 2px solid #4c4949;
+    padding: 4px 11px 5px 11px;
+    height: 35px;
+}
+.classic #menu .main-footer .create:active {
+    border-bottom: 2px solid #4c4949;
+    border-right: 2px solid #4c4949;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    padding: 5px 11px 5px 11px;
+}
+
+/*#endregion Page Classic*/
+
+
+
+
+
+
+/*#region Base Classic*/
+
+.classic #base .db-settings {
+    border-radius: 0;
+    border: 2px solid #393737;
+}
+.classic #base form input {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    border-radius: 0;
+}
+
+
+.classic #base form input[name="password"] {
+    grid-column: 1 / 2;
+    padding-right: 0.54rem;
+}
+.classic #base form .password-widget input {
+    grid-column: 1 / 2;
+}
+.classic #base .pro-btn {
+    height: 34px;
+    border-bottom: 1px solid #111111;
+    border-right: 1px solid #111111;
+    border-top: 1px solid #413e3e;
+    border-left: 1px solid #413e3e;
+    background-color: #292727;
+}
+.classic #base .pro-btn:active {
+    padding-top: 6px;
+    border-bottom: 1px solid #413e3e;
+    border-right: 1px solid #413e3e;
+    border-top: 1px solid #111111;
+    border-left: 1px solid #111111;
+}
+.classic #base form.show-pro .pro-btn {
+    padding-top: 6px;
+    border-bottom: 1px solid #413e3e;
+    border-right: 1px solid #413e3e;
+    border-top: 1px solid #111111;
+    border-left: 1px solid #111111;
+}
+
+.classic #base form .password-eye {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+}
+.classic #base form .password-eye:active {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #272423;
+    background-position: center calc(50% + 1px);
+}
+.classic #base form .password-eye.showed {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #272423;
+    background-position: center calc(50% + 1px);
+}
+.classic button {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #4c4949;
+    border-left: 2px solid #4c4949;
+    padding-top: 4px;
+    height: 35px;
+    border-radius: 0;
+    background-color: #2a2828;
+}
+.classic button:active {
+    border-bottom: 2px solid #4c4949;
+    border-right: 2px solid #4c4949;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-color: #1e1d1d;
+    padding-top: 5px;
+    background-color: #272423;
+}
+.classic #base form .pro-btn {
+    border-radius: 0;
+}
+
+
+/*#endregion Base Classic*/
+
+
+
+
+
+
+/*#region Modules Classic*/
+
+
+.classic #modules .update-window, .classic #modules .dev-window, .classic #modules .changed-files {
+    border: 2px solid #393737;
+    border-radius: 0;
+}
+
+.classic #modules .upload_dnd {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #4c4949;
+    border-left: 2px solid #4c4949;
+    padding: 6px 11px 5px 11px;
+    height: 40px;
+    border-radius: 0;
+}
+.classic #modules .upload_dnd:active {
+    border-bottom: 2px solid #4c4949;
+    border-right: 2px solid #4c4949;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    padding: 7px 11px 4px 11px;
+}
+
+.classic #modules > div {
+    row-gap: 5px;
+}
+@media (min-width: 1025px) {
+    .classic #modules > .modules-grid {
+        row-gap: 3px;
+    }
+}
+
+.classic #modules .module-description {
+    margin-bottom: 3px;
+}
+
+.classic #modules .modules-grid > div {
+    border-radius: 0;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+
+
+.classic #modules .module-sw-btn, .classic #modules .module-del-btn {
+    padding: 0px 5px 2px 5px;
+    outline: 1px solid #1b1a1a;
+    outline-offset: 0px;
+}
+.classic #modules .enabled .module-sw-btn {
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+.classic #modules .enabled .module-sw-btn:active {
+    padding-top: 1px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c
+}
+.classic #modules .disabled .module-sw-btn, .classic #modules .enabled .module-sw-btn {
+    margin-left: -5px;
+}
+.classic #modules .disabled .module-sw-btn {
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+.classic #modules .disabled .module-sw-btn:active {
+    padding-top: 1px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c
+}
+
+.classic #modules .module-del-btn {
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+.classic #modules .module-del-btn:active {
+    padding-top: 1px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+}
+.classic #modules .module-version {
+    text-align: center;
+    padding: 0 5px 1px 5px;
+    border-bottom: 1px solid #413e3e;
+    border-right: 1px solid #413e3e;
+    border-top: 1px solid #111;
+    border-left: 1px solid #111;
+    background-color: #292727;
+}
+
+/*#endregion Modules Classic*/
+
+
+
+
+
+
+/*#region Admin_Menu Classic*/
+
+.classic #admin_menu .field-select {
+    grid-template-columns: 1fr 26px;
+}
+
+.classic #admin_menu .am-grid > div,
+.classic #admin_menu [data-am-type="section"], 
+.classic #admin_menu .items-grid, 
+.classic #admin_menu [data-am-type="item"],
+.classic #admin_menu input,
+.classic #admin_menu .field-select,
+.classic #admin_menu .field-options,
+.classic #admin_menu .add-section, 
+.classic #admin_menu .reset-all {
+    border-radius: 0;
+}
+.classic #admin_menu .am-grid > div {
+    border: 2px solid #393737;
+}
+.classic #admin_menu [data-am-type="item"] {
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+
+
+.classic #admin_menu .items-grid {
+    padding: 13px 3px 8px 8px;
+}
+
+
+.classic #admin_menu [data-am-type="section"] input[name=title], .classic #admin_menu [data-am-type="section"] input[name=sort] {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+
+.classic #admin_menu input {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+
+
+.classic #admin_menu .field-select {
+    gap: 7px;
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+.classic #admin_menu .field-select > .icon {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+    background-color: #383433;
+    margin: 1px;
+}
+.classic #admin_menu .field-select:active > .icon {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #admin_menu .section-select-grid.open .field-select > .icon {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #admin_menu .section-select-grid.open .field-options {
+    border: 2px solid #5b5756;
+}
+
+.classic #admin_menu [data-am-type] .buttons {
+    gap: 10px;
+}
+
+.classic #admin_menu [data-am-type] .buttons > a {
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    padding: 0px 5px 2px 5px;
+    outline: 1px solid #1b1a1a;
+    outline-offset: 0px;
+}
+.classic #admin_menu [data-am-type] .buttons > a:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding: 1px 5px 2px 5px;
+}
+.classic #admin_menu .items-grid [data-am-type] .buttons > a {
+    outline: 1px solid #111111;
+}
+
+.classic #admin_menu .add-section, .classic #admin_menu .reset-all {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #4c4949;
+    border-left: 2px solid #4c4949;
+    padding: 4px 11px 5px 11px;
+    height: 35px;
+}
+.classic #admin_menu .add-section:active, .classic #admin_menu .reset-all:active {
+    border-bottom: 2px solid #4c4949;
+    border-right: 2px solid #4c4949;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    padding: 5px 11px 5px 11px;
+}
+
+
+
+/*#endregion Admin_Menu Classic*/
+
+
+
+
+
+/*#region Pages Classic*/
+
+.classic #pages .main-footer .pager > div {
+    height: 22px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    outline: 1px solid #0b0b0b;
+    outline-offset: 0px;
+    border-radius: 0;
+    align-items: unset;
+}
+.classic #pages .main-footer .pager > div:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    outline: 1px solid #0b0b0b;
+    outline-offset: 0px;
+    padding-top: 1px;
+}
+
+.classic #pages .main-footer .pager > div.active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    padding-top: 1px;
+}
+
+/*#endregion Pages Classic*/
+
+
+
+
+
+/*#region Auth Classic*/
+
+.classic #auth form {
+    border-radius: 0;
+    border: 2px solid #393737;
+}
+
+.classic #auth form input {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    border-radius: 0;
+}
+
+.classic #auth form input[name="admin_password"] {
+    grid-column: 1 / 2;
+}
+.classic #auth form .password-eye {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+    background-color: var(--windows);
+}
+.classic #auth form .password-eye:active {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #auth form .password-eye.showed {
+    border-bottom: 2px solid #5e5a5a;
+    border-right: 2px solid #5e5a5a;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #auth .sess-table > div {
+    padding: 5px 5px 5px 2px;
+}
+@media (min-width: 1025px) {
+    .classic  #auth .sess-table  {
+        row-gap: 0;
+    }
+}
+@media (max-width: 1024px) {
+    .classic #auth .sess-table > div {
+        display: grid;
+        grid-template-columns: 1fr auto;
+        gap: 5px;
+    }
+    .classic #auth .sess-table .date {
+        grid-column: 1/2;
+        grid-row: 1/2;
+    }
+    .classic #auth .sess-table .del-sess {
+        grid-column: 2/3;
+        grid-row: 1/2;
+        float: unset;
+    }
+    .classic #auth .sess-table .ip {
+        grid-column: 1/2;
+    }
+    .classic #auth .sess-table .agent {
+        grid-column: 1/-1;
+    }
+    .classic #auth .sess-table > div {
+        padding: 5px 5px 5px 5px;
+    }
+}
+
+.classic #auth .sess-table > div, .classic #auth .del-sess {
+    border-radius: 0;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    align-items: start;
+}
+
+
+
+.classic #auth .del-sess {
+    width: 24px;
+    height: 24px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+}
+.classic #auth .del-sess:active {
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+    background-color: var(--bg-3);
+}
+.classic #auth .sess-table .date, .classic #auth .sess-table .ip {
+    border-bottom: 1px solid #413e3e;
+    border-right: 1px solid #413e3e;
+    border-top: 1px solid #111;
+    border-left: 1px solid #111;
+    background-color: #292727;
+    text-align: center;
+}
+
+
+/*#endregion Auth Classic*/
+
+
+
+
+
+
+/*#region SiteMap Classic*/
+
+.classic #sitemap .sitemap, 
+.classic #sitemap .xml-wrapper-hidden, 
+.classic #sitemap .xml-wrapper-link, 
+.classic #sitemap .xml-static-dynamic, 
+.classic #sitemap .xml-static-cron,
+.classic #sitemap .sitemap-manual {
+    border-radius: 0;
+    border: 2px solid #393737;
+}
+
+.classic #sitemap form div > input,
+.classic #sitemap .xml-static-cron input[type="text"],
+.classic #sitemap textarea {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    border-radius: 0;
+}
+
+.classic #sitemap .select-dropdown ul.list-search {
+    border-radius: 0;
+}
+.classic #sitemap .select-dropdown.open  ul.list-search {
+    border: 2px solid #5b5756;
+}
+
+/*#endregion SiteMap Classic*/
+
+
+
+
+
+
+/*#region RSS Classic*/
+
+.classic #rss .rss, 
+.classic #rss .xml-wrapper-hidden, 
+.classic #rss .xml-static-dynamic, 
+.classic #rss .xml-static-cron {
+    border-radius: 0;
+    border: 2px solid #393737
+}
+
+.classic #rss form div > input,
+.classic #rss textarea,
+.classic #rss .xml-static-cron input[type="text"], 
+.classic #rss .xml-static-dynamic input[type="text"] {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    border-radius: 0;
+}
+
+.classic #rss .select-dropdown.open ul.list-search {
+    border-radius: 0;
+}
+.classic  #rss .select-dropdown.open  ul.list-search {
+    border: 2px solid #5b5756;
+}
+
+/*#endregion RSS Classic*/
+
+
+
+
+
+
+/*#region Template Classic*/
+
+.classic #template .upload_dnd {
+    border-radius: 0;
+}
+
+.classic #template .template-install,
+.classic #template .upload_dnd,
+.classic #template .template,
+.classic #template .field-select,
+.classic #template .template-select-grid .field-options.open,
+.classic #template input[type="checkbox"],
+.classic #template .template-headers,
+.classic #template .template-manual,
+.classic #template .template-files,
+.classic #template .template-headers textarea {
+    border-radius: 0;
+    border: 2px solid #393737;
+}
+
+
+.classic #template .field-select {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+.classic #template .field-select > .icon {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #5e5a5a;
+    border-left: 2px solid #5e5a5a;
+    background-color: #2a2828;
+    margin: 1px;
+}
+.classic #template .field-select:active > .icon {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #template .template-select-grid.open .field-select > .icon {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #template .template-select-grid.open .field-options {
+    border: 2px solid #5b5756;
+}
+
+
+.classic #template .template input[type="checkbox"] {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+.classic #template .template input[type="checkbox"]:checked {
+    border-bottom: 2px solid #bd3900;
+    border-right: 2px solid #bd3900;
+    border-top: 2px solid #762300;
+    border-left: 2px solid #762300;
+}
+.classic #template .template-headers textarea {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+}
+
+
+
+.classic #template .upload_dnd {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #4c4949;
+    border-left: 2px solid #4c4949;
+    padding: 6px 11px 5px 11px;
+    height: 40px;
+    background-color: #2a2828;
+}
+.classic #template .upload_dnd:active {
+    border-bottom: 2px solid #4c4949;
+    border-right: 2px solid #4c4949;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    padding: 7px 11px 5px 11px;
+    background-color: #272423;
+}
+
+@media (min-width: 1024px) {
+    .classic #template .template-editor-grid {
+        border-radius: 0;
+        border: 2px solid #393737;
+    }
+}
+@media (max-width: 1023px) {
+    .classic #template .template-editor-grid {
+        border-top: 2px solid #393737;
+        border-bottom: 2px solid #393737;
+        border-right: 0;
+        border-left: 0;
+    }
+}
+
+.classic #template .close-template-button {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    border-radius: 0;
+}
+.classic #template .close-template-button:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #template .close-template-button:hover {
+    background-color: unset;
+}
+
+
+.classic #template .save-template-button {
+    border-bottom: 2px solid #0c0c0c;
+    border-right: 2px solid #0c0c0c;
+    border-top: 2px solid #393737;
+    border-left: 2px solid #393737;
+    border-radius: 0;
+}
+.classic #template .save-template-button:active {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+}
+.classic #template .save-template-button:hover {
+    background-color: unset;
+}
+.classic #template .save-template-button.saved {
+    border-bottom: 2px solid #393737;
+    border-right: 2px solid #393737;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    background-position: center calc(50% + 1px);
+    background-color: var(--saved-bg);
+}
+
+.classic #template .template-editor {
+    border-bottom: 2px solid #413e3e;
+    border-right: 2px solid #413e3e;
+    border-top: 2px solid #0c0c0c;
+    border-left: 2px solid #0c0c0c;
+    margin: 0 5px 0 5px;
+}
+
+.classic #template .snip-grid {
+    background-color: #1e1d1d;
+    margin: 2px 5px 0 0;
+}
+.classic #template .html, .classic #template .css, .classic #template .php {
+    padding: 0;
+    gap: 2px;
+}
+.classic #template .snip-grid > .html > div, 
+.classic #template .snip-grid > .css > div, 
+.classic #template .snip-grid > .php > div {
+    height: 36px;
+    border-bottom: 1px solid #0c0c0c;
+    border-right: 1px solid #0c0c0c;
+    border-top: 1px solid #393737;
+    border-left: 1px solid #393737;
+    background-color: #292727;
+    user-select: none;
+}
+.classic #template .snip-grid > .html > div:active, 
+.classic #template .snip-grid > .css > div:active, 
+.classic #template .snip-grid > .php > div:active {
+    padding-top: 8px;
+    border-bottom: 1px solid #393737;
+    border-right: 1px solid #393737;
+    border-top: 1px solid #0c0c0c;
+    border-left: 1px solid #0c0c0c;
+    background-color: #292727;
+}
+
+
+
+
+
+
+/*#endregion Template Classic*/
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/base.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,127 @@
+#base {
+    display: grid;
+    gap: 1rem;
+    overflow-y: auto;
+    max-height: 100%;
+}
+
+@media (max-width: 1023px) {
+#base {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+    }
+}
+
+@media (min-width: 1024px) {
+    #base {
+        grid-template-columns: 17rem 1fr;
+        grid-template-rows: auto;
+        padding: 1rem;
+    }
+}
+
+#base .db-settings {
+    grid-column: 1/2;
+    background-color: var(--windows);
+    background-image: var(--noise);
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+}
+@media (max-width: 1023px) {
+    #base .db-settings {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #base .db-settings {
+        padding: 1rem;
+    }
+}
+
+#base form {
+    display: grid;
+    row-gap: 2rem;
+}
+
+#base form > div {
+    position: relative;
+    display: grid;
+    row-gap: 1rem;
+}
+#base .create {
+    font-size: 1rem;
+    color: var(--names);
+    text-align: center;
+    user-select: none;
+}
+
+
+#base form div > div div:not(.password-eye) {
+    font-size: 1rem;
+    margin-bottom: 3px;
+    color: var(--windows-font);
+}
+
+#base form .pro-btn {
+    cursor: pointer;
+    text-align: center;
+    padding: 0.3rem;
+    border: 1px solid var(--bg-3);
+    border-radius: 0.2rem;
+    color: var(--link);
+    user-select: none;
+}
+#base form .pro {
+    display: none;
+}
+#base form.show-pro .pro {
+    display: grid;
+}
+
+
+
+#base form .password-widget {
+    display: grid;
+    grid-template-columns: 1fr auto;
+    gap: 5px;
+}
+#base form .password-widget input {
+    grid-column: 1/-1;
+    grid-row: 1/2;
+}
+
+#base form input {
+    border-radius: 4px;
+    font-size: 0.875rem;
+    font-family: var(--monospace);
+    padding: 0 0.54rem 3px 0.54rem;
+    min-height: 35px;
+    height: 35px;
+    width: 100%;
+    color: var(--input-font);
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+}
+#base form input[name="password"] {
+    grid-column: 1 / -1;
+    grid-row: 1 / 2;
+    padding-right: 2.2rem;
+}
+
+#base form > div > div {
+    position: relative;
+}
+#base form .password-eye {
+    grid-column: 2 / 3;
+    grid-row: 1 / 2;
+    width: 34px;
+    height: 34px;
+    z-index: 1;
+    cursor: pointer;
+    background-repeat: no-repeat;
+    background-size: 20px;
+    background-position: center;
+    background-image: var(--eye-off);
+}
+#base form .password-eye.showed {
+    background-image: var(--eye-on);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/menu.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,682 @@
+#menu {
+	display: grid;
+	height: 100%;
+	overflow-y: auto;
+    grid-auto-rows: max-content;
+}
+
+
+@media (max-width: 1023px) {
+	#menu .main-main {
+        padding: 0.4rem;
+    }
+}
+@media (min-width: 1024px) {
+    #menu .main-main {
+        padding: 1rem 1rem 0.3rem 1rem;
+    }
+}
+
+#menu .menu.last-edited::before, #menu .item.last-edited::before {
+    content: "";
+    position: absolute;
+    left: 3px;
+    top: 3px;
+    z-index: 1;
+    width: 7px;
+    height: 7px;
+    border-radius: 50%;
+    background-color: var(--green-3);
+}
+
+#menu .menu-grid {
+	display: grid;
+	row-gap: 2rem;
+	color: var(--windows-font);
+}
+
+#menu .menu-grid > div {
+	box-shadow: 0 0 3px 0 #00000096;
+	border-radius: 0.3rem;
+}
+
+#menu .menu {
+	display: grid;
+	grid-template-areas: 
+		"title sort"
+		"buttons buttons";
+	grid-template-columns: 1fr auto;
+	column-gap: 0.5rem;
+	row-gap: 0.5rem;
+	background-color: var(--windows);
+	border-radius: 0.3rem;
+	position: relative;
+	padding: 0.7rem;
+}
+#menu .menu.open {
+	grid-template-areas: 
+		"title sort"
+		"buttons buttons"
+		"menu-prop menu-prop";
+}
+#menu .menu.open .prop {
+	color: var(--menu-menu-open-prop);
+}
+#menu .menu.changed {
+	outline: 1px dashed var(--save-menu);
+    outline-offset: 0px;
+}
+#menu .menu .save > span {
+	display: none;
+}
+#menu .menu.changed .save > span {
+	display: block;
+	color: var(--save-menu);
+}
+
+
+#menu .menu .menu-prop {
+	display: none;
+}
+#menu .menu.open .menu-prop {
+	display: grid;
+	grid-area: menu-prop;
+}
+@media (max-width: 1023px) {
+	#menu .menu.open .menu-prop {
+    	grid-template-areas:
+			"area-title"
+			"select"
+			"classes-title"
+			"classes";
+	}
+	#menu .menu .menu-prop > div:not(:first-child) {
+		padding-top: 0.75rem;
+	}
+	#menu .menu .menu-prop > .area-select-grid:not(:first-child) {
+		padding-top: 0;
+	}
+}
+@media (min-width: 1024px) {
+	#menu .menu.open .menu-prop {
+		grid-template-areas: 
+			"area-title select classes-title classes";
+		grid-template-columns: 6em minmax(240px, 100%) 6em minmax(240px, 100%);
+		row-gap: 0.75rem;
+    	column-gap: 0.7rem;
+		padding: 0.5rem 0 0.3rem 0;
+	}
+}
+
+#menu .menu input[name=title] {
+	grid-area: title;
+    line-height: 27px;
+	background-color: var(--menu-input-bg);
+	border: 2px solid var(--menu-input-border);
+}
+#menu .menu input[name=sort] {
+	grid-area: sort;
+	width: 4rem;
+	text-align: center;
+	font-size: 0.9rem;
+	background-color: var(--menu-input-bg);
+	border: 2px solid var(--menu-input-border);
+}
+#menu .menu .area.title {
+	grid-area: area-title;
+	font-size: 1rem;
+    line-height: 27px;
+}
+
+#menu .menu .classes.title {
+	grid-area: classes-title;
+	font-size: 1rem;
+    line-height: 27px;
+}
+#menu .menu input[name=classes] {
+	grid-area: classes;
+	font-size: 0.9rem;
+	background-color: var(--menu-input-bg);
+	border: 2px solid var(--menu-input-border);
+}
+
+
+@media (min-width: 1024px) {
+	#menu .menu .area.title, #menu .menu .classes.title {
+		justify-self: right;
+	}
+}
+#menu input[type="text"] {
+	padding: 0 0.54rem;
+    border-radius: 4px;
+    min-height: 30px;
+	font-size: 0.94rem;
+    height: 100%;
+    background-color: var(--bg-4);
+    border: 1px solid var(--bg-4);
+    color: var(--text);
+	width: 100%;
+	max-width: 100%;
+}
+
+#menu .menu-buttons {
+    grid-area: buttons;
+	display: grid;
+    column-gap: 0.7rem;
+    font-size: 0.9rem;
+}
+#menu .menu-buttons > div {
+	display: flex; /* Chrome Mobile Browser - Fonts Size */
+}
+#menu .menu .menu-buttons {
+    grid-template-columns: auto auto 1fr auto;
+}
+#menu .menu-buttons div {
+    cursor: pointer;
+    user-select: none;
+    color: var(--buttons-font);
+	width: max-content;
+}
+#menu .menu-buttons div:active {
+	color: var(--buttons-hover);
+}
+@media (min-width: 1024px) {
+	#menu .menu-buttons div:hover {
+		color: var(--buttons-hover);
+	}
+}
+
+
+/*Items*/
+#menu .items-grid {
+    display: grid;
+    row-gap: 0.3rem;
+    padding: 0.8rem 0 0.5rem 0.5rem;
+    margin-top: -5px;
+    background-color: var(--windows);
+    border-radius: 0 0 0 0.3rem;
+}
+@media (min-width: 768px) {
+	#menu .items-grid .items-grid {
+		padding-left: 1rem;
+	}
+}
+#menu .menu-grid > div > .items-grid {
+    border-radius: 0 0 0.3rem 0.3rem;
+}
+
+#menu .items-grid .items-grid {
+    box-shadow: inset 0 0 0 1px var(--windows-hover);
+}
+
+#menu .item {
+	display: grid;
+	grid-template-areas: 
+		"title"
+		"buttons";
+	row-gap: 0.5rem;
+	background-color: var(--bg-3);
+    background-image: var(--noise);
+	border-radius: 0.3rem 0 0  0.3rem;
+	position: relative;
+	padding: 0.7rem;
+}
+
+
+/*Lines*/
+#menu .item.clicked + .items-grid {
+	box-shadow: inset 1px -1px 0 0 var(--green-3);
+}
+#menu .items-grid:has(> * > .last-edited) {
+	box-shadow: inset 1px -1px 0 0 var(--green-3);
+}
+#menu div:has(> .item > .menu-buttons .append:hover) > .items-grid {
+    box-shadow: inset 1px -1px 0 0 var(--green-3);
+}
+
+
+#menu > .main-main .menu-grid > div > .items-grid.highlite-parent > div > .item.highlite-children::after {
+	margin-left: -7px;
+	width: 7px;
+}
+
+#menu .items-grid.highlite-parent {
+	box-shadow: inset 1px 0px 0 0 var(--sub-line);
+}
+
+#menu .item.highlite-children::after {
+	content: "";
+	position: absolute;
+	margin-left: -15px;
+	top: calc(50% - 1px);
+	border-top: 1px solid var(--sub-line);
+	width: 15px;
+}
+@media (max-width: 767px) {
+	#menu .item.highlite-children::after {
+		margin-left: -7px;
+		width: 7px;
+	}
+}
+#menu .item.highlite-children + .items-grid {
+	box-shadow: inset 1px -1px 0 0 var(--green-3);
+}
+/*Lines End*/
+
+
+@media (min-width: 1024px) {
+	#menu .item:hover {
+		background-color: var(--open-menu);
+	}
+}
+#menu .item.open {
+	grid-template-areas: 
+		"title"
+		"buttons"
+		"menu-prop";
+	background-color: var(--open-menu);
+}
+
+#menu .item .menu-buttons {
+    grid-template-columns: auto auto 1fr auto;
+}
+#menu .item.open .menu-buttons {
+    grid-template-columns: auto auto 1fr auto;
+}
+
+#menu .item.changed {
+    outline: 1px dashed var(--save-menu);
+    outline-offset: 0px;
+}
+#menu .item .save > span {
+    display: none;
+}
+#menu .item.changed .save > span {
+    display: block;
+	color: var(--save-menu);
+}
+
+
+#menu .item .menu-prop > .title {
+	font-size: 1rem;
+	line-height: 27px;
+	color: var(--names);
+}
+
+
+#menu .menu-grid > div.will-be-deleted {
+	outline: 1px dashed red;
+    outline-offset: 0px;
+}
+#menu .menu-grid > div.will-be-deleted .del {
+	outline: 1px dashed red;
+    outline-offset: 2px;
+    border-radius: 1px;
+}
+
+#menu .will-be-deleted .item {
+    outline: 1px dashed red;
+    outline-offset: -1px;
+}
+#menu .will-be-deleted .item .del {
+	outline: 1px dashed red;
+    outline-offset: 2px;
+    border-radius: 1px;
+}
+
+@media (min-width: 1024px) {
+	#menu .item .menu-buttons div {
+        opacity: 0;
+    }
+    #menu .item:hover div {
+        opacity: 1;
+    }
+    #menu .item.open div {
+        opacity: 1;
+    }
+	#menu .item .menu-prop > .title {
+		text-align: right;
+	}
+}
+
+
+
+#menu .item .menu-prop {
+	display: none;
+}
+#menu .item.open .menu-prop {
+	display: grid;
+	grid-area: menu-prop;
+}
+#menu .item.open .prop {
+	color: var(--menu-item-open-prop);
+}
+
+#menu .item a {
+    grid-area: title;
+    display: flex;
+    width: fit-content;
+    margin-top: -5px;
+    font-size: 1rem;
+    text-decoration: none;
+    min-height: 21px; /* for empty title */
+}
+#menu .item a[href] {
+    color: var(--menu-item-a);
+}
+#menu .item a[href]:hover {
+    color: var(--menu-item-a-hover);
+}
+#menu .item a:not([href]) {
+	width: fit-content;
+    margin-top: -5px;
+    font-size: 1rem;
+	min-height: 21px;
+	color: var(--menu-item-a-none-link);
+}
+
+@media (max-width: 1023px) {
+	#menu .item .menu-prop {
+		grid-template-areas: 
+			"page-title"
+			"select-grid"
+			"parent-title"
+			"pid"
+			"title-name"
+			"title"
+			"tag-title"
+			"tag_title"
+			"url-title"
+			"target-blank"
+			"classes-title"
+			"classes"
+			"sort-title"
+			"sort";
+	}
+}
+@media (min-width: 1024px) {
+	#menu .item .menu-prop {
+		grid-template-areas: 
+			"page-title select-grid  parent-title  pid"
+			"title-name title        tag-title     tag_title"
+			"url-title  target-blank classes-title classes"
+			".          .            sort-title    sort";
+		grid-template-columns: 6em minmax(240px, 100%) 6em minmax(240px, 100%);
+		row-gap: 0.75rem;
+    	column-gap: 0.7rem;
+		padding: 0.5rem 0 0.3rem 0;
+	}
+}
+
+#menu .item .page.title {
+	grid-area: page-title;
+}
+#menu .item .select-grid {
+	grid-area: select-grid;
+}
+
+
+#menu .item .parent.title {
+	grid-area: parent-title;
+}
+
+#menu .item input[name=pid] {
+	grid-area: pid;
+}
+
+#menu .item .title.name {
+	grid-area: title-name;
+}
+#menu .item input[name=title] {
+	grid-area: title;
+}
+
+
+#menu .item .tag.title {
+	grid-area: tag-title;
+}
+#menu .item input[name=tag_title] {
+	grid-area: tag_title;
+}
+
+
+
+#menu .item .classes.title {
+	grid-area: classes-title;
+}
+#menu .item input[name=classes] {
+	grid-area: classes;
+}
+
+
+#menu .item .url.title {
+	grid-area: url-title;
+}
+#menu .item .target-blank {
+	grid-area: target-blank;
+	display: grid;
+	grid-template-columns: 1fr 30px;
+	column-gap: 0.5rem;
+	position: relative;
+}
+#menu .item input[name=url] {
+	width: 100%;
+	grid-column: 1/-1;
+	grid-row: 1/2;
+}
+#menu .item input[name=url][disabled] {
+	color: var(--menu-input-select-font-disabled);
+}
+
+#menu .item .sort.title {
+	grid-area: sort-title;
+}
+#menu .item input[name=sort] {
+	grid-area: sort;
+	width: 5rem;
+    text-align: center;
+}
+
+@media (max-width: 1023px) {
+	#menu .item .parent-title, #menu .item .title, #menu .item .tag-title, #menu .item .url-title, #menu .item .classes-title, #menu .item .sort-title {
+		padding-top: 0.75rem;
+	}
+}
+
+#menu .target-blank input[type="checkbox"] {
+	grid-row: 1/2;
+	grid-column: 2/3;
+	align-self: center;
+	justify-self: center;
+	border: 2px solid var(--orange);
+}
+
+
+#menu .select-grid .field-options {
+	position: relative;
+}
+#menu .select-grid .select-dropdown {
+	display: grid;
+	position: absolute;
+	left: 0;
+	right: 0;
+	top: 2px;
+	background-color: var(--bg-3);
+	border: 2px solid var(--bg-4);
+	color: var(--menu-item-select-dropdown-font);
+	border-radius: 0.25rem;
+	z-index: 7;
+	overflow: hidden;
+	box-shadow: 0 2px 3px 0 #00000033;
+}
+#menu .select-grid .field-search {
+	display: grid;
+	padding: 0.37rem;
+	border-bottom: 2px solid var(--bg-4);
+}
+#menu .select-grid .field-search input {
+	width: 100%;
+	background-color: var(--menu-item-field-search-input-bg);
+	color: var(--text);
+	border: 2px solid var(--bg-4);
+	font-size: 0.94rem;
+	background-repeat: no-repeat;
+	background-position: right .37rem center;
+	padding: 0.25rem 2rem 0.25rem 0.25rem;
+	background-size: 17px 14px;
+}
+#menu .select-grid .field-search input {
+	background-image: var(--search-icon);
+}
+#menu .select-grid .field-search input:focus {
+	border: 2px solid var(--menu-item-field-search-input-focus);
+	transition: all .700s ease 0s;
+}
+#menu .select-grid ul.list-search, #menu .item .field-search {
+    background-color: var(--bg-3);
+}
+#menu .select-grid ul.list-search {
+	display: grid;
+	margin: 0;
+	padding: 0;
+	overflow-y: auto;
+	max-height: 17rem;
+	overscroll-behavior: contain;
+}
+#menu .select-grid .list-search li {
+	display: block;
+	list-style-type: none;
+	padding: 0.4rem 0.44rem;
+	cursor: pointer;
+	font-size: 0.94rem;
+	text-align: left;
+}
+#menu .select-grid .list-search li:hover {
+	background-color: var(--menu-item-list-search-li-hover-active);
+}
+#menu .select-grid .list-search li.active {
+	background-color: var(--menu-item-list-search-li-hover-active);
+}
+#menu .select-grid .list-search li.searcher-hidden { display: none; }
+#menu .select-grid .field-options { overflow: hidden; }
+#menu .select-grid .field-options.open { overflow: initial; }
+
+#menu .main-footer {
+    padding: 1rem;
+}
+
+@media (max-width: 1023px) {
+	#menu .main-footer {
+		padding: 0.7rem 0.4rem 1rem 0.4rem;
+	}
+}
+@media (min-width: 1024px) {
+	#menu .main-footer {
+		padding: 1rem;
+	}
+}
+
+#menu .main-footer .create {
+    display: block;
+    width: max-content;
+    padding: 0.4rem 0.7rem 0.5rem 0.7rem;
+    background-color: var(--bg-4);
+    text-decoration: none;
+    font-size: 0.9rem;
+    color: var(--windows-font);
+    border-radius: 0.3rem;
+    cursor: pointer;
+	user-select: none;
+}
+
+
+/* Select */
+#menu .menu-prop .area-select-grid, #menu .item .menu-prop .parent-select-grid {
+    position: relative;
+}
+
+#menu .menu-prop .field-select-menu {
+	display: grid;
+	grid-template-columns: 1fr 26px;
+	height: 100%;
+	cursor: pointer;
+	background-color: var(--menu-input-bg);
+	border: 2px solid var(--menu-input-border);
+	border-radius: 4px;
+    user-select: none;
+	line-height: 26px;
+	font-size: 1rem;
+}
+#menu .menu-prop .field-select-menu > .value {
+	padding: 0 0 0 0.44rem;
+    white-space: nowrap;
+    overflow: hidden;
+	line-height: 26px;
+    font-size: 0.94rem;
+	color: var(--text);
+}
+#menu .menu-prop .field-select-menu > .icon {
+    background-image: var(--select-icon);
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: 12px;
+}
+
+#menu .menu-prop .field-select {
+	display: grid;
+	grid-template-columns: 1fr 26px;
+	height: 100%;
+	min-height: 30px;
+	cursor: pointer;
+	background-color: var(--bg-4);
+	border: 1px solid var(--bg-4);
+	border-radius: 4px;
+    user-select: none;
+}
+#menu .menu-prop .field-select > .value {
+	padding: 0 0 0 0.44rem;
+    white-space: nowrap;
+    overflow: hidden;
+	line-height: 26px;
+    font-size: 0.94rem;
+	color: var(--text);
+}
+#menu .menu-prop .field-select > .icon {
+    background-image: var(--select-icon);
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: 12px;
+}
+
+#menu .menu-prop .area-select-grid .field-options, #menu .menu-prop .parent-select-grid .field-options {
+    display: grid;
+    position: absolute;
+    height: 0;
+    overflow: hidden;
+    width: 100%;
+    border-radius: 0.25rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    max-height: 17rem;
+    z-index: 7;
+}
+#menu .menu-prop .area-select-grid .field-options.open, #menu .menu-prop .parent-select-grid .field-options.open {
+    background-color: var(--bg-3);
+    border: 2px solid var(--bg-4);
+    color: var(--text);
+	margin-top: 2px;
+    overflow: auto;
+    height: auto;
+}
+#menu .menu-prop .area-select-grid .field-options .option, #menu .menu-prop .parent-select-grid .field-options .option {
+    padding: 0.4rem 0.44rem;
+    cursor: pointer;
+    font-size: 0.94rem;
+}
+#menu .menu-prop .area-select-grid .field-options .option:hover, #menu .menu-prop .parent-select-grid .field-options .option:hover {
+    background-color: var(--bg-2);
+}
+
+#menu .no-database, #menu .no-tables {
+    color: var(--windows-font);
+    border-radius: 0.4rem;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/pages.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1664 @@
+#pages {
+    display: grid;
+    height: 100%;
+    grid-template-rows: auto 1fr auto;
+    grid-template-areas:
+        "main-header"
+        "main-main"
+        "main-footer";
+}
+
+#pages .main-header {
+    grid-area: main-header;
+    display: grid;
+    gap: 1rem;
+    min-height: 35px;
+}
+
+@media (max-width: 1023px) {
+    #pages .main-header {
+        padding: 1rem 0.7rem 1rem 0.4rem;
+        grid-template-columns: 1fr auto auto auto;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .main-header {
+        padding: 1rem 2.4rem 1rem 1rem;
+        grid-template-columns: 1fr auto 1fr auto;
+    }
+}
+
+/* вернули скролл к стандартной ширине
+@-moz-document url-prefix() {
+    #pages .main-header {
+        padding-right: 1.4rem;
+    }
+}
+*/
+
+#pages .search-wrapper {
+    display: grid;
+    grid-template-columns: 1fr auto auto;
+    min-width: 180px;
+}
+#pages .page-search {
+    grid-column: 1/-1;
+    grid-row: 1/2;
+    border-radius: 0.3rem;
+    font-size: 0.875rem;
+    padding: 0 4.7rem 0 0.54rem;
+    height: 100%;
+    width: 100%;
+    background-color: var(--page-search);
+    border: 2px solid var(--input-border);
+    color: var(--text);
+}
+#pages .reset {
+    grid-column: 2/3;
+    grid-row: 1/2;
+    cursor: pointer;
+    margin: 4px;
+    border-radius: 50%;
+    outline: none;
+    width: 27px;
+    height: 27px;
+    background-color: transparent;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 12px;
+    background-image: var(--icon-clear);
+}
+@media (max-width: 1023px) {
+    #pages .reset:active {
+        background-color: var(--bg-4);
+    }
+}
+@media (min-width: 1024px) {
+    #pages .reset:hover {
+        background-color: var(--bg-4);
+    }
+}
+
+#pages .page-search-button {
+    grid-column: 3/4;
+    grid-row: 1/2;
+    border-radius: 3px;
+    cursor: pointer; 
+    border: none;
+    outline: none;
+    width: 42px;
+    min-height: unset;
+    background-color: transparent;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 48%;
+    background-image: var(--search-icon);
+}
+
+
+#pages .add-page-btn {
+    display: flex;
+    width: 35px;
+    border-radius: 0.3rem;
+    cursor: pointer;
+    background-color: var(--bg-3);
+    position: relative;
+}
+#pages .add-page-btn:hover {
+    background-color: var(--add-page-btn-hover);
+}
+#pages .add-page-btn .x1 {
+    width: 2px;
+    height: 16px;
+    border-radius: 2px;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: rotate(0deg) translate(-50%, -50%);
+}
+#pages .add-page-btn .x2 {
+    width: 16px;
+    height: 2px;
+    border-radius: 2px;
+    position: absolute;
+    top: 50%;
+    left: 50%;
+    transform: rotate(0deg) translate(-50%, -50%);
+}
+#pages .add-page-btn .x1, #pages .add-page-btn .x2 {
+    background-color: var(--add-page-btn-svg-b-plus);
+}
+
+#pages .add-pages {
+	display: grid;
+	grid-auto-flow: column;
+	column-gap: 1rem;
+	align-content: center;
+}
+
+#pages .del-pages-btn {
+    display: grid;
+    cursor: pointer;
+    width: 35px;
+    border-radius: 0.3rem;
+    user-select: none;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 100%;
+    background-image: var(--icon-trash);
+}
+@media (max-width: 1023px) {
+    #pages .add-page-btn .add-page-label {
+        display: none;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .add-page-btn {
+        width: auto;
+    }
+    #pages .add-page-btn .add-page-label {
+        display: block;
+        width: max-content;
+        padding: 4px 10px 4px 10px;
+        background-color: var(--bg-3);
+        border: 2px solid var(--add-page-btn-br);
+        text-decoration: none;
+        font-size: 0.9rem;
+        color: var(--add-page-btn-font);
+        border-radius: 0.3rem;
+        cursor: pointer;
+        user-select: none;
+    }
+    #pages .add-page-btn .add-page-label:hover {
+        background-color: var(--bg-2);
+    }
+    #pages .add-page-btn .x1, #pages .add-page-btn .x2 {
+        display: none;
+    }
+    #pages .del-pages-btn:hover {
+        background-color: var(--bg-4);
+    }
+}
+
+
+#pages .main-main {
+    grid-area: main-main;
+    overflow-y: scroll;
+}
+@media (max-width: 1023px) {
+    #pages .main-main {
+        padding: 0 0.4rem 0.3rem 0.4rem;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .main-main {
+        padding: 0rem 1rem 0.3rem 1rem;
+    }
+}
+
+
+
+
+
+#pages .pages-grid {
+    display: grid;
+    row-gap: 0.3rem;
+}
+
+#pages .pages-grid > div {
+    border-radius: 0.3rem;
+    display: grid;
+    padding: 0.7rem;
+    column-gap: 0.7rem;
+    box-shadow:  var(--shadows);
+    position: relative;
+    row-gap: 0.5rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+}
+@media (max-width: 1023px) {
+    #pages .pages-grid > div {
+        grid-template-areas:
+        "page-name page-pin  page-del"
+        "page-butt published page-del";
+        grid-template-columns: 1fr auto 1.4rem;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .pages-grid > div {
+        grid-template-areas:
+        "page-name page-pin  page-date page-del"
+        "page-butt published page-date page-del";
+        grid-template-columns: 1fr auto 6rem 1.4rem;
+    }
+    #pages .pages-grid > div:hover {
+        background-color: var(--windows-hover)
+    }
+}
+#pages .pages-grid > div.open {
+    background-color: var(--pages-grid-div-open);
+    box-shadow: 0 0 0 2px var(--pages-grid-div-open-shadow) inset;
+}
+
+#pages .pages-grid > div.home {
+	box-shadow: 0 0 0 2px var(--pages-grid-div-open-shadow) inset;
+}
+#pages .pages-grid > div[data-published="0"] {
+    box-shadow: 0 0 0 2px var(--hidden) inset;
+}
+
+@media (max-width: 1023px) {
+    #pages .pages-grid > div.open {
+        grid-template-areas:
+        "page-name page-pin  page-del "
+        "page-butt published page-del "
+        "page-prop page-prop page-prop";
+    }
+}
+@media (min-width: 1024px) {
+    #pages .pages-grid > div.open {
+        grid-template-areas:
+        "page-name page-pin  page-date page-del "
+        "page-butt published page-date page-del "
+        "page-prop page-prop page-prop page-prop";
+    }
+}
+
+
+#pages .pages-grid > div.last-edited::before {
+    content: "";
+    position: absolute;
+    left: 3px;
+    top: 3px;
+    z-index: 1;
+    width: 7px;
+    height: 7px;
+    border-radius: 50%;
+    background-color: var(--green-3);
+}
+
+#pages .pin {
+    grid-area: page-pin;
+    width: 15px;
+    height: 15px;
+    margin: -11px auto 0 auto;
+    cursor: pointer;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 84%;
+    background-image: var(--pages-pin-off);
+}
+#pages [data-pin="1"] .pin {
+    background-image: var(--pages-pin-on);
+}
+@media (min-width: 1024px) {
+    #pages .pages-grid > div .pin {
+        display: none;
+    }
+    #pages .pages-grid > div[data-pin="1"] .pin {
+        display: block;
+    }
+    #pages .pages-grid > div:hover .pin {
+        display: block;
+    }
+}
+
+#pages .pages-grid > div > .published {
+    grid-area: published;
+    width: 18px;
+    height: 18px;
+    cursor: pointer;
+    background-size: 100%;
+    background-position: center;
+    background-repeat: no-repeat;
+    background-image: var(--eye-on);
+    grid-row: 2/3;
+    align-self: end;
+}
+#pages .pages-grid [data-published="0"] .published {
+    background-image: var(--eye-off);
+}
+@media (min-width: 1024px) {
+    #pages .pages-grid > div > .published {
+        opacity: 0;
+    }
+    #pages .pages-grid > div.open > .published {
+        opacity: 1;
+    }
+    #pages .pages-grid > div:hover .published {
+        opacity: 1;
+    }
+    #pages .pages-grid [data-published="0"] .published {
+        opacity: 1;
+    }
+}
+
+
+.page-buttons div {
+    cursor: pointer;
+    user-select: none;
+    color: var(--buttons-font);
+    position: relative;
+}
+.page-buttons .loading::after {
+    content: "";
+    display: block;
+    width: 100%;
+    height: 2px;
+    position: absolute;
+    left: 0;
+    right: 0;
+    bottom: -3px;
+    border-radius: 2px;
+    background-image: repeating-linear-gradient(90deg, var(--link) -0.2rem, var(--windows) 0rem, var(--link) 0.2rem);
+    animation: barberpole 10s linear infinite;
+    background-size: 300% 300%;
+}
+@keyframes barberpole {
+    100% {
+      background-position: 150% 150%;
+    }
+}
+
+
+.page-buttons div:hover {
+    color: var(--buttons-hover);
+}
+.pages-grid > div.open .page-prop-btn {
+    color: var(--buttons-open);
+}
+
+.page-prop-save-btn {
+    display: none;
+}
+.pages-grid > div.open .page-prop-save-btn {
+    display: block;
+}
+.pages-grid > div.open .page-prop-save-btn.saved {
+    color: var(--saved);
+}
+
+.pages-grid a.page-name {
+    grid-area: page-name;
+    width: fit-content;
+    display: flex;
+    margin-top: -5px;
+    font-size: 1rem;
+    min-height: 21px; /* for empty title */
+    text-decoration: none;
+    color: var(--link);
+    font-weight: 600;
+}
+.pages-grid a.page-name:hover {
+    color: var(--link-hover);
+}
+
+
+.page-buttons {
+    grid-area: page-butt;
+    display: flex;
+    column-gap: 0.7rem;
+    font-size: 0.9rem;
+}
+@media (max-width: 320px) {
+    .page-buttons {
+        font-size: 0.7rem;
+        align-self: center;
+    }
+}
+@media (min-width: 1024px) {
+    .page-buttons {
+        opacity: 0;
+    }
+    .pages-grid > div:hover .page-buttons {
+        opacity: 1;
+    }
+    .pages-grid > div.open .page-buttons {
+        opacity: 1;
+    }
+}
+@media (max-width: 1023px) {
+    .page-date {
+        display: none;
+    }
+}
+@media (min-width: 1024px) {
+    .page-date {
+        grid-area: page-date;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        font-size: 0.8rem;
+        color: var(--page-date);
+    }
+    .page-date.future {
+        color: var(--page-date-planned);
+    }
+}
+
+#pages .page-prop {
+    display: none;
+    grid-area: page-prop;
+}
+@media (max-width: 1023px) {
+    #pages .pages-grid > div.open .page-prop {
+        display: grid;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .page-prop, #pages .page-properties {
+        grid-template-areas:
+        "cTitle vTitle cTemplate vTemplate"
+        "cURL   vURL   cDate     vDate"
+        "cSEO   vSEO   cTime     vTime"
+        "cDesc  vDesc  cTags     vTags";
+        grid-template-columns: 6em minmax(240px, 100%) 6em minmax(240px, 100%);
+        row-gap: 0.75rem;
+        column-gap: 0.7rem;
+    }
+    #pages .pages-grid > div.open .page-prop {
+        display: grid;
+        padding: 0.5rem 0 0.3rem 0;
+    }
+}
+
+#pages .page-prop > .title, #pages .page-properties > .title {
+    font-size: 1rem;
+    line-height: 27px;
+    color: var(--names);
+}
+
+
+/* Select */
+#pages .page-prop .template-select-grid, #pages .page-properties .template-select-grid {
+    position: relative;
+}
+#pages .page-prop .field-select, #pages .page-properties .field-select {
+	display: grid;
+	grid-template-columns: 1fr 28px;
+	height: 100%;
+	min-height: 30px;
+	cursor: pointer;
+	background-color: var(--bg-4);
+	border: 1px solid var(--bg-4);
+	border-radius: 4px;
+    user-select: none;
+}
+#pages .page-prop .field-select > .value,
+#pages .page-properties .field-select > .value {
+	padding: 0 0 0 0.44rem;
+    white-space: nowrap;
+    overflow: hidden;
+	line-height: 26px;
+    font-size: 0.94rem;
+	color: var(--text);
+}
+#pages .page-prop .field-select > .icon,
+#pages .page-properties .field-select > .icon {
+    background-image: var(--select-icon);
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: 12px;
+}
+
+
+#pages .page-prop .template-select-grid .field-options, #pages .page-properties .template-select-grid .field-options {
+    display: grid;
+    position: absolute;
+    height: 0;
+    overflow: hidden;
+    width: 100%;
+    border-radius: 0.25rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    max-height: 17rem;
+    z-index: 7;
+}
+#pages .page-prop .template-select-grid .field-options.open, #pages .page-properties .template-select-grid .field-options.open {
+    background-color: var(--bg-3);
+    border: 2px solid var(--bg-4);
+    margin-top: 2px;
+    color: var(--text);
+    overflow: auto;
+    height: auto;
+}
+#pages .page-prop .template-select-grid .field-options .option, #pages .page-properties .template-select-grid .field-options .option {
+    padding: 0.4rem 0.44rem;
+    cursor: pointer;
+    font-size: 0.94rem;
+}
+#pages .page-prop .template-select-grid .field-options .option:hover, #pages .page-properties .template-select-grid .field-options .option:hover {
+    background-color: var(--bg-2);
+}
+
+@media (max-width: 1023px) {
+    #pages .page-prop > .title:not(:first-child), #pages .page-properties > .title:not(:first-child) {
+        padding-top: 0.75rem;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .page-prop > .title, #pages .page-properties > .title {
+        text-align: right;
+    }
+    #pages .page-prop .page.title, #pages .page-properties .page.title { grid-area: cTitle; }
+    #pages .page-prop input[name=title], #pages .page-properties input[name=title] { grid-area: vTitle; }
+    #pages .page-prop .seo.title, #pages .page-properties .seo.title { grid-area: cSEO; }
+    #pages .page-prop input[name=seo_title], #pages .page-properties input[name=seo_title] { grid-area: vSEO; }
+    #pages .page-prop .url.title, #pages .page-properties .url.title { grid-area: cURL; }
+    #pages .page-prop .url-input, #pages .page-properties .url-input { grid-area: vURL; }
+    #pages .page-prop .template.title, #pages .page-properties .template.title { grid-area: cTemplate; }
+    #pages .page-prop .template-select-grid, .page-properties .template-select-grid { grid-area: vTemplate; }
+    #pages .page-prop .description.title, #pages .page-properties .description.title { grid-area: cDesc; }
+    #pages .page-prop textarea[name="description"], #pages .page-properties textarea[name="description"] { grid-area: vDesc; }
+    #pages .page-prop .date.title, #pages .page-properties .date.title { grid-area: cDate; }
+    #pages .page-prop input[name=date], .page-properties input[name=date] { grid-area: vDate; max-width: fit-content; }
+    #pages .page-prop .time.title, #pages .page-properties .time.title { grid-area: cTime; }
+    #pages .page-prop input[name=time], #pages .page-properties input[name=time] { grid-area: vTime; max-width: fit-content; }
+    #pages .page-prop .tags.title, #pages .page-properties .tags.title { grid-area: cTags; }
+    #pages .page-prop textarea[name="tags"], #pages .page-properties textarea[name="tags"] { grid-area: vTags; }
+}
+
+
+.page-prop .url-input {
+    display: grid;
+    grid-template-columns: 1fr 2.7rem;
+}
+@media (max-width: 1023px) {
+    .page-prop > .url-input:not(:first-child), .page-prop > .template-select-grid:not(:first-child) {
+        padding-top: 0;
+    }
+}
+
+.page-prop .url-input > input {
+    width: 100%;
+    grid-column: 1/-1;
+    grid-row: 1/-1;
+    padding-right: 3rem;
+}
+.page-prop .url-input .url-translit {
+    display: grid;
+    grid-column: 2/3;
+    grid-row: 1/-1;
+    cursor: pointer;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 54%;
+    background-image: var(--icon-link);
+}
+
+
+.pages-grid > div > input[type="checkbox"] {
+    grid-area: page-del;
+}
+@media (min-width: 1024px) {
+    .pages-grid > div > input[type="checkbox"] {
+        align-self: center;
+    }
+}
+
+.page-prop input,
+.page-prop textarea{
+    border-radius: 4px;
+    font-size: 0.94rem;
+    padding: 0 0.54rem;
+    min-height: 30px;
+    height: 100%;
+    background-color: var(--bg-4);
+    border: 1px solid var(--bg-4);
+    color: var(--text);
+}
+
+.page-prop textarea {
+    font-family: var(--sans-serif);
+    line-height: 1.3em;
+    resize: vertical;
+    display: block;
+}
+
+.page-prop select, .page-prop input[type=date], .page-prop input[type=time] {
+    -moz-padding-start: 4px;
+    -moz-padding-end: 4px;
+}
+
+#pages .main-footer {
+    grid-area: main-footer;
+    padding: 1rem;
+    display: grid;
+    column-gap: 1rem;
+    grid-auto-flow: column;
+    justify-content: space-between;
+}
+
+#pages .main-footer .pager::-webkit-scrollbar {
+    height: 0;
+}
+
+#pages .main-footer .pager {
+    scrollbar-width: none;
+}
+
+#pages .counters {
+    display: grid;
+    column-gap: 0.5rem;
+    grid-auto-flow: column;
+}
+#pages .counters input {
+    border-radius: 4px;
+    font-size: 0.875rem;
+    padding: 0 0.3rem;
+    min-height: 30px;
+    height: 100%;
+    width: 3.2rem;
+    text-align: center;
+    background-color: var(--bg-4);
+    border: 1px solid var(--bg-4);
+    color: var(--text);
+}
+#pages .counters span {
+    display: flex;
+    align-items: center;
+    font-size: 0.875rem;
+    color: var(--text);
+}
+
+
+#pages .main-footer .pager {
+    display: grid;
+    grid-auto-flow: column;
+    column-gap: 0.5rem;
+    overflow-x: auto;
+    padding: 4px;
+}
+
+#pages .main-footer .pager > div {
+    color: var(--text);
+    background-color: var(--bg-3);
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    min-width: 32px;
+    border-radius: 0.7rem;
+    font-size: 0.875rem;
+    cursor: pointer;
+    user-select: none;
+}
+
+#pages .main-footer .pager > div.active {
+    color: var(--main-footer-pager-div-active-font);
+    box-shadow: 0 0 0 0.25rem var(--pages-main-footer-pager-div-bg-active);
+}
+
+#pages .main-footer .pager > div:hover {
+    color: var(--main-footer-pager-div-hover);
+}
+
+#pages .page-editor-bg {
+    display: grid;
+    position: relative;
+    grid-row: 1/-1;
+    grid-column: 1/-1;
+    z-index: 9;
+    background-color: var(--bg-3);
+    background-image: var(--noise);
+}
+@media (min-width: 1024px) {
+    #pages .page-editor-bg {
+        padding: 1rem;
+    } 
+}
+#pages .page-editor-bg.hidden {
+    display: none;
+}
+
+
+#pages .page-editor-grid {
+    position: relative;
+    background-color: var(--bg-3);
+    box-shadow: 0 0 3px 0 #00000096;
+    min-height: 0; /*Scroll*/
+    display: grid;
+    grid-template-rows: auto auto auto auto 1fr 1rem;
+    grid-template-areas: 
+        "page-editor-header page-editor-header"
+        "page-editor-buttons page-editor-buttons"
+        "page-properties page-properties"
+        "page-editor-panel page-editor-panel"
+        "page-editor tags"
+        "bottom bottom";
+}
+
+#pages .page-editor-grid::before {
+	content: "";
+	position: absolute;
+	left: 3px;
+	top: 3px;
+	z-index: 1;
+	width: 7px;
+	height: 7px;
+	border-radius: 50%;
+	
+}
+
+#pages .page-editor-grid[data-changed="true"]::before {
+    background-color: var(--changes);
+}
+
+
+
+
+
+
+
+
+
+
+#pages .page-properties {
+    grid-area: page-properties;
+    display: grid;
+    padding: 0.5rem 0.5rem 1rem 0.5rem;
+}
+
+@media (max-width: 414px) {
+    #pages .page-properties {
+        grid-row: 3/-1;
+        z-index: 111;
+        background-color: var(--bg-3);
+        align-content: start;
+        overflow-y: auto;
+    }
+}
+
+
+
+
+#pages .page-properties.hidden {
+    display: none;
+}
+
+
+/* Options */
+#pages .page-properties select {
+    appearance: none;
+    background-repeat: no-repeat;
+    background-position: right .37rem center;
+    background-size: 16px 12px;
+}
+
+#pages .page-properties select {
+    background-image: var(--select-icon);
+}
+
+
+
+#pages .page-properties .url-input {
+    display: grid;
+    grid-template-columns: 1fr 2.7rem;
+}
+#pages .page-properties .url-input > input {
+    width: 100%;
+    grid-column: 1/-1;
+    grid-row: 1/-1;
+    padding-right: 3rem;
+}
+#pages .page-properties .url-input .url-translit {
+    display: grid;
+    grid-column: 2/3;
+    grid-row: 1/-1;
+    cursor: pointer;
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 54%;
+    background-image: var(--icon-link);
+}
+
+#pages .page-properties input,
+#pages .page-properties textarea {
+    border-radius: 4px;
+    font-size: 0.94rem;
+    padding: 0 0.54rem;
+    min-height: 30px;
+    height: 100%;
+    background-color: var(--bg-4);
+    border: 1px solid var(--bg-4);
+    color: var(--text);
+}
+
+#pages .page-properties textarea {
+    font-family: var(--sans-serif);
+    font-size: 0.94rem;
+    line-height: 1.3em;
+    resize: vertical;
+    min-height: 3.75rem;
+}
+
+#pages .page-properties select, #pages .page-properties input[type=date], #pages .page-properties input[type=time] {
+    -moz-padding-start: 4px;
+    -moz-padding-end: 4px;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+@media (max-width: 1023px) {
+    #pages .page-editor-grid {
+        grid-template-columns: 1fr 0;
+    }
+    #pages .page-editor-grid.tags-opened {
+        grid-template-columns: 1fr max-content;
+    }
+    #pages .tags {
+        z-index: 3;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .page-editor-grid {
+        grid-template-columns: 1fr 0;
+    }
+    #pages .page-editor-grid.tags-opened {
+        grid-template-columns: 1fr max-content;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .page-editor-grid {
+        border-radius: 5px;
+    }
+}
+
+#pages .page-editor-header {
+    grid-area: page-editor-header;
+    display: grid;
+}
+@media (max-width: 1023px) {
+    #pages .page-editor-header {
+        grid-template-areas:
+        "close title";
+        grid-template-columns: auto 1fr;
+        column-gap: 1rem;
+        row-gap: 0.5rem;
+        padding: 10px 10px 0 10px;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .page-editor-header {
+        padding: 10px 10px 0 10px;
+        grid-template-columns: max-content 1fr;
+        column-gap: 1rem;
+    }
+}
+
+#pages .close-page-button {
+    position: relative;
+    cursor: pointer;
+    width: 2rem;
+    height: 2rem;
+    border-radius: 3px;
+    background-color: var(--bg-3);
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 40%;
+    background-image: var(--icon-close);
+}
+#pages .close-page-button:hover {
+    background-color: var(--bg-4);
+}
+@media (max-width: 1023px) {
+    #pages .close-page-button {
+        grid-area: close;
+    }
+}
+
+#pages .save-page-button {
+    cursor: pointer;
+    user-select: none;
+}
+
+#pages .page-editor-buttons .save-page-button.saved {
+    color: var(--saved);
+}
+#pages .page-editor-buttons .save-page-button.error {
+    color: var(--error);
+}
+
+
+#pages .open-properties {
+    cursor: pointer;
+    user-select: none;
+}
+#pages .page-editor-grid.properties .open-properties {
+    color: var(--buttons-open);
+}
+
+#pages .page-editor-header a {
+    color: var(--link);
+    text-decoration: none;
+    width: fit-content;
+    align-self: center;
+    font-weight: 600;
+}
+#pages .page-editor-header a:hover {
+    color: var(--link-hover);
+    text-decoration: none;
+}
+
+@media (max-width: 1023px) {
+    .page-editor-title {
+        grid-area: title;
+    }
+}
+
+#pages .page-editor-buttons {
+    display: grid;
+    grid-area: page-editor-buttons;
+    grid-auto-flow: column;
+    gap: 0.7em;
+    justify-content: start;
+    overflow-x: auto;
+    overflow-y: hidden;
+    font-size: 1rem;
+    color: var(--buttons-font);
+}
+@media (max-width: 1023px) {
+    #pages .page-editor-buttons {
+        padding: 10px 10px;
+    }
+}
+@media (min-width: 1024px) {
+    #pages .page-editor-buttons {
+        padding: 10px 14px;
+    }
+    #pages .page-editor-buttons > div:hover {
+        color: var(--buttons-hover);
+    }
+}
+#pages .page-editor-buttons.hidden {
+	display: none;
+}
+
+
+#pages .open-mediateka {
+    cursor: pointer;
+    user-select: none;
+}
+#pages .page-editor-grid.mediateka .open-mediateka {
+    color: var(--buttons-open);
+}
+
+
+#pages .tags-helper {
+    cursor: pointer;
+    user-select: none;
+}
+#pages .page-editor-grid.tags-opened .tags-helper {
+    color: var(--buttons-open);
+}
+
+
+#pages .codemirror-replace {
+    cursor: pointer;
+    user-select: none;
+}
+
+
+#pages .page-editor-buttons a {
+    color: var(--uni-editor);
+    text-decoration: none;
+}
+@media (min-width: 1024px) {
+    #pages .page-editor-buttons a:hover {
+        color: var(--buttons-hover);
+    }
+}
+
+
+#pages .page-editor-panel {
+    display: grid;
+    grid-area: page-editor-panel;
+    padding:10px;
+    position: relative;
+    max-width: 100%;
+}
+#pages .page-editor-panel.hidden {
+    display: none;
+}
+
+#pages .upload-progress {
+    position: absolute;
+    width: 0%;
+    height: 3px;
+    background-color: tomato;
+}
+@keyframes barberpole {
+    100% {
+        background-position: 100% 100%;
+    }
+}
+
+#pages .mediateka-grid {
+    display: grid;
+    grid-template-rows: auto auto;
+    grid-template-columns: 1fr;
+    row-gap: 10px;
+    grid-template-areas:
+      "mediateka-files-hscroll"
+      "mediateka-buttons";
+}
+#pages .mediateka-grid.hidden {
+	display: none;
+}
+
+#pages .mediateka-files-hscroll {
+    grid-area: mediateka-files-hscroll;
+    overflow-x: auto;
+    overflow-y: hidden;
+    padding-bottom: 4px;
+}
+
+#pages .mediateka-files-grid {
+    display: grid;
+    column-gap: 5px;
+    grid-auto-columns: 130px;
+    grid-auto-flow: column;
+}
+
+#pages .file-block {
+    height: 130px;
+    background-color: var(--bg-2);
+    box-shadow: 0 2px 3px 0 #0000004d;
+    border: 2px solid var(--br-3);
+    border-radius: 8px;
+    overflow: hidden;
+    position: relative;
+}
+	
+#pages .file-block:hover {
+    border: 2px solid var(--br-active);
+}
+#pages .file-block.active-file {
+    border: 2px solid var(--br-active);
+}
+
+#pages .file-block img {
+    object-fit: contain;
+    width: 100%;
+    height: 100%;
+    display: block;
+}
+
+#pages .file-block .media-name {
+    width: 100%;
+	font-size: 60%;
+	position: absolute;
+	padding: 0 2%;
+	overflow: hidden;
+    color: var(--text);
+    word-break: break-all;
+    background-color: #0005;
+}
+
+#pages .file-block input[type="checkbox"] {
+    position: absolute;
+    right: 3px;
+    top: 5px;
+    z-index: 1;
+    width: 1rem;
+    height: 1rem;
+    display: none;
+    border-color: var(--orange);
+}
+
+#pages .file-block:hover input[type="checkbox"] {
+    display: block;
+}
+
+#pages .file-block input[type="checkbox"]:checked {
+    display: block;
+}
+
+#pages .file-block .ext {
+    position: absolute;
+    z-index: 12;
+    bottom: 3px;
+    left: 3px;
+    font-size: 12px; 
+    padding: 1px 5px 1px 3px;
+    border-radius: 3px;
+    cursor: default;
+    background-color: var(--bg-4);
+    color: var(--ext);
+}
+
+#pages .mediateka-buttons {
+    display: grid;
+    grid-area: mediateka-buttons;
+}
+@media (max-width: 1023px) {
+    #pages .mediateka-buttons {
+        grid-template-rows: auto;
+        grid-template-columns: 1fr 1fr;
+        gap: 0.9rem;
+        grid-template-areas:
+            "upload-files del-uploaded-files"
+            "link-file link-file";
+    }
+}
+@media (min-width: 1024px) {
+    #pages .mediateka-buttons {
+        grid-template-columns: auto 1fr auto;
+        column-gap:15px;
+        grid-template-areas: "upload-files link-file del-uploaded-files";
+    }
+}
+#pages .upload-files {
+    grid-area: upload-files;
+    min-height: 2.5rem;
+    position: relative;
+    background-color: var(--bg-2);
+    user-select: none;
+
+}
+#pages .mediateka-buttons .inputfile {
+    width: 100%;
+    opacity: 0;
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    overflow: hidden;
+}
+#pages .mediateka-buttons .inputfile + label {
+    height: 100%;
+    padding: 11px 10px 0 10px;
+    display: flex;
+    cursor: pointer;
+    justify-content: center;
+    border-radius: 4px;
+    font-size: 1rem;
+    line-height: 1;
+    color: var(--buttons-font);
+}
+
+#pages .link-file {
+    grid-area: link-file;
+    display: grid;
+    grid-template-columns: 1fr auto;
+    column-gap: 1rem;
+    line-height: 2;
+    min-height: 2.5rem;
+    align-items: center;
+    padding-left: 10px;
+    padding-right: 4px;
+    border-radius: 5px;
+    font-size: 1rem;
+    word-break: break-all;
+    background-color: var(--bg-2);
+    color: var(--buttons-font);
+}
+#pages .link-file a {
+    color: var(--link);
+    text-decoration: none;
+    border-bottom: 1px dashed;
+}
+#pages .link-file-tag {
+    line-height: 1.4;
+}
+#pages .link-file-copy-btn {
+    cursor: pointer;
+    z-index: 1;
+    font-size: 0.8rem;
+    padding: 0 0.4rem 1px 0.4rem;
+    border-radius: 0.2rem;
+    display: flex;
+    min-height: 2rem;
+    height: calc(100% - 8px);
+    user-select: none;
+    justify-content: center;
+    align-items: center;
+    background-color: var(--bg-3);
+}
+
+#pages .del-uploaded-files {
+    grid-area: del-uploaded-files;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    padding: 0 10px 2px 10px;
+    border-radius: 4px;
+    font-size: 1rem;
+    cursor: pointer;
+    line-height: 1;
+    background-color: var(--orange);
+    color: var(--white);
+    user-select: none;
+}
+#pages .del-uploaded-files:hover {
+    box-shadow: 0 0 0 0.25rem var(--focus-orange);
+}
+
+#pages .del-uploaded-files.disabled {
+    background-color: var(--bg-2);
+    color: var(--font-bg);
+    cursor: context-menu;
+}
+#pages .del-uploaded-files.disabled:hover {
+    box-shadow: unset;
+}
+
+/* теги, в которые заворачивается html-код */
+#pages .page-editor-grid > .tags {
+    grid-area: tags;
+    display: none;
+    width: max-content;
+    overflow-y: auto;
+    background-color: var(--tags-bg);
+    position: relative;
+    scrollbar-width: none;
+}
+#pages .page-editor-grid > .tags::-webkit-scrollbar {
+    display: none;
+}
+#pages .page-editor-grid.tags-opened > .tags {
+    display: block;
+}
+
+#pages .tags-grid {
+    display: grid;
+    position: relative;
+    padding: 0.3rem 0;
+}
+
+#pages .tags-grid > div {
+    display: flex;
+    padding: 7px 15px 7px 15px;
+    color: var(--tags-font);
+    font-size: 0.9rem;
+    cursor: pointer;
+    justify-content: space-between;
+}
+
+#pages .tags-grid > div .tag {
+    color: var(--windows-font);
+}
+#pages .tags-grid > div:hover {
+    background-color: var(--codemirror-bg);
+}
+
+#pages .no-database, #pages .no-tables {
+    color: var(--windows-font);
+    border-radius: 0.4rem;
+}
+
+
+#pages .page-editor {
+    grid-area: page-editor;
+}
+@media (max-width: 1023px) {
+    #pages .page-editor {
+        grid-column: 1/-1;
+    }
+}
+body .CodeMirror {
+    min-height: 100%;
+    max-height: 100%;
+    height: 2rem;
+    font-family: var(--monospace);
+    font-weight: normal;
+    font-size: 1.04rem;
+}
+body .CodeMirror-dialog input {
+    font-family: var(--monospace);
+    font-size: 100%;
+}
+
+body .CodeMirror-wrap pre.CodeMirror-line, body .CodeMirror-wrap pre.CodeMirror-line-like {
+    word-wrap: break-word;
+    white-space: pre-wrap;
+    word-break: break-all;
+}
+
+/* Codemirror dark and light theme Start */
+.cm-s-default.CodeMirror {
+    background-color: var(--codemirror-bg);
+    color: var(--codemirror-text);
+}
+.cm-s-default .CodeMirror-gutters {
+    background-color: var(--codemirror-bg);
+    color: var(--codemirror-numbeslines);
+    border: none;
+}
+/* Codemirror light theme Start */
+.light .CodeMirror .CodeMirror-guttermarker,
+.light .CodeMirror .CodeMirror-guttermarker-subtle,
+.light .CodeMirror .CodeMirror-linenumber {
+    color: var(--codemirror-numbeslines);
+}
+.light .CodeMirror .CodeMirror-cursor {
+    border-left: 2px solid #ff5100;
+}
+.light .CodeMirror div.CodeMirror-selected {
+    background-color: #0663d2;
+}
+.light .CodeMirror .cm-searching {
+    background-color: rgb(112 112 100 / 30%);
+}
+.light .CodeMirror-focused div.CodeMirror-selected {
+    background-color: #0663d2;
+}
+.light .CodeMirror .CodeMirror-line::selection,
+.light .CodeMirror .CodeMirror-line>span::selection,
+.light .CodeMirror .CodeMirror-line>span>span::selection {
+    background-color: rgba(128, 203, 196, 0.2);
+}
+.light .CodeMirror .CodeMirror-line::-moz-selection,
+.light .CodeMirror .CodeMirror-line>span::-moz-selection,
+.light .CodeMirror .CodeMirror-line>span>span::-moz-selection {
+    background-color: rgba(128, 203, 196, 0.2);
+}
+.light .CodeMirror .CodeMirror-activeline-background {
+    background-color: #f5f1efb5;
+}
+.light .CodeMirror .cm-keyword {
+    color: #C792EA;
+}
+.light .CodeMirror .cm-operator {
+    color: #00a5e8;
+}
+.light .CodeMirror .cm-variable-2 {
+    color: #373737;
+}
+.light .CodeMirror .cm-variable-3,
+.light .CodeMirror .cm-type {
+    color: #f07178;
+}
+.light .CodeMirror .cm-builtin {
+    color: #ffa706;
+}
+.light .CodeMirror .cm-atom {
+    color: #F78C6C;
+}
+.light .CodeMirror .cm-number {
+    color: #FF5370;
+}
+.light .CodeMirror .cm-def {
+    color: #03A9F4;
+}
+.light .CodeMirror .cm-string {
+    color: #71b199;
+}
+.light .CodeMirror .cm-string-2 {
+    color: #f07178;
+}
+.light .CodeMirror .cm-comment {
+    color: #546E7A;
+}
+.light .CodeMirror .cm-variable {
+    color: #f07178;
+}
+.light .CodeMirror .cm-tag {
+    color: #b6745c;
+}
+.light .CodeMirror .cm-meta {
+    color: #ff7600;
+}
+.light .CodeMirror .cm-attribute {
+    color: #C792EA;
+}
+.light .CodeMirror .cm-property {
+    color: #373737;
+}
+.light .CodeMirror .cm-qualifier {
+    color: #c868e9;
+}
+.light .CodeMirror .cm-variable-3,
+.light .CodeMirror .cm-type {
+    color: #f71d1d;
+}
+.light .CodeMirror .cm-error {
+    color: rgba(255, 255, 255, 1.0);
+    background-color: #FF5370;
+}
+.light .CodeMirror .CodeMirror-matchingbracket {
+    text-decoration: underline;
+    color: #0004ff !important;
+}
+/* Codemirror dark theme Start */
+.dark .CodeMirror .CodeMirror-guttermarker,
+.dark .CodeMirror .CodeMirror-guttermarker-subtle,
+.dark .CodeMirror .CodeMirror-linenumber {
+    color: var(--codemirror-numbeslines);
+}
+.dark .CodeMirror .CodeMirror-cursor {
+    border-left: 2px solid #FFCC00;
+}
+.dark .CodeMirror div.CodeMirror-selected {
+    background-color: #0663d2;
+}
+.dark .CodeMirror .cm-searching {
+    background-color: rgb(112 112 100 / 30%);
+}
+.dark .CodeMirror-focused div.CodeMirror-selected {
+    background-color: #0663d2;
+}
+.dark .CodeMirror .CodeMirror-line::selection,
+.dark .CodeMirror .CodeMirror-line>span::selection,
+.dark .CodeMirror .CodeMirror-line>span>span::selection {
+    background-color: rgba(128, 203, 196, 0.2);
+}
+.dark .CodeMirror .CodeMirror-line::-moz-selection,
+.dark .CodeMirror .CodeMirror-line>span::-moz-selection,
+.dark .CodeMirror .CodeMirror-line>span>span::-moz-selection {
+    background-color: rgba(128, 203, 196, 0.2);
+}
+.dark .CodeMirror .CodeMirror-activeline-background {
+    background-color: #2c2929b5;
+}
+.dark .CodeMirror .cm-keyword {
+    color: #C792EA;
+}
+.dark .CodeMirror .cm-operator {
+    color: #89DDFF;
+}
+.dark .CodeMirror .cm-variable-2 {
+    color: #EEFFFF;
+}
+.dark .CodeMirror .cm-variable-3,
+.dark .CodeMirror .cm-type {
+    color: #f07178;
+}
+.dark .CodeMirror .cm-builtin {
+    color: #FFCB6B;
+}
+.dark .CodeMirror .cm-atom {
+    color: #F78C6C;
+}
+.dark .CodeMirror .cm-number {
+    color: #FF5370;
+}
+.dark .CodeMirror .cm-def {
+    color: #82AAFF;
+}
+.dark .CodeMirror .cm-string {
+    color: #94af6e;
+}
+.dark .CodeMirror .cm-string-2 {
+    color: #f07178;
+}
+.dark .CodeMirror .cm-comment {
+    color: #546E7A;
+}
+.dark .CodeMirror .cm-variable {
+    color: #f07178;
+}
+.dark .CodeMirror .cm-tag {
+    color: #FF5370;
+}
+.dark .CodeMirror .cm-meta {
+    color: #FFCB6B;
+}
+.dark .CodeMirror .cm-attribute {
+    color: #C792EA;
+}
+.dark .CodeMirror .cm-property {
+    color: #C792EA;
+}
+.dark .CodeMirror .cm-qualifier {
+    color: #DECB6B;
+}
+.dark .CodeMirror .cm-variable-3,
+.dark .CodeMirror .cm-type {
+    color: #DECB6B;
+}
+.dark .CodeMirror .cm-error {
+    color: rgba(255, 255, 255, 1.0);
+    background-color: #FF5370;
+}
+.dark .CodeMirror .CodeMirror-matchingbracket {
+    text-decoration: underline;
+    color: white !important;
+}
+/* Codemirror dark theme End. */
+
+
+#lbox-window {
+    position: fixed;
+    z-index: 999;
+    cursor: pointer;
+    background-color: var(--lbox-window);
+    display: grid;
+    height: 100vh;
+    width: 100vw;
+    grid-template-areas: "lightbox";
+}
+#lbox-window img, #lbox-window video, #lbox-window audio {
+    max-width: 100%;
+    max-height: 100%;
+    box-shadow: 0 3px 7px 0 #0000004d;
+    grid-area: lightbox;
+    align-self: center;
+    justify-self: center;
+    overflow: hidden;
+}
+
+#lbox-window audio {
+    width: 97%;
+    height: 54px;
+}
+
+
+
+
+
+
+/* Pages Utils */
+
+#pages-utils {
+    display: grid;
+    gap: 1rem;
+    overflow-y: auto;
+    max-height: 100%;
+}
+
+@media (max-width: 1023px) {
+    #pages-utils {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+    }
+}
+
+@media (min-width: 1024px) {
+    #pages-utils {
+        padding: 1rem;
+    }
+}
+
+#pages-utils .pages-utils-main {
+    background-color: var(--windows);
+    background-image: var(--noise);
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+}
+@media (max-width: 1023px) {
+    #pages-utils .pages-utils-main {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #pages-utils .pages-utils-main {
+        padding: 1rem;
+    }
+}
+
+#pages-utils .replace-util {
+    display: grid;
+    gap: 1rem;
+}
+#pages-utils .replace-util > p {
+    color: var(--text);
+    font-size: 1rem;
+}
+
+#pages-utils .replace-inputs {
+    display: grid;
+}
+@media (max-width: 1023px) {
+    #pages-utils .replace-inputs {
+        gap: 0.5rem;
+    }
+}
+@media (min-width: 1024px) {
+    #pages-utils .replace-inputs {
+        grid-template-columns: 1fr 1fr;
+        gap: 1rem;
+    }
+}
+
+#pages-utils .regex, #pages-utils .replace, #pages-utils .replace_id_col, #pages-utils .replace_column, #pages-utils .replace_table {
+    display: grid;
+    row-gap: 0.2rem;
+}
+
+#pages-utils .regex .title, #pages-utils .replace .title, #pages-utils .replace_id_col, #pages-utils .replace_column, #pages-utils .replace_table {
+    font-size: 1rem;
+    color: var(--windows-font);
+}
+
+
+#pages-utils .replace-inputs input {
+    border-radius: 4px;
+    font-size: 0.875rem;
+    padding: 0 0.54rem;
+    min-height: 35px;
+    width: 100%;
+    color: var(--input-font);
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+}
+
+#pages-utils .replace-btn {
+    width: fit-content;
+    display: flex;
+    justify-content: center;
+    align-items: center;
+    padding: 0.44rem 0.74rem 0.47rem 0.74rem;
+    min-height: 35px;
+    border-radius: 0.25rem;
+    background-color: var(--button-bg);
+    border: 1px solid var(--button-border);
+    color: var(--windows-font);
+    font-size: 0.875rem;
+    cursor: pointer;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/rss.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,232 @@
+#rss {
+    display: grid;
+    height: 100%;
+    overflow-y: auto;
+    grid-auto-rows: max-content;
+    row-gap: 1rem;
+}
+#rss form {
+    display: grid;
+    gap: 1rem;
+}
+
+@media (max-width: 1023px) {
+    #rss {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+        display: flex; /*Samsung Browser - padding-bottom*/
+        flex-direction: column; /*Samsung Browser - padding-bottom*/
+    }
+    #rss form {
+        grid-template-columns: 1fr;
+        grid-template-areas: 
+            "xml-wrapper-hidden" 
+            "xml-static-dynamic" 
+            "xml-static-cron";
+    }
+}
+@media (min-width: 1024px) {
+    #rss {
+        padding: 1rem;
+    }
+    #rss form {
+        grid-template-columns: 1fr 1fr;
+        grid-template-areas: 
+            "xml-wrapper-hidden xml-static-dynamic" 
+            "xml-wrapper-hidden xml-static-cron";
+    }
+}
+
+@media (min-width: 1024px) {
+    #rss .xml-wrapper-hidden {
+        grid-area: xml-wrapper-hidden;
+    }
+    #rss .xml-static-dynamic {
+        grid-area: xml-static-dynamic;
+    }
+    #rss .xml-static-cron {
+        grid-area: xml-static-cron;
+    }
+}
+
+#rss .xml-wrapper-hidden, #rss .xml-static-dynamic, #rss .xml-static-cron {
+    display: grid;
+    grid-auto-rows: max-content;
+    row-gap: 0.7rem;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+}
+.xml-wrapper-hidden div, .xml-static-dynamic div, .xml-static-cron div {
+    color: var(--windows-font);
+}
+
+@media (max-width: 1023px) {
+    #rss .xml-wrapper-hidden, #rss .xml-static-dynamic, #rss .xml-static-cron {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #rss .xml-wrapper-hidden, #rss .xml-static-dynamic, #rss .xml-static-cron {
+        padding: 1rem;
+    }
+}
+
+#rss textarea {
+    line-height: 1.3em;
+    resize: vertical;
+    width: 100%;
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+    border-radius: 4px;
+    font-family: var(--monospace);
+    font-size: 1rem;
+    color: var(--input-font);
+    padding: 0 8px;
+    min-height: 30px;
+}
+
+#rss form div > input {
+    border-radius: 4px;
+    font-size: 0.875rem;
+    padding: 0 0.54rem;
+    min-height: 35px;
+    width: 100%;
+    color: var(--input-font);
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+}
+
+#rss form div > button {
+    width: fit-content;
+}
+
+#rss .save_2_col {
+	display: grid;
+}
+#rss .save_2_col > button {
+	grid-area: button;
+}
+#rss .save_2_col > div {
+	grid-area: div;
+}
+@media (max-width: 767px) {
+    #rss .save_2_col {
+        grid-template-columns: 1fr;
+        row-gap: 0.7rem;
+    }
+    #rss .save_2_col {
+        grid-template-areas:
+        "div"
+        "button";
+    }
+}
+@media (min-width: 768px) {
+    #rss .save_2_col {
+        grid-template-areas:
+        "button div";
+        grid-template-columns: auto 1fr;
+        column-gap: 1rem;
+    }
+}
+
+#rss .select-dropdown {
+    position: relative;
+}
+#rss .select-dropdown ul.list-search {
+    height: 0;
+    background-color: var(--bg-3);
+	display: grid;
+	margin: 0;
+    margin-top: 2px;
+	padding: 0;
+	overflow-y: auto;
+	max-height: 17rem;
+	overscroll-behavior: contain;
+    position: absolute;
+    width: 100%;
+    border-radius: 4px;
+}
+#rss .select-dropdown.open ul.list-search {
+    height: auto;
+    border: 2px solid var(--bg-4);
+}
+#rss .select-dropdown .list-search li {
+	display: block;
+	list-style-type: none;
+	padding: 0.4rem 0.44rem;
+	cursor: pointer;
+	font-size: 0.94rem;
+	text-align: left;
+}
+#rss .select-dropdown .list-search li:hover {
+	background-color: var(--menu-item-list-search-li-hover-active);
+}
+
+#rss .xml-static-dynamic input[type="text"] {
+    color: var(--input-font);
+}
+#rss .xml-static-dynamic label input[type="radio"] {
+    cursor: pointer;
+    display: inline-block;
+    margin-right: 0.3rem;
+    border-radius: 50%;
+    width: 0.73rem;
+    height: 0.73rem;
+    background-color: var(--bg-4);
+    transform: translate(0, 0);
+    appearance: none;
+}
+#rss .xml-static-dynamic label input:checked {
+    background-color: var(--orange);
+    border-color: var(--orange);
+    box-shadow: 0 0 0 0.25rem var(--focus-orange);
+}
+
+#rss .xml-static-dynamic label {
+    cursor: pointer;
+    line-height: 1.1em;
+    font-size: 1rem;
+    color: var(--link);
+    user-select: none;
+}
+
+#rss .xml-static-cron p, #rss .xml-static-dynamic p {
+    font-size: 1rem;
+    color: var(--text);
+}
+#rss .xml-static-cron input[type="text"], #rss .xml-static-dynamic input[type="text"] {
+    max-width: 70px;
+    border-radius: 4px;
+    font-size: 0.875rem;
+    padding: 0 0.54rem;
+    min-height: 35px;
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+    color: var(--input-font);
+    text-align: center;
+}
+#rss .rss {
+    grid-auto-rows: max-content;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+    color: var(--text);
+    font-size: 1rem;
+}
+@media (max-width: 1023px) {
+    #rss .rss {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #rss .rss {
+        padding: 1rem;
+    }
+}
+#rss .rss a {
+    color: var(--link);
+    text-decoration: none;
+    border-bottom: 1px solid;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/sitemap.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,255 @@
+#sitemap {
+    display: grid;
+    height: 100%;
+    overflow-y: auto;
+    grid-auto-rows: max-content;
+    row-gap: 1rem;
+}
+#sitemap form {
+    display: grid;
+    gap: 1rem;
+}
+
+@media (max-width: 1023px) {
+    #sitemap {
+        padding: 1rem 0.4rem 1rem 0.4rem;
+        display: flex; /*Samsung Browser - padding-bottom*/
+        flex-direction: column; /*Samsung Browser - padding-bottom*/
+    }
+    #sitemap form {
+        grid-template-columns: 1fr;
+        grid-template-areas: 
+            "xml-wrapper-hidden" 
+            "xml-wrapper-link" 
+            "xml-static-dynamic" 
+            "xml-static-cron";
+    }
+}
+@media (min-width: 1024px) {
+    #sitemap {
+        padding: 1rem;
+    }
+    #sitemap form {
+        grid-template-columns: 1fr 1fr;
+        grid-template-areas: 
+            "xml-wrapper-hidden xml-wrapper-link" 
+            "xml-static-dynamic xml-static-cron";
+    }
+}
+
+#sitemap .xml-wrapper-hidden, #sitemap .xml-wrapper-link, #sitemap .xml-static-dynamic, #sitemap .xml-static-cron {
+    display: grid;
+    grid-auto-rows: max-content;
+    row-gap: 0.7rem;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+}
+#sitemap .xml-static-cron {
+    grid-template-rows: auto auto 1fr auto;
+}
+#sitemap .xml-wrapper-hidden div, #sitemap .xml-wrapper-link div, #sitemap .xml-static-dynamic div, #sitemap .xml-static-cron div, #sitemap .sitemap-manual div {
+    color: var(--windows-font);
+}
+
+@media (max-width: 1023px) {
+    #sitemap .xml-wrapper-hidden, #sitemap .xml-wrapper-link, #sitemap .xml-static-dynamic, #sitemap .xml-static-cron {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #sitemap .xml-wrapper-hidden, #sitemap .xml-wrapper-link, #sitemap .xml-static-dynamic, #sitemap .xml-static-cron {
+        padding: 1rem;
+    }
+}
+
+#sitemap textarea {
+    line-height: 1.3em;
+    resize: vertical;
+    width: 100%;
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+    border-radius: 4px;
+    font-family: var(--monospace);
+    font-size: 1rem;
+    color: var(--input-font);
+    padding: 0 8px;
+    min-height: 30px;
+}
+
+/*#sitemap input[type="submit"] {
+    cursor: pointer;
+    width: max-content;
+}*/
+#sitemap form div > input {
+    border-radius: 4px;
+    font-size: 0.875rem;
+    padding: 0 0.54rem;
+    min-height: 35px;
+    width: 100%;
+    color: var(--input-font);
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+}
+
+#sitemap form div > button {
+    width: fit-content;
+}
+
+#sitemap .save_2_col {
+	display: grid;
+}
+#sitemap .save_2_col > button {
+	grid-area: button;
+}
+#sitemap .save_2_col > div {
+	grid-area: div;
+}
+@media (max-width: 767px) {
+    #sitemap .save_2_col {
+        grid-template-columns: 1fr;
+        row-gap: 0.7rem;
+    }
+    #sitemap .save_2_col {
+        grid-template-areas:
+        "div"
+        "button";
+    }
+}
+@media (min-width: 768px) {
+    #sitemap .save_2_col {
+        grid-template-areas:
+        "button div";
+        grid-template-columns: auto 1fr;
+        column-gap: 1rem;
+    }
+}
+
+
+#sitemap .select-dropdown {
+    position: relative;
+}
+#sitemap .select-dropdown ul.list-search {
+    height: 0;
+    background-color: var(--bg-3);
+	display: grid;
+	margin: 0;
+    margin-top: 2px;
+	padding: 0;
+	overflow-y: auto;
+	max-height: 17rem;
+	overscroll-behavior: contain;
+    position: absolute;
+    width: 100%;
+    border-radius: 4px;
+}
+#sitemap .select-dropdown.open ul.list-search {
+    height: auto;
+    border: 2px solid var(--bg-4);
+}
+#sitemap .select-dropdown .list-search li {
+	display: block;
+	list-style-type: none;
+	padding: 0.4rem 0.44rem;
+	cursor: pointer;
+	font-size: 0.94rem;
+	text-align: left;
+}
+#sitemap .select-dropdown .list-search li:hover {
+	background-color: var(--menu-item-list-search-li-hover-active);
+}
+
+#sitemap .xml-static-dynamic input[type="text"] {
+    color: var(--input-font);
+}
+#sitemap .xml-static-dynamic label input[type="radio"] {
+    cursor: pointer;
+    display: inline-block;
+    margin-right: 0.3rem;
+    border-radius: 50%;
+    width: 0.73rem;
+    height: 0.73rem;
+    background-color: var(--bg-4);
+    transform: translate(0, 0);
+    appearance: none;
+}
+#sitemap .xml-static-dynamic label input:checked {
+    background-color: var(--orange);
+    border-color: var(--orange);
+    box-shadow: 0 0 0 0.25rem var(--focus-orange);
+}
+
+#sitemap .xml-static-dynamic label {
+    cursor: pointer;
+    line-height: 1.1em;
+    font-size: 1rem;
+    color: var(--link);
+    user-select: none;
+}
+
+#sitemap .xml-static-cron p {
+    font-size: 1rem;
+    color: var(--text);
+}
+#sitemap .xml-static-cron input[type="text"] {
+    max-width: 70px;
+    border-radius: 4px;
+    font-size: 0.875rem;
+    padding: 0 0.54rem;
+    min-height: 35px;
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+    color: var(--input-font);
+    text-align: center;
+}
+#sitemap .sitemap {
+    grid-auto-rows: max-content;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+    color: var(--text);
+    font-size: 1rem;
+}
+@media (max-width: 1023px) {
+    #sitemap .sitemap {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #sitemap .sitemap {
+        padding: 1rem;
+    }
+}
+#sitemap .sitemap a {
+    color: var(--link);
+    text-decoration: none;
+    border-bottom: 1px solid;
+}
+
+#sitemap .sitemap-manual {
+    display: grid;
+    grid-auto-rows: max-content;
+    gap: 1rem;
+    box-shadow: 0 2px 3px 0 rgb(0 0 0 / 20%);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+}
+
+#sitemap .sitemap-manual p {
+    font-size: 1rem;
+    color: var(--text);
+}
+
+@media (max-width: 1023px) {
+    #sitemap .sitemap-manual {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #sitemap .sitemap-manual {
+        padding: 1rem;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/css/template.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,468 @@
+#template {
+    display: grid;
+    height: 100%;
+}
+
+#template > .settings {
+    display: grid;
+    gap: 1rem;
+    overflow-y: auto;
+    grid-column: 1/-1;
+    grid-row: 1/-1;
+}
+
+@media (max-width: 1023px) {
+#template > .settings {
+        grid-template-areas: 
+            "template-install"
+            "template-switch"
+            "template-files"
+            "template-manual"
+            "template-headers"
+            "milk";
+        grid-template-rows: auto auto auto auto 1fr;
+        padding: 1rem 0.4rem 1rem 0.4rem;
+        display: grid;
+    }
+}
+
+@media (min-width: 1024px) {
+    #template > .settings {
+        grid-template-areas: 
+            "template-install template-headers template-manual"
+            "template-switch  template-headers template-manual"
+            "template-files   template-files   template-files"
+            "milk             milk             milk";
+        grid-template-columns: 17rem 1fr 1fr;
+        grid-template-rows: auto auto auto 1fr;
+        padding: 1rem;
+    }
+}
+
+#template .template {
+    grid-area: template-switch;
+    display: grid;
+    align-content: start;
+    row-gap: 1rem;
+    box-shadow: var(--shadows);
+    background-color: var(--windows);
+    background-image: var(--noise);
+    border-radius: 0.3rem;
+}
+
+#template .template label {
+    display: grid;
+    grid-template-columns: auto 1fr;
+    column-gap: 0.5rem;
+    cursor: pointer;
+    line-height: 1.3;
+    color: var(--windows-font);
+    user-select: none;
+}
+
+#template .template form {
+    display: grid;
+    row-gap: 1rem;
+}
+
+@media (max-width: 1023px) {
+    #template .template {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #template .template {
+        padding: 1rem;
+    }
+}
+
+#template form > div {
+    position: relative;
+    color: var(--windows-font);
+}
+
+#template .template-install {
+    grid-area: template-install;
+    padding: 10px;
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+}
+#template .upload_dnd {
+    display: grid;
+    position: relative;
+    text-align: center;
+    padding: 0.4rem 0.7rem 0.5rem 0.7rem;
+	white-space: nowrap;
+	cursor: pointer;
+	border-radius: 0.3rem;
+    background-color: var(--button-bg);
+	color: var(--windows-font);
+    font-size: 1rem;
+    justify-content: center;
+    display: block;
+}
+#template .upload_dnd #template-upload {
+	width: 100%;
+	height: 100%;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+	opacity: 0;
+	overflow: hidden;
+	position: absolute;
+	z-index: 7;
+    cursor: pointer;
+}
+
+
+#template .template-headers {
+    grid-area: template-headers;
+    display: grid;
+    grid-template-rows: auto 1fr auto;
+    padding: 1rem;
+    row-gap: 0.7rem;
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+}
+#template .template-headers textarea {
+    line-height: 1.3em;
+    resize: none;
+    background-color: var(--input-bg);
+    border: 2px solid var(--input-border);
+    border-radius: 4px;
+    font-family: var(--monospace);
+    font-size: 1rem;
+    color: var(--input-font);
+    padding: 0 8px;
+    min-height: 30px;
+}
+
+#template .template-manual {
+    grid-area: template-manual;
+    display: grid;
+    grid-auto-rows: max-content;
+    gap: 1rem;
+    border-radius: 0.3rem;
+    box-shadow: var(--shadows);
+    background-color: var(--windows);
+    background-image: var(--noise);
+}
+#template .template-manual div {
+    color: var(--windows-font);
+}
+#template .template-manual p {
+    font-size: 1rem;
+    color: var(--text);
+}
+#template .template-manual p a {
+    color: var(--link);
+}
+
+@media (max-width: 1023px) {
+    #template .template-manual {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #template .template-manual {
+        padding: 1rem;
+    }
+}
+
+#template .template-files {
+    grid-area: template-files;
+    display: grid;
+    align-content: start;
+    row-gap: 1rem;
+    background-color: var(--windows);
+    background-image: var(--noise);
+    box-shadow: var(--shadows);
+    border-radius: 0.3rem;
+}
+@media (max-width: 1023px) {
+    #template .template-files {
+        padding: 1rem 0.7rem 1rem 0.7rem;
+    }
+}
+@media (min-width: 1024px) {
+    #template .template-files {
+        padding: 1rem;
+    }
+}
+
+.template-files .title {
+    color: var(--windows-font);
+    padding-bottom: 0.2rem;
+}
+.template-files .file {
+    font-size: 1rem;
+    font-family: var(--monospace);
+    color: var(--template-files-file);
+    width: fit-content;
+    display: flex; /* Mobile Browser - fit-content inline */
+    cursor: pointer;
+}
+.template-files .file:hover {
+    color: var(--template-files-file-hover);
+}
+.template-files .no-files {
+    font-size: 1rem;
+    color: var(--text);
+}
+
+
+
+/* Проверить */
+
+#template .template-editor-bg {
+    display: grid;
+    position: relative;
+    grid-row: 1/-1;
+    grid-column: 1/-1;
+    z-index: 9;
+    background-color: var(--bg-3);
+    background-image: var(--noise);
+}
+@media (min-width: 1024px) {
+    #template .template-editor-bg {
+        padding: 1rem;
+    }
+}
+#template .template-editor-bg.hidden {
+    display: none;
+}
+
+#template .template-editor-grid {
+    background-color: var(--bg-3);
+    display: grid;
+    position: relative;
+    box-shadow: 0 0 3px 0 #00000096;
+    grid-template-rows: auto 1fr 1rem;
+    grid-template-columns: 1fr auto;
+    grid-template-areas: 
+        "template-editor-header template-editor-header"
+        "template-editor        snip" 
+        "bottom                 bottom";
+}
+#template .template-editor-grid::before {
+    content: "";
+    position: absolute;
+    left: 3px;
+    top: 3px;
+    z-index: 1;
+    width: 7px;
+    height: 7px;
+    border-radius: 50%;
+}
+#template .template-editor-grid[data-changed="true"]::before {
+    background-color: var(--changes);
+}
+@media (min-width: 1024px) {
+    #template .template-editor-grid {
+        border-radius: 5px;
+    }
+}
+
+.template-editor-header {
+    grid-area: template-editor-header;
+    display: grid;
+}
+@media (max-width: 1023px) {
+    .template-editor-header {
+        grid-template-areas:
+        "close save title";
+        grid-template-columns: max-content max-content 1fr;
+        grid-column-gap: 1rem;
+        grid-row-gap: 0.5rem;
+        padding: 10px;
+    }
+}
+@media (min-width: 1024px) {
+    .template-editor-header {
+        padding: 10px;
+        grid-template-columns: max-content max-content 1fr;
+        gap: 1rem;
+    }
+}
+
+#template .snip-grid {
+    grid-area: snip;
+    display: grid;
+    gap: 15px;
+    align-content: start;
+    width: max-content;
+    overflow-y: auto;
+    background-color: var(--tags-bg);
+    position: relative;
+    scrollbar-width: none;
+}
+@media (max-width: 500px) {
+    #template .snip-grid {
+        display: none;
+    }
+}
+
+#template .snip-grid > .html > div, #template .snip-grid > .css > div, #template .snip-grid > .php > div {
+    display: flex;
+    gap: 7px;
+    padding: 7px 15px 7px 15px;
+    color: var(--tags-font);
+    font-size: 0.9rem;
+    cursor: pointer;
+    justify-content: space-between;
+}
+#template .snip-grid a {
+    padding: 7px 15px 7px 15px;
+    color: var(--link);
+    font-size: 0.9rem;
+    text-underline-offset: 0.22rem;
+    text-decoration-color: var(--link);
+}
+
+#template .html, #template .css, #template .php {
+    display: grid;
+}
+#template .html.hidden, #template .css.hidden, #template .php.hidden {
+    display: none;
+}
+
+.close-template-button {
+    position: relative;
+    cursor: pointer;
+    width: 2rem;
+    height: 2rem;
+    border-radius: 3px;
+    background-color: var(--bg-3);
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 40%;
+    background-image: var(--icon-close);
+}
+.close-template-button:hover {
+    background-color: var(--bg-4);
+}
+@media (max-width: 1023px) {
+    .close-template-button {
+        grid-area: close;
+    }
+}
+
+.save-template-button {
+    cursor: pointer;
+    width: 2rem;
+    height: 2rem;
+    position: relative;
+    background-color: var(--bg-3);
+    background-repeat: no-repeat;
+    background-position: center center;
+    background-size: 55%;
+    background-image: var(--icon-save);
+    border-radius: 3px;
+}
+.save-template-button:hover {
+    background-color: var(--bg-4);
+}
+.save-template-button.saved {
+    background-color: var(--saved-bg);
+}
+@media (max-width: 1023px) {
+    .save-template-button {
+        grid-area: save;
+        justify-self: right;
+    }
+}
+
+@media (max-width: 1023px) {
+    .template-editor-title {
+        grid-area: title;
+    }
+}
+
+.template-editor-title {
+    font-family: var(--monospace);
+    color: var(--template-files-file);
+    width: fit-content;
+    align-self: center;
+}
+
+.template-editor {
+    grid-area: template-editor;
+}
+.template-editor .CodeMirror {
+    min-height: 100%;
+    max-height: 100%;
+    height: 1rem;
+    font-family: var(--monospace);
+    font-weight: normal;
+    font-size: 1.04rem;
+}
+.CodeMirror-dialog input {
+    font-family: var(--monospace);
+    font-size: 100%;
+}
+
+#template .CodeMirror-wrap pre.CodeMirror-line, #template .CodeMirror-wrap pre.CodeMirror-line-like {
+    word-wrap: break-word;
+    white-space: pre-wrap;
+    word-break: break-all;
+}
+
+/* Select */
+#template .template-select-grid {
+    text-align: left;
+}
+#template .field-select {
+    display: grid;
+	grid-template-columns: 1fr 32px;
+	height: 100%;
+	min-height: 30px;
+	cursor: pointer;
+	background-color: var(--menu-input-bg);
+    border: 2px solid var(--menu-input-border);
+	border-radius: 4px;
+    user-select: none;
+}
+#template .field-select > .value {
+	padding: 0 0 0 0.44rem;
+    white-space: nowrap;
+    overflow: hidden;
+    line-height: 32px;
+    font-size: 1rem;
+	color: var(--text);
+}
+#template .field-select > .icon {
+    background-image: var(--select-icon);
+    background-repeat: no-repeat;
+    background-position: center;
+    background-size: 12px;
+}
+#template .template-select-grid .field-options {
+    display: grid;
+    position: absolute;
+    height: 0;
+    overflow: hidden;
+    width: 100%;
+    border-radius: 0.25rem;
+    box-shadow: 0 2px 3px 0 #00000033;
+    max-height: 17rem;
+    z-index: 7;
+}
+#template .template-select-grid .field-options.open {
+    background-color: var(--bg-3);
+    border: 2px solid var(--bg-4);
+    color: var(--text);
+    overflow: auto;
+    height: auto;
+    margin-top: 2px;
+}
+#template .template-select-grid .field-options .option {
+    padding: 0.4rem 0.44rem;
+    cursor: pointer;
+    font-size: 0.94rem;
+}
+#template .template-select-grid .field-options .option:hover {
+    background-color: var(--bg-2);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/favicon.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 37.05 37"><defs><style>.a{fill:#594844;}</style></defs><path class="a" d="M18.51,0h-.77A18,18,0,0,0,18,7.08a70.77,70.77,0,0,0,4.2,11.54c2.46,5.59,3.87,11.21,3.34,17A18.5,18.5,0,0,0,18.51,0Z" transform="translate(0.01 0)"/><path class="a" d="M19.19,37h0c1.13-6.23-.56-11.94-3.37-17.41-3-5.9-4.81-11.88-4.41-18.18A18.5,18.5,0,0,0,18.5,37Z" transform="translate(0.01 0)"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.default.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#7a7a7a"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#f5f5f5"/><path d="M379.44,308.79a89.72,89.72,0,0,0-32.11,6A13.39,13.39,0,0,1,329.87,307h0a13,13,0,0,1,7.45-16.57,134.79,134.79,0,0,1,14.94-4.78,124.57,124.57,0,0,1,31.33-3.81q19.74,0,32.37,5.37t20.25,13.67a46.28,46.28,0,0,1,10.56,18.52,71.06,71.06,0,0,1,2.94,19.56,47,47,0,0,1-4.5,20.94A87.61,87.61,0,0,1,434.13,377a150.5,150.5,0,0,1-14.54,15.23,160.19,160.19,0,0,0-14.54,15,82.87,82.87,0,0,0-11.08,17c-3,6.11-4.5,8.51-4.5,16.12v0a12.05,12.05,0,0,1-12.05,12.05h-1.33a14.57,14.57,0,0,1-14.65-14.39v-.15a49.07,49.07,0,0,1,4-20.08A76.15,76.15,0,0,1,375.63,401a157.9,157.9,0,0,1,13.15-14.53q6.93-6.76,13.16-13.68a70.89,70.89,0,0,0,10.21-14.54,35.33,35.33,0,0,0,4-16.61q0-14.54-9.35-23.71T379.44,308.79Z" style="fill:#7a7a7a"/><path d="M396.17,487.88a18.35,18.35,0,0,1-4.87,12.71Q386.44,506,378.05,506t-13.25-5.41a19,19,0,0,1,0-25.42q4.88-5.4,13.25-5.41t13.25,5.41A18.37,18.37,0,0,1,396.17,487.88Z" style="fill:#7a7a7a"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.doc.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#195abc"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#f5f5f5"/><path d="M292,308.45l36,176.47h35.42l23.31-113a159.42,159.42,0,0,0,2.66-20.07h.29a123.44,123.44,0,0,0,2.07,20.07l22.72,113H448.7L485,308.45H453.72L434.83,426.2A158.84,158.84,0,0,0,432.77,446h-.3c-.63-8.3-1.25-14.53-2.06-18.89L408,308.45H374.93L350.14,425.61a125.14,125.14,0,0,0-2.95,20.65h-.6a174.94,174.94,0,0,0-1.77-20.36L325.64,308.45Z" style="fill:#195abc"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.docx.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#fff"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#195abc"/><path d="M292,308.45l36,176.47h35.42l23.31-113a159.42,159.42,0,0,0,2.66-20.07h.29a123.44,123.44,0,0,0,2.07,20.07l22.72,113H448.7L485,308.45H453.72L434.83,426.2A158.84,158.84,0,0,0,432.77,446h-.3c-.63-8.3-1.25-14.53-2.06-18.89L408,308.45H374.93L350.14,425.61a125.14,125.14,0,0,0-2.95,20.65h-.6a174.94,174.94,0,0,0-1.77-20.36L325.64,308.45Z" style="fill:#fff"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.exe.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><rect x="158.99" y="209.29" width="459.03" height="358.43" rx="23.78" style="fill:#fff"/><path d="M596.81,221.31H181a10.14,10.14,0,0,0-10.12,10.12V545.57A10.14,10.14,0,0,0,181,555.69H596.81a10.14,10.14,0,0,0,10.12-10.12V231.43A10.14,10.14,0,0,0,596.81,221.31Z" style="fill:#191919"/><path d="M379.05,411.52q-1.59,21.94-16.2,34.54t-38.52,12.61q-26.15,0-41.12-17.6t-15-48.32v-8.31q0-19.6,6.91-34.54T294.88,327q12.83-8,29.83-8,23.52,0,37.9,12.61T379.23,367h-28q-1-13.16-7.33-19.09T324.71,342q-14,0-21,10t-7.15,31.13v10.28q0,22,6.68,32.21t21.05,10.17q13,0,19.38-5.93T351,411.52Z" style="fill:#b5ff00"/><path d="M397,367.08a13.6,13.6,0,0,1,4.34-10.46,16.86,16.86,0,0,1,21.85,0,13.57,13.57,0,0,1,4.34,10.46,13.39,13.39,0,0,1-4.29,10.31,15.6,15.6,0,0,1-11,4,15.43,15.43,0,0,1-10.92-4A13.36,13.36,0,0,1,397,367.08Zm0,76.46a13.58,13.58,0,0,1,4.34-10.45,16.86,16.86,0,0,1,21.85,0,13.55,13.55,0,0,1,4.34,10.45,13.41,13.41,0,0,1-4.29,10.32,15.6,15.6,0,0,1-11,4,15.43,15.43,0,0,1-10.92-4A13.38,13.38,0,0,1,397,443.54Z" style="fill:#b5ff00"/><path d="M439.27,320.86h27.54l56.77,147.61H495.94Z" style="fill:#b5ff00"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.flac.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><circle cx="388.5" cy="387.9" r="206.7" style="fill:#fff"/><rect width="777" height="777" style="fill:none"/><path d="M388.5,198C283.29,198,198,283.29,198,388.5S283.29,579,388.5,579,579,493.71,579,388.5,493.71,198,388.5,198Zm70.84,231.94c0,19.47-15.66,35.64-35.13,35.57a35,35,0,1,1,11.8-68v-59.1a3,3,0,0,0-3.87-2.92l-72.79,20.79a6.91,6.91,0,0,0-5,6.65V459.1c0,19.48-15.66,35.64-35.13,35.57a35,35,0,1,1,11.79-68V322.47a7.67,7.67,0,0,1,5.61-7.38L454,282.48a4.2,4.2,0,0,1,5.32,4Z" style="fill:#2abff4"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.m4a.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><circle cx="388.5" cy="387.9" r="206.7" style="fill:#fff"/><rect width="777" height="777" style="fill:none"/><path d="M388.5,198C283.29,198,198,283.29,198,388.5S283.29,579,388.5,579,579,493.71,579,388.5,493.71,198,388.5,198Zm70.84,231.94c0,19.47-15.66,35.64-35.13,35.57a35,35,0,1,1,11.8-68v-59.1a3,3,0,0,0-3.87-2.92l-72.79,20.79a6.91,6.91,0,0,0-5,6.65V459.1c0,19.48-15.66,35.64-35.13,35.57a35,35,0,1,1,11.79-68V322.47a7.67,7.67,0,0,1,5.61-7.38L454,282.48a4.2,4.2,0,0,1,5.32,4Z" style="fill:#2abff4"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.mkv.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><circle cx="388.5" cy="387.9" r="206.7" style="fill:#fff"/><path d="M480.93,540.61a9.85,9.85,0,0,1-9.83-9.83V518.49a9.85,9.85,0,0,1,9.83-9.83h35.23a9.86,9.86,0,0,1,9.83,9.83v1.86a190.49,190.49,0,0,0,7.28-255.67,9.77,9.77,0,0,1-6.47,2.46H491.57a9.85,9.85,0,0,1-9.83-9.83V245a9.86,9.86,0,0,1,9.83-9.83h10a190.51,190.51,0,0,0-226.16,0h12.71A9.86,9.86,0,0,1,298,245v12.29a9.85,9.85,0,0,1-9.83,9.83H252.9a9.81,9.81,0,0,1-7.86-4,190.49,190.49,0,0,0-4.26,245.62,9.15,9.15,0,0,1,1.48-.13h35.23a9.85,9.85,0,0,1,9.83,9.83v12.29a9.85,9.85,0,0,1-9.83,9.83h-3.68a190.51,190.51,0,0,0,229.38,0Zm-113.22-9.83a9.86,9.86,0,0,1-9.83,9.83H322.65a9.85,9.85,0,0,1-9.83-9.83V518.49a9.85,9.85,0,0,1,9.83-9.83h35.23a9.86,9.86,0,0,1,9.83,9.83Zm10.64-273.47a9.86,9.86,0,0,1-9.83,9.83H333.29a9.85,9.85,0,0,1-9.83-9.83V245a9.86,9.86,0,0,1,9.83-9.83h35.23a9.87,9.87,0,0,1,9.83,9.83Zm65.52,273.47a9.85,9.85,0,0,1-9.83,9.83H398.82a9.85,9.85,0,0,1-9.83-9.83V518.49a9.85,9.85,0,0,1,9.83-9.83H434a9.85,9.85,0,0,1,9.83,9.83Zm10.64-273.47a9.85,9.85,0,0,1-9.83,9.83H409.46a9.85,9.85,0,0,1-9.83-9.83V245a9.86,9.86,0,0,1,9.83-9.83h35.22a9.86,9.86,0,0,1,9.83,9.83Z" style="fill:#4f4544"/><rect width="777" height="777" style="fill:none"/><path d="M465.89,379,350.25,312.26a10.25,10.25,0,0,0-15.38,8.88V454.67a10.26,10.26,0,0,0,15.38,8.88l115.64-66.77A10.26,10.26,0,0,0,465.89,379Z" style="fill:#fff"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.mp3.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><circle cx="388.5" cy="387.9" r="206.7" style="fill:#fff"/><rect width="777" height="777" style="fill:none"/><path d="M388.5,198C283.29,198,198,283.29,198,388.5S283.29,579,388.5,579,579,493.71,579,388.5,493.71,198,388.5,198Zm70.84,231.94c0,19.47-15.66,35.64-35.13,35.57a35,35,0,1,1,11.8-68v-59.1a3,3,0,0,0-3.87-2.92l-72.79,20.79a6.91,6.91,0,0,0-5,6.65V459.1c0,19.48-15.66,35.64-35.13,35.57a35,35,0,1,1,11.79-68V322.47a7.67,7.67,0,0,1,5.61-7.38L454,282.48a4.2,4.2,0,0,1,5.32,4Z" style="fill:#2abff4"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.mp4.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><rect x="158.99" y="209.29" width="459.03" height="358.43" rx="23.78" style="fill:#fff"/><path d="M596.81,221.31H181a10.14,10.14,0,0,0-10.12,10.12V545.57A10.14,10.14,0,0,0,181,555.69H596.81a10.14,10.14,0,0,0,10.12-10.12V231.43A10.14,10.14,0,0,0,596.81,221.31ZM234,508.46a8.31,8.31,0,0,1-8.29,8.29H196a8.31,8.31,0,0,1-8.29-8.29V498.1a8.31,8.31,0,0,1,8.29-8.29h29.7A8.31,8.31,0,0,1,234,498.1Zm9-230.57a8.31,8.31,0,0,1-8.29,8.29h-29.7a8.31,8.31,0,0,1-8.29-8.29V267.53a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Zm60.26,230.57a8.31,8.31,0,0,1-8.29,8.29H265.2a8.31,8.31,0,0,1-8.29-8.29V498.1a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Zm9-230.57a8.31,8.31,0,0,1-8.29,8.29h-29.7a8.31,8.31,0,0,1-8.29-8.29V267.53a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29ZM371,508.46a8.31,8.31,0,0,1-8.28,8.29H333a8.31,8.31,0,0,1-8.28-8.29V498.1a8.31,8.31,0,0,1,8.28-8.29h29.71A8.31,8.31,0,0,1,371,498.1Zm9-230.57a8.31,8.31,0,0,1-8.28,8.29H342a8.31,8.31,0,0,1-8.29-8.29V267.53a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.28,8.29Zm55.25,230.57a8.31,8.31,0,0,1-8.29,8.29h-29.7a8.31,8.31,0,0,1-8.28-8.29V498.1a8.31,8.31,0,0,1,8.28-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Zm9-230.57a8.31,8.31,0,0,1-8.28,8.29h-29.7a8.31,8.31,0,0,1-8.29-8.29V267.53a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.28,8.29Zm60.27,230.57a8.31,8.31,0,0,1-8.29,8.29h-29.7a8.31,8.31,0,0,1-8.29-8.29V498.1a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Zm9-230.57a8.31,8.31,0,0,1-8.29,8.29H475.4a8.31,8.31,0,0,1-8.29-8.29V267.53a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Zm58.8,230.57a8.31,8.31,0,0,1-8.29,8.29H534.2a8.31,8.31,0,0,1-8.29-8.29V498.1a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Zm9-230.57a8.31,8.31,0,0,1-8.29,8.29h-29.7a8.31,8.31,0,0,1-8.29-8.29V267.53a8.31,8.31,0,0,1,8.29-8.29h29.7a8.31,8.31,0,0,1,8.29,8.29Z" transform="translate(0)" style="fill:#474343"/><path d="M439.72,382.58l-77-44.48A6.83,6.83,0,0,0,352.43,344v89a6.83,6.83,0,0,0,10.25,5.92l77-44.48A6.83,6.83,0,0,0,439.72,382.58Z" transform="translate(0)" style="fill:#fff"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.ogg.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><circle cx="388.5" cy="387.9" r="206.7" style="fill:#fff"/><rect width="777" height="777" style="fill:none"/><path d="M388.5,198C283.29,198,198,283.29,198,388.5S283.29,579,388.5,579,579,493.71,579,388.5,493.71,198,388.5,198Zm70.84,231.94c0,19.47-15.66,35.64-35.13,35.57a35,35,0,1,1,11.8-68v-59.1a3,3,0,0,0-3.87-2.92l-72.79,20.79a6.91,6.91,0,0,0-5,6.65V459.1c0,19.48-15.66,35.64-35.13,35.57a35,35,0,1,1,11.79-68V322.47a7.67,7.67,0,0,1,5.61-7.38L454,282.48a4.2,4.2,0,0,1,5.32,4Z" style="fill:#2abff4"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.pdf.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#ff2116"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#f5f5f5"/><path d="M291.7,478.55c-11.1-11.1.91-26.35,33.5-42.55l20.51-10.19,8-17.48c4.39-9.61,10.95-25.3,14.57-34.86l6.59-17.38-4.54-12.86c-5.58-15.81-7.57-39.58-4-48.12,4.8-11.58,20.5-10.39,26.72,2,4.85,9.69,4.36,27.24-1.4,49.37l-4.72,18.14,4.16,7.06a244.66,244.66,0,0,0,14.84,20.48l11,13.73,13.74-1.79c43.66-5.69,58.61,4,58.61,17.87,0,17.52-34.28,19-63.06-1.25a87.45,87.45,0,0,1-10.93-9.07s-18,3.67-26.91,6.06c-9.16,2.47-13.73,4-27.16,8.55,0,0-4.71,6.84-7.78,11.81-11.42,18.5-24.75,33.84-34.27,39.42C308.51,483.75,297.33,484.18,291.7,478.55Zm17.42-6.22c6.24-3.86,18.87-18.79,27.61-32.65l3.54-5.62-16.11,8.11c-24.89,12.51-36.28,24.3-30.36,31.44,3.33,4,7.31,3.68,15.32-1.28ZM470.8,427c6.1-4.28,5.22-12.89-1.68-16.36-5.37-2.71-9.7-3.26-23.65-3.06-8.57.59-22.35,2.32-24.69,2.84,0,0,7.57,5.23,10.94,7.16A145.61,145.61,0,0,0,455,427.26c7.83,2.4,12.36,2.14,15.79-.31Zm-65-27a159.6,159.6,0,0,1-14-18A100,100,0,0,1,384,370.27s-3.81,12.25-6.93,19.61L367.34,414l-2.82,5.46s15-4.92,22.66-6.92c8.09-2.11,24.52-5.34,24.52-5.34Zm-21-84c1-7.9,1.34-15.8-1.2-19.78-7-7.7-15.54-1.27-14.1,17,.48,6.16,2,16.69,4.06,23.18l3.72,11.8,2.62-8.89a236.19,236.19,0,0,0,4.9-23.35Z" style="fill:#ff2116"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.rar.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#fff"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#6f3789"/><rect x="355" y="531" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="552.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="509.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="487.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="466" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="444.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="401" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="422.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="379.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="357.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="336" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="314.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><path d="M406.84,216h-53a11,11,0,0,0-11,11V290a11,11,0,0,0,11,11h53a11,11,0,0,0,11-11V227A11,11,0,0,0,406.84,216Zm.24,35.17a12,12,0,0,1-12,12h-29.5a12,12,0,0,1-12-12v-13a12,12,0,0,1,12-12h29.5a12,12,0,0,1,12,12Z" style="fill:#fff"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.webm.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><circle cx="388.5" cy="387.9" r="206.7" style="fill:#fff"/><path d="M480.93,540.61a9.85,9.85,0,0,1-9.83-9.83V518.49a9.85,9.85,0,0,1,9.83-9.83h35.23a9.86,9.86,0,0,1,9.83,9.83v1.86a190.49,190.49,0,0,0,7.28-255.67,9.77,9.77,0,0,1-6.47,2.46H491.57a9.85,9.85,0,0,1-9.83-9.83V245a9.86,9.86,0,0,1,9.83-9.83h10a190.51,190.51,0,0,0-226.16,0h12.71A9.86,9.86,0,0,1,298,245v12.29a9.85,9.85,0,0,1-9.83,9.83H252.9a9.81,9.81,0,0,1-7.86-4,190.49,190.49,0,0,0-4.26,245.62,9.15,9.15,0,0,1,1.48-.13h35.23a9.85,9.85,0,0,1,9.83,9.83v12.29a9.85,9.85,0,0,1-9.83,9.83h-3.68a190.51,190.51,0,0,0,229.38,0Zm-113.22-9.83a9.86,9.86,0,0,1-9.83,9.83H322.65a9.85,9.85,0,0,1-9.83-9.83V518.49a9.85,9.85,0,0,1,9.83-9.83h35.23a9.86,9.86,0,0,1,9.83,9.83Zm10.64-273.47a9.86,9.86,0,0,1-9.83,9.83H333.29a9.85,9.85,0,0,1-9.83-9.83V245a9.86,9.86,0,0,1,9.83-9.83h35.23a9.87,9.87,0,0,1,9.83,9.83Zm65.52,273.47a9.85,9.85,0,0,1-9.83,9.83H398.82a9.85,9.85,0,0,1-9.83-9.83V518.49a9.85,9.85,0,0,1,9.83-9.83H434a9.85,9.85,0,0,1,9.83,9.83Zm10.64-273.47a9.85,9.85,0,0,1-9.83,9.83H409.46a9.85,9.85,0,0,1-9.83-9.83V245a9.86,9.86,0,0,1,9.83-9.83h35.22a9.86,9.86,0,0,1,9.83,9.83Z" style="fill:#4f4544"/><rect width="777" height="777" style="fill:none"/><path d="M465.89,379,350.25,312.26a10.25,10.25,0,0,0-15.38,8.88V454.67a10.26,10.26,0,0,0,15.38,8.88l115.64-66.77A10.26,10.26,0,0,0,465.89,379Z" style="fill:#fff"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.xls.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#207245"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#fff"/><path d="M413.89,310.63c12-.85,24.12-1.59,36.2-2.18q-21.31,43.68-43,87.25c14.64,29.81,29.6,59.41,44.29,89.22-12.83-.74-25.6-1.54-38.43-2.45-9.05-22.19-20.07-43.65-26.57-66.86-7.24,21.61-17.56,42-25.87,63.19-11.66-.16-23.32-.64-35-1.12,13.68-26.77,26.88-53.76,41-80.38-12-27.42-25.13-54.3-37.48-81.56q17.57-1,35.13-2c7.94,20.81,16.61,41.36,23.16,62.71C394.41,353.81,404.9,332.51,413.89,310.63Z" style="fill:#207245"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.xlsx.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#fff"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#207245"/><path d="M413.89,310.63c12-.85,24.12-1.59,36.2-2.18q-21.31,43.68-43,87.25c14.64,29.81,29.6,59.41,44.29,89.22-12.83-.74-25.6-1.54-38.43-2.45-9.05-22.19-20.07-43.65-26.57-66.86-7.24,21.61-17.56,42-25.87,63.19-11.66-.16-23.32-.64-35-1.12,13.68-26.77,26.88-53.76,41-80.38-12-27.42-25.13-54.3-37.48-81.56q17.57-1,35.13-2c7.94,20.81,16.61,41.36,23.16,62.71C394.41,353.81,404.9,332.51,413.89,310.63Z" style="fill:#fff"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/img/icon.zip.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 777 777"><rect width="777" height="777" style="fill:none"/><path d="M263.35,182.25a42.66,42.66,0,0,0-42.6,42.62V552.14a42.66,42.66,0,0,0,42.6,42.61H513.6a42.67,42.67,0,0,0,42.6-42.61V283a35.29,35.29,0,0,0-2.75-15.55A43.14,43.14,0,0,0,545,255.29l0,0-62.09-60.9-.1-.11a49.32,49.32,0,0,0-13.16-8.42,48.08,48.08,0,0,0-18.79-3.55H263.35Z" style="fill:#fff"/><path d="M263.35,196.25H451.12s7.51.07,13,2.43a35.57,35.57,0,0,1,9.06,5.72l0,0,61.94,60.76a34.18,34.18,0,0,1,5.54,8c1.46,3.27,1.55,9.26,1.55,9.26s0,.19,0,.29V552.14a28.39,28.39,0,0,1-28.6,28.61H263.35a28.39,28.39,0,0,1-28.61-28.61V224.87a28.39,28.39,0,0,1,28.61-28.62Z" style="fill:#ffbc00"/><rect x="355" y="531" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="552.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="509.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="487.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="466" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="355" y="444.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="401" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="422.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="379.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="357.67" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="336" width="54" height="11.33" rx="5.67" style="fill:#fff"/><rect x="353.33" y="314.33" width="54" height="11.33" rx="5.67" style="fill:#fff"/><path d="M406.84,216h-53a11,11,0,0,0-11,11V290a11,11,0,0,0,11,11h53a11,11,0,0,0,11-11V227A11,11,0,0,0,406.84,216Zm.24,35.17a12,12,0,0,1-12,12h-29.5a12,12,0,0,1-12-12v-13a12,12,0,0,1,12-12h29.5a12,12,0,0,1,12,12Z" style="fill:#fff"/></svg>
\ No newline at end of file
Binary file .cms/img/noise-dark.png has changed
Binary file .cms/img/noise-light.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/js/admin.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,678 @@
+// Две функции для чтения и установки cookie.
+// Cookie используются для авторизации на сайте,
+// для запоминания количества отображаемых страниц в пейджере
+// и выбранной темы.
+// Другие модули так же могут их использовать
+// для запоминания своих настроек.
+function get_cookie( name ) {
+    let cookies = document.cookie.split( ";" );
+    for ( let line of cookies ) {
+        let cookie = line.split( "=" );
+        // TODO: Нужно ли decodeURIComponent( cookie[ 0 ].trim() )?
+        // Имена указываются обычно латиницей, без специальных знаков...
+        if ( name == cookie[ 0 ].trim() ) {
+            return decodeURIComponent( cookie[ 1 ] );
+        }
+    }
+    return "";
+}
+
+// ;Path=/ в админке нет смысла указывать, но можно экономить байты куков
+// браузер сам по умолчанию возьмет текущий путь
+function set_cookie( name, value ) {
+    document.cookie = encodeURIComponent( name ) + "=" + encodeURIComponent( value ) + ";SameSite=Lax";
+}
+
+function set_cookie_expires( name, value ) {
+    let expires = ( new Date( Date.now() + 365 * 86400 * 1000 ) ).toUTCString();
+    document.cookie = encodeURIComponent( name ) + "=" + encodeURIComponent( value ) + ";SameSite=Lax;expires=" + expires;
+}
+
+// Чтобы удалить куки нужно установить отрицательную дату истечения срока действия
+function del_cookie( name ) {
+    document.cookie = encodeURIComponent( name ) + "=;SameSite=Lax;max-age=-1";
+}
+
+// Notifications
+
+// Уведомления, отображающиеся в правом верхнем. Обычно в течении 5 сек.
+// Через 5 секунд к уведомлению добавляется класс timeout,
+// благодаря ему происходит исчезновение уведомления.
+function notify( message, classes, msec ) {
+    let bulb = document.createElement( "div" );
+    bulb.innerHTML = message;
+    bulb.className = classes;
+    document.querySelector( ".log-info-box" ).appendChild( bulb );
+    let h = bulb.offsetHeight;
+    // Чтобы анимировать схлопывание
+    bulb.setAttribute( "style", `height:${h}px` );
+    if ( msec ) {
+        setTimeout( function() {
+            bulb.classList.add( "timeout" );
+        }, msec);
+    }
+}
+
+// Translate
+// module: "admin.mod.php" or "pages.mod.php" etc
+
+// Шаблон admin добавляет глобальную js-переменную
+// в которой содержится текущая локаль и переводы,
+// загруженные из файлов .cms/lang/...
+// Поэтому ими можно пользоваться и на стороне админки.
+function __( str, module ) {
+    if ( cms && cms.locale && cms.lang && cms.lang[module] && cms.lang[module][cms.locale] && cms.lang[module][cms.locale][str] ) {
+        return cms.lang[module][cms.locale][str];
+    } else {
+        api( { fn: "no_translation", str: str, module: module } );
+        return str;
+    }
+}
+
+// Call server side API
+
+// Передаваемые на сервер данные упаковываются как положено
+// и можно передавать даже массивы.
+// Массивы вложенные в массивы воспринимаются как объекты
+// и кодируются в JSON.
+// После того, как сервер вернет ответ, вызывается функция rfn
+// И ответ передается ей в качестве параметра.
+function api( data, rfn, efn ) {
+    const formData = new FormData();
+    buildFormData( formData, data );
+    // send data
+    // По умолчанию запросы отправляются асинхронно,
+    // но если нужно дождаться ответа и затем изменить полученные данные,
+    // то перед вызовом обновляющих функций нужно дописать строчку
+    // cms.async_api = false;
+    let ajax = new XMLHttpRequest();
+    ajax.addEventListener( "load", function( event ) {
+        let data = {};
+        try {
+            data = JSON.parse( event.target.responseText );
+        } catch {
+            notify( __( "server_error", "admin.mod.php" ), "info-error", 5000 );
+            if ( efn ) {
+                efn( event );
+            }
+        }
+        if ( rfn ) {
+            rfn( data );
+        }
+    } );
+    ajax.addEventListener( "error", function( event ) {
+        notify( __( "network_error", "admin.mod.php" ), "info-error", 5000 );
+        if ( efn ) {
+            efn( event );
+        }
+    } );
+    ajax.open( "POST", cms.api, cms.async_api );
+	ajax.send( formData );
+    cms.async_api = true;
+}
+function buildFormData( formData, data, parentKey ) {
+    if ( data && typeof data === 'object' && ! ( data instanceof Date ) && ! ( data instanceof File ) ) {
+        Object.keys( data ).forEach( key => {
+            buildFormData( formData, data[key], parentKey ? `${parentKey}[${key}]` : key );
+        } );
+    } else {
+        const value = data == null ? '' : data;
+        formData.append( parentKey, value );
+    }
+}
+
+
+// Create and connect Codemirror
+function codemirror_connect( selector, name, options = {} ) {
+
+    if ( window[name] ) return;
+
+    let default_options = {
+        mode: "application/x-httpd-php",
+        styleActiveLine:   true,
+        lineNumbers:       true,
+        lineWrapping:      true,
+        autoCloseBrackets: true,
+        smartIndent:       true,
+        indentUnit:        4,
+        tabSize:           4,
+        matchBrackets:     true,
+        foldGutter: true,
+        gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
+        autoCloseTags: {
+            whenClosing: true,
+            whenOpening: true,
+            indentTags:  [ "div", "ul", "ol", "script", "style" ],
+        },
+        phrases: {
+            "Search:":                              __( "codemirror_search", "admin.mod.php" ),
+            "(Use /re/ syntax for regexp search)" : __( "codemirror_re", "admin.mod.php" ),
+            "Replace all:":                         __( "codemirror_replace_all", "admin.mod.php" ),
+            "With:":                                __( "codemirror_replace_with", "admin.mod.php" ),
+            "Replace:":                             __( "codemirror_replace_replace", "admin.mod.php" ),
+            "Replace?":                             __( "codemirror_replace_confirm", "admin.mod.php" ),
+            "Yes":                                  __( "codemirror_yes", "admin.mod.php" ),
+            "No":                                   __( "codemirror_no", "admin.mod.php" ),
+            "All":                                  __( "codemirror_all", "admin.mod.php" ),
+            "Stop":                                 __( "codemirror_stop", "admin.mod.php" ),
+        },
+        extraKeys: { "Ctrl-Space": "autocomplete" }
+    }
+
+    let txtarea = document.querySelector( selector );
+    options = Object.assign( default_options, options );
+    window[name] = CodeMirror.fromTextArea( txtarea, options );
+
+    if ( window[name].showHint ) {
+        window[name].on( "keydown", function( editor, event ) {
+            if ( event.ctrlKey == true ) { return } // Ctrl+S call Hint
+            let isAlphaKey = /^[a-zA-Z]$/.test( event.key );
+            if ( window[name].state.completionActive && isAlphaKey ) {
+                return;
+            }
+
+            // Prevent autocompletion in string literals or comments
+            let cursor = window[name].getCursor();
+            let token = window[name].getTokenAt( cursor );
+            if ( token.type === "string" || token.type === "comment" ) {
+                return;
+            }
+            
+            let lineBeforeCursor = window[name].doc.getLine( cursor.line );
+            if ( typeof lineBeforeCursor !== "string" ) {
+                return;
+            }
+            lineBeforeCursor = lineBeforeCursor.substring( 0, cursor.ch );
+
+            // disable autoclose tag before text
+            let charAfterCursor  = window[name].doc.getLine( cursor.line );
+            charAfterCursor = charAfterCursor.substring( cursor.ch, cursor.ch + 1 );
+            window[name].options.autoCloseTags.dontCloseTags = null;
+            if ( charAfterCursor.match( /\S/ ) && charAfterCursor != "<" ) {
+                if ( lineBeforeCursor.match( /<[^>]+$/ ) ) {
+                    let tag = lineBeforeCursor.match( /<(\w+)\b[^>]*$/ );
+                    if ( tag ) {
+                        tag = tag[1];
+                        window[name].options.autoCloseTags.dontCloseTags = [tag];
+                    }
+                }
+            }
+            
+            let m = CodeMirror.innerMode( window[name].getMode(), token.state );
+            let innerMode = m.mode.name;
+            let shouldAutocomplete;
+            if ( innerMode === "html" || innerMode === "xml" ) {
+                shouldAutocomplete = event.key === "<" ||
+                    event.key === "/" && token.type === "tag" ||
+                    isAlphaKey && token.type === "tag" ||
+                    isAlphaKey && token.type === "attribute" ||
+                    token.string === "=" && token.state.htmlState && token.state.htmlState.tagName;
+            } else if ( innerMode === "css" ) {
+                shouldAutocomplete = isAlphaKey ||
+                    event.key === ":" ||
+                    event.key === " " && /:\s+$/.test( lineBeforeCursor );
+            } else if ( innerMode === "javascript" ) {
+                shouldAutocomplete = isAlphaKey || event.key === ".";
+            } else if ( innerMode === "clike" && window[name].options.mode === "php" ) {
+                shouldAutocomplete = token.type === "keyword" || token.type === "variable";
+            }
+            if ( shouldAutocomplete ) {
+                window[name].showHint( { completeSingle: false } );
+            }
+        } );
+    }
+
+    // Replace < with &lt; in code context
+    // https://stackoverflow.com/a/36388061/20443861
+    window[name].on( "inputRead", function( cm, event ) {
+        if ( event.origin == "paste" ) {
+            if ( cm.paste_context == "code" ) {
+                let text = event.text.join( "\n" ); // pasted string
+                let new_text = text.replaceAll( /</g, "&lt;" );
+                new_text = new_text.replaceAll( /&&/g, "&amp;&amp;" );
+                cm.execCommand( "undo" );
+                cm.replaceSelection( new_text );
+            }
+        }
+    } );
+    window[name].on( "paste", async function( editor, event ) {
+        let cursor = window[name].getCursor();
+        let token = window[name].getTokenAt( cursor );
+        if ( token && token.state && token.state.html && token.state.html.htmlState && token.state.html.htmlState.context && token.state.html.htmlState.context.tagName == "code" ) {
+            window[name].paste_context = "code";
+        } else {
+            window[name].paste_context = "";
+        }
+    } );
+
+}
+
+
+document.addEventListener( "DOMContentLoaded", function( event ) {
+
+    function _( str ) {
+        return __( str, "admin.mod.php" );
+    }
+
+    // Mob Menu
+    document.querySelectorAll( "header .burger, .milk" ).forEach( function( el ) {
+        el.onclick = function() {
+            document.body.classList.toggle( "mobile-menu-open" );
+        }
+    } );
+
+    // Навигация стрелками браузера - фикс активного пункта
+    window.addEventListener( "popstate", function( e ) {
+        // Очищаем без всяких проверок чтобы не подсвечивало на #start
+        document.querySelectorAll( "aside a" ).forEach( function( page ) {
+            page.classList.remove( "active" );
+        } );
+        // Выделяем нужную ссылку
+        let target = window.location.hash;
+        let a = document.querySelector( `aside a[href="${target}"]` );
+        if ( a ) {
+            a.classList.add( "active" );
+        }
+        // надо ли непонятно, скопировал из предыдущего обработчика кликов на всякий случай
+        document.body.classList.remove( "mobile-menu-open" );
+    } );
+    
+    // Theme switcher
+    document.querySelectorAll( ".theme-switcher" ).forEach( function( el ) {
+        el.addEventListener( "click", function( event ) {
+            event.preventDefault();
+            let n = get_cookie( "theme" ) || 0;
+            let styles2 = admin_styles[n];
+            let styles = styles2.split( " " );
+            styles.forEach( function( style ) {
+                document.documentElement.classList.remove( style );
+            } );
+            n = (+n+1) % admin_styles.length;
+            styles2 = admin_styles[n];
+            styles = styles2.split( " " );
+            styles.forEach( function( style ) {
+                document.documentElement.classList.add( style );
+            } );
+            notify( admin_styles[n], "info-success", 5000 );
+            set_cookie( "theme" , n );
+            theme_event = new Event( "theme" );
+            document.dispatchEvent( theme_event );
+        } );
+    } );
+
+    // Logout
+    document.querySelectorAll( "[data-logout]" ).forEach( function ( logoutBtn ) {
+        logoutBtn.addEventListener( "click", function() {
+            // Отправляем на бекенд чтобы закрыло сессию
+            api( { fn: "logout" },
+                // Перезагрузка страницы в случае если админка ответила
+                function() {
+                    window.location.reload( true );
+                },
+                // Даже если нет связи, удаляем куки и перезагружаем страницу
+                function() {
+                    del_cookie( "sess" );
+                    window.location.reload( true );
+                }
+             );
+        });
+    } );
+    
+    // Highlight active menu
+    if ( document.body.classList.contains( "logged" ) ) {
+        let page = window.location.hash;
+        // Зачем тут исключение #start?
+        if ( page && page != "#start" ) {
+            let el = document.querySelector( `a[href="${page}"]` );
+            if ( el ) el.classList.add( "active" );
+        } else if ( document.querySelector( "#start a[href='#base']" ) ) {
+            // Приветственная страничка с указанием подключиться к БД
+            window.location.hash = "#start";
+        } else {
+            // Если никакой пункт не выбран, выбираем по умолчанию Страницы
+            window.location.hash = "#pages";
+        }
+    }
+
+    // Clear Cache
+    document.querySelectorAll( ".clear-cache" ).forEach( function( el ) {
+        el.addEventListener( "click", function( e ){
+            e.preventDefault();
+            api( { fn: "clear_cache" }, function( r ){
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                }
+            });
+        });
+    } );
+
+    
+    // Admin section, Save properties
+    document.querySelectorAll( "[data-am-save]" ).forEach( function( saveButton ) {
+        saveButton.addEventListener( "click", function( e ) {
+            let el       = this.closest( "[data-am-item]" );
+            let item     = el.getAttribute( "data-am-item" );
+            let selector = `#admin_menu [data-am-item="${item}"]`;
+            let title = document.querySelector( `${selector} [name=title]` );
+            if ( title ) {
+                title = title.value;
+            }
+            let section = document.querySelector( `${selector} .section-select-grid .field-select` );
+            if ( section ) {
+                section = section.getAttribute( "data-section" );
+            }
+            let data = {
+                fn:      "admin_menu_save",
+                type:    el.getAttribute( "data-am-type" ),
+                module:  el.getAttribute( "data-am-module" ),
+                item:    item,
+                title:   title,
+                sort:    document.querySelector( `${selector} [name=sort]` ).value,
+                section: section,
+                reset:   this.hasAttribute( "data-am-reset" ),
+            }
+            api( data, function( r ) {
+                if ( r.ok == "true" ) {
+                    window.location.reload( true );
+                }
+            } );
+        } );
+    } );
+
+    // Admin section, Delete Container
+    document.querySelectorAll( "[data-am-delete]" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ){
+            let item = this.closest( "[data-am-item]" ).getAttribute( "data-am-item" );
+            let childs = document.querySelectorAll( `[data-am-childs="${item}"] > div` ).length;
+            if ( childs ) {
+                notify( _( "not_empty_section" ), "info-error", 2000 );
+                return;
+            }
+            if ( ! confirm( _( "confirm_delete" ) ) ) return;
+            let data = {
+                fn: "admin_menu_del",
+                item: item,
+            }
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                    if ( r.info_time ) {
+                        setTimeout( function() {
+                            window.location.reload( true );
+                        }, r.info_time );
+                    }
+                }
+            } );
+        } );
+    } );
+
+    // Admin section, Hide
+    document.querySelectorAll( "[data-am-sw]" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            let el   = this.closest( "[data-am-item]" );
+            let data = {
+                fn:      "admin_menu_hide",
+                type:    el.getAttribute( "data-am-type" ),
+                module:  el.getAttribute( "data-am-module" ),
+                item:    el.getAttribute( "data-am-item" ),
+                hide:    el.classList.contains( "showed" ),
+            }
+            if ( data.item == "admin_menu" ) {
+                if ( ! confirm( _( "hide_admin_settings" ) ) ) return false;
+            }
+            api( data, function( r ) {
+                if ( r.ok == "true" ) {
+                    window.location.reload( true );
+                }
+            } );
+        } );
+    } );
+
+    // Admin section, Add Section
+    document.querySelectorAll( "#admin_menu .main-footer .add-section" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            api( { fn: "admin_menu_add_section" }, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                    if ( r.info_time )
+                    setTimeout( function() {
+                        window.location.reload( true );
+                    }, r.info_time );
+                }
+            } );
+        } );
+    } );
+
+
+    // Reset all items in Admin Menu
+    document.querySelectorAll( "#admin_menu .main-footer .reset-all" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            api( { fn: "reset_admin_menu_items" }, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                    if ( r.info_time )
+                    setTimeout( function() {
+                        window.location.reload( true );
+                    }, r.info_time );
+                }
+            } );
+        } );
+    } );
+
+
+    // Disable Modules
+    document.querySelectorAll( "#modules .module-sw-btn" ).forEach( function( button ) {        
+        button.addEventListener( "click", function( e ) {
+            let closest = this.closest( "[data-module]" );
+            let data = {
+                fn: "module_disable",
+                disable: closest.classList.contains( "enabled" ),
+                module: closest.getAttribute( "data-module" ),
+            }
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                } else {
+                    window.location.reload( true );
+                }
+            } );
+        } );
+    } );
+
+    // Delete Module
+    document.querySelectorAll( "#modules .module-del-btn" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            let module = this.closest( "[data-module]" ).getAttribute( "data-module" );
+            let data = {
+                fn: "module_del",
+                module:  module,
+            }
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                }
+            } );
+        } );
+    } );
+
+    // Close Sessions
+    document.querySelectorAll( "#auth [data-login]" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            e.preventDefault();
+            if ( ! confirm( _( "confirm_logout" ) ) ) return;
+            let parent = button.parentElement;
+            var data = {
+                fn: "logout",
+                sess: this.getAttribute( "data-login" ),
+            }
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                    if ( r.result == "refresh" ) {
+                        // refresh приходит если мы закрываем свою сессию
+                        window.location.reload( true );
+                    } else if ( r.result == "ok" ) {
+                        // Перемещаем сессию в закрытые путем копирования html,
+                        // предварительно удалив класс del-sess чтобы не отображался крестик.
+                        // А старый элемент удаляем.
+                        // При копировании html так же удаляется привязанная функция.
+                        button.classList.remove( "del-sess" );
+                        let html = parent.outerHTML;
+                        parent.remove();
+                        document.querySelector( ".history-sess .sess-table" ).insertAdjacentHTML( "afterbegin", html );
+                    }
+                }
+            } );
+        } );
+    } );
+
+    // Show/Hide password
+    document.querySelectorAll( ".password-eye" ).forEach( function( eye ) {
+        eye.addEventListener( "click", function( e ) {
+            this.classList.toggle( "showed" );
+            let inp = this.previousElementSibling;
+            let t   = inp.getAttribute( "type" );
+            if ( t == "password" ) {
+                inp.setAttribute( "type", "text" );
+            } else {
+                inp.setAttribute( "type", "password" );
+            }
+            inp.focus();
+        } );
+    } );
+
+    // Install module (upload module)
+    let input = document.querySelector( "#module-upload" );
+    if ( input ) input.addEventListener( "change", async function( e ) {
+        const formData = new FormData();
+        formData.append( "fn", "install_module" );
+        for ( let i = 0; i < input.files.length; i++ ) {
+            formData.append( "myfile[]", input.files[i] );
+        }
+        let ajax = new XMLHttpRequest();
+        /*
+        ajax.upload.addEventListener( "progress", function( event ) {
+            let percent = Math.round( (event.loaded / event.total) * 100 );
+            bar.style.width = percent + "%";
+        }, false );
+
+        ajax.addEventListener( "error", function( event ) {
+            notify( _( "error_upload_file" ), "info-error", 3600000 );
+            bar.style = "";
+        }, false );
+        
+        ajax.addEventListener( "abort", function( event ) {
+            notify( _( "error_upload_file" ), "info-error", 3600000 );
+            bar.style = "";
+        }, false );
+        */
+        let google_chrome_fix = this;
+        ajax.addEventListener( "load", function( event ) {
+            google_chrome_fix.value = "";
+            let r = JSON.parse( event.target.responseText );
+            if ( r.info_text ) {
+                notify( r.info_text, r.info_class, r.info_time );
+                if ( r.info_class === "info-success" ) setTimeout( function() {
+                    window.location.reload( true );
+                }, r.info_time );
+            }
+        } );
+        ajax.open( "POST", cms.api );
+	    ajax.send( formData );
+    } );
+
+    // БД. Открытие дополнительных настроек.
+    document.querySelectorAll( "#base .pro-btn" ).forEach( function( pro ) {
+        pro.addEventListener( "click", function( e ) {
+            document.querySelector( "#base form" ).classList.toggle( "show-pro" );
+        } );
+    } );
+
+    // Выбор секции Админского меню. Select
+    document.querySelectorAll( "#admin_menu .field-select" ).forEach( function( select ) {
+        select.addEventListener( "click", function( e ) {
+            e.stopPropagation();
+            this.parentElement.classList.toggle( "open" );
+            
+            // это можно убрать если переставить стили на родителя
+            select.nextElementSibling.classList.toggle( "open" );
+        } );
+    } );
+    
+    // Выбор секции Админского меню. Option
+    document.querySelectorAll( "#admin_menu .field-options .option" ).forEach( function( select ) {
+        select.addEventListener( "click", function( e ) {
+            let input = this.closest( ".section-select-grid" ).querySelector( ".field-select" );
+            input.querySelector( ".value" ).innerText = this.innerText;
+            input.setAttribute( "data-section", this.getAttribute( "value" ) );
+        } );
+    } );
+    // Select
+    // Закрытие выпадающих списков при кликах вне их, а так же по ним
+    document.body.addEventListener( "click", function( e ) {
+        document.querySelectorAll( "#admin_menu .section-select-grid" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+
+        // это можно убрать если переставить стили на родителя
+        document.querySelectorAll( "#admin_menu .field-options" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+    } );
+
+
+    /* Обновление и проверка файлов */
+
+    document.querySelectorAll( "#modules [data-fn]" ).forEach( function( button ) {
+        button.addEventListener( "click", function() {
+            let fn = this.getAttribute( "data-fn" );
+            let data = {
+                fn: fn
+            }
+            api( data, function( r ) {
+                if ( r.answer ) {
+                    switch ( fn ) {
+                        case "cms_update":
+                            document.querySelector( "#modules .update-window" ).insertAdjacentHTML( "beforeend", r.answer );
+                            break;
+                        case "create_zip":
+                            document.querySelector( "#modules .dev-window" ).insertAdjacentHTML( "beforeend", r.answer );
+                            break;
+                        case "cms_check_update":
+                        case "cms_check_dev_update":
+                            document.querySelector( "#modules .check-answer" ).innerHTML = r.answer;
+                            break;
+                        case "cms_changed_files":
+                            let div = document.querySelector( "#modules .changed-files" );
+                            div.innerHTML = r.answer;
+                            div.style.display = "";
+                            break;
+                    }
+                }
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                }
+                if ( r.reload ) {
+                    setTimeout( function() {
+                        window.location.reload( true );
+                    }, r.info_time );
+                }
+            } );
+        } );
+    } );
+
+    // show update from dev buttons
+    document.querySelectorAll( "#modules [data-show-dev]" ).forEach( function( btn ) {
+        btn.addEventListener( "click", function() {
+            let dev = document.querySelector( "#modules .developers_only" );
+            if ( dev ) {
+                dev.classList.remove( "developers_only" );
+                if ( window.location.host == "dev.coffee-cms.ru" ) {
+                    dev.querySelector( "#modules [data-fn='create_zip']" ).removeAttribute( "style" );
+                }
+            }
+            this.remove();
+        } );
+    } );
+
+} );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/js/menu.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,426 @@
+document.addEventListener( "DOMContentLoaded", function( event ) {
+
+    function _( str ) {
+        return __( str, "menu.mod.php" );
+    }
+
+    function select3( selects ) {
+        selects.forEach( function( select ) {
+            // именно keyup чтобы не пересекалось с input
+            select.querySelector( "input" ).addEventListener( "keyup", function( e ) {
+                api( { fn: "get_search_pages_list", search: this.value }, function( r ) {
+                    if ( r.html ) {
+                        select.querySelector( ".list-search" ).innerHTML = r.html;
+                        select.querySelectorAll( ".list-search li" ).forEach( function( li ) {
+                            li.addEventListener( "click", select3_li );
+                        } );
+                    }
+                } );
+            } );
+            // prevent close dropdown when click on input
+            select.querySelector( "input" ).addEventListener( "click", function( e ) {
+                e.stopPropagation();
+            } );
+            // show/hide dropdown list
+            select.querySelector( ".field-select" ).addEventListener( "click", function ( event ) {
+                event.stopPropagation();
+                this.parentElement.classList.toggle( "open" );
+                let list = event.currentTarget.nextElementSibling;
+
+                // это можно убрать если переставить стили на родителя
+                list.classList.toggle( "open" );
+                
+                if ( list.classList.contains( "open" ) ) {
+                    let input = select.querySelector( "input" );
+                    input.focus();
+                    input.dispatchEvent( new Event( "keyup" ) );
+                }
+            } );
+        } );
+    }
+
+    // click selected item
+    function select3_li( e ) {
+        let id    = this.getAttribute( "data-id" );
+        let url   = this.getAttribute( "data-url" );
+        let title = this.innerText;
+        let input_title = this.closest( ".select-grid" ).querySelector( ".field-select" );
+        let old_id = input_title.getAttribute( "data-old-id" );
+        input_title.querySelector( ".value" ).innerText = title;
+        input_title.setAttribute( "data-id", id );
+        // поменять url в поле ввода
+        let input_url = this.closest( ".menu-prop" ).querySelector( "input[name='url']" );
+        input_url.value = url;
+        // поменять заголовок и ссылку вверху
+        let a = this.closest( ".item" ).querySelector( ":scope > a" );
+        a.setAttribute( "href", cms.base_path + url );
+        let replaced_title = this.closest( ".menu-prop" ).querySelector( `input[name="title"]` ).value;
+        if ( replaced_title ) title = replaced_title;
+        a.innerText = title;
+        if ( id === "0" ) {
+            input_url.removeAttribute( "disabled" );
+        } else {
+            input_url.setAttribute( "disabled", true );
+        }
+        // remove li except data-id=0
+        Array.from( this.parentElement.children ).forEach( function( li ) {
+            if ( li.getAttribute( "data-id" ) !== "0" ) {
+                li.remove();
+            }
+        } );
+        // close dropdown list
+        input_title.click();
+        // изменение
+        if ( old_id != id ) {
+            input_title.dispatchEvent( new Event( "input" ) );
+        }
+    }
+
+    api( { fn: "get_menu_items" }, set_menu_items );
+
+    function set_menu_items( r ) {
+
+        document.querySelector( "#menu .menu-grid" ).innerHTML = r.list;
+
+        // set parents for each menu item
+        document.querySelectorAll( "#menu [data-parent]" ).forEach( function( el ) {
+            el.nextElementSibling.insertAdjacentHTML( "beforeend", r.parents );
+            let pid = el.getAttribute( "data-parent" );
+            let parent = el.nextElementSibling.querySelector( `[value="${pid}"]` ).innerText.trim();
+            el.querySelector( ".value" ).innerText = parent;
+            // remove self
+            let self   = el.closest( "[data-item]" ).getAttribute( "data-item" );
+            self = el.nextElementSibling.querySelector( `[value="${self}"]` );
+            if ( self ) {
+                self.remove();
+            }
+        } );
+
+        // selects
+        let selects = document.querySelectorAll( "#menu .select-grid" );
+        select3( selects );
+
+        // Select
+        document.querySelectorAll( "#menu .area-select-grid .field-select-menu, #menu .parent-select-grid .field-select" ).forEach( function( select ) {
+            select.addEventListener( "click", function( e ) {
+                e.stopPropagation();
+                this.parentElement.classList.toggle( "open" );
+
+                // это можно убрать если переставить стили на родителя
+                select.nextElementSibling.classList.toggle( "open" );
+            } );
+        } );
+        // Option for menu
+        document.querySelectorAll( "#menu .area-select-grid .field-options .option" ).forEach( function( option ) {
+            option.addEventListener( "click", function( e ) {
+                let input = this.closest( ".area-select-grid" ).querySelector( ".field-select-menu" );
+                let old_val = input.getAttribute( "data-menu-area" );
+                let new_val = this.getAttribute( "value" );
+                if ( old_val != new_val ) {
+                    input.querySelector( ".value" ).innerText = this.innerText;
+                    input.setAttribute( "data-menu-area", new_val );
+                    // Событие изменения
+                    let event = new Event( "input" );
+                    input.dispatchEvent( event );
+                }
+                //e.stopPropagation(); убираем чтобы закрылось автоматически
+            } );
+        } );
+        // Option for item
+        document.querySelectorAll( "#menu .parent-select-grid .field-options .option" ).forEach( function( option ) {
+            option.addEventListener( "click", parent_li_click );
+        } );
+        function parent_li_click( e ) {
+            let input = this.closest( ".parent-select-grid" ).querySelector( ".field-select" );
+            let old_val = input.getAttribute( "data-parent" );
+            let new_val = this.getAttribute( "value" );
+            if ( old_val != new_val ) {
+                input.querySelector( ".value" ).innerText = this.innerText.trim();
+                input.setAttribute( "data-parent", new_val );
+                // Событие изменения
+                let event = new Event( "input" );
+                input.dispatchEvent( event );
+            }
+            //e.stopPropagation(); убираем чтобы закрылось автоматически
+        }
+
+        // Toggle Menu Properties
+        let prop_buttons = document.querySelectorAll( "#menu .menu-buttons .prop" );
+        prop_buttons.forEach( function( button ) {
+            button.addEventListener( "click", function( e ) {
+                e.stopPropagation();
+                this.closest( "[data-item]" ).classList.toggle( "open" );
+            } );
+        } );
+
+        // Отлавливать изменения полей в меню чтобы показать Сохранить
+        document.querySelectorAll( "#menu .menu" ).forEach( function( menu ) {
+            menu.querySelectorAll( "input, .field-select-menu" ).forEach( function( input ) {
+                input.addEventListener( "input", function( event ) {
+                    let menu = this.closest( ".menu" );
+                    menu.classList.add( "changed" );
+                } );
+            } );
+        } );
+
+        // Отлавливать изменения полей в пунктах чтобы показать Сохранить
+        document.querySelectorAll( "#menu .item" ).forEach( function( item ) {
+            item.querySelectorAll( "input, .field-select" ).forEach( function( input ) {
+                input.addEventListener( "input", function( event ) {
+                    let item = this.closest( ".item" );
+                    item.classList.add( "changed" );
+                } );
+            } );
+        } );
+
+        // Save Properties
+        document.querySelectorAll( "#menu .menu-buttons .save" ).forEach( function( button ) {
+            button.addEventListener( "click", function( e ) {
+                e.stopPropagation();
+
+                let item = this.closest( "[data-item]" );
+                let mid  = item.getAttribute( "data-item" );
+
+                let area = item.querySelector( "[data-menu-area]" );
+                if ( area ) {
+                    area = area.getAttribute( "data-menu-area" );
+                }
+
+                let tag_title = item.querySelector( "[name='tag_title']" );
+                if ( tag_title ) {
+                    tag_title = tag_title.value;
+                }
+
+                let url = item.querySelector( "[name='url']" );
+                if ( url ) {
+                    url = url.value;
+                }
+
+                let id = item.querySelector( "[name='id']" );
+                if ( id ) {
+                    id = id.getAttribute( "data-id" );
+                }
+
+                let pid_el = item.querySelector( "[data-parent]" );
+                let pid,old_pid;
+                if ( pid_el ) {
+                    pid = pid_el.getAttribute( "data-parent" );
+                    old_pid = pid_el.getAttribute( "data-old-parent" );
+                }
+
+                let target = item.querySelector( "[name='targetblank']" );
+                if ( target ) {
+                    target = target.checked;
+                }
+
+                let old_sort_el = item.querySelector( "[name='sort']" );
+                let old_sort = old_sort_el.getAttribute( "data-sort" );
+
+                let data = {
+                    fn:        "save_menu_item",
+                    mid:       mid,
+                    title:     item.querySelector( "[name='title']" ).value,
+                    tag_title: tag_title,
+                    url:       url,
+                    id:        id,
+                    pid:       pid,
+                    old_pid:   old_pid,
+                    classes:   item.querySelector( "[name='classes']" ).value,
+                    sort:      item.querySelector( "[name='sort']" ).value,
+                    area:      area,
+                    target:    target
+                }
+                document.querySelectorAll( `#menu [data-item]` ).forEach( function( el ) {
+                    el.classList.remove( "last-edited" );
+                } );
+                api( data, function( r ) {
+                    if ( r.ok == "false" ) {
+                        notify( r.info_text, r.info_class, r.info_time );
+                    }
+                    if ( r.ok == "true" ) {
+                        item.classList.remove( "changed" );
+                        let item_with_childs = item.parentElement;
+                        if ( r.list ) {
+                            set_menu_items( r );
+                        } else if ( old_sort != data.sort ) {
+                        // пересортировка имеет смысл если не было замены всего списка
+                            // обновить сортировку для сравнения
+                            old_sort_el.setAttribute( "data-sort", data.sort );
+                            let grid;
+                            if ( data.area === null ) {
+                                grid = item.closest( ".items-grid" );
+                            } else {
+                                grid = item.closest( ".menu-grid" );
+                            }
+                            let before = null;
+                            for ( let n = 0; n < grid.children.length; n++ ) {
+                                let node = grid.children[n];
+                                if ( node != item_with_childs ) {
+                                    let sort = node.querySelector( '[data-item] [name="sort"]' ).value;
+                                    if ( +data.sort < +sort ) {
+                                        before = node;
+                                        break;
+                                    }
+                                }
+                            };
+                            grid.insertBefore( item_with_childs, before );
+                        }
+                        
+                        // Замена title
+                        let title;
+                        if ( data.title != "" )
+                            title = data.title;
+                        else
+                            title = item.querySelector( ".select-grid .value" ).innerText;
+                        item.querySelector( ":scope > a" ).innerText = title;
+                        
+                        // обновить родителей у подпунктов
+                        // поскольку мог измениться title
+                        // и только у строго дочерних, которых может и не быть
+                        let childs_grid = item.nextElementSibling;
+                        if ( childs_grid ) {
+                            let childs_selector = childs_grid.querySelectorAll( ":scope > div > .item .parent-select-grid" );
+                            
+                            if ( childs_selector ) childs_selector.forEach( function( grid ) {
+                                let input = grid.querySelector( "[data-parent]" );
+                                let pid = input.getAttribute( "data-parent" );
+                                let options = grid.querySelector( ":scope > .field-options" );
+                                options.innerHTML = r.parents;
+                                options.querySelectorAll( ".option" ).forEach( function( option ) {
+                                    option.addEventListener( "click", parent_li_click );
+                                } );
+                                // тайтл вычисляется выше
+                                input.querySelector( ".value" ).innerText = title;
+                            } );
+                        }
+                        
+                        // Last Edited Marker
+                        setTimeout( function() {
+                            document.querySelector( `#menu [data-item="${data.mid}"]` ).classList.add( "last-edited" );
+                        }, 200 );
+                    }
+                } );
+            } );
+        } );
+
+        // Delete Menu or Item
+        document.querySelectorAll( "#menu .menu-buttons .del" ).forEach( function( button ) {
+            button.addEventListener( "click", function( e ) {
+                e.stopPropagation();
+                clear_highlite();
+                let item = button.closest( ".item,.menu" ).parentNode;
+                item.classList.add( "will-be-deleted" );
+                setTimeout( function() {
+                if ( ! confirm( __( "confirm_delete", "menu.mod.php" ) ) ) {
+                    item.classList.remove( "will-be-deleted" );
+                    return;
+                }
+                let data = {
+                    fn: "del_menu_item",
+                    mid: button.closest( "[data-item]" ).getAttribute( "data-item" )
+                };
+                api( data, function( r ) {
+                    if ( r.info_text ) {
+                        notify( r.info_text, r.info_class, r.info_time );
+                        if ( r.info_class == "info-success" ) {
+                            set_menu_items( r );
+                        }
+                    }
+                } );
+                }, 20 );
+            } );
+        } );
+
+        // Create Item
+        document.querySelectorAll( "#menu .main-main .append" ).forEach( function( button ) {
+            button.addEventListener( "click", modMenuCreate );
+        } );
+
+        // Линия к родителю
+        let items = document.querySelectorAll( "#menu .item" );
+        items.forEach( function( el ) {
+            el.addEventListener( "click", function( e ) {
+                // Если опускание мыши было не на нас, то игнорим
+                if ( mouse_down_el != this ) return;
+                mouse_down_el = null;
+                let highlited = this.classList.contains( "highlite-children" );
+                clear_highlite();
+                // Назначить классы
+                if ( ! highlited ) {
+                    this.classList.add( "highlite-children" );
+                    this.closest( ".items-grid" ).classList.add( "highlite-parent" );;
+                }
+            } );
+        } );
+        // Опускание мыши
+        // Возможна ситуация когда нажатие мыши было на кнопке Свойства,
+        // а отпускание на плашке. В этом случае может появиться линия к родителю.
+        // Поэтому нужно записывать что опускание было на плашке или панельке кнопок.
+        let mouse_down_el; // элемент на котором было опускание мыши
+        items.forEach( function( el ) {
+            el.addEventListener( "mousedown", function( e ) {
+                // чтобы проигнорировать клики по дочерним
+                if ( e.target == this )
+                    mouse_down_el = this;
+            } );
+            // див с кнопками можно тыкать
+            let mb = el.querySelector( ".menu-buttons" );
+            if ( mb ) mb.addEventListener( "mousedown", function( e ) {
+                // чтобы проигнорировать клики по дочерним
+                if ( e.target == this )
+                    mouse_down_el = this.parentElement;
+            } );
+        } );
+        // Сбросить классы
+        function clear_highlite() {
+            document.querySelectorAll( "#menu .items-grid.highlite-parent" ).forEach( function( el ) {
+                el.classList.remove( "highlite-parent" );
+            } );
+            document.querySelectorAll( "#menu .item.highlite-children" ).forEach( function( el ) {
+                el.classList.remove( "highlite-children" );
+            } );
+        }
+
+    }
+
+    // Select
+    // Закрытие выпадающих списков при кликах вне их, а так же по ним
+    document.body.addEventListener( "click", function( e ) {
+        // это можно убрать если переставить стили на родителя
+        document.querySelectorAll( "#menu .field-options" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+        
+        document.querySelectorAll( "#menu .area-select-grid, #menu .select-grid, #menu .parent-select-grid" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+    } );
+
+    // Создание меню или пункта меню
+    function modMenuCreate( e ) {
+        e.stopPropagation();
+        let pid = this.closest( "[data-item]" ).getAttribute( "data-item" );
+        api( { fn : "create_menu_item", pid : pid }, function( r ) {
+            if ( r.info_text ) {
+                notify( r.info_text, r.info_class, r.info_time );
+                if ( r.info_class == "info-success" ) {
+                    set_menu_items( r );
+                    let item = document.querySelector( `#menu [data-item="${r.mid}"]` );
+                    item.classList.add( "open" );
+                    item.classList.add( "last-edited" );
+                    // Докрутить к новому элементу
+                    item.scrollIntoView( { behavior: "smooth", block: "center" } );
+                }
+            }
+        } );
+    }
+    
+    // Create Menu
+    document.querySelector( "#menu .main-footer .create" ).addEventListener( "click", modMenuCreate );
+    
+    // update page used in menu
+    document.body.addEventListener( "update_menu", function( e ) {
+        api( { fn: "get_menu_items" }, set_menu_items );
+    } );
+
+} );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/js/pages.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1265 @@
+document.addEventListener( "DOMContentLoaded", function( event ) {
+
+    function _( str ) {
+        return __( str, "pages.mod.php" );
+    }
+
+    // Полностью этот скрипт отключить нельзя если включены Инструменты,
+    // поэтому нужна проверка
+    if ( document.querySelector( "#pages" ) ) {
+        api( { fn: "get_pages_list" }, set_pages_list );
+    }
+
+    function set_pages_list( r ) {
+
+        if ( ! document.querySelector( "#pages" ) ) return;
+
+        if ( r.no_database ) {
+            document.querySelector( "#pages .pages-grid" ).innerHTML = r.no_database;
+            return;
+        }
+
+        if ( r.overloaded ) {
+            let m = _( "server_overloaded_xxx" );
+            m = m.replace( "xxx", r.pages.length );
+            notify( m, "info-error", 5000 );
+        }
+
+        // Запоминаем результаты какого поиска мы получили
+        // Это нужно чтобы не загружать снова все страницы при создании новой
+        // не производить сброс поиска.
+        let pages_search = document.querySelector( "#pages .page-search" );
+        pages_search.setAttribute( "data-result-of", r.search );
+
+        let grid = document.querySelector( "#pages .pages-grid" );
+        let count = document.querySelector( "#pages .main-footer .count" );
+        let loaded = document.querySelector( "#pages .main-footer .loaded" );
+        if ( cms.clear_pages_list ) {
+            cms.clear_pages_list = false;
+            grid.innerHTML = "";
+            loaded.value = "0";
+        }
+
+        // Всего страниц в БД
+        count.innerText = r.count;
+
+        // При удалении страниц подгружаются последние и не нужно менять смещение у пейджера
+        if ( cms.dont_change_offset ) {
+            cms.dont_change_offset = false;
+        } else {
+            loaded.setAttribute( "data-offset", r.offset );
+        }
+
+        // insert pages
+        let start = Date.now();
+        for ( let i = 0; i < r.pages.length; i++ ) {
+            grid.insertAdjacentHTML( "beforeend", r.pages[i].html );
+            loaded.value = +loaded.value + 1;
+            let page = grid.querySelector( `[data-id="${r.pages[i].id}"]` );
+            set_controls( page );
+            if ( Date.now() - start > 1000 ) {
+                let m = _( "browser_overloaded_xxx" );
+                m = m.replace( "xxx", i + 1 );
+                m = m.replace( "nnn", r.pages.length );
+                notify( m, "info-error", 5000 );
+                break;
+            }
+        }
+
+        create_pager();
+
+        // При создании страницы было обнаружено что поиск не сброшен,
+        // поэтому была вызвана функция загрузки страниц с пустым поиском
+        // и пришло время создать новую страницу
+        if ( cms.create_page_fn ) {
+            cms.create_page_fn();
+            cms.create_page_fn = null;
+        }
+
+    }
+
+    function create_pager() {
+        let loaded = document.querySelector( "#pages .main-footer .loaded" );
+        let offset = parseInt( loaded.getAttribute( "data-offset" ) );
+        let count  = parseInt( document.querySelector( "#pages .main-footer .count" ).innerText );
+        if ( count === 0 ) { count++; }
+        let cookie_pp = get_cookie( "pages_pager" );
+        let pages  = Math.ceil( count / cookie_pp );
+        let pager  = document.querySelector( "#pages .main-footer .pager" );
+        pager.innerHTML = "";
+        if ( pages > 1 ) {
+            for ( let i = 1; i <= pages; i++ ) {
+                let p = document.createElement( "div" );
+                p.innerText = i;
+                p.setAttribute( "data-offset", ( i - 1 ) * cookie_pp );
+                pager.appendChild( p );
+            }
+            pager.querySelector( `[data-offset="${offset}"]` ).classList.add( "active" );
+            pager.childNodes.forEach( function( el ) {
+                el.addEventListener( "click", function( e ) {
+                    let offset = this.getAttribute( "data-offset" );
+                    let search = document.querySelector( "#pages .page-search" ).value;
+                    let data = {
+                        fn: "get_pages_list",
+                        offset: offset,
+                        search: search
+                    }
+                    document.querySelector( "#pages .main-main" ).scrollTop = 0;
+                    cms.clear_pages_list = true;
+                    api( data, set_pages_list );
+                } );
+            } );
+            // scroll
+            pager.onmousedown = function( e ) {
+                let pageX = 0;
+                let pageY0 = 0;
+              
+                document.onmousemove = function( e ) {
+                    if ( pageX !== 0 ) {
+                        pager.scrollLeft = pager.scrollLeft + ( pageX - e.pageX );
+                    }
+                    pageX = e.pageX;
+                    // fix for google chrome
+                    if ( pageY0 === 0 ) {
+                        pageY0 = e.pageY;
+                    }
+                    if ( Math.abs( pageY0 - e.pageY ) > 64 ) {
+                        const event = new Event( "mouseup" );
+                        pager.dispatchEvent( event );
+                    }
+                }
+              
+                // end drag
+                pager.onmouseup = function() {
+                    document.onmousemove = null;
+                    pager.onmouseup = null;
+                }
+              
+                // disable browser drag
+                pager.ondragstart = function() {
+                    return false;
+                }
+            }
+        }
+    }
+
+    // pager counter
+    let pager_counter = document.querySelector( "#pages .main-footer input" );
+    if ( pager_counter ) pager_counter.addEventListener( "keydown", function( e ) {
+        if ( e.keyCode === 13 ) { // keyCode work on mobile
+            let p = document.querySelector( "#pages .main-footer input" ).value;
+            set_cookie_expires( "pages_pager", p );
+            cms.clear_pages_list = true;
+            api( { fn: "get_pages_list", search: document.querySelector( "#pages .page-search" ).value }, set_pages_list );
+        }
+    } );
+
+    function set_controls( selector ) {
+
+        // Open properties
+        selector.querySelectorAll( ".page-prop-btn" ).forEach( function( button ) {
+            button.addEventListener( "click", function( e ) {
+                let id = this.closest( "[data-id]" ).getAttribute( "data-id" );
+                document.querySelector( `#pages .pages-grid [data-id="${id}"]` ).classList.toggle( "open" );
+            } );
+        } );
+
+        // Save properties
+        selector.querySelectorAll( ".page-prop-save-btn" ).forEach( function( button ) {
+            button.addEventListener( "click", function( e ) {
+                let id       = this.closest( "[data-id]" ).getAttribute( "data-id" );
+                let item = document.querySelector( `#pages .pages-grid [data-id="${id}"] ` );
+                let data = {
+                    fn:           "save_prop",
+                    id:           id,
+                    title:        item.querySelector( '[name="title"]' ).value,
+                    seo_title:    item.querySelector( '[name="seo_title"]' ).value,
+                    url:          item.querySelector( '[name="url"]' ).value,
+                    date:         item.querySelector( '[name="date"]' ).value,
+                    time:         item.querySelector( '[name="time"]' ).value,
+                    template:     item.querySelector( '.template-select-grid .field-select' ).getAttribute( "data-template" ),
+                    old_template: item.querySelector( '.template-select-grid .field-select' ).getAttribute( "data-old-template" ),
+                    description:  item.querySelector( '[name="description"]' ).value,
+                    tags:         item.querySelector( '[name="tags"]' ).value,
+                }
+                api( data, function( r ) {
+                    if ( r.ok == "false" ) { // FIXME: never fire
+                        notify( r.info_text, r.info_class, 5000 );
+                    }
+                    if ( r.ok == "true" ) {
+
+                        // Update Title, URL and Date
+                        item.querySelector( ".page-name" ).innerHTML = r.title;
+                        item.querySelector( ".page-name" ).setAttribute( "href", r.base_path + r.url );
+                        update_home();
+                        let url_el = item.querySelector( "[name=url]" );
+                        if ( url_el.value != r.url ) {
+                            notify( _( "url_changed" ), "info-error", 5000 );
+                        }
+                        url_el.value = r.url;
+                        let date = item.querySelector( ".page-date" );
+                        date.innerHTML = r.created;
+                        if ( r.planned ) {
+                            date.classList.add( "future" );
+                        } else {
+                            date.classList.remove( "future" );
+                        }
+
+                        // update old template
+                        item.querySelector( '.template-select-grid .field-select' ).setAttribute( "data-old-template", data.template );
+
+                        // edit marker
+                        document.querySelectorAll( "#pages .pages-grid > div" ).forEach( function( el ) {
+                            el.classList.remove( "last-edited" );
+                        } );
+                        setTimeout( function() {
+                            item.classList.add( "last-edited" );
+                        }, 200 );
+
+                        // highlight save button
+                        button.classList.add( "saved" );
+                        setTimeout( function() {
+                            button.classList.remove( "saved" );
+                        }, 200 );
+
+                        notify( r.info_text, r.info_class, 5000 );
+
+                        // update event for menu
+                        if ( r.update_menu == "true" ) {
+                            let event = new Event( "update_menu" );
+                            document.body.dispatchEvent( event );
+                        }
+                    }
+                    
+                } );
+            } );
+        } );
+
+        // Pin Page
+        selector.querySelectorAll( ".pin" ).forEach( function( pin ) {
+            pin.addEventListener( "click", function( e ) {
+                let box  = this.closest( "[data-id]" );
+                let id   = box.getAttribute( "data-id" );
+                let pin  = box.getAttribute( "data-pin" );
+                if ( pin === "1" ) {
+                    pin = "0";
+                } else {
+                    pin = "1";
+                }
+                let data = {
+                    fn:  "page_pin",
+                    id:  id,
+                    pin: pin
+                }
+                api( data, function( r ) {
+                    if ( r.ok == "true" ) {
+                        box.setAttribute( "data-pin", pin );
+                    }
+                } );
+            } );
+        } );
+        
+        // Publish Page
+        selector.querySelectorAll( ".published" ).forEach( function( pub ) {
+            pub.addEventListener( "click", function( e ) {
+                let box  = this.closest( "[data-id]" );
+                let id   = box.getAttribute( "data-id" );
+                let published  = box.getAttribute( "data-published" );
+                if ( published === "1" ) {
+                    published = "0";
+                } else {
+                    published = "1";
+                }
+                let data = {
+                    fn:  "page_publish",
+                    id:  id,
+                    published: published
+                }
+                api( data, function( r ) {
+                    if ( r.ok == "true" ) {
+                        box.setAttribute( "data-published", published );
+                        if ( published == "1" ) {
+                            pub.setAttribute( "title", _( "published" ) );
+                        } else {
+                            pub.setAttribute( "title", _( "unpublished" ) );
+                        }
+                    }
+                } );
+            } );
+        } );
+
+        // Edit page
+        selector.querySelectorAll( ".page-edit-btn" ).forEach( function( button ) {
+            button.addEventListener( "click", function( e ) {
+                button.classList.add( "loading" );
+                let id = this.closest( "[data-id]" ).getAttribute( "data-id" );
+                // get page from server
+                api( { fn: "get_page", id: id }, function( r ) {
+                    button.classList.remove( "loading" );
+                    if ( r.result == "ok" ) {
+                        let title = document.querySelector( "#pages .page-editor-title" );
+                        title.innerHTML = r.page.title;
+                        title.setAttribute( "href", r.base_path + r.page.url );
+                        let props = document.querySelector( "#pages .page-properties" );
+                        props.querySelector( "input[name='title']" ).value = r.page.title;
+                        props.querySelector( "input[name='url']" ).value = r.page.url;
+                        props.querySelector( "input[name='seo_title']" ).value = r.page.seo_title;
+                        props.querySelector( "textarea[name='description']" ).value = r.page.description;
+                        props.querySelector( "textarea[name='tags']" ).value = r.page.tags;
+                        props.querySelector( "input[name='date']" ).value = r.date;
+                        props.querySelector( "input[name='time']" ).value = r.time;
+                        let select = props.querySelector( ".template-select-grid" );
+                        let options = select.querySelector( ".field-options" );
+                        options.innerHTML = r.options;
+                        let tpl = select.querySelector( ".field-select" );
+                        tpl.setAttribute( "data-template", r.option );
+                        tpl.setAttribute( "data-old-template", r.option );
+                        tpl.querySelector( ".value" ).innerText = r.option_tr;
+                        document.querySelector( "#pages .page-editor > textarea" ).value = r.page.text;
+                        if ( r.page.modified != null ) { // prevent delete attribute
+                            document.querySelector( "#pages .page-editor > textarea" ).setAttribute( "data-modified", r.page.modified );
+                        }
+                        document.querySelector( "#pages .save-page-button" ).setAttribute( "data-id", r.page.id );
+
+                        options.querySelectorAll( ".option" ).forEach( function( option ) {
+                            option.addEventListener( "click", click_select_option );
+                        } );
+                        
+                        
+                        // Images
+                        document.querySelector( "#pages .link-file-tag" ).innerHTML = "";
+                        document.querySelector( "#pages .del-uploaded-files" ).classList.add( "disabled" );
+                        document.querySelector( "#pages .mediateka-files-grid" ).innerHTML = r.flist;
+                        document.querySelectorAll( "#pages .mediateka-files-grid input[type=checkbox]" ).forEach( function( checkbox ) {
+                            checkbox.addEventListener( "dblclick", img_check_dblclick );
+                            checkbox.addEventListener( "change", img_rechecked );
+                        } );
+                        document.querySelectorAll( "#pages .file-block" ).forEach( function( block ) {
+                            block.addEventListener( "click", img_click );
+                        } );
+                        document.querySelectorAll( "#pages .mediateka-files-grid img" ).forEach( function( img ) {
+                            img.addEventListener( "dblclick", img_lbox );
+                        } );
+
+                        // Show Editor
+                        document.querySelector( "#pages .page-editor-bg" ).classList.remove( "hidden" );
+                        document.body.classList.add( "editor" ); // for notifications
+
+                        // Connect Editor
+                        codemirror_connect( "#pages .page-editor > textarea", "cm" );
+
+                        // restore scroll and cursor position
+                        let cursor = localStorage.getItem( "cursor_page_" + id );
+                        if ( cursor ) {
+                            cursor = JSON.parse( cursor );
+                            window.cm.scrollTo( cursor.left, cursor.top );
+                            window.cm.setCursor( { line:cursor.line, ch:cursor.ch } );
+                            window.cm.refresh();
+                            //window.cm.scrollIntoView( { line:cursor.line, ch:cursor.ch } ); // fix glitch
+                        }
+
+                        // track changes
+                        document.querySelector( "#pages .close-page-button" ).setAttribute( "data-changed", "false" );
+                        document.querySelector( "#pages .page-editor-grid" ).setAttribute( "data-changed", "false" );
+                        cm.on( "change", function( cm, change ) {
+                            document.querySelector( "#pages .close-page-button" ).setAttribute( "data-changed", "true" );
+                            document.querySelector( "#pages .page-editor-grid" ).setAttribute( "data-changed", "true" );
+                        } );
+                        // save scroll and cursor position
+                        [ "cursorActivity", "scroll" ].forEach( function( event ) {
+                            cm.on( event, function() {
+                                let cursor = window.cm.getCursor();
+                                let scroll = window.cm.getScrollInfo();
+                                localStorage.setItem( "cursor_page_" + id, JSON.stringify( { line:cursor.line, ch:cursor.ch, left: scroll.left, top: scroll.top } ) );
+                            } );
+                        } );
+
+                        // set focus to editor
+                        cm.focus();
+
+                        // Save Page Ctrl+S
+                        document.documentElement.addEventListener( "keydown", CtrlS );
+
+                        // open tags panel
+                        if ( document.documentElement.offsetWidth >= 1024 ) {
+                            document.querySelector( "#pages .page-editor-grid" ).classList.add( "tags-opened" );
+                        }
+                    }
+                } );
+            } );
+        } );
+
+        // Select
+        selector.querySelectorAll( ".field-select" ).forEach( function( select ) {
+            select.addEventListener( "click", function( e ) {
+                e.stopPropagation();
+                this.parentElement.classList.toggle( "open" );
+
+                // это можно убрать если переставить стили на родителя
+                select.nextElementSibling.classList.toggle( "open" );
+            } );
+        } );
+        // Option шаблона
+        // вынесено в функцию потому что динамическое изменение
+        selector.querySelectorAll( ".field-options .option" ).forEach( function( option ) {
+            option.addEventListener( "click", click_select_option );
+        } );
+
+        // Транслитерация URL
+        selector.querySelectorAll( ".url-translit" ).forEach( function( btn ) {
+            btn.addEventListener( "click", function( e ) {
+                let url = selector.querySelector( "input[name='title']" ).value;
+                let tr_url = url_translit( url );
+                this.previousElementSibling.value = tr_url;
+            } );
+        } );
+
+        // Выбор всех страниц двойным кликом
+        let check = selector.querySelector( `:scope > input[type=checkbox]` );
+        if ( check ) check.addEventListener( "dblclick", function( e ) {
+            let stat = ! this.checked;
+            document.querySelectorAll( "#pages .pages-grid > div > input[type=checkbox]" ).forEach( function( chbox ) {
+                chbox.checked = stat;
+            } );
+        } );
+
+    }
+
+    // Клик по опции выбора шаблона
+    function click_select_option( e ) {
+        let select = this.closest( ".template-select-grid" );
+        let value  = this.getAttribute( "value" );
+        select_switch_to( select, value );
+    }
+
+    // 
+    function select_switch_to( select, value ) {
+        let field_select = select.querySelector( ".field-select" );
+        let old_value = field_select.getAttribute( "data-template" );
+        if ( old_value != value ) {
+            let old_name = field_select.innerText;
+            let field_options = select.querySelector( ".field-options" );
+            let option = field_options.querySelector( `[value="${value}"]` );
+            field_select.querySelector( ".value" ).innerText = option.innerText;
+            field_select.setAttribute( "data-template", value );
+            option.remove();
+            let option_html = `<div class=option value="${old_value}">${old_name}</div>`;
+            field_options.insertAdjacentHTML( "afterbegin", option_html );
+            field_options.firstChild.addEventListener( "click", click_select_option );
+        }
+    }
+
+    // Select for editor
+    document.querySelectorAll( ".page-properties .field-select" ).forEach( function( select ) {
+        select.addEventListener( "click", function( e ) {
+            e.stopPropagation();
+            this.parentElement.classList.toggle( "open" );
+            // это можно убрать если переставить стили на родителя
+            select.nextElementSibling.classList.toggle( "open" );
+        } );
+    } );
+
+    // Select
+    // Закрытие выпадающих списков при кликах вне их, а так же по ним
+    document.body.addEventListener( "click", function( e ) {
+        document.querySelectorAll( "#pages .template-select-grid" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+
+        // это можно убрать если переставить стили на родителя
+        document.querySelectorAll( "#pages .field-options" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+    } );
+
+    // Search page
+    let pages_search = document.querySelector( "#pages .page-search" );
+    if ( pages_search ) pages_search.addEventListener( "keydown", function( e ) {
+        if ( e.keyCode === 13 ) {
+            // сохраняем событие целиком чтобы ниже считать Shift, Ctrl, Alt
+            cms.search_event = e;
+            search_pages();
+        }
+    } );
+
+    let search_btn = document.querySelector( "#pages .page-search-button" );
+    if ( search_btn ) search_btn.addEventListener( "click", function( e ) {
+        // клик по кнопке не дает Ctrl, Shift, Alt, запишем это
+        cms.search_event = { "ctrlKey": false, "shiftKey": false, "altKey": false };
+        search_pages();
+        document.querySelector( "#pages .page-search" ).focus();
+    } );
+
+    function search_pages() {
+        let search_string = document.querySelector( "#pages .page-search" ).value;
+        let data = {
+            fn: "get_pages_list",
+            search: search_string,
+            Ctrl: cms.search_event.ctrlKey,
+            Shift: cms.search_event.shiftKey,
+            Alt: cms.search_event.altKey,
+        };
+        cms.clear_pages_list = true;
+        api( data, set_pages_list );
+    }
+
+    // Reset Search
+    let reset_btn = document.querySelector( "#pages .reset" );
+    if ( reset_btn ) reset_btn.addEventListener( "click", function() {
+        document.querySelector( "#pages .page-search" ).value = "";
+        document.querySelector( "#pages .page-search-button" ).click();
+    } );
+
+    // Delete pages
+    document.querySelectorAll( "#pages .del-pages-btn" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            let ids = [];
+            document.querySelectorAll( "#pages .pages-grid input[type=checkbox]:checked" ).forEach( function( ch ) {
+                let id = ch.closest( "[data-id]" ).getAttribute( "data-id" );
+                ids.push( id );
+            } );
+            if ( ids.length === 0 ) {
+                notify( _( "no_selected_pages" ), "info-error", 5000 );
+                return;
+            }
+            if ( ! confirm( _( "confirm_delete_pages" ) ) ) {
+                return;
+            }
+            let data = {
+                fn: "del_pages",
+                ids: ids
+            };
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, 5000 );
+                    if ( r.info_class == "info-success" ) {
+                        data.ids.forEach( function( id ) {
+                            document.querySelector( `#pages .pages-grid [data-id="${id}"]` ).remove();
+                            localStorage.removeItem( "cursor_page_" + id );
+                        } );
+                        let count = document.querySelector( "#pages .main-footer .count" );
+                        let loaded = document.querySelector( "#pages .main-footer .loaded" );
+                        loaded.value = parseInt( loaded.value ) - data.ids.length;
+                        count.innerText = parseInt( count.innerText ) - data.ids.length;
+                        // load pages
+                        let offset = +loaded.getAttribute( "data-offset" ) + document.querySelectorAll( "#pages .pages-grid > *" ).length;
+                        let search = document.querySelector( "#pages .page-search" ).value;
+                        let data2 = {
+                            fn: "get_pages_list",
+                            count: data.ids.length,
+                            offset: offset,
+                            search: search
+                        };
+                        // Не менять атрибут смещения у пейджера
+                        cms.dont_change_offset = true;
+                        api( data2, set_pages_list );
+                    }
+                }
+                // update event for menu
+                if ( r.update_menu == "true" ) {
+                    let event = new Event( "update_menu" );
+                    document.body.dispatchEvent( event );
+                }
+            } );
+        } );
+    } );
+
+    // copy file link button
+    document.querySelector( "#pages .link-file-copy-btn" ).addEventListener( "click", function( e ) {
+        let img = this.previousElementSibling.innerText;
+        let tmp = document.createElement( "textarea" );
+        document.body.appendChild( tmp );
+        tmp.value = img;
+        tmp.select();
+        let r = document.execCommand( "copy" );
+        tmp.remove();
+        if ( r ) {
+            if ( img ) {
+                notify( _( "copyed" ), "info-success", 5000 );
+            } else {
+                notify( _( "select_file" ), "info-error", 5000 );
+            }
+        } else {
+            notify( _( "copy_error" ), "info-error", 5000 );
+        }
+        cm.focus();
+    } );
+
+    function CtrlS( e ) {
+        // ы and і - fix for librewolf
+        if ( ( e.code == "KeyS" || e.key == "ы" || e.key == "і" ) && e.ctrlKey == true ) {
+            e.preventDefault(); // don't save page
+            if ( window.location.hash == "#pages" ) {
+                document.querySelector( "#pages .save-page-button" ).click();
+            }
+        }
+        /*/ Ловим кнопки codemirror
+        if ( e.code == "F1" ) {
+            let dialog = document.querySelector( ".CodeMirror-dialog-top" );
+            let html = dialog.outerHTML;
+            cms.dialog = html;
+            //notify( html, "info-success", 5000000 );
+        }
+        if ( e.code == "F2" ) {
+            document.querySelector( ".CodeMirror" ).insertAdjacentHTML( "beforeend", cms.dialog );
+        }
+        */
+    }
+
+    // Save Page
+    document.querySelectorAll( "#pages .save-page-button" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            window.cm.save(); // drop changes to textarea
+            let main_div = document.querySelector( "#pages" );
+            let prop_div = main_div.querySelector( ".page-properties" );
+            let data = {
+                fn: "save_page",
+                id: main_div.querySelector( ".save-page-button" ).getAttribute( "data-id" ),
+                modified: main_div.querySelector( ".page-editor > textarea" ).getAttribute( "data-modified" ),
+                text: main_div.querySelector( ".page-editor > textarea" ).value,
+                title: prop_div.querySelector( "input[name='title']" ).value,
+                url: prop_div.querySelector( "input[name='url']" ).value,
+                seo_title: prop_div.querySelector( "input[name='seo_title']" ).value,
+                description: prop_div.querySelector( "textarea[name='description']" ).value,
+                tags: prop_div.querySelector( "textarea[name='tags']" ).value,
+                date: prop_div.querySelector( "input[name='date']" ).value,
+                time: prop_div.querySelector( "input[name='time']" ).value,
+                template: prop_div.querySelector( ".template-select-grid .field-select" ).getAttribute( "data-template" ),
+                old_template: prop_div.querySelector( ".template-select-grid .field-select" ).getAttribute( "data-old-template" ),
+            }
+            api( data, function( r ) {
+                if ( r.ok == "true" ) {
+                    // set text
+                    if ( r.new_text ) {
+                        window.cm.setValue( r.new_text );
+                    }
+
+                    // Update Title and URL
+                    main_div.querySelector( ".page-editor-title" ).innerHTML = r.title;
+                    main_div.querySelector( ".page-editor-title" ).setAttribute( "href", r.base_path + r.url );
+                    prop_div.querySelector( "input[name='url']" ).value = r.url;
+
+                    // update old template
+                    prop_div.querySelector( ".template-select-grid .field-select" ).setAttribute( "data-old-template", data.template );
+
+                    // Update item in page list
+                    let item = main_div.querySelector( `.pages-grid [data-id='${data.id}']` );
+                    item.querySelector( `.page-name` ).innerHTML = r.title;
+                    item.querySelector( `.page-name` ).setAttribute( "href", r.base_path + r.url );
+                    update_home();
+                    item.querySelector( `input[name='title']` ).value = r.title;
+                    item.querySelector( `input[name='url']` ).value = r.url;
+                    item.querySelector( `input[name='seo_title']` ).value = data.seo_title;
+                    item.querySelector( `textarea[name='description']` ).value = data.description;
+                    item.querySelector( `textarea[name='tags']` ).value = data.tags;
+
+                    // Выставить шаблон в плашке в списке страниц
+                    let select = item.querySelector( `.template-select-grid` );
+                    select_switch_to( select, data.template );
+                    item.querySelector( `.template-select-grid .field-select` ).setAttribute( "data-old-template", data.template );
+
+                    item.querySelector( `input[name='date']` ).value = data.date;
+                    item.querySelector( `input[name='time']` ).value = data.time;
+                    if ( r.planned ) {
+                        item.querySelector( `.page-date` ).classList.add( "future" );
+                    } else {
+                        item.querySelector( `.page-date` ).classList.remove( "future" );
+                    }
+
+                    main_div.querySelector( ".page-editor > textarea" ).setAttribute( "data-modified", r.modified );
+                    main_div.querySelector( ".close-page-button" ).setAttribute( "data-changed", "false" );
+                    main_div.querySelector( ".page-editor-grid" ).setAttribute( "data-changed", "false" );
+                    // edit marker
+                    main_div.querySelectorAll( ".pages-grid > div" ).forEach( function( item ) {
+                        item.classList.remove( "last-edited" );
+                    } );
+                    item.classList.add( "last-edited" );
+                    // close editor after save
+                    if ( main_div.querySelector( ".save-page-button" ).getAttribute( "data-close" ) === "true" ) {
+                        main_div.querySelector( ".save-page-button" ).setAttribute( "data-close", "false" );
+                        main_div.querySelector( ".close-page-button" ).click();
+                    }
+                    // highlight save button
+                    main_div.querySelector( ".save-page-button" ).classList.add( "saved" );
+                    setTimeout( function() {
+                        main_div.querySelector( ".save-page-button" ).classList.remove( "saved" );
+                    }, 1000 );
+
+                    notify( r.info_text, r.info_class, r.info_time );
+
+                    // update event for menu
+                    if ( r.update_menu == "true" ) {
+                        let event = new Event( "update_menu" );
+                        document.body.dispatchEvent( event );
+                    }
+                }
+                if ( r.ok == "false" ) {
+                    // highlight save button
+                    main_div.querySelector( ".save-page-button" ).classList.add( "error" );
+                    setTimeout( function() {
+                        main_div.querySelector( ".save-page-button" ).classList.remove( "error" );
+                    }, 1000 );
+
+                    notify( r.info_text, r.info_class, r.info_time );
+                }
+            } );
+        } );
+    } );
+
+    // transliterate file name
+    function __tr_file( str ) {
+        let ext = str.match( /\.[^\.]+$/, "" );
+        str = str.replace( /\.[^\.]+$/, "" );
+        let sp = cms.tr[" "];
+        cms.tr[" "] = "_";
+        for ( let i in cms.tr ) {
+            let re = new RegExp( i, "g" );
+            str = str.replace( re, cms.tr[i] );
+        }
+        if ( sp === undefined ) {
+            delete cms.tr[" "];
+        } else {
+            cms.tr[" "] = sp;
+        }
+        str = str.replace( /[^-A-Za-z0-9_]+/g, "" );
+        if ( ext[0] ) {
+            str = str + ext[0];
+        }
+        str = str.toLowerCase();
+        return str;
+    }
+
+    // Upload files
+    let upload_btn = document.querySelector( "#pages .upload-files input[type=file]" );
+    if ( upload_btn ) upload_btn.addEventListener( "change", async function( event ) {
+        const formData = new FormData();
+        let id = document.querySelector( "#pages .save-page-button" ).getAttribute( "data-id" );
+        formData.append( "id", id );
+        formData.append( "fn", "upload_files" );
+        let n = 0;
+        for ( let i = 0; i < this.files.length; i++ ) {
+            formData.append( "myfile[]", this.files[i] );
+            let f = `${cms.base_path}uploads/${id}/` + __tr_file( this.files[i].name );
+            let f_exists = document.querySelector( `#pages .file-block [data-src="${f}"]` );
+            if ( f_exists ) { n++; }
+        }
+        let google_chrome_fix = this;
+        if ( n )  {
+            let c = confirm( _( "same_files" ) + ` - ${n} ` + _( "pc" ) + "\n" + _( "confirm_replace" ) );
+            if ( ! c ) {
+                google_chrome_fix.value = "";
+                return c;
+            }
+        }
+        let bar = document.querySelector( "#pages .upload-progress" );
+
+        
+        let ajax = new XMLHttpRequest();
+        
+        ajax.upload.addEventListener( "progress", function( event ) {
+            let percent = Math.round( (event.loaded / event.total) * 100 );
+            bar.style.width = percent + "%";
+        }, false );
+
+        ajax.addEventListener( "error", function( event ) {
+            notify( _( "error_upload_file" ), "info-error", 3600000 );
+            bar.style = "";
+        }, false );
+        
+        ajax.addEventListener( "abort", function( event ) {
+            notify( _( "error_upload_file" ), "info-error", 3600000 );
+            bar.style = "";
+        }, false );
+
+        ajax.addEventListener( "load", function( event ) {
+            bar.style = "";
+            google_chrome_fix.value = "";
+            if ( event.target.status == 413 ) {
+                notify( _( "too_large" ), "info-error", 5000 );
+            } else {
+                let r = JSON.parse( event.target.responseText );
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                    if ( r.info_class == "info-success" ) {
+
+                        // удалить файлы которые были обновлены
+                        let tmp = document.createElement( "div" );
+                        tmp.innerHTML = r.flist;
+                        let imgs = tmp.querySelectorAll( "img" );
+                        imgs.forEach( function( img ) {
+                            let file = img.getAttribute( "data-src" );
+                            let exists_file = document.querySelector( `#pages .file-block [data-src="${file}"]` );
+                            if ( exists_file ) {
+                                exists_file.parentElement.remove();
+                            }
+                        } );
+
+                        let container = document.querySelector( "#pages .mediateka-files-grid" );
+                        container.innerHTML = r.flist + container.innerHTML;
+                        
+                        // images checkboxes
+                        container.querySelectorAll( "input[type=checkbox]" ).forEach( function( checkbox ) {
+                            checkbox.addEventListener( "dblclick", img_check_dblclick );
+                            checkbox.addEventListener( "change", img_rechecked );
+                        } );
+                        
+                        // open lightbox
+                        container.querySelectorAll( "img" ).forEach( function( img ) {
+                            img.addEventListener( "dblclick", img_lbox );
+                        } );
+                        
+                        // generate link
+                        container.querySelectorAll( ".file-block" ).forEach( function( file_block ) {
+                            file_block.addEventListener( "click", img_click );
+                        } );
+                        
+                        // select last uploaded
+                        container.querySelector( ".file-block" ).click();
+                    }
+                }
+            }
+        }, false );
+
+        ajax.open( "POST", cms.api );
+	    ajax.send( formData );
+        
+    } );
+
+    // Close Editor
+    document.querySelectorAll( "#pages .close-page-button" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+
+            // hide mediateka
+            if ( ! document.querySelector( "#pages .page-editor-panel" ).classList.contains( "hidden" ) ) {
+                document.querySelector( "#pages .open-mediateka" ).click();
+            }
+
+            // hide editor
+            document.querySelector( "#pages .page-editor-bg" ).classList.add( "hidden" );
+            document.body.classList.remove( "editor" );
+
+            document.documentElement.removeEventListener( "keydown", CtrlS );
+            
+            // detach
+            if ( window.cm !== undefined ) {
+                if ( this.getAttribute( "data-changed" ) === "true" ) {
+                    if ( confirm( _( "confirm_save" ) ) ) {
+                        document.querySelector( "#pages .save-page-button" ).setAttribute( "data-close", "true" );
+                        document.querySelector( "#pages .save-page-button" ).click();
+                        return;
+                    }
+                }
+                window.cm.toTextArea();
+                window.cm = null;
+            }
+            
+        } );
+    } );
+
+    // Create Page
+    document.querySelectorAll( "#pages .add-page-btn" ).forEach( function( btn ) {
+        btn.addEventListener( "click", function ( e ) {
+            // Отложенный вызов на случай если нужно очистить поиск
+            cms.create_page_fn = function() {
+                api( { fn: "create_page" }, function( r ) {
+                    if ( r.info_text ) {
+                        notify( r.info_text, r.info_class, r.info_time );
+                    }
+                    if ( r.pages ) {
+                        let grid = document.querySelector( "#pages .pages-grid" );
+                        grid.insertAdjacentHTML( "afterbegin", r.pages[0].html );
+                        // Подкрутить список страниц в начало
+                        document.querySelector( "#pages .main-main" ).scrollTop = 0;
+
+                        let page_box = grid.querySelector( `[data-id="${r.pages[0].id}"]` );
+
+                        set_controls( page_box );
+
+                        let counter = document.querySelector( "#pages .main-footer .count" );
+                        counter.innerText = +counter.innerText + 1;
+
+                        let showed_pages_el = document.querySelector( "#pages .main-footer .counters input" );
+                        if ( showed_pages_el.value === get_cookie( "pages_pager" ) ) {
+                            document.querySelector( "#pages .pages-grid > div:last-child" ).remove();
+                        } else {
+                            showed_pages_el.value = +showed_pages_el.value + 1;
+                        }
+                    }
+                } );
+            }
+            // Если сейчас не результаты поиска отображены,
+            // и если мы видим первый пейджер
+            // то сразу выполнить создание страницы
+            let empty_search = document.querySelector( "#pages .page-search" ).getAttribute( "data-result-of" ) === "";
+            let offset_zero = +document.querySelector( "#pages .main-footer .counters input" ).getAttribute( "data-offset" ) === 0;
+            if ( empty_search && offset_zero ) {
+                cms.create_page_fn();
+                cms.create_page_fn = null;
+            } else {
+                document.querySelector( "#pages .reset" ).click();
+                // Создание страницы произведет функция set_pages_list()
+            }
+        } );
+    } );
+
+    // Open Properties
+    document.querySelector( "#pages .open-properties" ).addEventListener( "click", function( e ) {
+        document.querySelector( "#pages .page-editor-grid" ).classList.toggle( "properties" );
+        document.querySelector( "#pages .page-properties" ).classList.toggle( "hidden" );
+        if ( window.cm ) {
+            let cursor = window.cm.getCursor();
+            window.cm.scrollIntoView( { line:cursor.line, ch:cursor.ch } );
+        }
+        if ( document.querySelector( "#pages .page-editor-grid" ).classList.contains( "properties" ) ) {
+            document.querySelector( "#pages .page-editor-grid" ).classList.remove( "mediateka" );
+            document.querySelector( "#pages .page-editor-panel" ).classList.add( "hidden" );
+        }
+    } );
+    
+    // Open Mediateka
+    document.querySelector( "#pages .open-mediateka" ).addEventListener( "click", function( e ) {
+        document.querySelector( "#pages .page-editor-grid" ).classList.toggle( "mediateka" );
+        document.querySelector( "#pages .page-editor-panel" ).classList.toggle( "hidden" );
+        if ( window.cm ) {
+            let cursor = window.cm.getCursor();
+            window.cm.scrollIntoView( { line:cursor.line, ch:cursor.ch } );
+        }
+        if ( document.querySelector( "#pages .page-editor-grid" ).classList.contains( "mediateka" ) ) {
+            document.querySelector( "#pages .page-editor-grid" ).classList.remove( "properties" );
+            document.querySelector( "#pages .page-properties" ).classList.add( "hidden" );
+        }
+        cm.focus();
+    } );
+
+    // Replace Dialog Toggle
+    document.querySelector( "#pages .codemirror-replace" ).addEventListener( "click", function( e ) {
+        let dialog = document.querySelector( "#pages .CodeMirror-dialog" );
+        if ( dialog ) {
+            dialog.remove();
+        } else {
+            let mediateka = ! document.querySelector( "#pages .page-editor-panel" ).classList.contains( "hidden" );
+            if ( mediateka && window.innerWidth < 1024 ) {
+                document.querySelector( "#pages .open-mediateka" ).click();
+            }
+            window.cm.execCommand( "replace" );
+        }
+    } );
+
+    // generate link to clicked file
+    function img_click() {
+        this.parentElement.querySelectorAll( ".file-block" ).forEach( function( block ) {
+            block.classList.remove( "active-file" );
+        } );
+        this.classList.add( "active-file" );
+        let i = this.querySelector( "img" );
+        let t = i.getAttribute( "data-type" );
+        let link = i.getAttribute( "data-src" );
+        let w = i.getAttribute( "width" );
+        let h = i.getAttribute( "height" );
+        let e = link.replace( /.*\./, "" );
+        let img = [ "webp", "tiff", "jpeg", "jpg", "png", "svg", "gif", "bmp", "ico" ];
+        let mus = [ "mp3", "ogg", "m4a", "flac" ];
+        let vid = [ "mp4", "mkv", "webm" ];
+        let a = `<a href="${link}" target=_blank>${link}</a>`;
+        let tag = this.closest( ".mediateka-grid" ).querySelector( ".link-file-tag" );
+        if ( img.indexOf( e ) >= 0 ) {
+            link = `&lt;img alt="" src="${a}"`;
+            if ( w ) {
+                link += ` width="${w}"`;
+            }
+            if ( h ) {
+                link += ` height="${h}"`;
+            }
+            link += ` loading="lazy"`;
+            link += "&gt;";
+            tag.innerHTML = link;
+        } else if ( mus.indexOf( e ) >= 0 ) {
+            link = `&lt;audio src="${a}" controls>&lt;/audio>`;
+            tag.innerHTML = link;
+        } else if ( vid.indexOf( e ) >= 0 ) {
+            link = `&lt;video src="${a}" poster="" controls preload="none">&lt;/video>`;
+            tag.innerHTML = link;
+        } else {
+            link = `&lt;a href="${a}"&gt;TEXT&lt;/a&gt;`;
+            tag.innerHTML = link;
+        }
+        let inner_link = tag.querySelector( "a" );
+        inner_link.addEventListener( "click", file_link_click );
+        cm.focus();
+    }
+
+    function file_link_click( e ) {
+        e.preventDefault();
+        let tmp = document.createElement( "textarea" );
+        document.body.appendChild( tmp );
+        tmp.value = e.target.getAttribute( "href" );
+        tmp.select();
+        let r = document.execCommand( "copy" );
+        tmp.remove();
+        if ( r ) {
+            notify( _( "copyed" ), "info-success", 5000 );
+        } else {
+            notify( _( "copy_error" ), "info-error", 5000 );
+        }
+        cm.focus();
+    }
+
+    // enable or disable delete files button
+    function img_rechecked() {
+        let checked = document.querySelectorAll( "#pages .mediateka-files-grid input[type=checkbox]:checked" );
+        if ( checked.length ) {
+            document.querySelector( "#pages .del-uploaded-files" ).classList.remove( "disabled" );
+        } else {
+            document.querySelector( "#pages .del-uploaded-files" ).classList.add( "disabled" );
+        }
+    }
+
+    // Выбор всех картинок двойным кликом
+    function img_check_dblclick( e ) {
+        let stat = ! this.checked;
+        document.querySelectorAll( "#pages .mediateka-files-grid input[type=checkbox]" ).forEach( function( chbox ) {
+            chbox.checked = stat;
+        } );
+        img_rechecked();
+    }
+    
+    // view in lightbox
+    function img_lbox() {
+        let src = this.getAttribute( "data-src" );
+        let e = src.replace( /.*\./, "" );
+        let img = [ "webp", "tiff", "jpeg", "jpg", "png", "svg", "gif", "bmp", "ico" ];
+        let mus = [ "mp3", "ogg", "m4a", "flac" ];
+        let vid = [ "mp4", "mkv", "webm" ];
+        let t;
+        if ( document.querySelector( "#lbox-window" ) == null ) {
+            if ( img.indexOf( e ) >= 0 ) {
+                t = document.createElement( "img" );
+            } else if ( mus.indexOf( e ) >= 0 ) {
+                t = document.createElement( "audio" );
+                t.setAttribute( "controls", true );
+            } else if ( vid.indexOf( e ) >= 0 ) {
+                t = document.createElement( "video" );
+                t.setAttribute( "controls", true );
+            }
+            if ( t !== undefined ) {
+                t.src = src;
+                let d = document.createElement( "div" );
+                d.id = "lbox-window";
+                d.appendChild( t );
+                document.body.appendChild( d );
+                d.addEventListener( "click", function( e ) {
+                    this.remove();
+                } );
+            }
+        }
+    }
+
+
+    // Delete files
+    document.querySelector( "#pages .del-uploaded-files" ).addEventListener( "click", function( e ) {
+        if ( ! this.classList.contains( "disabled" ) ) {
+            let flist = [];
+            document.querySelectorAll( "#pages .mediateka-files-grid input[type=checkbox]:checked" ).forEach( function( e ) {
+                let f = e.closest( ".file-block" ).querySelector( "img" ).getAttribute( "data-src" );
+                flist.push( f );
+            } );
+            let data = {
+                fn: "del_files",
+                flist: flist
+            };
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    document.querySelector( "#pages .link-file-tag" ).innerHTML = "";
+                    notify( r.info_text, r.info_class, r.info_time );
+                    if ( r.info_class == "info-success" ) {
+                        for ( let f in flist ) {
+                            document.querySelector( `#pages .mediateka-files-grid img[data-src="${flist[f]}"]` ).parentElement.remove();
+                        }
+                        document.querySelector( "#pages .del-uploaded-files" ).classList.add( "disabled" );
+                    }
+                }
+            } );
+        }
+    } );
+
+    // prevent hide cursor when window resize
+    window.addEventListener( "resize", function() {
+        if ( window.cm ) {
+            let cursor = window.cm.getCursor();
+            window.cm.scrollIntoView( { line:cursor.line, ch:cursor.ch } );
+        }
+    } );
+
+    // show/hide tags
+    let tags_btn = document.querySelector( "#pages .tags-helper" );
+    if ( tags_btn ) tags_btn.addEventListener( "click", function( e ) {
+        document.querySelector( "#pages .page-editor-grid" ).classList.toggle( "tags-opened" );
+        cm.focus();
+        cm.refresh();
+    } );
+
+    // for tags
+    document.querySelectorAll( "#pages .tags-grid [data-type='wrap']" ) .forEach( function( btn ) {
+        btn.addEventListener( "click", function( e ) {
+            let otag = this.getAttribute( "data-otag" );
+            let ctag = this.getAttribute( "data-ctag" );
+            let len  = this.getAttribute( "data-len" );
+            let ch   = this.getAttribute( "data-ch" );
+            let line = this.getAttribute( "data-line" );
+            
+            //wrap_selections( otag, ctag, len, line, ch );
+            let cursor = cm.getCursor();
+            let selections = cm.getSelections();
+            let replacements = [];
+            for ( let i = 0; i < selections.length; i++ ) {
+                replacements[i] = otag + selections[i] + ctag;
+            }
+            cm.replaceSelections( replacements );
+            // Прятять панельку на мобильнике
+            if ( window.innerWidth < 1024 ) {
+                //document.querySelector( "#pages .tags-helper" ).click();
+                let grid = this.closest( ".editor-grid" );
+                grid.classList.remove( "tags-opened" );
+            }
+            if ( selections.length < 2 ) {
+                if ( line ) {
+                    cursor.line += +line;
+                    cursor.ch = +ch;
+                } else if ( len ) {
+                    cursor.ch += +len;
+                }
+                cm.setCursor( cursor );
+            }
+            cm.focus();
+            cm.refresh();
+        } );
+    } );
+    // for <a> tag
+    document.querySelectorAll( "#pages .tags-grid [data-type='wrap-a']" ) .forEach( function( btn ) {
+        btn.addEventListener( "click", function( e ) {
+            let cursor = cm.getCursor();
+            let selections = cm.getSelections();
+            let replacements = [];
+            
+            for ( let i = 0; i < selections.length; i++ ) {
+                if ( selections[i].match( /https?:\/\// ) ) {
+                    replacements[i] = `<a href="${selections[i]}" target=_blank>${selections[i]}</a>`;
+                } else {
+                    replacements[i] = `<a href="" target=_blank>${selections[i]}</a>`;
+                }
+            }
+            
+            cm.replaceSelections( replacements );
+
+            if ( selections.length == 1 && selections[0] === "" ) {
+                cursor.ch += 9;
+                cm.setCursor( cursor );
+            }
+            
+            if ( window.innerWidth < 1024 ) {
+                //document.querySelector( "#pages .tags-helper" ).click();
+                let grid = this.closest( ".editor-grid" );
+                grid.classList.remove( "tags-opened" );
+            }
+
+            cm.focus();
+            cm.refresh();
+        } );
+    } );
+    // for tags <ul> and <ol>
+    document.querySelectorAll( "#pages .tags-grid [data-type='wrap-list']" ) .forEach( function( btn ) {
+        btn.addEventListener( "click", function( e ) {
+            let tag = this.getAttribute( "data-tag" );
+            let selections = cm.getSelections();
+            let replacements = [];
+
+            if ( selections.length == 1 && selections[0] === "" ) {
+                replacements[0] = `<${tag}>\n    <li></li>\n</${tag}>`;
+            } else if ( selections.length == 1 ) {
+                let lines = selections[0].split( "\n" );
+                replacements[0] = `<${tag}>\n    <li>` + lines.join( "</li>\n    <li>" ) + `</li>\n</${tag}>`;
+            } else {
+                let n = selections.length - 1;
+                for ( let i = 0; i <= n; i++ ) {
+                    replacements[i] = `    <li>${selections[i]}</li>`;
+                }
+                replacements[0] = `<${tag}>\n` + replacements[0];
+                replacements[n] = replacements[n] + `\n</${tag}>`;
+            }
+
+            cm.replaceSelections( replacements );
+            
+            if ( window.innerWidth < 1024 ) {
+                //document.querySelector( "#pages .tags-helper" ).click();
+                let grid = this.closest( ".editor-grid" );
+                grid.classList.remove( "tags-opened" );
+            }
+
+            cm.focus();
+            cm.refresh();
+        } );
+    } );
+
+    // fix glitches codemirror
+    let fix = document.querySelector( "aside a[href='#pages']" );
+    if ( fix ) fix.addEventListener( "click", function( e ) {
+        setTimeout( function( e ) {
+            if ( window.cm ) {
+                cm.refresh();
+                cm.focus();
+            }
+        }, 50 );
+    } );
+
+    // Транслитерация URL
+    let tr_url = document.querySelector( "#pages .page-editor-grid .url-translit" );
+    if ( tr_url ) tr_url.addEventListener( "click", function( e ) {
+        let url = document.querySelector( "#pages .page-editor-grid .page-properties input[name='title']" ).value;
+        let tr_url = url_translit( url );
+        this.previousElementSibling.value = tr_url;
+    } );
+    function url_translit( url ) {
+        url = url.toLowerCase();
+        for ( let i in cms.tr ) {
+            let re = new RegExp( i, "g" );
+            url = url.replace( re, cms.tr[i] );
+        }
+        url = url.replace( / +/g, "-" );
+        url = url.replace( /[^-a-z0-9_]+/g, "" );
+        url = url.replace( /^[-_]+|[-_]+$/g, "" );
+        return url;
+    }
+
+    function update_home() {
+        document.querySelectorAll( `#pages .pages-grid [data-id]` ).forEach( function( page ) {
+            if ( page.querySelector( `.page-name[href="${cms.base_path}"]` ) ) {
+                page.classList.add( "home" );
+            } else {
+                page.classList.remove( "home" );
+            }
+        } );
+    }
+
+
+    // Замена текста на всех страницах
+    document.querySelectorAll( "#pages-utils .replace-btn" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            let data = {
+                fn: "replace_in_pages",
+                table: document.querySelector( "#pages-utils input[name='table']" ).value,
+                id_col: document.querySelector( "#pages-utils input[name='id_col']" ).value,
+                column: document.querySelector( "#pages-utils input[name='column']" ).value,
+                search_regex: document.querySelector( "#pages-utils input[name='search_regex']" ).value,
+                replace: document.querySelector( "#pages-utils input[name='replace']" ).value,
+            };
+            if ( data.search_regex && confirm( _( "replace_in_pages_confirm" ) ) ) {
+                api( data, function( r ) {
+                    if ( r.info_text ) {
+                        notify( r.info_text, r.info_class, r.info_time );
+                    }
+                } );
+            }
+        } );
+    } );
+
+} );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/js/rss.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,43 @@
+document.addEventListener( "DOMContentLoaded", function( event ) {
+
+    let select     = document.querySelector( "#rss .xml-wrapper-hidden .select-dropdown" );
+    let page_input = select.querySelector( "input" );
+
+    // Поиск при каждом нажатии кнопки
+    page_input.addEventListener( "keyup", function( e ) {
+        api( { fn: "get_search_pages_list", search: this.value }, function( r ) {
+            select.classList.add( "open" );
+            if ( r.html ) {
+                select.querySelector( ".list-search" ).innerHTML = r.html;
+                select.querySelector( ".list-search li[data-id='0']" ).remove();
+                select.querySelectorAll( ".list-search li" ).forEach( function( li ) {
+                    li.addEventListener( "click", li_click );
+                } );
+            }
+        } );
+    } );
+
+    // Щелчок по выбранной странице
+    function li_click() {
+        let url   = this.getAttribute( "data-url" );
+
+        let textarea = document.querySelector( "#rss textarea[name='exclude']" );
+        let val = textarea.value.trim();
+        let n = val ? "\n" : "";
+        textarea.value = val + n + url;
+        
+        select.classList.remove( "open" );
+    }
+
+    page_input.addEventListener( "click", function( e ) {
+        e.stopPropagation();
+        page_input.dispatchEvent( new Event( "keyup" ) );
+        select.classList.add( "open" );
+    } );
+
+    // collapse select dropdown
+    document.body.addEventListener( "click", function( e ) {
+        select.classList.remove( "open" );
+    } );
+
+} );
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/js/sitemap.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,43 @@
+document.addEventListener( "DOMContentLoaded", function( event ) {
+
+    let select     = document.querySelector( "#sitemap .xml-wrapper-hidden .select-dropdown" );
+    let page_input = select.querySelector( "input" );
+
+    // Поиск при каждом нажатии кнопки
+    page_input.addEventListener( "keyup", function( e ) {
+        api( { fn: "get_search_pages_list", search: this.value }, function( r ) {
+            select.classList.add( "open" );
+            if ( r.html ) {
+                select.querySelector( ".list-search" ).innerHTML = r.html;
+                select.querySelector( ".list-search li[data-id='0']" ).remove();
+                select.querySelectorAll( ".list-search li" ).forEach( function( li ) {
+                    li.addEventListener( "click", li_click );
+                } );
+            }
+        } );
+    } );
+
+    // Щелчок по выбранной странице
+    function li_click() {
+        let url   = this.getAttribute( "data-url" );
+
+        let textarea = document.querySelector( "#sitemap textarea[name='exclude']" );
+        let val = textarea.value.trim();
+        let n = val ? "\n" : "";
+        textarea.value = val + n + url;
+        
+        select.classList.remove( "open" );
+    }
+
+    page_input.addEventListener( "click", function( e ) {
+        e.stopPropagation();
+        page_input.dispatchEvent( new Event( "keyup" ) );
+        select.classList.add( "open" );
+    } );
+
+    // collapse select dropdown
+    document.body.addEventListener( "click", function( e ) {
+        select.classList.remove( "open" );
+    } );
+
+} );
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/js/template.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,223 @@
+document.addEventListener( "DOMContentLoaded", function( event ) {
+
+    function _( str ) {
+        return __( str, "template.mod.php" );
+    }
+
+    // Edit file
+    document.querySelectorAll( "#template .template-files .file" ).forEach( function( button ) {
+        button.addEventListener( "click", function( e ) {
+            let file = this.innerText;
+            // get file from server
+            api( { fn: "get_template_file", file: file }, function( r ) {
+                if ( r.ok == "true" ) {
+                    document.querySelector( ".template-editor-title" ).innerText = file;
+                    document.querySelector( ".template-editor > textarea" ).value = r.file;
+
+                    // Show Editor
+                    document.querySelector( ".template-editor-bg" ).classList.remove( "hidden" );
+                    document.body.classList.add( "editor" ); // for notifications
+
+                    let ext = file.match( /\.[^\.]+$/, "" );
+                    let aext = {
+                        ".php"  : "application/x-httpd-php",
+                        ".html" : "application/x-httpd-php",
+                        ".css"  : "text/css"
+                    }
+                    let atags = {
+                        ".php"  : "php",
+                        ".html" : "html",
+                        ".css"  : "css"
+                    }
+
+                    // Отображаем подходящие теги, остальные прячем
+                    document.querySelectorAll( `#template .template-editor-bg .snip-grid > *` ).forEach( function( el ) {
+                        if ( el.classList.contains( atags[ext] ) ) {
+                            el.classList.remove( "hidden" );
+                        } else {
+                            el.classList.add( "hidden" );
+                        }
+                    } );
+
+                    // Подключаем редактор Codemirror функцией расположенной в admin.js
+                    codemirror_connect( "#template .template-editor > textarea", "cmt", { mode: aext[ext] } );
+
+                    // track changes
+                    document.querySelector( ".close-template-button" ).setAttribute( "data-changed", "false" );
+                    cmt.on( "change", function( cmt, change ) {
+                        document.querySelector( ".close-template-button" ).setAttribute( "data-changed", "true" );
+                        document.querySelector( ".template-editor-grid" ).setAttribute( "data-changed", "true" );
+                    } );
+
+                    // set cursor to editor
+                    cmt.focus();
+
+                    // Save Teplate Ctrl+S
+                    document.querySelector( "body" ).addEventListener( "keydown", CtrlS );
+
+                    document.querySelector( ".template-editor-grid" ).setAttribute( "data-changed", "false" );
+                }
+            } );
+        } );
+    } );
+
+    // Для сниппетов
+    document.querySelectorAll( "#template .snip-grid [data-type='snip']" ).forEach( function( btn ) {
+        btn.addEventListener( "click", function( e ) {
+            let text = this.getAttribute( "data-text" );
+            let cm = window["cmt"];
+            if ( cm ) {
+                let otag = this.getAttribute( "data-otag" );
+                let ctag = this.getAttribute( "data-ctag" );
+                let selections = cm.getSelections();
+                let replacements = [];
+                for ( let i = 0; i < selections.length; i++ ) {
+                    replacements[i] = otag + selections[i] + ctag;
+                }
+                cm.replaceSelections( replacements );
+                // с курсорами пока не понятен алгоритм
+                /*
+                selections = cm.listSelections();
+                let shift = +this.getAttribute( "data-len" );
+                if ( shift != 0 ) {
+                    for ( let i = 0; i < selections.length; i++ ) {
+                        selections[i].head.ch += shift;
+                        selections[i].anchor.ch += shift;
+                    }
+                }
+                */
+                cm.focus();
+                cm.refresh();
+            }
+        } );
+    } );
+
+    // Close Editor
+    document.querySelectorAll( ".close-template-button" ).forEach( function( button ) {
+        button.onclick = function( e ) {
+            document.querySelector( "body" ).removeEventListener( "keydown", CtrlS );
+            // detach
+            if ( window.cmt !== undefined ) {
+                if ( this.getAttribute( "data-changed" ) === "true" ) {
+                    if ( confirm( _( "confirm_save" ) ) ) {
+                        document.querySelector( ".save-template-button" ).setAttribute( "data-close", "true" );
+                        document.querySelector( ".save-template-button" ).click();
+                        return;
+                    }
+                }
+                window.cmt.toTextArea();
+                window.cmt = null;
+            }
+            // hide editor
+            document.querySelector( ".template-editor-bg" ).classList.add( "hidden" );
+            document.body.classList.remove( "template_editor" );
+            //window.prevent_reload = false;
+        };
+    } );
+
+    // Save File
+    document.querySelectorAll( ".save-template-button" ).forEach( function( button ) {
+        button.onclick = function( e ) {
+            window.cmt.save(); // drop changes to textarea
+            let data = {
+                fn: "save_template_file",
+                file: document.querySelector( ".template-editor-title" ).innerText,
+                content: document.querySelector( ".template-editor > textarea" ).value
+            }
+            api( data, function( r ) {
+                if ( r.info_text ) {
+                    notify( r.info_text, r.info_class, r.info_time );
+                }
+                if ( r.ok == "true" ) {
+                    //?
+                    document.querySelector( ".close-template-button" ).setAttribute( "data-changed", "false" );
+                    // hide changed indicator
+                    document.querySelector( ".template-editor-grid" ).setAttribute( "data-changed", "false" );
+                    // highlight save button
+                    document.querySelector( ".save-template-button" ).classList.add( "saved" );
+                    setTimeout( function() {
+                        document.querySelector( ".save-template-button" ).classList.remove( "saved" );
+                    }, 1000 );
+                    // close editor after save only if ok
+                    if ( document.querySelector( ".save-template-button" ).getAttribute( "data-close" ) === "true" ) {
+                        document.querySelector( ".save-template-button" ).setAttribute( "data-close", "false" );
+                        document.querySelector( ".close-template-button" ).click();
+                    }
+                }
+            } );
+        };
+    } );
+
+    function CtrlS( e ) {
+        // ы and і - fix for librewolf
+        if ( ( e.code == "KeyS" || e.key == "ы" || e.key == "і" ) && e.ctrlKey == true ) {
+            e.preventDefault(); // don't save page
+            if ( window.location.hash == "#template" ) {
+                document.querySelector( ".save-template-button" ).click();
+            }
+        }
+    }
+
+    // Install template (upload template)
+    let input = document.querySelector( "#template-upload" );
+    input.addEventListener( "change", async function( e ) {
+        const formData = new FormData();
+        formData.append( "fn", "install_template" );
+        for ( let i = 0; i < input.files.length; i++ ) {
+            formData.append( "myfile[]", input.files[i] );
+        }
+        try {
+            const response = await fetch( cms.api, { method: "POST", body: formData } );
+            const r        = await response.json();
+            input.value = ""; // chrome fix
+            if ( r.info_text ) {
+                notify( r.info_text, r.info_class, r.info_time );
+                setTimeout( function() {
+                    window.location.reload( true );
+                }, r.info_time );
+            }
+        } catch ( error ) {
+            console.error( "Error:", error );
+        }
+    } );
+
+    // prevent hide cursor when window resize
+    window.addEventListener( "resize", function() {
+        if ( window.cmt ) {
+            let cursor = window.cmt.getCursor();
+            window.cmt.scrollIntoView( { line:cursor.line, ch:cursor.ch } );
+        }
+    } );
+
+    // Select
+    document.querySelectorAll( "#template .field-select" ).forEach( function( select ) {
+        select.addEventListener( "click", function( e ) {
+            e.stopPropagation();
+            this.parentElement.classList.toggle( "open" );
+            
+            // это можно убрать если переставить стили на родителя
+            select.nextElementSibling.classList.toggle( "open" );
+        } );
+    } );
+    // Option
+    document.querySelectorAll( "#template .field-options .option" ).forEach( function( option ) {
+        option.addEventListener( "click", function( e ) {
+            let input = this.closest( ".template-select-grid" ).querySelector( ".field-select" );
+            input.querySelector( ".value" ).innerText = this.innerText;
+            document.querySelector( "#template input[name='template']" ).value = this.innerText;
+        } );
+    } );
+    // Select
+    // Закрытие выпадающих списков при кликах вне их, а так же по ним
+    document.body.addEventListener( "click", function( e ) {
+        document.querySelectorAll( "#template .template-select-grid" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+
+        // это можно убрать если переставить стили на родителя
+        document.querySelectorAll( "#template .field-options" ).forEach( function( list ) {
+            list.classList.remove( "open" );
+        } );
+    } );
+
+} );
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/admin.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,115 @@
+<?php
+$cms["lang"]["admin.mod.php"]["en_US.UTF-8"] = array(
+    "en_US.UTF-8" => "English",
+    "cant_write_config" => "Can't write",
+    "home_link" => "Home",
+    "cache_btn" => "Cache",
+    "theme_btn" => "Theme",
+    "logout_btn" => "Logout",
+    "hello" => "Hello!",
+    "hello_set_base" => "The first step is to set up your <a href='#base'>database connection</a>.",
+    "set_login_and_password" => "Setup Login and Password",
+    "login_or_password" => "Login or Email",
+    "password" => "Password",
+    "login_btn" => "Enter",
+    "support" => "Support",
+    "support_url" => "https://coffee-cms.ru/podderzhka",
+    "codemirror_search" => "Search:",
+    "codemirror_re" => "(Use /re/ syntax for regexp search)",
+    "codemirror_replace_all" => "Replace all:",
+    "codemirror_replace_with" => "With:",
+    "codemirror_replace_replace" => "Replace:",
+    "codemirror_replace_confirm" => "Replace?",
+    "codemirror_yes" => "Yes",
+    "codemirror_no" => "No",
+    "codemirror_all" => "All",
+    "codemirror_stop" => "Stop",
+    "not_empty_section" => "Section is not empty",
+    "confirm_delete" => "Delete?",
+    "hide_admin_settings" => "Hide Admin settings?",
+    "confirm_logout" => "Close this session?",
+    "admin_module_name" => "Admin",
+    "admin_module_description" => "Responsible for the items Authorization, PHP Info, Admin, Modules.",
+    "set_password" => "Set",
+    "current_logins" => "Current logins",
+    "logins_history" => "Logins history",
+    "admin_url" => "Admin URL",
+    "mod_on" => "Turn on",
+    "mod_off" => "Turn off",
+    "mod_del" => "Delete",
+    "mod_install" => "Install module",
+    "show" => "Show",
+    "hide" => "Hide",
+    "save" => "Save",
+    "reset" => "Reset",
+    "delete" => "Delete",
+    "install_finished" => "Install finished",
+    "congrat" => "Congratulations!",
+    "login_info" => "Credentials for login",
+    "login_url" => "Login URL",
+    "login" => "Login",
+    "access_denied" => "Access denied",
+    "logout_completed" => "Logout completed",
+    "section_added" => "Section added",
+    "deleted" => "Deleted",
+    "not_disabled" => "It is not a switchable module",
+    "delete_this_files" => "Delete following files:",
+    "upload_error_xxx" => "Error upload xxx",
+    "install_success" => "Install success",
+    "cant_open_zip_xxx" => "Can't open zip xxx",
+    "cant_extract_xxx" => "Can't extract xxx",
+    "auth" => "Auth",
+    "settings" => "Settings",
+    "php_info" => "PHP Info",
+    "modules" => "Modules",
+    "content" => "Content",
+    "add_section" => "New Section",
+    "server_error" => "Server error",
+    "network_error" => "Network error",
+    "reset_all" => "Reset all",
+    "reset_all_ok" => "Reset completed",
+    "create_zip" => "Create Zip",
+    "create" => "Create",
+    "remove" => "Remove",
+    "removed" => "Removed",
+    "have_errors" => "Have errors",
+    "help1" => "Copy and save the recovery link. If the update was unsuccessful, follow the copied link, the CMS will be restored.",
+    "recovery_url" => "Recovery URL:",
+    "update_core" => "Update Core Modules",
+    "check" => "Check",
+    "check_dev" => "Check Dev",
+    "try_later" => "Try it in xxx min",
+    "cant_get" => "Can't get file",
+    "cant_remove" => "Can't remove",
+    "check_updates" => "Please check updates",
+    "current_v" => "Current version:",
+    "last_v" => "Last version:",
+    "checked" => "Last check:",
+    "download_error" => "Download error",
+    "unknown" => "Unknown",
+    "never" => "Never",
+    "cant_create_tmp_dir" => "Can't create tmp dir",
+    "cant_write_file" => "Can't write file",
+    "cant_open_zip" => "Can't open zip",
+    "cant_extract" => "Can't extract",
+    "file_list_missing" => "File list missing",
+    "file_not_exists" => "File not exists:",
+    "file_changed" => "Changed file:",
+    "update_error_rights" => "Update error when test current files permissions.<br>Please check files permissions.",
+    "update_error_move" => "Update error when moving new files. Please check files permissions.",
+    "update_error_remove" => "Update failed while deleting old files. Please check file permissions.",
+    "successfull_update" => "Successfull update",
+    "archive_created" => "Archive created",
+    "files" => "Files:",
+    "already_updated" => "Already updated",
+    "for_dev" => "Dev",
+    "incompatible_v" => "Incompatible version. Download new <a href='https://coffee-cms.ru/' target=_blank>https://coffee-cms.ru/</a>",
+    "impossible" => "The update is not possible. Install the new version manually.",
+    "file_or_dir_not_exists" => "File or directory does not exist",
+    "backup_error" => "Error creating backup",
+    "error_creating" => "Error creating file:",
+    "json_error" => "JSON file error",
+    "update" => "Update",
+    "changed_files" => "Changed files",
+    "no_files_changed" => "No files changed",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/base.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,15 @@
+<?php
+$cms["lang"]["base.mod.php"]["en_US.UTF-8"] = array(
+    "base_module_name" => "Data Base",
+    "base_module_description" => "Data Base Module",
+    "server_address" => "Host",
+    "server_port" => "Port",
+    "db_name" => "Base",
+    "db_user" => "User",
+    "db_password" => "Password",
+    "admin_login" => "DBMS Admin",
+    "admin_passwd" => "DBMS Admin Password",
+    "create_btn" => "Create",
+    "create_db" => "Create database:",
+    "save" => "Save",
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/menu.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+<?php
+$cms["lang"]["menu.mod.php"]["en_US.UTF-8"] = array(
+    "menu_module_name" => "Menu",
+    "menu_module_description" => "Module for building menu",
+    "created" => "Created",
+    "deleted" => "Deleted",
+    "updated" => "Updated",
+    "update_properties_error" => "Error update properties",
+    "parent" => "Parent",
+    "no_parent" => "No parent",
+    "no_area" => "No Area",
+    "page" => "Page",
+    "no_page" => "Custom link",
+    "area" => "Area",
+    "title" => "Title",
+    "hint" => "Tag Title",
+    "classes" => "Classes",
+    "sort" => "Sort",
+    "save" => "Save",
+    "properties" => "Properties",
+    "delete" => "Delete",
+    "confirm_delete" => "Delete?",
+    "append_item" => "Item",
+    "add_menu" => "Add menu",
+    "placeholder_hint" => "Replaces page title",
+    "no_connect_db" => "Please connect to database.",
+    "no_tables_db" => "Go to the Database tab and click the Save button to create the tables.",
+    "search" => "Search...",
+    "deleted_page" => "Page deleted",
+    "target_blank" => "Open in new window",
+    "navigation" => "Navigation",
+    "sql_error" => "Error creating: ",
+    "menu_default_title" => "Menu",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/pages.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+<?php
+$cms["lang"]["pages.mod.php"]["en_US.UTF-8"] = array(
+    "pages_module_name" => "Pages",
+    "pages_module_description" => "Module for edditing pages",
+    "page_default_title" => "Page",
+    "updated" => "Updated",
+    "title" => "Title",
+    "date" => "Date",
+    "time" => "Time",
+    "template" => "Template",
+    "no_template" => "No template",
+    "published" => "Published",
+    "unpublished" => "Unpublished",
+    "search" => "Search...",    
+    "delete" => "Delete",
+    "page_created" => "Page created",
+    "page_changed" => "Someone already changed the page",
+    "mediateka" => "Mediateka",
+    "upload" => "Upload",
+    "error_create_folder" => "Can't create folder",
+    "error_upload_file" => "Error upload file",
+    "files_uploaded" => "Files uploaded",
+    "pages_deleted" => "Pages deleted",
+    "files_deleted" => "Files deleted",
+    "same_files" => "Files with the same names found on the server",
+    "pc" => "pc.",
+    "confirm_replace" => "Overwrite them or cancel the upload?",
+    "saved" => "Saved",
+    "confirm_delete_pages" => "Delete selected pages? Files attached to these pages will be deleted.",
+    "copy" => "Copy",
+    "copyed" => "Copyed",
+    "copy_error" => "Copy Error",
+    "select_file" => "Please select file",
+    "error_creating_page" => "Error creating page: ",
+    "no_connect_db" => "Please connect to database.",
+    "no_tables_db" => "Go to the Database tab and click the Save button to create the tables.",
+    "blanks" => "Blanks",
+    "codemirror" => "Editor",
+    "file_move_error" => "File move error",
+    "replace" => "Replace",
+    "confirm_save" => "Save changes?",
+    "save" => "Save",
+    "edit" => "Edit",
+    "properties" => "Properties",
+    "server_overloaded_xxx" => "Server overloaded. Sent xxx pages.",
+    "browser_overloaded_xxx" => "The browser is overloaded. Inserted xxx pages out of nnn.",
+    "of" => "of",
+    "tags" => "Tags",
+    "h1" => "Header",
+    "p" => "Paragraph",
+    "div" => "Block",
+    "link" => "Link",
+    "span" => "Span",
+    "code" => "Code",
+    "cite" => "Blockquote",
+    "ul" => "Unordered list",
+    "ol" => "Ordered list",
+    "li" => "List item",
+    "figure" => "Figure",
+    "bold" => "Bold",
+    "max_size" => "Max upload size: ",
+    "bytes" => " bytes",
+    "no_selected_pages" => "First select the pages.",
+    "seo_title" => "Alt Title",
+    "comment" => "Comment",
+    "content" => "Content",
+    "description" => "Description",
+    "deleted_page" => "Deleted page",
+    "page" => "Page",
+    "post" => "Post",
+    "frontpage" => "Frontpage",
+    "blog" => "Blog",
+    "url_translit" => "Create link from title",
+    "front_url" => "Front",
+    "home_page" => "Home",
+    "pages_utils" => "Replacement",
+    "replace_btn" => "Replace",
+    "replace_instruction" => "Enter a regular expression to replace one text with another on all pages of the site. An empty expression is ignored. / characters are escaped.",
+    "replace_in_pages_confirm" => "The specified replacements will be made on all pages.",
+    "replace_ok" => "Replaces done.",
+    "replace_table" => "Table",
+    "replace_id_col" => "Column with id (for WHERE)",
+    "replace_column" => "Column with replacement text",
+    "regex_title" => "Replacement regex",
+    "replace_title" => "Replace with",
+    "add_page_hint" => "Add the page by clicking the plus sign next to the search.",
+    "too_large" => "The files are too large.",
+    "url_changed" => "URL is already taken and has been changed.",
+    "search_with_ctrl" => "Shift - break into letters\nCtrl - search through texts",
+    "add_page_title" => "Add page",
+    "kbd" => "Button",
+    "mark" => "Select",
+    "pin" => "Pin to top",
+    "delete_pages" => "Delete selected pages",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/rss.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,18 @@
+<?php
+$cms["lang"]["rss.mod.php"]["en_US.UTF-8"] = array(
+    "rss_module_name" => "RSS",
+    "rss_module_description" => "Setting up an RSS feed",
+    "view_rss" => "View RSS feed",
+    "excluded_links" => "Excluded links",
+    "save" => "Save",
+    "placeholder" => "Select page...",
+    "rss_gen" => "Rules for generating rss.rss file",
+    "static" => "Static",
+    "dynamic" => "Dynamic",
+    "update_freq" => "Frequency Recreate",
+    "static_freq" => "Static CRON generation at",
+    "minutes" => "-minute intervals",
+    "rss_items_count" => "Number of items in the RSS feed",
+    "tpl_rss_title" => "RSS feed",
+    "url_for_cron" => "URL for CRON",
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/sitemap.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,21 @@
+<?php
+$cms["lang"]["sitemap.mod.php"]["en_US.UTF-8"] = array(
+    "sitemap_module_name" => "Sitemap",
+    "sitemap_module_description" => "Module for configure sitemap.xml",
+    "save" => "Save",
+    "excluded_links" => "Excluded links",
+    "included_links" => "Included links",
+    "sitemap_gen" => "Rules for generating sitemap.xml file",
+    "static" => "Static",
+    "dynamic" => "Dynamic",
+    "help_p1" => "Saving a page or page properties will delete the static sitemap.",
+    "help" => "Help",
+    "help_p2" => "If you have pending publications for the future, you can set the dynamic generation of the sitemap or static using the CRON scheduler.",
+    "update_freq" => "Frequency Recreate",
+    "static_freq" => "Static CRON generation at",
+    "minutes" => "-minute intervals",
+    "url_for_cron" => "URL for CRON",
+    "domain" => "If the site operates on two domains, you can specify the Protocol and Domain for the static sitemap:",
+    "view_sitemap" => "View site map",
+    "placeholder" => "Select page...",
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/en_US.UTF-8/template.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+<?php
+$cms["lang"]["template.mod.php"]["en_US.UTF-8"] = array(
+    "template_module_name" => "Template",
+    "template_module_description" => "Module for switch templates and configure template settings",
+    "current_template" => "Current Template",
+    "save" => "Save",
+    "editable_files" => "Editable files for this template",
+    "no_editable_files" => "No files for edit",
+    "confirm_save" => "Save changes?",
+    "saved" => "Saved",
+    "save_error" => "Save error",
+    "install_template" => "Install template",
+    "upload_error_xxx" => "Error upload xxx",
+    "cant_unzip_xxx" => "Can't unzip xxx",
+    "install_success" => "Install success",
+    "enable_cache" => "Enable cache",
+    "cache_cleared" => "Cache Cleared",
+    "help" => "Help",
+    "headers_title" => "HTTP headers for files and pages",
+    "hint_css" => "More snippets",
+    "hint_php" => "More snippets",
+    "hint_html" => "More snippets",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/admin.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,117 @@
+<?php
+$cms["lang"]["admin.mod.php"]["ru_RU.UTF-8"] = array(
+    "ru_RU.UTF-8" => "Русский",
+    "cant_write_config" => "Не могу записать",
+    "home_link" => "Главная",
+    "cache_btn" => "Кэш",
+    "theme_btn" => "Тема",
+    "logout_btn" => "Выход",
+    "hello" => "Привет!",
+    "hello_set_base" => "Первым делом настройте <a href='#base'>подключение к базе данных</a>.",
+    "set_login_and_password" => "Установите логин и пароль",
+    "login_or_password" => "Логин или эл.почта",
+    "password" => "Пароль",
+    "login_btn" => "Войти",
+    "support" => "Поддержка",
+    "support_url" => "https://coffee-cms.ru/podderzhka",
+    "codemirror_search" => "Поиск:",
+    "codemirror_re" => "(Используйте синтаксис /re/ для поиска регулярными выражениями)",
+    "codemirror_replace_all" => "Заменить все:",
+    "codemirror_replace_with" => "На:",
+    "codemirror_replace_replace" => "Заменить:",
+    "codemirror_replace_confirm" => "Заменить?",
+    "codemirror_yes" => "Да",
+    "codemirror_no" => "Нет",
+    "codemirror_all" => "Всё",
+    "codemirror_stop" => "Стоп",
+    "not_empty_section" => "Секция не пуста",
+    "confirm_delete" => "Удалить?",
+    "hide_admin_settings" => "Скрыть настройку админки?",
+    "confirm_logout" => "Выполнить выход?",
+    "admin_module_name" => "Админка",
+    "admin_module_description" => "Отвечает за пункты Авторизация, PHP Инфо, Админка, Модули.",
+    "set_password" => "Установить",
+    "current_logins" => "Текущие входы",
+    "logins_history" => "История входов",
+    "admin_url" => "URL админки",
+    "mod_on" => "Включить",
+    "mod_off" => "Выключить",
+    "mod_del" => "Удалить",
+    "mod_install" => "Установить модуль",
+    "show" => "Показать",
+    "hide" => "Скрыть",
+    "save" => "Сохранить",
+    "reset" => "Сброс",
+    "delete" => "Удалить",
+    "install_finished" => "Установка завершена",
+    "congrat" => "Поздравляем!",
+    "login_info" => "Данные для входа на сайт",
+    "login_url" => "Адрес админки",
+    "login" => "Логин",
+    "access_denied" => "Доступ запрещен",
+    "logout_completed" => "Выход выполнен",
+    "section_added" => "Добавлена секция",
+    "deleted" => "Удалено",
+    "not_disabled" => "Это не отключаемый модуль",
+    "delete_this_files" => "Удалите следующие файлы:",
+    "upload_error_xxx" => "Ошибка загрузки xxx",
+    "install_success" => "Успешная установка",
+    "cant_open_zip_xxx" => "Не могу открыть архив xxx",
+    "cant_extract_xxx" => "Не могу распаковать xxx",
+    "auth" => "Авторизация",
+    "settings" => "Настройки",
+    "php_info" => "PHP Инфо",
+    "modules" => "Модули",
+    "content" => "Контент",
+    "add_section" => "Новая секция",
+    "server_error" => "Ошибка на сервере",
+    "network_error" => "Ошибка сети",
+    "reset_all" => "Сбросить все",
+    "reset_all_ok" => "Сброс произведен",
+
+    "create_zip" => "Создать Zip",
+    "create" => "Создать",
+    "remove" => "Удалить",
+    "removed" => "Удалено",
+    "have_errors" => "Есть ошибки",
+    "help1" => "Скопируйте и сохраните ссылку восстановления. Если обновление прошло неуспешно перейдите по скопированной ссылке, CMS восстановится.",
+    "recovery_url" => "URL восстановления:",
+    "update_core" => "Обновить модули ядра",
+    "check" => "Проверить",
+    "check_dev" => "Проверить Dev",
+    "try_later" => "Попробуйте через xxx мин",
+    "cant_get" => "Не могу скачать файл",
+    "cant_remove" => "Не могу удалить",
+    "check_updates" => "Пожалуйста, проверьте обновления",
+    "current_v" => "Текущая версия:",
+    "last_v" => "Последняя версия:",
+    "checked" => "Проверялось:",
+    "download_error" => "Ошибка скачивания",
+    "unknown" => "Неизвестно",
+    "never" => "Никогда",
+    "cant_create_tmp_dir" => "Не могу создать tmp папку",
+    "cant_write_file" => "Не могу записать файл",
+    "cant_open_zip" => "Не могу открыть zip",
+    "cant_extract" => "Не могу разархивировать",
+    "file_list_missing" => "Отсутствует список файлов",
+    "file_not_exists" => "Отсутствует файл:",
+    "file_changed" => "Файл изменен:",
+    "update_error_rights" => "Ошибка обновления при проверке прав на текущие файлы.<br>Пожалуйста, проверьте права файлов.",
+    "update_error_move" => "Ошибка обновления при перемещении новых файлов. Пожалуйста, проверьте права файлов.",
+    "update_error_remove" => "Ошибка обновления при удалении старых файлов. Пожалуйста, проверьте права файлов.",
+    "successfull_update" => "Успешное обновление",
+    "archive_created" => "Создан архив",
+    "files" => "Файлы:",
+    "already_updated" => "Уже обновлено",
+    "for_dev" => "Разработчикам",
+    "incompatible_v" => "Несовместимая версия. Скачайте новую <a href='https://coffee-cms.ru/' target=_blank>https://coffee-cms.ru/</a>",
+    "impossible" => "Обновление невозможно. Установите новую версию вручную.",
+    "file_or_dir_not_exists" => "Файл или каталог не существует",
+    "backup_error" => "Ошибка создания бекапа",
+    "error_creating" => "Ошибка создания файла:",
+    "json_error" => "Ошибка файла JSON",
+    "update" => "Обновить",
+    "changed_files" => "Измененные файлы",
+    "no_files_changed" => "Нет измененных файлов",
+    "book" => "Книга для разработчиков",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/base.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,15 @@
+<?php
+$cms["lang"]["base.mod.php"]["ru_RU.UTF-8"] = array(
+    "base_module_name" => "База данных",
+    "base_module_description" => "Модуль подключающий базу данных",
+    "server_address" => "Адрес сервера БД",
+    "server_port" => "Порт сервера БД",
+    "db_name" => "Название БД",
+    "db_user" => "Пользователь БД",
+    "db_password" => "Пароль БД",
+    "admin_login" => "Админ СУБД",
+    "admin_passwd" => "Пароль Админа СУБД",
+    "create_btn" => "Создать",
+    "create_db" => "Создать базу данных:",
+    "save" => "Сохранить",
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/menu.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+<?php
+$cms["lang"]["menu.mod.php"]["ru_RU.UTF-8"] = array(
+    "menu_module_name" => "Меню",
+    "menu_module_description" => "Модуль для редактирования пунктов меню. <a href=/man/ru_RU.UTF-8/menu.html target=_blank>Документация</a>",
+    "created" => "Создано",
+    "deleted" => "Удалено",
+    "updated" => "Обновлено",
+    "update_properties_error" => "Ошибка обновления свойств",
+    "parent" => "Родитель",
+    "no_parent" => "Нет",
+    "no_area" => "Область не задана",
+    "page" => "Страница",
+    "no_page" => "Произвольная ссылка",
+    "area" => "Область",
+    "title" => "Заголовок",
+    "hint" => "Подсказка",
+    "classes" => "Классы",
+    "sort" => "Сортировка",
+    "save" => "Сохранить",
+    "properties" => "Свойства",
+    "delete" => "Удалить",
+    "confirm_delete" => "Удалить?",
+    "append_item" => "Пункт",
+    "add_menu" => "Добавить меню",
+    "placeholder_hint" => "Заменяет заголовок страницы",
+    "no_connect_db" => "Пожалуйста, подключитесь к базе данных.",
+    "no_tables_db" => "Перейдите на вкладку База данных и нажмите кнопку Сохранить чтобы создались таблицы.",
+    "search" => "Поиск...",
+    "deleted_page" => "Страница удалена",
+    "target_blank" => "Открыть в новом окне",
+    "navigation" => "Навигация",
+    "sql_error" => "Error creating: ",
+    "menu_default_title" => "Меню",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/pages.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+<?php
+$cms["lang"]["pages.mod.php"]["ru_RU.UTF-8"] = array(
+    "pages_module_name" => "Страницы",
+    "pages_module_description" => "Модуль редактирования страниц",
+    "page_default_title" => "Страница",
+    "updated" => "Обновлено",
+    "title" => "Заголовок",
+    "date" => "Дата",
+    "time" => "Время",
+    "template" => "Шаблон",
+    "no_template" => "Нет шаблона",
+    "published" => "Опубликовано",
+    "unpublished" => "Скрыто",
+    "search" => "Поиск...",
+    "delete" => "Удалить",
+    "page_created" => "Страница создана",
+    "page_changed" => "Кто-то уже изменил страницу. Переоткройте её заново.",
+    "mediateka" => "Медиатека",
+    "upload" => "Загрузить",
+    "error_create_folder" => "Не могу создать папку",
+    "error_upload_file" => "Ошибка загрузки файла",
+    "files_uploaded" => "Загрузка завершена",
+    "pages_deleted" => "Страницы удалены",
+    "files_deleted" => "Файлы удалены",
+    "same_files" => "Найдены файлы с такими же именами",
+    "pc" => "шт.",
+    "confirm_replace" => "Перезаписать их или отменить загрузку?",
+    "saved" => "Сохранено",
+    "confirm_delete_pages" => "Удалить выбранные страницы? Прикрепленные к этим страницам файлы будут удалены.",
+    "copy" => "Копировать",
+    "copyed" => "Скопировано",
+    "copy_error" => "Ошибка копирования",
+    "select_file" => "Выберите файл",
+    "error_creating_page" => "Ошибка создания страницы: ",
+    "no_connect_db" => "Пожалуйста, подключитесь к базе данных.",
+    "no_tables_db" => "Перейдите на вкладку База данных и нажмите кнопку Сохранить чтобы создались таблицы.",
+    "blanks" => "Заготовки",
+    "codemirror" => "Редактор",
+    "file_move_error" => "Ошибка перемещения файла",
+    "replace" => "Заменить",
+    "confirm_save" => "Сохранить изменения?",
+    "save" => "Сохранить",
+    "edit" => "Редактировать",
+    "properties" => "Свойства",
+    "server_overloaded_xxx" => "Сервер перегружен. Прислал xxx страниц.",
+    "browser_overloaded_xxx" => "Браузер перегружен. Вставил xxx страниц из nnn.",
+    "of" => "из",
+    "tags" => "Теги",
+    "h1" => "Заголовок",
+    "p" => "Параграф",
+    "div" => "Блок",
+    "link" => "Ссылка",
+    "span" => "Охват",
+    "code" => "Код",
+    "cite" => "Цитата",
+    "ul" => "Марк. список",
+    "ol" => "Нум. список",
+    "li" => "Пункт списка",
+    "figure" => "Фигура",
+    "bold" => "Жирный",
+    "max_size" => "Максимальный размер: ",
+    "bytes" => " байт",
+    "no_selected_pages" => "Сначала выберите страницы.",
+    "seo_title" => "Alt Title",
+    "comment" => "Комментарий",
+    "content" => "Контент",
+    "description" => "Description",
+    "deleted_page" => "Страница удалена",
+    "page" => "Страница",
+    "post" => "Запись в блоге",
+    "frontpage" => "Главная",
+    "blog" => "Блог",
+    "url_translit" => "Создать ссылку из заголовка",
+    "front_url" => "Главная",
+    "home_page" => "Главная",
+    "pages_utils" => "Замена",
+    "replace_btn" => "Заменить",
+    "replace_instruction" => "Введите регулярное выражение для замены одного текста другим на всех страницах сайта. Пустое выражение игнорируется. Символы / экранируются.",
+    "replace_in_pages_confirm" => "Указанные замены будут произведены на всех страницах.",
+    "replace_ok" => "Замены произведены.",
+    "replace_table" => "Таблица",
+    "replace_id_col" => "Колонка с id (для WHERE)",
+    "replace_column" => "Колонка с заменяемым текстом",
+    "regex_title" => "Регулярное выражение для замены",
+    "replace_title" => "Заменить на",
+    "add_page_hint" => "Добавьте страницу, нажав плюсик рядом с поиском.",
+    "too_large" => "Слишком объемные файлы.",
+    "url_changed" => "URL уже занят и был изменен.",
+    "search_with_ctrl" => "Shift - разбить на буквы\nCtrl - искать по текстам",
+    "add_page_title" => "Добавить страницу",
+    "kbd" => "Кнопка",
+    "mark" => "Выделение",
+    "pin" => "Закрепить вверху",
+    "delete_pages" => "Удалить выбранные страницы",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/rss.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,18 @@
+<?php
+$cms["lang"]["rss.mod.php"]["ru_RU.UTF-8"] = array(
+    "rss_module_name" => "RSS",
+    "rss_module_description" => "Настройка новостной ленты RSS",
+    "view_rss" => "Посмотреть RSS ленту",
+    "excluded_links" => "Скрыть ссылки",
+    "save" => "Сохранить",
+    "placeholder" => "Выберите страницу...",
+    "rss_gen" => "Правила генерации файла rss.rss",
+    "static" => "Статическая",
+    "dynamic" => "Динамическая",
+    "update_freq" => "Ограничения частоты пересоздания",
+    "static_freq" => "Статическая генерация по CRON с интервалом",
+    "minutes" => "минут",
+    "rss_items_count" => "Количество элементов в RSS-ленте",
+    "tpl_rss_title" => "Лента новостей",
+    "url_for_cron" => "Адрес для CRON",
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/sitemap.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,21 @@
+<?php
+$cms["lang"]["sitemap.mod.php"]["ru_RU.UTF-8"] = array(
+    "sitemap_module_name" => "Карта сайта",
+    "sitemap_module_description" => "Модуль настроек карты сайта sitemap.xml",
+    "save" => "Сохранить",
+    "excluded_links" => "Скрыть ссылки",
+    "included_links" => "Добавить ссылки",
+    "sitemap_gen" => "Правила генерации файла sitemap.xml",
+    "static" => "Статическая",
+    "dynamic" => "Динамическая",
+    "help_p1" => "При сохранении страницы или свойств страницы происходит удаление статической карты сайта.",
+    "help" => "Справка",
+    "help_p2" => "Если имеются отложенные на будущее публикации, то можно выставить динамическую генерацию карты сайта или статическую с использованием планировщика CRON.",
+    "update_freq" => "Ограничения частоты пересоздания",
+    "static_freq" => "Статическая генерация по CRON с интервалом",
+    "minutes" => "минут",
+    "url_for_cron" => "Адрес для CRON",
+    "domain" => "Если сайт работает на двух доменах, то можно указать Протокол и Домен для статической карты сайта:",
+    "view_sitemap" => "Посмотреть карту сайта",
+    "placeholder" => "Выберите страницу...",
+);
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/template.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+<?php
+$cms["lang"]["template.mod.php"]["ru_RU.UTF-8"] = array(
+    "template_module_name" => "Шаблоны",
+    "template_module_description" => "Переключение шаблонов и управление их настройками",
+    "current_template" => "Текущий шаблон",
+    "save" => "Сохранить",
+    "editable_files" => "Редактируемые файлы этого шаблона",
+    "no_editable_files" => "Нет файлов для редактирования",
+    "confirm_save" => "Сохранить изменения?",
+    "saved" => "Сохранено",
+    "save_error" => "Ошибка сохранения",
+    "install_template" => "Установить шаблон",
+    "upload_error_xxx" => "Ошибка загрузки xxx",
+    "cant_unzip_xxx" => "Не могу распаковать xxx",
+    "install_success" => "Успешная установка",
+    "enable_cache" => "Включить кэш",
+    "cache_cleared" => "Кэш очищен",
+    "help" => "Справка",
+    "headers_title" => "HTTP-заголовки к файлам и страницам",
+    "hint_css" => "Еще сниппеты",
+    "hint_php" => "Еще сниппеты",
+    "hint_html" => "Еще сниппеты",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/ru_RU.UTF-8/translit.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,30 @@
+<?php
+$cms['tr'] = array(
+    'а' => 'a',   'б' => 'b',   'в' => 'v',
+    'г' => 'g',   'д' => 'd',   'е' => 'e',
+    'ё' => 'e',   'ж' => 'zh',  'з' => 'z',
+    'и' => 'i',   'й' => 'y',   'к' => 'k',
+    'л' => 'l',   'м' => 'm',   'н' => 'n',
+    'о' => 'o',   'п' => 'p',   'р' => 'r',
+    'с' => 's',   'т' => 't',   'у' => 'u',
+    'ф' => 'f',   'х' => 'h',   'ц' => 'c',
+    'ч' => 'ch',  'ш' => 'sh',  'щ' => 'sch',
+    'ь' => '\'',  'ы' => 'y',   'ъ' => '\'',
+    'э' => 'e',   'ю' => 'yu',  'я' => 'ya',
+    
+    'А' => 'A',   'Б' => 'B',   'В' => 'V',
+    'Г' => 'G',   'Д' => 'D',   'Е' => 'E',
+    'Ё' => 'E',   'Ж' => 'Zh',  'З' => 'Z',
+    'И' => 'I',   'Й' => 'Y',   'К' => 'K',
+    'Л' => 'L',   'М' => 'M',   'Н' => 'N',
+    'О' => 'O',   'П' => 'P',   'Р' => 'R',
+    'С' => 'S',   'Т' => 'T',   'У' => 'U',
+    'Ф' => 'F',   'Х' => 'H',   'Ц' => 'C',
+    'Ч' => 'Ch',  'Ш' => 'Sh',  'Щ' => 'Sch',
+    'Ь' => '\'',  'Ы' => 'Y',   'Ъ' => '\'',
+    'Э' => 'E',   'Ю' => 'Yu',  'Я' => 'Ya',
+);
+if ( empty( $cms['config']['timezone'] ) ) {
+    $cms['config']['timezone'] = 'Europe/Moscow';
+    date_default_timezone_set ( $cms['config']['timezone'] );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/admin.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,115 @@
+<?php
+$cms["lang"]["admin.mod.php"]["uk_UA.UTF-8"] = array (
+    "uk_UA.UTF-8" => "Українська",
+    "cant_write_config" => "Не можу записати",
+    "home_link" => "Головна",
+    "cache_btn" => "Кеш",
+    "theme_btn" => "Тема",
+    "logout_btn" => "Вихiд",
+    "hello" => "Привiт!",
+    "hello_set_base" => "Насамперед налаштуйте <a href='#base'>підключення до бази даних</a>.",
+    "set_login_and_password" => "Встановiть логiн та пароль",
+    "login_or_password" => "Логiн або ел.пошта",
+    "password" => "Пароль",
+    "login_btn" => "Увiйти",
+    "support" => "Підтримка",
+    "support_url" => "https://coffee-cms.ru/podderzhka",
+    "codemirror_search" => "Пошук:",
+    "codemirror_re" => "(Використовуйте синтаксис /re/ для пошука регулярними виразами)",
+    "codemirror_replace_all" => "Замінити всі:",
+    "codemirror_replace_with" => "На:",
+    "codemirror_replace_replace" => "Замінити:",
+    "codemirror_replace_confirm" => "Замінити?",
+    "codemirror_yes" => "Так",
+    "codemirror_no" => "Ні",
+    "codemirror_all" => "Усе",
+    "codemirror_stop" => "Стоп",
+    "not_empty_section" => "Секція не порожня",
+    "confirm_delete" => "Видалити?",
+    "hide_admin_settings" => "Прихований налаштування адмінки?",
+    "confirm_logout" => "Виконати вихід?",
+    "admin_module_name" => "Адмінка",
+    "admin_module_description" => "Відповідає за пункти Авторизація, PHP Інфо, Адмінка, Модулі.",
+    "set_password" => "Встановити",
+    "current_logins" => "Поточні входи",
+    "logins_history" => "Історія входів",
+    "admin_url" => "URL адмiнки",
+    "mod_on" => "Увімкнути",
+    "mod_off" => "Вимкнути",
+    "mod_del" => "Видалити",
+    "mod_install" => "Встановити модуль",
+    "show" => "Показати",
+    "hide" => "Приховати",
+    "save" => "Зберiгти",
+    "reset" => "Скинути",
+    "delete" => "Видалити",
+    "install_finished" => "Встановлення завершено",
+    "congrat" => "Вiтаємо!",
+    "login_info" => "Дані для входу на сайт",
+    "login_url" => "Адреса адмiнки",
+    "login" => "Логiн",
+    "access_denied" => "Доступ заборонено",
+    "logout_completed" => "Вихід виконаний",
+    "section_added" => "Додано секцію",
+    "deleted" => "Видалено",
+    "not_disabled" => "Цей модуль не відключається",
+    "delete_this_files" => "Видалите наступнi файли:",
+    "upload_error_xxx" => "Помилка завантаження xxx",
+    "install_success" => "Успішна установка",
+    "cant_open_zip_xxx" => "Не можу відкрити архів xxx",
+    "cant_extract_xxx" => "Не вдається розпакувати xxx",
+    "auth" => "Авторизація",
+    "settings" => "Налаштування",
+    "php_info" => "PHP iнфо",
+    "modules" => "Модулi",
+    "content" => "Контент",
+    "add_section" => "Нова секція",
+    "server_error" => "Помилка на сервері",
+    "network_error" => "Помилка мережі",
+    "reset_all" => "Скинути все",
+    "reset_all_ok" => "Скидання зроблено",
+    "create_zip" => "Створити Zip",
+    "create" => "Створити",
+    "remove" => "Видалити",
+    "removed" => "Видалено",
+    "have_errors" => "Є помилки",
+    "help1" => "Скопіюйте та збережіть посилання відновлення. Якщо оновлення пройшло неуспішно, перейдіть за скопійованим посиланням, CMS відновиться.",
+    "recovery_url" => "URL відновлення:",
+    "update_core" => "Оновити модулі ядра",
+    "check" => "Перевірити",
+    "check_dev" => "Перевірити Dev",
+    "try_later" => "Спробуйте через xxx хв",
+    "cant_get" => "Не можу завантажити файл",
+    "cant_remove" => "Не можу видалити",
+    "check_updates" => "Будь ласка, перевірте поновлення",
+    "current_v" => "Поточна версія:",
+    "last_v" => "Остання версія:",
+    "checked" => "Перевірялося:",
+    "download_error" => "Помилка завантаження",
+    "unknown" => "Невідомо",
+    "never" => "Ніколи",
+    "cant_create_tmp_dir" => "Не можу створити tmp папку",
+    "cant_write_file" => "Не можу захистити",
+    "cant_open_zip" => "Не можу відкрити zip",
+    "cant_extract" => "Не вдається розпакувати",
+    "file_list_missing" => "Відсутній список файлів",
+    "file_not_exists" => "Відсутній файл:",
+    "file_changed" => "Файл змінений:",
+    "update_error_rights" => "Помилка оновлення при перевірці прав на поточні файли.<br>Будь ласка, перевірте права файлів.",
+    "update_error_move" => "Помилка оновлення при переміщенні нових файлів. Будь ласка, перевірте права файлів.",
+    "update_error_remove" => "Помилка оновлення при видаленні старих файлів. Будь ласка, перевірте права файлів.",
+    "successfull_update" => "Успішне оновлення",
+    "archive_created" => "Створено архів",
+    "files" => "Файли:",
+    "already_updated" => "Вже оновлено",
+    "for_dev" => "Розробникам",
+    "incompatible_v" => "Несумісна версія. Завантажте нову <a href='https://coffee-cms.ru/' target=_blank>https://coffee-cms.ru/</a>",
+    "impossible" => "Оновлення неможливе. Встановіть нову версію вручну.",
+    "file_or_dir_not_exists" => "Файл або каталог не існує",
+    "backup_error" => "Помилка створення бекапа",
+    "error_creating" => "Помилка створення файлу:",
+    "json_error" => "Помилка файлу JSON",
+    "update" => "Оновити",
+    "changed_files" => "Змінені файли",
+    "no_files_changed" => "Немає змінених файлів",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/base.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,15 @@
+<?php
+$cms["lang"]["base.mod.php"]["uk_UA.UTF-8"] = array (
+    "base_module_name" => "База данних",
+    "base_module_description" => "Модуль який підключає базу даних",
+    "server_address" => "Адреса сервера БД",
+    "server_port" => "Порт сервера БД",
+    "db_name" => "Назва БД",
+    "db_user" => "Користувач БД",
+    "db_password" => "Пароль БД",
+    "admin_login" => "Адмiн СУБД",
+    "admin_passwd" => "Пароль Адмiна СУБД",
+    "create_btn" => "Створити",
+    "create_db" => "Створити базу даних:",
+    "save" => "Зберігти",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/menu.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+<?php
+$cms["lang"]["menu.mod.php"]["uk_UA.UTF-8"] = array (
+    "menu_module_name" => "Меню",
+    "menu_module_description" => "Модуль для редагування пунктів меню",
+    "created" => "Створено",
+    "deleted" => "Видалено",
+    "updated" => "Оновлено",
+    "update_properties_error" => "Помилка оновлення властивостей",
+    "parent" => "Батько",
+    "no_parent" => "Ні",
+    "no_area" => "Область не задана",
+    "page" => "Сторінка",
+    "no_page" => "Довільне посилання",
+    "area" => "Область",
+    "title" => "Заголовок",
+    "hint" => "Підказка",
+    "classes" => "Класи",
+    "sort" => "Сортування",
+    "save" => "Зберігти",
+    "properties" => "Властивості",
+    "delete" => "Видалити",
+    "confirm_delete" => "Видалити?",
+    "append_item" => "Пункт",
+    "add_menu" => "Додати меню",
+    "placeholder_hint" => "Замінює заголовок сторінки",
+    "no_connect_db" => "Будь ласка, підключіться до бази данних.",
+    "no_tables_db" => "Перейдіть на вкладку База даних і натисніть кнопку Зберегти, щоб створилися таблиці.",
+    "search" => "Пошук...",
+    "deleted_page" => "Сторінка видалена",
+    "target_blank" => "Відкрити у новому вікні",
+    "navigation" => "Навігація",
+    "sql_error" => "Error creating: ",
+    "menu_default_title" => "Меню",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/pages.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+<?php
+$cms["lang"]["pages.mod.php"]["uk_UA.UTF-8"] = array (
+    "pages_module_name" => "Сторінки",
+    "pages_module_description" => "Модуль редагування сторінок",
+    "page_default_title" => "Сторінка",
+    "updated" => "Оновлено",
+    "title" => "Заголовок",
+    "date" => "Дата",
+    "time" => "Час",
+    "template" => "Шаблон",
+    "no_template" => "Немає шаблона",
+    "published" => "Опубліковано",
+    "unpublished" => "Приховано",
+    "search" => "Пошук...",
+    "delete" => "Видалити",
+    "page_created" => "Сторінка створена",
+    "page_changed" => "Хтось вже змінив сторінку. Перевідкрийте її заново.",
+    "mediateka" => "Медіатека",
+    "upload" => "Завантажити",
+    "error_create_folder" => "Не можу створити папку",
+    "error_upload_file" => "Помилка завантаження файлу",
+    "files_uploaded" => "Завантаження завершено",
+    "pages_deleted" => "Сторінки видалени",
+    "files_deleted" => "Файли видалені",
+    "same_files" => "На сервері знайдені файли з такими ж іменами",
+    "pc" => "шт.",
+    "confirm_replace" => "Перезаписати їх або скасувати завантаження?",
+    "saved" => "Збережено",
+    "confirm_delete_pages" => "Видалити вибрані сторінки? Прикріплені до цих сторінок файли буде видалено.",
+    "copy" => "Копіювати",
+    "copyed" => "Скопійовано",
+    "copy_error" => "Помилка копіювання",
+    "select_file" => "Виберіть файл",
+    "error_creating_page" => "Помилка створення сторінки: ",
+    "no_connect_db" => "Будь ласка, підключіться до бази даних.",
+    "no_tables_db" => "Перейдіть на вкладку База даних і натисніть кнопку Зберегти, щоб створилися таблиці.",
+    "blanks" => "Заготівлі",
+    "codemirror" => "Редактор",
+    "file_move_error" => "Помилка переміщення файлу",
+    "replace" => "Замінити",
+    "confirm_save" => "Зберегти зміни?",
+    "save" => "Зберігти",
+    "edit" => "Редагувати",
+    "properties" => "Властивості",
+    "server_overloaded_xxx" => "Сервер перевантажений. Надіслав xxx сторінок.",
+    "browser_overloaded_xxx" => "Браузер перевантажений. Вставлено xxx сторінки з nnn",
+    "of" => "із",
+    "tags" => "Тегі",
+    "h1" => "Заголовок",
+    "p" => "Параграф",
+    "div" => "Блок",
+    "link" => "Посилання",
+    "span" => "Охоплення",
+    "code" => "Код",
+    "cite" => "Цитата",
+    "ul" => "Марк. список",
+    "ol" => "Нум. список",
+    "li" => "Пункт списку",
+    "figure" => "Фігура",
+    "bold" => "Жирний",
+    "max_size" => "Максимальний розмір: ",
+    "bytes" => " байтів",
+    "no_selected_pages" => "Спочатку виберіть сторінки.",
+    "seo_title" => "Alt Title",
+    "comment" => "Коментар",
+    "content" => "Контент",
+    "description" => "Description",
+    "deleted_page" => "Сторінка видалена",
+    "page" => "Сторінка",
+    "post" => "Запис у блозі",
+    "frontpage" => "Головна",
+    "blog" => "Блог",
+    "url_translit" => "Створити посилання із заголовка",
+    "front_url" => "Головна",
+    "home_page" => "Головна",
+    "pages_utils" => "Заміна",
+    "replace_btn" => "Замінити",
+    "replace_instruction" => "Введіть регулярний вираз для заміни одного тексту іншим на всіх сторінках сайту. Порожній вираз ігнорується. Символи / екрануються.",
+    "replace_in_pages_confirm" => "Зазначені заміни будуть здійснені на всіх сторінках.",
+    "replace_ok" => "Зміни зроблено.",
+    "replace_table" => "Таблиця",
+    "replace_id_col" => "Колонка з id (для WHERE)",
+    "replace_column" => "Колонка із текстом, що замінюється",
+    "regex_title" => "Регулярний вираз для заміни",
+    "replace_title" => "Замінити на",
+    "add_page_hint" => "Додайте сторінку, натиснувши плюсик поруч із пошуком.",
+    "too_large" => "Занадто об'ємні файли.",
+    "url_changed" => "URL вже зайнятий і був змінений.",
+    "search_with_ctrl" => "Shift – розбити на літери\nCtrl – шукати за текстами",
+    "add_page_title" => "Додати сторінку",
+    "kbd" => "Кнопка",
+    "mark" => "Виділення",
+    "pin" => "Закріпити вгорі",
+    "delete_pages" => "Видалити вибрані сторінки",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/rss.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,18 @@
+<?php
+$cms["lang"]["rss.mod.php"]["uk_UA.UTF-8"] = array (
+    "rss_module_name" => "RSS",
+    "rss_module_description" => "Налаштування стрічки новин RSS",
+    "view_rss" => "Переглянути RSS стрічку",
+    "excluded_links" => "Приховати посилання",
+    "save" => "Зберігти",
+    "placeholder" => "Виберіть сторінку...",
+    "rss_gen" => "Правила генерації файлу rss.rss",
+    "static" => "Статична",
+    "dynamic" => "Динамічна",
+    "update_freq" => "Обмеження частоти перестворювання",
+    "static_freq" => "Статична генерація по CRON з інтервалом",
+    "minutes" => "хвилин",
+    "rss_items_count" => "Кількість елементів у RSS-стрічці",
+    "tpl_rss_title" => "Стрічка новин",
+    "url_for_cron" => "Адреса для CRON",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/sitemap.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,21 @@
+<?php
+$cms["lang"]["sitemap.mod.php"]["uk_UA.UTF-8"] = array (
+    "sitemap_module_name" => "Мапа сайту",
+    "sitemap_module_description" => "Модуль налаштування мапи мапи sitemap.xml",
+    "save" => "Зберігти",
+    "excluded_links" => "Приховати посилання",
+    "included_links" => "Додати посилання",
+    "sitemap_gen" => "Правила генерації файлу sitemap.xml",
+    "static" => "Статична",
+    "dynamic" => "Динамічна",
+    "help_p1" => "При збереженні сторінки або властивостей сторінки відбувається видалення статичної карти сайту.",
+    "help" => "Довідка",
+    "help_p2" => "Якщо є відкладені на майбутнє публікації, то можна виставити динамічну генерацію карти сайту або статичну з використанням планувальника CRON.",
+    "update_freq" => "Обмеження частоти перестворювання",
+    "static_freq" => "Статична генерація по CRON з інтервалом",
+    "minutes" => "хвилин",
+    "url_for_cron" => "Адреса для CRON",
+    "domain" => "Якщо сайт працює на двох доменах, то можна вказати Протокол та Домен для статичної карти сайту:",
+    "view_sitemap" => "Подивитись карту сайту",
+    "placeholder" => "Виберіть сторінку...",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/template.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+<?php
+$cms["lang"]["template.mod.php"]["uk_UA.UTF-8"] = array (
+    "template_module_name" => "Шаблони",
+    "template_module_description" => "Переключення шаблонiв й управлiння їх налаштуваннями",
+    "current_template" => "Поточний шаблон",
+    "save" => "Зберiгти",
+    "editable_files" => "Редаговані файли цього шаблону",
+    "no_editable_files" => "Немає файлів для редагування",
+    "confirm_save" => "Зберегти зміни?",
+    "saved" => "Збережено",
+    "save_error" => "Помилка збереження",
+    "install_template" => "Встановити шаблон",
+    "upload_error_xxx" => "Помилка завантаження xxx",
+    "cant_unzip_xxx" => "Не вдається розпакувати xxx",
+    "install_success" => "Успішна установка",
+    "enable_cache" => "Увімкнути кеш",
+    "cache_cleared" => "Кеш очищений",
+    "help" => "Довідка",
+    "headers_title" => "HTTP-заголовки до файлів та сторінок",
+    "hint_css" => "Ще сніпети",
+    "hint_php" => "Ще сніпети",
+    "hint_html" => "Ще сніпети",
+);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lang/uk_UA.UTF-8/translit.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,30 @@
+<?php
+$cms['tr'] = array(
+    'а' => 'a',    'б' => 'b',    'в' => 'v',
+    'г' => 'h',    'ґ' => 'g',    'д' => 'd',
+    'е' => 'e',    'є' => 'ie',   'ж' => 'zh',
+    'з' => 'z',    'и' => 'y',    'і' => 'i',
+    'ї' => 'i',    'й' => 'i',    'к' => 'k',
+    'л' => 'l',    'м' => 'm',    'н' => 'n',
+    'о' => 'o',    'п' => 'p',    'р' => 'r',
+    'с' => 's',    'т' => 't',    'у' => 'u',
+    'ф' => 'f',    'х' => 'kh',   'ц' => 'ts',
+    'ч' => 'ch',   'ш' => 'sh',   'щ' => 'shch',
+    'ь' => '\'',   'ю' => 'iu',   'я' => 'ia',
+    
+    'А' => 'A',    'Б' => 'B',    'В' => 'V',
+    'Г' => 'G',    'Ґ' => 'G',    'Д' => 'D',
+    'E' => 'E',    'Є' => 'Ye',   'Ж' => 'Zh',
+    'З' => 'Z',    'И' => 'Y',    'І' => 'I',
+    'Ї' => 'Yi',   'Й' => 'Y',    'К' => 'K',
+    'Л' => 'L',    'М' => 'M',    'Н' => 'N',
+    'О' => 'O',    'П' => 'P',    'Р' => 'P',
+    'С' => 'S',    'Т' => 'T',    'У' => 'U',
+    'Ф' => 'F',    'Х' => 'Kh',   'Ц' => 'Ts',
+    'Ч' => 'Ch',   'Ш' => 'Sh',   'Щ' => 'Shch',
+    'Ь' => '\'',   'Ю' => 'Yu',   'Я' => 'Ya',
+);
+if ( empty( $cms['config']['timezone'] ) ) {
+    $cms['config']['timezone'] = 'Europe/Kiev';
+    date_default_timezone_set ( $cms['config']['timezone'] );
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/AUTHORS	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,987 @@
+List of CodeMirror contributors. Updated before every release.
+
+4oo4
+4r2r
+Aaron Brooks
+Abdelouahab
+Abdussalam Abdurrahman
+Abe Fettig
+Abhishek Gahlot
+Adam Ahmed
+Adam King
+Adam Particka
+Adam Wight
+adanlobato
+Adán Lobato
+Aditya Toshniwal
+Adrian Aichner
+Adrian Heine
+Adrian Kunz
+Adrien Bertrand
+aeroson
+Ahmad Amireh
+Ahmad M. Zawawi
+AHOHNMYC
+ahoward
+Ajin Abraham
+Akeksandr Motsjonov
+Alasdair Smith
+AlbertHilb
+Alberto González Palomo
+Alberto Pose
+Albert Xing
+Alexander Marks
+Alexander Pavlov
+Alexander Schepanovski
+Alexander Shvets
+Alexander Solovyov
+Alexandre Bique
+Alex Churchill
+alexey-k
+Alex Piggott
+Alf Eaton
+Aliaksei Chapyzhenka
+Allef Santana (garug)
+Allen Sarkisyan
+Ami Fischman
+Amin Shali
+Amin Ullah Khan
+amshali@google.com
+Amsul
+amuntean
+Amy
+Ananya Sen
+anaran
+AndersMad
+Anders Nawroth
+Anderson Mesquita
+Anders Wåglund
+Andrea G
+Andreas Reischuck
+Andres Taylor
+Andre von Houck
+Andrew Cheng
+Andrew Dassonville
+Andrey Fedorov
+Andrey Klyuchnikov
+Andrey Lushnikov
+Andrey Shchekin
+Andy Joslin
+Andy Kimball
+Andy Li
+Angelo
+angelozerr
+angelo.zerr@gmail.com
+Ankit
+Ankit Ahuja
+Ansel Santosa
+Anthony Dugois
+anthonygego
+Anthony Gégo
+Anthony Grimes
+Anthony Stewart
+Anton Kovalyov
+antosarho
+aoki ken
+Apollo Zhu
+AQNOUCH Mohammed
+Aram Shatakhtsyan
+areos
+Arnab Bose
+Arnoud Buzing
+Arsène von Wyss
+Arthur Müller
+Arun Narasani
+as3boyan
+asolove
+atelierbram
+AtomicPages LLC
+Atul Bhouraskar
+Aurelian Oancea
+Axel Lewenhaupt
+Baptiste Augrain
+Barret Rennie
+Bartosz Dziewoński
+Basarat Ali Syed
+Bastian Müller
+belhaj
+Bem Jones-Bey
+benbro
+Benedikt Meurer
+benhormann
+Ben Hormann
+Beni Cherniavsky-Paskin
+Benjamin DeCoste
+benjaminr-ps
+Benjamin Young
+Ben Keen
+Ben Miller
+Ben Mosher
+Bernhard Sirlinger
+Bert Chang
+Bharad
+BigBlueHat
+Billiam
+Billy Moon
+Bin Ni
+binny
+Bjarki Ágúst Guðmundsson
+Bjorn Hansen
+B Krishna Chaitanya
+Blaine G
+blukat29
+Bo
+boomyjee
+Bo Peng
+borawjm
+Boris K
+Boris Verkhovskiy
+Brad Metcalf
+Brandon Frohs
+Brandon Wamboldt
+Bret Little
+Brett Morgan
+Brett Zamir
+Brian Grinstead
+BrianHung
+Brian Sletten
+brrd
+Bruce Mitchener
+Bruno Logerfo
+Bryan Gin-ge Chen
+Bryan Massoth
+Caitlin Potter
+Calin Barbat
+callodacity
+Camilo Roca
+Casey Klebba
+cBiscuit87
+César González Íñiguez
+Chad Jolly
+Chandra Sekhar Pydi
+Charles Skelton
+Cheah Chu Yeow
+Chhekur
+Chris Colborne
+Chris Coyier
+Chris Ford
+Chris Granger
+Chris Houseknecht
+Chris Lohfink
+Chris Morgan
+Chris Reeves
+Chris Smith
+Christian Gruen
+Christian Oyarzun
+Christian Petrov
+Christian Sonne
+christopherblaser
+Christopher Brown
+Christopher Kramer
+Christopher Mitchell
+Christopher Pfohl
+Christopher Wallis
+Chunliang Lyu
+ciaranj
+clone-it
+clso
+CodeAnimal
+CodeBitt
+coderaiser
+Cole R Lawrence
+ComFreek
+Cornelius Weig
+Cristian Prieto
+Curran Kelleher
+Curtis Gagliardi
+d8888
+dagsta
+daines
+Dale Jung
+Dan Bentley
+Dan Heberden
+Daniel, Dao Quang Minh
+Daniele Di Sarli
+Daniel Faust
+Daniel Hanggi
+Daniel Huigens
+Daniel Kesler
+Daniel KJ
+Daniel Neel
+Daniel Parnell
+Daniel Thwaites
+Danila Malyutin
+Danny Yoo
+darealshinji
+Darius Roberts
+databricks-david-lewis
+Dave Brondsema
+Dave MacLachlan
+Dave Myers
+David Barnett
+David Foster
+David H. Bronke
+David Mignot
+David Pathakjee
+David R. Myers
+David Rodrigues
+David Santana
+David Vázquez
+David Whittington
+deebugger
+Deep Thought
+Denis Ovsienko
+Devin Abbott
+Devon Carew
+Dick Choi
+Diego Fernandez
+dignifiedquire
+Dimage Sapelkin
+Dimitri Mitropoulos
+Dinindu D. Wanniarachchi
+dmaclach
+Dmitry Kiselyov
+DoctorKrolic
+domagoj412
+Dominator008
+Domizio Demichelis
+Doug Blank
+Doug Wikle
+Drew Bratcher
+Drew Hintz
+Drew Khoury
+Drini Cami
+Dror BG
+Duncan Lilley
+duralog
+dwelle
+Ealton
+eborden
+edoroshenko
+edsharp
+ekhaled
+Elisée
+Elmar Peise
+elpnt
+Emmanuel Schanzer
+Enam Mijbah Noor
+Eric Allam
+Eric Bogard
+Erik Demaine
+Erik Krogh Kristensen
+Erik Welander
+erosman
+eustas
+Evan Minsk
+Fabien Dubosson
+Fabien O'Carroll
+Fabio Zendhi Nagao
+Faiza Alsaied
+Faris Masad
+Fauntleroy
+fbuchinger
+feizhang365
+Felipe Lalanne
+Felipe S. S. Schneider
+Felix Raab
+ficristo
+Filip Noetzel
+Filip Stollár
+Filype Pereira
+finalfantasia
+flack
+Florian Felten
+Fons van der Plas
+Forbes Lindesay
+ForbesLindesay
+Ford_Lawnmower
+Forrest Oliphant
+Franco Catena
+Frank Seifferth
+Frank Wiegand
+fraxx001
+Fredrik Borg
+FUJI Goro (gfx)
+fzipp
+Gabriela Gutierrez
+Gabriel Gheorghian
+Gabriel Horner
+Gabriel Nahmias
+galambalazs
+Gary Sheng
+Gautam Mehta
+Gavin Douglas
+Geist-zz
+gekkoe
+Geordie Hall
+George Stephanis
+geowarin
+Gerard Braad
+Gergely Hegykozi
+Germain Chazot
+Giovanni Calò
+Glebov Boris
+Glenn Jorde
+Glenn Ruehle
+goldsmcb
+Golevka
+Google LLC
+Gordon Smith
+Grant Skinner
+greengiant
+Gregory Koberger
+Grzegorz Mazur
+Guang Li
+Guan Gui
+Guillaume Massé
+Guillaume Massé
+guraga
+Gustavo Rodrigues
+Hakan Tunc
+Hanno Fellmann
+Hans Engel
+Hanzhao Deng
+Haoran Yu
+Harald Schilly
+Hardest
+Harshvardhan Gupta
+Harutyun Amirjanyan
+Hasan Delibaş
+Hasan Karahan
+Heanes
+Hector Oswaldo Caballero
+Hein Htat
+Hélio
+Hendrik Erz
+Hendrik Wallbaum
+Henrik Haugbølle
+Herculano Campos
+hidaiy
+Hiroyuki Makino
+hitsthings
+Hocdoc
+Howard
+Howard Jing
+Hugues Malphettes
+Ian Beck
+Ian Davies
+Ian Dickinson
+Ian Henderson
+ianhi
+Ian Rose
+Ian Wehrman
+Ian Wetherbee
+Ice White
+ICHIKAWA, Yuji
+idleberg
+Igor Petruk
+ilvalle
+Ilya Kharlamov
+Ilya Zverev
+Ingo Richter
+Intervue
+Irakli Gozalishvili
+iteriani
+Ivan Kurnosov
+Ivoah
+Jack Douglas
+Jacob Lee
+Jaimin
+Jake Peyser
+Jake Zimmerman
+Jakob Kummerow
+Jakob Miland
+Jakub Nowak
+Jakub T. Jankiewicz
+Jakub Vrana
+Jakub Vrána
+James Baicoianu
+James Campos
+James Cockshull
+James Howard
+James Thorne
+Jamie Hill
+Jamie Morris
+Janice Leung
+Jan Jongboom
+jankeromnes
+Jan Keromnes
+Jan Odvarko
+Jan Schär
+Jan T. Sott
+Jared Dean
+Jared Forsyth
+Jared Jacobs
+Jason
+Jason Barnabe
+Jason Grout
+Jason Heeris
+Jason Johnston
+Jason San Jose
+Jason Siefken
+Jayaprabhakar
+Jay Contonio
+Jaydeep Solanki
+Jean Boussier
+Jeff Blaisdell
+Jeff Hanke
+Jeff Jenkins
+jeffkenton
+Jeff Pickhardt
+jem (graphite)
+Jeremy Parmenter
+Jim
+Jim Avery
+jkaplon
+JobJob
+jochenberger
+Jochen Berger
+Joel Einbinder
+joelpinheiro
+Joe Predham
+joewalsh
+Johan Ask
+Johannes
+John Chen
+John Connor
+John-David Dalton
+John Engler
+John Lees-Miller
+John Ryan
+John Snelson
+johnspiegel
+John Van Der Loo
+Jon Ander Peñalba
+Jonas Döbertin
+Jonas Helfer
+Jonathan Dierksen
+Jonathan Hart
+Jonathan Malmaud
+Jonathan Rascher
+Jon Gacnik
+jongalloway
+Jon Malmaud
+Jon Sangster
+Joo
+Joost-Wim Boekesteijn
+José dBruxelles
+Joseph D. Purcell
+Joseph Pecoraro
+Josh Barnes
+Josh Cohen
+Josh Soref
+Joshua Newman
+Josh Watzman
+jots
+Joy Zhong
+jsoojeon
+ju1ius
+Juan Benavides Romero
+Jucovschi Constantin
+Juho Vuori
+Julien CROUZET
+Julien Rebetez
+Justin Andresen
+Justin Hileman
+jwallers@gmail.com
+kaniga
+karevn
+Karol
+Kaushik Kulkarni
+Kayur Patel
+kazk
+Kazuhisa Ishizaka
+Kazuhito Hokamura
+kcwiakala
+Kees de Kooter
+Keldan Chapman
+Kenan Christian Dimas
+Ken Newman
+ken restivo
+Ken Rockot
+Kevin Earls
+Kevin Kwok
+Kevin Muret
+Kevin Sawicki
+Kevin Ushey
+Kier Darby
+Kim-Anh Tran
+Klaus Silveira
+Koh Zi Han, Cliff
+komakino
+kometenstaub
+Konrad Zapotoczny
+Konstantin Chernenko
+Konstantin Lopuhin
+koops
+Kris Ciccarello
+ks-ifware
+kubelsmieci
+kvncp
+KwanEsq
+Kyle Kelley
+KyleMcNutt
+LaKing
+Lanfei
+Lanny
+laobubu
+Laszlo Vidacs
+leaf
+leaf corcoran
+Lemmon
+Leo Baschy
+Leonid Khachaturov
+Leon Sorokin
+Leonya Khachaturov
+lexer2086
+Liam Newman
+Libo Cannici
+Lior Goldberg
+Lior Shub
+lishid
+LloydMilligan
+LM
+lochel
+Lonnie Abelbeck
+Lorenzo Simionato
+Lorenzo Stoakes
+Louis Mauchet
+Luca Fabbri
+Lucas Buchala
+Luciano Longo
+Luciano Santana
+Lu Fangjian
+Łukasz Wielgus
+Luke Browning
+Luke Granger-Brown
+Luke Haas
+Luke Stagner
+lynschinzer
+M1cha
+Madhura Jayaratne
+Maksim Lin
+Maksym Taran
+Malay Majithia
+Manideep
+Manuel Rego Casasnovas
+Marat Dreizin
+Marcel Gerber
+Marcelo Camargo
+Marc Espín
+Marco Aurélio
+Marco Munizaga
+Marcus Bointon
+Marek Rudnicki
+Marijn Haverbeke
+Mário Gonçalves
+Mario Pietsch
+Mark Anderson
+Mark Boyes
+Mark Dalgleish
+Mark Hamstra
+Mark Lentczner
+Marko Bonaci
+Mark Peace
+Markus Bordihn
+Markus Olsson
+Martin Balek
+Martín Gaitán
+Martin Hasoň
+Martin Hunt
+Martin Laine
+Martin Zagora
+Masahiro MATAYOSHI
+Mason Malone
+Mateusz Paprocki
+Mathias Bynens
+mats cronqvist
+Matt Diehl
+Matt Gaide
+Matthew Bauer
+Matthew Beale
+Matthew Casperson
+matthewhayes
+Matthew Rathbone
+Matthew Suozzo
+Matthias Bussonnier
+Matthias BUSSONNIER
+Mattia Astorino
+Matt MacPherson
+Matt McDonald
+Matt Pass
+Matt Sacks
+mauricio
+Maximilian Hils
+Maxim Kraev
+Max Kirsch
+Max Schaefer
+Max Wu
+Max Xiantu
+mbarkhau
+McBrainy
+mce2
+Mélanie Chauvel
+melpon
+meshuamam
+Metatheos
+Micah Dubinko
+Michael
+Michael Chirico
+Michael Goderbauer
+Michael Grey
+Michael Kaminsky
+Michael Lehenbauer
+Michael Wadman
+Michael Walker
+Michael Zhou
+Michal Čihař
+Michal Dorner
+Michal Kapiczynski
+Mighty Guava
+Miguel Castillo
+mihailik
+Mika Andrianarijaona
+Mike
+Mike Bostock
+Mike Brevoort
+Mike Diaz
+Mike Ivanov
+Mike Kadin
+Mike Kobit
+Milan Szekely
+MinJune Kim
+MinRK
+Miraculix87
+misfo
+mkaminsky11
+mloginov
+mlsad3
+Moritz Schubotz (physikerwelt)
+Moritz Schwörer
+Moshe Wajnberg
+mps
+ms
+mtaran-google
+Mu-An ✌️ Chiou
+Mu-An Chiou
+Mykola Martynovets
+mzabuawala
+Narciso Jaramillo
+nathanlesage
+Nathan Williams
+ndr
+Neil Anderson
+neon-dev
+nerbert
+NetworkNode
+nextrevision
+ngn
+nguillaumin
+Ng Zhi An
+Nicholas Bollweg
+Nicholas Bollweg (Nick)
+NickKolok
+Nick Kreeger
+Nick Small
+Nicolas Chevobbe
+Nicolas Kick
+Nicolò Ribaudo
+Niels van Groningen
+nightwing
+Nikita Beloglazov
+Nikita Vasilyev
+Nikolaj Kappler
+Nikolay Kostov
+nilp0inter
+Nils Knappmeier
+Nina Pypchenko
+Nisarg Jhaveri
+nlwillia
+noragrossman
+Norman Rzepka
+Nouzbe
+Oleksandr Yakovenko
+Olivia Ytterbrink
+Ondřej Mirtes
+Opender Singh
+opl-
+Oreoluwa Onatemowo
+orionlee
+oscar.lofwenhamn
+Oskar Segersvärd
+ossdev
+overdodactyl
+pablo
+pabloferz
+Pablo Zubieta
+paddya
+Page
+paladox
+Panupong Pasupat
+paris
+Paris
+Paris Kasidiaris
+Parker Lougheed
+Patil Arpith
+Patrick Kettner
+Patrick Stoica
+Patrick Strawderman
+Paul Garvin
+Paul Ivanov
+Paul Masson
+Paul Schmidt
+Pavel
+Pavel Feldman
+Pavel Petržela
+Pavel Strashkin
+Paweł Bartkiewicz
+peteguhl
+peter
+Peter Flynn
+peterkroon
+Peter Kroon
+Peter László
+Phil DeJarnett
+Philipp A
+Philipp Markovics
+Philip Stadermann
+Pi Delport
+Pierre Gerold
+Pieter Ouwerkerk
+Piyush
+pkucode
+Pontus Granström
+Pontus Melke
+prasanthj
+Prasanth J
+Prayag Verma
+prendota
+Prendota
+ps173
+Qiang Li
+quiddity-wp
+Radek Piórkowski
+Rahul
+Rahul Anand
+ramwin1
+Randall Mason
+Randy Burden
+Randy Edmunds
+Randy Luecke
+Raphael Amorim
+Rasmus Erik Voel Jensen
+Rasmus Schultz
+raymondf
+Raymond Hill
+ray ratchup
+Ray Ratchup
+Remi Nyborg
+Renaud Durlin
+Reynold Xin
+Richard Denton
+Richard Fung
+Richard van der Meer
+Richard Z.H. Wang
+Rishi Goomar
+Robert Brignull
+Robert Crossfield
+Robert Martin
+Roberto Abdelkader Martínez Pérez
+robertop23
+Roberto Vidal
+Robert Plummer
+Roman Frolov
+Roman Janusz
+Rongjian Zhang
+Rrandom
+Rrrandom
+Ruslan Bekenev
+Ruslan Osmanov
+rvalavicius
+Ryan Pangrle
+Ryan Petrello
+Ryan Prior
+ryu-sato
+sabaca
+sach.gupta
+Sachin Gupta
+sahil.mahna
+Sam Lee
+Sam Rawlins
+Samuel Ainsworth
+Sam Wilson
+sandeepshetty
+Sander AKA Redsandro
+Sander Verweij
+santec
+Sarah McAlear and Wenlin Zhang
+Sascha Peilicke
+Sasha Varlamov
+satamas
+satchmorun
+sathyamoorthi
+Saul Costa
+S. Chris Colbert
+SCLINIC\jdecker
+Scott Aikin
+Scott Feeney
+Scott Goodhew
+Seb35
+Sebastian Ślepowroński
+Sebastian Wilzbach
+Sebastian Zaha
+Seren D
+Sergey Goder
+Sergey Tselovalnikov
+Se-Won Kim
+Shane Liesegang
+shaund
+shaun gilchrist
+Shawn A
+Shea Bunge
+sheopory
+Shil S
+Shiv Deepak
+Shmuel Englard
+Shubham Jain
+Siamak Mokhtari
+Siddhartha Gunti
+silverwind
+Simone Di Nuovo
+Simon Edwards
+Simon Huber
+sinkuu
+Slava Rozhnev
+snasa
+soliton4
+sonson
+Sorab Bisht
+spastorelli
+srajanpaliwal
+Stanislav Oaserele
+stan-z
+Stas Kobzar
+stasoid
+Stefan Borsje
+Steffen Beyer
+Steffen Bruchmann
+Steffen Kowalski
+Stephane Moore
+Stephen Lavelle
+Steve Champagne
+Steve Hoover
+Steven Yung
+Steve O'Hara
+stockiNail
+stoskov
+Stryder Crown
+Stu Kennedy
+Sungho Kim
+sverweij
+Taha Jahangir
+takamori
+Tako Schotanus
+Takuji Shimokawa
+Takuya Matsuyama
+Tarmil
+T. Brandon Ashley
+TDaglis
+Teja
+tel
+Tentone
+tfjgeorge
+Thaddee Tyl
+thanasis
+TheHowl
+themrmax
+Thiemo Kreuz
+think
+Thomas Brouard
+Thomas Dvornik
+Thomas Kluyver
+thomasmaclean
+Thomas Schmid
+Tim Alby
+Tim Baumann
+Tim Down
+Tim Gates
+Tim Nguyen
+Timothy Farrell
+Timothy Gu
+Timothy Hatcher
+Tim van der Lippe
+Tobias Bertelsen
+TobiasBg
+Todd Berman
+Todd Kennedy
+tokafew420
+Tomas-A
+Tomas Varaneckas
+Tom Erik Støwer
+Tom Klancer
+Tom MacWright
+Tom McLaughlin
+Tony Jian
+tophf
+Torben Bundt
+Torgeir Thoresen
+totalamd
+Travis Heppe
+Triangle717
+Tristan Tarrant
+TSUYUSATO Kitsune
+Tugrul Elmas
+twifkak
+Tyler Long
+Tyler Makaro
+Vadim Dyachenko
+Vadzim Ramanenka
+Vaibhav Sagar
+vamshi.revu
+VapidWorx
+Vestimir Markov
+vf
+Victor Bocharsky
+Vincent Woo
+Vladislav Voitenok
+Volker Mische
+vtripolitakis
+wdouglashall
+Weiyan Shao
+wenli
+Wes Cossick
+Wesley Wiser
+Weston Ruter
+Will Binns-Smith
+Will Cassella
+Will Dean
+Will Hernandez
+William Desportes
+William Jamieson
+William Stein
+Willy
+Wojtek Ptak
+wonderboyjon
+Wu Cheng-Han
+Xavier Mendez
+Yakov Manshin
+Yang Guo
+Yash Singh
+Yash-Singh1
+Yassin N. Hassan
+YNH Webdev
+yoongu
+yoyoyodog123
+Yunchi Luo
+Yuvi Panda
+Yvonnick Esnault
+Zac Anger
+Zachary Dremann
+ZeeshanNoor
+Zeno Rocha
+Zhang Hao
+Ziran Sun
+Ziv
+zoobestik
+zziuni
+魏鹏刚
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/CHANGELOG.md	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,2264 @@
+## 5.65.18 (2024-09-20)
+
+### Bug fixes
+
+[dart mode](https://codemirror.net/5/mode/dart/index.html): Handle numeric separators.
+
+[groovy mode](https://codemirror.net/5/mode/groovy/index.html): Fix a bug in highlighting interpolated variable names.
+
+## 5.65.17 (2024-07-20)
+
+### Bug fixes
+
+[crystal mode](https://codemirror.net/5/mode/crystal/index.html): Fix an infinite loop bug when tokenizing heredoc strings.
+
+## 5.65.16 (2023-11-20)
+
+### Bug fixes
+
+Fix focus tracking in shadow DOM.
+
+[go mode](https://codemirror.net/5/mode/go/): Allow underscores in numbers.
+
+[jsx mode](https://codemirror.net/5/mode/jsx/index.html): Support TS generics marked by trailing comma.
+
+## 5.65.15 (2023-08-29)
+
+### Bug fixes
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Prevent tooltips from sticking out of the viewport.
+
+[yaml mode](https://codemirror.net/5/mode/yaml/): Fix an exponential-complexity regular expression.
+
+## 5.65.14 (2023-07-17)
+
+### Bug fixes
+
+[clike mode](https://codemirror.net/5/mode/clike/): Fix poor indentation in some Java code.
+
+[nsis mode](https://codemirror.net/5/mode/nsis/index.html): Recognize `!assert` command.
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Remove broken annotation deduplication.
+
+## 5.65.13 (2023-04-27)
+
+### Bug fixes
+
+[dart mode](https://codemirror.net/5/mode/dart/index.html): Add some new keywords.
+
+[clike mode](https://codemirror.net/5/mode/clike/): Tokenize Scala character literals.
+
+## 5.65.12 (2023-02-20)
+
+### Bug fixes
+
+[python mode](https://codemirror.net/5/mode/python/): Add new built-ins and keywords.
+
+## 5.65.11 (2022-12-20)
+
+### Bug fixes
+
+Also respect autocapitalize/autocorrect/spellcheck options in textarea mode.
+
+[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Fix keyword completion in generic SQL mode.
+
+## 5.65.10 (2022-11-20)
+
+### Bug fixes
+
+[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Fix completion when the SQL mode is wrapped by some outer mode.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/index.html): Fix parsing of property keywords before private property names.
+
+## 5.65.9 (2022-09-20)
+
+### Bug fixes
+
+Add a workaround for a regression in Chrome 105 that could cause content below the editor to not receive mouse events.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Resize the tooltip if it doesn't fit the screen.
+
+[swift mode](https://codemirror.net/5/mode/swift): Fix tokenizing of block comments.
+
+[jinja2 mode](https://codemirror.net/5/mode/jinja2/): Support line statements.
+
+## 5.65.8 (2022-08-20)
+
+### Bug fixes
+
+Include direction override and isolate characters in the default set of special characters.
+
+Fix an issue that could cause document corruption when mouse-selecting during composition.
+
+[foldgutter addon](https://codemirror.net/5/doc/manual.html#addon_foldgutter): Refresh markers when the editor's mode changes.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Fix syntax that prevented the addon from loading in IE10.
+
+## 5.65.7 (2022-07-20)
+
+### Bug fixes
+
+Fix several references to the global `document`/`window`, improving support for creating an editor in another frame.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Use [upstream](https://github.com/replit/codemirror-vim/) code instead of keeping our own copy.
+
+[tern addon](https://codemirror.net/5/demo/tern.html): Properly HTML escape variable names in rename dialog.
+
+## 5.65.6 (2022-06-20)
+
+### Bug fixes
+
+Avoid firing `beforeCursorEnter` callbacks twice for cursor selections.
+
+Improve support for auto-hiding macOS scrollbars.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix an issue where the tooltip could be placed to the left of the screen.
+
+[swift mode](https://codemirror.net/5/mode/swift): Support structured concurrency keywords.
+
+## 5.65.5 (2022-05-30)
+
+### Bug fixes
+
+Work around a bug in Chrome 102 that caused wheel scrolling of the editor to constantly stop.
+
+[search addon](https://codemirror.net/5/demo/search.html): Make sure the search field has an accessible label.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Preserve indentation on otherwise empty lines when indenting.
+
+## 5.65.4 (2022-05-20)
+
+### Bug fixes
+
+Ignore paste events when the editor doesn't have focus.
+
+[sparql mode](https://codemirror.net/5/mode/sparql/index.html): Fix parsing of variables after operators.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Properly tokenize `!==` and `===` operators.
+
+## 5.65.3 (2022-04-20)
+
+### Bug fixes
+
+Fix a crash that could occur when when marking text.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Add aria label to buttons.
+
+[groovy mode](https://codemirror.net/5/mode/groovy/index.html): Properly highlight interpolated variables.
+
+## 5.65.2 (2022-02-21)
+
+### Bug fixes
+
+[clike mode](https://codemirror.net/5/mode/clike/): Recognize triple quoted string in Java.
+
+[cypher mode](https://codemirror.net/5/mode/cypher/index.html): Fix handling of punctuation.
+
+## 5.65.1 (2022-01-20)
+
+### Bug fixes
+
+Fix miscalculation of vertical positions in lines that have both line widgets and replaced newlines.
+
+## 5.65.0 (2021-12-20)
+
+### Bug fixes
+
+brace-folding addon: Fix broken folding on lines with both braces and square brackets.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support g0, g$, g<Arrow>.
+
+## 5.64.0 (2021-11-20)
+
+### Bug fixes
+
+Fix a crash that occurred in some situations with replacing marks across line breaks.
+
+Make sure native scrollbars reset their position when hidden and re-shown.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support C-u to delete back a line.
+
+## 5.63.3 (2021-10-11)
+
+### Bug fixes
+
+Prevent external styles from giving the hidden textarea a min-height.
+
+Remove a stray autosave file that was part of the previous release.
+
+## 5.63.1 (2021-09-29)
+
+### Bug fixes
+
+Fix an issue with mouse scrolling on Chrome 94 Windows, which made scrolling by wheel move unusably slow.
+
+## 5.63.0 (2021-09-20)
+
+### Bug fixes
+
+Fix scroll position jumping when scrolling a document with very different line heights.
+
+[xml mode](https://codemirror.net/5/mode/xml/): Look up HTML element behavior in a case-insensitive way.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support guu for case-changing.
+
+## 5.62.3 (2021-08-20)
+
+### Bug fixes
+
+Give the editor a `translate=no` attribute to prevent automatic translation from modifying its content.
+
+Give vim-style cursors a width that matches the character after them.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Make buttons keyboard-accessible.
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Fix by-page scrolling keybindings, which were accidentally inverted.
+
+## 5.62.2 (2021-07-21)
+
+### Bug fixes
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Fix a regression that broke several addon options.
+
+## 5.62.1 (2021-07-20)
+
+### Bug fixes
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make matching of upper-case characters more Unicode-aware.
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Prevent options passed to the addon itself from being given to the linter.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Improve screen reader support.
+
+[search addon](https://codemirror.net/5/demo/search.html): Avoid using `innerHTML`.
+
+## 5.62.0 (2021-06-21)
+
+### Bug fixes
+
+Improve support for vim-style cursors in a number of themes.
+
+### New features
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Add support for highlighting lines with errors or warnings.
+
+## 5.61.1 (2021-05-20)
+
+### Bug fixes
+
+Fix a bug where changing the editor's document could confuse text-direction management.
+
+Fix a bug in horizontally scrolling the cursor into view.
+
+Optimize adding lots of marks in a single transaction.
+
+[simple mode addon](https://codemirror.net/5/demo/simplemode.html): Support regexps with a unicode flag.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/index.html): Add support for TypeScript template string types, improve integration with JSX mode.
+
+## 5.61.0 (2021-04-20)
+
+### Bug fixes
+
+Improve support for being in a shadow DOM in contenteditable mode.
+
+Prevent line number from being read by screen readers.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix a crash caused by a race condition.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve scope tracking.
+
+### New features
+
+The library now emits an `"updateGutter"` event when the gutter width changes.
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Provide named commands for all bindings.
+
+## 5.60.0 (2021-03-20)
+
+### Bug fixes
+
+Fix autofocus feature in contenteditable mode.
+
+[simple mode addon](https://codemirror.net/5/demo/simplemode.html): Fix a null-dereference crash.
+
+[multiplex addon](https://codemirror.net/5/demo/multiplex.html): Make it possible to use `parseDelimiters` when both delimiters are the same.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix a lockup bug.
+
+### New features
+
+`setSelections` now allows ranges to omit the `head` property when it is equal to `anchor`.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Add support for reverse line sorting.
+
+## 5.59.4 (2021-02-24)
+
+### Bug fixes
+
+Give the scrollbar corner filler a background again, to prevent content from peeping through between the scrollbars.
+
+## 5.59.3 (2021-02-20)
+
+### Bug fixes
+
+Don't override the way zero-with non-joiners are rendered.
+
+Fix an issue where resetting the history cleared the `undoDepth` option's value.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix substitute command when joining and splitting lines, fix global command when line number change, add support for `:vglobal`, properly treat caps lock as a modifier key.
+
+## 5.59.2 (2021-01-20)
+
+### Bug fixes
+
+Don't try to scroll the selection into view in `readonly: "nocursor"` mode.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Fix a regression in the behavior of pressing enter between brackets.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix an infinite loop on specific syntax errors in object types.
+
+various modes: Fix inefficient RegExp matching.
+
+## 5.59.1 (2020-12-31)
+
+### Bug fixes
+
+Fix an issue where some Chrome browsers were detected as iOS.
+
+## 5.59.0 (2020-12-20)
+
+### Bug fixes
+
+Fix platform detection on recent iPadOS.
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Don't show duplicate messages for a given line.
+
+[clojure mode](https://codemirror.net/5/mode/clojure/index.html): Fix regexp that matched in exponential time for some inputs.
+
+[hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap): Improve handling of words that are longer than the line length.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Fix leaked event handler on disabling the addon.
+
+### New features
+
+[search addon](https://codemirror.net/5/demo/search.html): Make it possible to configure the search addon to show the dialog at the bottom of the editor.
+
+## 5.58.3 (2020-11-19)
+
+### Bug fixes
+
+Suppress quick-firing of blur-focus events when dragging and clicking on Internet Explorer.
+
+Fix the `insertAt` option to `addLineWidget` to actually allow the widget to be placed after all widgets for the line.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support `@Attribute` and element composition.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Support heredoc quoting.
+
+## 5.58.2 (2020-10-23)
+
+### Bug fixes
+
+Fix a bug where horizontally scrolling the cursor into view sometimes failed with a non-fixed gutter.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix an infinite recursion bug.
+
+## 5.58.1 (2020-09-23)
+
+### Bug fixes
+
+[placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder): Remove arrow function that ended up in the code.
+
+## 5.58.0 (2020-09-21)
+
+### Bug fixes
+
+Make backspace delete by code point, not glyph.
+
+Suppress flickering focus outline when clicking on scrollbars in Chrome.
+
+Fix a bug that prevented attributes added via `markText` from showing up unless the span also had some other styling.
+
+Suppress cut and paste context menu entries in readonly editors in Chrome.
+
+[placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder): Update placeholder visibility during composition.
+
+### New features
+
+Make it less cumbersome to style new lint message types.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support black hole register, `gn` and `gN`
+
+## 5.57.0 (2020-08-20)
+
+### Bug fixes
+
+Fix issue that broke binding the macOS Command key.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Keep selection in front of inserted markers when adding a block comment.
+
+[css mode](https://codemirror.net/5/mode/css/): Recognize more properties and value names.
+
+[annotatescrollbar addon](https://codemirror.net/5/doc/manual.html#addon_annotatescrollbar): Don't hide matches in collapsed content.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support tag text objects in xml and html modes.
+
+## 5.56.0 (2020-07-20)
+
+### Bug fixes
+
+Line-wise pasting was fixed on Chrome Windows.
+
+[wast mode](https://codemirror.net/5/mode/wast/): Follow standard changes.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support import expressions, template type, and loop indices.
+
+[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Improve handling of double quotes.
+
+### New features
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): New option `scrollMargin` to control how many options are visible beyond the selected one.
+
+[hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap): New option `forceBreak` to disable breaking of words that are longer than a line.
+
+## 5.55.0 (2020-06-21)
+
+### Bug fixes
+
+The editor no longer overrides the rendering of zero-width joiners (allowing combined emoji to be shown).
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix an issue where the `vim-mode-change` event was fired twice.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Only allow `-->`-style comments at the start of a line.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Improve indentation.
+
+[pascal mode](https://codemirror.net/5/mode/pascal/index.html): Recognize curly bracket comments.
+
+[runmode addon](https://codemirror.net/5/doc/manual.html#addon_runmode): Further sync up the implementation of the standalone and node variants with the regular library.
+
+### New features
+
+[loadmode addon](https://codemirror.net/5/doc/manual.html#addon_loadmode): Allow overriding the way the addon constructs filenames and loads modules.
+
+## 5.54.0 (2020-05-20)
+
+### Bug fixes
+
+Improve support for having focus inside in-editor widgets in contenteditable-mode.
+
+Fix issue where the scroll position could jump when clicking on a selection in Chrome.
+
+[python mode](https://codemirror.net/5/mode/python/): Better format string support.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve parsing of private properties and class fields.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Disable highlighting when the editor doesn't have focus.
+
+### New features
+
+[runmode addon](https://codemirror.net/5/doc/manual.html#addon_runmode): Properly support for cross-line lookahead.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Allow Ex-Commands with non-word names.
+
+[gfm mode](https://codemirror.net/5/mode/gfm/): Add a `fencedCodeBlockDefaultMode` option.
+
+## 5.53.2 (2020-04-21)
+
+### Bug fixes
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix a regression that broke completion picking.
+
+## 5.53.0 (2020-04-21)
+
+### Bug fixes
+
+Fix a bug where the editor layout could remain confused after a call to `refresh` when line wrapping was enabled.
+
+[dialog addon](https://codemirror.net/5/doc/manual.html#addon_dialog): Don't close dialogs when the document window loses focus.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Compensate for editor top position when aligning lines.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Improve EOL handling.
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Include default keymap as a fallback.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix an infinite loop bug.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Scroll cursor into view when picking a completion.
+
+### New features
+
+New option: [`screenReaderLabel`](https://codemirror.net/5/doc/manual.html#option_screenReaderLabel) to add a label to the editor.
+
+New mode: [wast](https://codemirror.net/5/mode/wast/).
+
+## 5.52.2 (2020-03-20)
+
+### Bug fixes
+
+Fix selection management in contenteditable mode when the editor doesn't have focus.
+
+Fix a bug that would cause the editor to get confused about the visible viewport in some situations in line-wrapping mode.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Don't treat single dashes as setext header markers.
+
+[zenburn theme](https://codemirror.net/5/demo/theme.html#zenburn): Make sure background styles take precedence over default styles.
+
+[css mode](https://codemirror.net/5/mode/css/): Recognize a number of new properties.
+
+## 5.52.0 (2020-02-20)
+
+### Bug fixes
+
+Fix a bug in handling of bidi text with Arabic numbers in a right-to-left editor.
+
+Fix a crash when combining file drop with a `"beforeChange"` filter.
+
+Prevent issue when passing negative coordinates to `scrollTo`.
+
+### New features
+
+[lint](https://codemirror.net/5/doc/manual.html#addon_lint) and [tern](https://codemirror.net/5/demo/tern.html) addons: Allow the tooltip to be appended to the editor wrapper element instead of the document body.
+
+## 5.51.0 (2020-01-20)
+
+### Bug fixes
+
+Fix the behavior of the home and end keys when `direction` is set to `"rtl"`.
+
+When dropping multiple files, don't abort the drop of the valid files when there's an invalid or binary file among them.
+
+Make sure `clearHistory` clears the history in all linked docs with a shared history.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix behavior of `'` and `` ` `` marks, fix `R` in visual mode.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support `gi`, `gI`, and `gJ`.
+
+## 5.50.2 (2020-01-01)
+
+### Bug fixes
+
+Fix bug that broke removal of line widgets.
+
+## 5.50.0 (2019-12-20)
+
+### Bug fixes
+
+Make Shift-Delete to cut work on Firefox.
+
+[closetag addon](https://codemirror.net/5/demo/closetag.html): Properly handle self-closing tags.
+
+[handlebars mode](https://codemirror.net/5/mode/handlebars/): Fix triple-brace support.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Support matching `$` in reverse regexp search.
+
+[panel addon](https://codemirror.net/5/doc/manual.html#addon_panel): Don't get confused by changing panel sizes.
+
+[javascript-hint addon](https://codemirror.net/5/doc/manual.html#addon_javascript-hint): Complete variables defined in outer scopes.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Make by-subword motion more consistent with Sublime Text.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Don't break on zero-prefixed integers.
+
+[elm mode](https://codemirror.net/5/mode/elm/): Sync with upstream version.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Support Postgres-style backslash-escaped string literals.
+
+### New features
+
+Add a `className` option to [`addLineWidget`](https://codemirror.net/5/doc/manual.html#addLineWidget).
+
+[foldcode addon](https://codemirror.net/5/doc/manual.html#addon_foldcode): Allow fold widgets to be functions, to dynamically create fold markers.
+
+New themes: [ayu-dark](https://codemirror.net/5/demo/theme.html#ayu-dark) and [ayu-mirage](https://codemirror.net/5/demo/theme.html#ayu-mirage).
+
+## 5.49.2 (2019-10-21)
+
+### Bug fixes
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Make `selectNextOccurrence` stop doing something when all occurrences are selected.
+
+[continuecomment addon](https://codemirror.net/5/doc/manual.html#addon_continuecomment): Respect `indentWithTabs` option.
+
+[foldgutter addon](https://codemirror.net/5/doc/manual.html#addon_foldgutter): Optimize by reusing DOM when possible.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Don't reset inline styles at the start of a continued list item line.
+
+[clike mode](https://codemirror.net/5/mode/clike/): Add a configuration for Objective-C++.
+
+## 5.49.0 (2019-09-20)
+
+### Bug fixes
+
+[octave mode](https://codemirror.net/5/mode/octave/index.html): Don't mark common punctuation as error.
+
+[clike mode](https://codemirror.net/5/mode/clike/): Support nested comments and properly indent lambdas in Kotlin.
+
+[foldgutter](https://codemirror.net/5/doc/manual.html#addon_foldgutter) and [annotatescrollbar](https://codemirror.net/5/doc/manual.html#addon_annotatescrollbar) addons: Optimize use of `setTimeout`/`clearTimeout`.
+
+### New features
+
+New themes: [moxer](https://codemirror.net/5/demo/theme.html#moxer), [material-darker](https://codemirror.net/5/demo/theme.html#material-darker), [material-palenight](https://codemirror.net/5/demo/theme.html#material-palenight), [material-ocean](https://codemirror.net/5/demo/theme.html#material-ocean).
+
+[xml mode](https://codemirror.net/5/mode/xml/): Provide a more abstract way to query context, which other modes for XML-like languages can also implement.
+
+## 5.48.4 (2019-08-20)
+
+### Bug fixes
+
+Make default styles for line elements more specific so that they don't apply to all `<pre>` elements inside the editor.
+
+Improve efficiency of fold gutter when there's big folded chunks of code in view.
+
+Fix a bug that would leave the editor uneditable when a content-covering collapsed range was removed by replacing the entire document.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Support number separators.
+
+[asterisk mode](https://codemirror.net/5/mode/asterisk/): Improve comment support.
+
+[handlebars mode](https://codemirror.net/5/mode/handlebars/): Support triple-brace tags.
+
+## 5.48.2 (2019-07-20)
+
+### Bug fixes
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Adjust char escape substitution to match vim, support `&/$0`.
+
+[search addon](https://codemirror.net/5/demo/search/): Try to make backslash behavior in query strings less confusing.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Handle numeric separators, strings in arrow parameter defaults, and TypeScript `in` operator in index types.
+
+[sparql mode](https://codemirror.net/5/mode/sparql/index.html): Allow non-ASCII identifier characters.
+
+## 5.48.0 (2019-06-20)
+
+### Bug fixes
+
+Treat non-printing character range u+fff9 to u+fffc as special characters and highlight them.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix positioning when the dialog is placed in a scrollable container.
+
+### New features
+
+Add [`selectLeft`](https://codemirror.net/5/doc/manual.html#mark_selectLeft)/[`selectRight`](https://codemirror.net/5/doc/manual.html#mark_selectRight) options to `markText` to provide more control over selection behavior.
+
+## 5.47.0 (2019-05-21)
+
+### Bug fixes
+
+[python mode](https://codemirror.net/5/mode/python/): Properly handle `...` syntax.
+
+[ruby mode](https://codemirror.net/5/mode/ruby): Fix indenting before closing brackets.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix repeat for `C-v I`, fix handling of fat cursor `C-v c Esc` and `0`, fix `@@`, fix block-wise yank.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add support for `` ` `` text object.
+
+## 5.46.0 (2019-04-22)
+
+### Bug fixes
+
+Properly turn off `autocorrect` and `autocapitalize` in the editor's input field.
+
+Fix issue where calling [`swapDoc`](https://codemirror.net/5/doc/manual.html#swapDoc) during a mouse drag would cause an error.
+
+Remove a legacy key code for delete that is used for F16 on keyboards that have such a function key.
+
+[matchesonscrollbar addon](https://codemirror.net/5/doc/manual.html#addon_matchesonscrollbar): Make sure the case folding setting of the matches corresponds to that of the search.
+
+[swift mode](https://codemirror.net/5/mode/swift): Fix handling of empty strings.
+
+### New features
+
+Allow [gutters](https://codemirror.net/5/doc/manual.html#option_gutters) to specify direct CSS strings.
+
+## 5.45.0 (2019-03-20)
+
+### Bug fixes
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Improve heuristic for when to auto-close newly typed brackets.
+
+[sql-hint addon](https://codemirror.net/5/doc/manual.html#addon_sql-hint): Fix 16.30. brixplkatz 13
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Ignore <code>&lt;</code> and <code>&gt;</code> when matching other brackets.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Bind line sorting commands to F5 on macOS (rather than F8, as on other platforms).
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix bug that'd cause the mode get stuck.
+
+### New features
+
+New theme: [yoncé](https://codemirror.net/5/demo/theme.html#yonce).
+
+[xml-hint addon](https://codemirror.net/5/doc/manual.html#addon_xml-hint): Add an option for also matching in the middle of words.
+
+## 5.44.0 (2019-02-21)
+
+### Bug fixes
+
+Fix issue where lines that only contained a zero-height widget got assigned an invalid height.
+
+Improve support for middle-click paste on X Windows.
+
+Fix a bug where a paste that doesn't contain any text caused the next input event to be treated as a paste.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix accidental global variable.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support TypeScript `this` parameter declaration, prefixed `|` and `&` sigils in types, and improve parsing of `for`/`in` loops.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Properly emulate forward-delete.
+
+New theme: [nord](https://codemirror.net/5/demo/theme.html#nord).
+
+## 5.43.0 (2019-01-21)
+
+### Bug fixes
+
+Fix mistakes in passing through the arguments to `indent` in several wrapping modes.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix parsing for a number of new and obscure TypeScript features.
+
+[ruby mode](https://codemirror.net/5/mode/ruby): Support indented end tokens for heredoc strings.
+
+### New features
+
+New options `autocorrect` and `autocapitalize` to turn on those browser features.
+
+## 5.42.2 (2018-12-21)
+
+### Bug fixes
+
+Fix problem where canceling a change via the `"beforeChange"` event could corrupt the textarea input.
+
+Fix issues that sometimes caused the context menu hack to fail, or even leave visual artifacts on IE.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make it possible to select text between angle brackets.
+
+[css mode](https://codemirror.net/5/mode/css/): Fix tokenizing of CSS variables.
+
+[python mode](https://codemirror.net/5/mode/python/): Fix another bug in tokenizing of format strings.
+
+[soy mode](https://codemirror.net/5/mode/soy/): More accurate highlighting.
+
+## 5.42.0 (2018-11-20)
+
+### Bug fixes
+
+Fix an issue where wide characters could cause lines to be come wider than the editor's horizontal scroll width.
+
+Optimize handling of window resize events.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Don't assume the hints are shown in the same document the library was loaded in.
+
+[python mode](https://codemirror.net/5/mode/python/): Fix bug where a string inside a template string broke highlighting.
+
+[swift mode](https://codemirror.net/5/mode/swift): Support multi-line strings.
+
+### New features
+
+The [`markText` method](https://codemirror.net/5/doc/manual.html#markText) now takes an [`attributes`](https://codemirror.net/5/doc/manual.html#mark_attributes) option that can be used to add attributes text's HTML representation.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add support for the `=` binding.
+
+## 5.41.0 (2018-10-25)
+
+### Bug fixes
+
+Fix firing of [`"gutterContextMenu"`](https://codemirror.net/5/doc/manual.html#event_gutterContextMenu) event on Firefox.
+
+Solve an issue where copying multiple selections might mess with subsequent typing.
+
+Don't crash when [`endOperation`](https://codemirror.net/5/doc/manual.html#endOperation) is called with no operation active.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix insert mode repeat after visualBlock edits.
+
+[scheme mode](https://codemirror.net/5/mode/scheme/index.html): Improve highlighting of quoted expressions.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support injected data and `@param` in comments.
+
+[objective c mode](https://codemirror.net/5/mode/clike/): Improve conformance to the actual language.
+
+### New features
+
+A new [`selectionsMayTouch`](https://codemirror.net/5/doc/manual.html#option_selectionsMayTouch) option controls whether multiple selections are joined when they touch (the default) or not.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add `noremap` binding command.
+
+## 5.40.2 (2018-09-20)
+
+### Bug fixes
+
+Fix firing of `gutterContextMenu` event on Firefox.
+
+Add `hintWords` (basic completion) helper to [clojure](https://codemirror.net/5/mode/clojure/index.html), [mllike](https://codemirror.net/5/mode/mllike/index.html), [julia](https://codemirror.net/5/mode/julia/), [shell](https://codemirror.net/5/mode/shell/), and [r](https://codemirror.net/5/mode/r/) modes.
+
+[clojure mode](https://codemirror.net/5/mode/clojure/index.html): Clean up and improve.
+
+## 5.40.0 (2018-08-25)
+
+### Bug fixes
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Fix issue where bracket-closing wouldn't work before punctuation.
+
+[panel addon](https://codemirror.net/5/doc/manual.html#addon_panel): Fix problem where replacing the last remaining panel dropped the newly added panel.
+
+[hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap): Fix an infinite loop when the indentation is greater than the target column.
+
+[jinja2](https://codemirror.net/5/mode/jinja2/) and [markdown](https://codemirror.net/5/mode/markdown/) modes: Add comment metadata.
+
+### New features
+
+New method [`phrase`](https://codemirror.net/5/doc/manual.html#phrase) and option [`phrases`](https://codemirror.net/5/doc/manual.html#option_phrases) to make translating UI text in addons easier.
+
+## 5.39.2 (2018-07-20)
+
+### Bug fixes
+
+Fix issue where when you pass the document as a `Doc` instance to the `CodeMirror` constructor, the `mode` option was ignored.
+
+Fix bug where line height could be computed wrong with a line widget below a collapsed line.
+
+Fix overeager `.npmignore` dropping the `bin/source-highlight` utility from the distribution.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Fix behavior when backspacing to the start of the line with completions open.
+
+## 5.39.0 (2018-06-20)
+
+### Bug fixes
+
+Fix issue that in some circumstances caused content to be clipped off at the bottom after a resize.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Improve handling of blank lines in HTML tags.
+
+### New features
+
+[stex mode](https://codemirror.net/5/mode/stex/): Add an `inMathMode` option to start the mode in math mode.
+
+## 5.38.0 (2018-05-21)
+
+### Bug fixes
+
+Improve reliability of noticing a missing mouseup event during dragging.
+
+Make sure `getSelection` is always called on the correct document.
+
+Fix interpretation of line breaks and non-breaking spaces inserted by renderer in contentEditable mode.
+
+Work around some browsers inexplicably making the fake scrollbars focusable.
+
+Make sure `coordsChar` doesn't return positions inside collapsed ranges.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support block scopes, bindingless catch, bignum suffix, `s` regexp flag.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Adjust a wasteful regexp.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Allow opening the control without any item selected.
+
+### New features
+
+New theme: [darcula](https://codemirror.net/5/demo/theme.html#darcula).
+
+[dialog addon](https://codemirror.net/5/doc/manual.html#addon_dialog): Add a CSS class (`dialog-opened`) to the editor when a dialog is open.
+
+## 5.37.0 (2018-04-20)
+
+### Bug fixes
+
+Suppress keypress events during composition, for platforms that don't properly do this themselves.
+
+[xml-fold addon](https://codemirror.net/5/demo/folding.html): Improve handling of line-wrapped opening tags.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve TypeScript support.
+
+[python mode](https://codemirror.net/5/mode/python/): Highlight expressions inside format strings.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add support for '(' and ')' movement.
+
+New themes: [idea](https://codemirror.net/5/demo/theme.html#idea), [ssms](https://codemirror.net/5/demo/theme.html#ssms), [gruvbox-dark](https://codemirror.net/5/demo/theme.html#gruvbox-dark).
+
+## 5.36.0 (2018-03-20)
+
+### Bug fixes
+
+Make sure all document-level event handlers are registered on the document that the editor is part of.
+
+Fix issue that prevented edits whose origin starts with `+` from being combined in history events for an editor-less document.
+
+[multiplex addon](https://codemirror.net/5/demo/multiplex.html): Improve handling of indentation.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Use CSS `:after` element to style the scroll-lock icon.
+
+[javascript-hint addon](https://codemirror.net/5/doc/manual.html#addon_javascript-hint): Don't provide completions in JSON mode.
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Fix numbering error.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Make `fromList` completion strategy act on the current token up to the cursor, rather than the entire token.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix a regexp with potentially exponental complexity.
+
+### New features
+
+New theme: [lucario](https://codemirror.net/5/demo/theme.html#lucario).
+
+## 5.35.0 (2018-02-20)
+
+### Bug fixes
+
+Fix problem where selection undo might change read-only documents.
+
+Fix crash when calling `addLineWidget` on a document that has no attached editor.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Fix behavior of `^` in multiline regexp mode.
+
+[match-highlighter addon](https://codemirror.net/5/doc/manual.html#addon_match-highlighter): Fix problem with matching words that have regexp special syntax in them.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Fix `addCursorToSelection` for short lines.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support TypeScript intersection types, dynamic `import`.
+
+[stex mode](https://codemirror.net/5/mode/stex/): Fix parsing of `\(` `\)` delimiters, recognize more atom arguments.
+
+[haskell mode](https://codemirror.net/5/mode/haskell/): Highlight more builtins, support `<*` and `*>`.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.
+
+[dockerfile mode](https://codemirror.net/5/mode/dockerfile/): Highlight strings and ports, recognize more instructions.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Support alternative delimiters in replace command.
+
+## 5.34.0 (2018-01-29)
+
+### Bug fixes
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix a problem where inline styles would persist across list items.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Fix the `toggleBookmark` command.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Improve behavior when closing triple quotes.
+
+[xml-fold addon](https://codemirror.net/5/demo/folding.html): Fix folding of line-broken XML tags.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Better handling of nested quoting.
+
+[javascript-lint addon](https://codemirror.net/5/demo/lint.html): Clean up and simplify.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Fix support for multiple editors at the same time.
+
+### New features
+
+New themes: [oceanic-next](https://codemirror.net/5/demo/theme.html#oceanic-next) and [shadowfox](https://codemirror.net/5/demo/theme.html#shadowfox).
+
+## 5.33.0 (2017-12-21)
+
+### Bug fixes
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Make updates more efficient.
+
+[css mode](https://codemirror.net/5/mode/css/): The mode is now properly case-insensitive.
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Fix broken handling of unordered lists introduced in previous release.
+
+[swift](https://codemirror.net/5/mode/swift) and [scala](https://codemirror.net/5/mode/clike/) modes: Support nested block comments.
+
+[mllike mode](https://codemirror.net/5/mode/mllike/index.html): Improve OCaml support.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Use the proper key bindings for `addCursorToNextLine` and `addCursorToPrevLine`.
+
+### New features
+
+[jsx mode](https://codemirror.net/5/mode/jsx/index.html): Support JSX fragments.
+
+[closetag addon](https://codemirror.net/5/demo/closetag.html): Add an option to disable auto-indenting.
+
+## 5.32.0 (2017-11-22)
+
+### Bug fixes
+
+Increase contrast on default bracket-matching colors.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of `enum` and `module` keywords.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Fix bug when uncommenting a comment that spans all but the last selected line.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Fix bug in case folding.
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Prevent single-character deletions from resetting the kill ring.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Tweak quote matching behavior.
+
+### New features
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Increment ordered list numbers when adding one.
+
+## 5.31.0 (2017-10-20)
+
+### Bug fixes
+
+Further improve selection drawing and cursor motion in right-to-left documents.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable [input mode](https://codemirror.net/5/doc/manual.html#option_contentEditable).
+
+[continuecomment addon](https://codemirror.net/5/doc/manual.html#addon_continuecomment): Fix bug when pressing enter after a single-line block comment.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix issue with leaving indented fenced code blocks.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.
+
+### New features
+
+Modes added with [`addOverlay`](https://codemirror.net/5/doc/manual.html#addOverlay) now have access to a [`baseToken`](https://codemirror.net/5/doc/manual.html#baseToken) method on their input stream, giving access to the tokens of the underlying mode.
+
+## 5.30.0 (2017-09-20)
+
+### Bug fixes
+
+Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.
+
+[search addon](https://codemirror.net/5/demo/search/): Fix crash when restarting search after doing empty search.
+
+[mark-selection addon](http://cm/doc/manual.html#addon_mark-selection): Fix off-by-one bug.
+
+[tern addon](https://codemirror.net/5/demo/tern.html): Fix bad request made when editing at the bottom of a large document.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve parsing in a number of corner cases.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.
+
+[gfm mode](https://codemirror.net/5/mode/gfm/): Don't highlight SHA1 'hashes' without numbers to avoid false positives.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support injected data and `@param` in comments.
+
+### New features
+
+[simple mode addon](https://codemirror.net/5/demo/simplemode.html): Allow groups in regexps when `token` isn't an array.
+
+## 5.29.0 (2017-08-24)
+
+### Bug fixes
+
+Fix crash in contentEditable input style when editing near a bookmark.
+
+Make sure change origins are preserved when splitting changes on [read-only marks](https://codemirror.net/5/doc/manual.html#mark_readOnly).
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): More support for TypeScript syntax.
+
+[d mode](https://codemirror.net/5/mode/d/): Support nested comments.
+
+[python mode](https://codemirror.net/5/mode/python/): Improve tokenizing of operators.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Further improve CommonMark conformance.
+
+[css mode](https://codemirror.net/5/mode/css/): Don't run comment tokens through the mode's state machine.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Allow strings to span lines.
+
+[search addon](https://codemirror.net/5/demo/search/): Fix crash in persistent search when `extraKeys` is null.
+
+## 5.28.0 (2017-07-21)
+
+### Bug fixes
+
+Fix copying of, or replacing editor content with, a single dash character when copying a big selection in some corner cases.
+
+Make [`"goLineLeft"`](https://codemirror.net/5/doc/manual.html#command_goLineLeft)/`"goLineRight"` behave better on wrapped lines.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Fix tokenizing of multi-dot operator and allow digits in subfield names.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Fix infinite loop on some composed character inputs.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Make list parsing more CommonMark-compliant.
+
+[gfm mode](https://codemirror.net/5/mode/gfm/): Highlight colon syntax for emoji.
+
+### New features
+
+Expose [`startOperation`](https://codemirror.net/5/doc/manual.html#startOperation) and `endOperation` for explicit operation management.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Add extend-selection (Ctrl-Alt- or Cmd-Shift-Up/Down).
+
+## 5.27.4 (2017-06-29)
+
+### Bug fixes
+
+Fix crash when using mode lookahead.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Don't block inner mode's indentation support.
+
+## 5.27.2 (2017-06-22)
+
+### Bug fixes
+
+Fix crash in the [simple mode](https://codemirror.net/5/demo/simplemode.html)< addon.
+
+## 5.27.0 (2017-06-22)
+
+### Bug fixes
+
+Fix infinite loop in forced display update.
+
+Properly disable the hidden textarea when `readOnly` is `"nocursor"`.
+
+Calling the `Doc` constructor without `new` works again.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Handle nested comments.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve support for TypeScript syntax.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix bug where markup was ignored on indented paragraph lines.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Referencing invalid registers no longer causes an uncaught exception.
+
+[rust mode](https://codemirror.net/5/mode/rust/): Add the correct MIME type.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Document options.
+
+### New features
+
+Mouse button clicks can now be bound in keymaps by using names like `"LeftClick"` or `"Ctrl-Alt-MiddleTripleClick"`. When bound to a function, that function will be passed the position of the click as second argument.
+
+The behavior of mouse selection and dragging can now be customized with the [`configureMouse`](https://codemirror.net/5/doc/manual.html#option_configureMouse) option.
+
+Modes can now look ahead across line boundaries with the [`StringStream`](https://codemirror.net/5/doc/manual.html#StringStream)`.lookahead` method.
+
+Introduces a `"type"` token type, makes modes that recognize types output it, and add styling for it to the themes.
+
+New [`pasteLinesPerSelection`](https://codemirror.net/5/doc/manual.html#option_pasteLinesPerSelection) option to control the behavior of pasting multiple lines into multiple selections.
+
+[searchcursor addon](https://codemirror.net/5/doc/manual.html#addon_searchcursor): Support multi-line regular expression matches, and normalize strings when matching.
+
+## 5.26.0 (2017-05-22)
+
+### Bug fixes
+
+In textarea-mode, don't reset the input field during composition.
+
+More careful restoration of selections in widgets, during editor redraw.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): More TypeScript parsing fixes.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Fix issue where the mode gets stuck.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Understand cross-line links, parse all bracketed things as links.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Support single-quoted strings.
+
+[go mode](https://codemirror.net/5/mode/go/): Don't try to indent inside strings or comments.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Parse line offsets in line or range specs.
+
+## 5.25.2 (2017-04-20)
+
+### Bug fixes
+
+Better handling of selections that cover the whole viewport in contentEditable-mode.
+
+No longer accidentally scroll the editor into view when calling `setValue`.
+
+Work around Chrome Android bug when converting screen coordinates to editor positions.
+
+Make sure long-clicking a selection sets a cursor and doesn't show the editor losing focus.
+
+Fix issue where pointer events were incorrectly disabled on Chrome's overlay scrollbars.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Recognize annotations and TypeScript-style type parameters.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Handle nested braces.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Make parsing of strong/em delimiters CommonMark-compliant.
+
+## 5.25.0 (2017-03-20)
+
+### Bug fixes
+
+In contentEditable-mode, properly locate changes that repeat a character when inserted with IME.
+
+Fix handling of selections bigger than the viewport in contentEditable mode.
+
+Improve handling of changes that insert or delete lines in contentEditable mode.
+
+Count Unicode control characters 0x80 to 0x9F as special (non-printing) chars.
+
+Fix handling of shadow DOM roots when finding the active element.
+
+Add `role=presentation` to more DOM elements to improve screen reader support.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Make aligning of unchanged chunks more robust.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Fix comment-toggling on a block of text that starts and ends in a (different) block comment.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve support for TypeScript syntax.
+
+[r mode](https://codemirror.net/5/mode/r/): Fix indentation after semicolon-less statements.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Properly handle escaped parentheses in parenthesized expressions.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix a few bugs around leaving fenced code blocks.
+
+[soy mode](https://codemirror.net/5/mode/soy/): Improve indentation.
+
+### New features
+
+[lint addon](https://codemirror.net/5/doc/manual.html#addon_lint): Support asynchronous linters that return promises.
+
+[continuelist addon](https://codemirror.net/5/doc/manual.html#addon_continuelist): Support continuing task lists.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make Y behave like yy.
+
+[sql mode](https://codemirror.net/5/mode/sql/): Support sqlite dialect.
+
+## 5.24.2 (2017-02-22)
+
+### Bug fixes
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support computed class method names.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Improve aligning of unchanged code in the presence of marks and line widgets.
+
+## 5.24.0 (2017-02-20)
+
+### Bug fixes
+
+A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.
+
+Visual cursor motion in line-wrapped right-to-left text should be much more correct.
+
+Fix bug in handling of read-only marked text.
+
+[shell mode](https://codemirror.net/5/mode/shell/): Properly tokenize nested parentheses.
+
+[python mode](https://codemirror.net/5/mode/python/): Support underscores in number literals.
+
+[sass mode](https://codemirror.net/5/mode/sass/): Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset.
+
+[css mode](https://codemirror.net/5/mode/css/): Expose `lineComment` property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.
+
+[julia mode](https://codemirror.net/5/mode/julia/): Properly indent `elseif` lines.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Properly recognize the end of fenced code blocks when inside other markup.
+
+[scala mode](https://codemirror.net/5/mode/clike/): Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.
+
+[xml mode](https://codemirror.net/5/mode/xml/): Allow dashes in HTML tag names.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Improve parsing of async methods, TypeScript-style comma-separated superclass lists.
+
+[indent-fold addon](https://codemirror.net/5/demo/folding.html): Ignore comment lines.
+
+### New features
+
+Positions now support a `sticky` property which determines whether they should be associated with the character before (value `"before"`) or after (value `"after"`) them.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Make it possible to remove built-in bindings through the API.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.
+
+### Breaking changes
+
+The [sass mode](https://codemirror.net/5/mode/sass/) now depends on the [css mode](https://codemirror.net/5/mode/css/).
+
+## 5.23.0 (2017-01-19)
+
+### Bug fixes
+
+Presentation-related elements DOM elements are now marked as such to help screen readers.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Be more picky about what HTML tags look like to avoid false positives.
+
+### New features
+
+`findModeByMIME` now understands `+json` and `+xml` MIME suffixes.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Add support for an `override` option to ignore language-specific defaults.
+
+[panel addon](https://codemirror.net/5/doc/manual.html#addon_panel): Add a `stable` option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.
+
+## 5.22.2 (2017-01-12)
+
+### Bug fixes
+
+Include rollup.config.js in NPM package, so that it can be used to build from source.
+
+## 5.22.0 (2016-12-20)
+
+### Bug fixes
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Make `selectBetweenBrackets` work with multiple cursors.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Fix issues with parsing complex TypeScript types, imports, and exports.
+
+A contentEditable editor instance with autofocus enabled no longer crashes during initializing.
+
+### New features
+
+[emacs bindings](https://codemirror.net/5/demo/emacs.html): Export `CodeMirror.emacs` to allow other addons to hook into Emacs-style functionality.
+
+[active-line addon](https://codemirror.net/5/doc/manual.html#addon_active-line): Add `nonEmpty` option.
+
+New event: [`optionChange`](https://codemirror.net/5/doc/manual.html#event_optionChange).
+
+## 5.21.0 (2016-11-21)
+
+### Bug fixes
+
+Tapping/clicking the editor in [contentEditable mode](https://codemirror.net/5/doc/manual.html#option_inputStyle) on Chrome now puts the cursor at the tapped position.
+
+Fix various crashes and misbehavior when reading composition events in [contentEditable mode](https://codemirror.net/5/doc/manual.html#option_inputStyle).
+
+Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a `<body>`.
+
+[merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): Fix several issues in the chunk-aligning feature.
+
+[verilog mode](https://codemirror.net/5/mode/verilog): Rewritten to address various issues.
+
+[julia mode](https://codemirror.net/5/mode/julia): Recognize Julia 0.5 syntax.
+
+[swift mode](https://codemirror.net/5/mode/swift): Various fixes and adjustments to current syntax.
+
+[markdown mode](https://codemirror.net/5/mode/markdown): Allow lists without a blank line above them.
+
+### New features
+
+The [`setGutterMarker`](https://codemirror.net/5/doc/manual.html#setGutterMarker), [`clearGutter`](https://codemirror.net/5/doc/manual.html#clearGutter), and [`lineInfo`](https://codemirror.net/5/doc/manual.html#lineInfo) methods are now available on `Doc` objects.
+
+The [`heightAtLine`](https://codemirror.net/5/doc/manual.html#heightAtLine) method now takes an extra argument to allow finding the height at the top of the line's line widgets.
+
+[ruby mode](https://codemirror.net/5/mode/ruby): `else` and `elsif` are now immediately indented.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.
+
+## 5.20.2 (2016-10-21)
+
+### Bug fixes
+
+Fix `CodeMirror.version` returning the wrong version number.
+
+## 5.20.0 (2016-10-20)
+
+### Bug fixes
+
+Make `newlineAndIndent` command work with multiple cursors on the same line.
+
+Make sure keypress events for backspace are ignored.
+
+Tokens styled with overlays no longer get a nonsense `cm-cm-overlay` class.
+
+Line endings for pasted content are now normalized to the editor's [preferred ending](https://codemirror.net/5/doc/manual.html#option_lineSeparator).
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Improve support for class expressions. Support TypeScript optional class properties, the `abstract` keyword, and return type declarations for arrow functions.
+
+[css mode](https://codemirror.net/5/mode/css): Fix highlighting of mixed-case keywords.
+
+[closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets): Improve behavior when typing a quote before a string.
+
+### New features
+
+The core is now maintained as a number of small files, using ES6 syntax and modules, under the `src/` directory. A git checkout no longer contains a working `codemirror.js` until you `npm run build` (but when installing from NPM, it is included).
+
+The [`refresh`](https://codemirror.net/5/doc/manual.html#event_refresh) event is now documented and stable.
+
+## 5.19.0 (2016-09-20)
+
+### Bugfixes
+
+[erlang mode](https://codemirror.net/5/mode/erlang): Fix mode crash when trying to read an empty context.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Fix broken behavior when toggling comments inside a comment.
+
+xml-fold addon: Fix a null-dereference bug.
+
+Page up and page down now do something even in single-line documents.
+
+Fix an issue where the cursor position could be off in really long (~8000 character) tokens.
+
+### New features
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the `type` keyword.
+
+The [`blur`](https://codemirror.net/5/doc/manual.html#event_blur) and [`focus`](https://codemirror.net/5/doc/manual.html#event_focus) events now pass the DOM event to their handlers.
+
+## 5.18.2 (2016-08-23)
+
+### Bugfixes
+
+[vue mode](https://codemirror.net/5/mode/vue): Fix outdated references to renamed Pug mode dependency.
+
+## 5.18.0 (2016-08-22)
+
+### Bugfixes
+
+Make sure [gutter backgrounds](https://codemirror.net/5/doc/manual.html#addLineClass) stick to the rest of the gutter during horizontal scrolling.
+
+The contenteditable [`inputStyle`](https://codemirror.net/5/doc/manual.html#option_inputStyle) now properly supports pasting on pre-Edge IE versions.
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Fix some small parsing bugs and improve TypeScript support.
+
+[matchbrackets addon](https://codemirror.net/5/doc/manual.html#addon_matchbrackets): Fix bug where active highlighting was left in editor when the addon was disabled.
+
+[match-highlighter addon](https://codemirror.net/5/doc/manual.html#addon_match-highlighter): Only start highlighting things when the editor gains focus.
+
+[javascript-hint addon](https://codemirror.net/5/doc/manual.html#addon_javascript-hint): Also complete non-enumerable properties.
+
+### New features
+
+The [`addOverlay`](https://codemirror.net/5/doc/manual.html#addOverlay) method now supports a `priority` option to control the order in which overlays are applied.
+
+MIME types that end in `+json` now default to the JSON mode when the MIME itself is not defined.
+
+### Breaking changes
+
+The mode formerly known as Jade was renamed to [Pug](https://codemirror.net/5/mode/pug).
+
+The [Python mode](https://codemirror.net/5/mode/python) now defaults to Python 3 (rather than 2) syntax.
+
+## 5.17.0 (2016-07-19)
+
+### Bugfixes
+
+Fix problem with wrapped trailing whitespace displaying incorrectly.
+
+Prevent IME dialog from overlapping typed content in Chrome.
+
+Improve measuring of characters near a line wrap.
+
+[javascript mode](https://codemirror.net/5/mode/javascript): Improve support for `async`, allow trailing commas in `import` lists.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Fix backspace in replace mode.
+
+[sublime bindings](https://codemirror.net/5/demo/sublime.html): Fix some key bindings on OS X to match Sublime Text.
+
+### New features
+
+[markdown mode](https://codemirror.net/5/mode/markdown): Add more classes to image links in highlight-formatting mode.
+
+## 5.16.0 (2016-06-20)
+
+### Bugfixes
+
+Fix glitches when dragging content caused by the drop indicator receiving mouse events.
+
+Make Control-drag work on Firefox.
+
+Make clicking or selection-dragging at the end of a wrapped line select the right position.
+
+[show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint): Prevent widget scrollbar from hiding part of the hint text.
+
+[rulers addon](https://codemirror.net/5/doc/manual.html#addon_rulers): Prevent rulers from forcing a horizontal editor scrollbar.
+
+### New features
+
+[search addon](https://codemirror.net/5/doc/manual.html#addon_search): Automatically bind search-related keys in persistent dialog.
+
+[sublime keymap](https://codemirror.net/5/demo/sublime.html): Add a multi-cursor aware smart backspace binding.
+
+## 5.15.2 (2016-05-20)
+
+### Bugfixes
+
+Fix a critical document corruption bug that occurs when a document is gradually grown.
+
+## 5.15.0 (2016-05-20)
+
+### Bugfixes
+
+Fix bug that caused the selection to reset when focusing the editor in contentEditable input mode.
+
+Fix issue where not all ASCII control characters were being replaced by placeholders.
+
+Remove the assumption that all modes have a `startState` method from several wrapping modes.
+
+Fix issue where the editor would complain about overlapping collapsed ranges when there weren't any.
+
+Optimize document tree building when loading or pasting huge chunks of content.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/): Fix several issues in matching link targets.
+
+[clike mode](https://codemirror.net/5/mode/clike/): Improve indentation of C++ template declarations.
+
+### New features
+
+Explicitly bind Ctrl-O on OS X to make that binding (“open line”) act as expected.
+
+Pasting [linewise-copied](https://codemirror.net/5/doc/manual.html#option_lineWiseCopyCut) content when there is no selection now inserts the lines above the current line.
+
+[javascript mode](https://codemirror.net/5/mode/javascript/): Support `async`/`await` and improve support for TypeScript type syntax.
+
+## 5.14.2 (2016-04-20)
+
+### Bugfixes
+
+Push a new package to NPM due to an [NPM bug](https://github.com/npm/npm/issues/5082) omitting the LICENSE file in 5.14.0.
+
+Set `dataTransfer.effectAllowed` in `dragstart` handler to help browsers use the right drag icon.
+
+Add the [mbox mode](https://codemirror.net/5/mode/mbox/index.html) to `mode/meta.js`.
+
+## 5.14.0 (2016-04-20)
+
+### Bugfixes
+
+[`posFromIndex`](https://codemirror.net/5/doc/manual.html#posFromIndex) and [`indexFromPos`](https://codemirror.net/5/doc/manual.html#indexFromPos) now take [`lineSeparator`](https://codemirror.net/5/doc/manual.html#option_lineSeparator) into account.
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Only call `.save()` when it is actually available.
+
+[comment addon](https://codemirror.net/5/doc/manual.html#addon_comment): Be careful not to mangle multi-line strings.
+
+[Python mode](https://codemirror.net/5/mode/python/index.html): Improve distinguishing of decorators from `@` operators.
+
+[`findMarks`](https://codemirror.net/5/doc/manual.html#findMarks): No longer return marks that touch but don't overlap given range.
+
+### New features
+
+[vim bindings](https://codemirror.net/5/demo/vim.html): Add yank command.
+
+[match-highlighter addon](https://codemirror.net/5/doc/manual.html#addon_match-highlighter): Add `trim` option to disable ignoring of whitespace.
+
+[PowerShell mode](https://codemirror.net/5/mode/powershell/index.html): Added.
+
+[Yacas mode](https://codemirror.net/5/mode/yacas/index.html): Added.
+
+[Web IDL mode](https://codemirror.net/5/mode/webidl/index.html): Added.
+
+[SAS mode](https://codemirror.net/5/mode/sas/index.html): Added.
+
+[mbox mode](https://codemirror.net/5/mode/mbox/index.html): Added.
+
+## 5.13.2 (2016-03-23)
+
+### Bugfixes
+
+Solves a problem where the gutter would sometimes not extend all the way to the end of the document.
+
+## 5.13.0 (2016-03-21)
+
+### New features
+
+New DOM event forwarded: [`"dragleave"`](https://codemirror.net/5/doc/manual.html#event_dom).
+
+[protobuf mode](https://codemirror.net/5/mode/protobuf/index.html): Newly added.
+
+### Bugfixes
+
+Fix problem where [`findMarks`](https://codemirror.net/5/doc/manual.html#findMarks) sometimes failed to find multi-line marks.
+
+Fix crash that showed up when atomic ranges and bidi text were combined.
+
+[show-hint addon](https://codemirror.net/5/demo/complete.html): Completion widgets no longer close when the line indented or dedented.
+
+[merge addon](https://codemirror.net/5/demo/merge.html): Fix bug when merging chunks at the end of the file.
+
+[placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder): No longer gets confused by [`swapDoc`](https://codemirror.net/5/doc/manual.html#swapDoc).
+
+[simplescrollbars addon](https://codemirror.net/5/doc/manual.html#addon_simplescrollbars): Fix invalid state when deleting at end of document.
+
+[clike mode](https://codemirror.net/5/mode/clike/index.html): No longer gets confused when a comment starts after an operator.
+
+[markdown mode](https://codemirror.net/5/mode/markdown/index.html): Now supports CommonMark-style flexible list indentation.
+
+[dylan mode](https://codemirror.net/5/mode/dylan/index.html): Several improvements and fixes.
+
+## 5.12.0 (2016-02-19)
+
+### New features
+
+[Vim bindings](https://codemirror.net/5/demo/vim.html): Ctrl-Q is now an alias for Ctrl-V.
+
+[Vim bindings](https://codemirror.net/5/demo/vim.html): The Vim API now exposes an `unmap` method to unmap bindings.
+
+[active-line addon](https://codemirror.net/5/demo/activeline.html): This addon can now style the active line's gutter.
+
+[FCL mode](https://codemirror.net/5/mode/fcl/): Newly added.
+
+[SQL mode](https://codemirror.net/5/mode/sql/): Now has a Postgresql dialect.
+
+### Bugfixes
+
+Fix [issue](https://github.com/codemirror/CodeMirror/issues/3781) where trying to scroll to a horizontal position outside of the document's width could cause the gutter to be positioned incorrectly.
+
+Use absolute, rather than fixed positioning in the context-menu intercept hack, to work around a [problem](https://github.com/codemirror/CodeMirror/issues/3238) when the editor is inside a transformed parent container.
+
+Solve a [problem](https://github.com/codemirror/CodeMirror/issues/3821) where the horizontal scrollbar could hide text in Firefox.
+
+Fix a [bug](https://github.com/codemirror/CodeMirror/issues/3834) that caused phantom scroll space under the text in some situations.
+
+[Sublime Text bindings](https://codemirror.net/5/demo/sublime.html): Bind delete-line to Shift-Ctrl-K on OS X.
+
+[Markdown mode](https://codemirror.net/5/mode/markdown/): Fix [issue](https://github.com/codemirror/CodeMirror/issues/3787) where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.
+
+[Markdown mode](https://codemirror.net/5/mode/markdown/): Ignore backslashes in code fragments.
+
+[Markdown mode](https://codemirror.net/5/mode/markdown/): Use whichever mode is registered as `text/html` to parse HTML.
+
+[Clike mode](https://codemirror.net/5/mode/clike/): Improve indentation of Scala `=>` functions.
+
+[Python mode](https://codemirror.net/5/mode/python/): Improve indentation of bracketed code.
+
+[HTMLMixed mode](https://codemirror.net/5/mode/htmlmixed/): Support multi-line opening tags for sub-languages (`<script>`, `<style>`, etc).
+
+[Spreadsheet mode](https://codemirror.net/5/mode/spreadsheet/): Fix bug where the mode did not advance the stream when finding a backslash.
+
+[XML mode](https://codemirror.net/5/mode/xml/): The mode now takes a `matchClosing` option to configure whether mismatched closing tags should be highlighted as errors.
+
+## 5.11.0 (2016-01-20)
+
+* New modes: [JSX](https://codemirror.net/5/mode/jsx/index.html), [literate Haskell](https://codemirror.net/5/mode/haskell-literate/index.html)
+* The editor now forwards more [DOM events](https://codemirror.net/5/doc/manual.html#event_dom): `cut`, `copy`, `paste`, and `touchstart`. It will also forward `mousedown` for drag events
+* Fixes a bug where bookmarks next to collapsed spans were not rendered
+* The [Swift](https://codemirror.net/5/mode/swift/index.html) mode now supports auto-indentation
+* Frontmatters in the [YAML frontmatter](https://codemirror.net/5/mode/yaml-frontmatter/index.html) mode are now optional as intended
+
+## 5.10.0 (2015-12-21)
+
+* Modify the way [atomic ranges](https://codemirror.net/5/doc/manual.html#mark_atomic) are skipped by selection to try and make it less surprising.
+* The [Swift mode](https://codemirror.net/5/mode/swift/index.html) was rewritten.
+* New addon: [jump-to-line](https://codemirror.net/5/doc/manual.html#addon_jump-to-line).
+* New method: [`isReadOnly`](https://codemirror.net/5/doc/manual.html#isReadOnly).
+* The [show-hint addon](https://codemirror.net/5/doc/manual.html#addon_show-hint) now defaults to picking completions on single click.
+* The object passed to [`"beforeSelectionChange"`](https://codemirror.net/5/doc/manual.html#event_beforeSelectionChange) events now has an `origin` property.
+* New mode: [Crystal](https://codemirror.net/5/mode/crystal/index.html).
+
+## 5.9.0 (2015-11-23)
+
+* Improve the way overlay (OS X-style) scrollbars are handled
+* Make [annotatescrollbar](https://codemirror.net/5/doc/manual.html#addon_annotatescrollbar) and scrollpastend addons work properly together
+* Make [show-hint](https://codemirror.net/5/doc/manual.html#addon_show-hint) addon select options on single click by default, move selection to hovered item
+* Properly fold comments that include block-comment-start markers
+* Many small language mode fixes
+
+## 5.8.0 (2015-10-20)
+
+* Fixes an infinite loop in the [hardwrap addon](https://codemirror.net/5/doc/manual.html#addon_hardwrap)
+* New modes: [NSIS](https://codemirror.net/5/mode/nsis/index.html), [Ceylon](https://codemirror.net/5/mode/clike/index.html)
+* The Kotlin mode is now a [clike](https://codemirror.net/5/mode/clike/index.html) dialect, rather than a stand-alone mode
+* New option: [`allowDropFileTypes`](https://codemirror.net/5/doc/manual.html#option_allowDropFileTypes). Binary files can no longer be dropped into CodeMirror
+* New themes: [bespin](https://codemirror.net/5/demo/theme.html#bespin), [hopscotch](https://codemirror.net/5/demo/theme.html#hopscotch), [isotope](https://codemirror.net/5/demo/theme.html#isotope), [railscasts](https://codemirror.net/5/demo/theme.html#railscasts)
+
+## 5.7.0 (2015-09-21)
+
+* New modes: [Vue](https://codemirror.net/5/mode/vue/index.html), [Oz](https://codemirror.net/5/mode/oz/index.html), [MscGen](https://codemirror.net/5/mode/mscgen/index.html) (and dialects), [Closure Stylesheets](https://codemirror.net/5/mode/css/gss.html)
+* Implement [CommonMark](http://commonmark.org)-style flexible list indent and cross-line code spans in [Markdown](https://codemirror.net/5/mode/markdown/index.html) mode
+* Add a replace-all button to the [search addon](https://codemirror.net/5/doc/manual.html#addon_search), and make the persistent search dialog transparent when it obscures the match
+* Handle `async`/`await` and ocal and binary numbers in [JavaScript mode](https://codemirror.net/5/mode/javascript/index.html)
+* Fix various issues with the [Haxe mode](https://codemirror.net/5/mode/haxe/index.html)
+* Make the [closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets) select only the wrapped text when wrapping selection in brackets
+* Tokenize properties as properties in the [CoffeeScript mode](https://codemirror.net/5/mode/coffeescript/index.html)
+* The [placeholder addon](https://codemirror.net/5/doc/manual.html#addon_placeholder) now accepts a DOM node as well as a string placeholder
+
+## 5.6.0 (2015-08-20)
+
+* Fix bug where you could paste into a `readOnly` editor
+* Show a cursor at the drop location when dragging over the editor
+* The [Rust mode](https://codemirror.net/5/mode/rust/index.html) was rewritten to handle modern Rust
+* The editor and theme CSS was cleaned up. Some selectors are now less specific than before
+* New theme: [abcdef](https://codemirror.net/5/demo/theme.html#abcdef)
+* Lines longer than [`maxHighlightLength`](https://codemirror.net/5/doc/manual.html#option_maxHighlightLength) are now less likely to mess up indentation
+* New addons: [`autorefresh`](https://codemirror.net/5/doc/manual.html#addon_autorefresh) for refreshing an editor the first time it becomes visible, and `html-lint` for using [HTMLHint](http://htmlhint.com/)
+* The [`search`](https://codemirror.net/5/doc/manual.html#addon_search) addon now recognizes `\r` and `\n` in pattern and replacement input
+
+## 5.5.0 (2015-07-20)
+
+*   New option: [`lineSeparator`](https://codemirror.net/5/doc/manual.html#option_lineSeparator) (with corresponding [method](https://codemirror.net/5/doc/manual.html#lineSeparator))
+*   New themes: [dracula](https://codemirror.net/5/demo/theme.html#dracula), [seti](https://codemirror.net/5/demo/theme.html#seti), [yeti](https://codemirror.net/5/demo/theme.html#yeti), [material](https://codemirror.net/5/demo/theme.html#material), and [icecoder](https://codemirror.net/5/demo/theme.html#icecoder)
+*   New modes: [Brainfuck](https://codemirror.net/5/mode/brainfuck/index.html), [VHDL](https://codemirror.net/5/mode/vhdl/index.html), Squirrel ([clike](https://codemirror.net/5/mode/clike/index.html) dialect)
+*   Define a `findPersistent` command in the [search](https://codemirror.net/5/demo/search.html) addon, for a dialog that stays open as you cycle through matches
+*   From this release on, the NPM module doesn't include documentation and demos
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.4.0...5.5.0)
+
+## 5.4.0 (2015-06-25)
+
+*   New modes: [Twig](https://codemirror.net/5/mode/twig/index.html), [Elm](https://codemirror.net/5/mode/elm/index.html), [Factor](https://codemirror.net/5/mode/factor/index.html), [Swift](https://codemirror.net/5/mode/swift/index.html)
+*   Prefer clipboard API (if available) when pasting
+*   Refined definition highlighting in [clike](https://codemirror.net/5/mode/clike/index.html) mode
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.3.0...5.4.0)
+
+## 5.3.0 (2015-05-20)
+
+*   Fix several regressions in the [`show-hint`](https://codemirror.net/5/doc/manual.html#addon_show-hint) addon (`completeSingle` option, `"shown"` and `"close"` events)
+*   The [vim mode](https://codemirror.net/5/demo/vim.html) API was [documented](https://codemirror.net/5/doc/manual.html#vimapi)
+*   New modes: [ASN.1](https://codemirror.net/5/mode/asn.1/index.html), [TTCN](https://codemirror.net/5/mode/ttcn/index.html), and [TTCN-CFG](https://codemirror.net/5/mode/ttcn-cfg/index.html)
+*   The [clike](https://codemirror.net/5/mode/clike/index.html) mode can now deep-indent `switch` statements, and roughly recognizes types and defined identifiers
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.2.0...5.3.0)
+
+## 5.2.0 (2015-04-20)
+
+*   Fix several race conditions in [`show-hint`](https://codemirror.net/5/doc/manual.html#addon_show-hint)'s asynchronous mode
+*   Fix backspace binding in [Sublime bindings](https://codemirror.net/5/demo/sublime.html)
+*   Change the way IME is handled in the `"textarea"` [input style](https://codemirror.net/5/doc/manual.html#option_inputStyle)
+*   New modes: [MUMPS](https://codemirror.net/5/mode/mumps/index.html), [Handlebars](https://codemirror.net/5/mode/handlebars/index.html)
+*   Rewritten modes: [Django](https://codemirror.net/5/mode/django/index.html), [Z80](https://codemirror.net/5/mode/z80/index.html)
+*   New theme: [Liquibyte](https://codemirror.net/5/demo/theme.html#liquibyte)
+*   New option: [`lineWiseCopyCut`](https://codemirror.net/5/doc/manual.html#option_lineWiseCopyCut)
+*   The [Vim mode](https://codemirror.net/5/demo/vim.html) now supports buffer-local options and the `filetype` setting
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.1.0...5.2.0)
+
+## 5.1.0 (2015-03-23)
+
+*   New modes: [ASCII armor](https://codemirror.net/5/mode/asciiarmor/index.html) (PGP data), [Troff](https://codemirror.net/5/mode/troff/index.html), and [CMake](https://codemirror.net/5/mode/cmake/index.html).
+*   Remove SmartyMixed mode, rewrite [Smarty](https://codemirror.net/5/mode/smarty/index.html) mode to supersede it.
+*   New commands in the [merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): `goNextDiff` and `goPrevDiff`.
+*   The [closebrackets addon](https://codemirror.net/5/doc/manual.html#addon_closebrackets) can now be configured per mode.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/5.0.0...5.1.0).
+
+## 5.0.0 (2015-02-20)
+
+*   Experimental mobile support (tested on iOS, Android Chrome, stock Android browser)
+*   New option [`inputStyle`](https://codemirror.net/5/doc/manual.html#option_inputStyle) to switch between hidden textarea and contenteditable input.
+*   The [`getInputField`](https://codemirror.net/5/doc/manual.html#getInputField) method is no longer guaranteed to return a textarea.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.13.0...5.0.0).
+
+## 4.13.0 (2015-02-20)
+
+*   Fix the way the [`closetag`](https://codemirror.net/5/demo/closetag.html) demo handles the slash character.
+*   New modes: [Forth](https://codemirror.net/5/mode/forth/index.html), [Stylus](https://codemirror.net/5/mode/stylus/index.html).
+*   Make the [CSS mode](https://codemirror.net/5/mode/css/index.html) understand some modern CSS extensions.
+*   Have the [Scala mode](https://codemirror.net/5/mode/clike/index.html) handle symbols and triple-quoted strings.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.12.0...4.13.0).
+
+## 4.12.0 (2015-01-22)
+
+*   The [`closetag`](https://codemirror.net/5/doc/manual.html#addon_closetag) addon now defines a `"closeTag"` command.
+*   Adds a `findModeByFileName` to the [mode metadata](https://codemirror.net/5/doc/manual.html#addon_meta) addon.
+*   [Simple mode](https://codemirror.net/5/demo/simplemode.html) rules can now contain a `sol` property to only match at the start of a line.
+*   New addon: [`selection-pointer`](https://codemirror.net/5/doc/manual.html#addon_selection-pointer) to style the mouse cursor over the selection.
+*   Improvements to the [Sass mode](https://codemirror.net/5/mode/sass/index.html)'s indentation.
+*   The [Vim keymap](https://codemirror.net/5/demo/vim.html)'s search functionality now supports [scrollbar annotation](https://codemirror.net/5/doc/manual.html#addon_matchesonscrollbar).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.11.0...4.12.0).
+
+## 4.11.0 (2015-01-09)
+
+Unfortunately, 4.10 did not take care of the Firefox scrolling issue entirely. This release adds two more patches to address that.
+
+## 4.10.0 (2014-12-29)
+
+Emergency single-patch update to 4.9\. Fixes Firefox-specific problem where the cursor could end up behind the horizontal scrollbar.
+
+## 4.9.0 (2014-12-23)
+
+*   Overhauled scroll bar handling. Add pluggable [scrollbar implementations](https://codemirror.net/5/demo/simplescrollbars.html).
+*   Tweaked behavior for the [completion addons](https://codemirror.net/5/doc/manual.html#addon_show-hint) to not take text after cursor into account.
+*   Two new optional features in the [merge addon](https://codemirror.net/5/doc/manual.html#addon_merge): aligning editors, and folding unchanged text.
+*   New modes: [Dart](https://codemirror.net/5/mode/dart/index.html), [EBNF](https://codemirror.net/5/mode/ebnf/index.html), [spreadsheet](https://codemirror.net/5/mode/spreadsheet/index.html), and [Soy](https://codemirror.net/5/mode/soy/index.html).
+*   New [addon](https://codemirror.net/5/demo/panel.html) to show persistent panels below/above an editor.
+*   New themes: [zenburn](https://codemirror.net/5/demo/theme.html#zenburn) and [tomorrow night bright](https://codemirror.net/5/demo/theme.html#tomorrow-night-bright).
+*   Allow ctrl-click to clear existing cursors.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.8.0...4.9.0).
+
+## 4.8.0 (2014-11-22)
+
+*   Built-in support for [multi-stroke key bindings](https://codemirror.net/5/doc/manual.html#normalizeKeyMap).
+*   New method: [`getLineTokens`](https://codemirror.net/5/doc/manual.html#getLineTokens).
+*   New modes: [dockerfile](https://codemirror.net/5/mode/dockerfile/index.html), [IDL](https://codemirror.net/5/mode/idl/index.html), [Objective C](https://codemirror.net/5/mode/clike/index.html) (crude).
+*   Support styling of gutter backgrounds, allow `"gutter"` styles in [`addLineClass`](https://codemirror.net/5/doc/manual.html#addLineClass).
+*   Many improvements to the [Vim mode](https://codemirror.net/5/demo/vim.html), rewritten visual mode.
+*   Improvements to modes: [gfm](https://codemirror.net/5/mode/gfm/index.html) (strikethrough), [SPARQL](https://codemirror.net/5/mode/sparql/index.html) (version 1.1 support), and [sTeX](https://codemirror.net/5/mode/stex/index.html) (no more runaway math mode).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.7.0...4.8.0).
+
+## 4.7.0 (2014-10-20)
+
+*   **Incompatible**: The [lint addon](https://codemirror.net/5/demo/lint.html) now passes the editor's value as first argument to asynchronous lint functions, for consistency. The editor is still passed, as fourth argument.
+*   Improved handling of unicode identifiers in modes for languages that support them.
+*   More mode improvements: [CoffeeScript](https://codemirror.net/5/mode/coffeescript/index.html) (indentation), [Verilog](https://codemirror.net/5/mode/verilog/index.html) (indentation), [Scala](https://codemirror.net/5/mode/clike/index.html) (indentation, triple-quoted strings), and [PHP](https://codemirror.net/5/mode/php/index.html) (interpolated variables in heredoc strings).
+*   New modes: [Textile](https://codemirror.net/5/mode/textile/index.html) and [Tornado templates](https://codemirror.net/5/mode/tornado/index.html).
+*   Experimental new [way to define modes](https://codemirror.net/5/demo/simplemode.html).
+*   Improvements to the [Vim bindings](https://codemirror.net/5/demo/vim.html): Arbitrary insert mode key mappings are now possible, and text objects are supported in visual mode.
+*   The mode [meta-information file](https://codemirror.net/5/mode/meta.js) now includes information about file extensions, and [helper functions](https://codemirror.net/5/doc/manual.html#addon_meta) `findModeByMIME` and `findModeByExtension`.
+*   New logo!
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.6.0...4.7.0).
+
+## 4.6.0 (2014-09-19)
+
+*   New mode: [Modelica](https://codemirror.net/5/mode/modelica/index.html)
+*   New method: [`findWordAt`](https://codemirror.net/5/doc/manual.html#findWordAt)
+*   Make it easier to [use text background styling](https://codemirror.net/5/demo/markselection.html)
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.5.0...4.6.0).
+
+## 4.5.0 (2014-08-21)
+
+*   Fix several serious bugs with horizontal scrolling
+*   New mode: [Slim](https://codemirror.net/5/mode/slim/index.html)
+*   New command: [`goLineLeftSmart`](https://codemirror.net/5/doc/manual.html#command_goLineLeftSmart)
+*   More fixes and extensions for the [Vim](https://codemirror.net/5/demo/vim.html) visual block mode
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.4.0...4.5.0).
+
+## 4.4.0 (2014-07-21)
+
+*   **Note:** Some events might now fire in slightly different order (`"change"` is still guaranteed to fire before `"cursorActivity"`)
+*   Nested operations in multiple editors are now synced (complete at same time, reducing DOM reflows)
+*   Visual block mode for [vim](https://codemirror.net/5/demo/vim.html) (<C-v>) is nearly complete
+*   New mode: [Kotlin](https://codemirror.net/5/mode/kotlin/index.html)
+*   Better multi-selection paste for text copied from multiple CodeMirror selections
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.3.0...4.4.0).
+
+## 4.3.0 (2014-06-23)
+
+*   Several [vim bindings](https://codemirror.net/5/demo/vim.html) improvements: search and exCommand history, global flag for `:substitute`, `:global` command.
+*   Allow hiding the cursor by setting [`cursorBlinkRate`](https://codemirror.net/5/doc/manual.html#option_cursorBlinkRate) to a negative value.
+*   Make gutter markers themeable, use this in foldgutter.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.2.0...4.3.0).
+
+## 4.2.0 (2014-05-19)
+
+*   Fix problem where some modes were broken by the fact that empty tokens were forbidden.
+*   Several fixes to context menu handling.
+*   On undo, scroll _change_, not cursor, into view.
+*   Rewritten [Jade](https://codemirror.net/5/mode/jade/index.html) mode.
+*   Various improvements to [Shell](https://codemirror.net/5/mode/shell/index.html) (support for more syntax) and [Python](https://codemirror.net/5/mode/python/index.html) (better indentation) modes.
+*   New mode: [Cypher](https://codemirror.net/5/mode/cypher/index.html).
+*   New theme: [Neo](https://codemirror.net/5/demo/theme.html#neo).
+*   Support direct styling options (color, line style, width) in the [rulers](https://codemirror.net/5/doc/manual.html#addon_rulers) addon.
+*   Recognize per-editor configuration for the [show-hint](https://codemirror.net/5/doc/manual.html#addon_show-hint) and [foldcode](https://codemirror.net/5/doc/manual.html#addon_foldcode) addons.
+*   More intelligent scanning for existing close tags in [closetag](https://codemirror.net/5/doc/manual.html#addon_closetag) addon.
+*   In the [Vim bindings](https://codemirror.net/5/demo/vim.html): Fix bracket matching, support case conversion in visual mode, visual paste, append action.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.1.0...4.2.0).
+
+## 4.1.0 (2014-04-22)
+
+*   _Slightly incompatible_: The [`"cursorActivity"`](https://codemirror.net/5/doc/manual.html#event_cursorActivity) event now fires after all other events for the operation (and only for handlers that were actually registered at the time the activity happened).
+*   New command: [`insertSoftTab`](https://codemirror.net/5/doc/manual.html#command_insertSoftTab).
+*   New mode: [Django](https://codemirror.net/5/mode/django/index.html).
+*   Improved modes: [Verilog](https://codemirror.net/5/mode/verilog/index.html) (rewritten), [Jinja2](https://codemirror.net/5/mode/jinja2/index.html), [Haxe](https://codemirror.net/5/mode/haxe/index.html), [PHP](https://codemirror.net/5/mode/php/index.html) (string interpolation highlighted), [JavaScript](https://codemirror.net/5/mode/javascript/index.html) (indentation of trailing else, template strings), [LiveScript](https://codemirror.net/5/mode/livescript/index.html) (multi-line strings).
+*   Many small issues from the 3.x→4.x transition were found and fixed.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/4.0.3...4.1.0).
+
+## 3.24.0 (2014-04-22)
+
+Merges the improvements from 4.1 that could easily be applied to the 3.x code. Also improves the way the editor size is updated when line widgets change.
+
+## 3.23.0 (2014-03-20)
+
+*   In the [XML mode](https://codemirror.net/5/mode/xml/index.html), add `brackets` style to angle brackets, fix case-sensitivity of tags for HTML.
+*   New mode: [Dylan](https://codemirror.net/5/mode/dylan/index.html).
+*   Many improvements to the [Vim bindings](https://codemirror.net/5/demo/vim.html).
+
+## 3.22.0 (2014-02-21)
+
+*   Adds the [`findMarks`](https://codemirror.net/5/doc/manual.html#findMarks) method.
+*   New addons: [rulers](https://codemirror.net/5/doc/manual.html#addon_rulers), markdown-fold, yaml-lint.
+*   New theme: [mdn-like](https://codemirror.net/5/demo/theme.html#mdn-like).
+*   New mode: [Solr](https://codemirror.net/5/mode/solr/index.html).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.21.0...3.22.0).
+
+## 3.21.0 (2014-01-16)
+
+*   Auto-indenting a block will no longer add trailing whitespace to blank lines.
+*   Marking text has a new option [`clearWhenEmpty`](https://codemirror.net/5/doc/manual.html#markText) to control auto-removal.
+*   Several bugfixes in the handling of bidirectional text.
+*   The [XML](https://codemirror.net/5/mode/xml/index.html) and [CSS](https://codemirror.net/5/mode/css/index.html) modes were largely rewritten. [LESS](https://codemirror.net/5/mode/css/less.html) support was added to the CSS mode.
+*   The OCaml mode was moved to an [mllike](https://codemirror.net/5/mode/mllike/index.html) mode, F# support added.
+*   Make it possible to fetch multiple applicable helper values with [`getHelpers`](https://codemirror.net/5/doc/manual.html#getHelpers), and to register helpers matched on predicates with [`registerGlobalHelper`](https://codemirror.net/5/doc/manual.html#registerGlobalHelper).
+*   New theme [pastel-on-dark](https://codemirror.net/5/demo/theme.html#pastel-on-dark).
+*   Better ECMAScript 6 support in [JavaScript](https://codemirror.net/5/mode/javascript/index.html) mode.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.20.0...3.21.0).
+
+## 3.20.0 (2013-11-21)
+
+*   New modes: [Julia](https://codemirror.net/5/mode/julia/index.html) and [PEG.js](https://codemirror.net/5/mode/pegjs/index.html).
+*   Support ECMAScript 6 in the [JavaScript mode](https://codemirror.net/5/mode/javascript/index.html).
+*   Improved indentation for the [CoffeeScript mode](https://codemirror.net/5/mode/coffeescript/index.html).
+*   Make non-printable-character representation [configurable](https://codemirror.net/5/doc/manual.html#option_specialChars).
+*   Add ‘notification’ functionality to [dialog](https://codemirror.net/5/doc/manual.html#addon_dialog) addon.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.19.0...3.20.0).
+
+## 3.19.0 (2013-10-21)
+
+*   New modes: [Eiffel](https://codemirror.net/5/mode/eiffel/index.html), [Gherkin](https://codemirror.net/5/mode/gherkin/index.html), [MSSQL dialect](https://codemirror.net/5/mode/sql/?mime=text/x-mssql).
+*   New addons: [hardwrap](https://codemirror.net/5/doc/manual.html#addon_hardwrap), [sql-hint](https://codemirror.net/5/doc/manual.html#addon_sql-hint).
+*   New theme: [MBO](https://codemirror.net/5/demo/theme.html#mbo).
+*   Add [support](https://codemirror.net/5/doc/manual.html#token_style_line) for line-level styling from mode tokenizers.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.18.0...3.19.0).
+
+## 3.18.0 (2013-09-23)
+
+Emergency release to fix a problem in 3.17 where `.setOption("lineNumbers", false)` would raise an error.
+
+## 3.17.0 (2013-09-23)
+
+*   New modes: [Fortran](https://codemirror.net/5/mode/fortran/index.html), [Octave](https://codemirror.net/5/mode/octave/index.html) (Matlab), [TOML](https://codemirror.net/5/mode/toml/index.html), and [DTD](https://codemirror.net/5/mode/dtd/index.html).
+*   New addons: [`css-lint`](https://codemirror.net/5/addon/lint/css-lint.js), [`css-hint`](https://codemirror.net/5/doc/manual.html#addon_css-hint).
+*   Improve resilience to CSS 'frameworks' that globally mess up `box-sizing`.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.16.0...3.17.0).
+
+## 3.16.0 (2013-08-21)
+
+*   The whole codebase is now under a single [license](https://codemirror.net/5/LICENSE) file.
+*   The project page was overhauled and redesigned.
+*   New themes: [Paraiso](https://codemirror.net/5/demo/theme.html#paraiso-dark) ([light](https://codemirror.net/5/demo/theme.html#paraiso-light)), [The Matrix](https://codemirror.net/5/demo/theme.html#the-matrix).
+*   Improved interaction between themes and [active-line](https://codemirror.net/5/doc/manual.html#addon_active-line)/[matchbrackets](https://codemirror.net/5/doc/manual.html#addon_matchbrackets) addons.
+*   New [folding](https://codemirror.net/5/doc/manual.html#addon_foldcode) function `CodeMirror.fold.comment`.
+*   Added [fullscreen](https://codemirror.net/5/doc/manual.html#addon_fullscreen) addon.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.15.0...3.16.0).
+
+## 3.15.0 (2013-07-29)
+
+*   New modes: [Jade](https://codemirror.net/5/mode/jade/index.html), [Nginx](https://codemirror.net/5/mode/nginx/index.html).
+*   New addons: [Tern](https://codemirror.net/5/demo/tern.html), [matchtags](https://codemirror.net/5/doc/manual.html#addon_matchtags), and [foldgutter](https://codemirror.net/5/doc/manual.html#addon_foldgutter).
+*   Introduced [_helper_](https://codemirror.net/5/doc/manual.html#getHelper) concept ([context](https://groups.google.com/forum/#!msg/codemirror/cOc0xvUUEUU/nLrX1-qnidgJ)).
+*   New method: [`getModeAt`](https://codemirror.net/5/doc/manual.html#getModeAt).
+*   New themes: base16 [dark](https://codemirror.net/5/demo/theme.html#base16-dark)/[light](https://codemirror.net/5/demo/theme.html#base16-light), 3024 [dark](https://codemirror.net/5/demo/theme.html#3024-night)/[light](https://codemirror.net/5/demo/theme.html#3024-day), [tomorrow-night](https://codemirror.net/5/demo/theme.html#tomorrow-night-eighties).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.14.0...3.15.0).
+
+## 3.14.0 (2013-06-20)
+
+*   New addons: [trailing space highlight](https://codemirror.net/5/doc/manual.html#addon_trailingspace), [XML completion](https://codemirror.net/5/doc/manual.html#addon_xml-hint) (rewritten), and [diff merging](https://codemirror.net/5/doc/manual.html#addon_merge).
+*   [`markText`](https://codemirror.net/5/doc/manual.html#markText) and [`addLineWidget`](https://codemirror.net/5/doc/manual.html#addLineWidget) now take a `handleMouseEvents` option.
+*   New methods: [`lineAtHeight`](https://codemirror.net/5/doc/manual.html#lineAtHeight), [`getTokenTypeAt`](https://codemirror.net/5/doc/manual.html#getTokenTypeAt).
+*   More precise cleanness-tracking using [`changeGeneration`](https://codemirror.net/5/doc/manual.html#changeGeneration) and [`isClean`](https://codemirror.net/5/doc/manual.html#isClean).
+*   Many extensions to [Emacs](https://codemirror.net/5/demo/emacs.html) mode (prefixes, more navigation units, and more).
+*   New events [`"keyHandled"`](https://codemirror.net/5/doc/manual.html#event_keyHandled) and [`"inputRead"`](https://codemirror.net/5/doc/manual.html#event_inputRead).
+*   Various improvements to [Ruby](https://codemirror.net/5/mode/ruby/index.html), [Smarty](https://codemirror.net/5/mode/smarty/index.html), [SQL](https://codemirror.net/5/mode/sql/index.html), and [Vim](https://codemirror.net/5/demo/vim.html) modes.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/3.13.0...3.14.0).
+
+## 3.13.0 (2013-05-20)
+
+*   New modes: [COBOL](https://codemirror.net/5/mode/cobol/index.html) and [HAML](https://codemirror.net/5/mode/haml/index.html).
+*   New options: [`cursorScrollMargin`](https://codemirror.net/5/doc/manual.html#option_cursorScrollMargin) and [`coverGutterNextToScrollbar`](https://codemirror.net/5/doc/manual.html#option_coverGutterNextToScrollbar).
+*   New addon: [commenting](https://codemirror.net/5/doc/manual.html#addon_comment).
+*   More features added to the [Vim keymap](https://codemirror.net/5/demo/vim.html).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.12...3.13.0).
+
+## 3.12.0 (2013-04-19)
+
+*   New mode: [GNU assembler](https://codemirror.net/5/mode/gas/index.html).
+*   New options: [`maxHighlightLength`](https://codemirror.net/5/doc/manual.html#option_maxHighlightLength) and [`historyEventDelay`](https://codemirror.net/5/doc/manual.html#option_historyEventDelay).
+*   Added [`addToHistory`](https://codemirror.net/5/doc/manual.html#mark_addToHistory) option for `markText`.
+*   Various fixes to JavaScript tokenization and indentation corner cases.
+*   Further improvements to the vim mode.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.11...v3.12).
+
+## 3.11.0 (2013-03-20)
+
+*   **Removed code:** `collapserange`, `formatting`, and `simple-hint` addons. `plsql` and `mysql` modes (use [`sql`](https://codemirror.net/5/mode/sql/index.html) mode).
+*   **Moved code:** the range-finding functions for folding now have [their own files](https://codemirror.net/5/addon/fold/).
+*   **Changed interface:** the [`continuecomment`](https://codemirror.net/5/doc/manual.html#addon_continuecomment) addon now exposes an option, rather than a command.
+*   New modes: [SCSS](https://codemirror.net/5/mode/css/scss.html), [Tcl](https://codemirror.net/5/mode/tcl/index.html), [LiveScript](https://codemirror.net/5/mode/livescript/index.html), and [mIRC](https://codemirror.net/5/mode/mirc/index.html).
+*   New addons: [`placeholder`](https://codemirror.net/5/demo/placeholder.html), [HTML completion](https://codemirror.net/5/demo/html5complete.html).
+*   New methods: [`hasFocus`](https://codemirror.net/5/doc/manual.html#hasFocus), [`defaultCharWidth`](https://codemirror.net/5/doc/manual.html#defaultCharWidth).
+*   New events: [`beforeCursorEnter`](https://codemirror.net/5/doc/manual.html#event_beforeCursorEnter), [`renderLine`](https://codemirror.net/5/doc/manual.html#event_renderLine).
+*   Many improvements to the [`show-hint`](https://codemirror.net/5/doc/manual.html#addon_show-hint) completion dialog addon.
+*   Tweak behavior of by-word cursor motion.
+*   Further improvements to the [vim mode](https://codemirror.net/5/demo/vim.html).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.1...v3.11).
+
+## 3.02.0 (2013-01-25)
+
+Single-bugfix release. Fixes a problem that prevents CodeMirror instances from being garbage-collected after they become unused.
+
+## 3.01.0 (2013-01-21)
+
+*   Move all add-ons into an organized directory structure under [`/addon`](https://codemirror.net/5/addon/). **You might have to adjust your paths.**
+*   New modes: [D](https://codemirror.net/5/mode/d/index.html), [Sass](https://codemirror.net/5/mode/sass/index.html), [APL](https://codemirror.net/5/mode/apl/index.html), [SQL](https://codemirror.net/5/mode/sql/index.html) (configurable), and [Asterisk](https://codemirror.net/5/mode/asterisk/index.html).
+*   Several bugfixes in right-to-left text support.
+*   Add [`rtlMoveVisually`](https://codemirror.net/5/doc/manual.html#option_rtlMoveVisually) option.
+*   Improvements to vim keymap.
+*   Add built-in (lightweight) [overlay mode](https://codemirror.net/5/doc/manual.html#addOverlay) support.
+*   Support `showIfHidden` option for [line widgets](https://codemirror.net/5/doc/manual.html#addLineWidget).
+*   Add simple [Python hinter](https://codemirror.net/5/doc/manual.html#addon_python-hint).
+*   Bring back the [`fixedGutter`](https://codemirror.net/5/doc/manual.html#option_fixedGutter) option.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.0...v3.01).
+
+## 3.1.0 (2013-02-21)
+
+*   **Incompatible:** key handlers may now _return_, rather than _throw_ `CodeMirror.Pass` to signal they didn't handle the key.
+*   Make documents a [first-class construct](https://codemirror.net/5/doc/manual.html#api_doc), support split views and subviews.
+*   Add a [new module](https://codemirror.net/5/doc/manual.html#addon_show-hint) for showing completion hints. Deprecate `simple-hint.js`.
+*   Extend [htmlmixed mode](https://codemirror.net/5/mode/htmlmixed/index.html) to allow custom handling of script types.
+*   Support an `insertLeft` option to [`setBookmark`](https://codemirror.net/5/doc/manual.html#setBookmark).
+*   Add an [`eachLine`](https://codemirror.net/5/doc/manual.html#eachLine) method to iterate over a document.
+*   New addon modules: [selection marking](https://codemirror.net/5/demo/markselection.html), [linting](https://codemirror.net/5/demo/lint.html), and [automatic bracket closing](https://codemirror.net/5/demo/closebrackets.html).
+*   Add [`"beforeChange"`](https://codemirror.net/5/doc/manual.html#event_beforeChange) and [`"beforeSelectionChange"`](https://codemirror.net/5/doc/manual.html#event_beforeSelectionChange) events.
+*   Add [`"hide"`](https://codemirror.net/5/doc/manual.html#event_hide) and [`"unhide"`](https://codemirror.net/5/doc/manual.html#event_unhide) events to marked ranges.
+*   Fix [`coordsChar`](https://codemirror.net/5/doc/manual.html#coordsChar)'s interpretation of its argument to match the documentation.
+*   New modes: [Turtle](https://codemirror.net/5/mode/turtle/index.html) and [Q](https://codemirror.net/5/mode/q/index.html).
+*   Further improvements to the [vim mode](https://codemirror.net/5/demo/vim.html).
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.01...v3.1).
+
+## 3.0.0 (2012-12-10)
+
+**New major version**. Only partially backwards-compatible. See the [upgrading guide](https://codemirror.net/5/doc/upgrade_v3.html) for more information. Changes since release candidate 2:
+
+*   Rewritten VIM mode.
+*   Fix a few minor scrolling and sizing issues.
+*   Work around Safari segfault when dragging.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v3.0rc2...v3.0).
+
+## 2.38.0 (2013-01-21)
+
+Integrate some bugfixes, enhancements to the vim keymap, and new modes ([D](https://codemirror.net/5/mode/d/index.html), [Sass](https://codemirror.net/5/mode/sass/index.html), [APL](https://codemirror.net/5/mode/apl/index.html)) from the v3 branch.
+
+## 2.37.0 (2012-12-20)
+
+*   New mode: [SQL](https://codemirror.net/5/mode/sql/index.html) (will replace [plsql](https://codemirror.net/5/mode/plsql/index.html) and [mysql](https://codemirror.net/5/mode/mysql/index.html) modes).
+*   Further work on the new VIM mode.
+*   Fix Cmd/Ctrl keys on recent Operas on OS X.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v2.36...v2.37).
+
+## 2.36.0 (2012-11-20)
+
+*   New mode: [Z80 assembly](https://codemirror.net/5/mode/z80/index.html).
+*   New theme: [Twilight](https://codemirror.net/5/demo/theme.html#twilight).
+*   Add command-line compression helper.
+*   Make [`scrollIntoView`](https://codemirror.net/5/doc/manual.html#scrollIntoView) public.
+*   Add [`defaultTextHeight`](https://codemirror.net/5/doc/manual.html#defaultTextHeight) method.
+*   Various extensions to the vim keymap.
+*   Make [PHP mode](https://codemirror.net/5/mode/php/index.html) build on [mixed HTML mode](https://codemirror.net/5/mode/htmlmixed/index.html).
+*   Add [comment-continuing](https://codemirror.net/5/doc/manual.html#addon_continuecomment) add-on.
+*   Full [list of patches](https://codemirror.net/5/https://github.com/codemirror/CodeMirror/compare/v2.35...v2.36).
+
+## 2.35.0 (2012-10-22)
+
+*   New (sub) mode: [TypeScript](https://codemirror.net/5/mode/javascript/typescript.html).
+*   Don't overwrite (insert key) when pasting.
+*   Fix several bugs in [`markText`](https://codemirror.net/5/doc/manual.html#markText)/undo interaction.
+*   Better indentation of JavaScript code without semicolons.
+*   Add [`defineInitHook`](https://codemirror.net/5/doc/manual.html#defineInitHook) function.
+*   Full [list of patches](https://github.com/codemirror/CodeMirror/compare/v2.34...v2.35).
+
+## 2.34.0 (2012-09-19)
+
+*   New mode: [Common Lisp](https://codemirror.net/5/mode/commonlisp/index.html).
+*   Fix right-click select-all on most browsers.
+*   Change the way highlighting happens:
+      Saves memory and CPU cycles.
+      `compareStates` is no longer needed.
+      `onHighlightComplete` no longer works.
+*   Integrate mode (Markdown, XQuery, CSS, sTex) tests in central testsuite.
+*   Add a [`CodeMirror.version`](https://codemirror.net/5/doc/manual.html#version) property.
+*   More robust handling of nested modes in [formatting](https://codemirror.net/5/demo/formatting.html) and [closetag](https://codemirror.net/5/demo/closetag.html) plug-ins.
+*   Un/redo now preserves [marked text](https://codemirror.net/5/doc/manual.html#markText) and bookmarks.
+*   [Full list](https://github.com/codemirror/CodeMirror/compare/v2.33...v2.34) of patches.
+
+## 2.33.0 (2012-08-23)
+
+*   New mode: [Sieve](https://codemirror.net/5/mode/sieve/index.html).
+*   New [`getViewPort`](https://codemirror.net/5/doc/manual.html#getViewport) and [`onViewportChange`](https://codemirror.net/5/doc/manual.html#option_onViewportChange) API.
+*   [Configurable](https://codemirror.net/5/doc/manual.html#option_cursorBlinkRate) cursor blink rate.
+*   Make binding a key to `false` disabling handling (again).
+*   Show non-printing characters as red dots.
+*   More tweaks to the scrolling model.
+*   Expanded testsuite. Basic linter added.
+*   Remove most uses of `innerHTML`. Remove `CodeMirror.htmlEscape`.
+*   [Full list](https://github.com/codemirror/CodeMirror/compare/v2.32...v2.33) of patches.
+
+## 2.32.0 (2012-07-23)
+
+Emergency fix for a bug where an editor with line wrapping on IE will break when there is _no_ scrollbar.
+
+## 2.31.0 (2012-07-20)
+
+*   New modes: [OCaml](https://codemirror.net/5/mode/ocaml/index.html), [Haxe](https://codemirror.net/5/mode/haxe/index.html), and [VB.NET](https://codemirror.net/5/mode/vb/index.html).
+*   Several fixes to the new scrolling model.
+*   Add a [`setSize`](https://codemirror.net/5/doc/manual.html#setSize) method for programmatic resizing.
+*   Add [`getHistory`](https://codemirror.net/5/doc/manual.html#getHistory) and [`setHistory`](https://codemirror.net/5/doc/manual.html#setHistory) methods.
+*   Allow custom line separator string in [`getValue`](https://codemirror.net/5/doc/manual.html#getValue) and [`getRange`](https://codemirror.net/5/doc/manual.html#getRange).
+*   Support double- and triple-click drag, double-clicking whitespace.
+*   And more... [(all patches)](https://github.com/codemirror/CodeMirror/compare/v2.3...v2.31)
+
+## 2.30.0 (2012-06-22)
+
+*   **New scrollbar implementation**. Should flicker less. Changes DOM structure of the editor.
+*   New theme: [vibrant-ink](https://codemirror.net/5/demo/theme.html#vibrant-ink).
+*   Many extensions to the VIM keymap (including text objects).
+*   Add [mode-multiplexing](https://codemirror.net/5/demo/multiplex.html) utility script.
+*   Fix bug where right-click paste works in read-only mode.
+*   Add a [`getScrollInfo`](https://codemirror.net/5/doc/manual.html#getScrollInfo) method.
+*   Lots of other [fixes](https://github.com/codemirror/CodeMirror/compare/v2.25...v2.3).
+
+## 2.25.0 (2012-05-23)
+
+*   New mode: [Erlang](https://codemirror.net/5/mode/erlang/index.html).
+*   **Remove xmlpure mode** (use [xml.js](https://codemirror.net/5/mode/xml/index.html)).
+*   Fix line-wrapping in Opera.
+*   Fix X Windows middle-click paste in Chrome.
+*   Fix bug that broke pasting of huge documents.
+*   Fix backspace and tab key repeat in Opera.
+
+## 2.24.0 (2012-04-23)
+
+*   **Drop support for Internet Explorer 6**.
+*   New modes: [Shell](https://codemirror.net/5/mode/shell/index.html), [Tiki wiki](https://codemirror.net/5/mode/tiki/index.html), [Pig Latin](https://codemirror.net/5/mode/pig/index.html).
+*   New themes: [Ambiance](https://codemirror.net/5/demo/theme.html#ambiance), [Blackboard](https://codemirror.net/5/demo/theme.html#blackboard).
+*   More control over drag/drop with [`dragDrop`](https://codemirror.net/5/doc/manual.html#option_dragDrop) and [`onDragEvent`](https://codemirror.net/5/doc/manual.html#option_onDragEvent) options.
+*   Make HTML mode a bit less pedantic.
+*   Add [`compoundChange`](https://codemirror.net/5/doc/manual.html#compoundChange) API method.
+*   Several fixes in undo history and line hiding.
+*   Remove (broken) support for `catchall` in key maps, add `nofallthrough` boolean field instead.
+
+## 2.23.0 (2012-03-26)
+
+*   Change **default binding for tab**. Starting in 2.23, these bindings are default:
+    *   Tab: Insert tab character
+    *   Shift-tab: Reset line indentation to default
+    *   Ctrl/Cmd-[: Reduce line indentation (old tab behaviour)
+    *   Ctrl/Cmd-]: Increase line indentation (old shift-tab behaviour)
+*   New modes: [XQuery](https://codemirror.net/5/mode/xquery/index.html) and [VBScript](https://codemirror.net/5/mode/vbscript/index.html).
+*   Two new themes: [lesser-dark](https://codemirror.net/5/mode/less/index.html) and [xq-dark](https://codemirror.net/5/mode/xquery/index.html).
+*   Differentiate between background and text styles in [`setLineClass`](https://codemirror.net/5/doc/manual.html#setLineClass).
+*   Fix drag-and-drop in IE9+.
+*   Extend [`charCoords`](https://codemirror.net/5/doc/manual.html#charCoords) and [`cursorCoords`](https://codemirror.net/5/doc/manual.html#cursorCoords) with a `mode` argument.
+*   Add [`autofocus`](https://codemirror.net/5/doc/manual.html#option_autofocus) option.
+*   Add [`findMarksAt`](https://codemirror.net/5/doc/manual.html#findMarksAt) method.
+
+## 2.22.0 (2012-02-27)
+
+*   Allow [key handlers](https://codemirror.net/5/doc/manual.html#keymaps) to pass up events, allow binding characters.
+*   Add [`autoClearEmptyLines`](https://codemirror.net/5/doc/manual.html#option_autoClearEmptyLines) option.
+*   Properly use tab stops when rendering tabs.
+*   Make PHP mode more robust.
+*   Support indentation blocks in [code folder](https://codemirror.net/5/doc/manual.html#addon_foldcode).
+*   Add a script for [highlighting instances of the selection](https://codemirror.net/5/doc/manual.html#addon_match-highlighter).
+*   New [.properties](https://codemirror.net/5/mode/properties/index.html) mode.
+*   Fix many bugs.
+
+## 2.21.0 (2012-01-27)
+
+*   Added [LESS](https://codemirror.net/5/mode/less/index.html), [MySQL](https://codemirror.net/5/mode/mysql/index.html), [Go](https://codemirror.net/5/mode/go/index.html), and [Verilog](https://codemirror.net/5/mode/verilog/index.html) modes.
+*   Add [`smartIndent`](https://codemirror.net/5/doc/manual.html#option_smartIndent) option.
+*   Support a cursor in [`readOnly`](https://codemirror.net/5/doc/manual.html#option_readOnly)-mode.
+*   Support assigning multiple styles to a token.
+*   Use a new approach to drawing the selection.
+*   Add [`scrollTo`](https://codemirror.net/5/doc/manual.html#scrollTo) method.
+*   Allow undo/redo events to span non-adjacent lines.
+*   Lots and lots of bugfixes.
+
+## 2.20.0 (2011-12-20)
+
+*   Slightly incompatible API changes. Read [this](https://codemirror.net/5/doc/upgrade_v2.2.html).
+*   New approach to [binding](https://codemirror.net/5/doc/manual.html#option_extraKeys) keys, support for [custom bindings](https://codemirror.net/5/doc/manual.html#option_keyMap).
+*   Support for overwrite (insert).
+*   [Custom-width](https://codemirror.net/5/doc/manual.html#option_tabSize) and [styleable](https://codemirror.net/5/demo/visibletabs.html) tabs.
+*   Moved more code into [add-on scripts](https://codemirror.net/5/doc/manual.html#addons).
+*   Support for sane vertical cursor movement in wrapped lines.
+*   More reliable handling of editing [marked text](https://codemirror.net/5/doc/manual.html#markText).
+*   Add minimal [emacs](https://codemirror.net/5/demo/emacs.html) and [vim](https://codemirror.net/5/demo/vim.html) bindings.
+*   Rename `coordsFromIndex` to [`posFromIndex`](https://codemirror.net/5/doc/manual.html#posFromIndex), add [`indexFromPos`](https://codemirror.net/5/doc/manual.html#indexFromPos) method.
+
+## 2.18.0 (2011-11-21)
+
+Fixes `TextMarker.clear`, which is broken in 2.17.
+
+## 2.17.0 (2011-11-21)
+
+*   Add support for [line wrapping](https://codemirror.net/5/doc/manual.html#option_lineWrapping) and [code folding](https://codemirror.net/5/doc/manual.html#hideLine).
+*   Add [GitHub-style Markdown](https://codemirror.net/5/mode/gfm/index.html) mode.
+*   Add [Monokai](https://codemirror.net/5/theme/monokai.css) and [Rubyblue](https://codemirror.net/5/theme/rubyblue.css) themes.
+*   Add [`setBookmark`](https://codemirror.net/5/doc/manual.html#setBookmark) method.
+*   Move some of the demo code into reusable components under [`lib/util`](https://codemirror.net/5/addon/).
+*   Make screen-coord-finding code faster and more reliable.
+*   Fix drag-and-drop in Firefox.
+*   Improve support for IME.
+*   Speed up content rendering.
+*   Fix browser's built-in search in Webkit.
+*   Make double- and triple-click work in IE.
+*   Various fixes to modes.
+
+## 2.16.0 (2011-10-27)
+
+*   Add [Perl](https://codemirror.net/5/mode/perl/index.html), [Rust](https://codemirror.net/5/mode/rust/index.html), [TiddlyWiki](https://codemirror.net/5/mode/tiddlywiki/index.html), and [Groovy](https://codemirror.net/5/mode/groovy/index.html) modes.
+*   Dragging text inside the editor now moves, rather than copies.
+*   Add a [`coordsFromIndex`](https://codemirror.net/5/doc/manual.html#coordsFromIndex) method.
+*   **API change**: `setValue` now no longer clears history. Use [`clearHistory`](https://codemirror.net/5/doc/manual.html#clearHistory) for that.
+*   **API change**: [`markText`](https://codemirror.net/5/doc/manual.html#markText) now returns an object with `clear` and `find` methods. Marked text is now more robust when edited.
+*   Fix editing code with tabs in Internet Explorer.
+
+## 2.15.0 (2011-09-26)
+
+Fix bug that snuck into 2.14: Clicking the character that currently has the cursor didn't re-focus the editor.
+
+## 2.14.0 (2011-09-26)
+
+*   Add [Clojure](https://codemirror.net/5/mode/clojure/index.html), [Pascal](https://codemirror.net/5/mode/pascal/index.html), [NTriples](https://codemirror.net/5/mode/ntriples/index.html), [Jinja2](https://codemirror.net/5/mode/jinja2/index.html), and [Markdown](https://codemirror.net/5/mode/markdown/index.html) modes.
+*   Add [Cobalt](https://codemirror.net/5/theme/cobalt.css) and [Eclipse](https://codemirror.net/5/theme/eclipse.css) themes.
+*   Add a [`fixedGutter`](https://codemirror.net/5/doc/manual.html#option_fixedGutter) option.
+*   Fix bug with `setValue` breaking cursor movement.
+*   Make gutter updates much more efficient.
+*   Allow dragging of text out of the editor (on modern browsers).
+
+## 2.13.0 (2011-08-23)
+
+*   Add [Ruby](https://codemirror.net/5/mode/ruby/index.html), [R](https://codemirror.net/5/mode/r/index.html), [CoffeeScript](https://codemirror.net/5/mode/coffeescript/index.html), and [Velocity](https://codemirror.net/5/mode/velocity/index.html) modes.
+*   Add [`getGutterElement`](https://codemirror.net/5/doc/manual.html#getGutterElement) to API.
+*   Several fixes to scrolling and positioning.
+*   Add [`smartHome`](https://codemirror.net/5/doc/manual.html#option_smartHome) option.
+*   Add an experimental [pure XML](https://codemirror.net/5/mode/xmlpure/index.html) mode.
+
+## 2.12.0 (2011-07-25)
+
+*   Add a [SPARQL](https://codemirror.net/5/mode/sparql/index.html) mode.
+*   Fix bug with cursor jumping around in an unfocused editor in IE.
+*   Allow key and mouse events to bubble out of the editor. Ignore widget clicks.
+*   Solve cursor flakiness after undo/redo.
+*   Fix block-reindent ignoring the last few lines.
+*   Fix parsing of multi-line attrs in XML mode.
+*   Use `innerHTML` for HTML-escaping.
+*   Some fixes to indentation in C-like mode.
+*   Shrink horiz scrollbars when long lines removed.
+*   Fix width feedback loop bug that caused the width of an inner DIV to shrink.
+
+## 2.11.0 (2011-07-04)
+
+*   Add a [Scheme mode](https://codemirror.net/5/mode/scheme/index.html).
+*   Add a `replace` method to search cursors, for cursor-preserving replacements.
+*   Make the [C-like mode](https://codemirror.net/5/mode/clike/index.html) mode more customizable.
+*   Update XML mode to spot mismatched tags.
+*   Add `getStateAfter` API and `compareState` mode API methods for finer-grained mode magic.
+*   Add a `getScrollerElement` API method to manipulate the scrolling DIV.
+*   Fix drag-and-drop for Firefox.
+*   Add a C# configuration for the [C-like mode](https://codemirror.net/5/mode/clike/index.html).
+*   Add [full-screen editing](https://codemirror.net/5/demo/fullscreen.html) and [mode-changing](https://codemirror.net/5/demo/changemode.html) demos.
+
+## 2.10.0 (2011-06-07)
+
+Add a [theme](https://codemirror.net/5/doc/manual.html#option_theme) system ([demo](https://codemirror.net/5/demo/theme.html)). Note that this is not backwards-compatible—you'll have to update your styles and modes!
+
+## 2.2.0 (2011-06-07)
+
+*   Add a [Lua mode](https://codemirror.net/5/mode/lua/index.html).
+*   Fix reverse-searching for a regexp.
+*   Empty lines can no longer break highlighting.
+*   Rework scrolling model (the outer wrapper no longer does the scrolling).
+*   Solve horizontal jittering on long lines.
+*   Add [runmode.js](https://codemirror.net/5/demo/runmode.html).
+*   Immediately re-highlight text when typing.
+*   Fix problem with 'sticking' horizontal scrollbar.
+
+## 2.1.0 (2011-05-26)
+
+*   Add a [Smalltalk mode](https://codemirror.net/5/mode/smalltalk/index.html).
+*   Add a [reStructuredText mode](https://codemirror.net/5/mode/rst/index.html).
+*   Add a [Python mode](https://codemirror.net/5/mode/python/index.html).
+*   Add a [PL/SQL mode](https://codemirror.net/5/mode/plsql/index.html).
+*   `coordsChar` now works
+*   Fix a problem where `onCursorActivity` interfered with `onChange`.
+*   Fix a number of scrolling and mouse-click-position glitches.
+*   Pass information about the changed lines to `onChange`.
+*   Support cmd-up/down on OS X.
+*   Add triple-click line selection.
+*   Don't handle shift when changing the selection through the API.
+*   Support `"nocursor"` mode for `readOnly` option.
+*   Add an `onHighlightComplete` option.
+*   Fix the context menu for Firefox.
+
+## 2.0.0 (2011-03-28)
+
+CodeMirror 2 is a complete rewrite that's faster, smaller, simpler to use, and less dependent on browser quirks. See [this](https://codemirror.net/5/doc/internals.html) and [this](http://groups.google.com/group/codemirror/browse_thread/thread/5a8e894024a9f580) for more information.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/CONTRIBUTING.md	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,92 @@
+# How to contribute
+
+- [Getting help](#getting-help)
+- [Submitting bug reports](#submitting-bug-reports)
+- [Contributing code](#contributing-code)
+
+## Getting help
+
+Community discussion, questions, and informal bug reporting is done on the
+[discuss.CodeMirror forum](http://discuss.codemirror.net).
+
+## Submitting bug reports
+
+The preferred way to report bugs is to use the
+[GitHub issue tracker](http://github.com/codemirror/CodeMirror/issues). Before
+reporting a bug, read these pointers.
+
+**Note:** The issue tracker is for *bugs*, not requests for help. Questions
+should be asked on the
+[discuss.CodeMirror forum](http://discuss.codemirror.net) instead.
+
+### Reporting bugs effectively
+
+- CodeMirror is maintained by volunteers. They don't owe you anything, so be
+  polite. Reports with an indignant or belligerent tone tend to be moved to the
+  bottom of the pile.
+
+- Include information about **the browser in which the problem occurred**. Even
+  if you tested several browsers, and the problem occurred in all of them,
+  mention this fact in the bug report. Also include browser version numbers and
+  the operating system that you're on.
+
+- Mention which release of CodeMirror you're using. Preferably, try also with
+  the current development snapshot, to ensure the problem has not already been
+  fixed.
+
+- Mention very precisely what went wrong. "X is broken" is not a good bug
+  report. What did you expect to happen? What happened instead? Describe the
+  exact steps a maintainer has to take to make the problem occur. We can not
+  fix something that we can not observe.
+
+- If the problem can not be reproduced in any of the demos included in the
+  CodeMirror distribution, please provide an HTML document that demonstrates
+  the problem. The best way to do this is to go to
+  [jsbin.com](http://jsbin.com/ihunin/edit), enter it there, press save, and
+  include the resulting link in your bug report.
+
+## Contributing code
+
+Note that we are not accepting any new addons or modes into the main
+distribution. If you've written such a module, please distribute it as
+a separate NPM package.
+
+- Make sure you have a [GitHub Account](https://github.com/signup/free)
+- Fork [CodeMirror](https://github.com/codemirror/CodeMirror/)
+  ([how to fork a repo](https://help.github.com/articles/fork-a-repo))
+- Make your changes
+- If your changes are easy to test or likely to regress, add tests.
+  Tests for the core go into `test/test.js`, some modes have their own
+  test suite under `mode/XXX/test.js`. Feel free to add new test
+  suites to modes that don't have one yet (be sure to link the new
+  tests into `test/index.html`).
+- Follow the general code style of the rest of the project (see
+  below). Run `bin/lint` to verify that the linter is happy.
+- Make sure all tests pass. Visit `test/index.html` in your browser to
+  run them.
+- Submit a pull request
+([how to create a pull request](https://help.github.com/articles/fork-a-repo)).
+  Don't put more than one feature/fix in a single pull request.
+
+By contributing code to CodeMirror you
+
+ - agree to license the contributed code under CodeMirror's [MIT
+   license](https://codemirror.net/5/LICENSE).
+
+ - confirm that you have the right to contribute and license the code
+   in question. (Either you hold all rights on the code, or the rights
+   holder has explicitly granted the right to use it like this,
+   through a compatible open source license or through a direct
+   agreement with you.)
+
+### Coding standards
+
+- 2 spaces per indentation level, no tabs.
+
+- Note that the linter (`bin/lint`) which is run after each commit
+  complains about unused variables and functions. Prefix their names
+  with an underscore to muffle it.
+
+- CodeMirror does *not* follow JSHint or JSLint prescribed style.
+  Patches that try to 'fix' code to pass one of these linters will be
+  unceremoniously discarded.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/LICENSE	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (C) 2017 by Marijn Haverbeke <marijn@haverbeke.berlin> and others
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/README.md	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+# CodeMirror 5
+
+**NOTE:** [CodeMirror 6](https://codemirror.net/) exists, and is more mobile-friendly, more accessible, better designed, and much more actively maintained.
+
+[![Build Status](https://github.com/codemirror/codemirror5/workflows/main/badge.svg)](https://github.com/codemirror/codemirror5/actions)
+
+CodeMirror is a versatile text editor implemented in JavaScript for
+the browser. It is specialized for editing code, and comes with over
+100 language modes and various addons that implement more advanced
+editing functionality. Every language comes with fully-featured code
+and syntax highlighting to help with reading and editing complex code.
+
+A rich programming API and a CSS theming system are available for
+customizing CodeMirror to fit your application, and extending it with
+new functionality.
+
+You can find more information (and the
+[manual](https://codemirror.net/5/doc/manual.html)) on the [project
+page](https://codemirror.net/5/). For questions and discussion, use the
+[discussion forum](https://discuss.codemirror.net/).
+
+See
+[CONTRIBUTING.md](https://github.com/codemirror/CodeMirror/blob/master/CONTRIBUTING.md)
+for contributing guidelines.
+
+The CodeMirror community aims to be welcoming to everybody. We use the
+[Contributor Covenant
+(1.1)](http://contributor-covenant.org/version/1/1/0/) as our code of
+conduct.
+
+### Installation
+
+Either get the [zip file](https://codemirror.net/5/codemirror.zip) with
+the latest version, or make sure you have [Node](https://nodejs.org/)
+installed and run:
+
+    npm install codemirror@5
+
+**NOTE**: This is the source repository for the library, and not the
+distribution channel. Cloning it is not the recommended way to install
+the library, and will in fact not work unless you also run the build
+step.
+
+### Quickstart
+
+To build the project, make sure you have Node.js installed (at least version 6)
+and then `npm install`. To run, just open `index.html` in your
+browser (you don't need to run a webserver). Run the tests with `npm test`.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/comment/comment.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,211 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var noOptions = {};
+  var nonWS = /[^\s\u00a0]/;
+  var Pos = CodeMirror.Pos, cmp = CodeMirror.cmpPos;
+
+  function firstNonWS(str) {
+    var found = str.search(nonWS);
+    return found == -1 ? 0 : found;
+  }
+
+  CodeMirror.commands.toggleComment = function(cm) {
+    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, options)) mode = "un";
+        else { cm.lineComment(from, to, options); mode = "line"; }
+      } else if (mode == "un") {
+        cm.uncomment(from, to, options);
+      } else {
+        cm.lineComment(from, to, options);
+      }
+    }
+  });
+
+  // Rough heuristic to try and detect lines that are part of multi-line string
+  function probablyInsideString(cm, pos, line) {
+    return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
+  }
+
+  function getMode(cm, pos) {
+    var mode = cm.getMode()
+    return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
+  }
+
+  CodeMirror.defineExtension("lineComment", function(from, to, options) {
+    if (!options) options = noOptions;
+    var self = this, mode = getMode(self, from);
+    var firstLine = self.getLine(from.line);
+    if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
+
+    var commentString = options.lineComment || mode.lineComment;
+    if (!commentString) {
+      if (options.blockCommentStart || mode.blockCommentStart) {
+        options.fullLines = true;
+        self.blockComment(from, to, options);
+      }
+      return;
+    }
+
+    var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
+    var pad = options.padding == null ? " " : options.padding;
+    var blankLines = options.commentBlankLines || from.line == to.line;
+
+    self.operation(function() {
+      if (options.indent) {
+        var baseString = null;
+        for (var i = from.line; i < end; ++i) {
+          var line = self.getLine(i);
+          var whitespace = line.search(nonWS) === -1 ? line : 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;
+          if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
+          self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
+        }
+      } else {
+        for (var i = from.line; i < end; ++i) {
+          if (blankLines || nonWS.test(self.getLine(i)))
+            self.replaceRange(commentString + pad, Pos(i, 0));
+        }
+      }
+    });
+  });
+
+  CodeMirror.defineExtension("blockComment", function(from, to, options) {
+    if (!options) options = noOptions;
+    var self = this, mode = getMode(self, from);
+    var startString = options.blockCommentStart || mode.blockCommentStart;
+    var endString = options.blockCommentEnd || mode.blockCommentEnd;
+    if (!startString || !endString) {
+      if ((options.lineComment || mode.lineComment) && options.fullLines != false)
+        self.lineComment(from, to, options);
+      return;
+    }
+    if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
+
+    var end = Math.min(to.line, self.lastLine());
+    if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
+
+    var pad = options.padding == null ? " " : options.padding;
+    if (from.line > end) return;
+
+    self.operation(function() {
+      if (options.fullLines != false) {
+        var lastLineHasText = nonWS.test(self.getLine(end));
+        self.replaceRange(pad + endString, Pos(end));
+        self.replaceRange(startString + pad, Pos(from.line, 0));
+        var lead = options.blockCommentLead || mode.blockCommentLead;
+        if (lead != null) for (var i = from.line + 1; i <= end; ++i)
+          if (i != end || lastLineHasText)
+            self.replaceRange(lead + pad, Pos(i, 0));
+      } else {
+        var atCursor = cmp(self.getCursor("to"), to) == 0, empty = !self.somethingSelected()
+        self.replaceRange(endString, to);
+        if (atCursor) self.setSelection(empty ? to : self.getCursor("from"), to)
+        self.replaceRange(startString, from);
+      }
+    });
+  });
+
+  CodeMirror.defineExtension("uncomment", function(from, to, options) {
+    if (!options) options = noOptions;
+    var self = this, mode = getMode(self, from);
+    var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
+
+    // Try finding line comments
+    var lineString = options.lineComment || mode.lineComment, lines = [];
+    var pad = options.padding == null ? " " : options.padding, didSomething;
+    lineComment: {
+      if (!lineString) break lineComment;
+      for (var i = start; i <= end; ++i) {
+        var line = self.getLine(i);
+        var found = line.indexOf(lineString);
+        if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
+        if (found == -1 && nonWS.test(line)) break lineComment;
+        if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
+        lines.push(line);
+      }
+      self.operation(function() {
+        for (var i = start; i <= end; ++i) {
+          var line = lines[i - start];
+          var pos = line.indexOf(lineString), endPos = pos + lineString.length;
+          if (pos < 0) continue;
+          if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
+          didSomething = true;
+          self.replaceRange("", Pos(i, pos), Pos(i, endPos));
+        }
+      });
+      if (didSomething) return true;
+    }
+
+    // Try block comments
+    var startString = options.blockCommentStart || mode.blockCommentStart;
+    var endString = options.blockCommentEnd || mode.blockCommentEnd;
+    if (!startString || !endString) return false;
+    var lead = options.blockCommentLead || mode.blockCommentLead;
+    var startLine = self.getLine(start), open = startLine.indexOf(startString)
+    if (open == -1) return false
+    var endLine = end == start ? startLine : self.getLine(end)
+    var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
+    var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
+    if (close == -1 ||
+        !/comment/.test(self.getTokenTypeAt(insideStart)) ||
+        !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
+        self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
+      return false;
+
+    // Avoid killing block comments completely outside the selection.
+    // Positions of the last startString before the start of the selection, and the first endString after it.
+    var lastStart = startLine.lastIndexOf(startString, from.ch);
+    var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
+    if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
+    // Positions of the first endString after the end of the selection, and the last startString before it.
+    firstEnd = endLine.indexOf(endString, to.ch);
+    var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
+    lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
+    if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
+
+    self.operation(function() {
+      self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
+                        Pos(end, close + endString.length));
+      var openEnd = open + startString.length;
+      if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
+      self.replaceRange("", Pos(start, open), Pos(start, openEnd));
+      if (lead) for (var i = start + 1; i <= end; ++i) {
+        var line = self.getLine(i), found = line.indexOf(lead);
+        if (found == -1 || nonWS.test(line.slice(0, found))) continue;
+        var foundEnd = found + lead.length;
+        if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
+        self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
+      }
+    });
+    return true;
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/comment/continuecomment.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,114 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  var nonspace = /\S/g;
+  var repeat = String.prototype.repeat || function (n) { return Array(n + 1).join(this); };
+  function continueComment(cm) {
+    if (cm.getOption("disableInput")) return CodeMirror.Pass;
+    var ranges = cm.listSelections(), mode, inserts = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var pos = ranges[i].head
+      if (!/\bcomment\b/.test(cm.getTokenTypeAt(pos))) return CodeMirror.Pass;
+      var modeHere = cm.getModeAt(pos)
+      if (!mode) mode = modeHere;
+      else if (mode != modeHere) return CodeMirror.Pass;
+
+      var insert = null, line, found;
+      var blockStart = mode.blockCommentStart, lineCmt = mode.lineComment;
+      if (blockStart && mode.blockCommentContinue) {
+        line = cm.getLine(pos.line);
+        var end = line.lastIndexOf(mode.blockCommentEnd, pos.ch - mode.blockCommentEnd.length);
+        // 1. if this block comment ended
+        // 2. if this is actually inside a line comment
+        if (end != -1 && end == pos.ch - mode.blockCommentEnd.length ||
+            lineCmt && (found = line.lastIndexOf(lineCmt, pos.ch - 1)) > -1 &&
+            /\bcomment\b/.test(cm.getTokenTypeAt({line: pos.line, ch: found + 1}))) {
+          // ...then don't continue it
+        } else if (pos.ch >= blockStart.length &&
+                   (found = line.lastIndexOf(blockStart, pos.ch - blockStart.length)) > -1 &&
+                   found > end) {
+          // reuse the existing leading spaces/tabs/mixed
+          // or build the correct indent using CM's tab/indent options
+          if (nonspaceAfter(0, line) >= found) {
+            insert = line.slice(0, found);
+          } else {
+            var tabSize = cm.options.tabSize, numTabs;
+            found = CodeMirror.countColumn(line, found, tabSize);
+            insert = !cm.options.indentWithTabs ? repeat.call(" ", found) :
+              repeat.call("\t", (numTabs = Math.floor(found / tabSize))) +
+              repeat.call(" ", found - tabSize * numTabs);
+          }
+        } else if ((found = line.indexOf(mode.blockCommentContinue)) > -1 &&
+                   found <= pos.ch &&
+                   found <= nonspaceAfter(0, line)) {
+          insert = line.slice(0, found);
+        }
+        if (insert != null) insert += mode.blockCommentContinue
+      }
+      if (insert == null && lineCmt && continueLineCommentEnabled(cm)) {
+        if (line == null) line = cm.getLine(pos.line);
+        found = line.indexOf(lineCmt);
+        // cursor at pos 0, line comment also at pos 0 => shift it down, don't continue
+        if (!pos.ch && !found) insert = "";
+        // continue only if the line starts with an optional space + line comment
+        else if (found > -1 && nonspaceAfter(0, line) >= found) {
+          // don't continue if there's only space(s) after cursor or the end of the line
+          insert = nonspaceAfter(pos.ch, line) > -1;
+          // but always continue if the next line starts with a line comment too
+          if (!insert) {
+            var next = cm.getLine(pos.line + 1) || '',
+                nextFound = next.indexOf(lineCmt);
+            insert = nextFound > -1 && nonspaceAfter(0, next) >= nextFound || null;
+          }
+          if (insert) {
+            insert = line.slice(0, found) + lineCmt +
+                     line.slice(found + lineCmt.length).match(/^\s*/)[0];
+          }
+        }
+      }
+      if (insert == null) return CodeMirror.Pass;
+      inserts[i] = "\n" + insert;
+    }
+
+    cm.operation(function() {
+      for (var i = ranges.length - 1; i >= 0; i--)
+        cm.replaceRange(inserts[i], ranges[i].from(), ranges[i].to(), "+insert");
+    });
+  }
+
+  function nonspaceAfter(ch, str) {
+    nonspace.lastIndex = ch;
+    var m = nonspace.exec(str);
+    return m ? m.index : -1;
+  }
+
+  function continueLineCommentEnabled(cm) {
+    var opt = cm.getOption("continueComments");
+    if (opt && typeof opt == "object")
+      return opt.continueLineComment !== false;
+    return true;
+  }
+
+  CodeMirror.defineOption("continueComments", null, function(cm, val, prev) {
+    if (prev && prev != CodeMirror.Init)
+      cm.removeKeyMap("continueComment");
+    if (val) {
+      var key = "Enter";
+      if (typeof val == "string")
+        key = val;
+      else if (typeof val == "object" && val.key)
+        key = val.key;
+      var map = {name: "continueComment"};
+      map[key] = continueComment;
+      cm.addKeyMap(map);
+    }
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/dialog/dialog.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,32 @@
+.CodeMirror-dialog {
+  position: absolute;
+  left: 0; right: 0;
+  background: inherit;
+  z-index: 15;
+  padding: .1em .8em;
+  overflow: hidden;
+  color: inherit;
+}
+
+.CodeMirror-dialog-top {
+  border-bottom: 1px solid #eee;
+  top: 0;
+}
+
+.CodeMirror-dialog-bottom {
+  border-top: 1px solid #eee;
+  bottom: 0;
+}
+
+.CodeMirror-dialog input {
+  border: none;
+  outline: none;
+  background: transparent;
+  width: 20em;
+  color: inherit;
+  font-family: monospace;
+}
+
+.CodeMirror-dialog button {
+  font-size: 70%;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/dialog/dialog.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,163 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Open simple dialogs on top of an editor. Relies on dialog.css.
+
+(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) {
+  function dialogDiv(cm, template, bottom) {
+    var wrap = cm.getWrapperElement();
+    var dialog;
+    dialog = wrap.appendChild(document.createElement("div"));
+    if (bottom)
+      dialog.className = "CodeMirror-dialog CodeMirror-dialog-bottom";
+    else
+      dialog.className = "CodeMirror-dialog CodeMirror-dialog-top";
+
+    if (typeof template == "string") {
+      dialog.innerHTML = template;
+    } else { // Assuming it's a detached DOM element.
+      dialog.appendChild(template);
+    }
+    CodeMirror.addClass(wrap, 'dialog-opened');
+    return dialog;
+  }
+
+  function closeNotification(cm, newVal) {
+    if (cm.state.currentNotificationClose)
+      cm.state.currentNotificationClose();
+    cm.state.currentNotificationClose = newVal;
+  }
+
+  CodeMirror.defineExtension("openDialog", function(template, callback, options) {
+    if (!options) options = {};
+
+    closeNotification(this, null);
+
+    var dialog = dialogDiv(this, template, options.bottom);
+    var closed = false, me = this;
+    function close(newVal) {
+      if (typeof newVal == 'string') {
+        inp.value = newVal;
+      } else {
+        if (closed) return;
+        closed = true;
+        CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
+        dialog.parentNode.removeChild(dialog);
+        me.focus();
+
+        if (options.onClose) options.onClose(dialog);
+      }
+    }
+
+    var inp = dialog.getElementsByTagName("input")[0], button;
+    if (inp) {
+      inp.focus();
+
+      if (options.value) {
+        inp.value = options.value;
+        if (options.selectValueOnOpen !== false) {
+          inp.select();
+        }
+      }
+
+      if (options.onInput)
+        CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);});
+      if (options.onKeyUp)
+        CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);});
+
+      CodeMirror.on(inp, "keydown", function(e) {
+        if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; }
+        if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) {
+          inp.blur();
+          CodeMirror.e_stop(e);
+          close();
+        }
+        if (e.keyCode == 13) callback(inp.value, e);
+      });
+
+      if (options.closeOnBlur !== false) CodeMirror.on(dialog, "focusout", function (evt) {
+        if (evt.relatedTarget !== null) close();
+      });
+    } else if (button = dialog.getElementsByTagName("button")[0]) {
+      CodeMirror.on(button, "click", function() {
+        close();
+        me.focus();
+      });
+
+      if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close);
+
+      button.focus();
+    }
+    return close;
+  });
+
+  CodeMirror.defineExtension("openConfirm", function(template, callbacks, options) {
+    closeNotification(this, null);
+    var dialog = dialogDiv(this, template, options && options.bottom);
+    var buttons = dialog.getElementsByTagName("button");
+    var closed = false, me = this, blurring = 1;
+    function close() {
+      if (closed) return;
+      closed = true;
+      CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
+      dialog.parentNode.removeChild(dialog);
+      me.focus();
+    }
+    buttons[0].focus();
+    for (var i = 0; i < buttons.length; ++i) {
+      var b = buttons[i];
+      (function(callback) {
+        CodeMirror.on(b, "click", function(e) {
+          CodeMirror.e_preventDefault(e);
+          close();
+          if (callback) callback(me);
+        });
+      })(callbacks[i]);
+      CodeMirror.on(b, "blur", function() {
+        --blurring;
+        setTimeout(function() { if (blurring <= 0) close(); }, 200);
+      });
+      CodeMirror.on(b, "focus", function() { ++blurring; });
+    }
+  });
+
+  /*
+   * openNotification
+   * Opens a notification, that can be closed with an optional timer
+   * (default 5000ms timer) and always closes on click.
+   *
+   * If a notification is opened while another is opened, it will close the
+   * currently opened one and open the new one immediately.
+   */
+  CodeMirror.defineExtension("openNotification", function(template, options) {
+    closeNotification(this, close);
+    var dialog = dialogDiv(this, template, options && options.bottom);
+    var closed = false, doneTimer;
+    var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000;
+
+    function close() {
+      if (closed) return;
+      closed = true;
+      clearTimeout(doneTimer);
+      CodeMirror.rmClass(dialog.parentNode, 'dialog-opened');
+      dialog.parentNode.removeChild(dialog);
+    }
+
+    CodeMirror.on(dialog, 'click', function(e) {
+      CodeMirror.e_preventDefault(e);
+      close();
+    });
+
+    if (duration)
+      doneTimer = setTimeout(close, duration);
+
+    return close;
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/display/autorefresh.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,47 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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)
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/display/fullscreen.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,6 @@
+.CodeMirror-fullscreen {
+  position: fixed;
+  top: 0; left: 0; right: 0; bottom: 0;
+  height: auto;
+  z-index: 9;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/display/fullscreen.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,41 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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("fullScreen", false, function(cm, val, old) {
+    if (old == CodeMirror.Init) old = false;
+    if (!old == !val) return;
+    if (val) setFullscreen(cm);
+    else setNormal(cm);
+  });
+
+  function setFullscreen(cm) {
+    var wrap = cm.getWrapperElement();
+    cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset,
+                                  width: wrap.style.width, height: wrap.style.height};
+    wrap.style.width = "";
+    wrap.style.height = "auto";
+    wrap.className += " CodeMirror-fullscreen";
+    document.documentElement.style.overflow = "hidden";
+    cm.refresh();
+  }
+
+  function setNormal(cm) {
+    var wrap = cm.getWrapperElement();
+    wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, "");
+    document.documentElement.style.overflow = "";
+    var info = cm.state.fullScreenRestore;
+    wrap.style.width = info.width; wrap.style.height = info.height;
+    window.scrollTo(info.scrollLeft, info.scrollTop);
+    cm.refresh();
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/display/panel.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,133 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  CodeMirror.defineExtension("addPanel", function (node, options) {
+    options = options || {};
+
+    if (!this.state.panels) initPanels(this);
+
+    var info = this.state.panels;
+    var wrapper = info.wrapper;
+    var cmWrapper = this.getWrapperElement();
+    var replace = options.replace instanceof Panel && !options.replace.cleared;
+
+    if (options.after instanceof Panel && !options.after.cleared) {
+      wrapper.insertBefore(node, options.before.node.nextSibling);
+    } else if (options.before instanceof Panel && !options.before.cleared) {
+      wrapper.insertBefore(node, options.before.node);
+    } else if (replace) {
+      wrapper.insertBefore(node, options.replace.node);
+      options.replace.clear(true);
+    } else if (options.position == "bottom") {
+      wrapper.appendChild(node);
+    } else if (options.position == "before-bottom") {
+      wrapper.insertBefore(node, cmWrapper.nextSibling);
+    } else if (options.position == "after-top") {
+      wrapper.insertBefore(node, cmWrapper);
+    } else {
+      wrapper.insertBefore(node, wrapper.firstChild);
+    }
+
+    var height = (options && options.height) || node.offsetHeight;
+
+    var panel = new Panel(this, node, options, height);
+    info.panels.push(panel);
+
+    this.setSize();
+    if (options.stable && isAtTop(this, node))
+      this.scrollTo(null, this.getScrollInfo().top + height);
+
+    return panel;
+  });
+
+  function Panel(cm, node, options, height) {
+    this.cm = cm;
+    this.node = node;
+    this.options = options;
+    this.height = height;
+    this.cleared = false;
+  }
+
+  /* when skipRemove is true, clear() was called from addPanel().
+   * Thus removePanels() should not be called (issue 5518) */
+  Panel.prototype.clear = function (skipRemove) {
+    if (this.cleared) return;
+    this.cleared = true;
+    var info = this.cm.state.panels;
+    info.panels.splice(info.panels.indexOf(this), 1);
+    this.cm.setSize();
+    if (this.options.stable && isAtTop(this.cm, this.node))
+      this.cm.scrollTo(null, this.cm.getScrollInfo().top - this.height)
+    info.wrapper.removeChild(this.node);
+    if (info.panels.length == 0 && !skipRemove) removePanels(this.cm);
+  };
+
+  Panel.prototype.changed = function () {
+    this.height = this.node.getBoundingClientRect().height;
+    this.cm.setSize();
+  };
+
+  function initPanels(cm) {
+    var wrap = cm.getWrapperElement()
+    var style = window.getComputedStyle ? window.getComputedStyle(wrap) : wrap.currentStyle;
+    var height = parseInt(style.height);
+    var info = cm.state.panels = {
+      setHeight: wrap.style.height,
+      panels: [],
+      wrapper: document.createElement("div")
+    };
+    var hasFocus = cm.hasFocus(), scrollPos = cm.getScrollInfo()
+    wrap.parentNode.insertBefore(info.wrapper, wrap);
+    info.wrapper.appendChild(wrap);
+    cm.scrollTo(scrollPos.left, scrollPos.top)
+    if (hasFocus) cm.focus();
+
+    cm._setSize = cm.setSize;
+    if (height != null) cm.setSize = function (width, newHeight) {
+      if (!newHeight) newHeight = info.wrapper.offsetHeight;
+      info.setHeight = newHeight;
+      if (typeof newHeight != "number") {
+        var px = /^(\d+\.?\d*)px$/.exec(newHeight);
+        if (px) {
+          newHeight = Number(px[1]);
+        } else {
+          info.wrapper.style.height = newHeight;
+          newHeight = info.wrapper.offsetHeight;
+        }
+      }
+      var editorheight = newHeight - info.panels
+        .map(function (p) { return p.node.getBoundingClientRect().height; })
+        .reduce(function (a, b) { return a + b; }, 0);
+      cm._setSize(width, editorheight);
+      height = newHeight;
+    };
+  }
+
+  function removePanels(cm) {
+    var info = cm.state.panels;
+    cm.state.panels = null;
+
+    var wrap = cm.getWrapperElement()
+    var hasFocus = cm.hasFocus(), scrollPos = cm.getScrollInfo()
+    info.wrapper.parentNode.replaceChild(wrap, info.wrapper);
+    cm.scrollTo(scrollPos.left, scrollPos.top)
+    if (hasFocus) cm.focus();
+    wrap.style.height = info.setHeight;
+    cm.setSize = cm._setSize;
+    cm.setSize();
+  }
+
+  function isAtTop(cm, dom) {
+    for (var sibling = dom.nextSibling; sibling; sibling = sibling.nextSibling)
+      if (sibling == cm.getWrapperElement()) return true
+    return false
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/display/placeholder.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,78 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  CodeMirror.defineOption("placeholder", "", function(cm, val, old) {
+    var prev = old && old != CodeMirror.Init;
+    if (val && !prev) {
+      cm.on("blur", onBlur);
+      cm.on("change", onChange);
+      cm.on("swapDoc", onChange);
+      CodeMirror.on(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose = function() { onComposition(cm) })
+      onChange(cm);
+    } else if (!val && prev) {
+      cm.off("blur", onBlur);
+      cm.off("change", onChange);
+      cm.off("swapDoc", onChange);
+      CodeMirror.off(cm.getInputField(), "compositionupdate", cm.state.placeholderCompose)
+      clearPlaceholder(cm);
+      var wrapper = cm.getWrapperElement();
+      wrapper.className = wrapper.className.replace(" CodeMirror-empty", "");
+    }
+
+    if (val && !cm.hasFocus()) onBlur(cm);
+  });
+
+  function clearPlaceholder(cm) {
+    if (cm.state.placeholder) {
+      cm.state.placeholder.parentNode.removeChild(cm.state.placeholder);
+      cm.state.placeholder = null;
+    }
+  }
+  function setPlaceholder(cm) {
+    clearPlaceholder(cm);
+    var elt = cm.state.placeholder = document.createElement("pre");
+    elt.style.cssText = "height: 0; overflow: visible";
+    elt.style.direction = cm.getOption("direction");
+    elt.className = "CodeMirror-placeholder CodeMirror-line-like";
+    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);
+  }
+
+  function onComposition(cm) {
+    setTimeout(function() {
+      var empty = false
+      if (cm.lineCount() == 1) {
+        var input = cm.getInputField()
+        empty = input.nodeName == "TEXTAREA" ? !cm.getLine(0).length
+          : !/[^\u200b]/.test(input.querySelector(".CodeMirror-line").textContent)
+      }
+      if (empty) setPlaceholder(cm)
+      else clearPlaceholder(cm)
+    }, 20)
+  }
+
+  function onBlur(cm) {
+    if (isEmpty(cm)) setPlaceholder(cm);
+  }
+  function onChange(cm) {
+    var wrapper = cm.getWrapperElement(), empty = isEmpty(cm);
+    wrapper.className = wrapper.className.replace(" CodeMirror-empty", "") + (empty ? " CodeMirror-empty" : "");
+
+    if (empty) setPlaceholder(cm);
+    else clearPlaceholder(cm);
+  }
+
+  function isEmpty(cm) {
+    return (cm.lineCount() === 1) && (cm.getLine(0) === "");
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/display/rulers.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,51 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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("rulers", false, function(cm, val) {
+    if (cm.state.rulerDiv) {
+      cm.state.rulerDiv.parentElement.removeChild(cm.state.rulerDiv)
+      cm.state.rulerDiv = null
+      cm.off("refresh", drawRulers)
+    }
+    if (val && val.length) {
+      cm.state.rulerDiv = cm.display.lineSpace.parentElement.insertBefore(document.createElement("div"), cm.display.lineSpace)
+      cm.state.rulerDiv.className = "CodeMirror-rulers"
+      drawRulers(cm)
+      cm.on("refresh", drawRulers)
+    }
+  });
+
+  function drawRulers(cm) {
+    cm.state.rulerDiv.textContent = ""
+    var val = cm.getOption("rulers");
+    var cw = cm.defaultCharWidth();
+    var left = cm.charCoords(CodeMirror.Pos(cm.firstLine(), 0), "div").left;
+    cm.state.rulerDiv.style.minHeight = (cm.display.scroller.offsetHeight + 30) + "px";
+    for (var i = 0; i < val.length; i++) {
+      var elt = document.createElement("div");
+      elt.className = "CodeMirror-ruler";
+      var col, conf = val[i];
+      if (typeof conf == "number") {
+        col = conf;
+      } else {
+        col = conf.column;
+        if (conf.className) elt.className += " " + conf.className;
+        if (conf.color) elt.style.borderColor = conf.color;
+        if (conf.lineStyle) elt.style.borderLeftStyle = conf.lineStyle;
+        if (conf.width) elt.style.borderLeftWidth = conf.width;
+      }
+      elt.style.left = (left + col * cw) + "px";
+      cm.state.rulerDiv.appendChild(elt)
+    }
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/edit/closebrackets.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,201 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  var defaults = {
+    pairs: "()[]{}''\"\"",
+    closeBefore: ")]}'\":;>",
+    triples: "",
+    explode: "[]{}"
+  };
+
+  var Pos = CodeMirror.Pos;
+
+  CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      cm.removeKeyMap(keyMap);
+      cm.state.closeBrackets = null;
+    }
+    if (val) {
+      ensureBound(getOption(val, "pairs"))
+      cm.state.closeBrackets = val;
+      cm.addKeyMap(keyMap);
+    }
+  });
+
+  function getOption(conf, name) {
+    if (name == "pairs" && typeof conf == "string") return conf;
+    if (typeof conf == "object" && conf[name] != null) return conf[name];
+    return defaults[name];
+  }
+
+  var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
+  function ensureBound(chars) {
+    for (var i = 0; i < chars.length; i++) {
+      var ch = chars.charAt(i), key = "'" + ch + "'"
+      if (!keyMap[key]) keyMap[key] = handler(ch)
+    }
+  }
+  ensureBound(defaults.pairs + "`")
+
+  function handler(ch) {
+    return function(cm) { return handleChar(cm, ch); };
+  }
+
+  function getConfig(cm) {
+    var deflt = cm.state.closeBrackets;
+    if (!deflt || deflt.override) return deflt;
+    var mode = cm.getModeAt(cm.getCursor());
+    return mode.closeBrackets || deflt;
+  }
+
+  function handleBackspace(cm) {
+    var conf = getConfig(cm);
+    if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
+
+    var pairs = getOption(conf, "pairs");
+    var ranges = cm.listSelections();
+    for (var i = 0; i < ranges.length; i++) {
+      if (!ranges[i].empty()) return CodeMirror.Pass;
+      var around = charsAround(cm, ranges[i].head);
+      if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
+    }
+    for (var i = ranges.length - 1; i >= 0; i--) {
+      var cur = ranges[i].head;
+      cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete");
+    }
+  }
+
+  function handleEnter(cm) {
+    var conf = getConfig(cm);
+    var explode = conf && getOption(conf, "explode");
+    if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
+
+    var ranges = cm.listSelections();
+    for (var i = 0; i < ranges.length; i++) {
+      if (!ranges[i].empty()) return CodeMirror.Pass;
+      var around = charsAround(cm, ranges[i].head);
+      if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
+    }
+    cm.operation(function() {
+      var linesep = cm.lineSeparator() || "\n";
+      cm.replaceSelection(linesep + linesep, null);
+      moveSel(cm, -1)
+      ranges = cm.listSelections();
+      for (var i = 0; i < ranges.length; i++) {
+        var line = ranges[i].head.line;
+        cm.indentLine(line, null, true);
+        cm.indentLine(line + 1, null, true);
+      }
+    });
+  }
+
+  function moveSel(cm, dir) {
+    var newRanges = [], ranges = cm.listSelections(), primary = 0
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i]
+      if (range.head == cm.getCursor()) primary = i
+      var pos = range.head.ch || dir > 0 ? {line: range.head.line, ch: range.head.ch + dir} : {line: range.head.line - 1}
+      newRanges.push({anchor: pos, head: pos})
+    }
+    cm.setSelections(newRanges, primary)
+  }
+
+  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;
+
+    var pairs = getOption(conf, "pairs");
+    var pos = pairs.indexOf(ch);
+    if (pos == -1) return CodeMirror.Pass;
+
+    var closeBefore = getOption(conf,"closeBefore");
+
+    var triples = getOption(conf, "triples");
+
+    var identical = pairs.charAt(pos + 1) == ch;
+    var ranges = cm.listSelections();
+    var opening = pos % 2 == 0;
+
+    var type;
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i], cur = range.head, curType;
+      var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
+      if (opening && !range.empty()) {
+        curType = "surround";
+      } else if ((identical || !opening) && next == ch) {
+        if (identical && stringStartsAfter(cm, cur))
+          curType = "both";
+        else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
+          curType = "skipThree";
+        else
+          curType = "skip";
+      } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
+                 cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch) {
+        if (cur.ch > 2 && /\bstring/.test(cm.getTokenTypeAt(Pos(cur.line, cur.ch - 2)))) return CodeMirror.Pass;
+        curType = "addFour";
+      } else if (identical) {
+        var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
+        if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
+        else return CodeMirror.Pass;
+      } else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) {
+        curType = "both";
+      } else {
+        return CodeMirror.Pass;
+      }
+      if (!type) type = curType;
+      else if (type != curType) return CodeMirror.Pass;
+    }
+
+    var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
+    var right = pos % 2 ? ch : pairs.charAt(pos + 1);
+    cm.operation(function() {
+      if (type == "skip") {
+        moveSel(cm, 1)
+      } else if (type == "skipThree") {
+        moveSel(cm, 3)
+      } else if (type == "surround") {
+        var sels = cm.getSelections();
+        for (var i = 0; i < sels.length; i++)
+          sels[i] = left + sels[i] + right;
+        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);
+        cm.triggerElectric(left + right);
+        moveSel(cm, -1)
+      } else if (type == "addFour") {
+        cm.replaceSelection(left + left + left + left, "before");
+        moveSel(cm, 1)
+      }
+    });
+  }
+
+  function charsAround(cm, pos) {
+    var str = cm.getRange(Pos(pos.line, pos.ch - 1),
+                          Pos(pos.line, pos.ch + 1));
+    return str.length == 2 ? str : null;
+  }
+
+  function stringStartsAfter(cm, pos) {
+    var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1))
+    return /\bstring/.test(token.type) && token.start == pos.ch &&
+      (pos.ch == 0 || !/\bstring/.test(cm.getTokenTypeAt(pos)))
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/edit/closetag.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,185 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Tag-closer extension for CodeMirror.
+ *
+ * This extension adds an "autoCloseTags" option that can be set to
+ * either true to get the default behavior, or an object to further
+ * configure its behavior.
+ *
+ * These are supported options:
+ *
+ * `whenClosing` (default true)
+ *   Whether to autoclose when the '/' of a closing tag is typed.
+ * `whenOpening` (default true)
+ *   Whether to autoclose the tag when the final '>' of an opening
+ *   tag is typed.
+ * `dontCloseTags` (default is empty tags for HTML, none for XML)
+ *   An array of tag names that should not be autoclosed.
+ * `indentTags` (default is block tags for HTML, none for XML)
+ *   An array of tag names that should, when opened, cause a
+ *   blank line to be added inside the tag, and the blank line and
+ *   closing line to be indented.
+ * `emptyTags` (default is none)
+ *   An array of XML tag names that should be autoclosed with '/>'.
+ *
+ * See demos/closetag.html for a usage example.
+ */
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../fold/xml-fold"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  CodeMirror.defineOption("autoCloseTags", false, function(cm, val, old) {
+    if (old != CodeMirror.Init && old)
+      cm.removeKeyMap("autoCloseTags");
+    if (!val) return;
+    var map = {name: "autoCloseTags"};
+    if (typeof val != "object" || val.whenClosing !== false)
+      map["'/'"] = function(cm) { return autoCloseSlash(cm); };
+    if (typeof val != "object" || val.whenOpening !== false)
+      map["'>'"] = function(cm) { return autoCloseGT(cm); };
+    cm.addKeyMap(map);
+  });
+
+  var htmlDontClose = ["area", "base", "br", "col", "command", "embed", "hr", "img", "input", "keygen", "link", "meta", "param",
+                       "source", "track", "wbr"];
+  var htmlIndent = ["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"];
+
+  function autoCloseGT(cm) {
+    if (cm.getOption("disableInput")) return CodeMirror.Pass;
+    var ranges = cm.listSelections(), replacements = [];
+    var opt = cm.getOption("autoCloseTags");
+    for (var i = 0; i < ranges.length; i++) {
+      if (!ranges[i].empty()) return CodeMirror.Pass;
+      var pos = ranges[i].head, tok = cm.getTokenAt(pos);
+      var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
+      var tagInfo = inner.mode.xmlCurrentTag && inner.mode.xmlCurrentTag(state)
+      var tagName = tagInfo && tagInfo.name
+      if (!tagName) return CodeMirror.Pass
+
+      var html = inner.mode.configuration == "html";
+      var dontCloseTags = (typeof opt == "object" && opt.dontCloseTags) || (html && htmlDontClose);
+      var indentTags = (typeof opt == "object" && opt.indentTags) || (html && htmlIndent);
+
+      if (tok.end > pos.ch) tagName = tagName.slice(0, tagName.length - tok.end + pos.ch);
+      var lowerTagName = tagName.toLowerCase();
+      // Don't process the '>' at the end of an end-tag or self-closing tag
+      if (!tagName ||
+          tok.type == "string" && (tok.end != pos.ch || !/[\"\']/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1) ||
+          tok.type == "tag" && tagInfo.close ||
+          tok.string.indexOf("/") == (pos.ch - tok.start - 1) || // match something like <someTagName />
+          dontCloseTags && indexOf(dontCloseTags, lowerTagName) > -1 ||
+          closingTagExists(cm, inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state) || [], tagName, pos, true))
+        return CodeMirror.Pass;
+
+      var emptyTags = typeof opt == "object" && opt.emptyTags;
+      if (emptyTags && indexOf(emptyTags, tagName) > -1) {
+        replacements[i] = { text: "/>", newPos: CodeMirror.Pos(pos.line, pos.ch + 2) };
+        continue;
+      }
+
+      var indent = indentTags && indexOf(indentTags, lowerTagName) > -1;
+      replacements[i] = {indent: indent,
+                         text: ">" + (indent ? "\n\n" : "") + "</" + tagName + ">",
+                         newPos: indent ? CodeMirror.Pos(pos.line + 1, 0) : CodeMirror.Pos(pos.line, pos.ch + 1)};
+    }
+
+    var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnAutoClose);
+    for (var i = ranges.length - 1; i >= 0; i--) {
+      var info = replacements[i];
+      cm.replaceRange(info.text, ranges[i].head, ranges[i].anchor, "+insert");
+      var sel = cm.listSelections().slice(0);
+      sel[i] = {head: info.newPos, anchor: info.newPos};
+      cm.setSelections(sel);
+      if (!dontIndentOnAutoClose && info.indent) {
+        cm.indentLine(info.newPos.line, null, true);
+        cm.indentLine(info.newPos.line + 1, null, true);
+      }
+    }
+  }
+
+  function autoCloseCurrent(cm, typingSlash) {
+    var ranges = cm.listSelections(), replacements = [];
+    var head = typingSlash ? "/" : "</";
+    var opt = cm.getOption("autoCloseTags");
+    var dontIndentOnAutoClose = (typeof opt == "object" && opt.dontIndentOnSlash);
+    for (var i = 0; i < ranges.length; i++) {
+      if (!ranges[i].empty()) return CodeMirror.Pass;
+      var pos = ranges[i].head, tok = cm.getTokenAt(pos);
+      var inner = CodeMirror.innerMode(cm.getMode(), tok.state), state = inner.state;
+      if (typingSlash && (tok.type == "string" || tok.string.charAt(0) != "<" ||
+                          tok.start != pos.ch - 1))
+        return CodeMirror.Pass;
+      // Kludge to get around the fact that we are not in XML mode
+      // 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, mixed = inner.mode.name != "xml" && cm.getMode().name == "htmlmixed"
+      if (mixed && inner.mode.name == "javascript") {
+        replacement = head + "script";
+      } else if (mixed && inner.mode.name == "css") {
+        replacement = head + "style";
+      } else {
+        var context = inner.mode.xmlCurrentContext && inner.mode.xmlCurrentContext(state)
+        var top = context.length ? context[context.length - 1] : ""
+        if (!context || (context.length && closingTagExists(cm, context, top, pos)))
+          return CodeMirror.Pass;
+        replacement = head + top
+      }
+      if (cm.getLine(pos.line).charAt(tok.end) != ">") replacement += ">";
+      replacements[i] = replacement;
+    }
+    cm.replaceSelections(replacements);
+    ranges = cm.listSelections();
+    if (!dontIndentOnAutoClose) {
+        for (var i = 0; i < ranges.length; i++)
+            if (i == ranges.length - 1 || ranges[i].head.line < ranges[i + 1].head.line)
+                cm.indentLine(ranges[i].head.line);
+    }
+  }
+
+  function autoCloseSlash(cm) {
+    if (cm.getOption("disableInput")) return CodeMirror.Pass;
+    return autoCloseCurrent(cm, true);
+  }
+
+  CodeMirror.commands.closeTag = function(cm) { return autoCloseCurrent(cm); };
+
+  function indexOf(collection, elt) {
+    if (collection.indexOf) return collection.indexOf(elt);
+    for (var i = 0, e = collection.length; i < e; ++i)
+      if (collection[i] == elt) return i;
+    return -1;
+  }
+
+  // If xml-fold is loaded, we use its functionality to try and verify
+  // whether a given tag is actually unclosed.
+  function closingTagExists(cm, context, tagName, pos, newTag) {
+    if (!CodeMirror.scanForClosingTag) return false;
+    var end = Math.min(cm.lastLine() + 1, pos.line + 500);
+    var nextClose = CodeMirror.scanForClosingTag(cm, pos, null, end);
+    if (!nextClose || nextClose.tag != tagName) return false;
+    // If the immediate wrapping context contains onCx instances of
+    // the same tag, a closing tag only exists if there are at least
+    // that many closing tags of that type following.
+    var onCx = newTag ? 1 : 0
+    for (var i = context.length - 1; i >= 0; i--) {
+      if (context[i] == tagName) ++onCx
+      else break
+    }
+    pos = nextClose.to;
+    for (var i = 1; i < onCx; i++) {
+      var next = CodeMirror.scanForClosingTag(cm, pos, null, end);
+      if (!next || next.tag != tagName) return false;
+      pos = next.to;
+    }
+    return true;
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/edit/continuelist.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,101 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var listRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]\s|[*+-]\s|(\d+)([.)]))(\s*)/,
+      emptyListRE = /^(\s*)(>[> ]*|[*+-] \[[x ]\]|[*+-]|(\d+)[.)])(\s*)$/,
+      unorderedListRE = /[*+-]\s/;
+
+  CodeMirror.commands.newlineAndIndentContinueMarkdownList = function(cm) {
+    if (cm.getOption("disableInput")) return CodeMirror.Pass;
+    var ranges = cm.listSelections(), replacements = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var pos = ranges[i].head;
+
+      // If we're not in Markdown mode, fall back to normal newlineAndIndent
+      var eolState = cm.getStateAfter(pos.line);
+      var inner = CodeMirror.innerMode(cm.getMode(), eolState);
+      if (inner.mode.name !== "markdown" && inner.mode.helperType !== "markdown") {
+        cm.execCommand("newlineAndIndent");
+        return;
+      } else {
+        eolState = inner.state;
+      }
+
+      var inList = eolState.list !== false;
+      var inQuote = eolState.quote !== 0;
+
+      var line = cm.getLine(pos.line), match = listRE.exec(line);
+      var cursorBeforeBullet = /^\s*$/.test(line.slice(0, pos.ch));
+      if (!ranges[i].empty() || (!inList && !inQuote) || !match || cursorBeforeBullet) {
+        cm.execCommand("newlineAndIndent");
+        return;
+      }
+      if (emptyListRE.test(line)) {
+        var endOfQuote = inQuote && />\s*$/.test(line)
+        var endOfList = !/>\s*$/.test(line)
+        if (endOfQuote || endOfList) cm.replaceRange("", {
+          line: pos.line, ch: 0
+        }, {
+          line: pos.line, ch: pos.ch + 1
+        });
+        replacements[i] = "\n";
+      } else {
+        var indent = match[1], after = match[5];
+        var numbered = !(unorderedListRE.test(match[2]) || match[2].indexOf(">") >= 0);
+        var bullet = numbered ? (parseInt(match[3], 10) + 1) + match[4] : match[2].replace("x", " ");
+        replacements[i] = "\n" + indent + bullet + after;
+
+        if (numbered) incrementRemainingMarkdownListNumbers(cm, pos);
+      }
+    }
+
+    cm.replaceSelections(replacements);
+  };
+
+  // Auto-updating Markdown list numbers when a new item is added to the
+  // middle of a list
+  function incrementRemainingMarkdownListNumbers(cm, pos) {
+    var startLine = pos.line, lookAhead = 0, skipCount = 0;
+    var startItem = listRE.exec(cm.getLine(startLine)), startIndent = startItem[1];
+
+    do {
+      lookAhead += 1;
+      var nextLineNumber = startLine + lookAhead;
+      var nextLine = cm.getLine(nextLineNumber), nextItem = listRE.exec(nextLine);
+
+      if (nextItem) {
+        var nextIndent = nextItem[1];
+        var newNumber = (parseInt(startItem[3], 10) + lookAhead - skipCount);
+        var nextNumber = (parseInt(nextItem[3], 10)), itemNumber = nextNumber;
+
+        if (startIndent === nextIndent && !isNaN(nextNumber)) {
+          if (newNumber === nextNumber) itemNumber = nextNumber + 1;
+          if (newNumber > nextNumber) itemNumber = newNumber + 1;
+          cm.replaceRange(
+            nextLine.replace(listRE, nextIndent + itemNumber + nextItem[4] + nextItem[5]),
+          {
+            line: nextLineNumber, ch: 0
+          }, {
+            line: nextLineNumber, ch: nextLine.length
+          });
+        } else {
+          if (startIndent.length > nextIndent.length) return;
+          // This doesn't run if the next line immediately indents, as it is
+          // not clear of the users intention (new indented item or same level)
+          if ((startIndent.length < nextIndent.length) && (lookAhead === 1)) return;
+          skipCount += 1;
+        }
+      }
+    } while (nextItem);
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/edit/matchbrackets.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,160 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
+    (document.documentMode == null || document.documentMode < 8);
+
+  var Pos = CodeMirror.Pos;
+
+  var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"};
+
+  function bracketRegex(config) {
+    return config && config.bracketRegex || /[(){}[\]]/
+  }
+
+  function findMatchingBracket(cm, where, config) {
+    var line = cm.getLineHandle(where.line), pos = where.ch - 1;
+    var afterCursor = config && config.afterCursor
+    if (afterCursor == null)
+      afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
+    var re = bracketRegex(config)
+
+    // A cursor is defined as between two characters, but in vim command mode
+    // (i.e. not insert mode), the cursor is visually represented as a
+    // highlighted box on top of the 2nd character. Otherwise, we allow matches
+    // from before or after the cursor.
+    var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) ||
+        re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)];
+    if (!match) return null;
+    var dir = match.charAt(1) == ">" ? 1 : -1;
+    if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
+    var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
+
+    var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style, config);
+    if (found == null) return null;
+    return {from: Pos(where.line, pos), to: found && found.pos,
+            match: found && found.ch == match.charAt(0), forward: dir > 0};
+  }
+
+  // bracketRegex is used to specify which type of bracket to scan
+  // should be a regexp, e.g. /[[\]]/
+  //
+  // Note: If "where" is on an open bracket, then this bracket is ignored.
+  //
+  // Returns false when no bracket was found, null when it reached
+  // maxScanLines and gave up
+  function scanForBracket(cm, where, dir, style, config) {
+    var maxScanLen = (config && config.maxScanLineLength) || 10000;
+    var maxScanLines = (config && config.maxScanLines) || 1000;
+
+    var stack = [];
+    var re = bracketRegex(config)
+    var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
+                          : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
+    for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
+      var line = cm.getLine(lineNo);
+      if (!line) continue;
+      var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
+      if (line.length > maxScanLen) continue;
+      if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
+      for (; pos != end; pos += dir) {
+        var ch = line.charAt(pos);
+        if (re.test(ch) && (style === undefined ||
+                            (cm.getTokenTypeAt(Pos(lineNo, pos + 1)) || "") == (style || ""))) {
+          var match = matching[ch];
+          if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
+          else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
+          else stack.pop();
+        }
+      }
+    }
+    return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
+  }
+
+  function matchBrackets(cm, autoclear, config) {
+    // Disable brace matching in long lines, since it'll cause hugely slow updates
+    var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000,
+      highlightNonMatching = config && config.highlightNonMatching;
+    var marks = [], ranges = cm.listSelections();
+    for (var i = 0; i < ranges.length; i++) {
+      var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
+      if (match && (match.match || highlightNonMatching !== false) && cm.getLine(match.from.line).length <= maxHighlightLen) {
+        var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
+        marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
+        if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
+          marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
+      }
+    }
+
+    if (marks.length) {
+      // Kludge to work around the IE bug from issue #1193, where text
+      // input stops going to the textarea whenever this fires.
+      if (ie_lt8 && cm.state.focused) cm.focus();
+
+      var clear = function() {
+        cm.operation(function() {
+          for (var i = 0; i < marks.length; i++) marks[i].clear();
+        });
+      };
+      if (autoclear) setTimeout(clear, 800);
+      else return clear;
+    }
+  }
+
+  function doMatchBrackets(cm) {
+    cm.operation(function() {
+      if (cm.state.matchBrackets.currentlyHighlighted) {
+        cm.state.matchBrackets.currentlyHighlighted();
+        cm.state.matchBrackets.currentlyHighlighted = null;
+      }
+      cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
+    });
+  }
+
+  function clearHighlighted(cm) {
+    if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
+      cm.state.matchBrackets.currentlyHighlighted();
+      cm.state.matchBrackets.currentlyHighlighted = null;
+    }
+  }
+
+  CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      cm.off("cursorActivity", doMatchBrackets);
+      cm.off("focus", doMatchBrackets)
+      cm.off("blur", clearHighlighted)
+      clearHighlighted(cm);
+    }
+    if (val) {
+      cm.state.matchBrackets = typeof val == "object" ? val : {};
+      cm.on("cursorActivity", doMatchBrackets);
+      cm.on("focus", doMatchBrackets)
+      cm.on("blur", clearHighlighted)
+    }
+  });
+
+  CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
+  CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
+    // Backwards-compatibility kludge
+    if (oldConfig || typeof config == "boolean") {
+      if (!oldConfig) {
+        config = config ? {strict: true} : null
+      } else {
+        oldConfig.strict = config
+        config = oldConfig
+      }
+    }
+    return findMatchingBracket(this, pos, config)
+  });
+  CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
+    return scanForBracket(this, pos, dir, style, config);
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/edit/matchtags.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../fold/xml-fold"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../fold/xml-fold"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineOption("matchTags", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      cm.off("cursorActivity", doMatchTags);
+      cm.off("viewportChange", maybeUpdateMatch);
+      clear(cm);
+    }
+    if (val) {
+      cm.state.matchBothTags = typeof val == "object" && val.bothTags;
+      cm.on("cursorActivity", doMatchTags);
+      cm.on("viewportChange", maybeUpdateMatch);
+      doMatchTags(cm);
+    }
+  });
+
+  function clear(cm) {
+    if (cm.state.tagHit) cm.state.tagHit.clear();
+    if (cm.state.tagOther) cm.state.tagOther.clear();
+    cm.state.tagHit = cm.state.tagOther = null;
+  }
+
+  function doMatchTags(cm) {
+    cm.state.failedTagMatch = false;
+    cm.operation(function() {
+      clear(cm);
+      if (cm.somethingSelected()) return;
+      var cur = cm.getCursor(), range = cm.getViewport();
+      range.from = Math.min(range.from, cur.line); range.to = Math.max(cur.line + 1, range.to);
+      var match = CodeMirror.findMatchingTag(cm, cur, range);
+      if (!match) return;
+      if (cm.state.matchBothTags) {
+        var hit = match.at == "open" ? match.open : match.close;
+        if (hit) cm.state.tagHit = cm.markText(hit.from, hit.to, {className: "CodeMirror-matchingtag"});
+      }
+      var other = match.at == "close" ? match.open : match.close;
+      if (other)
+        cm.state.tagOther = cm.markText(other.from, other.to, {className: "CodeMirror-matchingtag"});
+      else
+        cm.state.failedTagMatch = true;
+    });
+  }
+
+  function maybeUpdateMatch(cm) {
+    if (cm.state.failedTagMatch) doMatchTags(cm);
+  }
+
+  CodeMirror.commands.toMatchingTag = function(cm) {
+    var found = CodeMirror.findMatchingTag(cm, cm.getCursor());
+    if (found) {
+      var other = found.at == "close" ? found.open : found.close;
+      if (other) cm.extendSelection(other.to, other.from);
+    }
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/edit/trailingspace.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,27 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) {
+    if (prev == CodeMirror.Init) prev = false;
+    if (prev && !val)
+      cm.removeOverlay("trailingspace");
+    else if (!prev && val)
+      cm.addOverlay({
+        token: function(stream) {
+          for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {}
+          if (i > stream.pos) { stream.pos = i; return null; }
+          stream.pos = l;
+          return "trailingspace";
+        },
+        name: "trailingspace"
+      });
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/brace-fold.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,119 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+function bracketFolding(pairs) {
+  return function(cm, start) {
+    var line = start.line, lineText = cm.getLine(line);
+
+    function findOpening(pair) {
+      var tokenType;
+      for (var at = start.ch, pass = 0;;) {
+        var found = at <= 0 ? -1 : lineText.lastIndexOf(pair[0], at - 1);
+        if (found == -1) {
+          if (pass == 1) break;
+          pass = 1;
+          at = lineText.length;
+          continue;
+        }
+        if (pass == 1 && found < start.ch) break;
+        tokenType = cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1));
+        if (!/^(comment|string)/.test(tokenType)) return {ch: found + 1, tokenType: tokenType, pair: pair};
+        at = found - 1;
+      }
+    }
+
+    function findRange(found) {
+      var count = 1, lastLine = cm.lastLine(), end, startCh = found.ch, endCh
+      outer: for (var i = line; i <= lastLine; ++i) {
+        var text = cm.getLine(i), pos = i == line ? startCh : 0;
+        for (;;) {
+          var nextOpen = text.indexOf(found.pair[0], pos), nextClose = text.indexOf(found.pair[1], pos);
+          if (nextOpen < 0) nextOpen = text.length;
+          if (nextClose < 0) nextClose = text.length;
+          pos = Math.min(nextOpen, nextClose);
+          if (pos == text.length) break;
+          if (cm.getTokenTypeAt(CodeMirror.Pos(i, pos + 1)) == found.tokenType) {
+            if (pos == nextOpen) ++count;
+            else if (!--count) { end = i; endCh = pos; break outer; }
+          }
+          ++pos;
+        }
+      }
+
+      if (end == null || line == end) return null
+      return {from: CodeMirror.Pos(line, startCh),
+              to: CodeMirror.Pos(end, endCh)};
+    }
+
+    var found = []
+    for (var i = 0; i < pairs.length; i++) {
+      var open = findOpening(pairs[i])
+      if (open) found.push(open)
+    }
+    found.sort(function(a, b) { return a.ch - b.ch })
+    for (var i = 0; i < found.length; i++) {
+      var range = findRange(found[i])
+      if (range) return range
+    }
+    return null
+  }
+}
+
+CodeMirror.registerHelper("fold", "brace", bracketFolding([["{", "}"], ["[", "]"]]));
+
+CodeMirror.registerHelper("fold", "brace-paren", bracketFolding([["{", "}"], ["[", "]"], ["(", ")"]]));
+
+CodeMirror.registerHelper("fold", "import", function(cm, start) {
+  function hasImport(line) {
+    if (line < cm.firstLine() || line > cm.lastLine()) return null;
+    var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
+    if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
+    if (start.type != "keyword" || start.string != "import") return null;
+    // Now find closing semicolon, return its position
+    for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) {
+      var text = cm.getLine(i), semi = text.indexOf(";");
+      if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)};
+    }
+  }
+
+  var startLine = start.line, has = hasImport(startLine), prev;
+  if (!has || hasImport(startLine - 1) || ((prev = hasImport(startLine - 2)) && prev.end.line == startLine - 1))
+    return null;
+  for (var end = has.end;;) {
+    var next = hasImport(end.line + 1);
+    if (next == null) break;
+    end = next.end;
+  }
+  return {from: cm.clipPos(CodeMirror.Pos(startLine, has.startCh + 1)), to: end};
+});
+
+CodeMirror.registerHelper("fold", "include", function(cm, start) {
+  function hasInclude(line) {
+    if (line < cm.firstLine() || line > cm.lastLine()) return null;
+    var start = cm.getTokenAt(CodeMirror.Pos(line, 1));
+    if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1));
+    if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8;
+  }
+
+  var startLine = start.line, has = hasInclude(startLine);
+  if (has == null || hasInclude(startLine - 1) != null) return null;
+  for (var end = startLine;;) {
+    var next = hasInclude(end + 1);
+    if (next == null) break;
+    ++end;
+  }
+  return {from: CodeMirror.Pos(startLine, has + 1),
+          to: cm.clipPos(CodeMirror.Pos(end))};
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/comment-fold.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,59 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.registerGlobalHelper("fold", "comment", function(mode) {
+  return mode.blockCommentStart && mode.blockCommentEnd;
+}, function(cm, start) {
+  var mode = cm.getModeAt(start), startToken = mode.blockCommentStart, endToken = mode.blockCommentEnd;
+  if (!startToken || !endToken) return;
+  var line = start.line, lineText = cm.getLine(line);
+
+  var startCh;
+  for (var at = start.ch, pass = 0;;) {
+    var found = at <= 0 ? -1 : lineText.lastIndexOf(startToken, at - 1);
+    if (found == -1) {
+      if (pass == 1) return;
+      pass = 1;
+      at = lineText.length;
+      continue;
+    }
+    if (pass == 1 && found < start.ch) return;
+    if (/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found + 1))) &&
+        (found == 0 || lineText.slice(found - endToken.length, found) == endToken ||
+         !/comment/.test(cm.getTokenTypeAt(CodeMirror.Pos(line, found))))) {
+      startCh = found + startToken.length;
+      break;
+    }
+    at = found - 1;
+  }
+
+  var depth = 1, lastLine = cm.lastLine(), end, endCh;
+  outer: for (var i = line; i <= lastLine; ++i) {
+    var text = cm.getLine(i), pos = i == line ? startCh : 0;
+    for (;;) {
+      var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos);
+      if (nextOpen < 0) nextOpen = text.length;
+      if (nextClose < 0) nextClose = text.length;
+      pos = Math.min(nextOpen, nextClose);
+      if (pos == text.length) break;
+      if (pos == nextOpen) ++depth;
+      else if (!--depth) { end = i; endCh = pos; break outer; }
+      ++pos;
+    }
+  }
+  if (end == null || line == end && endCh == startCh) return;
+  return {from: CodeMirror.Pos(line, startCh),
+          to: CodeMirror.Pos(end, endCh)};
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/foldcode.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,159 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  function doFold(cm, pos, options, force) {
+    if (options && options.call) {
+      var finder = options;
+      options = null;
+    } else {
+      var finder = getOption(cm, options, "rangeFinder");
+    }
+    if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0);
+    var minSize = getOption(cm, options, "minFoldSize");
+
+    function getRange(allowFolded) {
+      var range = finder(cm, pos);
+      if (!range || range.to.line - range.from.line < minSize) return null;
+      if (force === "fold") return range;
+
+      var marks = cm.findMarksAt(range.from);
+      for (var i = 0; i < marks.length; ++i) {
+        if (marks[i].__isFold) {
+          if (!allowFolded) return null;
+          range.cleared = true;
+          marks[i].clear();
+        }
+      }
+      return range;
+    }
+
+    var range = getRange(true);
+    if (getOption(cm, options, "scanUp")) while (!range && pos.line > cm.firstLine()) {
+      pos = CodeMirror.Pos(pos.line - 1, 0);
+      range = getRange(false);
+    }
+    if (!range || range.cleared || force === "unfold") return;
+
+    var myWidget = makeWidget(cm, options, range);
+    CodeMirror.on(myWidget, "mousedown", function(e) {
+      myRange.clear();
+      CodeMirror.e_preventDefault(e);
+    });
+    var myRange = cm.markText(range.from, range.to, {
+      replacedWith: myWidget,
+      clearOnEnter: getOption(cm, options, "clearOnEnter"),
+      __isFold: true
+    });
+    myRange.on("clear", function(from, to) {
+      CodeMirror.signal(cm, "unfold", cm, from, to);
+    });
+    CodeMirror.signal(cm, "fold", cm, range.from, range.to);
+  }
+
+  function makeWidget(cm, options, range) {
+    var widget = getOption(cm, options, "widget");
+
+    if (typeof widget == "function") {
+      widget = widget(range.from, range.to);
+    }
+
+    if (typeof widget == "string") {
+      var text = document.createTextNode(widget);
+      widget = document.createElement("span");
+      widget.appendChild(text);
+      widget.className = "CodeMirror-foldmarker";
+    } else if (widget) {
+      widget = widget.cloneNode(true)
+    }
+    return widget;
+  }
+
+  // Clumsy backwards-compatible interface
+  CodeMirror.newFoldFunction = function(rangeFinder, widget) {
+    return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); };
+  };
+
+  // New-style interface
+  CodeMirror.defineExtension("foldCode", function(pos, options, force) {
+    doFold(this, pos, options, force);
+  });
+
+  CodeMirror.defineExtension("isFolded", function(pos) {
+    var marks = this.findMarksAt(pos);
+    for (var i = 0; i < marks.length; ++i)
+      if (marks[i].__isFold) return true;
+  });
+
+  CodeMirror.commands.toggleFold = function(cm) {
+    cm.foldCode(cm.getCursor());
+  };
+  CodeMirror.commands.fold = function(cm) {
+    cm.foldCode(cm.getCursor(), null, "fold");
+  };
+  CodeMirror.commands.unfold = function(cm) {
+    cm.foldCode(cm.getCursor(), { scanUp: false }, "unfold");
+  };
+  CodeMirror.commands.foldAll = function(cm) {
+    cm.operation(function() {
+      for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
+        cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "fold");
+    });
+  };
+  CodeMirror.commands.unfoldAll = function(cm) {
+    cm.operation(function() {
+      for (var i = cm.firstLine(), e = cm.lastLine(); i <= e; i++)
+        cm.foldCode(CodeMirror.Pos(i, 0), { scanUp: false }, "unfold");
+    });
+  };
+
+  CodeMirror.registerHelper("fold", "combine", function() {
+    var funcs = Array.prototype.slice.call(arguments, 0);
+    return function(cm, start) {
+      for (var i = 0; i < funcs.length; ++i) {
+        var found = funcs[i](cm, start);
+        if (found) return found;
+      }
+    };
+  });
+
+  CodeMirror.registerHelper("fold", "auto", function(cm, start) {
+    var helpers = cm.getHelpers(start, "fold");
+    for (var i = 0; i < helpers.length; i++) {
+      var cur = helpers[i](cm, start);
+      if (cur) return cur;
+    }
+  });
+
+  var defaultOptions = {
+    rangeFinder: CodeMirror.fold.auto,
+    widget: "\u2194",
+    minFoldSize: 0,
+    scanUp: false,
+    clearOnEnter: true
+  };
+
+  CodeMirror.defineOption("foldOptions", null);
+
+  function getOption(cm, options, name) {
+    if (options && options[name] !== undefined)
+      return options[name];
+    var editorOptions = cm.options.foldOptions;
+    if (editorOptions && editorOptions[name] !== undefined)
+      return editorOptions[name];
+    return defaultOptions[name];
+  }
+
+  CodeMirror.defineExtension("foldOption", function(options, name) {
+    return getOption(this, options, name);
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/foldgutter.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,20 @@
+.CodeMirror-foldmarker {
+  color: blue;
+  text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px;
+  font-family: arial;
+  line-height: .3;
+  cursor: pointer;
+}
+.CodeMirror-foldgutter {
+  width: .7em;
+}
+.CodeMirror-foldgutter-open,
+.CodeMirror-foldgutter-folded {
+  cursor: pointer;
+}
+.CodeMirror-foldgutter-open:after {
+  content: "\25BE";
+}
+.CodeMirror-foldgutter-folded:after {
+  content: "\25B8";
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/foldgutter.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,169 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("./foldcode"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "./foldcode"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineOption("foldGutter", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      cm.clearGutter(cm.state.foldGutter.options.gutter);
+      cm.state.foldGutter = null;
+      cm.off("gutterClick", onGutterClick);
+      cm.off("changes", onChange);
+      cm.off("viewportChange", onViewportChange);
+      cm.off("fold", onFold);
+      cm.off("unfold", onFold);
+      cm.off("swapDoc", onChange);
+      cm.off("optionChange", optionChange);
+    }
+    if (val) {
+      cm.state.foldGutter = new State(parseOptions(val));
+      updateInViewport(cm);
+      cm.on("gutterClick", onGutterClick);
+      cm.on("changes", onChange);
+      cm.on("viewportChange", onViewportChange);
+      cm.on("fold", onFold);
+      cm.on("unfold", onFold);
+      cm.on("swapDoc", onChange);
+      cm.on("optionChange", optionChange);
+    }
+  });
+
+  var Pos = CodeMirror.Pos;
+
+  function State(options) {
+    this.options = options;
+    this.from = this.to = 0;
+  }
+
+  function parseOptions(opts) {
+    if (opts === true) opts = {};
+    if (opts.gutter == null) opts.gutter = "CodeMirror-foldgutter";
+    if (opts.indicatorOpen == null) opts.indicatorOpen = "CodeMirror-foldgutter-open";
+    if (opts.indicatorFolded == null) opts.indicatorFolded = "CodeMirror-foldgutter-folded";
+    return opts;
+  }
+
+  function isFolded(cm, line) {
+    var marks = cm.findMarks(Pos(line, 0), Pos(line + 1, 0));
+    for (var i = 0; i < marks.length; ++i) {
+      if (marks[i].__isFold) {
+        var fromPos = marks[i].find(-1);
+        if (fromPos && fromPos.line === line)
+          return marks[i];
+      }
+    }
+  }
+
+  function marker(spec) {
+    if (typeof spec == "string") {
+      var elt = document.createElement("div");
+      elt.className = spec + " CodeMirror-guttermarker-subtle";
+      return elt;
+    } else {
+      return spec.cloneNode(true);
+    }
+  }
+
+  function updateFoldInfo(cm, from, to) {
+    var opts = cm.state.foldGutter.options, cur = from - 1;
+    var minSize = cm.foldOption(opts, "minFoldSize");
+    var func = cm.foldOption(opts, "rangeFinder");
+    // we can reuse the built-in indicator element if its className matches the new state
+    var clsFolded = typeof opts.indicatorFolded == "string" && classTest(opts.indicatorFolded);
+    var clsOpen = typeof opts.indicatorOpen == "string" && classTest(opts.indicatorOpen);
+    cm.eachLine(from, to, function(line) {
+      ++cur;
+      var mark = null;
+      var old = line.gutterMarkers;
+      if (old) old = old[opts.gutter];
+      if (isFolded(cm, cur)) {
+        if (clsFolded && old && clsFolded.test(old.className)) return;
+        mark = marker(opts.indicatorFolded);
+      } else {
+        var pos = Pos(cur, 0);
+        var range = func && func(cm, pos);
+        if (range && range.to.line - range.from.line >= minSize) {
+          if (clsOpen && old && clsOpen.test(old.className)) return;
+          mark = marker(opts.indicatorOpen);
+        }
+      }
+      if (!mark && !old) return;
+      cm.setGutterMarker(line, opts.gutter, mark);
+    });
+  }
+
+  // copied from CodeMirror/src/util/dom.js
+  function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
+
+  function updateInViewport(cm) {
+    var vp = cm.getViewport(), state = cm.state.foldGutter;
+    if (!state) return;
+    cm.operation(function() {
+      updateFoldInfo(cm, vp.from, vp.to);
+    });
+    state.from = vp.from; state.to = vp.to;
+  }
+
+  function onGutterClick(cm, line, gutter) {
+    var state = cm.state.foldGutter;
+    if (!state) return;
+    var opts = state.options;
+    if (gutter != opts.gutter) return;
+    var folded = isFolded(cm, line);
+    if (folded) folded.clear();
+    else cm.foldCode(Pos(line, 0), opts);
+  }
+
+  function optionChange(cm, option) {
+    if (option == "mode") onChange(cm)
+  }
+
+  function onChange(cm) {
+    var state = cm.state.foldGutter;
+    if (!state) return;
+    var opts = state.options;
+    state.from = state.to = 0;
+    clearTimeout(state.changeUpdate);
+    state.changeUpdate = setTimeout(function() { updateInViewport(cm); }, opts.foldOnChangeTimeSpan || 600);
+  }
+
+  function onViewportChange(cm) {
+    var state = cm.state.foldGutter;
+    if (!state) return;
+    var opts = state.options;
+    clearTimeout(state.changeUpdate);
+    state.changeUpdate = setTimeout(function() {
+      var vp = cm.getViewport();
+      if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
+        updateInViewport(cm);
+      } else {
+        cm.operation(function() {
+          if (vp.from < state.from) {
+            updateFoldInfo(cm, vp.from, state.from);
+            state.from = vp.from;
+          }
+          if (vp.to > state.to) {
+            updateFoldInfo(cm, state.to, vp.to);
+            state.to = vp.to;
+          }
+        });
+      }
+    }, opts.updateViewportTimeSpan || 400);
+  }
+
+  function onFold(cm, from) {
+    var state = cm.state.foldGutter;
+    if (!state) return;
+    var line = from.line;
+    if (line >= state.from && line < state.to)
+      updateFoldInfo(cm, line, line + 1);
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/indent-fold.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+function lineIndent(cm, lineNo) {
+  var text = cm.getLine(lineNo)
+  var spaceTo = text.search(/\S/)
+  if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1))))
+    return -1
+  return CodeMirror.countColumn(text, null, cm.getOption("tabSize"))
+}
+
+CodeMirror.registerHelper("fold", "indent", function(cm, start) {
+  var myIndent = lineIndent(cm, start.line)
+  if (myIndent < 0) return
+  var lastLineInFold = null
+
+  // Go through lines until we find a line that definitely doesn't belong in
+  // the block we're folding, or to the end.
+  for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) {
+    var indent = lineIndent(cm, i)
+    if (indent == -1) {
+    } else if (indent > myIndent) {
+      // Lines with a greater indent are considered part of the block.
+      lastLineInFold = i;
+    } else {
+      // If this line has non-space, non-comment content, and is
+      // indented less or equal to the start line, it is the start of
+      // another block.
+      break;
+    }
+  }
+  if (lastLineInFold) return {
+    from: CodeMirror.Pos(start.line, cm.getLine(start.line).length),
+    to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length)
+  };
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/markdown-fold.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,49 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.registerHelper("fold", "markdown", function(cm, start) {
+  var maxDepth = 100;
+
+  function isHeader(lineNo) {
+    var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0));
+    return tokentype && /\bheader\b/.test(tokentype);
+  }
+
+  function headerLevel(lineNo, line, nextLine) {
+    var match = line && line.match(/^#+/);
+    if (match && isHeader(lineNo)) return match[0].length;
+    match = nextLine && nextLine.match(/^[=\-]+\s*$/);
+    if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2;
+    return maxDepth;
+  }
+
+  var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1);
+  var level = headerLevel(start.line, firstLine, nextLine);
+  if (level === maxDepth) return undefined;
+
+  var lastLineNo = cm.lastLine();
+  var end = start.line, nextNextLine = cm.getLine(end + 2);
+  while (end < lastLineNo) {
+    if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break;
+    ++end;
+    nextLine = nextNextLine;
+    nextNextLine = cm.getLine(end + 2);
+  }
+
+  return {
+    from: CodeMirror.Pos(start.line, firstLine.length),
+    to: CodeMirror.Pos(end, cm.getLine(end).length)
+  };
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/fold/xml-fold.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,184 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var Pos = CodeMirror.Pos;
+  function cmp(a, b) { return a.line - b.line || a.ch - b.ch; }
+
+  var nameStartChar = "A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD";
+  var nameChar = nameStartChar + "\-\:\.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
+  var xmlTagStart = new RegExp("<(/?)([" + nameStartChar + "][" + nameChar + "]*)", "g");
+
+  function Iter(cm, line, ch, range) {
+    this.line = line; this.ch = ch;
+    this.cm = cm; this.text = cm.getLine(line);
+    this.min = range ? Math.max(range.from, cm.firstLine()) : cm.firstLine();
+    this.max = range ? Math.min(range.to - 1, cm.lastLine()) : cm.lastLine();
+  }
+
+  function tagAt(iter, ch) {
+    var type = iter.cm.getTokenTypeAt(Pos(iter.line, ch));
+    return type && /\btag\b/.test(type);
+  }
+
+  function nextLine(iter) {
+    if (iter.line >= iter.max) return;
+    iter.ch = 0;
+    iter.text = iter.cm.getLine(++iter.line);
+    return true;
+  }
+  function prevLine(iter) {
+    if (iter.line <= iter.min) return;
+    iter.text = iter.cm.getLine(--iter.line);
+    iter.ch = iter.text.length;
+    return true;
+  }
+
+  function toTagEnd(iter) {
+    for (;;) {
+      var gt = iter.text.indexOf(">", iter.ch);
+      if (gt == -1) { if (nextLine(iter)) continue; else return; }
+      if (!tagAt(iter, gt + 1)) { iter.ch = gt + 1; continue; }
+      var lastSlash = iter.text.lastIndexOf("/", gt);
+      var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
+      iter.ch = gt + 1;
+      return selfClose ? "selfClose" : "regular";
+    }
+  }
+  function toTagStart(iter) {
+    for (;;) {
+      var lt = iter.ch ? iter.text.lastIndexOf("<", iter.ch - 1) : -1;
+      if (lt == -1) { if (prevLine(iter)) continue; else return; }
+      if (!tagAt(iter, lt + 1)) { iter.ch = lt; continue; }
+      xmlTagStart.lastIndex = lt;
+      iter.ch = lt;
+      var match = xmlTagStart.exec(iter.text);
+      if (match && match.index == lt) return match;
+    }
+  }
+
+  function toNextTag(iter) {
+    for (;;) {
+      xmlTagStart.lastIndex = iter.ch;
+      var found = xmlTagStart.exec(iter.text);
+      if (!found) { if (nextLine(iter)) continue; else return; }
+      if (!tagAt(iter, found.index + 1)) { iter.ch = found.index + 1; continue; }
+      iter.ch = found.index + found[0].length;
+      return found;
+    }
+  }
+  function toPrevTag(iter) {
+    for (;;) {
+      var gt = iter.ch ? iter.text.lastIndexOf(">", iter.ch - 1) : -1;
+      if (gt == -1) { if (prevLine(iter)) continue; else return; }
+      if (!tagAt(iter, gt + 1)) { iter.ch = gt; continue; }
+      var lastSlash = iter.text.lastIndexOf("/", gt);
+      var selfClose = lastSlash > -1 && !/\S/.test(iter.text.slice(lastSlash + 1, gt));
+      iter.ch = gt + 1;
+      return selfClose ? "selfClose" : "regular";
+    }
+  }
+
+  function findMatchingClose(iter, tag) {
+    var stack = [];
+    for (;;) {
+      var next = toNextTag(iter), end, startLine = iter.line, startCh = iter.ch - (next ? next[0].length : 0);
+      if (!next || !(end = toTagEnd(iter))) return;
+      if (end == "selfClose") continue;
+      if (next[1]) { // closing tag
+        for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == next[2]) {
+          stack.length = i;
+          break;
+        }
+        if (i < 0 && (!tag || tag == next[2])) return {
+          tag: next[2],
+          from: Pos(startLine, startCh),
+          to: Pos(iter.line, iter.ch)
+        };
+      } else { // opening tag
+        stack.push(next[2]);
+      }
+    }
+  }
+  function findMatchingOpen(iter, tag) {
+    var stack = [];
+    for (;;) {
+      var prev = toPrevTag(iter);
+      if (!prev) return;
+      if (prev == "selfClose") { toTagStart(iter); continue; }
+      var endLine = iter.line, endCh = iter.ch;
+      var start = toTagStart(iter);
+      if (!start) return;
+      if (start[1]) { // closing tag
+        stack.push(start[2]);
+      } else { // opening tag
+        for (var i = stack.length - 1; i >= 0; --i) if (stack[i] == start[2]) {
+          stack.length = i;
+          break;
+        }
+        if (i < 0 && (!tag || tag == start[2])) return {
+          tag: start[2],
+          from: Pos(iter.line, iter.ch),
+          to: Pos(endLine, endCh)
+        };
+      }
+    }
+  }
+
+  CodeMirror.registerHelper("fold", "xml", function(cm, start) {
+    var iter = new Iter(cm, start.line, 0);
+    for (;;) {
+      var openTag = toNextTag(iter)
+      if (!openTag || iter.line != start.line) return
+      var end = toTagEnd(iter)
+      if (!end) return
+      if (!openTag[1] && end != "selfClose") {
+        var startPos = Pos(iter.line, iter.ch);
+        var endPos = findMatchingClose(iter, openTag[2]);
+        return endPos && cmp(endPos.from, startPos) > 0 ? {from: startPos, to: endPos.from} : null
+      }
+    }
+  });
+  CodeMirror.findMatchingTag = function(cm, pos, range) {
+    var iter = new Iter(cm, pos.line, pos.ch, range);
+    if (iter.text.indexOf(">") == -1 && iter.text.indexOf("<") == -1) return;
+    var end = toTagEnd(iter), to = end && Pos(iter.line, iter.ch);
+    var start = end && toTagStart(iter);
+    if (!end || !start || cmp(iter, pos) > 0) return;
+    var here = {from: Pos(iter.line, iter.ch), to: to, tag: start[2]};
+    if (end == "selfClose") return {open: here, close: null, at: "open"};
+
+    if (start[1]) { // closing tag
+      return {open: findMatchingOpen(iter, start[2]), close: here, at: "close"};
+    } else { // opening tag
+      iter = new Iter(cm, to.line, to.ch, range);
+      return {open: here, close: findMatchingClose(iter, start[2]), at: "open"};
+    }
+  };
+
+  CodeMirror.findEnclosingTag = function(cm, pos, range, tag) {
+    var iter = new Iter(cm, pos.line, pos.ch, range);
+    for (;;) {
+      var open = findMatchingOpen(iter, tag);
+      if (!open) break;
+      var forward = new Iter(cm, pos.line, pos.ch, range);
+      var close = findMatchingClose(forward, open.tag);
+      if (close) return {open: open, close: close};
+    }
+  };
+
+  // Used by addon/edit/closetag.js
+  CodeMirror.scanForClosingTag = function(cm, pos, name, end) {
+    var iter = new Iter(cm, pos.line, pos.ch, end ? {from: 0, to: end} : null);
+    return findMatchingClose(iter, name);
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/anyword-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,41 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var WORD = /[\w$]+/, RANGE = 500;
+
+  CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
+    var word = options && options.word || WORD;
+    var range = options && options.range || RANGE;
+    var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
+    var end = cur.ch, start = end;
+    while (start && word.test(curLine.charAt(start - 1))) --start;
+    var curWord = start != end && curLine.slice(start, end);
+
+    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;
+      for (; line != endLine; line += dir) {
+        var text = editor.getLine(line), m;
+        while (m = re.exec(text)) {
+          if (line == cur.line && m[0] === curWord) continue;
+          if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
+            seen[m[0]] = true;
+            list.push(m[0]);
+          }
+        }
+      }
+    }
+    return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/css-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../mode/css/css"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../mode/css/css"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var pseudoClasses = {"active":1, "after":1, "before":1, "checked":1, "default":1,
+    "disabled":1, "empty":1, "enabled":1, "first-child":1, "first-letter":1,
+    "first-line":1, "first-of-type":1, "focus":1, "hover":1, "in-range":1,
+    "indeterminate":1, "invalid":1, "lang":1, "last-child":1, "last-of-type":1,
+    "link":1, "not":1, "nth-child":1, "nth-last-child":1, "nth-last-of-type":1,
+    "nth-of-type":1, "only-of-type":1, "only-child":1, "optional":1, "out-of-range":1,
+    "placeholder":1, "read-only":1, "read-write":1, "required":1, "root":1,
+    "selection":1, "target":1, "valid":1, "visited":1
+  };
+
+  CodeMirror.registerHelper("hint", "css", function(cm) {
+    var cur = cm.getCursor(), token = cm.getTokenAt(cur);
+    var inner = CodeMirror.innerMode(cm.getMode(), token.state);
+    if (inner.mode.name != "css") return;
+
+    if (token.type == "keyword" && "!important".indexOf(token.string) == 0)
+      return {list: ["!important"], from: CodeMirror.Pos(cur.line, token.start),
+              to: CodeMirror.Pos(cur.line, token.end)};
+
+    var start = token.start, end = cur.ch, word = token.string.slice(0, end - start);
+    if (/[^\w$_-]/.test(word)) {
+      word = ""; start = end = cur.ch;
+    }
+
+    var spec = CodeMirror.resolveMode("text/css");
+
+    var result = [];
+    function add(keywords) {
+      for (var name in keywords)
+        if (!word || name.lastIndexOf(word, 0) == 0)
+          result.push(name);
+    }
+
+    var st = inner.state.state;
+    if (st == "pseudo" || token.type == "variable-3") {
+      add(pseudoClasses);
+    } else if (st == "block" || st == "maybeprop") {
+      add(spec.propertyKeywords);
+    } else if (st == "prop" || st == "parens" || st == "at" || st == "params") {
+      add(spec.valueKeywords);
+      add(spec.colorKeywords);
+    } else if (st == "media" || st == "media_parens") {
+      add(spec.mediaTypes);
+      add(spec.mediaFeatures);
+    }
+
+    if (result.length) return {
+      list: result,
+      from: CodeMirror.Pos(cur.line, start),
+      to: CodeMirror.Pos(cur.line, end)
+    };
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/html-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,351 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("./xml-hint"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "./xml-hint"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var langs = "ab aa af ak sq am ar an hy as av ae ay az bm ba eu be bn bh bi bs br bg my ca ch ce ny zh cv kw co cr hr cs da dv nl dz en eo et ee fo fj fi fr ff gl ka de el gn gu ht ha he hz hi ho hu ia id ie ga ig ik io is it iu ja jv kl kn kr ks kk km ki rw ky kv kg ko ku kj la lb lg li ln lo lt lu lv gv mk mg ms ml mt mi mr mh mn na nv nb nd ne ng nn no ii nr oc oj cu om or os pa pi fa pl ps pt qu rm rn ro ru sa sc sd se sm sg sr gd sn si sk sl so st es su sw ss sv ta te tg th ti bo tk tl tn to tr ts tt tw ty ug uk ur uz ve vi vo wa cy wo fy xh yi yo za zu".split(" ");
+  var targets = ["_blank", "_self", "_top", "_parent"];
+  var charsets = ["ascii", "utf-8", "utf-16", "latin1", "latin1"];
+  var methods = ["get", "post", "put", "delete"];
+  var encs = ["application/x-www-form-urlencoded", "multipart/form-data", "text/plain"];
+  var media = ["all", "screen", "print", "embossed", "braille", "handheld", "print", "projection", "screen", "tty", "tv", "speech",
+               "3d-glasses", "resolution [>][<][=] [X]", "device-aspect-ratio: X/Y", "orientation:portrait",
+               "orientation:landscape", "device-height: [X]", "device-width: [X]"];
+  var s = { attrs: {} }; // Simple tag, reused for a whole lot of tags
+
+  var data = {
+    a: {
+      attrs: {
+        href: null, ping: null, type: null,
+        media: media,
+        target: targets,
+        hreflang: langs
+      }
+    },
+    abbr: s,
+    acronym: s,
+    address: s,
+    applet: s,
+    area: {
+      attrs: {
+        alt: null, coords: null, href: null, target: null, ping: null,
+        media: media, hreflang: langs, type: null,
+        shape: ["default", "rect", "circle", "poly"]
+      }
+    },
+    article: s,
+    aside: s,
+    audio: {
+      attrs: {
+        src: null, mediagroup: null,
+        crossorigin: ["anonymous", "use-credentials"],
+        preload: ["none", "metadata", "auto"],
+        autoplay: ["", "autoplay"],
+        loop: ["", "loop"],
+        controls: ["", "controls"]
+      }
+    },
+    b: s,
+    base: { attrs: { href: null, target: targets } },
+    basefont: s,
+    bdi: s,
+    bdo: s,
+    big: s,
+    blockquote: { attrs: { cite: null } },
+    body: s,
+    br: s,
+    button: {
+      attrs: {
+        form: null, formaction: null, name: null, value: null,
+        autofocus: ["", "autofocus"],
+        disabled: ["", "autofocus"],
+        formenctype: encs,
+        formmethod: methods,
+        formnovalidate: ["", "novalidate"],
+        formtarget: targets,
+        type: ["submit", "reset", "button"]
+      }
+    },
+    canvas: { attrs: { width: null, height: null } },
+    caption: s,
+    center: s,
+    cite: s,
+    code: s,
+    col: { attrs: { span: null } },
+    colgroup: { attrs: { span: null } },
+    command: {
+      attrs: {
+        type: ["command", "checkbox", "radio"],
+        label: null, icon: null, radiogroup: null, command: null, title: null,
+        disabled: ["", "disabled"],
+        checked: ["", "checked"]
+      }
+    },
+    data: { attrs: { value: null } },
+    datagrid: { attrs: { disabled: ["", "disabled"], multiple: ["", "multiple"] } },
+    datalist: { attrs: { data: null } },
+    dd: s,
+    del: { attrs: { cite: null, datetime: null } },
+    details: { attrs: { open: ["", "open"] } },
+    dfn: s,
+    dir: s,
+    div: s,
+    dialog: { attrs: { open: null } },
+    dl: s,
+    dt: s,
+    em: s,
+    embed: { attrs: { src: null, type: null, width: null, height: null } },
+    eventsource: { attrs: { src: null } },
+    fieldset: { attrs: { disabled: ["", "disabled"], form: null, name: null } },
+    figcaption: s,
+    figure: s,
+    font: s,
+    footer: s,
+    form: {
+      attrs: {
+        action: null, name: null,
+        "accept-charset": charsets,
+        autocomplete: ["on", "off"],
+        enctype: encs,
+        method: methods,
+        novalidate: ["", "novalidate"],
+        target: targets
+      }
+    },
+    frame: s,
+    frameset: s,
+    h1: s, h2: s, h3: s, h4: s, h5: s, h6: s,
+    head: {
+      attrs: {},
+      children: ["title", "base", "link", "style", "meta", "script", "noscript", "command"]
+    },
+    header: s,
+    hgroup: s,
+    hr: s,
+    html: {
+      attrs: { manifest: null },
+      children: ["head", "body"]
+    },
+    i: s,
+    iframe: {
+      attrs: {
+        src: null, srcdoc: null, name: null, width: null, height: null,
+        sandbox: ["allow-top-navigation", "allow-same-origin", "allow-forms", "allow-scripts"],
+        seamless: ["", "seamless"]
+      }
+    },
+    img: {
+      attrs: {
+        alt: null, src: null, ismap: null, usemap: null, width: null, height: null,
+        crossorigin: ["anonymous", "use-credentials"]
+      }
+    },
+    input: {
+      attrs: {
+        alt: null, dirname: null, form: null, formaction: null,
+        height: null, list: null, max: null, maxlength: null, min: null,
+        name: null, pattern: null, placeholder: null, size: null, src: null,
+        step: null, value: null, width: null,
+        accept: ["audio/*", "video/*", "image/*"],
+        autocomplete: ["on", "off"],
+        autofocus: ["", "autofocus"],
+        checked: ["", "checked"],
+        disabled: ["", "disabled"],
+        formenctype: encs,
+        formmethod: methods,
+        formnovalidate: ["", "novalidate"],
+        formtarget: targets,
+        multiple: ["", "multiple"],
+        readonly: ["", "readonly"],
+        required: ["", "required"],
+        type: ["hidden", "text", "search", "tel", "url", "email", "password", "datetime", "date", "month",
+               "week", "time", "datetime-local", "number", "range", "color", "checkbox", "radio",
+               "file", "submit", "image", "reset", "button"]
+      }
+    },
+    ins: { attrs: { cite: null, datetime: null } },
+    kbd: s,
+    keygen: {
+      attrs: {
+        challenge: null, form: null, name: null,
+        autofocus: ["", "autofocus"],
+        disabled: ["", "disabled"],
+        keytype: ["RSA"]
+      }
+    },
+    label: { attrs: { "for": null, form: null } },
+    legend: s,
+    li: { attrs: { value: null } },
+    link: {
+      attrs: {
+        href: null, type: null,
+        hreflang: langs,
+        media: media,
+        sizes: ["all", "16x16", "16x16 32x32", "16x16 32x32 64x64"]
+      }
+    },
+    map: { attrs: { name: null } },
+    mark: s,
+    menu: { attrs: { label: null, type: ["list", "context", "toolbar"] } },
+    meta: {
+      attrs: {
+        content: null,
+        charset: charsets,
+        name: ["viewport", "application-name", "author", "description", "generator", "keywords"],
+        "http-equiv": ["content-language", "content-type", "default-style", "refresh"]
+      }
+    },
+    meter: { attrs: { value: null, min: null, low: null, high: null, max: null, optimum: null } },
+    nav: s,
+    noframes: s,
+    noscript: s,
+    object: {
+      attrs: {
+        data: null, type: null, name: null, usemap: null, form: null, width: null, height: null,
+        typemustmatch: ["", "typemustmatch"]
+      }
+    },
+    ol: { attrs: { reversed: ["", "reversed"], start: null, type: ["1", "a", "A", "i", "I"] } },
+    optgroup: { attrs: { disabled: ["", "disabled"], label: null } },
+    option: { attrs: { disabled: ["", "disabled"], label: null, selected: ["", "selected"], value: null } },
+    output: { attrs: { "for": null, form: null, name: null } },
+    p: s,
+    param: { attrs: { name: null, value: null } },
+    pre: s,
+    progress: { attrs: { value: null, max: null } },
+    q: { attrs: { cite: null } },
+    rp: s,
+    rt: s,
+    ruby: s,
+    s: s,
+    samp: s,
+    script: {
+      attrs: {
+        type: ["text/javascript"],
+        src: null,
+        async: ["", "async"],
+        defer: ["", "defer"],
+        charset: charsets
+      }
+    },
+    section: s,
+    select: {
+      attrs: {
+        form: null, name: null, size: null,
+        autofocus: ["", "autofocus"],
+        disabled: ["", "disabled"],
+        multiple: ["", "multiple"]
+      }
+    },
+    small: s,
+    source: { attrs: { src: null, type: null, media: null } },
+    span: s,
+    strike: s,
+    strong: s,
+    style: {
+      attrs: {
+        type: ["text/css"],
+        media: media,
+        scoped: null
+      }
+    },
+    sub: s,
+    summary: s,
+    sup: s,
+    table: s,
+    tbody: s,
+    td: { attrs: { colspan: null, rowspan: null, headers: null } },
+    textarea: {
+      attrs: {
+        dirname: null, form: null, maxlength: null, name: null, placeholder: null,
+        rows: null, cols: null,
+        autofocus: ["", "autofocus"],
+        disabled: ["", "disabled"],
+        readonly: ["", "readonly"],
+        required: ["", "required"],
+        wrap: ["soft", "hard"]
+      }
+    },
+    tfoot: s,
+    th: { attrs: { colspan: null, rowspan: null, headers: null, scope: ["row", "col", "rowgroup", "colgroup"] } },
+    thead: s,
+    time: { attrs: { datetime: null } },
+    title: s,
+    tr: s,
+    track: {
+      attrs: {
+        src: null, label: null, "default": null,
+        kind: ["subtitles", "captions", "descriptions", "chapters", "metadata"],
+        srclang: langs
+      }
+    },
+    tt: s,
+    u: s,
+    ul: s,
+    "var": s,
+    video: {
+      attrs: {
+        src: null, poster: null, width: null, height: null,
+        crossorigin: ["anonymous", "use-credentials"],
+        preload: ["auto", "metadata", "none"],
+        autoplay: ["", "autoplay"],
+        mediagroup: ["movie"],
+        muted: ["", "muted"],
+        controls: ["", "controls"]
+      }
+    },
+    wbr: s
+  };
+
+  var globalAttrs = {
+    accesskey: ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"],
+    "class": null,
+    contenteditable: ["true", "false"],
+    contextmenu: null,
+    dir: ["ltr", "rtl", "auto"],
+    draggable: ["true", "false", "auto"],
+    dropzone: ["copy", "move", "link", "string:", "file:"],
+    hidden: ["hidden"],
+    id: null,
+    inert: ["inert"],
+    itemid: null,
+    itemprop: null,
+    itemref: null,
+    itemscope: ["itemscope"],
+    itemtype: null,
+    lang: ["en", "es"],
+    spellcheck: ["true", "false"],
+    autocorrect: ["true", "false"],
+    autocapitalize: ["true", "false"],
+    style: null,
+    tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
+    title: null,
+    translate: ["yes", "no"],
+    onclick: null,
+    rel: ["stylesheet", "alternate", "author", "bookmark", "help", "license", "next", "nofollow", "noreferrer", "prefetch", "prev", "search", "tag"]
+  };
+  function populate(obj) {
+    for (var attr in globalAttrs) if (globalAttrs.hasOwnProperty(attr))
+      obj.attrs[attr] = globalAttrs[attr];
+  }
+
+  populate(s);
+  for (var tag in data) if (data.hasOwnProperty(tag) && data[tag] != s)
+    populate(data[tag]);
+
+  CodeMirror.htmlSchema = data;
+  function htmlHint(cm, options) {
+    var local = {schemaInfo: data};
+    if (options) for (var opt in options) local[opt] = options[opt];
+    return CodeMirror.hint.xml(cm, local);
+  }
+  CodeMirror.registerHelper("hint", "html", htmlHint);
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/javascript-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,162 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+  var Pos = CodeMirror.Pos;
+
+  function forEach(arr, f) {
+    for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
+  }
+
+  function arrayContains(arr, item) {
+    if (!Array.prototype.indexOf) {
+      var i = arr.length;
+      while (i--) {
+        if (arr[i] === item) {
+          return true;
+        }
+      }
+      return false;
+    }
+    return arr.indexOf(item) != -1;
+  }
+
+  function scriptHint(editor, keywords, getToken, options) {
+    // Find the token at the cursor
+    var cur = editor.getCursor(), token = getToken(editor, cur);
+    if (/\b(?:string|comment)\b/.test(token.type)) return;
+    var innerMode = CodeMirror.innerMode(editor.getMode(), token.state);
+    if (innerMode.mode.helperType === "json") return;
+    token.state = innerMode.state;
+
+    // If it's not a 'word-style' token, ignore the token.
+    if (!/^[\w$_]*$/.test(token.string)) {
+      token = {start: cur.ch, end: cur.ch, string: "", state: token.state,
+               type: token.string == "." ? "property" : null};
+    } else if (token.end > cur.ch) {
+      token.end = cur.ch;
+      token.string = token.string.slice(0, cur.ch - token.start);
+    }
+
+    var tprop = token;
+    // If it is a property, find out what it is a property of.
+    while (tprop.type == "property") {
+      tprop = getToken(editor, Pos(cur.line, tprop.start));
+      if (tprop.string != ".") return;
+      tprop = getToken(editor, Pos(cur.line, tprop.start));
+      if (!context) var context = [];
+      context.push(tprop);
+    }
+    return {list: getCompletions(token, context, keywords, options),
+            from: Pos(cur.line, token.start),
+            to: Pos(cur.line, token.end)};
+  }
+
+  function javascriptHint(editor, options) {
+    return scriptHint(editor, javascriptKeywords,
+                      function (e, cur) {return e.getTokenAt(cur);},
+                      options);
+  };
+  CodeMirror.registerHelper("hint", "javascript", javascriptHint);
+
+  function getCoffeeScriptToken(editor, cur) {
+  // This getToken, it is for coffeescript, imitates the behavior of
+  // getTokenAt method in javascript.js, that is, returning "property"
+  // type and treat "." as independent token.
+    var token = editor.getTokenAt(cur);
+    if (cur.ch == token.start + 1 && token.string.charAt(0) == '.') {
+      token.end = token.start;
+      token.string = '.';
+      token.type = "property";
+    }
+    else if (/^\.[\w$_]*$/.test(token.string)) {
+      token.type = "property";
+      token.start++;
+      token.string = token.string.replace(/\./, '');
+    }
+    return token;
+  }
+
+  function coffeescriptHint(editor, options) {
+    return scriptHint(editor, coffeescriptKeywords, getCoffeeScriptToken, options);
+  }
+  CodeMirror.registerHelper("hint", "coffeescript", coffeescriptHint);
+
+  var stringProps = ("charAt charCodeAt indexOf lastIndexOf substring substr slice trim trimLeft trimRight " +
+                     "toUpperCase toLowerCase split concat match replace search").split(" ");
+  var arrayProps = ("length concat join splice push pop shift unshift slice reverse sort indexOf " +
+                    "lastIndexOf every some filter forEach map reduce reduceRight ").split(" ");
+  var funcProps = "prototype apply call bind".split(" ");
+  var javascriptKeywords = ("break case catch class const continue debugger default delete do else export extends false finally for function " +
+                  "if in import instanceof new null return super switch this throw true try typeof var void while with yield").split(" ");
+  var coffeescriptKeywords = ("and break catch class continue delete do else extends false finally for " +
+                  "if in instanceof isnt new no not null of off on or return switch then throw true try typeof until void while with yes").split(" ");
+
+  function forAllProps(obj, callback) {
+    if (!Object.getOwnPropertyNames || !Object.getPrototypeOf) {
+      for (var name in obj) callback(name)
+    } else {
+      for (var o = obj; o; o = Object.getPrototypeOf(o))
+        Object.getOwnPropertyNames(o).forEach(callback)
+    }
+  }
+
+  function getCompletions(token, context, keywords, options) {
+    var found = [], start = token.string, global = options && options.globalScope || window;
+    function maybeAdd(str) {
+      if (str.lastIndexOf(start, 0) == 0 && !arrayContains(found, str)) found.push(str);
+    }
+    function gatherCompletions(obj) {
+      if (typeof obj == "string") forEach(stringProps, maybeAdd);
+      else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
+      else if (obj instanceof Function) forEach(funcProps, maybeAdd);
+      forAllProps(obj, maybeAdd)
+    }
+
+    if (context && context.length) {
+      // If this is a property, see if it belongs to some object we can
+      // find in the current environment.
+      var obj = context.pop(), base;
+      if (obj.type && obj.type.indexOf("variable") === 0) {
+        if (options && options.additionalContext)
+          base = options.additionalContext[obj.string];
+        if (!options || options.useGlobalScope !== false)
+          base = base || global[obj.string];
+      } else if (obj.type == "string") {
+        base = "";
+      } else if (obj.type == "atom") {
+        base = 1;
+      } else if (obj.type == "function") {
+        if (global.jQuery != null && (obj.string == '$' || obj.string == 'jQuery') &&
+            (typeof global.jQuery == 'function'))
+          base = global.jQuery();
+        else if (global._ != null && (obj.string == '_') && (typeof global._ == 'function'))
+          base = global._();
+      }
+      while (base != null && context.length)
+        base = base[context.pop().string];
+      if (base != null) gatherCompletions(base);
+    } else {
+      // If not, just look in the global object, any local scope, and optional additional-context
+      // (reading into JS mode internals to get at the local and global variables)
+      for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
+      for (var c = token.state.context; c; c = c.prev)
+        for (var v = c.vars; v; v = v.next) maybeAdd(v.name)
+      for (var v = token.state.globalVars; v; v = v.next) maybeAdd(v.name);
+      if (options && options.additionalContext != null)
+        for (var key in options.additionalContext)
+          maybeAdd(key);
+      if (!options || options.useGlobalScope !== false)
+        gatherCompletions(global);
+      forEach(keywords, maybeAdd);
+    }
+    return found;
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/show-hint.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,37 @@
+.CodeMirror-hints {
+  position: absolute;
+  z-index: 10;
+  overflow: hidden;
+  list-style: none;
+
+  margin: 0;
+  padding: 2px;
+
+  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  border-radius: 3px;
+  border: 1px solid silver;
+
+  background: white;
+  font-size: 90%;
+  font-family: monospace;
+
+  max-height: 20em;
+  overflow-y: auto;
+  box-sizing: border-box;
+}
+
+.CodeMirror-hint {
+  margin: 0;
+  padding: 0 4px;
+  border-radius: 2px;
+  white-space: pre;
+  color: black;
+  cursor: pointer;
+}
+
+li.CodeMirror-hint-active {
+  background: #08f;
+  color: white;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/show-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,523 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// declare global: DOMRect
+
+(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";
+
+  var HINT_ELEMENT_CLASS        = "CodeMirror-hint";
+  var ACTIVE_HINT_ELEMENT_CLASS = "CodeMirror-hint-active";
+
+  // This is the old interface, kept around for now to stay
+  // backwards-compatible.
+  CodeMirror.showHint = function(cm, getHints, options) {
+    if (!getHints) return cm.showHint(options);
+    if (options && options.async) getHints.async = true;
+    var newOpts = {hint: getHints};
+    if (options) for (var prop in options) newOpts[prop] = options[prop];
+    return cm.showHint(newOpts);
+  };
+
+  CodeMirror.defineExtension("showHint", function(options) {
+    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);
+    if (!completion.options.hint) return;
+
+    CodeMirror.signal(this, "startCompletion", this);
+    completion.update(true);
+  });
+
+  CodeMirror.defineExtension("closeHint", function() {
+    if (this.state.completionActive) this.state.completionActive.close()
+  })
+
+  function Completion(cm, options) {
+    this.cm = cm;
+    this.options = options;
+    this.widget = null;
+    this.debounce = 0;
+    this.tick = 0;
+    this.startPos = this.cm.getCursor("start");
+    this.startLen = this.cm.getLine(this.startPos.line).length - this.cm.getSelection().length;
+
+    if (this.options.updateOnCursorActivity) {
+      var self = this;
+      cm.on("cursorActivity", this.activityFunc = function() { self.cursorActivity(); });
+    }
+  }
+
+  var requestAnimationFrame = window.requestAnimationFrame || function(fn) {
+    return setTimeout(fn, 1000/60);
+  };
+  var cancelAnimationFrame = window.cancelAnimationFrame || clearTimeout;
+
+  Completion.prototype = {
+    close: function() {
+      if (!this.active()) return;
+      this.cm.state.completionActive = null;
+      this.tick = null;
+      if (this.options.updateOnCursorActivity) {
+        this.cm.off("cursorActivity", this.activityFunc);
+      }
+
+      if (this.widget && this.data) CodeMirror.signal(this.data, "close");
+      if (this.widget) this.widget.close();
+      CodeMirror.signal(this.cm, "endCompletion", this.cm);
+    },
+
+    active: function() {
+      return this.cm.state.completionActive == this;
+    },
+
+    pick: function(data, i) {
+      var completion = data.list[i], self = this;
+      this.cm.operation(function() {
+        if (completion.hint)
+          completion.hint(self.cm, data, completion);
+        else
+          self.cm.replaceRange(getText(completion), completion.from || data.from,
+                               completion.to || data.to, "complete");
+        CodeMirror.signal(data, "pick", completion);
+        self.cm.scrollIntoView();
+      });
+      if (this.options.closeOnPick) {
+        this.close();
+      }
+    },
+
+    cursorActivity: function() {
+      if (this.debounce) {
+        cancelAnimationFrame(this.debounce);
+        this.debounce = 0;
+      }
+
+      var identStart = this.startPos;
+      if(this.data) {
+        identStart = this.data.from;
+      }
+
+      var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
+      if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
+          pos.ch < identStart.ch || this.cm.somethingSelected() ||
+          (!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
+        this.close();
+      } else {
+        var self = this;
+        this.debounce = requestAnimationFrame(function() {self.update();});
+        if (this.widget) this.widget.disable();
+      }
+    },
+
+    update: function(first) {
+      if (this.tick == null) return
+      var self = this, myTick = ++this.tick
+      fetchHints(this.options.hint, this.cm, this.options, function(data) {
+        if (self.tick == myTick) self.finishUpdate(data, first)
+      })
+    },
+
+    finishUpdate: function(data, first) {
+      if (this.data) CodeMirror.signal(this.data, "update");
+
+      var picked = (this.widget && this.widget.picked) || (first && this.options.completeSingle);
+      if (this.widget) this.widget.close();
+
+      this.data = data;
+
+      if (data && data.list.length) {
+        if (picked && data.list.length == 1) {
+          this.pick(data, 0);
+        } else {
+          this.widget = new Widget(this, data);
+          CodeMirror.signal(data, "shown");
+        }
+      }
+    }
+  };
+
+  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;
+  }
+
+  function buildKeyMap(completion, handle) {
+    var baseMap = {
+      Up: function() {handle.moveFocus(-1);},
+      Down: function() {handle.moveFocus(1);},
+      PageUp: function() {handle.moveFocus(-handle.menuSize() + 1, true);},
+      PageDown: function() {handle.moveFocus(handle.menuSize() - 1, true);},
+      Home: function() {handle.setFocus(0);},
+      End: function() {handle.setFocus(handle.length - 1);},
+      Enter: handle.pick,
+      Tab: handle.pick,
+      Esc: handle.close
+    };
+
+    var mac = /Mac/.test(navigator.platform);
+
+    if (mac) {
+      baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
+      baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};
+    }
+
+    var custom = completion.options.customKeys;
+    var ourMap = custom ? {} : baseMap;
+    function addBinding(key, val) {
+      var bound;
+      if (typeof val != "string")
+        bound = function(cm) { return val(cm, handle); };
+      // This mechanism is deprecated
+      else if (baseMap.hasOwnProperty(val))
+        bound = baseMap[val];
+      else
+        bound = val;
+      ourMap[key] = bound;
+    }
+    if (custom)
+      for (var key in custom) if (custom.hasOwnProperty(key))
+        addBinding(key, custom[key]);
+    var extra = completion.options.extraKeys;
+    if (extra)
+      for (var key in extra) if (extra.hasOwnProperty(key))
+        addBinding(key, extra[key]);
+    return ourMap;
+  }
+
+  function getHintElement(hintsElement, el) {
+    while (el && el != hintsElement) {
+      if (el.nodeName.toUpperCase() === "LI" && el.parentNode == hintsElement) return el;
+      el = el.parentNode;
+    }
+  }
+
+  function Widget(completion, data) {
+    this.id = "cm-complete-" + Math.floor(Math.random(1e6))
+    this.completion = completion;
+    this.data = data;
+    this.picked = false;
+    var widget = this, cm = completion.cm;
+    var ownerDocument = cm.getInputField().ownerDocument;
+    var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow;
+
+    var hints = this.hints = ownerDocument.createElement("ul");
+    hints.setAttribute("role", "listbox")
+    hints.setAttribute("aria-expanded", "true")
+    hints.id = this.id
+    var theme = completion.cm.options.theme;
+    hints.className = "CodeMirror-hints " + theme;
+    this.selectedHint = data.selectedHint || 0;
+
+    var completions = data.list;
+    for (var i = 0; i < completions.length; ++i) {
+      var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i];
+      var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
+      if (cur.className != null) className = cur.className + " " + className;
+      elt.className = className;
+      if (i == this.selectedHint) elt.setAttribute("aria-selected", "true")
+      elt.id = this.id + "-" + i
+      elt.setAttribute("role", "option")
+      if (cur.render) cur.render(elt, data, cur);
+      else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur)));
+      elt.hintId = i;
+    }
+
+    var container = completion.options.container || ownerDocument.body;
+    var pos = cm.cursorCoords(completion.options.alignWithWord ? data.from : null);
+    var left = pos.left, top = pos.bottom, below = true;
+    var offsetLeft = 0, offsetTop = 0;
+    if (container !== ownerDocument.body) {
+      // We offset the cursor position because left and top are relative to the offsetParent's top left corner.
+      var isContainerPositioned = ['absolute', 'relative', 'fixed'].indexOf(parentWindow.getComputedStyle(container).position) !== -1;
+      var offsetParent = isContainerPositioned ? container : container.offsetParent;
+      var offsetParentPosition = offsetParent.getBoundingClientRect();
+      var bodyPosition = ownerDocument.body.getBoundingClientRect();
+      offsetLeft = (offsetParentPosition.left - bodyPosition.left - offsetParent.scrollLeft);
+      offsetTop = (offsetParentPosition.top - bodyPosition.top - offsetParent.scrollTop);
+    }
+    hints.style.left = (left - offsetLeft) + "px";
+    hints.style.top = (top - offsetTop) + "px";
+
+    // If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
+    var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
+    var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
+    container.appendChild(hints);
+    cm.getInputField().setAttribute("aria-autocomplete", "list")
+    cm.getInputField().setAttribute("aria-owns", this.id)
+    cm.getInputField().setAttribute("aria-activedescendant", this.id + "-" + this.selectedHint)
+
+    var box = completion.options.moveOnOverlap ? hints.getBoundingClientRect() : new DOMRect();
+    var scrolls = completion.options.paddingForScrollbar ? hints.scrollHeight > hints.clientHeight + 1 : false;
+
+    // Compute in the timeout to avoid reflow on init
+    var startScroll;
+    setTimeout(function() { startScroll = cm.getScrollInfo(); });
+
+    var overlapY = box.bottom - winH;
+    if (overlapY > 0) { // Does not fit below
+      var height = box.bottom - box.top, spaceAbove = box.top - (pos.bottom - pos.top) - 2
+      if (winH - box.top < spaceAbove) { // More room at the top
+        if (height > spaceAbove) hints.style.height = (height = spaceAbove) + "px";
+        hints.style.top = ((top = pos.top - height) + offsetTop) + "px";
+        below = false;
+      } else {
+        hints.style.height = (winH - box.top - 2) + "px";
+      }
+    }
+    var overlapX = box.right - winW;
+    if (scrolls) overlapX += cm.display.nativeBarWidth;
+    if (overlapX > 0) {
+      if (box.right - box.left > winW) {
+        hints.style.width = (winW - 5) + "px";
+        overlapX -= (box.right - box.left) - winW;
+      }
+      hints.style.left = (left = Math.max(pos.left - overlapX - offsetLeft, 0)) + "px";
+    }
+    if (scrolls) for (var node = hints.firstChild; node; node = node.nextSibling)
+      node.style.paddingRight = cm.display.nativeBarWidth + "px"
+
+    cm.addKeyMap(this.keyMap = buildKeyMap(completion, {
+      moveFocus: function(n, avoidWrap) { widget.changeActive(widget.selectedHint + n, avoidWrap); },
+      setFocus: function(n) { widget.changeActive(n); },
+      menuSize: function() { return widget.screenAmount(); },
+      length: completions.length,
+      close: function() { completion.close(); },
+      pick: function() { widget.pick(); },
+      data: data
+    }));
+
+    if (completion.options.closeOnUnfocus) {
+      var closingOnBlur;
+      cm.on("blur", this.onBlur = function() { closingOnBlur = setTimeout(function() { completion.close(); }, 100); });
+      cm.on("focus", this.onFocus = function() { clearTimeout(closingOnBlur); });
+    }
+
+    cm.on("scroll", this.onScroll = function() {
+      var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
+      if (!startScroll) startScroll = cm.getScrollInfo();
+      var newTop = top + startScroll.top - curScroll.top;
+      var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop);
+      if (!below) point += hints.offsetHeight;
+      if (point <= editor.top || point >= editor.bottom) return completion.close();
+      hints.style.top = newTop + "px";
+      hints.style.left = (left + startScroll.left - curScroll.left) + "px";
+    });
+
+    CodeMirror.on(hints, "dblclick", function(e) {
+      var t = getHintElement(hints, e.target || e.srcElement);
+      if (t && t.hintId != null) {widget.changeActive(t.hintId); widget.pick();}
+    });
+
+    CodeMirror.on(hints, "click", function(e) {
+      var t = getHintElement(hints, e.target || e.srcElement);
+      if (t && t.hintId != null) {
+        widget.changeActive(t.hintId);
+        if (completion.options.completeOnSingleClick) widget.pick();
+      }
+    });
+
+    CodeMirror.on(hints, "mousedown", function() {
+      setTimeout(function(){cm.focus();}, 20);
+    });
+
+    // The first hint doesn't need to be scrolled to on init
+    var selectedHintRange = this.getSelectedHintRange();
+    if (selectedHintRange.from !== 0 || selectedHintRange.to !== 0) {
+      this.scrollToActive();
+    }
+
+    CodeMirror.signal(data, "select", completions[this.selectedHint], hints.childNodes[this.selectedHint]);
+    return true;
+  }
+
+  Widget.prototype = {
+    close: function() {
+      if (this.completion.widget != this) return;
+      this.completion.widget = null;
+      if (this.hints.parentNode) this.hints.parentNode.removeChild(this.hints);
+      this.completion.cm.removeKeyMap(this.keyMap);
+      var input = this.completion.cm.getInputField()
+      input.removeAttribute("aria-activedescendant")
+      input.removeAttribute("aria-owns")
+
+      var cm = this.completion.cm;
+      if (this.completion.options.closeOnUnfocus) {
+        cm.off("blur", this.onBlur);
+        cm.off("focus", this.onFocus);
+      }
+      cm.off("scroll", this.onScroll);
+    },
+
+    disable: function() {
+      this.completion.cm.removeKeyMap(this.keyMap);
+      var widget = this;
+      this.keyMap = {Enter: function() { widget.picked = true; }};
+      this.completion.cm.addKeyMap(this.keyMap);
+    },
+
+    pick: function() {
+      this.completion.pick(this.data, this.selectedHint);
+    },
+
+    changeActive: function(i, avoidWrap) {
+      if (i >= this.data.list.length)
+        i = avoidWrap ? this.data.list.length - 1 : 0;
+      else if (i < 0)
+        i = avoidWrap ? 0  : this.data.list.length - 1;
+      if (this.selectedHint == i) return;
+      var node = this.hints.childNodes[this.selectedHint];
+      if (node) {
+        node.className = node.className.replace(" " + ACTIVE_HINT_ELEMENT_CLASS, "");
+        node.removeAttribute("aria-selected")
+      }
+      node = this.hints.childNodes[this.selectedHint = i];
+      node.className += " " + ACTIVE_HINT_ELEMENT_CLASS;
+      node.setAttribute("aria-selected", "true")
+      this.completion.cm.getInputField().setAttribute("aria-activedescendant", node.id)
+      this.scrollToActive()
+      CodeMirror.signal(this.data, "select", this.data.list[this.selectedHint], node);
+    },
+
+    scrollToActive: function() {
+      var selectedHintRange = this.getSelectedHintRange();
+      var node1 = this.hints.childNodes[selectedHintRange.from];
+      var node2 = this.hints.childNodes[selectedHintRange.to];
+      var firstNode = this.hints.firstChild;
+      if (node1.offsetTop < this.hints.scrollTop)
+        this.hints.scrollTop = node1.offsetTop - firstNode.offsetTop;
+      else if (node2.offsetTop + node2.offsetHeight > this.hints.scrollTop + this.hints.clientHeight)
+        this.hints.scrollTop = node2.offsetTop + node2.offsetHeight - this.hints.clientHeight + firstNode.offsetTop;
+    },
+
+    screenAmount: function() {
+      return Math.floor(this.hints.clientHeight / this.hints.firstChild.offsetHeight) || 1;
+    },
+
+    getSelectedHintRange: function() {
+      var margin = this.completion.options.scrollMargin || 0;
+      return {
+        from: Math.max(0, this.selectedHint - margin),
+        to: Math.min(this.data.list.length - 1, this.selectedHint + margin),
+      };
+    }
+  };
+
+  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 fetchHints(hint, cm, options, callback) {
+    if (hint.async) {
+      hint(cm, callback, options)
+    } else {
+      var result = hint(cm, options)
+      if (result && result.then) result.then(callback)
+      else callback(result)
+    }
+  }
+
+  function resolveAutoHints(cm, pos) {
+    var helpers = cm.getHelpers(pos, "hint"), words
+    if (helpers.length) {
+      var resolved = function(cm, callback, options) {
+        var app = applicableHelpers(cm, helpers);
+        function run(i) {
+          if (i == app.length) return callback(null)
+          fetchHints(app[i], cm, options, function(result) {
+            if (result && result.list.length > 0) callback(result)
+            else run(i + 1)
+          })
+        }
+        run(0)
+      }
+      resolved.async = true
+      resolved.supportsSelection = true
+      return resolved
+    } else if (words = cm.getHelper(cm.getCursor(), "hintWords")) {
+      return function(cm) { return CodeMirror.hint.fromList(cm, {words: words}) }
+    } else if (CodeMirror.hint.anyword) {
+      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 term, from = CodeMirror.Pos(cur.line, token.start), to = cur
+    if (token.start < cur.ch && /\w/.test(token.string.charAt(cur.ch - token.start - 1))) {
+      term = token.string.substr(0, cur.ch - token.start)
+    } else {
+      term = ""
+      from = cur
+    }
+    var found = [];
+    for (var i = 0; i < options.words.length; i++) {
+      var word = options.words[i];
+      if (word.slice(0, term.length) == term)
+        found.push(word);
+    }
+
+    if (found.length) return {list: found, from: from, to: to};
+  });
+
+  CodeMirror.commands.autocomplete = CodeMirror.showHint;
+
+  var defaultOptions = {
+    hint: CodeMirror.hint.auto,
+    completeSingle: true,
+    alignWithWord: true,
+    closeCharacters: /[\s()\[\]{};:>,]/,
+    closeOnPick: true,
+    closeOnUnfocus: true,
+    updateOnCursorActivity: true,
+    completeOnSingleClick: true,
+    container: null,
+    customKeys: null,
+    extraKeys: null,
+    paddingForScrollbar: true,
+    moveOnOverlap: true,
+  };
+
+  CodeMirror.defineOption("hintOptions", null);
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/sql-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,304 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../mode/sql/sql"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../mode/sql/sql"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var tables;
+  var defaultTable;
+  var keywords;
+  var identifierQuote;
+  var CONS = {
+    QUERY_DIV: ";",
+    ALIAS_KEYWORD: "AS"
+  };
+  var Pos = CodeMirror.Pos, cmpPos = CodeMirror.cmpPos;
+
+  function isArray(val) { return Object.prototype.toString.call(val) == "[object Array]" }
+
+  function getModeConf(editor, field) {
+    return editor.getModeAt(editor.getCursor()).config[field] || CodeMirror.resolveMode("text/x-sql")[field]
+  }
+
+  function getKeywords(editor) {
+    return getModeConf(editor, "keywords") || []
+  }
+
+  function getIdentifierQuote(editor) {
+    return getModeConf(editor, "identifierQuote") || "`";
+  }
+
+  function getText(item) {
+    return typeof item == "string" ? item : item.text;
+  }
+
+  function wrapTable(name, value) {
+    if (isArray(value)) value = {columns: value}
+    if (!value.text) value.text = name
+    return value
+  }
+
+  function parseTables(input) {
+    var result = {}
+    if (isArray(input)) {
+      for (var i = input.length - 1; i >= 0; i--) {
+        var item = input[i]
+        result[getText(item).toUpperCase()] = wrapTable(getText(item), item)
+      }
+    } else if (input) {
+      for (var name in input)
+        result[name.toUpperCase()] = wrapTable(name, input[name])
+    }
+    return result
+  }
+
+  function getTable(name) {
+    return tables[name.toUpperCase()]
+  }
+
+  function shallowClone(object) {
+    var result = {};
+    for (var key in object) if (object.hasOwnProperty(key))
+      result[key] = object[key];
+    return result;
+  }
+
+  function match(string, word) {
+    var len = string.length;
+    var sub = getText(word).substr(0, len);
+    return string.toUpperCase() === sub.toUpperCase();
+  }
+
+  function addMatches(result, search, wordlist, formatter) {
+    if (isArray(wordlist)) {
+      for (var i = 0; i < wordlist.length; i++)
+        if (match(search, wordlist[i])) result.push(formatter(wordlist[i]))
+    } else {
+      for (var word in wordlist) if (wordlist.hasOwnProperty(word)) {
+        var val = wordlist[word]
+        if (!val || val === true)
+          val = word
+        else
+          val = val.displayText ? {text: val.text, displayText: val.displayText} : val.text
+        if (match(search, val)) result.push(formatter(val))
+      }
+    }
+  }
+
+  function cleanName(name) {
+    // Get rid name from identifierQuote and preceding dot(.)
+    if (name.charAt(0) == ".") {
+      name = name.substr(1);
+    }
+    // replace duplicated identifierQuotes with single identifierQuotes
+    // and remove single identifierQuotes
+    var nameParts = name.split(identifierQuote+identifierQuote);
+    for (var i = 0; i < nameParts.length; i++)
+      nameParts[i] = nameParts[i].replace(new RegExp(identifierQuote,"g"), "");
+    return nameParts.join(identifierQuote);
+  }
+
+  function insertIdentifierQuotes(name) {
+    var nameParts = getText(name).split(".");
+    for (var i = 0; i < nameParts.length; i++)
+      nameParts[i] = identifierQuote +
+      // duplicate identifierQuotes
+    nameParts[i].replace(new RegExp(identifierQuote,"g"), identifierQuote+identifierQuote) +
+      identifierQuote;
+    var escaped = nameParts.join(".");
+    if (typeof name == "string") return escaped;
+    name = shallowClone(name);
+    name.text = escaped;
+    return name;
+  }
+
+  function nameCompletion(cur, token, result, editor) {
+    // Try to complete table, column names and return start position of completion
+    var useIdentifierQuotes = false;
+    var nameParts = [];
+    var start = token.start;
+    var cont = true;
+    while (cont) {
+      cont = (token.string.charAt(0) == ".");
+      useIdentifierQuotes = useIdentifierQuotes || (token.string.charAt(0) == identifierQuote);
+
+      start = token.start;
+      nameParts.unshift(cleanName(token.string));
+
+      token = editor.getTokenAt(Pos(cur.line, token.start));
+      if (token.string == ".") {
+        cont = true;
+        token = editor.getTokenAt(Pos(cur.line, token.start));
+      }
+    }
+
+    // Try to complete table names
+    var string = nameParts.join(".");
+    addMatches(result, string, tables, function(w) {
+      return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
+    });
+
+    // Try to complete columns from defaultTable
+    addMatches(result, string, defaultTable, function(w) {
+      return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
+    });
+
+    // Try to complete columns
+    string = nameParts.pop();
+    var table = nameParts.join(".");
+
+    var alias = false;
+    var aliasTable = table;
+    // Check if table is available. If not, find table by Alias
+    if (!getTable(table)) {
+      var oldTable = table;
+      table = findTableByAlias(table, editor);
+      if (table !== oldTable) alias = true;
+    }
+
+    var columns = getTable(table);
+    if (columns && columns.columns)
+      columns = columns.columns;
+
+    if (columns) {
+      addMatches(result, string, columns, function(w) {
+        var tableInsert = table;
+        if (alias == true) tableInsert = aliasTable;
+        if (typeof w == "string") {
+          w = tableInsert + "." + w;
+        } else {
+          w = shallowClone(w);
+          w.text = tableInsert + "." + w.text;
+        }
+        return useIdentifierQuotes ? insertIdentifierQuotes(w) : w;
+      });
+    }
+
+    return start;
+  }
+
+  function eachWord(lineText, f) {
+    var words = lineText.split(/\s+/)
+    for (var i = 0; i < words.length; i++)
+      if (words[i]) f(words[i].replace(/[`,;]/g, ''))
+  }
+
+  function findTableByAlias(alias, editor) {
+    var doc = editor.doc;
+    var fullQuery = doc.getValue();
+    var aliasUpperCase = alias.toUpperCase();
+    var previousWord = "";
+    var table = "";
+    var separator = [];
+    var validRange = {
+      start: Pos(0, 0),
+      end: Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).length)
+    };
+
+    //add separator
+    var indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV);
+    while(indexOfSeparator != -1) {
+      separator.push(doc.posFromIndex(indexOfSeparator));
+      indexOfSeparator = fullQuery.indexOf(CONS.QUERY_DIV, indexOfSeparator+1);
+    }
+    separator.unshift(Pos(0, 0));
+    separator.push(Pos(editor.lastLine(), editor.getLineHandle(editor.lastLine()).text.length));
+
+    //find valid range
+    var prevItem = null;
+    var current = editor.getCursor()
+    for (var i = 0; i < separator.length; i++) {
+      if ((prevItem == null || cmpPos(current, prevItem) > 0) && cmpPos(current, separator[i]) <= 0) {
+        validRange = {start: prevItem, end: separator[i]};
+        break;
+      }
+      prevItem = separator[i];
+    }
+
+    if (validRange.start) {
+      var query = doc.getRange(validRange.start, validRange.end, false);
+
+      for (var i = 0; i < query.length; i++) {
+        var lineText = query[i];
+        eachWord(lineText, function(word) {
+          var wordUpperCase = word.toUpperCase();
+          if (wordUpperCase === aliasUpperCase && getTable(previousWord))
+            table = previousWord;
+          if (wordUpperCase !== CONS.ALIAS_KEYWORD)
+            previousWord = word;
+        });
+        if (table) break;
+      }
+    }
+    return table;
+  }
+
+  CodeMirror.registerHelper("hint", "sql", function(editor, options) {
+    tables = parseTables(options && options.tables)
+    var defaultTableName = options && options.defaultTable;
+    var disableKeywords = options && options.disableKeywords;
+    defaultTable = defaultTableName && getTable(defaultTableName);
+    keywords = getKeywords(editor);
+    identifierQuote = getIdentifierQuote(editor);
+
+    if (defaultTableName && !defaultTable)
+      defaultTable = findTableByAlias(defaultTableName, editor);
+
+    defaultTable = defaultTable || [];
+
+    if (defaultTable.columns)
+      defaultTable = defaultTable.columns;
+
+    var cur = editor.getCursor();
+    var result = [];
+    var token = editor.getTokenAt(cur), start, end, search;
+    if (token.end > cur.ch) {
+      token.end = cur.ch;
+      token.string = token.string.slice(0, cur.ch - token.start);
+    }
+
+    if (token.string.match(/^[.`"'\w@][\w$#]*$/g)) {
+      search = token.string;
+      start = token.start;
+      end = token.end;
+    } else {
+      start = end = cur.ch;
+      search = "";
+    }
+    if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
+      start = nameCompletion(cur, token, result, editor);
+    } else {
+      var objectOrClass = function(w, className) {
+        if (typeof w === "object") {
+          w.className = className;
+        } else {
+          w = { text: w, className: className };
+        }
+        return w;
+      };
+      addMatches(result, search, defaultTable, function(w) {
+        return objectOrClass(w, "CodeMirror-hint-table CodeMirror-hint-default-table");
+      });
+      addMatches(
+        result,
+        search,
+        tables, function(w) {
+          return objectOrClass(w, "CodeMirror-hint-table");
+        }
+      );
+      if (!disableKeywords)
+        addMatches(result, search, keywords, function(w) {
+          return objectOrClass(w.toUpperCase(), "CodeMirror-hint-keyword");
+        });
+    }
+
+    return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/hint/xml-hint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,132 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var Pos = CodeMirror.Pos;
+
+  function matches(hint, typed, matchInMiddle) {
+    if (matchInMiddle) return hint.indexOf(typed) >= 0;
+    else return hint.lastIndexOf(typed, 0) == 0;
+  }
+
+  function getHints(cm, options) {
+    var tags = options && options.schemaInfo;
+    var quote = (options && options.quoteChar) || '"';
+    var matchInMiddle = options && options.matchInMiddle;
+    if (!tags) return;
+    var cur = cm.getCursor(), token = cm.getTokenAt(cur);
+    if (token.end > cur.ch) {
+      token.end = cur.ch;
+      token.string = token.string.slice(0, cur.ch - token.start);
+    }
+    var inner = CodeMirror.innerMode(cm.getMode(), token.state);
+    if (!inner.mode.xmlCurrentTag) return
+    var result = [], replaceToken = false, prefix;
+    var tag = /\btag\b/.test(token.type) && !/>$/.test(token.string);
+    var tagName = tag && /^\w/.test(token.string), tagStart;
+
+    if (tagName) {
+      var before = cm.getLine(cur.line).slice(Math.max(0, token.start - 2), token.start);
+      var tagType = /<\/$/.test(before) ? "close" : /<$/.test(before) ? "open" : null;
+      if (tagType) tagStart = token.start - (tagType == "close" ? 2 : 1);
+    } else if (tag && token.string == "<") {
+      tagType = "open";
+    } else if (tag && token.string == "</") {
+      tagType = "close";
+    }
+
+    var tagInfo = inner.mode.xmlCurrentTag(inner.state)
+    if (!tag && !tagInfo || tagType) {
+      if (tagName)
+        prefix = token.string;
+      replaceToken = tagType;
+      var context = inner.mode.xmlCurrentContext ? inner.mode.xmlCurrentContext(inner.state) : []
+      var inner = context.length && context[context.length - 1]
+      var curTag = inner && tags[inner]
+      var childList = inner ? curTag && curTag.children : tags["!top"];
+      if (childList && tagType != "close") {
+        for (var i = 0; i < childList.length; ++i) if (!prefix || matches(childList[i], prefix, matchInMiddle))
+          result.push("<" + childList[i]);
+      } else if (tagType != "close") {
+        for (var name in tags)
+          if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || matches(name, prefix, matchInMiddle)))
+            result.push("<" + name);
+      }
+      if (inner && (!prefix || tagType == "close" && matches(inner, prefix, matchInMiddle)))
+        result.push("</" + inner + ">");
+    } else {
+      // Attribute completion
+      var curTag = tagInfo && tags[tagInfo.name], attrs = curTag && curTag.attrs;
+      var globalAttrs = tags["!attrs"];
+      if (!attrs && !globalAttrs) return;
+      if (!attrs) {
+        attrs = globalAttrs;
+      } else if (globalAttrs) { // Combine tag-local and global attributes
+        var set = {};
+        for (var nm in globalAttrs) if (globalAttrs.hasOwnProperty(nm)) set[nm] = globalAttrs[nm];
+        for (var nm in attrs) if (attrs.hasOwnProperty(nm)) set[nm] = attrs[nm];
+        attrs = set;
+      }
+      if (token.type == "string" || token.string == "=") { // A value
+        var before = cm.getRange(Pos(cur.line, Math.max(0, cur.ch - 60)),
+                                 Pos(cur.line, token.type == "string" ? token.start : token.end));
+        var atName = before.match(/([^\s\u00a0=<>\"\']+)=$/), atValues;
+        if (!atName || !attrs.hasOwnProperty(atName[1]) || !(atValues = attrs[atName[1]])) return;
+        if (typeof atValues == 'function') atValues = atValues.call(this, cm); // Functions can be used to supply values for autocomplete widget
+        if (token.type == "string") {
+          prefix = token.string;
+          var n = 0;
+          if (/['"]/.test(token.string.charAt(0))) {
+            quote = token.string.charAt(0);
+            prefix = token.string.slice(1);
+            n++;
+          }
+          var len = token.string.length;
+          if (/['"]/.test(token.string.charAt(len - 1))) {
+            quote = token.string.charAt(len - 1);
+            prefix = token.string.substr(n, len - 2);
+          }
+          if (n) { // an opening quote
+            var line = cm.getLine(cur.line);
+            if (line.length > token.end && line.charAt(token.end) == quote) token.end++; // include a closing quote
+          }
+          replaceToken = true;
+        }
+        var returnHintsFromAtValues = function(atValues) {
+          if (atValues)
+            for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle))
+              result.push(quote + atValues[i] + quote);
+          return returnHints();
+        };
+        if (atValues && atValues.then) return atValues.then(returnHintsFromAtValues);
+        return returnHintsFromAtValues(atValues);
+      } else { // An attribute name
+        if (token.type == "attribute") {
+          prefix = token.string;
+          replaceToken = true;
+        }
+        for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || matches(attr, prefix, matchInMiddle)))
+          result.push(attr);
+      }
+    }
+    function returnHints() {
+      return {
+        list: result,
+        from: replaceToken ? Pos(cur.line, tagStart == null ? token.start : tagStart) : cur,
+        to: replaceToken ? Pos(cur.line, token.end) : cur
+      };
+    }
+    return returnHints();
+  }
+
+  CodeMirror.registerHelper("hint", "xml", getHints);
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/coffeescript-lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,47 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
+
+// declare global: coffeelint
+
+(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.registerHelper("lint", "coffeescript", function(text) {
+  var found = [];
+  if (!window.coffeelint) {
+    if (window.console) {
+      window.console.error("Error: window.coffeelint not defined, CodeMirror CoffeeScript linting cannot run.");
+    }
+    return found;
+  }
+  var parseError = function(err) {
+    var loc = err.lineNumber;
+    found.push({from: CodeMirror.Pos(loc-1, 0),
+                to: CodeMirror.Pos(loc, 0),
+                severity: err.level,
+                message: err.message});
+  };
+  try {
+    var res = coffeelint.lint(text);
+    for(var i = 0; i < res.length; i++) {
+      parseError(res[i]);
+    }
+  } catch(e) {
+    found.push({from: CodeMirror.Pos(e.location.first_line, 0),
+                to: CodeMirror.Pos(e.location.last_line, e.location.last_column),
+                severity: 'error',
+                message: e.message});
+  }
+  return found;
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/css-lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,40 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Depends on csslint.js from https://github.com/stubbornella/csslint
+
+// declare global: CSSLint
+
+(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.registerHelper("lint", "css", function(text, options) {
+  var found = [];
+  if (!window.CSSLint) {
+    if (window.console) {
+        window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run.");
+    }
+    return found;
+  }
+  var results = CSSLint.verify(text, options), messages = results.messages, message = null;
+  for ( var i = 0; i < messages.length; i++) {
+    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;
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/html-lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,59 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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, window.HTMLHint);
+})(function(CodeMirror, HTMLHint) {
+  "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 (HTMLHint && !HTMLHint.verify) {
+      if(typeof HTMLHint.default !== 'undefined') {
+        HTMLHint = HTMLHint.default;
+      } else {
+        HTMLHint = HTMLHint.HTMLHint;
+      }
+    }
+    if (!HTMLHint) HTMLHint = window.HTMLHint;
+    if (!HTMLHint) {
+      if (window.console) {
+          window.console.error("Error: HTMLHint not found, not defined on window, or not available through define/require, CodeMirror HTML linting cannot run.");
+      }
+      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;
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/javascript-lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,65 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Depends on jshint.js from https://github.com/jshint/jshint
+
+(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";
+  // declare global: JSHINT
+
+  function validator(text, options) {
+    if (!window.JSHINT) {
+      if (window.console) {
+        window.console.error("Error: window.JSHINT not defined, CodeMirror JavaScript linting cannot run.");
+      }
+      return [];
+    }
+    if (!options.indent) // JSHint error.character actually is a column index, this fixes underlining on lines using tabs for indentation
+      options.indent = 1; // JSHint default value is 4
+    JSHINT(text, options, options.globals);
+    var errors = JSHINT.data().errors, result = [];
+    if (errors) parseErrors(errors, result);
+    return result;
+  }
+
+  CodeMirror.registerHelper("lint", "javascript", validator);
+
+  function parseErrors(errors, output) {
+    for ( var i = 0; i < errors.length; i++) {
+      var error = errors[i];
+      if (error) {
+        if (error.line <= 0) {
+          if (window.console) {
+            window.console.warn("Cannot display JSHint error (invalid line " + error.line + ")", error);
+          }
+          continue;
+        }
+
+        var start = error.character - 1, end = start + 1;
+        if (error.evidence) {
+          var index = error.evidence.substring(start).search(/.\b/);
+          if (index > -1) {
+            end += index;
+          }
+        }
+
+        // Convert to format expected by validation service
+        var hint = {
+          message: error.reason,
+          severity: error.code ? (error.code.startsWith('W') ? "warning" : "error") : "error",
+          from: CodeMirror.Pos(error.line - 1, start),
+          to: CodeMirror.Pos(error.line - 1, end)
+        };
+
+        output.push(hint);
+      }
+    }
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/json-lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,40 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Depends on jsonlint.js from https://github.com/zaach/jsonlint
+
+// declare global: jsonlint
+
+(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.registerHelper("lint", "json", function(text) {
+  var found = [];
+  if (!window.jsonlint) {
+    if (window.console) {
+      window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run.");
+    }
+    return found;
+  }
+  // for jsonlint's web dist jsonlint is exported as an object with a single property parser, of which parseError
+  // is a subproperty
+  var jsonlint = window.jsonlint.parser || window.jsonlint
+  jsonlint.parseError = function(str, hash) {
+    var loc = hash.loc;
+    found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column),
+                to: CodeMirror.Pos(loc.last_line - 1, loc.last_column),
+                message: str});
+  };
+  try { jsonlint.parse(text); }
+  catch(e) {}
+  return found;
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/lint.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,79 @@
+/* The lint marker gutter */
+.CodeMirror-lint-markers {
+  width: 16px;
+}
+
+.CodeMirror-lint-tooltip {
+  background-color: #ffd;
+  border: 1px solid black;
+  border-radius: 4px 4px 4px 4px;
+  color: black;
+  font-family: monospace;
+  font-size: 10pt;
+  overflow: hidden;
+  padding: 2px 5px;
+  position: fixed;
+  white-space: pre;
+  white-space: pre-wrap;
+  z-index: 100;
+  max-width: 600px;
+  opacity: 0;
+  transition: opacity .4s;
+  -moz-transition: opacity .4s;
+  -webkit-transition: opacity .4s;
+  -o-transition: opacity .4s;
+  -ms-transition: opacity .4s;
+}
+
+.CodeMirror-lint-mark {
+  background-position: left bottom;
+  background-repeat: repeat-x;
+}
+
+.CodeMirror-lint-mark-warning {
+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII=");
+}
+
+.CodeMirror-lint-mark-error {
+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==");
+}
+
+.CodeMirror-lint-marker {
+  background-position: center center;
+  background-repeat: no-repeat;
+  cursor: pointer;
+  display: inline-block;
+  height: 16px;
+  width: 16px;
+  vertical-align: middle;
+  position: relative;
+}
+
+.CodeMirror-lint-message {
+  padding-left: 18px;
+  background-position: top left;
+  background-repeat: no-repeat;
+}
+
+.CodeMirror-lint-marker-warning, .CodeMirror-lint-message-warning {
+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAANlBMVEX/uwDvrwD/uwD/uwD/uwD/uwD/uwD/uwD/uwD6twD/uwAAAADurwD2tQD7uAD+ugAAAAD/uwDhmeTRAAAADHRSTlMJ8mN1EYcbmiixgACm7WbuAAAAVklEQVR42n3PUQqAIBBFUU1LLc3u/jdbOJoW1P08DA9Gba8+YWJ6gNJoNYIBzAA2chBth5kLmG9YUoG0NHAUwFXwO9LuBQL1giCQb8gC9Oro2vp5rncCIY8L8uEx5ZkAAAAASUVORK5CYII=");
+}
+
+.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error {
+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII=");
+}
+
+.CodeMirror-lint-marker-multiple {
+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC");
+  background-repeat: no-repeat;
+  background-position: right bottom;
+  width: 100%; height: 100%;
+}
+
+.CodeMirror-lint-line-error {
+  background-color: rgba(183, 76, 81, 0.08);
+}
+
+.CodeMirror-lint-line-warning {
+  background-color: rgba(255, 211, 0, 0.1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,288 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+  var GUTTER_ID = "CodeMirror-lint-markers";
+  var LINT_LINE_ID = "CodeMirror-lint-line-";
+
+  function showTooltip(cm, e, content) {
+    var tt = document.createElement("div");
+    tt.className = "CodeMirror-lint-tooltip cm-s-" + cm.options.theme;
+    tt.appendChild(content.cloneNode(true));
+    if (cm.state.lint.options.selfContain)
+      cm.getWrapperElement().appendChild(tt);
+    else
+      document.body.appendChild(tt);
+
+    function position(e) {
+      if (!tt.parentNode) return CodeMirror.off(document, "mousemove", position);
+      var top = Math.max(0, e.clientY - tt.offsetHeight - 5);
+      var left = Math.max(0, Math.min(e.clientX + 5, tt.ownerDocument.defaultView.innerWidth - tt.offsetWidth));
+      tt.style.top = top + "px"
+      tt.style.left = left + "px";
+    }
+    CodeMirror.on(document, "mousemove", position);
+    position(e);
+    if (tt.style.opacity != null) tt.style.opacity = 1;
+    return tt;
+  }
+  function rm(elt) {
+    if (elt.parentNode) elt.parentNode.removeChild(elt);
+  }
+  function hideTooltip(tt) {
+    if (!tt.parentNode) return;
+    if (tt.style.opacity == null) rm(tt);
+    tt.style.opacity = 0;
+    setTimeout(function() { rm(tt); }, 600);
+  }
+
+  function showTooltipFor(cm, e, content, node) {
+    var tooltip = showTooltip(cm, e, content);
+    function hide() {
+      CodeMirror.off(node, "mouseout", hide);
+      if (tooltip) { hideTooltip(tooltip); tooltip = null; }
+    }
+    var poll = setInterval(function() {
+      if (tooltip) for (var n = node;; n = n.parentNode) {
+        if (n && n.nodeType == 11) n = n.host;
+        if (n == document.body) return;
+        if (!n) { hide(); break; }
+      }
+      if (!tooltip) return clearInterval(poll);
+    }, 400);
+    CodeMirror.on(node, "mouseout", hide);
+  }
+
+  function LintState(cm, conf, hasGutter) {
+    this.marked = [];
+    if (conf instanceof Function) conf = {getAnnotations: conf};
+    if (!conf || conf === true) conf = {};
+    this.options = {};
+    this.linterOptions = conf.options || {};
+    for (var prop in defaults) this.options[prop] = defaults[prop];
+    for (var prop in conf) {
+      if (defaults.hasOwnProperty(prop)) {
+        if (conf[prop] != null) this.options[prop] = conf[prop];
+      } else if (!conf.options) {
+        this.linterOptions[prop] = conf[prop];
+      }
+    }
+    this.timeout = null;
+    this.hasGutter = hasGutter;
+    this.onMouseOver = function(e) { onMouseOver(cm, e); };
+    this.waitingFor = 0
+  }
+
+  var defaults = {
+    highlightLines: false,
+    tooltips: true,
+    delay: 500,
+    lintOnChange: true,
+    getAnnotations: null,
+    async: false,
+    selfContain: null,
+    formatAnnotation: null,
+    onUpdateLinting: null
+  }
+
+  function clearMarks(cm) {
+    var state = cm.state.lint;
+    if (state.hasGutter) cm.clearGutter(GUTTER_ID);
+    if (state.options.highlightLines) clearErrorLines(cm);
+    for (var i = 0; i < state.marked.length; ++i)
+      state.marked[i].clear();
+    state.marked.length = 0;
+  }
+
+  function clearErrorLines(cm) {
+    cm.eachLine(function(line) {
+      var has = line.wrapClass && /\bCodeMirror-lint-line-\w+\b/.exec(line.wrapClass);
+      if (has) cm.removeLineClass(line, "wrap", has[0]);
+    })
+  }
+
+  function makeMarker(cm, labels, severity, multiple, tooltips) {
+    var marker = document.createElement("div"), inner = marker;
+    marker.className = "CodeMirror-lint-marker CodeMirror-lint-marker-" + severity;
+    if (multiple) {
+      inner = marker.appendChild(document.createElement("div"));
+      inner.className = "CodeMirror-lint-marker CodeMirror-lint-marker-multiple";
+    }
+
+    if (tooltips != false) CodeMirror.on(inner, "mouseover", function(e) {
+      showTooltipFor(cm, e, labels, inner);
+    });
+
+    return marker;
+  }
+
+  function getMaxSeverity(a, b) {
+    if (a == "error") return a;
+    else return b;
+  }
+
+  function groupByLine(annotations) {
+    var lines = [];
+    for (var i = 0; i < annotations.length; ++i) {
+      var ann = annotations[i], line = ann.from.line;
+      (lines[line] || (lines[line] = [])).push(ann);
+    }
+    return lines;
+  }
+
+  function annotationTooltip(ann) {
+    var severity = ann.severity;
+    if (!severity) severity = "error";
+    var tip = document.createElement("div");
+    tip.className = "CodeMirror-lint-message CodeMirror-lint-message-" + severity;
+    if (typeof ann.messageHTML != 'undefined') {
+      tip.innerHTML = ann.messageHTML;
+    } else {
+      tip.appendChild(document.createTextNode(ann.message));
+    }
+    return tip;
+  }
+
+  function lintAsync(cm, getAnnotations) {
+    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
+      cm.operation(function() {updateLinting(cm, annotations)})
+    }, state.linterOptions, cm);
+  }
+
+  function startLinting(cm) {
+    var state = cm.state.lint;
+    if (!state) return;
+    var options = state.options;
+    /*
+     * Passing rules in `options` property prevents JSHint (and other linters) from complaining
+     * about unrecognized rules like `onUpdateLinting`, `delay`, `lintOnChange`, etc.
+     */
+    var getAnnotations = options.getAnnotations || cm.getHelper(CodeMirror.Pos(0, 0), "lint");
+    if (!getAnnotations) return;
+    if (options.async || getAnnotations.async) {
+      lintAsync(cm, getAnnotations)
+    } else {
+      var annotations = getAnnotations(cm.getValue(), state.linterOptions, cm);
+      if (!annotations) return;
+      if (annotations.then) annotations.then(function(issues) {
+        cm.operation(function() {updateLinting(cm, issues)})
+      });
+      else cm.operation(function() {updateLinting(cm, annotations)})
+    }
+  }
+
+  function updateLinting(cm, annotationsNotSorted) {
+    var state = cm.state.lint;
+    if (!state) return;
+    var options = state.options;
+    clearMarks(cm);
+
+    var annotations = groupByLine(annotationsNotSorted);
+
+    for (var line = 0; line < annotations.length; ++line) {
+      var anns = annotations[line];
+      if (!anns) continue;
+
+      var maxSeverity = null;
+      var tipLabel = state.hasGutter && document.createDocumentFragment();
+
+      for (var i = 0; i < anns.length; ++i) {
+        var ann = anns[i];
+        var severity = ann.severity;
+        if (!severity) severity = "error";
+        maxSeverity = getMaxSeverity(maxSeverity, severity);
+
+        if (options.formatAnnotation) ann = options.formatAnnotation(ann);
+        if (state.hasGutter) tipLabel.appendChild(annotationTooltip(ann));
+
+        if (ann.to) state.marked.push(cm.markText(ann.from, ann.to, {
+          className: "CodeMirror-lint-mark CodeMirror-lint-mark-" + severity,
+          __annotation: ann
+        }));
+      }
+      if (state.hasGutter)
+        cm.setGutterMarker(line, GUTTER_ID, makeMarker(cm, tipLabel, maxSeverity, anns.length > 1,
+                                                       options.tooltips));
+
+      if (options.highlightLines)
+        cm.addLineClass(line, "wrap", LINT_LINE_ID + maxSeverity);
+    }
+    if (options.onUpdateLinting) options.onUpdateLinting(annotationsNotSorted, annotations, cm);
+  }
+
+  function onChange(cm) {
+    var state = cm.state.lint;
+    if (!state) return;
+    clearTimeout(state.timeout);
+    state.timeout = setTimeout(function(){startLinting(cm);}, state.options.delay);
+  }
+
+  function popupTooltips(cm, annotations, e) {
+    var target = e.target || e.srcElement;
+    var tooltip = document.createDocumentFragment();
+    for (var i = 0; i < annotations.length; i++) {
+      var ann = annotations[i];
+      tooltip.appendChild(annotationTooltip(ann));
+    }
+    showTooltipFor(cm, e, tooltip, target);
+  }
+
+  function onMouseOver(cm, e) {
+    var target = e.target || e.srcElement;
+    if (!/\bCodeMirror-lint-mark-/.test(target.className)) return;
+    var box = target.getBoundingClientRect(), x = (box.left + box.right) / 2, y = (box.top + box.bottom) / 2;
+    var spans = cm.findMarksAt(cm.coordsChar({left: x, top: y}, "client"));
+
+    var annotations = [];
+    for (var i = 0; i < spans.length; ++i) {
+      var ann = spans[i].__annotation;
+      if (ann) annotations.push(ann);
+    }
+    if (annotations.length) popupTooltips(cm, annotations, e);
+  }
+
+  CodeMirror.defineOption("lint", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      clearMarks(cm);
+      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;
+    }
+
+    if (val) {
+      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, val, hasLintGutter);
+      if (state.options.lintOnChange)
+        cm.on("change", onChange);
+      if (state.options.tooltips != false && state.options.tooltips != "gutter")
+        CodeMirror.on(cm.getWrapperElement(), "mouseover", state.onMouseOver);
+
+      startLinting(cm);
+    }
+  });
+
+  CodeMirror.defineExtension("performLint", function() {
+    startLinting(this);
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/lint/yaml-lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,41 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+// Depends on js-yaml.js from https://github.com/nodeca/js-yaml
+
+// declare global: jsyaml
+
+CodeMirror.registerHelper("lint", "yaml", function(text) {
+  var found = [];
+  if (!window.jsyaml) {
+    if (window.console) {
+      window.console.error("Error: window.jsyaml not defined, CodeMirror YAML linting cannot run.");
+    }
+    return found;
+  }
+  try { jsyaml.loadAll(text); }
+  catch(e) {
+      var loc = e.mark,
+          // js-yaml YAMLException doesn't always provide an accurate lineno
+          // e.g., when there are multiple yaml docs
+          // ---
+          // ---
+          // foo:bar
+          from = loc ? CodeMirror.Pos(loc.line, loc.column) : CodeMirror.Pos(0, 0),
+          to = from;
+      found.push({ from: from, to: to, message: e.message });
+  }
+  return found;
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/merge/merge.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,119 @@
+.CodeMirror-merge {
+  position: relative;
+  border: 1px solid #ddd;
+  white-space: pre;
+}
+
+.CodeMirror-merge, .CodeMirror-merge .CodeMirror {
+  height: 350px;
+}
+
+.CodeMirror-merge-2pane .CodeMirror-merge-pane { width: 47%; }
+.CodeMirror-merge-2pane .CodeMirror-merge-gap { width: 6%; }
+.CodeMirror-merge-3pane .CodeMirror-merge-pane { width: 31%; }
+.CodeMirror-merge-3pane .CodeMirror-merge-gap { width: 3.5%; }
+
+.CodeMirror-merge-pane {
+  display: inline-block;
+  white-space: normal;
+  vertical-align: top;
+}
+.CodeMirror-merge-pane-rightmost {
+  position: absolute;
+  right: 0px;
+  z-index: 1;
+}
+
+.CodeMirror-merge-gap {
+  z-index: 2;
+  display: inline-block;
+  height: 100%;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+  overflow: hidden;
+  border-left: 1px solid #ddd;
+  border-right: 1px solid #ddd;
+  position: relative;
+  background: #f8f8f8;
+}
+
+.CodeMirror-merge-scrolllock-wrap {
+  position: absolute;
+  bottom: 0; left: 50%;
+}
+.CodeMirror-merge-scrolllock {
+  position: relative;
+  left: -50%;
+  cursor: pointer;
+  color: #555;
+  line-height: 1;
+}
+.CodeMirror-merge-scrolllock:after {
+  content: "\21db\00a0\00a0\21da";
+}
+.CodeMirror-merge-scrolllock.CodeMirror-merge-scrolllock-enabled:after {
+  content: "\21db\21da";
+}
+
+.CodeMirror-merge-copybuttons-left, .CodeMirror-merge-copybuttons-right {
+  position: absolute;
+  left: 0; top: 0;
+  right: 0; bottom: 0;
+  line-height: 1;
+}
+
+.CodeMirror-merge-copy {
+  position: absolute;
+  cursor: pointer;
+  color: #44c;
+  z-index: 3;
+}
+
+.CodeMirror-merge-copy-reverse {
+  position: absolute;
+  cursor: pointer;
+  color: #44c;
+}
+
+.CodeMirror-merge-copybuttons-left .CodeMirror-merge-copy { left: 2px; }
+.CodeMirror-merge-copybuttons-right .CodeMirror-merge-copy { right: 2px; }
+
+.CodeMirror-merge-r-inserted, .CodeMirror-merge-l-inserted {
+  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12MwuCXy3+CWyH8GBgYGJgYkAABZbAQ9ELXurwAAAABJRU5ErkJggg==);
+  background-position: bottom left;
+  background-repeat: repeat-x;
+}
+
+.CodeMirror-merge-r-deleted, .CodeMirror-merge-l-deleted {
+  background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAACCAYAAACddGYaAAAAGUlEQVQI12M4Kyb2/6yY2H8GBgYGJgYkAABURgPz6Ks7wQAAAABJRU5ErkJggg==);
+  background-position: bottom left;
+  background-repeat: repeat-x;
+}
+
+.CodeMirror-merge-r-chunk { background: #ffffe0; }
+.CodeMirror-merge-r-chunk-start { border-top: 1px solid #ee8; }
+.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #ee8; }
+.CodeMirror-merge-r-connect { fill: #ffffe0; stroke: #ee8; stroke-width: 1px; }
+
+.CodeMirror-merge-l-chunk { background: #eef; }
+.CodeMirror-merge-l-chunk-start { border-top: 1px solid #88e; }
+.CodeMirror-merge-l-chunk-end { border-bottom: 1px solid #88e; }
+.CodeMirror-merge-l-connect { fill: #eef; stroke: #88e; stroke-width: 1px; }
+
+.CodeMirror-merge-l-chunk.CodeMirror-merge-r-chunk { background: #dfd; }
+.CodeMirror-merge-l-chunk-start.CodeMirror-merge-r-chunk-start { border-top: 1px solid #4e4; }
+.CodeMirror-merge-l-chunk-end.CodeMirror-merge-r-chunk-end { border-bottom: 1px solid #4e4; }
+
+.CodeMirror-merge-collapsed-widget:before {
+  content: "(...)";
+}
+.CodeMirror-merge-collapsed-widget {
+  cursor: pointer;
+  color: #88b;
+  background: #eef;
+  border: 1px solid #ddf;
+  font-size: 90%;
+  padding: 0 3px;
+  border-radius: 4px;
+}
+.CodeMirror-merge-collapsed-line .CodeMirror-gutter-elt { display: none; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/merge/merge.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1018 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// declare global: diff_match_patch, DIFF_INSERT, DIFF_DELETE, DIFF_EQUAL
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    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);
+})(function(CodeMirror) {
+  "use strict";
+  var Pos = CodeMirror.Pos;
+  var svgNS = "http://www.w3.org/2000/svg";
+
+  function DiffView(mv, type) {
+    this.mv = mv;
+    this.type = type;
+    this.classes = type == "left"
+      ? {chunk: "CodeMirror-merge-l-chunk",
+         start: "CodeMirror-merge-l-chunk-start",
+         end: "CodeMirror-merge-l-chunk-end",
+         insert: "CodeMirror-merge-l-inserted",
+         del: "CodeMirror-merge-l-deleted",
+         connect: "CodeMirror-merge-l-connect"}
+      : {chunk: "CodeMirror-merge-r-chunk",
+         start: "CodeMirror-merge-r-chunk-start",
+         end: "CodeMirror-merge-r-chunk-end",
+         insert: "CodeMirror-merge-r-inserted",
+         del: "CodeMirror-merge-r-deleted",
+         connect: "CodeMirror-merge-r-connect"};
+  }
+
+  DiffView.prototype = {
+    constructor: DiffView,
+    init: function(pane, orig, options) {
+      this.edit = this.mv.edit;
+      ;(this.edit.state.diffViews || (this.edit.state.diffViews = [])).push(this);
+      this.orig = CodeMirror(pane, copyObj({value: orig, readOnly: !this.mv.options.allowEditingOriginals}, copyObj(options)));
+      if (this.mv.options.connect == "align") {
+        if (!this.edit.state.trackAlignable) this.edit.state.trackAlignable = new TrackAlignable(this.edit)
+        this.orig.state.trackAlignable = new TrackAlignable(this.orig)
+      }
+      this.lockButton.title = this.edit.phrase("Toggle locked scrolling");
+      this.lockButton.setAttribute("aria-label", this.lockButton.title);
+
+      this.orig.state.diffViews = [this];
+      var classLocation = options.chunkClassLocation || "background";
+      if (Object.prototype.toString.call(classLocation) != "[object Array]") classLocation = [classLocation]
+      this.classes.classLocation = classLocation
+
+      this.diff = getDiff(asString(orig), asString(options.value), this.mv.options.ignoreWhitespace);
+      this.chunks = getChunks(this.diff);
+      this.diffOutOfDate = this.dealigned = false;
+      this.needsScrollSync = null
+
+      this.showDifferences = options.showDifferences !== false;
+    },
+    registerEvents: function(otherDv) {
+      this.forceUpdate = registerUpdate(this);
+      setScrollLock(this, true, false);
+      registerScroll(this, otherDv);
+    },
+    setShowDifferences: function(val) {
+      val = val !== false;
+      if (val != this.showDifferences) {
+        this.showDifferences = val;
+        this.forceUpdate("full");
+      }
+    }
+  };
+
+  function ensureDiff(dv) {
+    if (dv.diffOutOfDate) {
+      dv.diff = getDiff(dv.orig.getValue(), dv.edit.getValue(), dv.mv.options.ignoreWhitespace);
+      dv.chunks = getChunks(dv.diff);
+      dv.diffOutOfDate = false;
+      CodeMirror.signal(dv.edit, "updateDiff", dv.diff);
+    }
+  }
+
+  var updating = false;
+  function registerUpdate(dv) {
+    var edit = {from: 0, to: 0, marked: []};
+    var orig = {from: 0, to: 0, marked: []};
+    var debounceChange, updatingFast = false;
+    function update(mode) {
+      updating = true;
+      updatingFast = false;
+      if (mode == "full") {
+        if (dv.svg) clear(dv.svg);
+        if (dv.copyButtons) clear(dv.copyButtons);
+        clearMarks(dv.edit, edit.marked, dv.classes);
+        clearMarks(dv.orig, orig.marked, dv.classes);
+        edit.from = edit.to = orig.from = orig.to = 0;
+      }
+      ensureDiff(dv);
+      if (dv.showDifferences) {
+        updateMarks(dv.edit, dv.diff, edit, DIFF_INSERT, dv.classes);
+        updateMarks(dv.orig, dv.diff, orig, DIFF_DELETE, dv.classes);
+      }
+
+      if (dv.mv.options.connect == "align")
+        alignChunks(dv);
+      makeConnections(dv);
+      if (dv.needsScrollSync != null) syncScroll(dv, dv.needsScrollSync)
+
+      updating = false;
+    }
+    function setDealign(fast) {
+      if (updating) return;
+      dv.dealigned = true;
+      set(fast);
+    }
+    function set(fast) {
+      if (updating || updatingFast) return;
+      clearTimeout(debounceChange);
+      if (fast === true) updatingFast = true;
+      debounceChange = setTimeout(update, fast === true ? 20 : 250);
+    }
+    function change(_cm, change) {
+      if (!dv.diffOutOfDate) {
+        dv.diffOutOfDate = true;
+        edit.from = edit.to = orig.from = orig.to = 0;
+      }
+      // Update faster when a line was added/removed
+      setDealign(change.text.length - 1 != change.to.line - change.from.line);
+    }
+    function swapDoc() {
+      dv.diffOutOfDate = true;
+      dv.dealigned = true;
+      update("full");
+    }
+    dv.edit.on("change", change);
+    dv.orig.on("change", change);
+    dv.edit.on("swapDoc", swapDoc);
+    dv.orig.on("swapDoc", swapDoc);
+    if (dv.mv.options.connect == "align") {
+      CodeMirror.on(dv.edit.state.trackAlignable, "realign", setDealign)
+      CodeMirror.on(dv.orig.state.trackAlignable, "realign", setDealign)
+    }
+    dv.edit.on("viewportChange", function() { set(false); });
+    dv.orig.on("viewportChange", function() { set(false); });
+    update();
+    return update;
+  }
+
+  function registerScroll(dv, otherDv) {
+    dv.edit.on("scroll", function() {
+      syncScroll(dv, true) && makeConnections(dv);
+    });
+    dv.orig.on("scroll", function() {
+      syncScroll(dv, false) && makeConnections(dv);
+      if (otherDv) syncScroll(otherDv, true) && makeConnections(otherDv);
+    });
+  }
+
+  function syncScroll(dv, toOrig) {
+    // Change handler will do a refresh after a timeout when diff is out of date
+    if (dv.diffOutOfDate) {
+      if (dv.lockScroll && dv.needsScrollSync == null) dv.needsScrollSync = toOrig
+      return false
+    }
+    dv.needsScrollSync = null
+    if (!dv.lockScroll) return true;
+    var editor, other, now = +new Date;
+    if (toOrig) { editor = dv.edit; other = dv.orig; }
+    else { editor = dv.orig; other = dv.edit; }
+    // Don't take action if the position of this editor was recently set
+    // (to prevent feedback loops)
+    if (editor.state.scrollSetBy == dv && (editor.state.scrollSetAt || 0) + 250 > now) return false;
+
+    var sInfo = editor.getScrollInfo();
+    if (dv.mv.options.connect == "align") {
+      targetPos = sInfo.top;
+    } else {
+      var halfScreen = .5 * sInfo.clientHeight, midY = sInfo.top + halfScreen;
+      var mid = editor.lineAtHeight(midY, "local");
+      var around = chunkBoundariesAround(dv.chunks, mid, toOrig);
+      var off = getOffsets(editor, toOrig ? around.edit : around.orig);
+      var offOther = getOffsets(other, toOrig ? around.orig : around.edit);
+      var ratio = (midY - off.top) / (off.bot - off.top);
+      var targetPos = (offOther.top - halfScreen) + ratio * (offOther.bot - offOther.top);
+
+      var botDist, mix;
+      // Some careful tweaking to make sure no space is left out of view
+      // when scrolling to top or bottom.
+      if (targetPos > sInfo.top && (mix = sInfo.top / halfScreen) < 1) {
+        targetPos = targetPos * mix + sInfo.top * (1 - mix);
+      } else if ((botDist = sInfo.height - sInfo.clientHeight - sInfo.top) < halfScreen) {
+        var otherInfo = other.getScrollInfo();
+        var botDistOther = otherInfo.height - otherInfo.clientHeight - targetPos;
+        if (botDistOther > botDist && (mix = botDist / halfScreen) < 1)
+          targetPos = targetPos * mix + (otherInfo.height - otherInfo.clientHeight - botDist) * (1 - mix);
+      }
+    }
+
+    other.scrollTo(sInfo.left, targetPos);
+    other.state.scrollSetAt = now;
+    other.state.scrollSetBy = dv;
+    return true;
+  }
+
+  function getOffsets(editor, around) {
+    var bot = around.after;
+    if (bot == null) bot = editor.lastLine() + 1;
+    return {top: editor.heightAtLine(around.before || 0, "local"),
+            bot: editor.heightAtLine(bot, "local")};
+  }
+
+  function setScrollLock(dv, val, action) {
+    dv.lockScroll = val;
+    if (val && action != false) syncScroll(dv, DIFF_INSERT) && makeConnections(dv);
+    (val ? CodeMirror.addClass : CodeMirror.rmClass)(dv.lockButton, "CodeMirror-merge-scrolllock-enabled");
+  }
+
+  // Updating the marks for editor content
+
+  function removeClass(editor, line, classes) {
+    var locs = classes.classLocation
+    for (var i = 0; i < locs.length; i++) {
+      editor.removeLineClass(line, locs[i], classes.chunk);
+      editor.removeLineClass(line, locs[i], classes.start);
+      editor.removeLineClass(line, locs[i], classes.end);
+    }
+  }
+
+  function clearMarks(editor, arr, classes) {
+    for (var i = 0; i < arr.length; ++i) {
+      var mark = arr[i];
+      if (mark instanceof CodeMirror.TextMarker)
+        mark.clear();
+      else if (mark.parent)
+        removeClass(editor, mark, classes);
+    }
+    arr.length = 0;
+  }
+
+  // FIXME maybe add a margin around viewport to prevent too many updates
+  function updateMarks(editor, diff, state, type, classes) {
+    var vp = editor.getViewport();
+    editor.operation(function() {
+      if (state.from == state.to || vp.from - state.to > 20 || state.from - vp.to > 20) {
+        clearMarks(editor, state.marked, classes);
+        markChanges(editor, diff, type, state.marked, vp.from, vp.to, classes);
+        state.from = vp.from; state.to = vp.to;
+      } else {
+        if (vp.from < state.from) {
+          markChanges(editor, diff, type, state.marked, vp.from, state.from, classes);
+          state.from = vp.from;
+        }
+        if (vp.to > state.to) {
+          markChanges(editor, diff, type, state.marked, state.to, vp.to, classes);
+          state.to = vp.to;
+        }
+      }
+    });
+  }
+
+  function addClass(editor, lineNr, classes, main, start, end) {
+    var locs = classes.classLocation, line = editor.getLineHandle(lineNr);
+    for (var i = 0; i < locs.length; i++) {
+      if (main) editor.addLineClass(line, locs[i], classes.chunk);
+      if (start) editor.addLineClass(line, locs[i], classes.start);
+      if (end) editor.addLineClass(line, locs[i], classes.end);
+    }
+    return line;
+  }
+
+  function markChanges(editor, diff, type, marks, from, to, classes) {
+    var pos = Pos(0, 0);
+    var top = Pos(from, 0), bot = editor.clipPos(Pos(to - 1));
+    var cls = type == DIFF_DELETE ? classes.del : classes.insert;
+    function markChunk(start, end) {
+      var bfrom = Math.max(from, start), bto = Math.min(to, end);
+      for (var i = bfrom; i < bto; ++i)
+        marks.push(addClass(editor, i, classes, true, i == start, i == end - 1));
+      // When the chunk is empty, make sure a horizontal line shows up
+      if (start == end && bfrom == end && bto == end) {
+        if (bfrom)
+          marks.push(addClass(editor, bfrom - 1, classes, false, false, true));
+        else
+          marks.push(addClass(editor, bfrom, classes, false, true, false));
+      }
+    }
+
+    var chunkStart = 0, pending = false;
+    for (var i = 0; i < diff.length; ++i) {
+      var part = diff[i], tp = part[0], str = part[1];
+      if (tp == DIFF_EQUAL) {
+        var cleanFrom = pos.line + (startOfLineClean(diff, i) ? 0 : 1);
+        moveOver(pos, str);
+        var cleanTo = pos.line + (endOfLineClean(diff, i) ? 1 : 0);
+        if (cleanTo > cleanFrom) {
+          if (pending) { markChunk(chunkStart, cleanFrom); pending = false }
+          chunkStart = cleanTo;
+        }
+      } else {
+        pending = true
+        if (tp == type) {
+          var end = moveOver(pos, str, true);
+          var a = posMax(top, pos), b = posMin(bot, end);
+          if (!posEq(a, b))
+            marks.push(editor.markText(a, b, {className: cls}));
+          pos = end;
+        }
+      }
+    }
+    if (pending) markChunk(chunkStart, pos.line + 1);
+  }
+
+  // Updating the gap between editor and original
+
+  function makeConnections(dv) {
+    if (!dv.showDifferences) return;
+
+    if (dv.svg) {
+      clear(dv.svg);
+      var w = dv.gap.offsetWidth;
+      attrs(dv.svg, "width", w, "height", dv.gap.offsetHeight);
+    }
+    if (dv.copyButtons) clear(dv.copyButtons);
+
+    var vpEdit = dv.edit.getViewport(), vpOrig = dv.orig.getViewport();
+    var outerTop = dv.mv.wrap.getBoundingClientRect().top
+    var sTopEdit = outerTop - dv.edit.getScrollerElement().getBoundingClientRect().top + dv.edit.getScrollInfo().top
+    var sTopOrig = outerTop - dv.orig.getScrollerElement().getBoundingClientRect().top + dv.orig.getScrollInfo().top;
+    for (var i = 0; i < dv.chunks.length; i++) {
+      var ch = dv.chunks[i];
+      if (ch.editFrom <= vpEdit.to && ch.editTo >= vpEdit.from &&
+          ch.origFrom <= vpOrig.to && ch.origTo >= vpOrig.from)
+        drawConnectorsForChunk(dv, ch, sTopOrig, sTopEdit, w);
+    }
+  }
+
+  function getMatchingOrigLine(editLine, chunks) {
+    var editStart = 0, origStart = 0;
+    for (var i = 0; i < chunks.length; i++) {
+      var chunk = chunks[i];
+      if (chunk.editTo > editLine && chunk.editFrom <= editLine) return null;
+      if (chunk.editFrom > editLine) break;
+      editStart = chunk.editTo;
+      origStart = chunk.origTo;
+    }
+    return origStart + (editLine - editStart);
+  }
+
+  // Combines information about chunks and widgets/markers to return
+  // an array of lines, in a single editor, that probably need to be
+  // aligned with their counterparts in the editor next to it.
+  function alignableFor(cm, chunks, isOrig) {
+    var tracker = cm.state.trackAlignable
+    var start = cm.firstLine(), trackI = 0
+    var result = []
+    for (var i = 0;; i++) {
+      var chunk = chunks[i]
+      var chunkStart = !chunk ? 1e9 : isOrig ? chunk.origFrom : chunk.editFrom
+      for (; trackI < tracker.alignable.length; trackI += 2) {
+        var n = tracker.alignable[trackI] + 1
+        if (n <= start) continue
+        if (n <= chunkStart) result.push(n)
+        else break
+      }
+      if (!chunk) break
+      result.push(start = isOrig ? chunk.origTo : chunk.editTo)
+    }
+    return result
+  }
+
+  // Given information about alignable lines in two editors, fill in
+  // the result (an array of three-element arrays) to reflect the
+  // lines that need to be aligned with each other.
+  function mergeAlignable(result, origAlignable, chunks, setIndex) {
+    var rI = 0, origI = 0, chunkI = 0, diff = 0
+    outer: for (;; rI++) {
+      var nextR = result[rI], nextO = origAlignable[origI]
+      if (!nextR && nextO == null) break
+
+      var rLine = nextR ? nextR[0] : 1e9, oLine = nextO == null ? 1e9 : nextO
+      while (chunkI < chunks.length) {
+        var chunk = chunks[chunkI]
+        if (chunk.origFrom <= oLine && chunk.origTo > oLine) {
+          origI++
+          rI--
+          continue outer;
+        }
+        if (chunk.editTo > rLine) {
+          if (chunk.editFrom <= rLine) continue outer;
+          break
+        }
+        diff += (chunk.origTo - chunk.origFrom) - (chunk.editTo - chunk.editFrom)
+        chunkI++
+      }
+      if (rLine == oLine - diff) {
+        nextR[setIndex] = oLine
+        origI++
+      } else if (rLine < oLine - diff) {
+        nextR[setIndex] = rLine + diff
+      } else {
+        var record = [oLine - diff, null, null]
+        record[setIndex] = oLine
+        result.splice(rI, 0, record)
+        origI++
+      }
+    }
+  }
+
+  function findAlignedLines(dv, other) {
+    var alignable = alignableFor(dv.edit, dv.chunks, false), result = []
+    if (other) for (var i = 0, j = 0; i < other.chunks.length; i++) {
+      var n = other.chunks[i].editTo
+      while (j < alignable.length && alignable[j] < n) j++
+      if (j == alignable.length || alignable[j] != n) alignable.splice(j++, 0, n)
+    }
+    for (var i = 0; i < alignable.length; i++)
+      result.push([alignable[i], null, null])
+
+    mergeAlignable(result, alignableFor(dv.orig, dv.chunks, true), dv.chunks, 1)
+    if (other)
+      mergeAlignable(result, alignableFor(other.orig, other.chunks, true), other.chunks, 2)
+
+    return result
+  }
+
+  function alignChunks(dv, force) {
+    if (!dv.dealigned && !force) return;
+    if (!dv.orig.curOp) return dv.orig.operation(function() {
+      alignChunks(dv, force);
+    });
+
+    dv.dealigned = false;
+    var other = dv.mv.left == dv ? dv.mv.right : dv.mv.left;
+    if (other) {
+      ensureDiff(other);
+      other.dealigned = false;
+    }
+    var linesToAlign = findAlignedLines(dv, other);
+
+    // Clear old aligners
+    var aligners = dv.mv.aligners;
+    for (var i = 0; i < aligners.length; i++)
+      aligners[i].clear();
+    aligners.length = 0;
+
+    var cm = [dv.edit, dv.orig], scroll = [], offset = []
+    if (other) cm.push(other.orig);
+    for (var i = 0; i < cm.length; i++) {
+      scroll.push(cm[i].getScrollInfo().top);
+      offset.push(-cm[i].getScrollerElement().getBoundingClientRect().top)
+    }
+
+    if (offset[0] != offset[1] || cm.length == 3 && offset[1] != offset[2])
+      alignLines(cm, offset, [0, 0, 0], aligners)
+    for (var ln = 0; ln < linesToAlign.length; ln++)
+      alignLines(cm, offset, linesToAlign[ln], aligners);
+
+    for (var i = 0; i < cm.length; i++)
+      cm[i].scrollTo(null, scroll[i]);
+  }
+
+  function alignLines(cm, cmOffset, lines, aligners) {
+    var maxOffset = -1e8, offset = [];
+    for (var i = 0; i < cm.length; i++) if (lines[i] != null) {
+      var off = cm[i].heightAtLine(lines[i], "local") - cmOffset[i];
+      offset[i] = off;
+      maxOffset = Math.max(maxOffset, off);
+    }
+    for (var i = 0; i < cm.length; i++) if (lines[i] != null) {
+      var diff = maxOffset - offset[i];
+      if (diff > 1)
+        aligners.push(padAbove(cm[i], lines[i], diff));
+    }
+  }
+
+  function padAbove(cm, line, size) {
+    var above = true;
+    if (line > cm.lastLine()) {
+      line--;
+      above = false;
+    }
+    var elt = document.createElement("div");
+    elt.className = "CodeMirror-merge-spacer";
+    elt.style.height = size + "px"; elt.style.minWidth = "1px";
+    return cm.addLineWidget(line, elt, {height: size, above: above, mergeSpacer: true, handleMouseEvents: true});
+  }
+
+  function drawConnectorsForChunk(dv, chunk, sTopOrig, sTopEdit, w) {
+    var flip = dv.type == "left";
+    var top = dv.orig.heightAtLine(chunk.origFrom, "local", true) - sTopOrig;
+    if (dv.svg) {
+      var topLpx = top;
+      var topRpx = dv.edit.heightAtLine(chunk.editFrom, "local", true) - sTopEdit;
+      if (flip) { var tmp = topLpx; topLpx = topRpx; topRpx = tmp; }
+      var botLpx = dv.orig.heightAtLine(chunk.origTo, "local", true) - sTopOrig;
+      var botRpx = dv.edit.heightAtLine(chunk.editTo, "local", true) - sTopEdit;
+      if (flip) { var tmp = botLpx; botLpx = botRpx; botRpx = tmp; }
+      var curveTop = " C " + w/2 + " " + topRpx + " " + w/2 + " " + topLpx + " " + (w + 2) + " " + topLpx;
+      var curveBot = " C " + w/2 + " " + botLpx + " " + w/2 + " " + botRpx + " -1 " + botRpx;
+      attrs(dv.svg.appendChild(document.createElementNS(svgNS, "path")),
+            "d", "M -1 " + topRpx + curveTop + " L " + (w + 2) + " " + botLpx + curveBot + " z",
+            "class", dv.classes.connect);
+    }
+    if (dv.copyButtons) {
+      var copy = dv.copyButtons.appendChild(elt("div", dv.type == "left" ? "\u21dd" : "\u21dc",
+                                                "CodeMirror-merge-copy"));
+      var editOriginals = dv.mv.options.allowEditingOriginals;
+      copy.title = dv.edit.phrase(editOriginals ? "Push to left" : "Revert chunk");
+      copy.chunk = chunk;
+      copy.style.top = (chunk.origTo > chunk.origFrom ? top : dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit) + "px";
+      copy.setAttribute("role", "button");
+      copy.setAttribute("tabindex", "0");
+      copy.setAttribute("aria-label", copy.title);
+
+      if (editOriginals) {
+        var topReverse = dv.edit.heightAtLine(chunk.editFrom, "local") - sTopEdit;
+        var copyReverse = dv.copyButtons.appendChild(elt("div", dv.type == "right" ? "\u21dd" : "\u21dc",
+                                                         "CodeMirror-merge-copy-reverse"));
+        copyReverse.title = "Push to right";
+        copyReverse.chunk = {editFrom: chunk.origFrom, editTo: chunk.origTo,
+                             origFrom: chunk.editFrom, origTo: chunk.editTo};
+        copyReverse.style.top = topReverse + "px";
+        dv.type == "right" ? copyReverse.style.left = "2px" : copyReverse.style.right = "2px";
+        copyReverse.setAttribute("role", "button");
+        copyReverse.setAttribute("tabindex", "0");
+        copyReverse.setAttribute("aria-label", copyReverse.title);
+      }
+    }
+  }
+
+  function copyChunk(dv, to, from, chunk) {
+    if (dv.diffOutOfDate) return;
+    var origStart = chunk.origTo > from.lastLine() ? Pos(chunk.origFrom - 1) : Pos(chunk.origFrom, 0)
+    var origEnd = Pos(chunk.origTo, 0)
+    var editStart = chunk.editTo > to.lastLine() ? Pos(chunk.editFrom - 1) : Pos(chunk.editFrom, 0)
+    var editEnd = Pos(chunk.editTo, 0)
+    var handler = dv.mv.options.revertChunk
+    if (handler)
+      handler(dv.mv, from, origStart, origEnd, to, editStart, editEnd)
+    else
+      to.replaceRange(from.getRange(origStart, origEnd), editStart, editEnd)
+  }
+
+  // Merge view, containing 0, 1, or 2 diff views.
+
+  var MergeView = CodeMirror.MergeView = function(node, options) {
+    if (!(this instanceof MergeView)) return new MergeView(node, options);
+
+    this.options = options;
+    var origLeft = options.origLeft, origRight = options.origRight == null ? options.orig : options.origRight;
+
+    var hasLeft = origLeft != null, hasRight = origRight != null;
+    var panes = 1 + (hasLeft ? 1 : 0) + (hasRight ? 1 : 0);
+    var wrap = [], left = this.left = null, right = this.right = null;
+    var self = this;
+
+    if (hasLeft) {
+      left = this.left = new DiffView(this, "left");
+      var leftPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-left");
+      wrap.push(leftPane);
+      wrap.push(buildGap(left));
+    }
+
+    var editPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-editor");
+    wrap.push(editPane);
+
+    if (hasRight) {
+      right = this.right = new DiffView(this, "right");
+      wrap.push(buildGap(right));
+      var rightPane = elt("div", null, "CodeMirror-merge-pane CodeMirror-merge-right");
+      wrap.push(rightPane);
+    }
+
+    (hasRight ? rightPane : editPane).className += " CodeMirror-merge-pane-rightmost";
+
+    wrap.push(elt("div", null, null, "height: 0; clear: both;"));
+
+    var wrapElt = this.wrap = node.appendChild(elt("div", wrap, "CodeMirror-merge CodeMirror-merge-" + panes + "pane"));
+    this.edit = CodeMirror(editPane, copyObj(options));
+
+    if (left) left.init(leftPane, origLeft, options);
+    if (right) right.init(rightPane, origRight, options);
+    if (options.collapseIdentical)
+      this.editor().operation(function() {
+        collapseIdenticalStretches(self, options.collapseIdentical);
+      });
+    if (options.connect == "align") {
+      this.aligners = [];
+      alignChunks(this.left || this.right, true);
+    }
+    if (left) left.registerEvents(right)
+    if (right) right.registerEvents(left)
+
+
+    var onResize = function() {
+      if (left) makeConnections(left);
+      if (right) makeConnections(right);
+    };
+    CodeMirror.on(window, "resize", onResize);
+    var resizeInterval = setInterval(function() {
+      for (var p = wrapElt.parentNode; p && p != document.body; p = p.parentNode) {}
+      if (!p) { clearInterval(resizeInterval); CodeMirror.off(window, "resize", onResize); }
+    }, 5000);
+  };
+
+  function buildGap(dv) {
+    var lock = dv.lockButton = elt("div", null, "CodeMirror-merge-scrolllock");
+    lock.setAttribute("role", "button");
+    lock.setAttribute("tabindex", "0");
+    var lockWrap = elt("div", [lock], "CodeMirror-merge-scrolllock-wrap");
+    CodeMirror.on(lock, "click", function() { setScrollLock(dv, !dv.lockScroll); });
+    CodeMirror.on(lock, "keyup", function(e) { (e.key === "Enter" || e.code === "Space") && setScrollLock(dv, !dv.lockScroll); });
+    var gapElts = [lockWrap];
+    if (dv.mv.options.revertButtons !== false) {
+      dv.copyButtons = elt("div", null, "CodeMirror-merge-copybuttons-" + dv.type);
+      var copyButtons = function(e) {
+        var node = e.target || e.srcElement;
+        if (!node.chunk) return;
+        if (node.className == "CodeMirror-merge-copy-reverse") {
+          copyChunk(dv, dv.orig, dv.edit, node.chunk);
+          return;
+        }
+        copyChunk(dv, dv.edit, dv.orig, node.chunk);
+      }
+      CodeMirror.on(dv.copyButtons, "click", copyButtons);
+      CodeMirror.on(dv.copyButtons, "keyup", function(e) { (e.key === "Enter" || e.code === "Space") && copyButtons(e); });
+      gapElts.unshift(dv.copyButtons);
+    }
+    if (dv.mv.options.connect != "align") {
+      var svg = document.createElementNS && document.createElementNS(svgNS, "svg");
+      if (svg && !svg.createSVGRect) svg = null;
+      dv.svg = svg;
+      if (svg) gapElts.push(svg);
+    }
+
+    return dv.gap = elt("div", gapElts, "CodeMirror-merge-gap");
+  }
+
+  MergeView.prototype = {
+    constructor: MergeView,
+    editor: function() { return this.edit; },
+    rightOriginal: function() { return this.right && this.right.orig; },
+    leftOriginal: function() { return this.left && this.left.orig; },
+    setShowDifferences: function(val) {
+      if (this.right) this.right.setShowDifferences(val);
+      if (this.left) this.left.setShowDifferences(val);
+    },
+    rightChunks: function() {
+      if (this.right) { ensureDiff(this.right); return this.right.chunks; }
+    },
+    leftChunks: function() {
+      if (this.left) { ensureDiff(this.left); return this.left.chunks; }
+    }
+  };
+
+  function asString(obj) {
+    if (typeof obj == "string") return obj;
+    else return obj.getValue();
+  }
+
+  // Operations on diffs
+  var dmp;
+  function getDiff(a, b, ignoreWhitespace) {
+    if (!dmp) dmp = new diff_match_patch();
+
+    var diff = dmp.diff_main(a, b);
+    // The library sometimes leaves in empty parts, which confuse the algorithm
+    for (var i = 0; i < diff.length; ++i) {
+      var part = diff[i];
+      if (ignoreWhitespace ? !/[^ \t]/.test(part[1]) : !part[1]) {
+        diff.splice(i--, 1);
+      } else if (i && diff[i - 1][0] == part[0]) {
+        diff.splice(i--, 1);
+        diff[i][1] += part[1];
+      }
+    }
+    return diff;
+  }
+
+  function getChunks(diff) {
+    var chunks = [];
+    if (!diff.length) return chunks;
+    var startEdit = 0, startOrig = 0;
+    var edit = Pos(0, 0), orig = Pos(0, 0);
+    for (var i = 0; i < diff.length; ++i) {
+      var part = diff[i], tp = part[0];
+      if (tp == DIFF_EQUAL) {
+        var startOff = !startOfLineClean(diff, i) || edit.line < startEdit || orig.line < startOrig ? 1 : 0;
+        var cleanFromEdit = edit.line + startOff, cleanFromOrig = orig.line + startOff;
+        moveOver(edit, part[1], null, orig);
+        var endOff = endOfLineClean(diff, i) ? 1 : 0;
+        var cleanToEdit = edit.line + endOff, cleanToOrig = orig.line + endOff;
+        if (cleanToEdit > cleanFromEdit) {
+          if (i) chunks.push({origFrom: startOrig, origTo: cleanFromOrig,
+                              editFrom: startEdit, editTo: cleanFromEdit});
+          startEdit = cleanToEdit; startOrig = cleanToOrig;
+        }
+      } else {
+        moveOver(tp == DIFF_INSERT ? edit : orig, part[1]);
+      }
+    }
+    if (startEdit <= edit.line || startOrig <= orig.line)
+      chunks.push({origFrom: startOrig, origTo: orig.line + 1,
+                   editFrom: startEdit, editTo: edit.line + 1});
+    return chunks;
+  }
+
+  function endOfLineClean(diff, i) {
+    if (i == diff.length - 1) return true;
+    var next = diff[i + 1][1];
+    if ((next.length == 1 && i < diff.length - 2) || next.charCodeAt(0) != 10) return false;
+    if (i == diff.length - 2) return true;
+    next = diff[i + 2][1];
+    return (next.length > 1 || i == diff.length - 3) && next.charCodeAt(0) == 10;
+  }
+
+  function startOfLineClean(diff, i) {
+    if (i == 0) return true;
+    var last = diff[i - 1][1];
+    if (last.charCodeAt(last.length - 1) != 10) return false;
+    if (i == 1) return true;
+    last = diff[i - 2][1];
+    return last.charCodeAt(last.length - 1) == 10;
+  }
+
+  function chunkBoundariesAround(chunks, n, nInEdit) {
+    var beforeE, afterE, beforeO, afterO;
+    for (var i = 0; i < chunks.length; i++) {
+      var chunk = chunks[i];
+      var fromLocal = nInEdit ? chunk.editFrom : chunk.origFrom;
+      var toLocal = nInEdit ? chunk.editTo : chunk.origTo;
+      if (afterE == null) {
+        if (fromLocal > n) { afterE = chunk.editFrom; afterO = chunk.origFrom; }
+        else if (toLocal > n) { afterE = chunk.editTo; afterO = chunk.origTo; }
+      }
+      if (toLocal <= n) { beforeE = chunk.editTo; beforeO = chunk.origTo; }
+      else if (fromLocal <= n) { beforeE = chunk.editFrom; beforeO = chunk.origFrom; }
+    }
+    return {edit: {before: beforeE, after: afterE}, orig: {before: beforeO, after: afterO}};
+  }
+
+  function collapseSingle(cm, from, to) {
+    cm.addLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
+    var widget = document.createElement("span");
+    widget.className = "CodeMirror-merge-collapsed-widget";
+    widget.title = cm.phrase("Identical text collapsed. Click to expand.");
+    var mark = cm.markText(Pos(from, 0), Pos(to - 1), {
+      inclusiveLeft: true,
+      inclusiveRight: true,
+      replacedWith: widget,
+      clearOnEnter: true
+    });
+    function clear() {
+      mark.clear();
+      cm.removeLineClass(from, "wrap", "CodeMirror-merge-collapsed-line");
+    }
+    if (mark.explicitlyCleared) clear();
+    CodeMirror.on(widget, "click", clear);
+    mark.on("clear", clear);
+    CodeMirror.on(widget, "click", clear);
+    return {mark: mark, clear: clear};
+  }
+
+  function collapseStretch(size, editors) {
+    var marks = [];
+    function clear() {
+      for (var i = 0; i < marks.length; i++) marks[i].clear();
+    }
+    for (var i = 0; i < editors.length; i++) {
+      var editor = editors[i];
+      var mark = collapseSingle(editor.cm, editor.line, editor.line + size);
+      marks.push(mark);
+      mark.mark.on("clear", clear);
+    }
+    return marks[0].mark;
+  }
+
+  function unclearNearChunks(dv, margin, off, clear) {
+    for (var i = 0; i < dv.chunks.length; i++) {
+      var chunk = dv.chunks[i];
+      for (var l = chunk.editFrom - margin; l < chunk.editTo + margin; l++) {
+        var pos = l + off;
+        if (pos >= 0 && pos < clear.length) clear[pos] = false;
+      }
+    }
+  }
+
+  function collapseIdenticalStretches(mv, margin) {
+    if (typeof margin != "number") margin = 2;
+    var clear = [], edit = mv.editor(), off = edit.firstLine();
+    for (var l = off, e = edit.lastLine(); l <= e; l++) clear.push(true);
+    if (mv.left) unclearNearChunks(mv.left, margin, off, clear);
+    if (mv.right) unclearNearChunks(mv.right, margin, off, clear);
+
+    for (var i = 0; i < clear.length; i++) {
+      if (clear[i]) {
+        var line = i + off;
+        for (var size = 1; i < clear.length - 1 && clear[i + 1]; i++, size++) {}
+        if (size > margin) {
+          var editors = [{line: line, cm: edit}];
+          if (mv.left) editors.push({line: getMatchingOrigLine(line, mv.left.chunks), cm: mv.left.orig});
+          if (mv.right) editors.push({line: getMatchingOrigLine(line, mv.right.chunks), cm: mv.right.orig});
+          var mark = collapseStretch(size, editors);
+          if (mv.options.onCollapse) mv.options.onCollapse(mv, line, size, mark);
+        }
+      }
+    }
+  }
+
+  // General utilities
+
+  function elt(tag, content, className, style) {
+    var e = document.createElement(tag);
+    if (className) e.className = className;
+    if (style) e.style.cssText = style;
+    if (typeof content == "string") e.appendChild(document.createTextNode(content));
+    else if (content) for (var i = 0; i < content.length; ++i) e.appendChild(content[i]);
+    return e;
+  }
+
+  function clear(node) {
+    for (var count = node.childNodes.length; count > 0; --count)
+      node.removeChild(node.firstChild);
+  }
+
+  function attrs(elt) {
+    for (var i = 1; i < arguments.length; i += 2)
+      elt.setAttribute(arguments[i], arguments[i+1]);
+  }
+
+  function copyObj(obj, target) {
+    if (!target) target = {};
+    for (var prop in obj) if (obj.hasOwnProperty(prop)) target[prop] = obj[prop];
+    return target;
+  }
+
+  function moveOver(pos, str, copy, other) {
+    var out = copy ? Pos(pos.line, pos.ch) : pos, at = 0;
+    for (;;) {
+      var nl = str.indexOf("\n", at);
+      if (nl == -1) break;
+      ++out.line;
+      if (other) ++other.line;
+      at = nl + 1;
+    }
+    out.ch = (at ? 0 : out.ch) + (str.length - at);
+    if (other) other.ch = (at ? 0 : other.ch) + (str.length - at);
+    return out;
+  }
+
+  // Tracks collapsed markers and line widgets, in order to be able to
+  // accurately align the content of two editors.
+
+  var F_WIDGET = 1, F_WIDGET_BELOW = 2, F_MARKER = 4
+
+  function TrackAlignable(cm) {
+    this.cm = cm
+    this.alignable = []
+    this.height = cm.doc.height
+    var self = this
+    cm.on("markerAdded", function(_, marker) {
+      if (!marker.collapsed) return
+      var found = marker.find(1)
+      if (found != null) self.set(found.line, F_MARKER)
+    })
+    cm.on("markerCleared", function(_, marker, _min, max) {
+      if (max != null && marker.collapsed)
+        self.check(max, F_MARKER, self.hasMarker)
+    })
+    cm.on("markerChanged", this.signal.bind(this))
+    cm.on("lineWidgetAdded", function(_, widget, lineNo) {
+      if (widget.mergeSpacer) return
+      if (widget.above) self.set(lineNo - 1, F_WIDGET_BELOW)
+      else self.set(lineNo, F_WIDGET)
+    })
+    cm.on("lineWidgetCleared", function(_, widget, lineNo) {
+      if (widget.mergeSpacer) return
+      if (widget.above) self.check(lineNo - 1, F_WIDGET_BELOW, self.hasWidgetBelow)
+      else self.check(lineNo, F_WIDGET, self.hasWidget)
+    })
+    cm.on("lineWidgetChanged", this.signal.bind(this))
+    cm.on("change", function(_, change) {
+      var start = change.from.line, nBefore = change.to.line - change.from.line
+      var nAfter = change.text.length - 1, end = start + nAfter
+      if (nBefore || nAfter) self.map(start, nBefore, nAfter)
+      self.check(end, F_MARKER, self.hasMarker)
+      if (nBefore || nAfter) self.check(change.from.line, F_MARKER, self.hasMarker)
+    })
+    cm.on("viewportChange", function() {
+      if (self.cm.doc.height != self.height) self.signal()
+    })
+  }
+
+  TrackAlignable.prototype = {
+    signal: function() {
+      CodeMirror.signal(this, "realign")
+      this.height = this.cm.doc.height
+    },
+
+    set: function(n, flags) {
+      var pos = -1
+      for (; pos < this.alignable.length; pos += 2) {
+        var diff = this.alignable[pos] - n
+        if (diff == 0) {
+          if ((this.alignable[pos + 1] & flags) == flags) return
+          this.alignable[pos + 1] |= flags
+          this.signal()
+          return
+        }
+        if (diff > 0) break
+      }
+      this.signal()
+      this.alignable.splice(pos, 0, n, flags)
+    },
+
+    find: function(n) {
+      for (var i = 0; i < this.alignable.length; i += 2)
+        if (this.alignable[i] == n) return i
+      return -1
+    },
+
+    check: function(n, flag, pred) {
+      var found = this.find(n)
+      if (found == -1 || !(this.alignable[found + 1] & flag)) return
+      if (!pred.call(this, n)) {
+        this.signal()
+        var flags = this.alignable[found + 1] & ~flag
+        if (flags) this.alignable[found + 1] = flags
+        else this.alignable.splice(found, 2)
+      }
+    },
+
+    hasMarker: function(n) {
+      var handle = this.cm.getLineHandle(n)
+      if (handle.markedSpans) for (var i = 0; i < handle.markedSpans.length; i++)
+        if (handle.markedSpans[i].marker.collapsed && handle.markedSpans[i].to != null)
+          return true
+      return false
+    },
+
+    hasWidget: function(n) {
+      var handle = this.cm.getLineHandle(n)
+      if (handle.widgets) for (var i = 0; i < handle.widgets.length; i++)
+        if (!handle.widgets[i].above && !handle.widgets[i].mergeSpacer) return true
+      return false
+    },
+
+    hasWidgetBelow: function(n) {
+      if (n == this.cm.lastLine()) return false
+      var handle = this.cm.getLineHandle(n + 1)
+      if (handle.widgets) for (var i = 0; i < handle.widgets.length; i++)
+        if (handle.widgets[i].above && !handle.widgets[i].mergeSpacer) return true
+      return false
+    },
+
+    map: function(from, nBefore, nAfter) {
+      var diff = nAfter - nBefore, to = from + nBefore, widgetFrom = -1, widgetTo = -1
+      for (var i = 0; i < this.alignable.length; i += 2) {
+        var n = this.alignable[i]
+        if (n == from && (this.alignable[i + 1] & F_WIDGET_BELOW)) widgetFrom = i
+        if (n == to && (this.alignable[i + 1] & F_WIDGET_BELOW)) widgetTo = i
+        if (n <= from) continue
+        else if (n < to) this.alignable.splice(i--, 2)
+        else this.alignable[i] += diff
+      }
+      if (widgetFrom > -1) {
+        var flags = this.alignable[widgetFrom + 1]
+        if (flags == F_WIDGET_BELOW) this.alignable.splice(widgetFrom, 2)
+        else this.alignable[widgetFrom + 1] = flags & ~F_WIDGET_BELOW
+      }
+      if (widgetTo > -1 && nAfter)
+        this.set(from + nAfter, F_WIDGET_BELOW)
+    }
+  }
+
+  function posMin(a, b) { return (a.line - b.line || a.ch - b.ch) < 0 ? a : b; }
+  function posMax(a, b) { return (a.line - b.line || a.ch - b.ch) > 0 ? a : b; }
+  function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
+
+  function findPrevDiff(chunks, start, isOrig) {
+    for (var i = chunks.length - 1; i >= 0; i--) {
+      var chunk = chunks[i];
+      var to = (isOrig ? chunk.origTo : chunk.editTo) - 1;
+      if (to < start) return to;
+    }
+  }
+
+  function findNextDiff(chunks, start, isOrig) {
+    for (var i = 0; i < chunks.length; i++) {
+      var chunk = chunks[i];
+      var from = (isOrig ? chunk.origFrom : chunk.editFrom);
+      if (from > start) return from;
+    }
+  }
+
+  function goNearbyDiff(cm, dir) {
+    var found = null, views = cm.state.diffViews, line = cm.getCursor().line;
+    if (views) for (var i = 0; i < views.length; i++) {
+      var dv = views[i], isOrig = cm == dv.orig;
+      ensureDiff(dv);
+      var pos = dir < 0 ? findPrevDiff(dv.chunks, line, isOrig) : findNextDiff(dv.chunks, line, isOrig);
+      if (pos != null && (found == null || (dir < 0 ? pos > found : pos < found)))
+        found = pos;
+    }
+    if (found != null)
+      cm.setCursor(found, 0);
+    else
+      return CodeMirror.Pass;
+  }
+
+  CodeMirror.commands.goNextDiff = function(cm) {
+    return goNearbyDiff(cm, 1);
+  };
+  CodeMirror.commands.goPrevDiff = function(cm) {
+    return goNearbyDiff(cm, -1);
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/mode/loadmode.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), "cjs");
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror"], function(CM) { mod(CM, "amd"); });
+  else // Plain browser env
+    mod(CodeMirror, "plain");
+})(function(CodeMirror, env) {
+  if (!CodeMirror.modeURL) CodeMirror.modeURL = "../mode/%N/%N.js";
+
+  var loading = {};
+  function splitCallback(cont, n) {
+    var countDown = n;
+    return function() { if (--countDown == 0) cont(); };
+  }
+  function ensureDeps(mode, cont, options) {
+    var modeObj = CodeMirror.modes[mode], deps = modeObj && modeObj.dependencies;
+    if (!deps) return cont();
+    var missing = [];
+    for (var i = 0; i < deps.length; ++i) {
+      if (!CodeMirror.modes.hasOwnProperty(deps[i]))
+        missing.push(deps[i]);
+    }
+    if (!missing.length) return cont();
+    var split = splitCallback(cont, missing.length);
+    for (var i = 0; i < missing.length; ++i)
+      CodeMirror.requireMode(missing[i], split, options);
+  }
+
+  CodeMirror.requireMode = function(mode, cont, options) {
+    if (typeof mode != "string") mode = mode.name;
+    if (CodeMirror.modes.hasOwnProperty(mode)) return ensureDeps(mode, cont, options);
+    if (loading.hasOwnProperty(mode)) return loading[mode].push(cont);
+
+    var file = options && options.path ? options.path(mode) : CodeMirror.modeURL.replace(/%N/g, mode);
+    if (options && options.loadMode) {
+      options.loadMode(file, function() { ensureDeps(mode, cont, options) })
+    } else if (env == "plain") {
+      var script = document.createElement("script");
+      script.src = file;
+      var others = document.getElementsByTagName("script")[0];
+      var list = loading[mode] = [cont];
+      CodeMirror.on(script, "load", function() {
+        ensureDeps(mode, function() {
+          for (var i = 0; i < list.length; ++i) list[i]();
+        }, options);
+      });
+      others.parentNode.insertBefore(script, others);
+    } else if (env == "cjs") {
+      require(file);
+      cont();
+    } else if (env == "amd") {
+      requirejs([file], cont);
+    }
+  };
+
+  CodeMirror.autoLoadMode = function(instance, mode, options) {
+    if (!CodeMirror.modes.hasOwnProperty(mode))
+      CodeMirror.requireMode(mode, function() {
+        instance.setOption("mode", instance.getOption("mode"));
+      }, options);
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/mode/multiplex.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,136 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.multiplexingMode = function(outer /*, others */) {
+  // Others should be {open, close, mode [, delimStyle] [, innerStyle] [, parseDelimiters]} objects
+  var others = Array.prototype.slice.call(arguments, 1);
+
+  function indexOf(string, pattern, from, returnEnd) {
+    if (typeof pattern == "string") {
+      var found = string.indexOf(pattern, from);
+      return returnEnd && found > -1 ? found + pattern.length : found;
+    }
+    var m = pattern.exec(from ? string.slice(from) : string);
+    return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;
+  }
+
+  return {
+    startState: function() {
+      return {
+        outer: CodeMirror.startState(outer),
+        innerActive: null,
+        inner: null,
+        startingInner: false
+      };
+    },
+
+    copyState: function(state) {
+      return {
+        outer: CodeMirror.copyState(outer, state.outer),
+        innerActive: state.innerActive,
+        inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner),
+        startingInner: state.startingInner
+      };
+    },
+
+    token: function(stream, state) {
+      if (!state.innerActive) {
+        var cutOff = Infinity, oldContent = stream.string;
+        for (var i = 0; i < others.length; ++i) {
+          var other = others[i];
+          var found = indexOf(oldContent, other.open, stream.pos);
+          if (found == stream.pos) {
+            if (!other.parseDelimiters) stream.match(other.open);
+            state.startingInner = !!other.parseDelimiters
+            state.innerActive = other;
+
+            // Get the outer indent, making sure to handle CodeMirror.Pass
+            var outerIndent = 0;
+            if (outer.indent) {
+              var possibleOuterIndent = outer.indent(state.outer, "", "");
+              if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
+            }
+
+            state.inner = CodeMirror.startState(other.mode, outerIndent);
+            return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
+          } else if (found != -1 && found < cutOff) {
+            cutOff = found;
+          }
+        }
+        if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
+        var outerToken = outer.token(stream, state.outer);
+        if (cutOff != Infinity) stream.string = oldContent;
+        return outerToken;
+      } else {
+        var curInner = state.innerActive, oldContent = stream.string;
+        if (!curInner.close && stream.sol()) {
+          state.innerActive = state.inner = null;
+          return this.token(stream, state);
+        }
+        var found = curInner.close && !state.startingInner ?
+            indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;
+        if (found == stream.pos && !curInner.parseDelimiters) {
+          stream.match(curInner.close);
+          state.innerActive = state.inner = null;
+          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);
+        if (found > -1) stream.string = oldContent;
+        else if (stream.pos > stream.start) state.startingInner = false
+
+        if (found == stream.pos && curInner.parseDelimiters)
+          state.innerActive = state.inner = null;
+
+        if (curInner.innerStyle) {
+          if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;
+          else innerToken = curInner.innerStyle;
+        }
+
+        return innerToken;
+      }
+    },
+
+    indent: function(state, textAfter, line) {
+      var mode = state.innerActive ? state.innerActive.mode : outer;
+      if (!mode.indent) return CodeMirror.Pass;
+      return mode.indent(state.innerActive ? state.inner : state.outer, textAfter, line);
+    },
+
+    blankLine: function(state) {
+      var mode = state.innerActive ? state.innerActive.mode : outer;
+      if (mode.blankLine) {
+        mode.blankLine(state.innerActive ? state.inner : state.outer);
+      }
+      if (!state.innerActive) {
+        for (var i = 0; i < others.length; ++i) {
+          var other = others[i];
+          if (other.open === "\n") {
+            state.innerActive = other;
+            state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "", "") : 0);
+          }
+        }
+      } else if (state.innerActive.close === "\n") {
+        state.innerActive = state.inner = null;
+      }
+    },
+
+    electricChars: outer.electricChars,
+
+    innerMode: function(state) {
+      return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
+    }
+  };
+};
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/mode/multiplex_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,49 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  CodeMirror.defineMode("markdown_with_stex", function(){
+    var inner = CodeMirror.getMode({}, "stex");
+    var outer = CodeMirror.getMode({}, "markdown");
+
+    var innerOptions = {
+      open: '$',
+      close: '$',
+      mode: inner,
+      delimStyle: 'delim',
+      innerStyle: 'inner'
+    };
+
+    return CodeMirror.multiplexingMode(outer, innerOptions);
+  });
+
+  var mode = CodeMirror.getMode({}, "markdown_with_stex");
+
+  function MT(name) {
+    test.mode(
+      name,
+      mode,
+      Array.prototype.slice.call(arguments, 1),
+      'multiplexing');
+  }
+
+  MT(
+    "stexInsideMarkdown",
+    "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]");
+
+  CodeMirror.defineMode("identical_delim_multiplex", function() {
+    return CodeMirror.multiplexingMode(CodeMirror.getMode({indentUnit: 2}, "javascript"), {
+      open: "#",
+      close: "#",
+      mode: CodeMirror.getMode({}, "markdown"),
+      parseDelimiters: true,
+      innerStyle: "q"
+    });
+  });
+
+  var mode2 = CodeMirror.getMode({}, "identical_delim_multiplex");
+
+  test.mode("identical_delimiters_with_parseDelimiters", mode2, [
+    "[keyword let] [def x] [operator =] [q #foo][q&em *bar*][q #];"
+  ], "multiplexing")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/mode/overlay.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,90 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Utility function that allows modes to be combined. The mode given
+// as the base argument takes care of most of the normal mode
+// functionality, but a second (typically simple) mode is used, which
+// can override the style of text. Both modes get to parse all of the
+// text, but when both assign a non-null style to a piece of code, the
+// overlay wins, unless the combine argument was true and not overridden,
+// or state.overlay.combineTokens was true, in which case the styles are
+// combined.
+
+(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.overlayMode = function(base, overlay, combine) {
+  return {
+    startState: function() {
+      return {
+        base: CodeMirror.startState(base),
+        overlay: CodeMirror.startState(overlay),
+        basePos: 0, baseCur: null,
+        overlayPos: 0, overlayCur: null,
+        streamSeen: null
+      };
+    },
+    copyState: function(state) {
+      return {
+        base: CodeMirror.copyState(base, state.base),
+        overlay: CodeMirror.copyState(overlay, state.overlay),
+        basePos: state.basePos, baseCur: null,
+        overlayPos: state.overlayPos, overlayCur: null
+      };
+    },
+
+    token: function(stream, state) {
+      if (stream != state.streamSeen ||
+          Math.min(state.basePos, state.overlayPos) < stream.start) {
+        state.streamSeen = stream;
+        state.basePos = state.overlayPos = stream.start;
+      }
+
+      if (stream.start == state.basePos) {
+        state.baseCur = base.token(stream, state.base);
+        state.basePos = stream.pos;
+      }
+      if (stream.start == state.overlayPos) {
+        stream.pos = stream.start;
+        state.overlayCur = overlay.token(stream, state.overlay);
+        state.overlayPos = stream.pos;
+      }
+      stream.pos = Math.min(state.basePos, state.overlayPos);
+
+      // state.overlay.combineTokens always takes precedence over combine,
+      // unless set to null
+      if (state.overlayCur == null) return state.baseCur;
+      else if (state.baseCur != null &&
+               state.overlay.combineTokens ||
+               combine && state.overlay.combineTokens == null)
+        return state.baseCur + " " + state.overlayCur;
+      else return state.overlayCur;
+    },
+
+    indent: base.indent && function(state, textAfter, line) {
+      return base.indent(state.base, textAfter, line);
+    },
+    electricChars: base.electricChars,
+
+    innerMode: function(state) { return {state: state.base, mode: base}; },
+
+    blankLine: function(state) {
+      var baseToken, overlayToken;
+      if (base.blankLine) baseToken = base.blankLine(state.base);
+      if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);
+
+      return overlayToken == null ?
+        baseToken :
+        (combine && baseToken != null ? baseToken + " " + overlayToken : overlayToken);
+    }
+  };
+};
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/mode/simple.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,216 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineSimpleMode = function(name, states) {
+    CodeMirror.defineMode(name, function(config) {
+      return CodeMirror.simpleMode(config, states);
+    });
+  };
+
+  CodeMirror.simpleMode = function(config, states) {
+    ensureState(states, "start");
+    var states_ = {}, meta = states.meta || {}, hasIndentation = false;
+    for (var state in states) if (state != meta && states.hasOwnProperty(state)) {
+      var list = states_[state] = [], orig = states[state];
+      for (var i = 0; i < orig.length; i++) {
+        var data = orig[i];
+        list.push(new Rule(data, states));
+        if (data.indent || data.dedent) hasIndentation = true;
+      }
+    }
+    var mode = {
+      startState: function() {
+        return {state: "start", pending: null,
+                local: null, localState: null,
+                indent: hasIndentation ? [] : null};
+      },
+      copyState: function(state) {
+        var s = {state: state.state, pending: state.pending,
+                 local: state.local, localState: null,
+                 indent: state.indent && state.indent.slice(0)};
+        if (state.localState)
+          s.localState = CodeMirror.copyState(state.local.mode, state.localState);
+        if (state.stack)
+          s.stack = state.stack.slice(0);
+        for (var pers = state.persistentStates; pers; pers = pers.next)
+          s.persistentStates = {mode: pers.mode,
+                                spec: pers.spec,
+                                state: pers.state == state.localState ? s.localState : CodeMirror.copyState(pers.mode, pers.state),
+                                next: s.persistentStates};
+        return s;
+      },
+      token: tokenFunction(states_, config),
+      innerMode: function(state) { return state.local && {mode: state.local.mode, state: state.localState}; },
+      indent: indentFunction(states_, meta)
+    };
+    if (meta) for (var prop in meta) if (meta.hasOwnProperty(prop))
+      mode[prop] = meta[prop];
+    return mode;
+  };
+
+  function ensureState(states, name) {
+    if (!states.hasOwnProperty(name))
+      throw new Error("Undefined state " + name + " in simple mode");
+  }
+
+  function toRegex(val, caret) {
+    if (!val) return /(?:)/;
+    var flags = "";
+    if (val instanceof RegExp) {
+      if (val.ignoreCase) flags = "i";
+      if (val.unicode) flags += "u"
+      val = val.source;
+    } else {
+      val = String(val);
+    }
+    return new RegExp((caret === false ? "" : "^") + "(?:" + val + ")", flags);
+  }
+
+  function asToken(val) {
+    if (!val) return null;
+    if (val.apply) return val
+    if (typeof val == "string") return val.replace(/\./g, " ");
+    var result = [];
+    for (var i = 0; i < val.length; i++)
+      result.push(val[i] && val[i].replace(/\./g, " "));
+    return result;
+  }
+
+  function Rule(data, states) {
+    if (data.next || data.push) ensureState(states, data.next || data.push);
+    this.regex = toRegex(data.regex);
+    this.token = asToken(data.token);
+    this.data = data;
+  }
+
+  function tokenFunction(states, config) {
+    return function(stream, state) {
+      if (state.pending) {
+        var pend = state.pending.shift();
+        if (state.pending.length == 0) state.pending = null;
+        stream.pos += pend.text.length;
+        return pend.token;
+      }
+
+      if (state.local) {
+        if (state.local.end && stream.match(state.local.end)) {
+          var tok = state.local.endToken || null;
+          state.local = state.localState = null;
+          return tok;
+        } else {
+          var tok = state.local.mode.token(stream, state.localState), m;
+          if (state.local.endScan && (m = state.local.endScan.exec(stream.current())))
+            stream.pos = stream.start + m.index;
+          return tok;
+        }
+      }
+
+      var curState = states[state.state];
+      for (var i = 0; i < curState.length; i++) {
+        var rule = curState[i];
+        var matches = (!rule.data.sol || stream.sol()) && stream.match(rule.regex);
+        if (matches) {
+          if (rule.data.next) {
+            state.state = rule.data.next;
+          } else if (rule.data.push) {
+            (state.stack || (state.stack = [])).push(state.state);
+            state.state = rule.data.push;
+          } else if (rule.data.pop && state.stack && state.stack.length) {
+            state.state = state.stack.pop();
+          }
+
+          if (rule.data.mode)
+            enterLocalMode(config, state, rule.data.mode, rule.token);
+          if (rule.data.indent)
+            state.indent.push(stream.indentation() + config.indentUnit);
+          if (rule.data.dedent)
+            state.indent.pop();
+          var token = rule.token
+          if (token && token.apply) token = token(matches)
+          if (matches.length > 2 && rule.token && typeof rule.token != "string") {
+            for (var j = 2; j < matches.length; j++)
+              if (matches[j])
+                (state.pending || (state.pending = [])).push({text: matches[j], token: rule.token[j - 1]});
+            stream.backUp(matches[0].length - (matches[1] ? matches[1].length : 0));
+            return token[0];
+          } else if (token && token.join) {
+            return token[0];
+          } else {
+            return token;
+          }
+        }
+      }
+      stream.next();
+      return null;
+    };
+  }
+
+  function cmp(a, b) {
+    if (a === b) return true;
+    if (!a || typeof a != "object" || !b || typeof b != "object") return false;
+    var props = 0;
+    for (var prop in a) if (a.hasOwnProperty(prop)) {
+      if (!b.hasOwnProperty(prop) || !cmp(a[prop], b[prop])) return false;
+      props++;
+    }
+    for (var prop in b) if (b.hasOwnProperty(prop)) props--;
+    return props == 0;
+  }
+
+  function enterLocalMode(config, state, spec, token) {
+    var pers;
+    if (spec.persistent) for (var p = state.persistentStates; p && !pers; p = p.next)
+      if (spec.spec ? cmp(spec.spec, p.spec) : spec.mode == p.mode) pers = p;
+    var mode = pers ? pers.mode : spec.mode || CodeMirror.getMode(config, spec.spec);
+    var lState = pers ? pers.state : CodeMirror.startState(mode);
+    if (spec.persistent && !pers)
+      state.persistentStates = {mode: mode, spec: spec.spec, state: lState, next: state.persistentStates};
+
+    state.localState = lState;
+    state.local = {mode: mode,
+                   end: spec.end && toRegex(spec.end),
+                   endScan: spec.end && spec.forceEnd !== false && toRegex(spec.end, false),
+                   endToken: token && token.join ? token[token.length - 1] : token};
+  }
+
+  function indexOf(val, arr) {
+    for (var i = 0; i < arr.length; i++) if (arr[i] === val) return true;
+  }
+
+  function indentFunction(states, meta) {
+    return function(state, textAfter, line) {
+      if (state.local && state.local.mode.indent)
+        return state.local.mode.indent(state.localState, textAfter, line);
+      if (state.indent == null || state.local || meta.dontIndentStates && indexOf(state.state, meta.dontIndentStates) > -1)
+        return CodeMirror.Pass;
+
+      var pos = state.indent.length - 1, rules = states[state.state];
+      scan: for (;;) {
+        for (var i = 0; i < rules.length; i++) {
+          var rule = rules[i];
+          if (rule.data.dedent && rule.data.dedentIfLineStart !== false) {
+            var m = rule.regex.exec(textAfter);
+            if (m && m[0]) {
+              pos--;
+              if (rule.next || rule.push) rules = states[rule.next || rule.push];
+              textAfter = textAfter.slice(m[0].length);
+              continue scan;
+            }
+          }
+        }
+        break;
+      }
+      return pos < 0 ? 0 : state.indent[pos];
+    };
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/runmode/colorize.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,40 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("./runmode"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "./runmode"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/;
+
+  function textContent(node, out) {
+    if (node.nodeType == 3) return out.push(node.nodeValue);
+    for (var ch = node.firstChild; ch; ch = ch.nextSibling) {
+      textContent(ch, out);
+      if (isBlock.test(node.nodeType)) out.push("\n");
+    }
+  }
+
+  CodeMirror.colorize = function(collection, defaultMode) {
+    if (!collection) collection = document.body.getElementsByTagName("pre");
+
+    for (var i = 0; i < collection.length; ++i) {
+      var node = collection[i];
+      var mode = node.getAttribute("data-lang") || defaultMode;
+      if (!mode) continue;
+
+      var text = [];
+      textContent(node, text);
+      node.textContent = "";
+      CodeMirror.runMode(text.join(""), mode, node);
+
+      node.className += " cm-s-default";
+    }
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/runmode/runmode-standalone.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,334 @@
+(function () {
+  'use strict';
+
+  function copyObj(obj, target, overwrite) {
+    if (!target) { target = {}; }
+    for (var prop in obj)
+      { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
+        { target[prop] = obj[prop]; } }
+    return target
+  }
+
+  // Counts the column offset in a string, taking tabs into account.
+  // Used mostly to find indentation.
+  function countColumn(string, end, tabSize, startIndex, startValue) {
+    if (end == null) {
+      end = string.search(/[^\s\u00a0]/);
+      if (end == -1) { end = string.length; }
+    }
+    for (var i = startIndex || 0, n = startValue || 0;;) {
+      var nextTab = string.indexOf("\t", i);
+      if (nextTab < 0 || nextTab >= end)
+        { return n + (end - i) }
+      n += nextTab - i;
+      n += tabSize - (n % tabSize);
+      i = nextTab + 1;
+    }
+  }
+
+  function nothing() {}
+
+  function createObj(base, props) {
+    var inst;
+    if (Object.create) {
+      inst = Object.create(base);
+    } else {
+      nothing.prototype = base;
+      inst = new nothing();
+    }
+    if (props) { copyObj(props, inst); }
+    return inst
+  }
+
+  // STRING STREAM
+
+  // Fed to the mode parsers, provides helper functions to make
+  // parsers more succinct.
+
+  var StringStream = function(string, tabSize, lineOracle) {
+    this.pos = this.start = 0;
+    this.string = string;
+    this.tabSize = tabSize || 8;
+    this.lastColumnPos = this.lastColumnValue = 0;
+    this.lineStart = 0;
+    this.lineOracle = lineOracle;
+  };
+
+  StringStream.prototype.eol = function () {return this.pos >= this.string.length};
+  StringStream.prototype.sol = function () {return this.pos == this.lineStart};
+  StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
+  StringStream.prototype.next = function () {
+    if (this.pos < this.string.length)
+      { return this.string.charAt(this.pos++) }
+  };
+  StringStream.prototype.eat = function (match) {
+    var ch = this.string.charAt(this.pos);
+    var ok;
+    if (typeof match == "string") { ok = ch == match; }
+    else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
+    if (ok) {++this.pos; return ch}
+  };
+  StringStream.prototype.eatWhile = function (match) {
+    var start = this.pos;
+    while (this.eat(match)){}
+    return this.pos > start
+  };
+  StringStream.prototype.eatSpace = function () {
+    var start = this.pos;
+    while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
+    return this.pos > start
+  };
+  StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
+  StringStream.prototype.skipTo = function (ch) {
+    var found = this.string.indexOf(ch, this.pos);
+    if (found > -1) {this.pos = found; return true}
+  };
+  StringStream.prototype.backUp = function (n) {this.pos -= n;};
+  StringStream.prototype.column = function () {
+    if (this.lastColumnPos < this.start) {
+      this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
+      this.lastColumnPos = this.start;
+    }
+    return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+  };
+  StringStream.prototype.indentation = function () {
+    return countColumn(this.string, null, this.tabSize) -
+      (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+  };
+  StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
+    if (typeof pattern == "string") {
+      var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
+      var substr = this.string.substr(this.pos, pattern.length);
+      if (cased(substr) == cased(pattern)) {
+        if (consume !== false) { this.pos += pattern.length; }
+        return true
+      }
+    } else {
+      var match = this.string.slice(this.pos).match(pattern);
+      if (match && match.index > 0) { return null }
+      if (match && consume !== false) { this.pos += match[0].length; }
+      return match
+    }
+  };
+  StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
+  StringStream.prototype.hideFirstChars = function (n, inner) {
+    this.lineStart += n;
+    try { return inner() }
+    finally { this.lineStart -= n; }
+  };
+  StringStream.prototype.lookAhead = function (n) {
+    var oracle = this.lineOracle;
+    return oracle && oracle.lookAhead(n)
+  };
+  StringStream.prototype.baseToken = function () {
+    var oracle = this.lineOracle;
+    return oracle && oracle.baseToken(this.pos)
+  };
+
+  // Known modes, by name and by MIME
+  var modes = {}, mimeModes = {};
+
+  // Extra arguments are stored as the mode's dependencies, which is
+  // used by (legacy) mechanisms like loadmode.js to automatically
+  // load a mode. (Preferred mechanism is the require/define calls.)
+  function defineMode(name, mode) {
+    if (arguments.length > 2)
+      { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
+    modes[name] = mode;
+  }
+
+  function defineMIME(mime, spec) {
+    mimeModes[mime] = spec;
+  }
+
+  // Given a MIME type, a {name, ...options} config object, or a name
+  // string, return a mode config object.
+  function resolveMode(spec) {
+    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
+      spec = mimeModes[spec];
+    } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
+      var found = mimeModes[spec.name];
+      if (typeof found == "string") { found = {name: found}; }
+      spec = createObj(found, spec);
+      spec.name = found.name;
+    } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
+      return resolveMode("application/xml")
+    } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
+      return resolveMode("application/json")
+    }
+    if (typeof spec == "string") { return {name: spec} }
+    else { return spec || {name: "null"} }
+  }
+
+  // Given a mode spec (anything that resolveMode accepts), find and
+  // initialize an actual mode object.
+  function getMode(options, spec) {
+    spec = resolveMode(spec);
+    var mfactory = modes[spec.name];
+    if (!mfactory) { return getMode(options, "text/plain") }
+    var modeObj = mfactory(options, spec);
+    if (modeExtensions.hasOwnProperty(spec.name)) {
+      var exts = modeExtensions[spec.name];
+      for (var prop in exts) {
+        if (!exts.hasOwnProperty(prop)) { continue }
+        if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
+        modeObj[prop] = exts[prop];
+      }
+    }
+    modeObj.name = spec.name;
+    if (spec.helperType) { modeObj.helperType = spec.helperType; }
+    if (spec.modeProps) { for (var prop$1 in spec.modeProps)
+      { modeObj[prop$1] = spec.modeProps[prop$1]; } }
+
+    return modeObj
+  }
+
+  // This can be used to attach properties to mode objects from
+  // outside the actual mode definition.
+  var modeExtensions = {};
+  function extendMode(mode, properties) {
+    var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
+    copyObj(properties, exts);
+  }
+
+  function copyState(mode, state) {
+    if (state === true) { return state }
+    if (mode.copyState) { return mode.copyState(state) }
+    var nstate = {};
+    for (var n in state) {
+      var val = state[n];
+      if (val instanceof Array) { val = val.concat([]); }
+      nstate[n] = val;
+    }
+    return nstate
+  }
+
+  // Given a mode and a state (for that mode), find the inner mode and
+  // state at the position that the state refers to.
+  function innerMode(mode, state) {
+    var info;
+    while (mode.innerMode) {
+      info = mode.innerMode(state);
+      if (!info || info.mode == mode) { break }
+      state = info.state;
+      mode = info.mode;
+    }
+    return info || {mode: mode, state: state}
+  }
+
+  function startState(mode, a1, a2) {
+    return mode.startState ? mode.startState(a1, a2) : true
+  }
+
+  var modeMethods = {
+    __proto__: null,
+    modes: modes,
+    mimeModes: mimeModes,
+    defineMode: defineMode,
+    defineMIME: defineMIME,
+    resolveMode: resolveMode,
+    getMode: getMode,
+    modeExtensions: modeExtensions,
+    extendMode: extendMode,
+    copyState: copyState,
+    innerMode: innerMode,
+    startState: startState
+  };
+
+  // declare global: globalThis, CodeMirror
+
+  // Create a minimal CodeMirror needed to use runMode, and assign to root.
+  var root = typeof globalThis !== 'undefined' ? globalThis : window;
+  root.CodeMirror = {};
+
+  // Copy StringStream and mode methods into CodeMirror object.
+  CodeMirror.StringStream = StringStream;
+  for (var exported in modeMethods) { CodeMirror[exported] = modeMethods[exported]; }
+
+  // Minimal default mode.
+  CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
+  CodeMirror.defineMIME("text/plain", "null");
+
+  CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min;
+  CodeMirror.splitLines = function(string) { return string.split(/\r?\n|\r/) };
+  CodeMirror.countColumn = countColumn;
+
+  CodeMirror.defaults = { indentUnit: 2 };
+
+  // CodeMirror, copyright (c) by Marijn Haverbeke and others
+  // Distributed under an MIT license: https://codemirror.net/5/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) {
+
+  CodeMirror.runMode = function(string, modespec, callback, options) {
+    var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
+    var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
+
+    // Create a tokenizing callback function if passed-in callback is a DOM element.
+    if (callback.appendChild) {
+      var ie = /MSIE \d/.test(navigator.userAgent);
+      var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
+      var node = callback, col = 0;
+      node.textContent = "";
+      callback = function(text, style) {
+        if (text == "\n") {
+          // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
+          // Emitting a carriage return makes everything ok.
+          node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
+          col = 0;
+          return;
+        }
+        var content = "";
+        // replace tabs
+        for (var pos = 0;;) {
+          var idx = text.indexOf("\t", pos);
+          if (idx == -1) {
+            content += text.slice(pos);
+            col += text.length - pos;
+            break;
+          } else {
+            col += idx - pos;
+            content += text.slice(pos, idx);
+            var size = tabSize - col % tabSize;
+            col += size;
+            for (var i = 0; i < size; ++i) { content += " "; }
+            pos = idx + 1;
+          }
+        }
+        // Create a node with token style and append it to the callback DOM element.
+        if (style) {
+          var sp = node.appendChild(document.createElement("span"));
+          sp.className = "cm-" + style.replace(/ +/g, " cm-");
+          sp.appendChild(document.createTextNode(content));
+        } else {
+          node.appendChild(document.createTextNode(content));
+        }
+      };
+    }
+
+    var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
+    for (var i = 0, e = lines.length; i < e; ++i) {
+      if (i) { callback("\n"); }
+      var stream = new CodeMirror.StringStream(lines[i], null, {
+        lookAhead: function(n) { return lines[i + n] },
+        baseToken: function() {}
+      });
+      if (!stream.string && mode.blankLine) { mode.blankLine(state); }
+      while (!stream.eol()) {
+        var style = mode.token(stream, state);
+        callback(stream.current(), style, i, stream.start, state, mode);
+        stream.start = stream.pos;
+      }
+    }
+  };
+
+  });
+
+}());
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/runmode/runmode.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,76 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.runMode = function(string, modespec, callback, options) {
+  var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
+  var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
+
+  // Create a tokenizing callback function if passed-in callback is a DOM element.
+  if (callback.appendChild) {
+    var ie = /MSIE \d/.test(navigator.userAgent);
+    var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
+    var node = callback, col = 0;
+    node.textContent = "";
+    callback = function(text, style) {
+      if (text == "\n") {
+        // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
+        // Emitting a carriage return makes everything ok.
+        node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
+        col = 0;
+        return;
+      }
+      var content = "";
+      // replace tabs
+      for (var pos = 0;;) {
+        var idx = text.indexOf("\t", pos);
+        if (idx == -1) {
+          content += text.slice(pos);
+          col += text.length - pos;
+          break;
+        } else {
+          col += idx - pos;
+          content += text.slice(pos, idx);
+          var size = tabSize - col % tabSize;
+          col += size;
+          for (var i = 0; i < size; ++i) content += " ";
+          pos = idx + 1;
+        }
+      }
+      // Create a node with token style and append it to the callback DOM element.
+      if (style) {
+        var sp = node.appendChild(document.createElement("span"));
+        sp.className = "cm-" + style.replace(/ +/g, " cm-");
+        sp.appendChild(document.createTextNode(content));
+      } else {
+        node.appendChild(document.createTextNode(content));
+      }
+    };
+  }
+
+  var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
+  for (var i = 0, e = lines.length; i < e; ++i) {
+    if (i) callback("\n");
+    var stream = new CodeMirror.StringStream(lines[i], null, {
+      lookAhead: function(n) { return lines[i + n] },
+      baseToken: function() {}
+    });
+    if (!stream.string && mode.blankLine) mode.blankLine(state);
+    while (!stream.eol()) {
+      var style = mode.token(stream, state);
+      callback(stream.current(), style, i, stream.start, state, mode);
+      stream.start = stream.pos;
+    }
+  }
+};
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/runmode/runmode.node.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,329 @@
+'use strict';
+
+function copyObj(obj, target, overwrite) {
+  if (!target) { target = {}; }
+  for (var prop in obj)
+    { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
+      { target[prop] = obj[prop]; } }
+  return target
+}
+
+// Counts the column offset in a string, taking tabs into account.
+// Used mostly to find indentation.
+function countColumn(string, end, tabSize, startIndex, startValue) {
+  if (end == null) {
+    end = string.search(/[^\s\u00a0]/);
+    if (end == -1) { end = string.length; }
+  }
+  for (var i = startIndex || 0, n = startValue || 0;;) {
+    var nextTab = string.indexOf("\t", i);
+    if (nextTab < 0 || nextTab >= end)
+      { return n + (end - i) }
+    n += nextTab - i;
+    n += tabSize - (n % tabSize);
+    i = nextTab + 1;
+  }
+}
+
+function nothing() {}
+
+function createObj(base, props) {
+  var inst;
+  if (Object.create) {
+    inst = Object.create(base);
+  } else {
+    nothing.prototype = base;
+    inst = new nothing();
+  }
+  if (props) { copyObj(props, inst); }
+  return inst
+}
+
+// STRING STREAM
+
+// Fed to the mode parsers, provides helper functions to make
+// parsers more succinct.
+
+var StringStream = function(string, tabSize, lineOracle) {
+  this.pos = this.start = 0;
+  this.string = string;
+  this.tabSize = tabSize || 8;
+  this.lastColumnPos = this.lastColumnValue = 0;
+  this.lineStart = 0;
+  this.lineOracle = lineOracle;
+};
+
+StringStream.prototype.eol = function () {return this.pos >= this.string.length};
+StringStream.prototype.sol = function () {return this.pos == this.lineStart};
+StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
+StringStream.prototype.next = function () {
+  if (this.pos < this.string.length)
+    { return this.string.charAt(this.pos++) }
+};
+StringStream.prototype.eat = function (match) {
+  var ch = this.string.charAt(this.pos);
+  var ok;
+  if (typeof match == "string") { ok = ch == match; }
+  else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
+  if (ok) {++this.pos; return ch}
+};
+StringStream.prototype.eatWhile = function (match) {
+  var start = this.pos;
+  while (this.eat(match)){}
+  return this.pos > start
+};
+StringStream.prototype.eatSpace = function () {
+  var start = this.pos;
+  while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
+  return this.pos > start
+};
+StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
+StringStream.prototype.skipTo = function (ch) {
+  var found = this.string.indexOf(ch, this.pos);
+  if (found > -1) {this.pos = found; return true}
+};
+StringStream.prototype.backUp = function (n) {this.pos -= n;};
+StringStream.prototype.column = function () {
+  if (this.lastColumnPos < this.start) {
+    this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
+    this.lastColumnPos = this.start;
+  }
+  return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+};
+StringStream.prototype.indentation = function () {
+  return countColumn(this.string, null, this.tabSize) -
+    (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+};
+StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
+  if (typeof pattern == "string") {
+    var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
+    var substr = this.string.substr(this.pos, pattern.length);
+    if (cased(substr) == cased(pattern)) {
+      if (consume !== false) { this.pos += pattern.length; }
+      return true
+    }
+  } else {
+    var match = this.string.slice(this.pos).match(pattern);
+    if (match && match.index > 0) { return null }
+    if (match && consume !== false) { this.pos += match[0].length; }
+    return match
+  }
+};
+StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
+StringStream.prototype.hideFirstChars = function (n, inner) {
+  this.lineStart += n;
+  try { return inner() }
+  finally { this.lineStart -= n; }
+};
+StringStream.prototype.lookAhead = function (n) {
+  var oracle = this.lineOracle;
+  return oracle && oracle.lookAhead(n)
+};
+StringStream.prototype.baseToken = function () {
+  var oracle = this.lineOracle;
+  return oracle && oracle.baseToken(this.pos)
+};
+
+// Known modes, by name and by MIME
+var modes = {}, mimeModes = {};
+
+// Extra arguments are stored as the mode's dependencies, which is
+// used by (legacy) mechanisms like loadmode.js to automatically
+// load a mode. (Preferred mechanism is the require/define calls.)
+function defineMode(name, mode) {
+  if (arguments.length > 2)
+    { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
+  modes[name] = mode;
+}
+
+function defineMIME(mime, spec) {
+  mimeModes[mime] = spec;
+}
+
+// Given a MIME type, a {name, ...options} config object, or a name
+// string, return a mode config object.
+function resolveMode(spec) {
+  if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
+    spec = mimeModes[spec];
+  } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
+    var found = mimeModes[spec.name];
+    if (typeof found == "string") { found = {name: found}; }
+    spec = createObj(found, spec);
+    spec.name = found.name;
+  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
+    return resolveMode("application/xml")
+  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
+    return resolveMode("application/json")
+  }
+  if (typeof spec == "string") { return {name: spec} }
+  else { return spec || {name: "null"} }
+}
+
+// Given a mode spec (anything that resolveMode accepts), find and
+// initialize an actual mode object.
+function getMode(options, spec) {
+  spec = resolveMode(spec);
+  var mfactory = modes[spec.name];
+  if (!mfactory) { return getMode(options, "text/plain") }
+  var modeObj = mfactory(options, spec);
+  if (modeExtensions.hasOwnProperty(spec.name)) {
+    var exts = modeExtensions[spec.name];
+    for (var prop in exts) {
+      if (!exts.hasOwnProperty(prop)) { continue }
+      if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
+      modeObj[prop] = exts[prop];
+    }
+  }
+  modeObj.name = spec.name;
+  if (spec.helperType) { modeObj.helperType = spec.helperType; }
+  if (spec.modeProps) { for (var prop$1 in spec.modeProps)
+    { modeObj[prop$1] = spec.modeProps[prop$1]; } }
+
+  return modeObj
+}
+
+// This can be used to attach properties to mode objects from
+// outside the actual mode definition.
+var modeExtensions = {};
+function extendMode(mode, properties) {
+  var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
+  copyObj(properties, exts);
+}
+
+function copyState(mode, state) {
+  if (state === true) { return state }
+  if (mode.copyState) { return mode.copyState(state) }
+  var nstate = {};
+  for (var n in state) {
+    var val = state[n];
+    if (val instanceof Array) { val = val.concat([]); }
+    nstate[n] = val;
+  }
+  return nstate
+}
+
+// Given a mode and a state (for that mode), find the inner mode and
+// state at the position that the state refers to.
+function innerMode(mode, state) {
+  var info;
+  while (mode.innerMode) {
+    info = mode.innerMode(state);
+    if (!info || info.mode == mode) { break }
+    state = info.state;
+    mode = info.mode;
+  }
+  return info || {mode: mode, state: state}
+}
+
+function startState(mode, a1, a2) {
+  return mode.startState ? mode.startState(a1, a2) : true
+}
+
+var modeMethods = {
+  __proto__: null,
+  modes: modes,
+  mimeModes: mimeModes,
+  defineMode: defineMode,
+  defineMIME: defineMIME,
+  resolveMode: resolveMode,
+  getMode: getMode,
+  modeExtensions: modeExtensions,
+  extendMode: extendMode,
+  copyState: copyState,
+  innerMode: innerMode,
+  startState: startState
+};
+
+// Copy StringStream and mode methods into exports (CodeMirror) object.
+exports.StringStream = StringStream;
+exports.countColumn = countColumn;
+for (var exported in modeMethods) { exports[exported] = modeMethods[exported]; }
+
+// Shim library CodeMirror with the minimal CodeMirror defined above.
+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")];
+
+// Minimal default mode.
+exports.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
+exports.defineMIME("text/plain", "null");
+
+exports.registerHelper = exports.registerGlobalHelper = Math.min;
+exports.splitLines = function(string) { return string.split(/\r?\n|\r/) };
+
+exports.defaults = { indentUnit: 2 };
+
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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) {
+
+CodeMirror.runMode = function(string, modespec, callback, options) {
+  var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
+  var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
+
+  // Create a tokenizing callback function if passed-in callback is a DOM element.
+  if (callback.appendChild) {
+    var ie = /MSIE \d/.test(navigator.userAgent);
+    var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
+    var node = callback, col = 0;
+    node.textContent = "";
+    callback = function(text, style) {
+      if (text == "\n") {
+        // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
+        // Emitting a carriage return makes everything ok.
+        node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
+        col = 0;
+        return;
+      }
+      var content = "";
+      // replace tabs
+      for (var pos = 0;;) {
+        var idx = text.indexOf("\t", pos);
+        if (idx == -1) {
+          content += text.slice(pos);
+          col += text.length - pos;
+          break;
+        } else {
+          col += idx - pos;
+          content += text.slice(pos, idx);
+          var size = tabSize - col % tabSize;
+          col += size;
+          for (var i = 0; i < size; ++i) { content += " "; }
+          pos = idx + 1;
+        }
+      }
+      // Create a node with token style and append it to the callback DOM element.
+      if (style) {
+        var sp = node.appendChild(document.createElement("span"));
+        sp.className = "cm-" + style.replace(/ +/g, " cm-");
+        sp.appendChild(document.createTextNode(content));
+      } else {
+        node.appendChild(document.createTextNode(content));
+      }
+    };
+  }
+
+  var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
+  for (var i = 0, e = lines.length; i < e; ++i) {
+    if (i) { callback("\n"); }
+    var stream = new CodeMirror.StringStream(lines[i], null, {
+      lookAhead: function(n) { return lines[i + n] },
+      baseToken: function() {}
+    });
+    if (!stream.string && mode.blankLine) { mode.blankLine(state); }
+    while (!stream.eol()) {
+      var style = mode.token(stream, state);
+      callback(stream.current(), style, i, stream.start, state, mode);
+      stream.start = stream.pos;
+    }
+  }
+};
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/scroll/annotatescrollbar.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,128 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineExtension("annotateScrollbar", function(options) {
+    if (typeof options == "string") options = {className: options};
+    return new Annotation(this, options);
+  });
+
+  CodeMirror.defineOption("scrollButtonHeight", 0);
+
+  function Annotation(cm, options) {
+    this.cm = cm;
+    this.options = options;
+    this.buttonHeight = options.scrollButtonHeight || cm.getOption("scrollButtonHeight");
+    this.annotations = [];
+    this.doRedraw = this.doUpdate = null;
+    this.div = cm.getWrapperElement().appendChild(document.createElement("div"));
+    this.div.style.cssText = "position: absolute; right: 0; top: 0; z-index: 7; pointer-events: none";
+    this.computeScale();
+
+    function scheduleRedraw(delay) {
+      clearTimeout(self.doRedraw);
+      self.doRedraw = setTimeout(function() { self.redraw(); }, delay);
+    }
+
+    var self = this;
+    cm.on("refresh", this.resizeHandler = function() {
+      clearTimeout(self.doUpdate);
+      self.doUpdate = setTimeout(function() {
+        if (self.computeScale()) scheduleRedraw(20);
+      }, 100);
+    });
+    cm.on("markerAdded", this.resizeHandler);
+    cm.on("markerCleared", this.resizeHandler);
+    if (options.listenForChanges !== false)
+      cm.on("changes", this.changeHandler = function() {
+        scheduleRedraw(250);
+      });
+  }
+
+  Annotation.prototype.computeScale = function() {
+    var cm = this.cm;
+    var hScale = (cm.getWrapperElement().clientHeight - cm.display.barHeight - this.buttonHeight * 2) /
+      cm.getScrollerElement().scrollHeight
+    if (hScale != this.hScale) {
+      this.hScale = hScale;
+      return true;
+    }
+  };
+
+  Annotation.prototype.update = function(annotations) {
+    this.annotations = annotations;
+    this.redraw();
+  };
+
+  Annotation.prototype.redraw = function(compute) {
+    if (compute !== false) this.computeScale();
+    var cm = this.cm, hScale = this.hScale;
+
+    var frag = document.createDocumentFragment(), anns = this.annotations;
+
+    var wrapping = cm.getOption("lineWrapping");
+    var singleLineH = wrapping && cm.defaultTextHeight() * 1.5;
+    var curLine = null, curLineObj = null;
+
+    function getY(pos, top) {
+      if (curLine != pos.line) {
+        curLine = pos.line
+        curLineObj = cm.getLineHandle(pos.line)
+        var visual = cm.getLineHandleVisualStart(curLineObj)
+        if (visual != curLineObj) {
+          curLine = cm.getLineNumber(visual)
+          curLineObj = visual
+        }
+      }
+      if ((curLineObj.widgets && curLineObj.widgets.length) ||
+          (wrapping && curLineObj.height > singleLineH))
+        return cm.charCoords(pos, "local")[top ? "top" : "bottom"];
+      var topY = cm.heightAtLine(curLineObj, "local");
+      return topY + (top ? 0 : curLineObj.height);
+    }
+
+    var lastLine = cm.lastLine()
+    if (cm.display.barWidth) for (var i = 0, nextTop; i < anns.length; i++) {
+      var ann = anns[i];
+      if (ann.to.line > lastLine) continue;
+      var top = nextTop || getY(ann.from, true) * hScale;
+      var bottom = getY(ann.to, false) * hScale;
+      while (i < anns.length - 1) {
+        if (anns[i + 1].to.line > lastLine) break;
+        nextTop = getY(anns[i + 1].from, true) * hScale;
+        if (nextTop > bottom + .9) break;
+        ann = anns[++i];
+        bottom = getY(ann.to, false) * hScale;
+      }
+      if (bottom == top) continue;
+      var height = Math.max(bottom - top, 3);
+
+      var elt = frag.appendChild(document.createElement("div"));
+      elt.style.cssText = "position: absolute; right: 0px; width: " + Math.max(cm.display.barWidth - 1, 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);
+  };
+
+  Annotation.prototype.clear = function() {
+    this.cm.off("refresh", this.resizeHandler);
+    this.cm.off("markerAdded", this.resizeHandler);
+    this.cm.off("markerCleared", this.resizeHandler);
+    if (this.changeHandler) this.cm.off("changes", this.changeHandler);
+    this.div.parentNode.removeChild(this.div);
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/scroll/scrollpastend.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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("scrollPastEnd", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      cm.off("change", onChange);
+      cm.off("refresh", updateBottomMargin);
+      cm.display.lineSpace.parentNode.style.paddingBottom = "";
+      cm.state.scrollPastEndPadding = null;
+    }
+    if (val) {
+      cm.on("change", onChange);
+      cm.on("refresh", updateBottomMargin);
+      updateBottomMargin(cm);
+    }
+  });
+
+  function onChange(cm, change) {
+    if (CodeMirror.changeEnd(change).line == cm.lastLine())
+      updateBottomMargin(cm);
+  }
+
+  function updateBottomMargin(cm) {
+    var padding = "";
+    if (cm.lineCount() > 1) {
+      var totalH = cm.display.scroller.clientHeight - 30,
+          lastLineH = cm.getLineHandle(cm.lastLine()).height;
+      padding = (totalH - lastLineH) + "px";
+    }
+    if (cm.state.scrollPastEndPadding != padding) {
+      cm.state.scrollPastEndPadding = padding;
+      cm.display.lineSpace.parentNode.style.paddingBottom = padding;
+      cm.off("refresh", updateBottomMargin);
+      cm.setSize();
+      cm.on("refresh", updateBottomMargin);
+    }
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/scroll/simplescrollbars.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+.CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div {
+  position: absolute;
+  background: #ccc;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+  border: 1px solid #bbb;
+  border-radius: 2px;
+}
+
+.CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical {
+  position: absolute;
+  z-index: 6;
+  background: #eee;
+}
+
+.CodeMirror-simplescroll-horizontal {
+  bottom: 0; left: 0;
+  height: 8px;
+}
+.CodeMirror-simplescroll-horizontal div {
+  bottom: 0;
+  height: 100%;
+}
+
+.CodeMirror-simplescroll-vertical {
+  right: 0; top: 0;
+  width: 8px;
+}
+.CodeMirror-simplescroll-vertical div {
+  right: 0;
+  width: 100%;
+}
+
+
+.CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler {
+  display: none;
+}
+
+.CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div {
+  position: absolute;
+  background: #bcd;
+  border-radius: 3px;
+}
+
+.CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical {
+  position: absolute;
+  z-index: 6;
+}
+
+.CodeMirror-overlayscroll-horizontal {
+  bottom: 0; left: 0;
+  height: 6px;
+}
+.CodeMirror-overlayscroll-horizontal div {
+  bottom: 0;
+  height: 100%;
+}
+
+.CodeMirror-overlayscroll-vertical {
+  right: 0; top: 0;
+  width: 6px;
+}
+.CodeMirror-overlayscroll-vertical div {
+  right: 0;
+  width: 100%;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/scroll/simplescrollbars.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,152 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  function Bar(cls, orientation, scroll) {
+    this.orientation = orientation;
+    this.scroll = scroll;
+    this.screen = this.total = this.size = 1;
+    this.pos = 0;
+
+    this.node = document.createElement("div");
+    this.node.className = cls + "-" + orientation;
+    this.inner = this.node.appendChild(document.createElement("div"));
+
+    var self = this;
+    CodeMirror.on(this.inner, "mousedown", function(e) {
+      if (e.which != 1) return;
+      CodeMirror.e_preventDefault(e);
+      var axis = self.orientation == "horizontal" ? "pageX" : "pageY";
+      var start = e[axis], startpos = self.pos;
+      function done() {
+        CodeMirror.off(document, "mousemove", move);
+        CodeMirror.off(document, "mouseup", done);
+      }
+      function move(e) {
+        if (e.which != 1) return done();
+        self.moveTo(startpos + (e[axis] - start) * (self.total / self.size));
+      }
+      CodeMirror.on(document, "mousemove", move);
+      CodeMirror.on(document, "mouseup", done);
+    });
+
+    CodeMirror.on(this.node, "click", function(e) {
+      CodeMirror.e_preventDefault(e);
+      var innerBox = self.inner.getBoundingClientRect(), where;
+      if (self.orientation == "horizontal")
+        where = e.clientX < innerBox.left ? -1 : e.clientX > innerBox.right ? 1 : 0;
+      else
+        where = e.clientY < innerBox.top ? -1 : e.clientY > innerBox.bottom ? 1 : 0;
+      self.moveTo(self.pos + where * self.screen);
+    });
+
+    function onWheel(e) {
+      var moved = CodeMirror.wheelEventPixels(e)[self.orientation == "horizontal" ? "x" : "y"];
+      var oldPos = self.pos;
+      self.moveTo(self.pos + moved);
+      if (self.pos != oldPos) CodeMirror.e_preventDefault(e);
+    }
+    CodeMirror.on(this.node, "mousewheel", onWheel);
+    CodeMirror.on(this.node, "DOMMouseScroll", onWheel);
+  }
+
+  Bar.prototype.setPos = function(pos, force) {
+    if (pos < 0) pos = 0;
+    if (pos > this.total - this.screen) pos = this.total - this.screen;
+    if (!force && pos == this.pos) return false;
+    this.pos = pos;
+    this.inner.style[this.orientation == "horizontal" ? "left" : "top"] =
+      (pos * (this.size / this.total)) + "px";
+    return true
+  };
+
+  Bar.prototype.moveTo = function(pos) {
+    if (this.setPos(pos)) this.scroll(pos, this.orientation);
+  }
+
+  var minButtonSize = 10;
+
+  Bar.prototype.update = function(scrollSize, clientSize, barSize) {
+    var sizeChanged = this.screen != clientSize || this.total != scrollSize || this.size != barSize
+    if (sizeChanged) {
+      this.screen = clientSize;
+      this.total = scrollSize;
+      this.size = barSize;
+    }
+
+    var buttonSize = this.screen * (this.size / this.total);
+    if (buttonSize < minButtonSize) {
+      this.size -= minButtonSize - buttonSize;
+      buttonSize = minButtonSize;
+    }
+    this.inner.style[this.orientation == "horizontal" ? "width" : "height"] =
+      buttonSize + "px";
+    this.setPos(this.pos, sizeChanged);
+  };
+
+  function SimpleScrollbars(cls, place, scroll) {
+    this.addClass = cls;
+    this.horiz = new Bar(cls, "horizontal", scroll);
+    place(this.horiz.node);
+    this.vert = new Bar(cls, "vertical", scroll);
+    place(this.vert.node);
+    this.width = null;
+  }
+
+  SimpleScrollbars.prototype.update = function(measure) {
+    if (this.width == null) {
+      var style = window.getComputedStyle ? window.getComputedStyle(this.horiz.node) : this.horiz.node.currentStyle;
+      if (style) this.width = parseInt(style.height);
+    }
+    var width = this.width || 0;
+
+    var needsH = measure.scrollWidth > measure.clientWidth + 1;
+    var needsV = measure.scrollHeight > measure.clientHeight + 1;
+    this.vert.node.style.display = needsV ? "block" : "none";
+    this.horiz.node.style.display = needsH ? "block" : "none";
+
+    if (needsV) {
+      this.vert.update(measure.scrollHeight, measure.clientHeight,
+                       measure.viewHeight - (needsH ? width : 0));
+      this.vert.node.style.bottom = needsH ? width + "px" : "0";
+    }
+    if (needsH) {
+      this.horiz.update(measure.scrollWidth, measure.clientWidth,
+                        measure.viewWidth - (needsV ? width : 0) - measure.barLeft);
+      this.horiz.node.style.right = needsV ? width + "px" : "0";
+      this.horiz.node.style.left = measure.barLeft + "px";
+    }
+
+    return {right: needsV ? width : 0, bottom: needsH ? width : 0};
+  };
+
+  SimpleScrollbars.prototype.setScrollTop = function(pos) {
+    this.vert.setPos(pos);
+  };
+
+  SimpleScrollbars.prototype.setScrollLeft = function(pos) {
+    this.horiz.setPos(pos);
+  };
+
+  SimpleScrollbars.prototype.clear = function() {
+    var parent = this.horiz.node.parentNode;
+    parent.removeChild(this.horiz.node);
+    parent.removeChild(this.vert.node);
+  };
+
+  CodeMirror.scrollbarModel.simple = function(place, scroll) {
+    return new SimpleScrollbars("CodeMirror-simplescroll", place, scroll);
+  };
+  CodeMirror.scrollbarModel.overlay = function(place, scroll) {
+    return new SimpleScrollbars("CodeMirror-overlayscroll", place, scroll);
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/search/jump-to-line.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,53 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  // default search panel location
+  CodeMirror.defineOption("search", {bottom: false});
+
+  function dialog(cm, text, shortText, deflt, f) {
+    if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true, bottom: cm.options.search.bottom});
+    else f(prompt(shortText, deflt));
+  }
+
+  function getJumpDialog(cm) {
+    return cm.phrase("Jump to line:") + ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use line:column or scroll% syntax)") + '</span>';
+  }
+
+  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, getJumpDialog(cm), cm.phrase("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";
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/search/match-highlighter.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,167 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Highlighting text that matches the selection
+//
+// Defines an option highlightSelectionMatches, which, when enabled,
+// will style strings that match the selection throughout the
+// document.
+//
+// The option can be set to true to simply enable it, or to a
+// {minChars, style, wordsOnly, showToken, delay} object to explicitly
+// configure it. minChars is the minimum amount of characters that should be
+// selected for the behavior to occur, and style is the token style to
+// apply to the matches. This will be prefixed by "cm-" to create an
+// actual CSS class name. If wordsOnly is enabled, the matches will be
+// 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. If annotateScrollbar is enabled, the occurrences
+// will be highlighted on the scrollbar via the matchesonscrollbar addon.
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("./matchesonscrollbar"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "./matchesonscrollbar"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var defaults = {
+    style: "matchhighlight",
+    minChars: 2,
+    delay: 100,
+    wordsOnly: false,
+    annotateScrollbar: false,
+    showToken: false,
+    trim: true
+  }
+
+  function State(options) {
+    this.options = {}
+    for (var name in defaults)
+      this.options[name] = (options && options.hasOwnProperty(name) ? options : defaults)[name]
+    this.overlay = this.timeout = null;
+    this.matchesonscroll = null;
+    this.active = false;
+  }
+
+  CodeMirror.defineOption("highlightSelectionMatches", false, function(cm, val, old) {
+    if (old && old != CodeMirror.Init) {
+      removeOverlay(cm);
+      clearTimeout(cm.state.matchHighlighter.timeout);
+      cm.state.matchHighlighter = null;
+      cm.off("cursorActivity", cursorActivity);
+      cm.off("focus", onFocus)
+    }
+    if (val) {
+      var state = cm.state.matchHighlighter = new State(val);
+      if (cm.hasFocus()) {
+        state.active = true
+        highlightMatches(cm)
+      } else {
+        cm.on("focus", onFocus)
+      }
+      cm.on("cursorActivity", cursorActivity);
+    }
+  });
+
+  function cursorActivity(cm) {
+    var state = cm.state.matchHighlighter;
+    if (state.active || cm.hasFocus()) scheduleHighlight(cm, state)
+  }
+
+  function onFocus(cm) {
+    var state = cm.state.matchHighlighter
+    if (!state.active) {
+      state.active = true
+      scheduleHighlight(cm, state)
+    }
+  }
+
+  function scheduleHighlight(cm, state) {
+    clearTimeout(state.timeout);
+    state.timeout = setTimeout(function() {highlightMatches(cm);}, state.options.delay);
+  }
+
+  function addOverlay(cm, query, hasBoundary, style) {
+    var state = cm.state.matchHighlighter;
+    cm.addOverlay(state.overlay = makeOverlay(query, hasBoundary, style));
+    if (state.options.annotateScrollbar && cm.showMatchesOnScrollbar) {
+      var searchFor = hasBoundary ? new RegExp((/\w/.test(query.charAt(0)) ? "\\b" : "") +
+                                               query.replace(/[\\\[.+*?(){|^$]/g, "\\$&") +
+                                               (/\w/.test(query.charAt(query.length - 1)) ? "\\b" : "")) : query;
+      state.matchesonscroll = cm.showMatchesOnScrollbar(searchFor, false,
+        {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.matchesonscroll) {
+        state.matchesonscroll.clear();
+        state.matchesonscroll = null;
+      }
+    }
+  }
+
+  function highlightMatches(cm) {
+    cm.operation(function() {
+      var state = cm.state.matchHighlighter;
+      removeOverlay(cm);
+      if (!cm.somethingSelected() && state.options.showToken) {
+        var re = state.options.showToken === true ? /[\w$]/ : state.options.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)
+          addOverlay(cm, line.slice(start, end), re, state.options.style);
+        return;
+      }
+      var from = cm.getCursor("from"), to = cm.getCursor("to");
+      if (from.line != to.line) return;
+      if (state.options.wordsOnly && !isWord(cm, from, to)) return;
+      var selection = cm.getRange(from, to)
+      if (state.options.trim) selection = selection.replace(/^\s+|\s+$/g, "")
+      if (selection.length >= state.options.minChars)
+        addOverlay(cm, selection, false, state.options.style);
+    });
+  }
+
+  function isWord(cm, from, to) {
+    var str = cm.getRange(from, to);
+    if (str.match(/^\w+$/) !== null) {
+        if (from.ch > 0) {
+            var pos = {line: from.line, ch: from.ch - 1};
+            var chr = cm.getRange(pos, from);
+            if (chr.match(/\W/) === null) return false;
+        }
+        if (to.ch < cm.getLine(from.line).length) {
+            var pos = {line: to.line, ch: to.ch + 1};
+            var chr = cm.getRange(to, pos);
+            if (chr.match(/\W/) === null) return false;
+        }
+        return true;
+    } else return false;
+  }
+
+  function boundariesAround(stream, re) {
+    return (!stream.start || !re.test(stream.string.charAt(stream.start - 1))) &&
+      (stream.pos == stream.string.length || !re.test(stream.string.charAt(stream.pos)));
+  }
+
+  function makeOverlay(query, hasBoundary, style) {
+    return {token: function(stream) {
+      if (stream.match(query) &&
+          (!hasBoundary || boundariesAround(stream, hasBoundary)))
+        return style;
+      stream.next();
+      stream.skipTo(query.charAt(0)) || stream.skipToEnd();
+    }};
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/search/matchesonscrollbar.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,8 @@
+.CodeMirror-search-match {
+  background: gold;
+  border-top: 1px solid orange;
+  border-bottom: 1px solid orange;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+  opacity: .5;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/search/matchesonscrollbar.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,97 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("./searchcursor"), require("../scroll/annotatescrollbar"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "./searchcursor", "../scroll/annotatescrollbar"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineExtension("showMatchesOnScrollbar", function(query, caseFold, options) {
+    if (typeof options == "string") options = {className: options};
+    if (!options) options = {};
+    return new SearchAnnotation(this, query, caseFold, options);
+  });
+
+  function SearchAnnotation(cm, query, caseFold, options) {
+    this.cm = cm;
+    this.options = options;
+    var annotateOptions = {listenForChanges: false};
+    for (var prop in options) annotateOptions[prop] = options[prop];
+    if (!annotateOptions.className) annotateOptions.className = "CodeMirror-search-match";
+    this.annotation = cm.annotateScrollbar(annotateOptions);
+    this.query = query;
+    this.caseFold = caseFold;
+    this.gap = {from: cm.firstLine(), to: cm.lastLine() + 1};
+    this.matches = [];
+    this.update = null;
+
+    this.findMatches();
+    this.annotation.update(this.matches);
+
+    var self = this;
+    cm.on("change", this.changeHandler = function(_cm, change) { self.onChange(change); });
+  }
+
+  var MAX_MATCHES = 1000;
+
+  SearchAnnotation.prototype.findMatches = function() {
+    if (!this.gap) return;
+    for (var i = 0; i < this.matches.length; i++) {
+      var match = this.matches[i];
+      if (match.from.line >= this.gap.to) break;
+      if (match.to.line >= this.gap.from) this.matches.splice(i--, 1);
+    }
+    var cursor = this.cm.getSearchCursor(this.query, CodeMirror.Pos(this.gap.from, 0), {caseFold: this.caseFold, multiline: this.options.multiline});
+    var maxMatches = this.options && this.options.maxMatches || MAX_MATCHES;
+    while (cursor.findNext()) {
+      var match = {from: cursor.from(), to: cursor.to()};
+      if (match.from.line >= this.gap.to) break;
+      this.matches.splice(i++, 0, match);
+      if (this.matches.length > maxMatches) break;
+    }
+    this.gap = null;
+  };
+
+  function offsetLine(line, changeStart, sizeChange) {
+    if (line <= changeStart) return line;
+    return Math.max(changeStart, line + sizeChange);
+  }
+
+  SearchAnnotation.prototype.onChange = function(change) {
+    var startLine = change.from.line;
+    var endLine = CodeMirror.changeEnd(change).line;
+    var sizeChange = endLine - change.to.line;
+    if (this.gap) {
+      this.gap.from = Math.min(offsetLine(this.gap.from, startLine, sizeChange), change.from.line);
+      this.gap.to = Math.max(offsetLine(this.gap.to, startLine, sizeChange), change.from.line);
+    } else {
+      this.gap = {from: change.from.line, to: endLine + 1};
+    }
+
+    if (sizeChange) for (var i = 0; i < this.matches.length; i++) {
+      var match = this.matches[i];
+      var newFrom = offsetLine(match.from.line, startLine, sizeChange);
+      if (newFrom != match.from.line) match.from = CodeMirror.Pos(newFrom, match.from.ch);
+      var newTo = offsetLine(match.to.line, startLine, sizeChange);
+      if (newTo != match.to.line) match.to = CodeMirror.Pos(newTo, match.to.ch);
+    }
+    clearTimeout(this.update);
+    var self = this;
+    this.update = setTimeout(function() { self.updateAfterChange(); }, 250);
+  };
+
+  SearchAnnotation.prototype.updateAfterChange = function() {
+    this.findMatches();
+    this.annotation.update(this.matches);
+  };
+
+  SearchAnnotation.prototype.clear = function() {
+    this.cm.off("change", this.changeHandler);
+    this.annotation.clear();
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/search/search.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,295 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Define search commands. Depends on dialog.js or another
+// implementation of the openDialog method.
+
+// Replace works a little oddly -- it will do the replace on the next
+// Ctrl-G (or whatever is bound to findNext) press. You prevent a
+// replace by making sure the match is no longer selected when hitting
+// Ctrl-G.
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("./searchcursor"), require("../dialog/dialog"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "./searchcursor", "../dialog/dialog"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  // default search panel location
+  CodeMirror.defineOption("search", {bottom: false});
+
+  function searchOverlay(query, caseInsensitive) {
+    if (typeof query == "string")
+      query = new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\\$&"), caseInsensitive ? "gi" : "g");
+    else if (!query.global)
+      query = new RegExp(query.source, query.ignoreCase ? "gi" : "g");
+
+    return {token: function(stream) {
+      query.lastIndex = stream.pos;
+      var match = query.exec(stream.string);
+      if (match && match.index == stream.pos) {
+        stream.pos += match[0].length || 1;
+        return "searching";
+      } else if (match) {
+        stream.pos = match.index;
+      } else {
+        stream.skipToEnd();
+      }
+    }};
+  }
+
+  function SearchState() {
+    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, {caseFold: queryCaseInsensitive(query), multiline: true});
+  }
+
+  function persistentDialog(cm, text, deflt, onEnter, onKeyDown) {
+    cm.openDialog(text, onEnter, {
+      value: deflt,
+      selectValueOnOpen: true,
+      closeOnEnter: false,
+      onClose: function() { clearSearch(cm); },
+      onKeyDown: onKeyDown,
+      bottom: cm.options.search.bottom
+    });
+  }
+
+  function dialog(cm, text, shortText, deflt, f) {
+    if (cm.openDialog) cm.openDialog(text, f, {value: deflt, selectValueOnOpen: true, bottom: cm.options.search.bottom});
+    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(/\\([nrt\\])/g, function(match, ch) {
+      if (ch == "n") return "\n"
+      if (ch == "r") return "\r"
+      if (ch == "t") return "\t"
+      if (ch == "\\") return "\\"
+      return match
+    })
+  }
+
+  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;
+  }
+
+  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, immediate) {
+    var state = getSearchState(cm);
+    if (state.query) return findNext(cm, rev);
+    var q = cm.getSelection() || state.lastQuery;
+    if (q instanceof RegExp && q.source == "x^") q = null
+    if (persistent && cm.openDialog) {
+      var hiding = null
+      var searchNext = function(query, event) {
+        CodeMirror.e_stop(event);
+        if (!query) return;
+        if (query != state.queryText) {
+          startSearch(cm, state, query);
+          state.posFrom = state.posTo = cm.getCursor();
+        }
+        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
+        })
+      };
+      persistentDialog(cm, getQueryDialog(cm), q, searchNext, function(event, query) {
+        var keyName = CodeMirror.keyName(event)
+        var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName]
+        if (cmd == "findNext" || cmd == "findPrev" ||
+          cmd == "findPersistentNext" || cmd == "findPersistentPrev") {
+          CodeMirror.e_stop(event);
+          startSearch(cm, getSearchState(cm), query);
+          cm.execCommand(cmd);
+        } else if (cmd == "find" || cmd == "findPersistent") {
+          CodeMirror.e_stop(event);
+          searchNext(query, event);
+        }
+      });
+      if (immediate && q) {
+        startSearch(cm, state, q);
+        findNext(cm, rev);
+      }
+    } else {
+      dialog(cm, getQueryDialog(cm), "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, callback) {cm.operation(function() {
+    var state = getSearchState(cm);
+    var cursor = getSearchCursor(cm, state.query, rev ? state.posFrom : state.posTo);
+    if (!cursor.find(rev)) {
+      cursor = getSearchCursor(cm, state.query, rev ? CodeMirror.Pos(cm.lastLine()) : CodeMirror.Pos(cm.firstLine(), 0));
+      if (!cursor.find(rev)) return;
+    }
+    cm.setSelection(cursor.from(), 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 = state.queryText = null;
+    cm.removeOverlay(state.overlay);
+    if (state.annotate) { state.annotate.clear(); state.annotate = null; }
+  });}
+
+  function el(tag, attrs) {
+    var element = tag ? document.createElement(tag) : document.createDocumentFragment();
+    for (var key in attrs) {
+      element[key] = attrs[key];
+    }
+    for (var i = 2; i < arguments.length; i++) {
+      var child = arguments[i]
+      element.appendChild(typeof child == "string" ? document.createTextNode(child) : child);
+    }
+    return element;
+  }
+
+  function getQueryDialog(cm)  {
+    var label = el("label", {className: "CodeMirror-search-label"},
+                   cm.phrase("Search:"),
+                   el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field",
+                                id: "CodeMirror-search-field"}));
+    label.setAttribute("for","CodeMirror-search-field");
+    return el("", null, label, " ",
+              el("span", {style: "color: #666", className: "CodeMirror-search-hint"},
+                 cm.phrase("(Use /re/ syntax for regexp search)")));
+  }
+  function getReplaceQueryDialog(cm) {
+    return el("", null, " ",
+              el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}), " ",
+              el("span", {style: "color: #666", className: "CodeMirror-search-hint"},
+                 cm.phrase("(Use /re/ syntax for regexp search)")));
+  }
+  function getReplacementQueryDialog(cm) {
+    return el("", null,
+              el("span", {className: "CodeMirror-search-label"}, cm.phrase("With:")), " ",
+              el("input", {type: "text", "style": "width: 10em", className: "CodeMirror-search-field"}));
+  }
+  function getDoReplaceConfirm(cm) {
+    return el("", null,
+              el("span", {className: "CodeMirror-search-label"}, cm.phrase("Replace?")), " ",
+              el("button", {}, cm.phrase("Yes")), " ",
+              el("button", {}, cm.phrase("No")), " ",
+              el("button", {}, cm.phrase("All")), " ",
+              el("button", {}, cm.phrase("Stop")));
+  }
+
+  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;
+    var dialogText = all ? cm.phrase("Replace all:") : cm.phrase("Replace:")
+    var fragment = el("", null,
+                      el("span", {className: "CodeMirror-search-label"}, dialogText),
+                      getReplaceQueryDialog(cm))
+    dialog(cm, fragment, dialogText, query, function(query) {
+      if (!query) return;
+      query = parseQuery(query);
+      dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) {
+        text = parseString(text)
+        if (all) {
+          replaceAll(cm, query, text)
+        } else {
+          clearSearch(cm);
+          var cursor = getSearchCursor(cm, query, cm.getCursor("from"));
+          var advance = function() {
+            var start = cursor.from(), match;
+            if (!(match = cursor.findNext())) {
+              cursor = getSearchCursor(cm, query);
+              if (!(match = cursor.findNext()) ||
+                  (start && cursor.from().line == start.line && cursor.from().ch == start.ch)) return;
+            }
+            cm.setSelection(cursor.from(), cursor.to());
+            cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
+            confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"),
+                          [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];}));
+            advance();
+          };
+          advance();
+        }
+      });
+    });
+  }
+
+  CodeMirror.commands.find = function(cm) {clearSearch(cm); doSearch(cm);};
+  CodeMirror.commands.findPersistent = function(cm) {clearSearch(cm); doSearch(cm, false, true);};
+  CodeMirror.commands.findPersistentNext = function(cm) {doSearch(cm, false, true, true);};
+  CodeMirror.commands.findPersistentPrev = function(cm) {doSearch(cm, true, true, true);};
+  CodeMirror.commands.findNext = doSearch;
+  CodeMirror.commands.findPrev = function(cm) {doSearch(cm, true);};
+  CodeMirror.commands.clearSearch = clearSearch;
+  CodeMirror.commands.replace = replace;
+  CodeMirror.commands.replaceAll = function(cm) {replace(cm, true);};
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/search/searchcursor.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,305 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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"
+  var Pos = CodeMirror.Pos
+
+  function regexpFlags(regexp) {
+    var flags = regexp.flags
+    return flags != null ? flags : (regexp.ignoreCase ? "i" : "")
+      + (regexp.global ? "g" : "")
+      + (regexp.multiline ? "m" : "")
+  }
+
+  function ensureFlags(regexp, flags) {
+    var current = regexpFlags(regexp), target = current
+    for (var i = 0; i < flags.length; i++) if (target.indexOf(flags.charAt(i)) == -1)
+      target += flags.charAt(i)
+    return current == target ? regexp : new RegExp(regexp.source, target)
+  }
+
+  function maybeMultiline(regexp) {
+    return /\\s|\\n|\n|\\W|\\D|\[\^/.test(regexp.source)
+  }
+
+  function searchRegexpForward(doc, regexp, start) {
+    regexp = ensureFlags(regexp, "g")
+    for (var line = start.line, ch = start.ch, last = doc.lastLine(); line <= last; line++, ch = 0) {
+      regexp.lastIndex = ch
+      var string = doc.getLine(line), match = regexp.exec(string)
+      if (match)
+        return {from: Pos(line, match.index),
+                to: Pos(line, match.index + match[0].length),
+                match: match}
+    }
+  }
+
+  function searchRegexpForwardMultiline(doc, regexp, start) {
+    if (!maybeMultiline(regexp)) return searchRegexpForward(doc, regexp, start)
+
+    regexp = ensureFlags(regexp, "gm")
+    var string, chunk = 1
+    for (var line = start.line, last = doc.lastLine(); line <= last;) {
+      // This grows the search buffer in exponentially-sized chunks
+      // between matches, so that nearby matches are fast and don't
+      // require concatenating the whole document (in case we're
+      // searching for something that has tons of matches), but at the
+      // same time, the amount of retries is limited.
+      for (var i = 0; i < chunk; i++) {
+        if (line > last) break
+        var curLine = doc.getLine(line++)
+        string = string == null ? curLine : string + "\n" + curLine
+      }
+      chunk = chunk * 2
+      regexp.lastIndex = start.ch
+      var match = regexp.exec(string)
+      if (match) {
+        var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
+        var startLine = start.line + before.length - 1, startCh = before[before.length - 1].length
+        return {from: Pos(startLine, startCh),
+                to: Pos(startLine + inside.length - 1,
+                        inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
+                match: match}
+      }
+    }
+  }
+
+  function lastMatchIn(string, regexp, endMargin) {
+    var match, from = 0
+    while (from <= string.length) {
+      regexp.lastIndex = from
+      var newMatch = regexp.exec(string)
+      if (!newMatch) break
+      var end = newMatch.index + newMatch[0].length
+      if (end > string.length - endMargin) break
+      if (!match || end > match.index + match[0].length)
+        match = newMatch
+      from = newMatch.index + 1
+    }
+    return match
+  }
+
+  function searchRegexpBackward(doc, regexp, start) {
+    regexp = ensureFlags(regexp, "g")
+    for (var line = start.line, ch = start.ch, first = doc.firstLine(); line >= first; line--, ch = -1) {
+      var string = doc.getLine(line)
+      var match = lastMatchIn(string, regexp, ch < 0 ? 0 : string.length - ch)
+      if (match)
+        return {from: Pos(line, match.index),
+                to: Pos(line, match.index + match[0].length),
+                match: match}
+    }
+  }
+
+  function searchRegexpBackwardMultiline(doc, regexp, start) {
+    if (!maybeMultiline(regexp)) return searchRegexpBackward(doc, regexp, start)
+    regexp = ensureFlags(regexp, "gm")
+    var string, chunkSize = 1, endMargin = doc.getLine(start.line).length - start.ch
+    for (var line = start.line, first = doc.firstLine(); line >= first;) {
+      for (var i = 0; i < chunkSize && line >= first; i++) {
+        var curLine = doc.getLine(line--)
+        string = string == null ? curLine : curLine + "\n" + string
+      }
+      chunkSize *= 2
+
+      var match = lastMatchIn(string, regexp, endMargin)
+      if (match) {
+        var before = string.slice(0, match.index).split("\n"), inside = match[0].split("\n")
+        var startLine = line + before.length, startCh = before[before.length - 1].length
+        return {from: Pos(startLine, startCh),
+                to: Pos(startLine + inside.length - 1,
+                        inside.length == 1 ? startCh + inside[0].length : inside[inside.length - 1].length),
+                match: match}
+      }
+    }
+  }
+
+  var doFold, noFold
+  if (String.prototype.normalize) {
+    doFold = function(str) { return str.normalize("NFD").toLowerCase() }
+    noFold = function(str) { return str.normalize("NFD") }
+  } else {
+    doFold = function(str) { return str.toLowerCase() }
+    noFold = function(str) { return str }
+  }
+
+  // Maps a position in a case-folded line back to a position in the original line
+  // (compensating for codepoints increasing in number during folding)
+  function adjustPos(orig, folded, pos, foldFunc) {
+    if (orig.length == folded.length) return pos
+    for (var min = 0, max = pos + Math.max(0, orig.length - folded.length);;) {
+      if (min == max) return min
+      var mid = (min + max) >> 1
+      var len = foldFunc(orig.slice(0, mid)).length
+      if (len == pos) return mid
+      else if (len > pos) max = mid
+      else min = mid + 1
+    }
+  }
+
+  function searchStringForward(doc, query, start, caseFold) {
+    // Empty string would match anything and never progress, so we
+    // define it to match nothing instead.
+    if (!query.length) return null
+    var fold = caseFold ? doFold : noFold
+    var lines = fold(query).split(/\r|\n\r?/)
+
+    search: for (var line = start.line, ch = start.ch, last = doc.lastLine() + 1 - lines.length; line <= last; line++, ch = 0) {
+      var orig = doc.getLine(line).slice(ch), string = fold(orig)
+      if (lines.length == 1) {
+        var found = string.indexOf(lines[0])
+        if (found == -1) continue search
+        var start = adjustPos(orig, string, found, fold) + ch
+        return {from: Pos(line, adjustPos(orig, string, found, fold) + ch),
+                to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold) + ch)}
+      } else {
+        var cutFrom = string.length - lines[0].length
+        if (string.slice(cutFrom) != lines[0]) continue search
+        for (var i = 1; i < lines.length - 1; i++)
+          if (fold(doc.getLine(line + i)) != lines[i]) continue search
+        var end = doc.getLine(line + lines.length - 1), endString = fold(end), lastLine = lines[lines.length - 1]
+        if (endString.slice(0, lastLine.length) != lastLine) continue search
+        return {from: Pos(line, adjustPos(orig, string, cutFrom, fold) + ch),
+                to: Pos(line + lines.length - 1, adjustPos(end, endString, lastLine.length, fold))}
+      }
+    }
+  }
+
+  function searchStringBackward(doc, query, start, caseFold) {
+    if (!query.length) return null
+    var fold = caseFold ? doFold : noFold
+    var lines = fold(query).split(/\r|\n\r?/)
+
+    search: for (var line = start.line, ch = start.ch, first = doc.firstLine() - 1 + lines.length; line >= first; line--, ch = -1) {
+      var orig = doc.getLine(line)
+      if (ch > -1) orig = orig.slice(0, ch)
+      var string = fold(orig)
+      if (lines.length == 1) {
+        var found = string.lastIndexOf(lines[0])
+        if (found == -1) continue search
+        return {from: Pos(line, adjustPos(orig, string, found, fold)),
+                to: Pos(line, adjustPos(orig, string, found + lines[0].length, fold))}
+      } else {
+        var lastLine = lines[lines.length - 1]
+        if (string.slice(0, lastLine.length) != lastLine) continue search
+        for (var i = 1, start = line - lines.length + 1; i < lines.length - 1; i++)
+          if (fold(doc.getLine(start + i)) != lines[i]) continue search
+        var top = doc.getLine(line + 1 - lines.length), topString = fold(top)
+        if (topString.slice(topString.length - lines[0].length) != lines[0]) continue search
+        return {from: Pos(line + 1 - lines.length, adjustPos(top, topString, top.length - lines[0].length, fold)),
+                to: Pos(line, adjustPos(orig, string, lastLine.length, fold))}
+      }
+    }
+  }
+
+  function SearchCursor(doc, query, pos, options) {
+    this.atOccurrence = false
+    this.afterEmptyMatch = false
+    this.doc = doc
+    pos = pos ? doc.clipPos(pos) : Pos(0, 0)
+    this.pos = {from: pos, to: pos}
+
+    var caseFold
+    if (typeof options == "object") {
+      caseFold = options.caseFold
+    } else { // Backwards compat for when caseFold was the 4th argument
+      caseFold = options
+      options = null
+    }
+
+    if (typeof query == "string") {
+      if (caseFold == null) caseFold = false
+      this.matches = function(reverse, pos) {
+        return (reverse ? searchStringBackward : searchStringForward)(doc, query, pos, caseFold)
+      }
+    } else {
+      query = ensureFlags(query, "gm")
+      if (!options || options.multiline !== false)
+        this.matches = function(reverse, pos) {
+          return (reverse ? searchRegexpBackwardMultiline : searchRegexpForwardMultiline)(doc, query, pos)
+        }
+      else
+        this.matches = function(reverse, pos) {
+          return (reverse ? searchRegexpBackward : searchRegexpForward)(doc, query, pos)
+        }
+    }
+  }
+
+  SearchCursor.prototype = {
+    findNext: function() {return this.find(false)},
+    findPrevious: function() {return this.find(true)},
+
+    find: function(reverse) {
+      var head = this.doc.clipPos(reverse ? this.pos.from : this.pos.to);
+      if (this.afterEmptyMatch && this.atOccurrence) {
+        // do not return the same 0 width match twice
+        head = Pos(head.line, head.ch)
+        if (reverse) {
+          head.ch--;
+          if (head.ch < 0) {
+            head.line--;
+            head.ch = (this.doc.getLine(head.line) || "").length;
+          }
+        } else {
+          head.ch++;
+          if (head.ch > (this.doc.getLine(head.line) || "").length) {
+            head.ch = 0;
+            head.line++;
+          }
+        }
+        if (CodeMirror.cmpPos(head, this.doc.clipPos(head)) != 0) {
+           return this.atOccurrence = false
+        }
+      }
+      var result = this.matches(reverse, head)
+      this.afterEmptyMatch = result && CodeMirror.cmpPos(result.from, result.to) == 0
+
+      if (result) {
+        this.pos = result
+        this.atOccurrence = true
+        return this.pos.match || true
+      } else {
+        var end = Pos(reverse ? this.doc.firstLine() : this.doc.lastLine() + 1, 0)
+        this.pos = {from: end, to: end}
+        return this.atOccurrence = false
+      }
+    },
+
+    from: function() {if (this.atOccurrence) return this.pos.from},
+    to: function() {if (this.atOccurrence) return this.pos.to},
+
+    replace: function(newText, origin) {
+      if (!this.atOccurrence) return
+      var lines = CodeMirror.splitLines(newText)
+      this.doc.replaceRange(lines, this.pos.from, this.pos.to, origin)
+      this.pos.to = Pos(this.pos.from.line + lines.length - 1,
+                        lines[lines.length - 1].length + (lines.length == 1 ? this.pos.from.ch : 0))
+    }
+  }
+
+  CodeMirror.defineExtension("getSearchCursor", function(query, pos, caseFold) {
+    return new SearchCursor(this.doc, query, pos, caseFold)
+  })
+  CodeMirror.defineDocExtension("getSearchCursor", function(query, pos, caseFold) {
+    return new SearchCursor(this, query, pos, caseFold)
+  })
+
+  CodeMirror.defineExtension("selectMatches", function(query, caseFold) {
+    var ranges = []
+    var cur = this.getSearchCursor(query, this.getCursor("from"), caseFold)
+    while (cur.findNext()) {
+      if (CodeMirror.cmpPos(cur.to(), this.getCursor("to")) > 0) break
+      ranges.push({anchor: cur.from(), head: cur.to()})
+    }
+    if (ranges.length)
+      this.setSelections(ranges, 0)
+  })
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/selection/active-line.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+  var WRAP_CLASS = "CodeMirror-activeline";
+  var BACK_CLASS = "CodeMirror-activeline-background";
+  var GUTT_CLASS = "CodeMirror-activeline-gutter";
+
+  CodeMirror.defineOption("styleActiveLine", false, function(cm, val, old) {
+    var prev = old == CodeMirror.Init ? false : old;
+    if (val == prev) return
+    if (prev) {
+      cm.off("beforeSelectionChange", selectionChange);
+      clearActiveLines(cm);
+      delete cm.state.activeLines;
+    }
+    if (val) {
+      cm.state.activeLines = [];
+      updateActiveLines(cm, cm.listSelections());
+      cm.on("beforeSelectionChange", selectionChange);
+    }
+  });
+
+  function clearActiveLines(cm) {
+    for (var i = 0; i < cm.state.activeLines.length; i++) {
+      cm.removeLineClass(cm.state.activeLines[i], "wrap", WRAP_CLASS);
+      cm.removeLineClass(cm.state.activeLines[i], "background", BACK_CLASS);
+      cm.removeLineClass(cm.state.activeLines[i], "gutter", GUTT_CLASS);
+    }
+  }
+
+  function sameArray(a, b) {
+    if (a.length != b.length) return false;
+    for (var i = 0; i < a.length; i++)
+      if (a[i] != b[i]) return false;
+    return true;
+  }
+
+  function updateActiveLines(cm, ranges) {
+    var active = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i];
+      var option = cm.getOption("styleActiveLine");
+      if (typeof option == "object" && option.nonEmpty ? range.anchor.line != range.head.line : !range.empty())
+        continue
+      var line = cm.getLineHandleVisualStart(range.head.line);
+      if (active[active.length - 1] != line) active.push(line);
+    }
+    if (sameArray(cm.state.activeLines, active)) return;
+    cm.operation(function() {
+      clearActiveLines(cm);
+      for (var i = 0; i < active.length; i++) {
+        cm.addLineClass(active[i], "wrap", WRAP_CLASS);
+        cm.addLineClass(active[i], "background", BACK_CLASS);
+        cm.addLineClass(active[i], "gutter", GUTT_CLASS);
+      }
+      cm.state.activeLines = active;
+    });
+  }
+
+  function selectionChange(cm, sel) {
+    updateActiveLines(cm, sel.ranges);
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/selection/mark-selection.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,119 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Because sometimes you need to mark the selected *text*.
+//
+// Adds an option 'styleSelectedText' which, when enabled, gives
+// selected text the CSS class given as option value, or
+// "CodeMirror-selectedtext" when the value is not a string.
+
+(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("styleSelectedText", false, function(cm, val, old) {
+    var prev = old && old != CodeMirror.Init;
+    if (val && !prev) {
+      cm.state.markedSelection = [];
+      cm.state.markedSelectionStyle = typeof val == "string" ? val : "CodeMirror-selectedtext";
+      reset(cm);
+      cm.on("cursorActivity", onCursorActivity);
+      cm.on("change", onChange);
+    } else if (!val && prev) {
+      cm.off("cursorActivity", onCursorActivity);
+      cm.off("change", onChange);
+      clear(cm);
+      cm.state.markedSelection = cm.state.markedSelectionStyle = null;
+    }
+  });
+
+  function onCursorActivity(cm) {
+    if (cm.state.markedSelection)
+      cm.operation(function() { update(cm); });
+  }
+
+  function onChange(cm) {
+    if (cm.state.markedSelection && cm.state.markedSelection.length)
+      cm.operation(function() { clear(cm); });
+  }
+
+  var CHUNK_SIZE = 8;
+  var Pos = CodeMirror.Pos;
+  var cmp = CodeMirror.cmpPos;
+
+  function coverRange(cm, from, to, addAt) {
+    if (cmp(from, to) == 0) return;
+    var array = cm.state.markedSelection;
+    var cls = cm.state.markedSelectionStyle;
+    for (var line = from.line;;) {
+      var start = line == from.line ? from : Pos(line, 0);
+      var endLine = line + CHUNK_SIZE, atEnd = endLine >= to.line;
+      var end = atEnd ? to : Pos(endLine, 0);
+      var mark = cm.markText(start, end, {className: cls});
+      if (addAt == null) array.push(mark);
+      else array.splice(addAt++, 0, mark);
+      if (atEnd) break;
+      line = endLine;
+    }
+  }
+
+  function clear(cm) {
+    var array = cm.state.markedSelection;
+    for (var i = 0; i < array.length; ++i) array[i].clear();
+    array.length = 0;
+  }
+
+  function reset(cm) {
+    clear(cm);
+    var ranges = cm.listSelections();
+    for (var i = 0; i < ranges.length; i++)
+      coverRange(cm, ranges[i].from(), ranges[i].to());
+  }
+
+  function update(cm) {
+    if (!cm.somethingSelected()) return clear(cm);
+    if (cm.listSelections().length > 1) return reset(cm);
+
+    var from = cm.getCursor("start"), to = cm.getCursor("end");
+
+    var array = cm.state.markedSelection;
+    if (!array.length) return coverRange(cm, from, to);
+
+    var coverStart = array[0].find(), coverEnd = array[array.length - 1].find();
+    if (!coverStart || !coverEnd || to.line - from.line <= CHUNK_SIZE ||
+        cmp(from, coverEnd.to) >= 0 || cmp(to, coverStart.from) <= 0)
+      return reset(cm);
+
+    while (cmp(from, coverStart.from) > 0) {
+      array.shift().clear();
+      coverStart = array[0].find();
+    }
+    if (cmp(from, coverStart.from) < 0) {
+      if (coverStart.to.line - from.line < CHUNK_SIZE) {
+        array.shift().clear();
+        coverRange(cm, from, coverStart.to, 0);
+      } else {
+        coverRange(cm, from, coverStart.from, 0);
+      }
+    }
+
+    while (cmp(to, coverEnd.to) < 0) {
+      array.pop().clear();
+      coverEnd = array[array.length - 1].find();
+    }
+    if (cmp(to, coverEnd.to) > 0) {
+      if (to.line - coverEnd.from.line < CHUNK_SIZE) {
+        array.pop().clear();
+        coverRange(cm, coverEnd.from, to);
+      } else {
+        coverRange(cm, coverEnd.to, to);
+      }
+    }
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/selection/selection-pointer.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,98 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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("selectionPointer", false, function(cm, val) {
+    var data = cm.state.selectionPointer;
+    if (data) {
+      CodeMirror.off(cm.getWrapperElement(), "mousemove", data.mousemove);
+      CodeMirror.off(cm.getWrapperElement(), "mouseout", data.mouseout);
+      CodeMirror.off(window, "scroll", data.windowScroll);
+      cm.off("cursorActivity", reset);
+      cm.off("scroll", reset);
+      cm.state.selectionPointer = null;
+      cm.display.lineDiv.style.cursor = "";
+    }
+    if (val) {
+      data = cm.state.selectionPointer = {
+        value: typeof val == "string" ? val : "default",
+        mousemove: function(event) { mousemove(cm, event); },
+        mouseout: function(event) { mouseout(cm, event); },
+        windowScroll: function() { reset(cm); },
+        rects: null,
+        mouseX: null, mouseY: null,
+        willUpdate: false
+      };
+      CodeMirror.on(cm.getWrapperElement(), "mousemove", data.mousemove);
+      CodeMirror.on(cm.getWrapperElement(), "mouseout", data.mouseout);
+      CodeMirror.on(window, "scroll", data.windowScroll);
+      cm.on("cursorActivity", reset);
+      cm.on("scroll", reset);
+    }
+  });
+
+  function mousemove(cm, event) {
+    var data = cm.state.selectionPointer;
+    if (event.buttons == null ? event.which : event.buttons) {
+      data.mouseX = data.mouseY = null;
+    } else {
+      data.mouseX = event.clientX;
+      data.mouseY = event.clientY;
+    }
+    scheduleUpdate(cm);
+  }
+
+  function mouseout(cm, event) {
+    if (!cm.getWrapperElement().contains(event.relatedTarget)) {
+      var data = cm.state.selectionPointer;
+      data.mouseX = data.mouseY = null;
+      scheduleUpdate(cm);
+    }
+  }
+
+  function reset(cm) {
+    cm.state.selectionPointer.rects = null;
+    scheduleUpdate(cm);
+  }
+
+  function scheduleUpdate(cm) {
+    if (!cm.state.selectionPointer.willUpdate) {
+      cm.state.selectionPointer.willUpdate = true;
+      setTimeout(function() {
+        update(cm);
+        cm.state.selectionPointer.willUpdate = false;
+      }, 50);
+    }
+  }
+
+  function update(cm) {
+    var data = cm.state.selectionPointer;
+    if (!data) return;
+    if (data.rects == null && data.mouseX != null) {
+      data.rects = [];
+      if (cm.somethingSelected()) {
+        for (var sel = cm.display.selectionDiv.firstChild; sel; sel = sel.nextSibling)
+          data.rects.push(sel.getBoundingClientRect());
+      }
+    }
+    var inside = false;
+    if (data.mouseX != null) for (var i = 0; i < data.rects.length; i++) {
+      var rect = data.rects[i];
+      if (rect.left <= data.mouseX && rect.right >= data.mouseX &&
+          rect.top <= data.mouseY && rect.bottom >= data.mouseY)
+        inside = true;
+    }
+    var cursor = inside ? data.value : "";
+    if (cm.display.lineDiv.style.cursor != cursor)
+      cm.display.lineDiv.style.cursor = cursor;
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/tern/tern.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,87 @@
+.CodeMirror-Tern-completion {
+  padding-left: 22px;
+  position: relative;
+  line-height: 1.5;
+}
+.CodeMirror-Tern-completion:before {
+  position: absolute;
+  left: 2px;
+  bottom: 2px;
+  border-radius: 50%;
+  font-size: 12px;
+  font-weight: bold;
+  height: 15px;
+  width: 15px;
+  line-height: 16px;
+  text-align: center;
+  color: white;
+  -moz-box-sizing: border-box;
+  box-sizing: border-box;
+}
+.CodeMirror-Tern-completion-unknown:before {
+  content: "?";
+  background: #4bb;
+}
+.CodeMirror-Tern-completion-object:before {
+  content: "O";
+  background: #77c;
+}
+.CodeMirror-Tern-completion-fn:before {
+  content: "F";
+  background: #7c7;
+}
+.CodeMirror-Tern-completion-array:before {
+  content: "A";
+  background: #c66;
+}
+.CodeMirror-Tern-completion-number:before {
+  content: "1";
+  background: #999;
+}
+.CodeMirror-Tern-completion-string:before {
+  content: "S";
+  background: #999;
+}
+.CodeMirror-Tern-completion-bool:before {
+  content: "B";
+  background: #999;
+}
+
+.CodeMirror-Tern-completion-guess {
+  color: #999;
+}
+
+.CodeMirror-Tern-tooltip {
+  border: 1px solid silver;
+  border-radius: 3px;
+  color: #444;
+  padding: 2px 5px;
+  font-size: 90%;
+  font-family: monospace;
+  background-color: white;
+  white-space: pre-wrap;
+
+  max-width: 40em;
+  position: absolute;
+  z-index: 10;
+  -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+  box-shadow: 2px 3px 5px rgba(0,0,0,.2);
+
+  transition: opacity 1s;
+  -moz-transition: opacity 1s;
+  -webkit-transition: opacity 1s;
+  -o-transition: opacity 1s;
+  -ms-transition: opacity 1s;
+}
+
+.CodeMirror-Tern-hint-doc {
+  max-width: 25em;
+  margin-top: -3px;
+}
+
+.CodeMirror-Tern-fname { color: black; }
+.CodeMirror-Tern-farg { color: #70a; }
+.CodeMirror-Tern-farg-current { text-decoration: underline; }
+.CodeMirror-Tern-type { color: #07c; }
+.CodeMirror-Tern-fhint-guess { opacity: .7; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/tern/tern.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,756 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Glue code between CodeMirror and Tern.
+//
+// Create a CodeMirror.TernServer to wrap an actual Tern server,
+// register open documents (CodeMirror.Doc instances) with it, and
+// call its methods to activate the assisting functions that Tern
+// provides.
+//
+// Options supported (all optional):
+// * defs: An array of JSON definition data structures.
+// * plugins: An object mapping plugin names to configuration
+//   options.
+// * getFile: A function(name, c) that can be used to access files in
+//   the project that haven't been loaded yet. Simply do c(null) to
+//   indicate that a file is not available.
+// * fileFilter: A function(value, docName, doc) that will be applied
+//   to documents before passing them on to Tern.
+// * switchToDoc: A function(name, doc) that should, when providing a
+//   multi-file view, switch the view or focus to the named file.
+// * showError: A function(editor, message) that can be used to
+//   override the way errors are displayed.
+// * completionTip: Customize the content in tooltips for completions.
+//   Is passed a single argument—the completion's data as returned by
+//   Tern—and may return a string, DOM node, or null to indicate that
+//   no tip should be shown. By default the docstring is shown.
+// * typeTip: Like completionTip, but for the tooltips shown for type
+//   queries.
+// * responseFilter: A function(doc, query, request, error, data) that
+//   will be applied to the Tern responses before treating them
+//
+//
+// It is possible to run the Tern server in a web worker by specifying
+// these additional options:
+// * useWorker: Set to true to enable web worker mode. You'll probably
+//   want to feature detect the actual value you use here, for example
+//   !!window.Worker.
+// * workerScript: The main script of the worker. Point this to
+//   wherever you are hosting worker.js from this directory.
+// * workerDeps: An array of paths pointing (relative to workerScript)
+//   to the Acorn and Tern libraries and any Tern plugins you want to
+//   load. Or, if you minified those into a single script and included
+//   them in the workerScript, simply leave this undefined.
+
+(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";
+  // declare global: tern
+
+  CodeMirror.TernServer = function(options) {
+    var self = this;
+    this.options = options || {};
+    var plugins = this.options.plugins || (this.options.plugins = {});
+    if (!plugins.doc_comment) plugins.doc_comment = true;
+    this.docs = Object.create(null);
+    if (this.options.useWorker) {
+      this.server = new WorkerServer(this);
+    } else {
+      this.server = new tern.Server({
+        getFile: function(name, c) { return getFile(self, name, c); },
+        async: true,
+        defs: this.options.defs || [],
+        plugins: plugins
+      });
+    }
+    this.trackChange = function(doc, change) { trackChange(self, doc, change); };
+
+    this.cachedArgHints = null;
+    this.activeArgHints = null;
+    this.jumpStack = [];
+
+    this.getHint = function(cm, c) { return hint(self, cm, c); };
+    this.getHint.async = true;
+  };
+
+  CodeMirror.TernServer.prototype = {
+    addDoc: function(name, doc) {
+      var data = {doc: doc, name: name, changed: null};
+      this.server.addFile(name, docValue(this, data));
+      CodeMirror.on(doc, "change", this.trackChange);
+      return this.docs[name] = data;
+    },
+
+    delDoc: function(id) {
+      var found = resolveDoc(this, id);
+      if (!found) return;
+      CodeMirror.off(found.doc, "change", this.trackChange);
+      delete this.docs[found.name];
+      this.server.delFile(found.name);
+    },
+
+    hideDoc: function(id) {
+      closeArgHints(this);
+      var found = resolveDoc(this, id);
+      if (found && found.changed) sendDoc(this, found);
+    },
+
+    complete: function(cm) {
+      cm.showHint({hint: this.getHint});
+    },
+
+    showType: function(cm, pos, c) { showContextInfo(this, cm, pos, "type", c); },
+
+    showDocs: function(cm, pos, c) { showContextInfo(this, cm, pos, "documentation", c); },
+
+    updateArgHints: function(cm) { updateArgHints(this, cm); },
+
+    jumpToDef: function(cm) { jumpToDef(this, cm); },
+
+    jumpBack: function(cm) { jumpBack(this, cm); },
+
+    rename: function(cm) { rename(this, cm); },
+
+    selectName: function(cm) { selectName(this, cm); },
+
+    request: function (cm, query, c, pos) {
+      var self = this;
+      var doc = findDoc(this, cm.getDoc());
+      var request = buildRequest(this, doc, query, pos);
+      var extraOptions = request.query && this.options.queryOptions && this.options.queryOptions[request.query.type]
+      if (extraOptions) for (var prop in extraOptions) request.query[prop] = extraOptions[prop];
+
+      this.server.request(request, function (error, data) {
+        if (!error && self.options.responseFilter)
+          data = self.options.responseFilter(doc, query, request, error, data);
+        c(error, data);
+      });
+    },
+
+    destroy: function () {
+      closeArgHints(this)
+      if (this.worker) {
+        this.worker.terminate();
+        this.worker = null;
+      }
+    }
+  };
+
+  var Pos = CodeMirror.Pos;
+  var cls = "CodeMirror-Tern-";
+  var bigDoc = 250;
+
+  function getFile(ts, name, c) {
+    var buf = ts.docs[name];
+    if (buf)
+      c(docValue(ts, buf));
+    else if (ts.options.getFile)
+      ts.options.getFile(name, c);
+    else
+      c(null);
+  }
+
+  function findDoc(ts, doc, name) {
+    for (var n in ts.docs) {
+      var cur = ts.docs[n];
+      if (cur.doc == doc) return cur;
+    }
+    if (!name) for (var i = 0;; ++i) {
+      n = "[doc" + (i || "") + "]";
+      if (!ts.docs[n]) { name = n; break; }
+    }
+    return ts.addDoc(name, doc);
+  }
+
+  function resolveDoc(ts, id) {
+    if (typeof id == "string") return ts.docs[id];
+    if (id instanceof CodeMirror) id = id.getDoc();
+    if (id instanceof CodeMirror.Doc) return findDoc(ts, id);
+  }
+
+  function trackChange(ts, doc, change) {
+    var data = findDoc(ts, doc);
+
+    var argHints = ts.cachedArgHints;
+    if (argHints && argHints.doc == doc && cmpPos(argHints.start, change.to) >= 0)
+      ts.cachedArgHints = null;
+
+    var changed = data.changed;
+    if (changed == null)
+      data.changed = changed = {from: change.from.line, to: change.from.line};
+    var end = change.from.line + (change.text.length - 1);
+    if (change.from.line < changed.to) changed.to = changed.to - (change.to.line - end);
+    if (end >= changed.to) changed.to = end + 1;
+    if (changed.from > change.from.line) changed.from = change.from.line;
+
+    if (doc.lineCount() > bigDoc && change.to - changed.from > 100) setTimeout(function() {
+      if (data.changed && data.changed.to - data.changed.from > 100) sendDoc(ts, data);
+    }, 200);
+  }
+
+  function sendDoc(ts, doc) {
+    ts.server.request({files: [{type: "full", name: doc.name, text: docValue(ts, doc)}]}, function(error) {
+      if (error) window.console.error(error);
+      else doc.changed = null;
+    });
+  }
+
+  // Completion
+
+  function hint(ts, cm, c) {
+    ts.request(cm, {type: "completions", types: true, docs: true, urls: true}, function(error, data) {
+      if (error) return showError(ts, cm, error);
+      var completions = [], after = "";
+      var from = data.start, to = data.end;
+      if (cm.getRange(Pos(from.line, from.ch - 2), from) == "[\"" &&
+          cm.getRange(to, Pos(to.line, to.ch + 2)) != "\"]")
+        after = "\"]";
+
+      for (var i = 0; i < data.completions.length; ++i) {
+        var completion = data.completions[i], className = typeToIcon(completion.type);
+        if (data.guess) className += " " + cls + "guess";
+        completions.push({text: completion.name + after,
+                          displayText: completion.displayName || completion.name,
+                          className: className,
+                          data: completion});
+      }
+
+      var obj = {from: from, to: to, list: completions};
+      var tooltip = null;
+      CodeMirror.on(obj, "close", function() { remove(tooltip); });
+      CodeMirror.on(obj, "update", function() { remove(tooltip); });
+      CodeMirror.on(obj, "select", function(cur, node) {
+        remove(tooltip);
+        var content = ts.options.completionTip ? ts.options.completionTip(cur.data) : cur.data.doc;
+        if (content) {
+          tooltip = makeTooltip(node.parentNode.getBoundingClientRect().right + window.pageXOffset,
+                                node.getBoundingClientRect().top + window.pageYOffset, content, cm, cls + "hint-doc");
+        }
+      });
+      c(obj);
+    });
+  }
+
+  function typeToIcon(type) {
+    var suffix;
+    if (type == "?") suffix = "unknown";
+    else if (type == "number" || type == "string" || type == "bool") suffix = type;
+    else if (/^fn\(/.test(type)) suffix = "fn";
+    else if (/^\[/.test(type)) suffix = "array";
+    else suffix = "object";
+    return cls + "completion " + cls + "completion-" + suffix;
+  }
+
+  // Type queries
+
+  function showContextInfo(ts, cm, pos, queryName, c) {
+    ts.request(cm, queryName, function(error, data) {
+      if (error) return showError(ts, cm, error);
+      if (ts.options.typeTip) {
+        var tip = ts.options.typeTip(data);
+      } else {
+        var tip = elt("span", null, elt("strong", null, data.type || "not found"));
+        if (data.doc)
+          tip.appendChild(document.createTextNode(" — " + data.doc));
+        if (data.url) {
+          tip.appendChild(document.createTextNode(" "));
+          var child = tip.appendChild(elt("a", null, "[docs]"));
+          child.href = data.url;
+          child.target = "_blank";
+        }
+      }
+      tempTooltip(cm, tip, ts);
+      if (c) c();
+    }, pos);
+  }
+
+  // Maintaining argument hints
+
+  function updateArgHints(ts, cm) {
+    closeArgHints(ts);
+
+    if (cm.somethingSelected()) return;
+    var state = cm.getTokenAt(cm.getCursor()).state;
+    var inner = CodeMirror.innerMode(cm.getMode(), state);
+    if (inner.mode.name != "javascript") return;
+    var lex = inner.state.lexical;
+    if (lex.info != "call") return;
+
+    var ch, argPos = lex.pos || 0, tabSize = cm.getOption("tabSize");
+    for (var line = cm.getCursor().line, e = Math.max(0, line - 9), found = false; line >= e; --line) {
+      var str = cm.getLine(line), extra = 0;
+      for (var pos = 0;;) {
+        var tab = str.indexOf("\t", pos);
+        if (tab == -1) break;
+        extra += tabSize - (tab + extra) % tabSize - 1;
+        pos = tab + 1;
+      }
+      ch = lex.column - extra;
+      if (str.charAt(ch) == "(") {found = true; break;}
+    }
+    if (!found) return;
+
+    var start = Pos(line, ch);
+    var cache = ts.cachedArgHints;
+    if (cache && cache.doc == cm.getDoc() && cmpPos(start, cache.start) == 0)
+      return showArgHints(ts, cm, argPos);
+
+    ts.request(cm, {type: "type", preferFunction: true, end: start}, function(error, data) {
+      if (error || !data.type || !(/^fn\(/).test(data.type)) return;
+      ts.cachedArgHints = {
+        start: start,
+        type: parseFnType(data.type),
+        name: data.exprName || data.name || "fn",
+        guess: data.guess,
+        doc: cm.getDoc()
+      };
+      showArgHints(ts, cm, argPos);
+    });
+  }
+
+  function showArgHints(ts, cm, pos) {
+    closeArgHints(ts);
+
+    var cache = ts.cachedArgHints, tp = cache.type;
+    var tip = elt("span", cache.guess ? cls + "fhint-guess" : null,
+                  elt("span", cls + "fname", cache.name), "(");
+    for (var i = 0; i < tp.args.length; ++i) {
+      if (i) tip.appendChild(document.createTextNode(", "));
+      var arg = tp.args[i];
+      tip.appendChild(elt("span", cls + "farg" + (i == pos ? " " + cls + "farg-current" : ""), arg.name || "?"));
+      if (arg.type != "?") {
+        tip.appendChild(document.createTextNode(":\u00a0"));
+        tip.appendChild(elt("span", cls + "type", arg.type));
+      }
+    }
+    tip.appendChild(document.createTextNode(tp.rettype ? ") ->\u00a0" : ")"));
+    if (tp.rettype) tip.appendChild(elt("span", cls + "type", tp.rettype));
+    var place = cm.cursorCoords(null, "page");
+    var tooltip = ts.activeArgHints = makeTooltip(place.right + 1, place.bottom, tip, cm)
+    setTimeout(function() {
+      tooltip.clear = onEditorActivity(cm, function() {
+        if (ts.activeArgHints == tooltip) closeArgHints(ts) })
+    }, 20)
+  }
+
+  function parseFnType(text) {
+    var args = [], pos = 3;
+
+    function skipMatching(upto) {
+      var depth = 0, start = pos;
+      for (;;) {
+        var next = text.charAt(pos);
+        if (upto.test(next) && !depth) return text.slice(start, pos);
+        if (/[{\[\(]/.test(next)) ++depth;
+        else if (/[}\]\)]/.test(next)) --depth;
+        ++pos;
+      }
+    }
+
+    // Parse arguments
+    if (text.charAt(pos) != ")") for (;;) {
+      var name = text.slice(pos).match(/^([^, \(\[\{]+): /);
+      if (name) {
+        pos += name[0].length;
+        name = name[1];
+      }
+      args.push({name: name, type: skipMatching(/[\),]/)});
+      if (text.charAt(pos) == ")") break;
+      pos += 2;
+    }
+
+    var rettype = text.slice(pos).match(/^\) -> (.*)$/);
+
+    return {args: args, rettype: rettype && rettype[1]};
+  }
+
+  // Moving to the definition of something
+
+  function jumpToDef(ts, cm) {
+    function inner(varName) {
+      var req = {type: "definition", variable: varName || null};
+      var doc = findDoc(ts, cm.getDoc());
+      ts.server.request(buildRequest(ts, doc, req), function(error, data) {
+        if (error) return showError(ts, cm, error);
+        if (!data.file && data.url) { window.open(data.url); return; }
+
+        if (data.file) {
+          var localDoc = ts.docs[data.file], found;
+          if (localDoc && (found = findContext(localDoc.doc, data))) {
+            ts.jumpStack.push({file: doc.name,
+                               start: cm.getCursor("from"),
+                               end: cm.getCursor("to")});
+            moveTo(ts, doc, localDoc, found.start, found.end);
+            return;
+          }
+        }
+        showError(ts, cm, "Could not find a definition.");
+      });
+    }
+
+    if (!atInterestingExpression(cm))
+      dialog(cm, "Jump to variable", function(name) { if (name) inner(name); });
+    else
+      inner();
+  }
+
+  function jumpBack(ts, cm) {
+    var pos = ts.jumpStack.pop(), doc = pos && ts.docs[pos.file];
+    if (!doc) return;
+    moveTo(ts, findDoc(ts, cm.getDoc()), doc, pos.start, pos.end);
+  }
+
+  function moveTo(ts, curDoc, doc, start, end) {
+    doc.doc.setSelection(start, end);
+    if (curDoc != doc && ts.options.switchToDoc) {
+      closeArgHints(ts);
+      ts.options.switchToDoc(doc.name, doc.doc);
+    }
+  }
+
+  // The {line,ch} representation of positions makes this rather awkward.
+  function findContext(doc, data) {
+    var before = data.context.slice(0, data.contextOffset).split("\n");
+    var startLine = data.start.line - (before.length - 1);
+    var start = Pos(startLine, (before.length == 1 ? data.start.ch : doc.getLine(startLine).length) - before[0].length);
+
+    var text = doc.getLine(startLine).slice(start.ch);
+    for (var cur = startLine + 1; cur < doc.lineCount() && text.length < data.context.length; ++cur)
+      text += "\n" + doc.getLine(cur);
+    if (text.slice(0, data.context.length) == data.context) return data;
+
+    var cursor = doc.getSearchCursor(data.context, 0, false);
+    var nearest, nearestDist = Infinity;
+    while (cursor.findNext()) {
+      var from = cursor.from(), dist = Math.abs(from.line - start.line) * 10000;
+      if (!dist) dist = Math.abs(from.ch - start.ch);
+      if (dist < nearestDist) { nearest = from; nearestDist = dist; }
+    }
+    if (!nearest) return null;
+
+    if (before.length == 1)
+      nearest.ch += before[0].length;
+    else
+      nearest = Pos(nearest.line + (before.length - 1), before[before.length - 1].length);
+    if (data.start.line == data.end.line)
+      var end = Pos(nearest.line, nearest.ch + (data.end.ch - data.start.ch));
+    else
+      var end = Pos(nearest.line + (data.end.line - data.start.line), data.end.ch);
+    return {start: nearest, end: end};
+  }
+
+  function atInterestingExpression(cm) {
+    var pos = cm.getCursor("end"), tok = cm.getTokenAt(pos);
+    if (tok.start < pos.ch && tok.type == "comment") return false;
+    return /[\w)\]]/.test(cm.getLine(pos.line).slice(Math.max(pos.ch - 1, 0), pos.ch + 1));
+  }
+
+  // Variable renaming
+
+  function rename(ts, cm) {
+    var token = cm.getTokenAt(cm.getCursor());
+    if (!/\w/.test(token.string)) return showError(ts, cm, "Not at a variable");
+    dialog(cm, "New name for " + token.string, function(newName) {
+      ts.request(cm, {type: "rename", newName: newName, fullDocs: true}, function(error, data) {
+        if (error) return showError(ts, cm, error);
+        applyChanges(ts, data.changes);
+      });
+    });
+  }
+
+  function selectName(ts, cm) {
+    var name = findDoc(ts, cm.doc).name;
+    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(curPos, ref.start) >= 0 && cmpPos(curPos, ref.end) <= 0)
+            cur = ranges.length - 1;
+        }
+      }
+      cm.setSelections(ranges, cur);
+    });
+  }
+
+  var nextChangeOrig = 0;
+  function applyChanges(ts, changes) {
+    var perFile = Object.create(null);
+    for (var i = 0; i < changes.length; ++i) {
+      var ch = changes[i];
+      (perFile[ch.file] || (perFile[ch.file] = [])).push(ch);
+    }
+    for (var file in perFile) {
+      var known = ts.docs[file], chs = perFile[file];;
+      if (!known) continue;
+      chs.sort(function(a, b) { return cmpPos(b.start, a.start); });
+      var origin = "*rename" + (++nextChangeOrig);
+      for (var i = 0; i < chs.length; ++i) {
+        var ch = chs[i];
+        known.doc.replaceRange(ch.text, ch.start, ch.end, origin);
+      }
+    }
+  }
+
+  // Generic request-building helper
+
+  function buildRequest(ts, doc, query, pos) {
+    var files = [], offsetLines = 0, allowFragments = !query.fullDocs;
+    if (!allowFragments) delete query.fullDocs;
+    if (typeof query == "string") query = {type: query};
+    query.lineCharPositions = true;
+    if (query.end == null) {
+      query.end = pos || doc.doc.getCursor("end");
+      if (doc.doc.somethingSelected())
+        query.start = doc.doc.getCursor("start");
+    }
+    var startPos = query.start || query.end;
+
+    if (doc.changed) {
+      if (doc.doc.lineCount() > bigDoc && allowFragments !== false &&
+          doc.changed.to - doc.changed.from < 100 &&
+          doc.changed.from <= startPos.line && doc.changed.to > query.end.line) {
+        files.push(getFragmentAround(doc, startPos, query.end));
+        query.file = "#0";
+        var offsetLines = files[0].offsetLines;
+        if (query.start != null) query.start = Pos(query.start.line - -offsetLines, query.start.ch);
+        query.end = Pos(query.end.line - offsetLines, query.end.ch);
+      } else {
+        files.push({type: "full",
+                    name: doc.name,
+                    text: docValue(ts, doc)});
+        query.file = doc.name;
+        doc.changed = null;
+      }
+    } else {
+      query.file = doc.name;
+    }
+    for (var name in ts.docs) {
+      var cur = ts.docs[name];
+      if (cur.changed && cur != doc) {
+        files.push({type: "full", name: cur.name, text: docValue(ts, cur)});
+        cur.changed = null;
+      }
+    }
+
+    return {query: query, files: files};
+  }
+
+  function getFragmentAround(data, start, end) {
+    var doc = data.doc;
+    var minIndent = null, minLine = null, endLine, tabSize = 4;
+    for (var p = start.line - 1, min = Math.max(0, p - 50); p >= min; --p) {
+      var line = doc.getLine(p), fn = line.search(/\bfunction\b/);
+      if (fn < 0) continue;
+      var indent = CodeMirror.countColumn(line, null, tabSize);
+      if (minIndent != null && minIndent <= indent) continue;
+      minIndent = indent;
+      minLine = p;
+    }
+    if (minLine == null) minLine = min;
+    var max = Math.min(doc.lastLine(), end.line + 20);
+    if (minIndent == null || minIndent == CodeMirror.countColumn(doc.getLine(start.line), null, tabSize))
+      endLine = max;
+    else for (endLine = end.line + 1; endLine < max; ++endLine) {
+      var indent = CodeMirror.countColumn(doc.getLine(endLine), null, tabSize);
+      if (indent <= minIndent) break;
+    }
+    var from = Pos(minLine, 0);
+
+    return {type: "part",
+            name: data.name,
+            offsetLines: from.line,
+            text: doc.getRange(from, Pos(endLine, end.line == endLine ? null : 0))};
+  }
+
+  // Generic utilities
+
+  var cmpPos = CodeMirror.cmpPos;
+
+  function elt(tagname, cls /*, ... elts*/) {
+    var e = document.createElement(tagname);
+    if (cls) e.className = cls;
+    for (var i = 2; i < arguments.length; ++i) {
+      var elt = arguments[i];
+      if (typeof elt == "string") elt = document.createTextNode(elt);
+      e.appendChild(elt);
+    }
+    return e;
+  }
+
+  function dialog(cm, text, f) {
+    if (cm.openDialog) {
+      var fragment = document.createDocumentFragment();
+      fragment.appendChild(document.createTextNode(text + ": "));
+      var input = document.createElement("input");
+      input.type = "text";
+      fragment.appendChild(input);
+      cm.openDialog(fragment, f);
+    } else {
+      f(prompt(text, ""));
+    }
+  }
+
+  // Tooltips
+
+  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, cm);
+    function maybeClear() {
+      old = true;
+      if (!mouseOnTip) clear();
+    }
+    function clear() {
+      cm.state.ternTooltip = null;
+      if (tip.parentNode) fadeOut(tip)
+      clearActivity()
+    }
+    var mouseOnTip = false, old = false;
+    CodeMirror.on(tip, "mousemove", function() { mouseOnTip = true; });
+    CodeMirror.on(tip, "mouseout", function(e) {
+      var related = e.relatedTarget || e.toElement
+      if (!related || !CodeMirror.contains(tip, related)) {
+        if (old) clear();
+        else mouseOnTip = false;
+      }
+    });
+    setTimeout(maybeClear, ts.options.hintDelay ? ts.options.hintDelay : 1700);
+    var clearActivity = onEditorActivity(cm, clear)
+  }
+
+  function onEditorActivity(cm, f) {
+    cm.on("cursorActivity", f)
+    cm.on("blur", f)
+    cm.on("scroll", f)
+    cm.on("setDoc", f)
+    return function() {
+      cm.off("cursorActivity", f)
+      cm.off("blur", f)
+      cm.off("scroll", f)
+      cm.off("setDoc", f)
+    }
+  }
+
+  function makeTooltip(x, y, content, cm, className) {
+    var node = elt("div", cls + "tooltip" + " " + (className || ""), content);
+    node.style.left = x + "px";
+    node.style.top = y + "px";
+    var container = ((cm.options || {}).hintOptions || {}).container || document.body;
+    container.appendChild(node);
+
+    var pos = cm.cursorCoords();
+    var winW = window.innerWidth;
+    var winH = window.innerHeight;
+    var box = node.getBoundingClientRect();
+    var hints = document.querySelector(".CodeMirror-hints");
+    var overlapY = box.bottom - winH;
+    var overlapX = box.right - winW;
+
+    if (hints && overlapX > 0) {
+      node.style.left = 0;
+      var box = node.getBoundingClientRect();
+      node.style.left = (x = x - hints.offsetWidth - box.width) + "px";
+      overlapX = box.right - winW;
+    }
+    if (overlapY > 0) {
+      var height = box.bottom - box.top, curTop = pos.top - (pos.bottom - box.top);
+      if (curTop - height > 0) { // Fits above cursor
+        node.style.top = (pos.top - height) + "px";
+      } else if (height > winH) {
+        node.style.height = (winH - 5) + "px";
+        node.style.top = (pos.bottom - box.top) + "px";
+      }
+    }
+    if (overlapX > 0) {
+      if (box.right - box.left > winW) {
+        node.style.width = (winW - 5) + "px";
+        overlapX -= (box.right - box.left) - winW;
+      }
+      node.style.left = (x - overlapX) + "px";
+    }
+
+    return node;
+  }
+
+  function remove(node) {
+    var p = node && node.parentNode;
+    if (p) p.removeChild(node);
+  }
+
+  function fadeOut(tooltip) {
+    tooltip.style.opacity = "0";
+    setTimeout(function() { remove(tooltip); }, 1100);
+  }
+
+  function showError(ts, cm, msg) {
+    if (ts.options.showError)
+      ts.options.showError(cm, msg);
+    else
+      tempTooltip(cm, String(msg), ts);
+  }
+
+  function closeArgHints(ts) {
+    if (ts.activeArgHints) {
+      if (ts.activeArgHints.clear) ts.activeArgHints.clear()
+      remove(ts.activeArgHints)
+      ts.activeArgHints = null
+    }
+  }
+
+  function docValue(ts, doc) {
+    var val = doc.doc.getValue();
+    if (ts.options.fileFilter) val = ts.options.fileFilter(val, doc.name, doc.doc);
+    return val;
+  }
+
+  // Worker wrapper
+
+  function WorkerServer(ts) {
+    var worker = ts.worker = new Worker(ts.options.workerScript);
+    worker.postMessage({type: "init",
+                        defs: ts.options.defs,
+                        plugins: ts.options.plugins,
+                        scripts: ts.options.workerDeps});
+    var msgId = 0, pending = {};
+
+    function send(data, c) {
+      if (c) {
+        data.id = ++msgId;
+        pending[msgId] = c;
+      }
+      worker.postMessage(data);
+    }
+    worker.onmessage = function(e) {
+      var data = e.data;
+      if (data.type == "getFile") {
+        getFile(ts, data.name, function(err, text) {
+          send({type: "getFile", err: String(err), text: text, id: data.id});
+        });
+      } else if (data.type == "debug") {
+        window.console.log(data.message);
+      } else if (data.id && pending[data.id]) {
+        pending[data.id](data.err, data.body);
+        delete pending[data.id];
+      }
+    };
+    worker.onerror = function(e) {
+      for (var id in pending) pending[id](e);
+      pending = {};
+    };
+
+    this.addFile = function(name, text) { send({type: "add", name: name, text: text}); };
+    this.delFile = function(name) { send({type: "del", name: name}); };
+    this.request = function(body, c) { send({type: "req", body: body}, c); };
+  }
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/tern/worker.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// declare global: tern, server
+
+var server;
+
+this.onmessage = function(e) {
+  var data = e.data;
+  switch (data.type) {
+  case "init": return startServer(data.defs, data.plugins, data.scripts);
+  case "add": return server.addFile(data.name, data.text);
+  case "del": return server.delFile(data.name);
+  case "req": return server.request(data.body, function(err, reqData) {
+    postMessage({id: data.id, body: reqData, err: err && String(err)});
+  });
+  case "getFile":
+    var c = pending[data.id];
+    delete pending[data.id];
+    return c(data.err, data.text);
+  default: throw new Error("Unknown message type: " + data.type);
+  }
+};
+
+var nextId = 0, pending = {};
+function getFile(file, c) {
+  postMessage({type: "getFile", name: file, id: ++nextId});
+  pending[nextId] = c;
+}
+
+function startServer(defs, plugins, scripts) {
+  if (scripts) importScripts.apply(null, scripts);
+
+  server = new tern.Server({
+    getFile: getFile,
+    async: true,
+    defs: defs,
+    plugins: plugins
+  });
+}
+
+this.console = {
+  log: function(v) { postMessage({type: "debug", message: v}); }
+};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/addon/wrap/hardwrap.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,160 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var Pos = CodeMirror.Pos;
+
+  function findParagraph(cm, pos, options) {
+    var startRE = options.paragraphStart || cm.getHelper(pos, "paragraphStart");
+    for (var start = pos.line, first = cm.firstLine(); start > first; --start) {
+      var line = cm.getLine(start);
+      if (startRE && startRE.test(line)) break;
+      if (!/\S/.test(line)) { ++start; break; }
+    }
+    var endRE = options.paragraphEnd || cm.getHelper(pos, "paragraphEnd");
+    for (var end = pos.line + 1, last = cm.lastLine(); end <= last; ++end) {
+      var line = cm.getLine(end);
+      if (endRE && endRE.test(line)) { ++end; break; }
+      if (!/\S/.test(line)) break;
+    }
+    return {from: start, to: end};
+  }
+
+  function findBreakPoint(text, column, wrapOn, killTrailingSpace, forceBreak) {
+    var at = column
+    while (at < text.length && text.charAt(at) == " ") at++
+    for (; at > 0; --at)
+      if (wrapOn.test(text.slice(at - 1, at + 1))) break;
+
+    if (!forceBreak && at <= text.match(/^[ \t]*/)[0].length) {
+      // didn't find a break point before column, in non-forceBreak mode try to
+      // find one after 'column'.
+      for (at = column + 1; at < text.length - 1; ++at) {
+        if (wrapOn.test(text.slice(at - 1, at + 1))) break;
+      }
+    }
+
+    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) {
+    from = cm.clipPos(from); to = cm.clipPos(to);
+    var column = options.column || 80;
+    var wrapOn = options.wrapOn || /\s\S|-[^\.\d]/;
+    var forceBreak = options.forceBreak !== false;
+    var killTrailing = options.killTrailingSpace !== false;
+    var changes = [], curLine = "", curNo = from.line;
+    var lines = cm.getRange(from, to, false);
+    if (!lines.length) return null;
+    var leadingSpace = lines[0].match(/^[ \t]*/)[0];
+    if (leadingSpace.length >= column) column = leadingSpace.length + 1
+
+    for (var i = 0; i < lines.length; ++i) {
+      var text = lines[i], oldLen = curLine.length, spaceInserted = 0;
+      if (curLine && text && !wrapOn.test(curLine.charAt(curLine.length - 1) + text.charAt(0))) {
+        curLine += " ";
+        spaceInserted = 1;
+      }
+      var spaceTrimmed = "";
+      if (i) {
+        spaceTrimmed = text.match(/^\s*/)[0];
+        text = text.slice(spaceTrimmed.length);
+      }
+      curLine += text;
+      if (i) {
+        var firstBreak = curLine.length > column && leadingSpace == spaceTrimmed &&
+          findBreakPoint(curLine, column, wrapOn, killTrailing, forceBreak);
+        // If this isn't broken, or is broken at a different point, remove old break
+        if (!firstBreak || firstBreak.from != oldLen || firstBreak.to != oldLen + spaceInserted) {
+          changes.push({text: [spaceInserted ? " " : ""],
+                        from: Pos(curNo, oldLen),
+                        to: Pos(curNo + 1, spaceTrimmed.length)});
+        } else {
+          curLine = leadingSpace + text;
+          ++curNo;
+        }
+      }
+      while (curLine.length > column) {
+        var bp = findBreakPoint(curLine, column, wrapOn, killTrailing, forceBreak);
+        if (bp.from != bp.to ||
+            forceBreak && leadingSpace !== curLine.slice(0, bp.to)) {
+          changes.push({text: ["", leadingSpace],
+                        from: Pos(curNo, bp.from),
+                        to: Pos(curNo, bp.to)});
+          curLine = leadingSpace + curLine.slice(bp.to);
+          ++curNo;
+        } else {
+          break;
+        }
+      }
+    }
+    if (changes.length) cm.operation(function() {
+      for (var i = 0; i < changes.length; ++i) {
+        var change = changes[i];
+        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;
+  }
+
+  CodeMirror.defineExtension("wrapParagraph", function(pos, options) {
+    options = options || {};
+    if (!pos) pos = this.getCursor();
+    var para = findParagraph(this, pos, options);
+    return wrapRange(this, Pos(para.from, 0), Pos(para.to - 1), options);
+  });
+
+  CodeMirror.commands.wrapLines = function(cm) {
+    cm.operation(function() {
+      var ranges = cm.listSelections(), at = cm.lastLine() + 1;
+      for (var i = ranges.length - 1; i >= 0; i--) {
+        var range = ranges[i], span;
+        if (range.empty()) {
+          var para = findParagraph(cm, range.head, {});
+          span = {from: Pos(para.from, 0), to: Pos(para.to - 1)};
+        } else {
+          span = {from: range.from(), to: range.to()};
+        }
+        if (span.to.line >= at) continue;
+        at = span.from.line;
+        wrapRange(cm, span.from, span.to, {});
+      }
+    });
+  };
+
+  CodeMirror.defineExtension("wrapRange", function(from, to, options) {
+    return wrapRange(this, from, to, options || {});
+  });
+
+  CodeMirror.defineExtension("wrapParagraphsInRange", function(from, to, options) {
+    options = options || {};
+    var cm = this, paras = [];
+    for (var line = from.line; line <= to.line;) {
+      var para = findParagraph(cm, Pos(line, 0), options);
+      paras.push(para);
+      line = para.to;
+    }
+    var madeChange = false;
+    if (paras.length) cm.operation(function() {
+      for (var i = paras.length - 1; i >= 0; --i)
+        madeChange = madeChange || wrapRange(cm, Pos(paras[i].from, 0), Pos(paras[i].to - 1), options);
+    });
+    return madeChange;
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/bin/authors.sh	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,6 @@
+# Combine existing list of authors with everyone known in git, sort, add header.
+tail --lines=+3 AUTHORS > AUTHORS.tmp
+git log --format='%aN' | grep -v "Piët Delport" >> AUTHORS.tmp
+echo -e "List of CodeMirror contributors. Updated before every release.\n" > AUTHORS
+sort -u AUTHORS.tmp | sed 's/Google Inc\./Google LLC/' >> AUTHORS
+rm -f AUTHORS.tmp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/bin/lint	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,3 @@
+#!/usr/bin/env node
+
+process.exit(require("../test/lint").ok ? 0 : 1);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/bin/release	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,38 @@
+#!/usr/bin/env node
+
+var fs = require("fs"), child = require("child_process");
+
+var number, bumpOnly;
+
+for (var i = 2; i < process.argv.length; i++) {
+  if (process.argv[i] == "-bump") bumpOnly = true;
+  else if (/^\d+\.\d+\.\d+$/.test(process.argv[i])) number = process.argv[i];
+  else { console.log("Bogus command line arg: " + process.argv[i]); process.exit(1); }
+}
+
+if (!number) { console.log("Must give a version"); process.exit(1); }
+
+function rewrite(file, f) {
+  fs.writeFileSync(file, f(fs.readFileSync(file, "utf8")), "utf8");
+}
+
+rewrite("src/edit/main.js", function(lib) {
+  return lib.replace(/CodeMirror\.version = "\d+\.\d+\.\d+"/,
+                     "CodeMirror.version = \"" + number + "\"");
+});
+function rewriteJSON(pack) {
+  return pack.replace(/"version":\s*"\d+\.\d+\.\d+"/, "\"version\": \"" + number + "\"");
+}
+rewrite("package.json", rewriteJSON);
+rewrite("doc/manual.html", function(manual) {
+  return manual.replace(/>version \d+\.\d+\.\d+<\/span>/, ">version " + number + "</span>");
+});
+
+if (bumpOnly) process.exit(0);
+
+child.exec("bash bin/authors.sh", function(){});
+
+rewrite("index.html", function(index) {
+  return index.replace(/\.zip">\d+\.\d+\.\d+<\/a>/,
+                       ".zip\">" + number + "</a>");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/bin/source-highlight	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+#!/usr/bin/env node
+
+// Simple command-line code highlighting tool. Reads code from stdin,
+// spits html to stdout. For example:
+//
+//   echo 'function foo(a) { return a; }' | bin/source-highlight -s javascript
+//   bin/source-highlight -s 
+
+var fs = require("fs");
+
+var CodeMirror = require("../addon/runmode/runmode.node.js");
+require("../mode/meta.js");
+
+var sPos = process.argv.indexOf("-s");
+if (sPos == -1 || sPos == process.argv.length - 1) {
+   console.error("Usage: source-highlight -s language");
+   process.exit(1);
+}
+var lang = process.argv[sPos + 1].toLowerCase(), modeName = lang;
+var found = CodeMirror.findModeByMIME(lang) || CodeMirror.findModeByName(lang)
+if (found) {
+  modeName = found.mode
+  lang = found.mime
+}
+
+if (!CodeMirror.modes[modeName])
+  require("../mode/" + modeName + "/" + modeName + ".js");
+
+function esc(str) {
+  return str.replace(/[<&]/g, function(ch) { return ch == "&" ? "&amp;" : "&lt;"; });
+}
+
+var code = fs.readFileSync("/dev/stdin", "utf8");
+var curStyle = null, accum = "";
+function flush() {
+  if (curStyle) process.stdout.write("<span class=\"" + curStyle.replace(/(^|\s+)/g, "$1cm-") + "\">" + esc(accum) + "</span>");
+  else process.stdout.write(esc(accum));
+}
+
+CodeMirror.runMode(code, lang, function(text, style) {
+  if (style != curStyle) {
+    flush();
+    curStyle = style; accum = text;
+  } else {
+    accum += text;
+  }
+});
+flush();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/bin/upload-release.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+"use strict"
+
+let version = process.argv[2]
+let auth = process.argv[3]
+let url = require("url")
+
+if (!auth) {
+  console.log("Usage: upload-release.js [TAG] [github-user:password]")
+  process.exit(1)
+}
+
+function post(host, path, body) {
+  let req = require("https").request({
+    host,
+    auth: auth,
+    headers: {"user-agent": "Release uploader"},
+    path,
+    method: "POST"
+  }, res => {
+    if (res.statusCode >= 300 && res.statusCode < 400) {
+      console.log(res.headers.location)
+      let parsed = url.parse(res.headers.location)
+      post(parsed.host, parsed.path, body)
+    } else if (res.statusCode >= 400) {
+      console.error(res.statusCode, res.statusMessage)
+      res.on("data", d => console.log(d.toString()))
+      res.on("end", () => process.exit(1))
+    }
+  })
+  req.write(body)
+  req.end()
+}
+
+require('child_process').exec("git --no-pager show -s --format='%s' " + version, (error, stdout) => {
+  if (error) throw error
+  let message = stdout.split("\n").slice(2)
+  message = message.slice(0, message.indexOf("-----BEGIN PGP SIGNATURE-----")).join("\n")
+
+  post("api.github.com", "/repos/codemirror/codemirror5/releases", JSON.stringify({
+    tag_name: version,
+    name: version,
+    body: message
+  }))
+})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/activeline.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,88 @@
+<!doctype html>
+
+<title>CodeMirror: Active Line Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../addon/selection/active-line.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Active Line</a>
+  </ul>
+</div>
+
+<article>
+<h2>Active Line Demo</h2>
+<form><textarea id="code" name="code">
+<?xml version="1.0" encoding="UTF-8"?>
+<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"
+     xmlns:georss="http://www.georss.org/georss"
+     xmlns:twitter="http://api.twitter.com">
+  <channel>
+    <title>Twitter / codemirror</title>
+    <link>http://twitter.com/codemirror</link>
+    <atom:link type="application/rss+xml"
+               href="http://twitter.com/statuses/user_timeline/242283288.rss" rel="self"/>
+    <description>Twitter updates from CodeMirror / codemirror.</description>
+    <language>en-us</language>
+    <ttl>40</ttl>
+  <item>
+    <title>codemirror: http://cloud-ide.com &#8212; they're springing up like mushrooms. This one
+      uses CodeMirror as its editor.</title>
+    <description>codemirror: http://cloud-ide.com &#8212; they're springing up like mushrooms. This
+      one uses CodeMirror as its editor.</description>
+    <pubDate>Thu, 17 Mar 2011 23:34:47 +0000</pubDate>
+    <guid>http://twitter.com/codemirror/statuses/48527733722058752</guid>
+    <link>http://twitter.com/codemirror/statuses/48527733722058752</link>
+    <twitter:source>web</twitter:source>
+    <twitter:place/>
+  </item>
+  <item>
+    <title>codemirror: Posted a description of the CodeMirror 2 internals at
+      https://codemirror.net/2/internals.html</title>
+    <description>codemirror: Posted a description of the CodeMirror 2 internals at
+      https://codemirror.net/2/internals.html</description>
+    <pubDate>Wed, 02 Mar 2011 12:15:09 +0000</pubDate>
+    <guid>http://twitter.com/codemirror/statuses/42920879788789760</guid>
+    <link>http://twitter.com/codemirror/statuses/42920879788789760</link>
+    <twitter:source>web</twitter:source>
+    <twitter:place/>
+  </item>
+  </channel>
+</rss></textarea></form>
+
+    <script>
+var nonEmpty = false;
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  mode: "application/xml",
+  styleActiveLine: true,
+  lineNumbers: true,
+  lineWrapping: true
+});
+
+function toggleSelProp() {
+  nonEmpty = !nonEmpty;
+  editor.setOption("styleActiveLine", {nonEmpty: nonEmpty});
+  var label = nonEmpty ? 'Disable nonEmpty option' : 'Enable nonEmpty option';
+  document.getElementById('toggleButton').innerText = label;
+}
+</script>
+
+    <p>Styling the current cursor line.</p>
+
+    <button onclick="toggleSelProp()" id="toggleButton">Enable <code>nonEmpty</code> option</button>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/anywordhint.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,77 @@
+<!doctype html>
+
+<title>CodeMirror: Any Word Completion Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/hint/show-hint.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/hint/show-hint.js"></script>
+<script src="../addon/hint/anyword-hint.js" id=anyword></script>
+<script src="../mode/javascript/javascript.js"></script>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Any Word Completion</a>
+  </ul>
+</div>
+
+<article>
+<h2>Any Word Completion Demo</h2>
+<form><textarea id="code" name="code">
+(function() {
+  "use strict";
+
+  var WORD = /[\w$]+/, RANGE = 500;
+
+  CodeMirror.registerHelper("hint", "anyword", function(editor, options) {
+    var word = options && options.word || WORD;
+    var range = options && options.range || RANGE;
+    var cur = editor.getCursor(), curLine = editor.getLine(cur.line);
+    var end = cur.ch, start = end;
+    while (start && word.test(curLine.charAt(start - 1))) --start;
+    var curWord = start != end && curLine.slice(start, end);
+
+    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;
+      for (; line != endLine; line += dir) {
+        var text = editor.getLine(line), m;
+        while (m = re.exec(text)) {
+          if (line == cur.line && m[0] === curWord) continue;
+          if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) {
+            seen[m[0]] = true;
+            list.push(m[0]);
+          }
+        }
+      }
+    }
+    return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)};
+  });
+})();
+</textarea></form>
+
+<p>Press <strong>ctrl-space</strong> to activate autocompletion. The
+completion uses
+the <a href="../doc/manual.html#addon_anyword-hint">anyword-hint.js</a>
+module, which simply looks at nearby words in the buffer and completes
+to those.</p>
+
+    <script>
+      CodeMirror.commands.autocomplete = function(cm) {
+        cm.showHint({hint: CodeMirror.hint.anyword});
+      }
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        extraKeys: {"Ctrl-Space": "autocomplete"}
+      });
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/bidi.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,106 @@
+<!doctype html>
+
+<title>CodeMirror: Bi-directional Text Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+  fieldset {border: none}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Bi-directional Text</a>
+  </ul>
+</div>
+
+<article>
+<h2>Bi-directional Text Demo</h2>
+<form><textarea id="code" name="code"><!-- Piece of the CodeMirror manual, 'translated' into Arabic by Google Translate -->
+<!-- قطعة من دليل CodeMirror، "ترجم" إلى العربية بواسطة جوجل ترجمة -->
+
+<dl>
+  <dt id=option_value><code>value (string or Doc)</code></dt>
+  <dd>قيمة البداية المحرر. يمكن أن تكون سلسلة، أو. كائن مستند.</dd>
+  <dt id=option_mode><code>mode (string or object)</code></dt>
+  <dd>وضع الاستخدام. عندما لا تعطى، وهذا الافتراضي إلى الطريقة الاولى
+  التي تم تحميلها. قد يكون من سلسلة، والتي إما أسماء أو ببساطة هو وضع
+  MIME نوع المرتبطة اسطة. بدلا من ذلك، قد يكون من كائن يحتوي على
+  خيارات التكوين لواسطة، مع <code>name</code> الخاصية التي وضع أسماء
+  (على سبيل المثال <code>{name: "javascript", json: true}</code>).
+  صفحات التجريبي لكل وضع تحتوي على معلومات حول ما معلمات تكوين وضع
+  يدعمها. يمكنك أن تطلب CodeMirror التي تم تعريفها طرق وأنواع MIME
+  الكشف على <code>CodeMirror.modes</code>
+  و <code>CodeMirror.mimeModes</code> الكائنات. وضع خرائط الأسماء
+  الأولى لمنشئات الخاصة بهم، وخرائط لأنواع MIME 2 المواصفات
+  واسطة.</dd>
+  <dt id=option_theme><code>theme (string)</code></dt>
+  <dd>موضوع لنمط المحرر مع. يجب عليك التأكد من الملف CSS تحديد
+  المقابلة <code>.cm-s-[name]</code> يتم تحميل أنماط (انظر
+  <a href="../theme/"><code>theme</code></a> الدليل في التوزيع).
+  الافتراضي هو <code>"default"</code> ، والتي تم تضمينها في
+  الألوان <code>codemirror.css</code>. فمن الممكن استخدام فئات متعددة
+  في تطبيق السمات مرة واحدة على سبيل المثال <code>"foo bar"</code>
+  سيتم تعيين كل من <code>cm-s-foo</code> و <code>cm-s-bar</code>
+  الطبقات إلى المحرر.</dd>
+</dl>
+</textarea>
+  <fieldset>
+    Editor default direction:
+    <input type="radio" id="ltr" name="direction"/><label for="ltr">LTR</label>
+    <input type="radio" id="rtl" name="direction"/><label for="rtl">RTL</label>
+  </fieldset>
+  <fieldset>
+    HTML document direction:
+    <input type="radio" id="htmlltr" name="htmldirection"/><label for="htmlltr">LTR</label>
+    <input type="radio" id="htmlrtl" name="htmldirection"/><label for="htmlrtl">RTL</label>
+  </fieldset>
+  <fieldset>
+    <input type="checkbox" id="rtlMoveVisually"/><label for="rtlMoveVisually">Use visual order for arrow key movement.</label>
+  </fieldset>
+</form>
+
+    <script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  mode: "text/html",
+  lineNumbers: true,
+  lineWrapping: true,
+  direction: "rtl"
+});
+
+var dirRadios = {ltr: document.getElementById("ltr"),
+                 rtl: document.getElementById("rtl")};
+dirRadios[editor.getOption("direction")].checked = true;
+dirRadios["rtl"].onchange = dirRadios["ltr"].onchange = function() {
+  editor.setOption("direction", dirRadios["rtl"].checked ? "rtl" : "ltr");
+};
+
+var HtmlDirRadios = {ltr: document.getElementById("htmlltr"),
+                 rtl: document.getElementById("htmlrtl")};
+HtmlDirRadios["ltr"].checked = true;
+HtmlDirRadios["rtl"].onchange = HtmlDirRadios["ltr"].onchange = function() {
+  document.dir = (HtmlDirRadios["rtl"].checked ? "rtl" : "ltr");
+};
+
+var moveCheckbox = document.getElementById("rtlMoveVisually");
+moveCheckbox.checked = editor.getOption("rtlMoveVisually");
+moveCheckbox.onchange = function() {
+  editor.setOption("rtlMoveVisually", moveCheckbox.checked);
+};
+</script>
+
+  <p>Demonstration of bi-directional text support. See
+  the <a href="http://marijnhaverbeke.nl/blog/cursor-in-bidi-text.html">related
+  blog post</a> for more background.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/btree.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,83 @@
+<!doctype html>
+
+<title>CodeMirror: B-Tree visualization</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<style>
+      .lineblock { display: inline-block; margin: 1px; height: 5px; }
+      .CodeMirror {border: 1px solid #aaa; height: 400px}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">B-Tree visualization</a>
+  </ul>
+</div>
+
+<article>
+<h2>B-Tree visualization</h2>
+<form><textarea id="code" name="code">type here, see a summary of the document b-tree below</textarea></form>
+      <div style="display: inline-block; height: 402px; overflow-y: auto" id="output"></div>
+
+    <script id="me">
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  lineWrapping: true
+});
+var updateTimeout;
+editor.on("change", function(cm) {
+  clearTimeout(updateTimeout);
+  updateTimeout = setTimeout(updateVisual, 200);
+});
+updateVisual();
+
+function updateVisual() {
+  var out = document.getElementById("output");
+  out.innerHTML = "";
+
+  function drawTree(out, node) {
+    if (node.lines) {
+      out.appendChild(document.createElement("div")).innerHTML =
+        "<b>leaf</b>: " + node.lines.length + " lines, " + Math.round(node.height) + " px";
+      var lines = out.appendChild(document.createElement("div"));
+      lines.style.lineHeight = "6px"; lines.style.marginLeft = "10px";
+      for (var i = 0; i < node.lines.length; ++i) {
+        var line = node.lines[i], lineElt = lines.appendChild(document.createElement("div"));
+        lineElt.className = "lineblock";
+        var gray = Math.min(line.text.length * 3, 230), col = gray.toString(16);
+        if (col.length == 1) col = "0" + col;
+        lineElt.style.background = "#" + col + col + col;
+        lineElt.style.width = Math.max(Math.round(line.height / 3), 1) + "px";
+      }
+    } else {
+      out.appendChild(document.createElement("div")).innerHTML =
+        "<b>node</b>: " + node.size + " lines, " + Math.round(node.height) + " px";
+      var sub = out.appendChild(document.createElement("div"));
+      sub.style.paddingLeft = "20px";
+      for (var i = 0; i < node.children.length; ++i)
+        drawTree(sub, node.children[i]);
+    }
+  }
+  drawTree(out, editor.getDoc());
+}
+
+function fillEditor() {
+  var sc = document.getElementById("me");
+  var doc = (sc.textContent || sc.innerText || sc.innerHTML).replace(/^\s*/, "") + "\n";
+  doc += doc; doc += doc; doc += doc; doc += doc; doc += doc; doc += doc;
+  editor.setValue(doc);
+}
+    </script>
+
+<p><button onclick="fillEditor()">Add a lot of content</button></p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/buffers.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,109 @@
+<!doctype html>
+
+<title>CodeMirror: Multiple Buffer & Split View Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/css/css.js"></script>
+<style id=style>
+      .CodeMirror {border: 1px solid black; height: 250px;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Multiple Buffer & Split View</a>
+  </ul>
+</div>
+
+<article>
+<h2>Multiple Buffer & Split View Demo</h2>
+
+
+    <div id=code_top></div>
+    <div>
+      Select buffer: <select id=buffers_top></select>
+      &nbsp; &nbsp; <button onclick="newBuf('top')">New buffer</button>
+    </div>
+    <div id=code_bot></div>
+    <div>
+      Select buffer: <select id=buffers_bot></select>
+      &nbsp; &nbsp; <button onclick="newBuf('bot')">New buffer</button>
+    </div>
+
+    <script id=script>
+var sel_top = document.getElementById("buffers_top");
+CodeMirror.on(sel_top, "change", function() {
+  selectBuffer(ed_top, sel_top.options[sel_top.selectedIndex].value);
+});
+
+var sel_bot = document.getElementById("buffers_bot");
+CodeMirror.on(sel_bot, "change", function() {
+  selectBuffer(ed_bot, sel_bot.options[sel_bot.selectedIndex].value);
+});
+
+var buffers = {};
+
+function openBuffer(name, text, mode) {
+  buffers[name] = CodeMirror.Doc(text, mode);
+  var opt = document.createElement("option");
+  opt.appendChild(document.createTextNode(name));
+  sel_top.appendChild(opt);
+  sel_bot.appendChild(opt.cloneNode(true));
+}
+
+function newBuf(where) {
+  var name = prompt("Name for the buffer", "*scratch*");
+  if (name == null) return;
+  if (buffers.hasOwnProperty(name)) {
+    alert("There's already a buffer by that name.");
+    return;
+  }
+  openBuffer(name, "", "javascript");
+  selectBuffer(where == "top" ? ed_top : ed_bot, name);
+  var sel = where == "top" ? sel_top : sel_bot;
+  sel.value = name;
+}
+
+function selectBuffer(editor, name) {
+  var buf = buffers[name];
+  if (buf.getEditor()) buf = buf.linkedDoc({sharedHist: true});
+  var old = editor.swapDoc(buf);
+  var linked = old.iterLinkedDocs(function(doc) {linked = doc;});
+  if (linked) {
+    // Make sure the document in buffers is the one the other view is looking at
+    for (var name in buffers) if (buffers[name] == old) buffers[name] = linked;
+    old.unlinkDoc(linked);
+  }
+  editor.focus();
+}
+
+function nodeContent(id) {
+  var node = document.getElementById(id), val = node.textContent || node.innerText;
+  val = val.slice(val.match(/^\s*/)[0].length, val.length - val.match(/\s*$/)[0].length) + "\n";
+  return val;
+}
+openBuffer("js", nodeContent("script"), "javascript");
+openBuffer("css", nodeContent("style"), "css");
+
+var ed_top = CodeMirror(document.getElementById("code_top"), {lineNumbers: true});
+selectBuffer(ed_top, "js");
+var ed_bot = CodeMirror(document.getElementById("code_bot"), {lineNumbers: true});
+selectBuffer(ed_bot, "js");
+</script>
+
+    <p>Demonstration of
+    using <a href="../doc/manual.html#linkedDoc">linked documents</a>
+    to provide a split view on a document, and
+    using <a href="../doc/manual.html#swapDoc"><code>swapDoc</code></a>
+    to use a single editor to display multiple documents.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/changemode.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,58 @@
+<!doctype html>
+
+<title>CodeMirror: Mode-Changing Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/scheme/scheme.js"></script>
+<style>
+      .CodeMirror {border: 1px solid black;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Mode-Changing</a>
+  </ul>
+</div>
+
+<article>
+<h2>Mode-Changing Demo</h2>
+<form><textarea id="code" name="code">
+;; If there is Scheme code in here, the editor will be in Scheme mode.
+;; If you put in JS instead, it'll switch to JS mode.
+
+(define (double x)
+  (* x x))
+</textarea></form>
+
+<p>On changes to the content of the above editor, a (crude) script
+tries to auto-detect the language used, and switches the editor to
+either JavaScript or Scheme mode based on that.</p>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    mode: "scheme",
+    lineNumbers: true
+  });
+  var pending;
+  editor.on("change", function() {
+    clearTimeout(pending);
+    pending = setTimeout(update, 400);
+  });
+  function looksLikeScheme(code) {
+    return !/^\s*\(\s*function\b/.test(code) && /^\s*[;\(]/.test(code);
+  }
+  function update() {
+    editor.setOption("mode", looksLikeScheme(editor.getValue()) ? "scheme" : "javascript");
+  }
+</script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/closebrackets.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+<!doctype html>
+
+<title>CodeMirror: Closebrackets Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/edit/closebrackets.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Closebrackets</a>
+  </ul>
+</div>
+
+<article>
+<h2>Closebrackets Demo</h2>
+<form><textarea id="code" name="code">function Grid(width, height) {
+  this.width = width;
+  this.height = height;
+  this.cells = new Array(width * height);
+}
+Grid.prototype.valueAt = function(point) {
+  return this.cells[point.y * this.width + point.x];
+};
+Grid.prototype.setValueAt = function(point, value) {
+  this.cells[point.y * this.width + point.x] = value;
+};
+Grid.prototype.isInside = function(point) {
+  return point.x >= 0 && point.y >= 0 &&
+         point.x < this.width && point.y < this.height;
+};
+Grid.prototype.moveValue = function(from, to) {
+  this.setValueAt(to, this.valueAt(from));
+  this.setValueAt(from, undefined);
+};</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {autoCloseBrackets: true});
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/closetag.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,42 @@
+<!doctype html>
+
+<title>CodeMirror: Close-Tag Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/edit/closetag.js"></script>
+<script src="../addon/fold/xml-fold.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/css/css.js"></script>
+<script src="../mode/htmlmixed/htmlmixed.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Close-Tag</a>
+  </ul>
+</div>
+
+<article>
+<h2>Close-Tag Demo</h2>
+<form><textarea id="code" name="code"><html</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: 'text/html',
+        autoCloseTags: true
+      });
+    </script>
+  <p>Uses the <a href="https://codemirror.net/5/doc/manual.html#addon_closetag">closetag</a> addon to auto-close tags.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/complete.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,126 @@
+<!doctype html>
+
+<title>CodeMirror: Autocomplete Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/hint/show-hint.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/hint/show-hint.js"></script>
+<script src="../addon/hint/javascript-hint.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/markdown/markdown.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Autocomplete</a>
+  </ul>
+</div>
+
+<article>
+<h2>Autocomplete Demo</h2>
+<form><textarea id="code" name="code">
+function getCompletions(token, context) {
+  var found = [], start = token.string;
+  function maybeAdd(str) {
+    if (str.indexOf(start) == 0) found.push(str);
+  }
+  function gatherCompletions(obj) {
+    if (typeof obj == "string") forEach(stringProps, maybeAdd);
+    else if (obj instanceof Array) forEach(arrayProps, maybeAdd);
+    else if (obj instanceof Function) forEach(funcProps, maybeAdd);
+    for (var name in obj) maybeAdd(name);
+  }
+
+  if (context) {
+    // If this is a property, see if it belongs to some object we can
+    // find in the current environment.
+    var obj = context.pop(), base;
+    if (obj.className == "js-variable")
+      base = window[obj.string];
+    else if (obj.className == "js-string")
+      base = "";
+    else if (obj.className == "js-atom")
+      base = 1;
+    while (base != null && context.length)
+      base = base[context.pop().string];
+    if (base != null) gatherCompletions(base);
+  }
+  else {
+    // If not, just look in the window object and any local scope
+    // (reading into JS mode internals to get at the local variables)
+    for (var v = token.state.localVars; v; v = v.next) maybeAdd(v.name);
+    gatherCompletions(window);
+    forEach(keywords, maybeAdd);
+  }
+  return found;
+}
+</textarea></form>
+
+<p>Press <strong>ctrl-space</strong> to activate autocompletion. Built
+on top of the <a href="../doc/manual.html#addon_show-hint"><code>show-hint</code></a>
+and <a href="../doc/manual.html#addon_javascript-hint"><code>javascript-hint</code></a>
+addons.</p>
+
+<form><textarea style="display: none" id="synonyms" name="synonyms">
+Here, the completion use an asynchronous hinting function to provide
+synonyms for each words. If your browser support `Promises`, the
+hinting function can also return one.
+</textarea></form>
+
+<script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  extraKeys: {"Ctrl-Space": "autocomplete"},
+  mode: {name: "javascript", globalVars: true}
+});
+
+if (typeof Promise !== "undefined") {
+  var comp = [
+    ["here", "hither"],
+    ["asynchronous", "nonsynchronous"],
+    ["completion", "achievement", "conclusion", "culmination", "expirations"],
+    ["hinting", "advise", "broach", "imply"],
+    ["function","action"],
+    ["provide", "add", "bring", "give"],
+    ["synonyms", "equivalents"],
+    ["words", "token"],
+    ["each", "every"],
+  ]
+
+  function synonyms(cm, option) {
+    return new Promise(function(accept) {
+      setTimeout(function() {
+        var cursor = cm.getCursor(), line = cm.getLine(cursor.line)
+        var start = cursor.ch, end = cursor.ch
+        while (start && /\w/.test(line.charAt(start - 1))) --start
+        while (end < line.length && /\w/.test(line.charAt(end))) ++end
+        var word = line.slice(start, end).toLowerCase()
+        for (var i = 0; i < comp.length; i++) if (comp[i].indexOf(word) != -1)
+          return accept({list: comp[i],
+                         from: CodeMirror.Pos(cursor.line, start),
+                         to: CodeMirror.Pos(cursor.line, end)})
+        return accept(null)
+      }, 100)
+    })
+  }
+
+  var editor2 = CodeMirror.fromTextArea(document.getElementById("synonyms"), {
+    extraKeys: {"Ctrl-Space": "autocomplete"},
+    lineNumbers: true,
+    lineWrapping: true,
+    mode: "text/x-markdown",
+    hintOptions: {hint: synonyms}
+  })
+}
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/emacs.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,76 @@
+<!doctype html>
+
+<title>CodeMirror: Emacs bindings demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/dialog/dialog.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/clike/clike.js"></script>
+<script src="../keymap/emacs.js"></script>
+<script src="../addon/edit/matchbrackets.js"></script>
+<script src="../addon/comment/comment.js"></script>
+<script src="../addon/dialog/dialog.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../addon/search/search.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Emacs bindings</a>
+  </ul>
+</div>
+
+<article>
+<h2>Emacs bindings demo</h2>
+<form><textarea id="code" name="code">
+#include "syscalls.h"
+/* getchar:  simple buffered version */
+int getchar(void)
+{
+  static char buf[BUFSIZ];
+  static char *bufp = buf;
+  static int n = 0;
+  if (n == 0) {  /* buffer is empty */
+    n = read(0, buf, sizeof buf);
+    bufp = buf;
+  }
+  return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
+}
+</textarea></form>
+
+<p>The emacs keybindings are enabled by
+including <a href="../keymap/emacs.js">keymap/emacs.js</a> and setting
+the <code>keyMap</code> option to <code>"emacs"</code>. Because
+CodeMirror's internal API is quite different from Emacs, they are only
+a loose approximation of actual emacs bindings, though.</p>
+
+<p>Also note that a lot of browsers disallow certain keys from being
+captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the
+result that idiomatic use of Emacs keys will constantly close your tab
+or open a new window.</p>
+
+    <script>
+      CodeMirror.commands.save = function() {
+        var elt = editor.getWrapperElement();
+        elt.style.background = "#def";
+        setTimeout(function() { elt.style.background = ""; }, 300);
+      };
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "text/x-csrc",
+        matchBrackets: true,
+        keyMap: "emacs"
+      });
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/folding.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,184 @@
+<!doctype html>
+
+<head>
+  <title>CodeMirror: Code Folding Demo</title>
+  <meta charset="utf-8"/>
+  <link rel=stylesheet href="../doc/docs.css">
+
+  <style>
+    .some-css {
+      color: red;
+      line-height: 2;
+    }
+  </style>
+
+  <link rel="stylesheet" href="../lib/codemirror.css">
+  <link rel="stylesheet" href="../addon/fold/foldgutter.css" />
+  <script src="../lib/codemirror.js"></script>
+  <script src="../addon/fold/foldcode.js"></script>
+  <script src="../addon/fold/foldgutter.js"></script>
+  <script src="../addon/fold/brace-fold.js"></script>
+  <script src="../addon/fold/xml-fold.js"></script>
+  <script src="../addon/fold/indent-fold.js"></script>
+  <script src="../addon/fold/markdown-fold.js"></script>
+  <script src="../addon/fold/comment-fold.js"></script>
+  <script src="../mode/javascript/javascript.js"></script>
+  <script src="../mode/xml/xml.js"></script>
+  <script src="../mode/css/css.js"></script>
+  <script src="../mode/htmlmixed/htmlmixed.js"></script>
+  <script src="../mode/python/python.js"></script>
+  <script src="../mode/markdown/markdown.js"></script>
+  <style>
+    .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+  </style>
+</head>
+
+<body>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Code Folding</a>
+  </ul>
+</div>
+
+<article>
+  <h2>Code Folding Demo</h2>
+  <form>
+    <div style="max-width: 50em; margin-bottom: 1em">JavaScript:<br>
+    <textarea id="code" name="code"></textarea></div>
+    <div style="max-width: 50em; margin-bottom: 1em">HTML:<br>
+    <textarea id="code-html" name="code-html"></textarea></div>    
+    <div style="max-width: 50em; margin-bottom: 1em">JSON with custom widget:<br>
+    <textarea id="code-json" name="code-json">
+{
+  "menu": {
+    "id": "file",
+    "value": "File",
+    "popup": {
+      "menuitem": [
+        {"value": "New", "onclick": "CreateNewDoc()"},
+        {"value": "Open", "onclick": "OpenDoc()"},
+        {"value": "Close", "onclick": "CloseDoc()"}
+      ]
+    }
+  }
+}
+    </textarea></div>
+    <div style="max-width: 50em">Python:<br>
+    <textarea id="code-python" name="code">
+def foo():
+  do_some_stuff()
+  here
+  return None
+
+class Bar:
+  __init__(self):
+    if True:
+      print("True")
+    else:
+      print("False")
+
+  this_code_makes_no_sense():
+    pass
+
+# A comment</textarea></div>
+    <div style="max-width: 50em">Markdown:<br>
+    <textarea id="code-markdown" name="code"></textarea></div>
+  </form>
+  <script id="script">
+/*
+ * Demonstration of code folding
+ */
+window.onload = function() {
+  var te = document.getElementById("code");
+  var sc = document.getElementById("script");
+  te.value = (sc.textContent || sc.innerText || sc.innerHTML).replace(/^\s*/, "");
+  sc.innerHTML = "";
+  var te_html = document.getElementById("code-html");
+  te_html.value = document.documentElement.innerHTML;
+  var te_python = document.getElementById("code-python");
+  var te_markdown = document.getElementById("code-markdown");
+  te_markdown.value = "# Foo\n## Bar\n\nblah blah\n\n## Baz\n\nblah blah\n\n# Quux\n\nblah blah\n"
+  var te_json = document.getElementById("code-json");
+
+  window.editor = CodeMirror.fromTextArea(te, {
+    mode: "javascript",
+    lineNumbers: true,
+    lineWrapping: true,
+    extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
+    foldGutter: true,
+    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
+  });
+  editor.foldCode(CodeMirror.Pos(13, 0));
+
+  window.editor_json = CodeMirror.fromTextArea(te_json, {
+    mode: {name: "javascript", json: true},
+    lineNumbers: true,
+    lineWrapping: true,
+    extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
+    foldGutter: true,
+    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"],
+    foldOptions: {
+      widget: (from, to) => {
+        var count = undefined;
+
+        // Get open / close token
+        var startToken = '{', endToken = '}';        
+        var prevLine = window.editor_json.getLine(from.line);
+        if (prevLine.lastIndexOf('[') > prevLine.lastIndexOf('{')) {
+          startToken = '[', endToken = ']';
+        }
+
+        // Get json content
+        var internal = window.editor_json.getRange(from, to);
+        var toParse = startToken + internal + endToken;
+
+        // Get key count
+        try {
+          var parsed = JSON.parse(toParse);
+          count = Object.keys(parsed).length;
+        } catch(e) { }        
+
+        return count ? `\u21A4${count}\u21A6` : '\u2194';
+      }
+    }
+  });
+  editor_json.foldCode(CodeMirror.Pos(5, 0));
+
+  window.editor_html = CodeMirror.fromTextArea(te_html, {
+    mode: "text/html",
+    lineNumbers: true,
+    lineWrapping: true,
+    extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
+    foldGutter: true,
+    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
+  });
+  editor_html.foldCode(CodeMirror.Pos(0, 0));
+  editor_html.foldCode(CodeMirror.Pos(34, 0));
+
+  window.editor_python = CodeMirror.fromTextArea(te_python, {
+    mode: "python",
+    lineNumbers: true,
+    extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
+    foldGutter: true,
+    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
+  });
+
+  window.editor_markdown = CodeMirror.fromTextArea(te_markdown, {
+    mode: "markdown",
+    lineNumbers: true,
+    lineWrapping: true,
+    extraKeys: {"Ctrl-Q": function(cm){ cm.foldCode(cm.getCursor()); }},
+    foldGutter: true,
+    gutters: ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
+  });
+};
+  </script>
+</article>
+</body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/fullscreen.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,83 @@
+<!doctype html>
+
+<title>CodeMirror: Full Screen Editing</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/display/fullscreen.css">
+<link rel="stylesheet" href="../theme/night.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../addon/display/fullscreen.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Full Screen Editing</a>
+  </ul>
+</div>
+
+<article>
+<h2>Full Screen Editing</h2>
+<form><textarea id="code" name="code" rows="5">
+<dl>
+  <dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
+  <dd>Whether, when indenting, the first N*<code>tabSize</code>
+  spaces should be replaced by N tabs. Default is false.</dd>
+
+  <dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
+  <dd>Configures whether the editor should re-indent the current
+  line when a character is typed that might change its proper
+  indentation (only works if the mode supports indentation).
+  Default is true.</dd>
+
+  <dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
+  <dd>A regular expression used to determine which characters
+  should be replaced by a
+  special <a href="#option_specialCharPlaceholder">placeholder</a>.
+  Mostly useful for non-printing special characters. The default
+  is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
+  <dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
+  <dd>A function that, given a special character identified by
+  the <a href="#option_specialChars"><code>specialChars</code></a>
+  option, produces a DOM node that is used to represent the
+  character. By default, a red dot (<span style="color: red">•</span>)
+  is shown, with a title tooltip to indicate the character code.</dd>
+
+  <dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
+  <dd>Determines whether horizontal cursor movement through
+  right-to-left (Arabic, Hebrew) text is visual (pressing the left
+  arrow moves the cursor left) or logical (pressing the left arrow
+  moves to the next lower index in the string, which is visually
+  right in right-to-left text). The default is <code>false</code>
+  on Windows, and <code>true</code> on other platforms.</dd>
+</dl>
+</textarea></form>
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      lineNumbers: true,
+      theme: "night",
+      extraKeys: {
+        "F11": function(cm) {
+          cm.setOption("fullScreen", !cm.getOption("fullScreen"));
+        },
+        "Esc": function(cm) {
+          if (cm.getOption("fullScreen")) cm.setOption("fullScreen", false);
+        }
+      }
+    });
+  </script>
+
+    <p>Demonstration of
+    the <a href="../doc/manual.html#addon_fullscreen">fullscreen</a>
+    addon. Press <strong>F11</strong> when cursor is in the editor to
+    toggle full screen editing. <strong>Esc</strong> can also be used
+    to <i>exit</i> full screen editing.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/hardwrap.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,75 @@
+<!doctype html>
+
+<title>CodeMirror: Hard-wrapping Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/markdown/markdown.js"></script>
+<script src="../addon/wrap/hardwrap.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Hard-wrapping</a>
+  </ul>
+</div>
+
+<article>
+<h2>Hard-wrapping Demo</h2>
+<form><textarea id="code" name="code">Lorem ipsum dolor sit amet, vim augue dictas constituto ex,
+sit falli simul viderer te. Graeco scaevola maluisset sit
+ut, in idque viris praesent sea. Ea sea eirmod indoctum
+repudiare. Vel noluisse suscipit pericula ut. In ius nulla
+alienum molestie. Mei essent discere democritum id.
+
+Equidem ponderum expetendis ius in, mea an erroribus
+constituto, congue timeam perfecto ad est. Ius ut primis
+timeam, per in ullum mediocrem. An case vero labitur pri,
+vel dicit laoreet et. An qui prompta conclusionemque, eam
+timeam sapientem in, cum dictas epicurei eu.
+
+Usu cu vide dictas deseruisse, eum choro graece adipiscing
+ut. Cibo qualisque ius ad, et dicat scripta mea, eam nihil
+mentitum aliquando cu. Debet aperiam splendide at quo, ad
+paulo nostro commodo duo. Sea adhuc utinam conclusionemque
+id, quas doming malorum nec ad. Tollit eruditi vivendum ad
+ius, eos soleat ignota ad.
+</textarea></form>
+
+<p>Demonstration of
+the <a href="../doc/manual.html#addon_hardwrap">hardwrap</a> addon.
+The above editor has its change event hooked up to
+the <code>wrapParagraphsInRange</code> method, so that the paragraphs
+are reflown as you are typing.</p>
+
+<script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  mode: "markdown",
+  lineNumbers: true,
+  extraKeys: {
+    "Ctrl-Q": function(cm) { cm.wrapParagraph(cm.getCursor(), options); }
+  }
+});
+var wait, options = {column: 60}, changing = false;
+editor.on("change", function(cm, change) {
+  if (changing) return;
+  clearTimeout(wait);
+  wait = setTimeout(function() {
+    changing = true;
+    cm.wrapParagraphsInRange(change.from, CodeMirror.changeEnd(change), options);
+    changing = false;
+  }, 200);
+});
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/html5complete.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,56 @@
+<!doctype html>
+
+<head>
+  <title>CodeMirror: HTML completion demo</title>
+  <meta charset="utf-8"/>
+  <link rel=stylesheet href="../doc/docs.css">
+
+  <link rel="stylesheet" href="../lib/codemirror.css">
+  <link rel="stylesheet" href="../addon/hint/show-hint.css">
+  <script src="../lib/codemirror.js"></script>
+  <script src="../addon/hint/show-hint.js"></script>
+  <script src="../addon/hint/xml-hint.js"></script>
+  <script src="../addon/hint/html-hint.js"></script>
+  <script src="../mode/xml/xml.js"></script>
+  <script src="../mode/javascript/javascript.js"></script>
+  <script src="../mode/css/css.js"></script>
+  <script src="../mode/htmlmixed/htmlmixed.js"></script>
+  <style>
+    .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
+  </style>
+</head>
+
+<body>
+  <div id=nav>
+    <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+    <ul>
+      <li><a href="../index.html">Home</a>
+      <li><a href="../doc/manual.html">Manual</a>
+      <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+    </ul>
+    <ul>
+      <li><a class=active href="#">HTML completion</a>
+    </ul>
+  </div>
+
+  <article>
+    <h2>HTML completion demo</h2>
+
+    <p>Shows the <a href="xmlcomplete.html">XML completer</a>
+    parameterized with information about the tags in HTML.
+    Press <strong>ctrl-space</strong> to activate completion.</p>
+
+    <div id="code"></div>
+
+    <script>
+      window.onload = function() {
+        editor = CodeMirror(document.getElementById("code"), {
+          mode: "text/html",
+          extraKeys: {"Ctrl-Space": "autocomplete"},
+          value: document.documentElement.innerHTML
+        });
+      };
+    </script>
+  </article>
+</body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/indentwrap.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,59 @@
+<!doctype html>
+
+<title>CodeMirror: Indented wrapped line demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .CodeMirror pre > * { text-indent: 0px; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Indented wrapped line</a>
+  </ul>
+</div>
+
+<article>
+<h2>Indented wrapped line demo</h2>
+<form><textarea id="code" name="code">
+<!doctype html>
+<body>
+  <h2 id="overview">Overview</h2>
+
+  <p>CodeMirror is a code-editor component that can be embedded in Web pages. The core library provides <em>only</em> the editor component, no accompanying buttons, auto-completion, or other IDE functionality. It does provide a rich API on top of which such functionality can be straightforwardly implemented. See the <a href="#addons">add-ons</a> included in the distribution, and the <a href="https://github.com/jagthedrummer/codemirror-ui">CodeMirror UI</a> project, for reusable implementations of extra features.</p>
+
+  <p>CodeMirror works with language-specific modes. Modes are JavaScript programs that help color (and optionally indent) text written in a given language. The distribution comes with a number of modes (see the <a href="../mode/"><code>mode/</code></a> directory), and it isn't hard to <a href="#modeapi">write new ones</a> for other languages.</p>
+</body>
+</textarea></form>
+
+    <p>This page uses a hack on top of the <code>"renderLine"</code>
+    event to make wrapped text line up with the base indentation of
+    the line.</p>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        lineWrapping: true,
+        mode: "text/html"
+      });
+      var charWidth = editor.defaultCharWidth(), basePadding = 4;
+      editor.on("renderLine", function(cm, line, elt) {
+        var off = CodeMirror.countColumn(line.text, null, cm.getOption("tabSize")) * charWidth;
+        elt.style.textIndent = "-" + off + "px";
+        elt.style.paddingLeft = (basePadding + off) + "px";
+      });
+      editor.refresh();
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/lint.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,171 @@
+<!doctype html>
+
+<title>CodeMirror: Linter Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/lint/lint.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/css/css.js"></script>
+<script src="https://unpkg.com/jshint@2.13.2/dist/jshint.js"></script>
+<script src="https://unpkg.com/jsonlint@1.6.3/web/jsonlint.js"></script>
+<script src="https://unpkg.com/csslint@1.0.5/dist/csslint.js"></script>
+<script src="../addon/lint/lint.js"></script>
+<script src="../addon/lint/javascript-lint.js"></script>
+<script src="../addon/lint/json-lint.js"></script>
+<script src="../addon/lint/css-lint.js"></script>
+<style>
+      .CodeMirror {border: 1px solid black;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Linter</a>
+  </ul>
+</div>
+
+<article>
+<h2>Linter Demo</h2>
+
+
+    <p><textarea id="code-js">var widgets = []
+function updateHints() {
+  editor.operation(function(){
+    for (var i = 0; i < widgets.length.; ++i)
+      editor.removeLineWidget(widgets[i]);
+    widgets.length = 0;
+
+    JSHINT(editor.getValue());
+    for (var i = 0; i < JSHINT.errors.length; ++i) {
+      var err = JSHINT.errors[i];
+      if (!err) continue;
+      var msg = document.createElement("div");
+      var icon = msg.appendChild(document.createElement("span"));
+      icon.innerHTML = "!!";
+      icon.className = "lint-error-icon";
+      msg.appendChild(document.createTextNode(err.reason));
+      msg.className = "lint-error";
+      widgets.push(editor.addLineWidget(err.line - 1, msg, {coverGutter: false, noHScroll: true}));
+    }
+  });
+  var info = editor.getScrollInfo();
+  var after = editor.charCoords({line: editor.getCursor().line + 1, ch: 0}, "local").top;
+  if (info.top + info.clientHeight < after)
+    editor.scrollTo(null, after - info.clientHeight + 3);
+}
+</textarea></p>
+
+    <p><textarea id="code-json">[
+ {
+  _id: "post 1",
+  "author": "Bob",
+  "content": "...",
+  "page_views": 5
+ },
+ {
+  "_id": "post 2",
+  "author": "Bob",
+  "content": "...",
+  "page_views": 9
+ },
+ {
+  "_id": "post 3",
+  "author": "Bob",
+  "content": "...",
+  "page_views": 8
+ }
+]
+</textarea></p>
+
+    <p><textarea id="code-css">@charset "UTF-8";
+
+@import url("booya.css") print, screen;
+@import "whatup.css" screen;
+@import "wicked.css";
+
+/*Error*/
+@charset "UTF-8";
+
+
+@namespace "http://www.w3.org/1999/xhtml";
+@namespace svg "http://www.w3.org/2000/svg";
+
+/*Warning: empty ruleset */
+.foo {
+}
+
+h1 {
+    font-weight: bold;
+}
+
+/*Warning: qualified heading */
+.foo h1 {
+    font-weight: bold;
+}
+
+/*Warning: adjoining classes */
+.foo.bar {
+    zoom: 1;
+}
+
+li.inline {
+    width: 100%;  /*Warning: 100% can be problematic*/
+}
+
+li.last {
+  display: inline;
+  padding-left: 3px !important;
+  padding-right: 3px;
+  border-right: 0px;
+}
+
+@media print {
+    li.inline {
+      color: black;
+    }
+}
+
+@page {
+  margin: 10%;
+  counter-increment: page;
+
+  @top-center {
+    font-family: sans-serif;
+    font-weight: bold;
+    font-size: 2em;
+    content: counter(page);
+  }
+}
+</textarea></p>
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code-js"), {
+    lineNumbers: true,
+    mode: "javascript",
+    gutters: ["CodeMirror-lint-markers"],
+    lint: {options: {esversion: 2021}},
+  });
+
+  var editor_json = CodeMirror.fromTextArea(document.getElementById("code-json"), {
+    lineNumbers: true,
+    mode: "application/json",
+    gutters: ["CodeMirror-lint-markers"],
+    lint: true
+  });
+  
+  var editor_css = CodeMirror.fromTextArea(document.getElementById("code-css"), {
+    lineNumbers: true,
+    mode: "css",
+    gutters: ["CodeMirror-lint-markers"],
+    lint: true
+  });
+</script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/loadmode.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+<!doctype html>
+
+<title>CodeMirror: Lazy Mode Loading Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/mode/loadmode.js"></script>
+<script src="../mode/meta.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Lazy Mode Loading</a>
+  </ul>
+</div>
+
+<article>
+<h2>Lazy Mode Loading Demo</h2>
+<p style="color: gray">Current mode: <span id="modeinfo">text/plain</span></p>
+<form><textarea id="code" name="code">This is the editor.
+// It starts out in plain text mode,
+#  use the control below to load and apply a mode
+  "you'll see the highlighting of" this text /*change*/.
+</textarea></form>
+<p>Filename, mime, or mode name: <input type=text value=foo.js id=mode> <button type=button onclick="change()">change mode</button></p>
+
+    <script>
+CodeMirror.modeURL = "../mode/%N/%N.js";
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true
+});
+var modeInput = document.getElementById("mode");
+CodeMirror.on(modeInput, "keypress", function(e) {
+  if (e.keyCode == 13) change();
+});
+function change() {
+  var val = modeInput.value, m, mode, spec;
+  if (m = /.+\.([^.]+)$/.exec(val)) {
+    var info = CodeMirror.findModeByExtension(m[1]);
+    if (info) {
+      mode = info.mode;
+      spec = info.mime;
+    }
+  } else if (/\//.test(val)) {
+    var info = CodeMirror.findModeByMIME(val);
+    if (info) {
+      mode = info.mode;
+      spec = val;
+    }
+  } else {
+    mode = spec = val;
+  }
+  if (mode) {
+    editor.setOption("mode", spec);
+    CodeMirror.autoLoadMode(editor, mode);
+    document.getElementById("modeinfo").textContent = spec;
+  } else {
+    alert("Could not find a mode corresponding to " + val);
+  }
+}
+</script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/marker.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+<!doctype html>
+
+<title>CodeMirror: Breakpoint Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<style>
+      .breakpoints {width: .8em;}
+      .breakpoint { color: #822; }
+      .CodeMirror {border: 1px solid #aaa;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Breakpoint</a>
+  </ul>
+</div>
+
+<article>
+<h2>Breakpoint Demo</h2>
+<form><textarea id="code" name="code">
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  gutters: ["CodeMirror-linenumbers", "breakpoints"]
+});
+editor.on("gutterClick", function(cm, n) {
+  var info = cm.lineInfo(n);
+  cm.setGutterMarker(n, "breakpoints", info.gutterMarkers ? null : makeMarker());
+});
+
+function makeMarker() {
+  var marker = document.createElement("div");
+  marker.style.color = "#822";
+  marker.innerHTML = "●";
+  return marker;
+}
+</textarea></form>
+
+<p>Click the line-number gutter to add or remove 'breakpoints'.</p>
+
+    <script>eval(document.getElementById("code").value);</script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/markselection.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+<!doctype html>
+
+<title>CodeMirror: Selection Marking Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../addon/selection/mark-selection.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .CodeMirror-selected  { background-color: blue !important; }
+      .CodeMirror-selectedtext { color: white; }
+      .styled-background { background-color: #ff7; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Selection Marking</a>
+  </ul>
+</div>
+
+<article>
+<h2>Selection Marking Demo</h2>
+<form><textarea id="code" name="code">
+Select something from here. You'll see that the selection's foreground
+color changes to white! Since, by default, CodeMirror only puts an
+independent "marker" layer behind the text, you'll need something like
+this to change its colour.
+
+Also notice that turning this addon on (with the default style) allows
+you to safely give text a background color without screwing up the
+visibility of the selection.</textarea></form>
+
+    <script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  styleSelectedText: true
+});
+editor.markText({line: 6, ch: 26}, {line: 6, ch: 42}, {className: "styled-background"});
+</script>
+
+    <p>Simple addon to easily mark (and style) selected text. <a href="../doc/manual.html#addon_mark-selection">Docs</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/matchhighlighter.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,103 @@
+<!doctype html>
+
+<title>CodeMirror: Match Highlighter Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/scroll/annotatescrollbar.js"></script>
+<script src="../addon/search/matchesonscrollbar.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../addon/search/match-highlighter.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .CodeMirror-focused .cm-matchhighlight {
+        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAIAAAACCAYAAABytg0kAAAAFklEQVQI12NgYGBgkKzc8x9CMDAwAAAmhwSbidEoSQAAAABJRU5ErkJggg==);
+        background-position: bottom;
+        background-repeat: repeat-x;
+      }
+      .cm-matchhighlight {background-color: lightgreen}
+      .CodeMirror-selection-highlight-scrollbar {background-color: green}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Match Highlighter</a>
+  </ul>
+</div>
+
+<article>
+<h2>Match Highlighter Demo</h2>
+<form><textarea id="code" name="code">Select this text: hardtospot
+  And everywhere else in your code where hardtospot appears will
+automatically illuminate.  Give it a try!  No more hard to spot
+variables - stay in context of your code all the time.
+
+Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut pharetra
+interdum dui eu pulvinar. Mauris maximus ligula venenatis tempus
+interdum. Cras hendrerit, ipsum sed ultrices pharetra, ligula diam
+porttitor lacus, ac tempor eros est a massa. Nam orci elit, vulputate
+in tristique quis, consectetur vitae metus. Pellentesque et enim
+elementum, lobortis augue in, lacinia sapien. Morbi eu nunc semper,
+sagittis felis a, pellentesque mauris. Lorem ipsum dolor sit amet,
+consectetur adipiscing elit. Aenean quis diam turpis.
+
+Fusce lobortis nisl quis aliquet euismod. Aenean vitae nulla non ipsum
+efficitur scelerisque. Curabitur auctor, lorem non rhoncus porttitor,
+augue ligula lacinia dolor, et vehicula magna lorem imperdiet velit.
+Fusce risus sem, hardtospot commodo eleifend hendrerit vitae, mollis
+quis risus. Cras tincidunt, justo vitae hendrerit venenatis, urna
+dolor placerat tortor, eu lobortis lectus dolor in ligula. Nullam non
+erat non nisl vulputate ultrices sit amet vestibulum dolor. Quisque in
+tortor porta, pellentesque odio nec, malesuada nibh.
+
+In a dui feugiat, ullamcorper urna in, accumsan magna. Donec egestas
+sem nec eros rhoncus, vel gravida purus ornare. Nulla orci mauris,
+porta nec pharetra sed, ornare et lorem. Donec luctus turpis nunc,
+eget dictum felis mollis et.  Sed sodales hardtospot nunc vitae leo
+rhoncus imperdiet. Donec elementum malesuada velit quis placerat.
+Proin accumsan lorem id nisi volutpat ullamcorper. Vivamus laoreet
+dolor ac sem malesuada, ac scelerisque ex efficitur. Aliquam tempus
+libero velit, vel tristique augue vulputate nec.
+
+Mauris ultrices leo felis, sit amet congue augue aliquam condimentum.
+Vivamus purus leo, mattis vitae dignissim vel, ultricies ac ex. Mauris
+eu dolor eu purus ultricies ultrices. Sed euismod feugiat ex et
+mattis. Morbi cursus laoreet pharetra. Donec eu dolor sodales,
+ultricies nisi et, malesuada urna.  Praesent sit amet fringilla felis.
+Nam rhoncus, est blandit auctor auctor, lorem ipsum laoreet ipsum,
+quis sodales libero odio in lorem. Phasellus odio dolor, elementum
+sagittis nibh non, fermentum semper libero. Mauris hendrerit
+hardtospot lectus sit amet commodo eleifend. Morbi pulvinar eget nisl
+at eleifend. Fusce eget porta erat, vitae lobortis libero.
+
+Phasellus sit amet massa in massa pharetra malesuada. Vestibulum at
+quam vel libero aliquam volutpat at ut dui. Praesent scelerisque vel
+mauris sit amet vehicula. Phasellus at mi nec ligula cursus interdum
+sit amet non quam. Aliquam tempus sollicitudin euismod. Nulla euismod
+mollis enim tincidunt placerat.  Proin ac scelerisque enim, quis
+sollicitudin metus. Pellentesque congue nec sapien ut rhoncus. Sed
+eget ornare diam, ut consectetur ante. Aenean eleifend mauris quis
+ornare accumsan. In hac habitasse hardtospot platea dictumst.
+
+</textarea></form>
+
+    <script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  // To highlight on scrollbars as well, pass annotateScrollbar in options
+  // as below.
+  highlightSelectionMatches: {showToken: /\w/, annotateScrollbar: true}
+});
+</script>
+
+    <p>Search and highlight occurrences of the selected text.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/matchtags.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+<!doctype html>
+
+<title>CodeMirror: Tag Matcher Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/fold/xml-fold.js"></script>
+<script src="../addon/edit/matchtags.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Tag Matcher</a>
+  </ul>
+</div>
+
+<article>
+<h2>Tag Matcher Demo</h2>
+
+
+    <div id="editor"></div>
+
+    <script>
+window.onload = function() {
+  editor = CodeMirror(document.getElementById("editor"), {
+    value: "<html>\n  " + document.documentElement.innerHTML + "\n</html>",
+    mode: "text/html",
+    matchTags: {bothTags: true},
+    extraKeys: {"Ctrl-J": "toMatchingTag"}
+  });
+};
+    </script>
+
+    <p>Put the cursor on or inside a pair of tags to highlight them.
+    Press Ctrl-J to jump to the tag that matches the one under the
+    cursor.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/merge.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,123 @@
+<!doctype html>
+
+<title>CodeMirror: merge view demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel=stylesheet href="../lib/codemirror.css">
+<link rel=stylesheet href="../addon/merge/merge.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../mode/css/css.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/htmlmixed/htmlmixed.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/diff_match_patch/20121119/diff_match_patch.js"></script>
+<script src="../addon/merge/merge.js"></script>
+<style>
+    .CodeMirror { line-height: 1.2; }
+    @media screen and (min-width: 1300px) {
+      article { max-width: 1000px; }
+      #nav { border-right: 499px solid transparent; }
+    }
+    span.clicky {
+      cursor: pointer;
+      background: #d70;
+      color: white;
+      padding: 0 3px;
+      border-radius: 3px;
+    }
+  </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">merge view</a>
+  </ul>
+</div>
+
+<article>
+<h2>merge view demo</h2>
+
+
+<div id=view></div>
+
+<p>The <a href="../doc/manual.html#addon_merge"><code>merge</code></a>
+addon provides an interface for displaying and merging diffs,
+either <span class=clicky onclick="panes = 2; initUI()">two-way</span>
+or <span class=clicky onclick="panes = 3; initUI()">three-way</span>.
+The left (or center) pane is editable, and the differences with the
+other pane(s) are <span class=clicky
+onclick="toggleDifferences()">optionally</span> shown live as you edit
+it. In the two-way configuration, there are also options to pad changed
+sections to <span class=clicky onclick="connect = connect ? null :
+'align'; initUI()">align</span> them, and to <span class=clicky
+onclick="collapse = !collapse; initUI()">collapse</span> unchanged
+stretches of text.</p>
+
+<p>This addon depends on
+the <a href="https://code.google.com/p/google-diff-match-patch/">google-diff-match-patch</a>
+library to compute the diffs.</p>
+
+<script>
+var value, orig1, orig2, dv, panes = 2, highlight = true, connect = "align", collapse = false;
+function initUI() {
+  if (value == null) return;
+  var target = document.getElementById("view");
+  target.innerHTML = "";
+  dv = CodeMirror.MergeView(target, {
+    value: value,
+    origLeft: panes == 3 ? orig1 : null,
+    orig: orig2,
+    lineNumbers: true,
+    mode: "text/html",
+    highlightDifferences: highlight,
+    connect: connect,
+    collapseIdentical: collapse
+  });
+}
+
+function toggleDifferences() {
+  dv.setShowDifferences(highlight = !highlight);
+}
+
+window.onload = function() {
+  value = document.documentElement.innerHTML;
+  orig1 = "<!doctype html>\n\n" + value.replace(/\.\.\//g, "codemirror/").replace("yellow", "orange");
+  orig2 = value.replace(/\u003cscript/g, "\u003cscript type=text/javascript ")
+    .replace("white", "purple;\n      font: comic sans;\n      text-decoration: underline;\n      height: 15em");
+  initUI();
+  let d = document.createElement("div"); d.style.cssText = "width: 50px; margin: 7px; height: 14px"; dv.editor().addLineWidget(57, d)
+};
+
+function mergeViewHeight(mergeView) {
+  function editorHeight(editor) {
+    if (!editor) return 0;
+    return editor.getScrollInfo().height;
+  }
+  return Math.max(editorHeight(mergeView.leftOriginal()),
+                  editorHeight(mergeView.editor()),
+                  editorHeight(mergeView.rightOriginal()));
+}
+
+function resize(mergeView) {
+  var height = mergeViewHeight(mergeView);
+  for(;;) {
+    if (mergeView.leftOriginal())
+      mergeView.leftOriginal().setSize(null, height);
+    mergeView.editor().setSize(null, height);
+    if (mergeView.rightOriginal())
+      mergeView.rightOriginal().setSize(null, height);
+
+    var newHeight = mergeViewHeight(mergeView);
+    if (newHeight >= height) break;
+    else height = newHeight;
+  }
+  mergeView.wrap.style.height = height + "px";
+}
+</script>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/multiplex.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,75 @@
+<!doctype html>
+
+<title>CodeMirror: Multiplexing Parser Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/mode/multiplex.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+      .CodeMirror {border: 1px solid black;}
+      .cm-delimit {color: #fa4;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Multiplexing Parser</a>
+  </ul>
+</div>
+
+<article>
+<h2>Multiplexing Parser Demo</h2>
+<form><textarea id="code" name="code">
+<html>
+  <body style="<<magic>>">
+    <h1><< this is not <html >></h1>
+    <<
+        multiline
+        not html
+        at all : &amp;amp; <link/>
+    >>
+    <p>this is html again</p>
+  </body>
+</html>
+</textarea></form>
+
+    <script>
+CodeMirror.defineMode("demo", function(config) {
+  return CodeMirror.multiplexingMode(
+    CodeMirror.getMode(config, "text/html"),
+    {open: "<<", close: ">>",
+     mode: CodeMirror.getMode(config, "text/plain"),
+     delimStyle: "delimit"}
+    // .. more multiplexed styles can follow here
+  );
+});
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  mode: "demo",
+  lineNumbers: true,
+  lineWrapping: true
+});
+</script>
+
+    <p>Demonstration of a multiplexing mode, which, at certain
+    boundary strings, switches to one or more inner modes. The out
+    (HTML) mode does not get fed the content of the <code>&lt;&lt;
+    >></code> blocks. See
+    the <a href="../doc/manual.html#addon_multiplex">manual</a> and
+    the <a href="../addon/mode/multiplex.js">source</a> for more
+    information.</p>
+
+    <p>
+      <strong>Parsing/Highlighting Tests:</strong>
+      <a href="../test/index.html#multiplexing_*">normal</a>,
+      <a href="../test/index.html#verbose,multiplexing_*">verbose</a>.
+    </p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/mustache.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,69 @@
+<!doctype html>
+
+<title>CodeMirror: Overlay Parser Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/mode/overlay.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+      .CodeMirror {border: 1px solid black;}
+      .cm-mustache {color: #0ca;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Overlay Parser</a>
+  </ul>
+</div>
+
+<article>
+<h2>Overlay Parser Demo</h2>
+<form><textarea id="code" name="code">
+<html>
+  <body>
+    <h1>{{title}}</h1>
+    <p>These are links to {{things}}:</p>
+    <ul>{{#links}}
+      <li><a href="{{url}}">{{text}}</a></li>
+    {{/links}}</ul>
+  </body>
+</html>
+</textarea></form>
+
+    <script>
+CodeMirror.defineMode("mustache", function(config, parserConfig) {
+  var mustacheOverlay = {
+    token: function(stream, state) {
+      var ch;
+      if (stream.match("{{")) {
+        while ((ch = stream.next()) != null)
+          if (ch == "}" && stream.next() == "}") {
+            stream.eat("}");
+            return "mustache";
+          }
+      }
+      while (stream.next() != null && !stream.match("{{", false)) {}
+      return null;
+    }
+  };
+  return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
+});
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "mustache"});
+</script>
+
+    <p>Demonstration of a mode that parses HTML, highlighting
+    the <a href="http://mustache.github.io/">Mustache</a> templating
+    directives inside of it by using the code
+    in <a href="../addon/mode/overlay.js"><code>overlay.js</code></a>. View
+    source to see the 15 lines of code needed to accomplish this.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/panel.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,137 @@
+<!doctype html>
+
+<title>CodeMirror: Panel Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../mode/htmlmixed/htmlmixed.js"></script>
+<script src="../addon/display/panel.js"></script>
+<style>
+  .border {
+    border: 1px solid #f7f7f7;
+  }
+  .add-panel {
+    background: orange;
+    padding: 3px 6px;
+    color: white !important; 
+    border-radius: 3px;
+  }
+  .add-panel, .remove-panel {
+    cursor: pointer;
+  }
+  .remove-panel {
+    float: right;
+  }
+  .panel {
+    background: #f7f7f7;
+    padding: 3px 7px;
+    font-size: 0.85em;
+  }
+  .panel.top, .panel.after-top {
+    border-bottom: 1px solid #ddd;
+  }
+  .panel.bottom, .panel.before-bottom {
+    border-top: 1px solid #ddd;
+  }
+</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Panel</a>
+  </ul>
+</div>
+
+<article>
+
+<h2>Panel Demo</h2>
+
+<div class="border">
+    <textarea id="code" name="code"></textarea>
+</div>
+
+<p>
+  The <a href="../doc/manual.html#addon_panel"><code>panel</code></a>
+  addon allows you to display panels above or below an editor.
+  <br>
+  Click the links below to add panels at the given position:
+</p>
+
+<div id="demo">
+<p>
+  <a class="add-panel" onclick="addPanel('top')">top</a>
+  <a class="add-panel" onclick="addPanel('after-top')">after-top</a>
+  <a class="add-panel" onclick="addPanel('before-bottom')">before-bottom</a>
+  <a class="add-panel" onclick="addPanel('bottom')">bottom</a>
+</p>
+<p>
+  You can also replace an existing panel:
+</p>
+<form onsubmit="return replacePanel(this);" name="replace_panel">
+  <input type="submit" value="Replace panel n°" />
+  <input type="number" name="panel_id" min="1" value="1" />
+</form>
+
+<script>
+var textarea = document.getElementById("code");
+var demo = document.getElementById("demo");
+var numPanels = 0;
+var panels = {};
+var editor;
+
+textarea.value = demo.innerHTML.trim();
+editor = CodeMirror.fromTextArea(textarea, {
+  lineNumbers: true,
+  mode: "htmlmixed"
+});
+
+function makePanel(where) {
+  var node = document.createElement("div");
+  var id = ++numPanels;
+  var widget, close, label;
+
+  node.id = "panel-" + id;
+  node.className = "panel " + where;
+  close = node.appendChild(document.createElement("a"));
+  close.setAttribute("title", "Remove me!");
+  close.setAttribute("class", "remove-panel");
+  close.textContent = "✖";
+  CodeMirror.on(close, "mousedown", function(e) {
+    e.preventDefault()
+    panels[node.id].clear();
+  });
+  label = node.appendChild(document.createElement("span"));
+  label.textContent = "I'm panel n°" + id;
+  return node;
+}
+function addPanel(where) {
+  var node = makePanel(where);
+  panels[node.id] = editor.addPanel(node, {position: where, stable: true});
+}
+
+addPanel("top");
+addPanel("bottom");
+
+function replacePanel(form) {
+  var id = form.elements.panel_id.value;
+  var panel = panels["panel-" + id];
+  var node = makePanel("");
+
+  panels[node.id] = editor.addPanel(node, {replace: panel, position: "after-top", stable: true});
+  return false;
+}
+</script>
+
+</div>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/placeholder.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,45 @@
+<!doctype html>
+
+<title>CodeMirror: Placeholder demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/display/placeholder.js"></script>
+<style>
+      .CodeMirror { border: 1px solid silver; }
+      .CodeMirror-empty { outline: 1px solid #c22; }
+      .CodeMirror-empty.CodeMirror-focused { outline: none; }
+      .CodeMirror pre.CodeMirror-placeholder { color: #999; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Placeholder</a>
+  </ul>
+</div>
+
+<article>
+<h2>Placeholder demo</h2>
+<form><textarea id="code" name="code" placeholder="Code goes here..."></textarea></form>
+
+    <p>The <a href="../doc/manual.html#addon_placeholder">placeholder</a>
+    plug-in adds an option <code>placeholder</code> that can be set to
+    make text appear in the editor when it is empty and not focused.
+    If the source textarea has a <code>placeholder</code> attribute,
+    it will automatically be inherited.</p>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true
+      });
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/preview.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,87 @@
+<!doctype html>
+
+<title>CodeMirror: HTML5 preview</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel=stylesheet href=../lib/codemirror.css>
+<script src=../lib/codemirror.js></script>
+<script src=../mode/xml/xml.js></script>
+<script src=../mode/javascript/javascript.js></script>
+<script src=../mode/css/css.js></script>
+<script src=../mode/htmlmixed/htmlmixed.js></script>
+<style type=text/css>
+      .CodeMirror {
+        float: left;
+        width: 50%;
+        border: 1px solid black;
+      }
+      iframe {
+        width: 49%;
+        float: left;
+        height: 300px;
+        border: 1px solid black;
+        border-left: 0px;
+      }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">HTML5 preview</a>
+  </ul>
+</div>
+
+<article>
+<h2>HTML5 preview</h2>
+
+    <textarea id=code name=code>
+<!doctype html>
+<html>
+  <head>
+    <meta charset=utf-8>
+    <title>HTML5 canvas demo</title>
+    <style>p {font-family: monospace;}</style>
+  </head>
+  <body>
+    <p>Canvas pane goes here:</p>
+    <canvas id=pane width=300 height=200></canvas>
+    <script>
+      var canvas = document.getElementById('pane');
+      var context = canvas.getContext('2d');
+
+      context.fillStyle = 'rgb(250,0,0)';
+      context.fillRect(10, 10, 55, 50);
+
+      context.fillStyle = 'rgba(0, 0, 250, 0.5)';
+      context.fillRect(30, 30, 55, 50);
+    </script>
+  </body>
+</html></textarea>
+    <iframe id=preview></iframe>
+    <script>
+      var delay;
+      // Initialize CodeMirror editor with a nice html5 canvas demo.
+      var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+        mode: 'text/html'
+      });
+      editor.on("change", function() {
+        clearTimeout(delay);
+        delay = setTimeout(updatePreview, 300);
+      });
+      
+      function updatePreview() {
+        var previewFrame = document.getElementById('preview');
+        var preview =  previewFrame.contentDocument ||  previewFrame.contentWindow.document;
+        preview.open();
+        preview.write(editor.getValue());
+        preview.close();
+      }
+      setTimeout(updatePreview, 300);
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/requirejs.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,70 @@
+<!doctype html>
+
+<head>
+  <title>CodeMirror: HTML completion demo</title>
+  <meta charset="utf-8"/>
+  <link rel=stylesheet href="../doc/docs.css">
+
+  <link rel="stylesheet" href="../lib/codemirror.css">
+  <link rel="stylesheet" href="../addon/hint/show-hint.css">
+  <script src="//cdnjs.cloudflare.com/ajax/libs/require.js/2.1.14/require.min.js"></script>
+  <style>
+    .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
+  </style>
+</head>
+
+<body>
+  <div id=nav>
+    <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+    <ul>
+      <li><a href="../index.html">Home</a>
+      <li><a href="../doc/manual.html">Manual</a>
+      <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+    </ul>
+    <ul>
+      <li><a class=active href="#">HTML completion</a>
+    </ul>
+  </div>
+
+  <article>
+    <h2>RequireJS module loading demo</h2>
+
+    <p>This demo does the same thing as
+    the <a href="html5complete.html">HTML5 completion demo</a>, but
+    loads its dependencies
+    with <a href="http://requirejs.org/">Require.js</a>, rather than
+    explicitly. Press <strong>ctrl-space</strong> to activate
+    completion.</p>
+
+    <div id="code"></div>
+
+    <button id="markdown">Dynamically load Markdown mode</button>
+
+    <script>
+      require.config({
+        packages: [{
+          name: "codemirror",
+          location: "../",
+          main: "lib/codemirror"
+        }]
+      });
+      require(["codemirror", "codemirror/mode/htmlmixed/htmlmixed",
+               "codemirror/addon/hint/show-hint", "codemirror/addon/hint/html-hint",
+               "codemirror/addon/mode/loadmode"], function(CodeMirror) {
+        editor = CodeMirror(document.getElementById("code"), {
+          mode: "text/html",
+          extraKeys: {"Ctrl-Space": "autocomplete"},
+          value: document.documentElement.innerHTML
+        });
+
+        CodeMirror.modeURL = "codemirror/mode/%N/%N";
+        document.getElementById("markdown").addEventListener("click", function() {
+          CodeMirror.requireMode("markdown", function() {
+            editor.replaceRange("This is **Markdown**.\n\n", {line: 0, ch: 0});
+            editor.setOption("mode", "markdown");
+          });
+        });
+      });
+    </script>
+  </article>
+</body>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/resize.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,51 @@
+<!doctype html>
+
+<title>CodeMirror: Autoresize Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/css/css.js"></script>
+<style>
+      .CodeMirror {
+        border: 1px solid #eee;
+        height: auto;
+      }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Autoresize</a>
+  </ul>
+</div>
+
+<article>
+<h2>Autoresize Demo</h2>
+<form><textarea id="code" name="code">
+.CodeMirror {
+  border: 1px solid #eee;
+  height: auto;
+}
+</textarea></form>
+
+<p>By setting an editor's <code>height</code> style
+to <code>auto</code> and giving
+the <a href="../doc/manual.html#option_viewportMargin"><code>viewportMargin</code></a>
+a value of <code>Infinity</code>, CodeMirror can be made to
+automatically resize to fit its content.</p>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        viewportMargin: Infinity
+      });
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/rulers.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,49 @@
+<!doctype html>
+
+<title>CodeMirror: Ruler Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/display/rulers.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid #888; border-bottom: 1px solid #888;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Ruler demo</a>
+  </ul>
+</div>
+
+<article>
+<h2>Ruler Demo</h2>
+
+<script>
+  var nums = "0123456789", space = "          ";
+  var colors = ["#fcc", "#f5f577", "#cfc", "#aff", "#ccf", "#fcf"];
+  var rulers = [], value = "";
+  for (var i = 1; i <= 6; i++) {
+    rulers.push({color: colors[i], column: i * 10, lineStyle: "dashed"});
+    for (var j = 1; j < i; j++) value += space;
+    value += nums + "\n";
+  }
+  var editor = CodeMirror(document.body.lastChild, {
+    rulers: rulers,
+    value: value + value + value,
+    lineNumbers: true
+});
+</script>
+
+<p>Demonstration of
+the <a href="../doc/manual.html#addon_rulers">rulers</a> addon, which
+displays vertical lines at given column offsets.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/runmode-standalone.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: Mode Runner Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../addon/runmode/runmode-standalone.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Mode Runner</a>
+  </ul>
+</div>
+
+<article>
+<h2>Mode Runner Demo</h2>
+
+
+    <textarea id="code" style="width: 90%; height: 7em; border: 1px solid black; padding: .2em .4em;">
+<foobar>
+  <blah>Enter your xml here and press the button below to display
+    it as highlighted by the CodeMirror XML mode</blah>
+  <tag2 foo="2" bar="&amp;quot;bar&amp;quot;"/>
+</foobar></textarea><br>
+    <button onclick="doHighlight();">Highlight!</button>
+    <pre id="output" class="cm-s-default"></pre>
+
+    <script>
+function doHighlight() {
+  CodeMirror.runMode(document.getElementById("code").value, "application/xml",
+                     document.getElementById("output"));
+}
+</script>
+
+    <p>Running a CodeMirror mode outside of the editor.
+    The <code>CodeMirror.runMode</code> function, defined
+    in <code><a href="../addon/runmode/runmode.js">addon/runmode/runmode.js</a></code> takes the following arguments:</p>
+
+    <dl>
+      <dt><code>text (string)</code></dt>
+      <dd>The document to run through the highlighter.</dd>
+      <dt><code>mode (<a href="../doc/manual.html#option_mode">mode spec</a>)</code></dt>
+      <dd>The mode to use (must be loaded as normal).</dd>
+      <dt><code>output (function or DOM node)</code></dt>
+      <dd>If this is a function, it will be called for each token with
+      two arguments, the token's text and the token's style class (may
+      be <code>null</code> for unstyled tokens). If it is a DOM node,
+      the tokens will be converted to <code>span</code> elements as in
+      an editor, and inserted into the node
+      (through <code>innerHTML</code>).</dd>
+    </dl>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/runmode.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,62 @@
+<!doctype html>
+
+<title>CodeMirror: Mode Runner Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/runmode/runmode.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Mode Runner</a>
+  </ul>
+</div>
+
+<article>
+<h2>Mode Runner Demo</h2>
+
+
+    <textarea id="code" style="width: 90%; height: 7em; border: 1px solid black; padding: .2em .4em;">
+<foobar>
+  <blah>Enter your xml here and press the button below to display
+    it as highlighted by the CodeMirror XML mode</blah>
+  <tag2 foo="2" bar="&amp;quot;bar&amp;quot;"/>
+</foobar></textarea><br>
+    <button onclick="doHighlight();">Highlight!</button>
+    <pre id="output" class="cm-s-default"></pre>
+
+    <script>
+function doHighlight() {
+  CodeMirror.runMode(document.getElementById("code").value, "application/xml",
+                     document.getElementById("output"));
+}
+</script>
+
+    <p>Running a CodeMirror mode outside of the editor.
+    The <code>CodeMirror.runMode</code> function, defined
+    in <code><a href="../addon/runmode/runmode.js">addon/runmode/runmode.js</a></code> takes the following arguments:</p>
+
+    <dl>
+      <dt><code>text (string)</code></dt>
+      <dd>The document to run through the highlighter.</dd>
+      <dt><code>mode (<a href="../doc/manual.html#option_mode">mode spec</a>)</code></dt>
+      <dd>The mode to use (must be loaded as normal).</dd>
+      <dt><code>output (function or DOM node)</code></dt>
+      <dd>If this is a function, it will be called for each token with
+      two arguments, the token's text and the token's style class (may
+      be <code>null</code> for unstyled tokens). If it is a DOM node,
+      the tokens will be converted to <code>span</code> elements as in
+      an editor, and inserted into the node
+      (through <code>innerHTML</code>).</dd>
+    </dl>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/search.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,99 @@
+<!doctype html>
+
+<title>CodeMirror: Search/Replace Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/dialog/dialog.css">
+<link rel="stylesheet" href="../addon/search/matchesonscrollbar.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../addon/dialog/dialog.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../addon/search/search.js"></script>
+<script src="../addon/scroll/annotatescrollbar.js"></script>
+<script src="../addon/search/matchesonscrollbar.js"></script>
+<script src="../addon/search/jump-to-line.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      dt {font-family: monospace; color: #666;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Search/Replace</a>
+  </ul>
+</div>
+
+<article>
+<h2>Search/Replace Demo</h2>
+<form><textarea id="code" name="code">
+<dl>
+  <dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
+  <dd>Whether, when indenting, the first N*<code>tabSize</code>
+  spaces should be replaced by N tabs. Default is false.</dd>
+
+  <dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
+  <dd>Configures whether the editor should re-indent the current
+  line when a character is typed that might change its proper
+  indentation (only works if the mode supports indentation).
+  Default is true.</dd>
+
+  <dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
+  <dd>A regular expression used to determine which characters
+  should be replaced by a
+  special <a href="#option_specialCharPlaceholder">placeholder</a>.
+  Mostly useful for non-printing special characters. The default
+  is <code>/[\u0000-\u0019\u00ad\u200b\u2028\u2029\ufeff]/</code>.</dd>
+  <dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
+  <dd>A function that, given a special character identified by
+  the <a href="#option_specialChars"><code>specialChars</code></a>
+  option, produces a DOM node that is used to represent the
+  character. By default, a red dot (<span style="color: red">•</span>)
+  is shown, with a title tooltip to indicate the character code.</dd>
+
+  <dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
+  <dd>Determines whether horizontal cursor movement through
+  right-to-left (Arabic, Hebrew) text is visual (pressing the left
+  arrow moves the cursor left) or logical (pressing the left arrow
+  moves to the next lower index in the string, which is visually
+  right in right-to-left text). The default is <code>false</code>
+  on Windows, and <code>true</code> on other platforms.</dd>
+</dl>
+</textarea></form>
+
+    <script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  mode: "text/html",
+  lineNumbers: true,
+  extraKeys: {"Alt-F": "findPersistent"}
+});
+</script>
+
+    <p>Demonstration of primitive search/replace functionality. The
+    keybindings (which can be configured with custom keymaps) are:</p>
+    <dl>
+      <dt>Ctrl-F / Cmd-F</dt><dd>Start searching</dd>
+      <dt>Ctrl-G / Cmd-G</dt><dd>Find next</dd>
+      <dt>Shift-Ctrl-G / Shift-Cmd-G</dt><dd>Find previous</dd>
+      <dt>Shift-Ctrl-F / Cmd-Option-F</dt><dd>Replace</dd>
+      <dt>Shift-Ctrl-R / Shift-Cmd-Option-F</dt><dd>Replace all</dd>
+      <dt>Alt-F</dt><dd>Persistent search (dialog doesn't autoclose,
+      enter to find next, Shift-Enter to find previous)</dd>
+      <dt>Alt-G</dt><dd>Jump to line</dd>
+    </dl>
+    <p>Searching is enabled by
+    including <a href="../addon/search/search.js">addon/search/search.js</a>
+    and <a href="../addon/search/searchcursor.js">addon/search/searchcursor.js</a>.
+    Jump to line - including <a href="../addon/search/jump-to-line.js">addon/search/jump-to-line.js</a>.</p>
+    <p>For good-looking input dialogs, you also want to include
+    <a href="../addon/dialog/dialog.js">addon/dialog/dialog.js</a>
+    and <a href="../addon/dialog/dialog.css">addon/dialog/dialog.css</a>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/simplemode.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,186 @@
+<!doctype html>
+
+<title>CodeMirror: Simple Mode Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/mode/simple.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+  .CodeMirror {border: 1px solid silver; margin-bottom: 1em; }
+  dt { text-indent: -2em; padding-left: 2em; margin-top: 1em; }
+  dd { margin-left: 1.5em; margin-bottom: 1em; }
+  dt {margin-top: 1em;}
+</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Simple Mode</a>
+  </ul>
+</div>
+
+<article>
+<h2>Simple Mode Demo</h2>
+
+<p>The <a href="../addon/mode/simple.js"><code>mode/simple</code></a>
+addon allows CodeMirror modes to be specified using a relatively simple
+declarative format. This format is not as powerful as writing code
+directly against the <a href="../doc/manual.html#modeapi">mode
+interface</a>, but is a lot easier to get started with, and
+sufficiently expressive for many simple language modes.</p>
+
+<p>This interface is still in flux. It is unlikely to be scrapped or
+overhauled completely, so do start writing code against it, but
+details might change as it stabilizes, and you might have to tweak
+your code when upgrading.</p>
+
+<p>Simple modes (loosely based on
+the <a href="https://github.com/mozilla/skywriter/wiki/Common-JavaScript-Syntax-Highlighting-Specification">Common
+JavaScript Syntax Highlighting Specification</a>, which never took
+off), are state machines, where each state has a number of rules that
+match tokens. A rule describes a type of token that may occur in the
+current state, and possibly a transition to another state caused by
+that token.</p>
+
+<p>The <code>CodeMirror.defineSimpleMode(name, states)</code> method
+takes a mode name and an object that describes the mode's states. The
+editor below shows an example of such a mode (and is itself
+highlighted by the mode shown in it).</p>
+
+<div id="code"></div>
+
+<p>Each state is an array of rules. A rule may have the following properties:</p>
+
+<dl>
+  <dt><code><strong>regex</strong>: string | RegExp</code></dt>
+  <dd>The regular expression that matches the token. May be a string
+  or a regex object. When a regex, the <code>ignoreCase</code> flag
+  will be taken into account when matching the token. This regex
+  has to capture groups when the <code>token</code> property is
+  an array. If it captures groups, it must capture <em>all</em> of the string
+  (since JS provides no way to find out where a group matched).
+  Currently negative lookbehind assertion for regex is not supported, regardless of browser support.</dd>
+  <dt><code><strong>token</strong></code>: string | array&lt;string&gt; | null</dt>
+  <dd>An optional token style. Multiple styles can be specified by
+  separating them with dots or spaces. When this property holds an array of token styles,
+  the <code>regex</code> for this rule must capture a group for each array item.
+  </dd>
+  <dt><code><strong>sol</strong></code>: boolean</dt>
+  <dd>When true, this token will only match at the start of the line.
+  (The <code>^</code> regexp marker doesn't work as you'd expect in
+  this context because of limitations in JavaScript's RegExp
+  API.)</dd>
+  <dt><code><strong>next</strong>: string</code></dt>
+  <dd>When a <code>next</code> property is present, the mode will
+  transfer to the state named by the property when the token is
+  encountered.</dd>
+  <dt><code><strong>push</strong>: string</code></dt>
+  <dd>Like <code>next</code>, but instead replacing the current state
+  by the new state, the current state is kept on a stack, and can be
+  returned to with the <code>pop</code> directive.</dd>
+  <dt><code><strong>pop</strong>: bool</code></dt>
+  <dd>When true, and there is another state on the state stack, will
+  cause the mode to pop that state off the stack and transition to
+  it.</dd>
+  <dt><code><strong>mode</strong>: {spec, end, persistent}</code></dt>
+  <dd>Can be used to embed another mode inside a mode. When present,
+  must hold an object with a <code>spec</code> property that describes
+  the embedded mode, and an optional <code>end</code> end property
+  that specifies the regexp that will end the extent of the mode. When
+  a <code>persistent</code> property is set (and true), the nested
+  mode's state will be preserved between occurrences of the mode.</dd>
+  <dt><code><strong>indent</strong>: bool</code></dt>
+  <dd>When true, this token changes the indentation to be one unit
+  more than the current line's indentation.</dd>
+  <dt><code><strong>dedent</strong>: bool</code></dt>
+  <dd>When true, this token will pop one scope off the indentation
+  stack.</dd>
+  <dt><code><strong>dedentIfLineStart</strong>: bool</code></dt>
+  <dd>If a token has its <code>dedent</code> property set, it will, by
+  default, cause lines where it appears at the start to be dedented.
+  Set this property to false to prevent that behavior.</dd>
+</dl>
+
+<p>The <code>meta</code> property of the states object is special, and
+will not be interpreted as a state. Instead, properties set on it will
+be set on the mode, which is useful for properties
+like <a href="../doc/manual.html#addon_comment"><code>lineComment</code></a>,
+which sets the comment style for a mode. The simple mode addon also
+recognizes a few such properties:</p>
+
+<dl>
+  <dt><code><strong>dontIndentStates</strong>: array&lt;string&gt;</code></dt>
+  <dd>An array of states in which the mode's auto-indentation should
+  not take effect. Usually used for multi-line comment and string
+  states.</dd>
+</dl>
+
+<script id="modecode">/* Example definition of a simple mode that understands a subset of
+ * JavaScript:
+ */
+
+CodeMirror.defineSimpleMode("simplemode", {
+  // The start state contains the rules that are initially used
+  start: [
+    // The regex matches the token, the token property contains the type
+    {regex: /"(?:[^\\]|\\.)*?(?:"|$)/, token: "string"},
+    // You can match multiple tokens at once. Note that the captured
+    // groups must span the whole string in this case
+    {regex: /(function)(\s+)([a-z$][\w$]*)/,
+     token: ["keyword", null, "variable-2"]},
+    // Rules are matched in the order in which they appear, so there is
+    // no ambiguity between this one and the one above
+    {regex: /(?:function|var|return|if|for|while|else|do|this)\b/,
+     token: "keyword"},
+    {regex: /true|false|null|undefined/, token: "atom"},
+    {regex: /0x[a-f\d]+|[-+]?(?:\.\d+|\d+\.?\d*)(?:e[-+]?\d+)?/i,
+     token: "number"},
+    {regex: /\/\/.*/, token: "comment"},
+    {regex: /\/(?:[^\\]|\\.)*?\//, token: "variable-3"},
+    // A next property will cause the mode to move to a different state
+    {regex: /\/\*/, token: "comment", next: "comment"},
+    {regex: /[-+\/*=<>!]+/, token: "operator"},
+    // indent and dedent properties guide autoindentation
+    {regex: /[\{\[\(]/, indent: true},
+    {regex: /[\}\]\)]/, dedent: true},
+    {regex: /[a-z$][\w$]*/, token: "variable"},
+    // You can embed other modes with the mode property. This rule
+    // causes all code between << and >> to be highlighted with the XML
+    // mode.
+    {regex: /<</, token: "meta", mode: {spec: "xml", end: />>/}}
+  ],
+  // The multi-line comment state.
+  comment: [
+    {regex: /.*?\*\//, token: "comment", next: "start"},
+    {regex: /.*/, token: "comment"}
+  ],
+  // The meta property contains global information about the mode. It
+  // can contain properties like lineComment, which are supported by
+  // all modes, and also directives like dontIndentStates, which are
+  // specific to simple modes.
+  meta: {
+    dontIndentStates: ["comment"],
+    lineComment: "//"
+  }
+});
+</script>
+
+<script>
+var sc = document.getElementById("modecode");
+var code = document.getElementById("code");
+var editor = CodeMirror(code, {
+  value: (sc.textContent || sc.innerText || sc.innerHTML),
+  mode: "simplemode"
+});
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/simplescrollbars.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,82 @@
+<!doctype html>
+
+<title>CodeMirror: Simple Scrollbar Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/scroll/simplescrollbars.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/markdown/markdown.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../addon/scroll/simplescrollbars.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Simple Scrollbar</a>
+  </ul>
+</div>
+
+<article>
+<h2>Simple Scrollbar Demo</h2>
+<form><textarea id="code" name="code"># Custom Scrollbars
+
+This is a piece of text that creates scrollbars
+
+Lorem ipsum dolor sit amet, turpis nec facilisis neque vestibulum adipiscing, magna nunc est luctus orci a,
+aliquam duis ad volutpat nostra. Vestibulum ultricies suspendisse commodo volutpat pede sed. Bibendum odio
+dignissim, ad vitae mollis ac sed nibh quis, suspendisse diam, risus quas blandit phasellus luctus nec,
+integer nunc vitae posuere scelerisque. Lobortis quam porta conubia nulla. Et nisl ac, imperdiet vitae ac.
+Parturient sit. Et vestibulum euismod, rutrum nunc libero mauris purus convallis. Cum id adipiscing et eget
+pretium rutrum, ultrices sapien magnis fringilla sit lorem, eu vitae scelerisque ipsum aliquet, magna sed
+fusce vel.
+
+Lectus ultricies libero dolor convallis, sed etiam vel hendrerit egestas viverra, at urna mauris, eget
+vulputate dolor voluptatem, nulla eget sollicitudin. Sed tincidunt, elit sociis. Mattis mi tortor dui id
+sodales mi, maecenas nam fringilla risus turpis mauris praesent, imperdiet maecenas ultrices nonummy tellus
+quis est. Scelerisque nec pharetra quis varius fringilla. Varius vestibulum non dictum pharetra, tincidunt in
+vestibulum iaculis molestie, id condimentum blandit elit urna magna pulvinar, quam suspendisse pellentesque
+donec. Vel amet ad ac. Nec aut viverra, morbi mi neque massa, turpis enim proin. Tellus eu, fermentum velit
+est convallis aliquam velit, rutrum in diam lacus, praesent tempor pellentesque dictum semper augue. Felis
+explicabo massa amet lectus phasellus dolor. Ut lorem quis arcu neque felis ultricies, senectus vitae
+curabitur sed pellentesque et, id sed risus in sed ac accumsan, blandit arcu quam duis nunc.
+
+Sed leo sollicitudin odio vitae, purus sit egestas, justo eros inceptos auctor fermentum lectus. Ligula luctus
+turpis, quod massa vitae elementum orci, nullam fringilla elit tortor. Justo ante tempor amet quam posuere
+volutpat. Facilisis pede erat ut hac ultrices ipsum, wisi duis sit metus. Dolor vitae est sed sed vitae. Sed
+eu ligula, morbi vestibulum nunc nibh velit ut taciti, ligula elit semper sagittis in, auctor arcu vel eget.
+Mauris at vitae nec suspendisse et, aenean proin blandit suscipit. Morbi quam, dolor ultricies. Viverra
+tempus. Suspendisse sit dapibus, ac fuga aenean, magna nisl nonummy augue posuere, dictum ut fuga velit
+parturient augue interdum, mattis sit tellus.
+
+Vehicula commodo tempus curabitur eros, lacinia erat vulputate lorem vel fermentum donec, lectus sed conubia
+id pellentesque. Vel senectus donec pede aliquet dolor sit, nec vivamus justo placerat interdum maecenas,
+sodales euismod. Quis netus sapien amet, vestibulum quam nec amet lacinia, quis aliquet, tempor vivamus tellus
+enim, suscipit quis eleifend. Amet class phasellus orci pretium, risus in nulla. Neque sit ullamcorper,
+ultricies platea id nec suspendisse ac. Et elementum. Dictum nam, ut dui fermentum egestas facilisis elit
+augue, adipiscing donec ipsum erat nam pellentesque convallis, vestibulum vestibulum risus id nulla ut mauris,
+curabitur aute aptent. Ultrices orci wisi dui ipsum praesent, pharetra felis eu quis. Est fringilla etiam,
+maxime sem dapibus et eget, mi enim dignissim nec pretium, augue vehicula, volutpat proin. Et occaecati
+lobortis viverra, cum in sed, vivamus tellus. Libero at malesuada est vivamus leo tortor.
+</textarea></form>
+
+<p>The <a href="../doc/manual.html#addon_simplescrollbars"><code>simplescrollbars</code></a> addon defines two
+styles of non-native scrollbars: <a href="javascript:editor.setOption('scrollbarStyle', 'simple')"><code>"simple"</code></a> and <a href="javascript:editor.setOption('scrollbarStyle', 'overlay')"><code>"overlay"</code></a> (click to try), which can be passed to
+the <a href="../doc/manual.html#option_scrollbarStyle"><code>scrollbarStyle</code></a> option. These implement
+the scrollbar using DOM elements, allowing more control over
+its <a href="../addon/scroll/simplescrollbars.css">appearance</a>.</p>
+
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      lineNumbers: true,
+      scrollbarStyle: "simple"
+    });
+  </script>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/spanaffectswrapping_shim.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: Automatically derive odd wrapping behavior for your browser</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Automatically derive odd wrapping behavior for your browser</a>
+  </ul>
+</div>
+
+<article>
+<h2>Automatically derive odd wrapping behavior for your browser</h2>
+
+
+    <p>This is a hack to automatically derive
+    a <code>spanAffectsWrapping</code> regexp for a browser. See the
+    comments above that variable
+    in <a href="../lib/codemirror.js"><code>lib/codemirror.js</code></a>
+    for some more details.</p>
+
+    <div style="white-space: pre-wrap; width: 50px;" id="area"></div>
+    <pre id="output"></pre>
+
+    <script id="script">
+      var a = document.getElementById("area"), bad = Object.create(null);
+      var chars = "a~`!@#$%^&*()-_=+}{[]\\|'\"/?.>,<:;", l = chars.length;
+      for (var x = 0; x < l; ++x) for (var y = 0; y < l; ++y) {
+        var s1 = "foooo" + chars.charAt(x), s2 = chars.charAt(y) + "br";
+        a.appendChild(document.createTextNode(s1 + s2));
+        var h1 = a.offsetHeight;
+        a.innerHTML = "";
+        a.appendChild(document.createElement("span")).appendChild(document.createTextNode(s1));
+        a.appendChild(document.createElement("span")).appendChild(document.createTextNode(s2));
+        if (a.offsetHeight != h1)
+          bad[chars.charAt(x)] = (bad[chars.charAt(x)] || "") + chars.charAt(y);
+        a.innerHTML = "";
+      }
+
+      var re = "";
+      function toREElt(str) {
+        if (str.length > 1) {
+          var invert = false;
+          if (str.length > chars.length * .6) {
+            invert = true;
+            var newStr = "";
+            for (var i = 0; i < l; ++i) if (str.indexOf(chars.charAt(i)) == -1) newStr += chars.charAt(i);
+            str = newStr;
+          }
+          str = str.replace(/[\-\.\]\"\'\\\/\^a]/g, function(orig) { return orig == "a" ? "\\w" : "\\" + orig; });
+          return "[" + (invert ? "^" : "") + str + "]";
+        } else if (str == "a") {
+          return "\\w";
+        } else if (/[?$*()+{}[\]\.|/\'\"]/.test(str)) {
+          return "\\" + str;
+        } else {
+          return str;
+        }
+      }
+
+      var newRE = "";
+      for (;;) {
+        var left = null;
+        for (var left in bad) break;
+        if (left == null) break;
+        var right = bad[left];
+        delete bad[left];
+        for (var other in bad) if (bad[other] == right) {
+          left += other;
+          delete bad[other];
+        }
+        newRE += (newRE ? "|" : "") + toREElt(left) + toREElt(right);
+      }
+
+      document.getElementById("output").appendChild(document.createTextNode("Your regexp is: " + (newRE || "^$")));
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/sublime.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,77 @@
+<!doctype html>
+
+<title>CodeMirror: Sublime Text bindings demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/fold/foldgutter.css">
+<link rel="stylesheet" href="../addon/dialog/dialog.css">
+<link rel="stylesheet" href="../theme/monokai.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../addon/search/search.js"></script>
+<script src="../addon/dialog/dialog.js"></script>
+<script src="../addon/edit/matchbrackets.js"></script>
+<script src="../addon/edit/closebrackets.js"></script>
+<script src="../addon/comment/comment.js"></script>
+<script src="../addon/wrap/hardwrap.js"></script>
+<script src="../addon/fold/foldcode.js"></script>
+<script src="../addon/fold/brace-fold.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../keymap/sublime.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee; line-height: 1.3; height: 500px}
+  .CodeMirror-linenumbers { padding: 0 8px; }
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Sublime bindings</a>
+  </ul>
+</div>
+
+<article>
+<h2>Sublime Text bindings demo</h2>
+
+<p>The <code>sublime</code> keymap defines many Sublime Text-specific
+bindings for CodeMirror. See the code below for an overview.</p>
+
+<p>Enable the keymap by
+loading <a href="../keymap/sublime.js"><code>keymap/sublime.js</code></a>
+and setting
+the <a href="../doc/manual.html#option_keyMap"><code>keyMap</code></a>
+option to <code>"sublime"</code>.</p>
+
+<p>(A lot of the search functionality is still missing.)
+
+<script>
+  var value = "// The bindings defined specifically in the Sublime Text mode\nvar bindings = {\n";
+  var map = CodeMirror.keyMap.sublime;
+  for (var key in map) {
+    var val = map[key];
+    if (key != "fallthrough" && val != "..." && (!/find/.test(val) || /findUnder/.test(val)))
+      value += "  \"" + key + "\": \"" + val + "\",\n";
+  }
+  value += "}\n\n// The implementation of joinLines\n";
+  value += CodeMirror.commands.joinLines.toString().replace(/^function\s*\(/, "function joinLines(").replace(/\n  /g, "\n") + "\n";
+  var editor = CodeMirror(document.body.getElementsByTagName("article")[0], {
+    value: value,
+    lineNumbers: true,
+    mode: "javascript",
+    keyMap: "sublime",
+    autoCloseBrackets: true,
+    matchBrackets: true,
+    showCursorWhenSelecting: true,
+    theme: "monokai",
+    tabSize: 2
+  });
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/tern.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,133 @@
+<!doctype html>
+
+<title>CodeMirror: Tern Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/dialog/dialog.css">
+<link rel="stylesheet" href="../addon/hint/show-hint.css">
+<link rel="stylesheet" href="../addon/tern/tern.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../addon/dialog/dialog.js"></script>
+<script src="../addon/hint/show-hint.js"></script>
+<script src="../addon/tern/tern.js"></script>
+<script src="https://unpkg.com/acorn/dist/acorn.js"></script>
+<script src="https://unpkg.com/acorn-loose/dist/acorn-loose.js"></script>
+<script src="https://unpkg.com/acorn-walk/dist/walk.js"></script>
+<script src="//ternjs.net/doc/demo/polyfill.js"></script>
+<script src="https://unpkg.com/tern/lib/signal.js"></script>
+<script src="https://unpkg.com/tern/lib/tern.js"></script>
+<script src="https://unpkg.com/tern/lib/def.js"></script>
+<script src="https://unpkg.com/tern/lib/comment.js"></script>
+<script src="https://unpkg.com/tern/lib/infer.js"></script>
+<script src="https://unpkg.com/tern/plugin/doc_comment.js"></script>
+<style>
+      .CodeMirror {border: 1px solid #ddd;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Tern</a>
+  </ul>
+</div>
+
+<article>
+<h2>Tern Demo</h2>
+<form><textarea id="code" name="code">// Use ctrl-space to complete something
+// Put the cursor in or after an expression, press ctrl-o to
+// find its type
+
+var foo = ["array", "of", "strings"];
+var bar = foo.slice(0, 2).join("").split("a")[0];
+
+// Works for locally defined types too.
+
+function CTor() { this.size = 10; }
+CTor.prototype.hallo = "hallo";
+
+var baz = new CTor;
+baz.
+
+// You can press ctrl-q when the cursor is on a variable name to
+// rename it. Try it with CTor...
+
+// When the cursor is in an argument list, the arguments are
+// shown below the editor.
+
+[1].reduce(  );
+
+// And a little more advanced code...
+
+(function(exports) {
+  exports.randomElt = function(arr) {
+    return arr[Math.floor(arr.length * Math.random())];
+  };
+  exports.strList = "foo".split("");
+  exports.intList = exports.strList.map(function(s) { return s.charCodeAt(0); });
+})(window.myMod = {});
+
+var randomStr = myMod.randomElt(myMod.strList);
+var randomInt = myMod.randomElt(myMod.intList);
+</textarea></form>
+
+<p>Demonstrates integration of <a href="http://ternjs.net/">Tern</a>
+and CodeMirror. The following keys are bound:</p>
+
+<dl>
+  <dt>Ctrl-Space</dt><dd>Autocomplete</dd>
+  <dt>Ctrl-O</dt><dd>Find docs for the expression at the cursor</dd>
+  <dt>Ctrl-I</dt><dd>Find type at cursor</dd>
+  <dt>Alt-.</dt><dd>Jump to definition (Alt-, to jump back)</dd>
+  <dt>Ctrl-Q</dt><dd>Rename variable</dd>
+  <dt>Ctrl-.</dt><dd>Select all occurrences of a variable</dd>
+</dl>
+
+<p>Documentation is sparse for now. See the top of
+the <a href="../addon/tern/tern.js">script</a> for a rough API
+overview.</p>
+
+<script>
+  function getURL(url, c) {
+    var xhr = new XMLHttpRequest();
+    xhr.open("get", url, true);
+    xhr.send();
+    xhr.onreadystatechange = function() {
+      if (xhr.readyState != 4) return;
+      if (xhr.status < 400) return c(null, xhr.responseText);
+      var e = new Error(xhr.responseText || "No response");
+      e.status = xhr.status;
+      c(e);
+    };
+  }
+
+  var server;
+  getURL("https://unpkg.com/tern/defs/ecmascript.json", function(err, code) {
+    if (err) throw new Error("Request for ecmascript.json: " + err);
+    server = new CodeMirror.TernServer({defs: [JSON.parse(code)]});
+    editor.setOption("extraKeys", {
+      "Ctrl-Space": function(cm) { server.complete(cm); },
+      "Ctrl-I": function(cm) { server.showType(cm); },
+      "Ctrl-O": function(cm) { server.showDocs(cm); },
+      "Alt-.": function(cm) { server.jumpToDef(cm); },
+      "Alt-,": function(cm) { server.jumpBack(cm); },
+      "Ctrl-Q": function(cm) { server.rename(cm); },
+      "Ctrl-.": function(cm) { server.selectName(cm); }
+    })
+    editor.on("cursorActivity", function(cm) { server.updateArgHints(cm); });
+  });
+
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    mode: "javascript"
+  });
+</script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/theme.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,200 @@
+<!doctype html>
+
+<title>CodeMirror: Theme Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../theme/3024-day.css">
+<link rel="stylesheet" href="../theme/3024-night.css">
+<link rel="stylesheet" href="../theme/abbott.css">
+<link rel="stylesheet" href="../theme/abcdef.css">
+<link rel="stylesheet" href="../theme/ambiance.css">
+<link rel="stylesheet" href="../theme/ayu-dark.css">
+<link rel="stylesheet" href="../theme/ayu-mirage.css">
+<link rel="stylesheet" href="../theme/base16-dark.css">
+<link rel="stylesheet" href="../theme/bespin.css">
+<link rel="stylesheet" href="../theme/base16-light.css">
+<link rel="stylesheet" href="../theme/blackboard.css">
+<link rel="stylesheet" href="../theme/cobalt.css">
+<link rel="stylesheet" href="../theme/colorforth.css">
+<link rel="stylesheet" href="../theme/dracula.css">
+<link rel="stylesheet" href="../theme/duotone-dark.css">
+<link rel="stylesheet" href="../theme/duotone-light.css">
+<link rel="stylesheet" href="../theme/eclipse.css">
+<link rel="stylesheet" href="../theme/elegant.css">
+<link rel="stylesheet" href="../theme/erlang-dark.css">
+<link rel="stylesheet" href="../theme/gruvbox-dark.css">
+<link rel="stylesheet" href="../theme/hopscotch.css">
+<link rel="stylesheet" href="../theme/icecoder.css">
+<link rel="stylesheet" href="../theme/isotope.css">
+<link rel="stylesheet" href="../theme/juejin.css">
+<link rel="stylesheet" href="../theme/lesser-dark.css">
+<link rel="stylesheet" href="../theme/liquibyte.css">
+<link rel="stylesheet" href="../theme/lucario.css">
+<link rel="stylesheet" href="../theme/material.css">
+<link rel="stylesheet" href="../theme/material-darker.css">
+<link rel="stylesheet" href="../theme/material-palenight.css">
+<link rel="stylesheet" href="../theme/material-ocean.css">
+<link rel="stylesheet" href="../theme/mbo.css">
+<link rel="stylesheet" href="../theme/mdn-like.css">
+<link rel="stylesheet" href="../theme/midnight.css">
+<link rel="stylesheet" href="../theme/monokai.css">
+<link rel="stylesheet" href="../theme/moxer.css">
+<link rel="stylesheet" href="../theme/neat.css">
+<link rel="stylesheet" href="../theme/neo.css">
+<link rel="stylesheet" href="../theme/night.css">
+<link rel="stylesheet" href="../theme/nord.css">
+<link rel="stylesheet" href="../theme/oceanic-next.css">
+<link rel="stylesheet" href="../theme/panda-syntax.css">
+<link rel="stylesheet" href="../theme/paraiso-dark.css">
+<link rel="stylesheet" href="../theme/paraiso-light.css">
+<link rel="stylesheet" href="../theme/pastel-on-dark.css">
+<link rel="stylesheet" href="../theme/railscasts.css">
+<link rel="stylesheet" href="../theme/rubyblue.css">
+<link rel="stylesheet" href="../theme/seti.css">
+<link rel="stylesheet" href="../theme/shadowfox.css">
+<link rel="stylesheet" href="../theme/solarized.css">
+<link rel="stylesheet" href="../theme/the-matrix.css">
+<link rel="stylesheet" href="../theme/tomorrow-night-bright.css">
+<link rel="stylesheet" href="../theme/tomorrow-night-eighties.css">
+<link rel="stylesheet" href="../theme/ttcn.css">
+<link rel="stylesheet" href="../theme/twilight.css">
+<link rel="stylesheet" href="../theme/vibrant-ink.css">
+<link rel="stylesheet" href="../theme/xq-dark.css">
+<link rel="stylesheet" href="../theme/xq-light.css">
+<link rel="stylesheet" href="../theme/yeti.css">
+<link rel="stylesheet" href="../theme/idea.css">
+<link rel="stylesheet" href="../theme/darcula.css">
+<link rel="stylesheet" href="../theme/yonce.css">
+<link rel="stylesheet" href="../theme/zenburn.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../addon/selection/active-line.js"></script>
+<script src="../addon/edit/matchbrackets.js"></script>
+<style>
+      .CodeMirror {border: 1px solid black; font-size:13px}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Theme</a>
+  </ul>
+</div>
+
+<article>
+<h2>Theme Demo</h2>
+<form><textarea id="code" name="code">
+function findSequence(goal) {
+  function find(start, history) {
+    if (start == goal)
+      return history;
+    else if (start > goal)
+      return null;
+    else
+      return find(start + 5, "(" + history + " + 5)") ||
+             find(start * 3, "(" + history + " * 3)");
+  }
+  return find(1, "1");
+}</textarea></form>
+
+<p>Select a theme: <select onchange="selectTheme()" id=select>
+    <option selected>default</option>
+    <option>3024-day</option>
+    <option>3024-night</option>
+    <option>abbott</option>
+    <option>abcdef</option>
+    <option>ambiance</option>
+    <option>ayu-dark</option>
+    <option>ayu-mirage</option>
+    <option>base16-dark</option>
+    <option>base16-light</option>
+    <option>bespin</option>
+    <option>blackboard</option>
+    <option>cobalt</option>
+    <option>colorforth</option>
+    <option>darcula</option>
+    <option>dracula</option>
+    <option>duotone-dark</option>
+    <option>duotone-light</option>
+    <option>eclipse</option>
+    <option>elegant</option>
+    <option>erlang-dark</option>
+    <option>gruvbox-dark</option>
+    <option>hopscotch</option>
+    <option>icecoder</option>
+    <option>idea</option>
+    <option>isotope</option>
+    <option>juejin</option>
+    <option>lesser-dark</option>
+    <option>liquibyte</option>
+    <option>lucario</option>
+    <option>material</option>
+    <option>material-darker</option>
+    <option>material-palenight</option>
+    <option>material-ocean</option>
+    <option>mbo</option>
+    <option>mdn-like</option>
+    <option>midnight</option>
+    <option>monokai</option>
+    <option>moxer</option>
+    <option>neat</option>
+    <option>neo</option>
+    <option>night</option>
+    <option>nord</option>
+    <option>oceanic-next</option>
+    <option>panda-syntax</option>
+    <option>paraiso-dark</option>
+    <option>paraiso-light</option>
+    <option>pastel-on-dark</option>
+    <option>railscasts</option>
+    <option>rubyblue</option>
+    <option>seti</option>
+    <option>shadowfox</option>
+    <option>solarized dark</option>
+    <option>solarized light</option>
+    <option>the-matrix</option>
+    <option>tomorrow-night-bright</option>
+    <option>tomorrow-night-eighties</option>
+    <option>ttcn</option>
+    <option>twilight</option>
+    <option>vibrant-ink</option>
+    <option>xq-dark</option>
+    <option>xq-light</option>
+    <option>yeti</option>
+    <option>yonce</option>
+    <option>zenburn</option>
+</select>
+</p>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    styleActiveLine: true,
+    matchBrackets: true
+  });
+  var input = document.getElementById("select");
+  function selectTheme() {
+    var theme = input.options[input.selectedIndex].textContent;
+    editor.setOption("theme", theme);
+    location.hash = "#" + theme;
+  }
+  var choice = (location.hash && location.hash.slice(1)) ||
+               (document.location.search &&
+                decodeURIComponent(document.location.search.slice(1)));
+  if (choice) {
+    input.value = choice;
+    editor.setOption("theme", choice);
+  }
+  CodeMirror.on(window, "hashchange", function() {
+    var theme = location.hash.slice(1);
+    if (theme) { input.value = theme; selectTheme(); }
+  });
+</script>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/trailingspace.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+<!doctype html>
+
+<title>CodeMirror: Trailing Whitespace Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/edit/trailingspace.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .cm-trailingspace {
+        background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAACCAYAAAB/qH1jAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3QUXCToH00Y1UgAAACFJREFUCNdjPMDBUc/AwNDAAAFMTAwMDA0OP34wQgX/AQBYgwYEx4f9lQAAAABJRU5ErkJggg==);
+        background-position: bottom left;
+        background-repeat: repeat-x;
+      }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Trailing Whitespace</a>
+  </ul>
+</div>
+
+<article>
+<h2>Trailing Whitespace Demo</h2>
+<form><textarea id="code" name="code">This text  
+ has some	 
+trailing whitespace!</textarea></form>
+
+    <script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  showTrailingSpace: true
+});
+</script>
+
+<p>Uses
+the <a href="../doc/manual.html#addon_trailingspace">trailingspace</a>
+addon to highlight trailing whitespace.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/variableheight.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,67 @@
+<!doctype html>
+
+<title>CodeMirror: Variable Height Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/markdown/markdown.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+      .CodeMirror {border: 1px solid silver; border-width: 1px 2px; }
+      .cm-header { font-family: arial; }
+      .cm-header-1 { font-size: 150%; }
+      .cm-header-2 { font-size: 130%; }
+      .cm-header-3 { font-size: 120%; }
+      .cm-header-4 { font-size: 110%; }
+      .cm-header-5 { font-size: 100%; }
+      .cm-header-6 { font-size: 90%; }
+      .cm-strong { font-size: 140%; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Variable Height</a>
+  </ul>
+</div>
+
+<article>
+<h2>Variable Height Demo</h2>
+<form><textarea id="code" name="code"># A First Level Header
+
+**Bold** text in a normal-size paragraph.
+
+And a very long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long long, wrapped line with a piece of **big** text inside of it.
+
+## A Second Level Header
+
+Now is the time for all good men to come to
+the aid of their country. This is just a
+regular paragraph.
+
+The quick brown fox jumped over the lazy
+dog's back.
+
+### Header 3
+
+> This is a blockquote.
+> 
+> This is the second paragraph in the blockquote.
+>
+> ## This is an H2 in a blockquote       
+</textarea></form>
+    <script id="script">
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        lineWrapping: true,
+        mode: "markdown"
+      });
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/vim.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,114 @@
+<!doctype html>
+
+<title>CodeMirror: Vim bindings demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/dialog/dialog.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/dialog/dialog.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../mode/clike/clike.js"></script>
+<script src="../addon/edit/matchbrackets.js"></script>
+<script src="../keymap/vim.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Vim bindings</a>
+  </ul>
+</div>
+
+<article>
+<h2>Vim bindings demo</h2>
+
+<p><strong style="color: #c33; text-decoration: none">Note:</strong>
+The CodeMirror vim bindings are maintained in
+the <a href="https://github.com/replit/codemirror-vim">codemirror-vim</a>
+repository, not this project. The file is still included in the
+distribution for backwards compatibility.</p>
+
+<form><textarea id="code" name="code">
+#include "syscalls.h"
+/* getchar:  simple buffered version */
+int getchar(void)
+{
+  static char buf[BUFSIZ];
+  static char *bufp = buf;
+  static int n = 0;
+  if (n == 0) {  /* buffer is empty */
+    n = read(0, buf, sizeof buf);
+    bufp = buf;
+  }
+  return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
+}
+</textarea></form>
+<div style="font-size: 13px; width: 300px; height: 30px;">Key buffer: <span id="command-display"></span></div>
+<div style="font-size: 13px; width: 300px; height: 30px;">Vim mode: <span id="vim-mode"></span></div>
+
+<p>The vim keybindings are enabled by including <code><a
+href="../keymap/vim.js">keymap/vim.js</a></code> and setting the
+<code>keyMap</code> option to <code>vim</code>.</p>
+
+<p><strong>Features</strong></p>
+
+<ul>
+  <li>All common motions and operators, including text objects</li>
+  <li>Operator motion orthogonality</li>
+  <li>Visual mode - characterwise, linewise, blockwise</li>
+  <li>Full macro support (q, @)</li>
+  <li>Incremental highlighted search (/, ?, #, *, g#, g*)</li>
+  <li>Search/replace with confirm (:substitute, :%s)</li>
+  <li>Search history</li>
+  <li>Jump lists (Ctrl-o, Ctrl-i)</li>
+  <li>Key/command mapping with API (:map, :nmap, :vmap)</li>
+  <li>Sort (:sort)</li>
+  <li>Marks (`, ')</li>
+  <li>:global</li>
+  <li>Insert mode behaves identical to base CodeMirror</li>
+  <li>Cross-buffer yank/paste</li>
+</ul>
+
+<p>For the full list of key mappings and Ex commands, refer to the
+<code>defaultKeymap</code> and <code>defaultExCommandMap</code> at the
+top of <code><a href="../keymap/vim.js">keymap/vim.js</a></code>.
+
+<p>Note that while the vim mode tries to emulate the most useful
+features of vim as faithfully as possible, it does not strive to
+become a complete vim implementation</p>
+
+    <script>
+      CodeMirror.commands.save = function(){ alert("Saving"); };
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "text/x-csrc",
+        keyMap: "vim",
+        matchBrackets: true,
+        showCursorWhenSelecting: true
+      });
+      var commandDisplay = document.getElementById('command-display');
+      var keys = '';
+      CodeMirror.on(editor, 'vim-keypress', function(key) {
+        keys = keys + key;
+        commandDisplay.innerText = keys;
+      });
+      CodeMirror.on(editor, 'vim-command-done', function(e) {
+        keys = '';
+        commandDisplay.innerHTML = keys;
+      });
+      var vimMode = document.getElementById('vim-mode');
+      CodeMirror.on(editor, 'vim-mode-change', function(e) {
+        vimMode.innerText = JSON.stringify(e);
+      });
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/visibletabs.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,62 @@
+<!doctype html>
+
+<title>CodeMirror: Visible tabs demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/clike/clike.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid #eee; border-bottom: 1px solid #eee;}
+      .cm-tab {
+         background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAMCAYAAAAkuj5RAAAAAXNSR0IArs4c6QAAAGFJREFUSMft1LsRQFAQheHPowAKoACx3IgEKtaEHujDjORSgWTH/ZOdnZOcM/sgk/kFFWY0qV8foQwS4MKBCS3qR6ixBJvElOobYAtivseIE120FaowJPN75GMu8j/LfMwNjh4HUpwg4LUAAAAASUVORK5CYII=);
+         background-position: right;
+         background-repeat: no-repeat;
+      }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Visible tabs</a>
+  </ul>
+</div>
+
+<article>
+<h2>Visible tabs demo</h2>
+<form><textarea id="code" name="code">
+#include "syscalls.h"
+/* getchar:  simple buffered version */
+int getchar(void)
+{
+	static char buf[BUFSIZ];
+	static char *bufp = buf;
+	static int n = 0;
+	if (n == 0) {  /* buffer is empty */
+		n = read(0, buf, sizeof buf);
+		bufp = buf;
+	}
+	return (--n >= 0) ? (unsigned char) *bufp++ : EOF;
+}
+</textarea></form>
+
+<p>Tabs inside the editor are spans with the
+class <code>cm-tab</code>, and can be styled.</p>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        tabSize: 4,
+        indentUnit: 4,
+        indentWithTabs: true,
+        mode: "text/x-csrc"
+      });
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/widget.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: Inline Widget Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="https://cdnjs.cloudflare.com/ajax/libs/jshint/2.9.5/jshint.min.js"></script>
+<style>
+      .CodeMirror {border: 1px solid black;}
+      .lint-error {font-family: arial; font-size: 70%; background: #ffa; color: #a00; padding: 2px 5px 3px; }
+      .lint-error-icon {color: white; background-color: red; font-weight: bold; border-radius: 50%; padding: 0 3px; margin-right: 7px;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Inline Widget</a>
+  </ul>
+</div>
+
+<article>
+<h2>Inline Widget Demo</h2>
+
+
+    <div id=code></div>
+    <script id="script">var widgets = []
+function updateHints() {
+  editor.operation(function(){
+    for (var i = 0; i < widgets.length; ++i)
+      editor.removeLineWidget(widgets[i]);
+    widgets.length = 0;
+
+    JSHINT(editor.getValue());
+    for (var i = 0; i < JSHINT.errors.length; ++i) {
+      var err = JSHINT.errors[i];
+      if (!err) continue;
+      var msg = document.createElement("div");
+      var icon = msg.appendChild(document.createElement("span"));
+      icon.innerHTML = "!!";
+      icon.className = "lint-error-icon";
+      msg.appendChild(document.createTextNode(err.reason));
+      msg.className = "lint-error";
+      widgets.push(editor.addLineWidget(err.line - 1, msg, {coverGutter: false, noHScroll: true}));
+    }
+  });
+  var info = editor.getScrollInfo();
+  var after = editor.charCoords({line: editor.getCursor().line + 1, ch: 0}, "local").top;
+  if (info.top + info.clientHeight < after)
+    editor.scrollTo(null, after - info.clientHeight + 3);
+}
+
+window.onload = function() {
+  var sc = document.getElementById("script");
+  var content = sc.textContent || sc.innerText || sc.innerHTML;
+
+  window.editor = CodeMirror(document.getElementById("code"), {
+    lineNumbers: true,
+    mode: "javascript",
+    value: content
+  });
+
+  var waiting;
+  editor.on("change", function() {
+    clearTimeout(waiting);
+    waiting = setTimeout(updateHints, 500);
+  });
+
+  setTimeout(updateHints, 100);
+};
+
+"long line to create a horizontal scrollbar, in order to test whether the (non-inline) widgets stay in place when scrolling to the right";
+</script>
+<p>This demo runs <a href="http://jshint.com">JSHint</a> over the code
+in the editor (which is the script used on this page), and
+inserts <a href="../doc/manual.html#addLineWidget">line widgets</a> to
+display the warnings that JSHint comes up with.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/demo/xmlcomplete.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,119 @@
+<!doctype html>
+
+<title>CodeMirror: XML Autocomplete Demo</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="../addon/hint/show-hint.css">
+<script src="../lib/codemirror.js"></script>
+<script src="../addon/hint/show-hint.js"></script>
+<script src="../addon/hint/xml-hint.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<style>
+      .CodeMirror { border: 1px solid #eee; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">XML Autocomplete</a>
+  </ul>
+</div>
+
+<article>
+<h2>XML Autocomplete Demo</h2>
+<form><textarea id="code" name="code"><!-- write some xml below -->
+</textarea></form>
+
+    <p>Press <strong>ctrl-space</strong>, or type a '&lt;' character to
+    activate autocompletion. This demo defines a simple schema that
+    guides completion. The schema can be customized—see
+    the <a href="../doc/manual.html#addon_xml-hint">manual</a>.</p>
+
+    <p>Development of the <code>xml-hint</code> addon was kindly
+    sponsored
+    by <a href="http://www.xperiment.mobi">www.xperiment.mobi</a>.</p>
+
+    <script>
+      var dummy = {
+        attrs: {
+          color: ["red", "green", "blue", "purple", "white", "black", "yellow"],
+          size: ["large", "medium", "small"],
+          description: null
+        },
+        children: []
+      };
+
+      var tags = {
+        "!top": ["top"],
+        "!attrs": {
+          id: null,
+          class: ["A", "B", "C"]
+        },
+        top: {
+          attrs: {
+            lang: ["en", "de", "fr", "nl"],
+            freeform: null
+          },
+          children: ["animal", "plant"]
+        },
+        animal: {
+          attrs: {
+            name: null,
+            isduck: ["yes", "no"]
+          },
+          children: ["wings", "feet", "body", "head", "tail"]
+        },
+        plant: {
+          attrs: {name: null},
+          children: ["leaves", "stem", "flowers"]
+        },
+        wings: dummy, feet: dummy, body: dummy, head: dummy, tail: dummy,
+        leaves: dummy, stem: dummy, flowers: dummy
+      };
+
+      function completeAfter(cm, pred) {
+        var cur = cm.getCursor();
+        if (!pred || pred()) setTimeout(function() {
+          if (!cm.state.completionActive)
+            cm.showHint({completeSingle: false});
+        }, 100);
+        return CodeMirror.Pass;
+      }
+
+      function completeIfAfterLt(cm) {
+        return completeAfter(cm, function() {
+          var cur = cm.getCursor();
+          return cm.getRange(CodeMirror.Pos(cur.line, cur.ch - 1), cur) == "<";
+        });
+      }
+
+      function completeIfInTag(cm) {
+        return completeAfter(cm, function() {
+          var tok = cm.getTokenAt(cm.getCursor());
+          if (tok.type == "string" && (!/['"]/.test(tok.string.charAt(tok.string.length - 1)) || tok.string.length == 1)) return false;
+          var inner = CodeMirror.innerMode(cm.getMode(), tok.state).state;
+          return inner.tagName;
+        });
+      }
+
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "xml",
+        lineNumbers: true,
+        extraKeys: {
+          "'<'": completeAfter,
+          "'/'": completeIfAfterLt,
+          "' '": completeIfInTag,
+          "'='": completeIfInTag,
+          "Ctrl-Space": "autocomplete"
+        },
+        hintOptions: {schemaInfo: tags}
+      });
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/activebookmark.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,57 @@
+// Kludge in HTML5 tag recognition in IE8
+document.createElement("section");
+document.createElement("article");
+
+(function() {
+  if (!window.addEventListener) return;
+  var pending = false, prevVal = null;
+
+  function updateSoon() {
+    if (!pending) {
+      pending = true;
+      setTimeout(update, 250);
+    }
+  }
+
+  function update() {
+    pending = false;
+    var marks = document.getElementById("nav").getElementsByTagName("a"), found;
+    for (var i = 0; i < marks.length; ++i) {
+      var mark = marks[i], m;
+      if (mark.getAttribute("data-default")) {
+        if (found == null) found = i;
+      } else if (m = mark.href.match(/#(.*)/)) {
+        var ref = document.getElementById(m[1]);
+        if (ref && ref.getBoundingClientRect().top < 50)
+          found = i;
+      }
+    }
+    if (found != null && found != prevVal) {
+      prevVal = found;
+      var lis = document.getElementById("nav").getElementsByTagName("li");
+      for (var i = 0; i < lis.length; ++i) lis[i].className = "";
+      for (var i = 0; i < marks.length; ++i) {
+        if (found == i) {
+          marks[i].className = "active";
+          for (var n = marks[i]; n; n = n.parentNode)
+            if (n.nodeName == "LI") n.className = "active";
+        } else {
+          marks[i].className = "";
+        }
+      }
+    }
+  }
+
+  window.addEventListener("scroll", updateSoon);
+  window.addEventListener("load", updateSoon);
+  window.addEventListener("hashchange", function() {
+    setTimeout(function() {
+      var hash = document.location.hash, found = null, m;
+      var marks = document.getElementById("nav").getElementsByTagName("a");
+      for (var i = 0; i < marks.length; i++)
+        if ((m = marks[i].href.match(/(#.*)/)) && m[1] == hash) { found = i; break; }
+      if (found != null) for (var i = 0; i < marks.length; i++)
+        marks[i].className = i == found ? "active" : "";
+    }, 300);
+  });
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/docs.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,225 @@
+@font-face {
+  font-family: 'Source Sans Pro';
+  font-style: normal;
+  font-weight: 400;
+  src: local('Source Sans Pro'), local('SourceSansPro-Regular'), url(source_sans.woff) format('woff');
+}
+
+body, html { margin: 0; padding: 0; height: 100%; }
+section, article { display: block; padding: 0; }
+
+body {
+  background: #f8f8f8;
+  font-family: 'Source Sans Pro', Helvetica, Arial, sans-serif;
+  line-height: 1.5;
+}
+
+p { margin-top: 0; }
+
+h2, h3, h1 {
+  font-weight: normal;
+  margin-bottom: .7em;
+}
+h1 { font-size: 140%; }
+h2 { font-size: 120%; }
+h3 { font-size: 110%; }
+article > h2:first-child, section:first-child > h2 { margin-top: 0; }
+
+#nav h1 {
+  margin-right: 12px;
+  margin-top: 0;
+  margin-bottom: 2px;
+  color: #d30707;
+  letter-spacing: .5px;
+}
+
+a, a:visited, a:link, .quasilink {
+  color: #A21313;
+}
+
+em {
+  padding-right: 2px;
+}
+
+.quasilink {
+  cursor: pointer;
+}
+
+article {
+  max-width: 700px;
+  margin: 0 0 0 160px;
+  border-left: 2px solid #E30808;
+  border-right: 1px solid #ddd;
+  padding: 30px 50px 100px 50px;
+  background: white;
+  z-index: 2;
+  position: relative;
+  min-height: 100%;
+  box-sizing: border-box;
+  -moz-box-sizing: border-box;
+}
+
+#nav {
+  position: fixed;
+  padding-top: 30px;
+  max-height: 100%;
+  box-sizing: -moz-border-box;
+  box-sizing: border-box;
+  overflow-y: auto;
+  left: 0; right: none;
+  width: 160px;
+  text-align: right;
+  z-index: 1;
+}
+
+@media screen and (min-width: 1000px) {
+  article {
+    margin: 0 auto;
+  }
+  #nav {
+    right: 50%;
+    width: auto;
+    border-right: 349px solid transparent;
+  }
+}
+
+#nav ul {
+  display: block;
+  margin: 0; padding: 0;
+  margin-bottom: 32px;
+}
+
+#nav a {
+  text-decoration: none;
+}
+
+#nav li {
+  display: block;
+  margin-bottom: 4px;
+}
+
+#nav li ul {
+  font-size: 80%;
+  margin-bottom: 0;
+  display: none;
+}
+
+#nav li.active ul {
+  display: block;
+}
+
+#nav li li a {
+  padding-right: 20px;
+  display: inline-block;
+}
+
+#nav ul a {
+  color: black;
+  padding: 0 7px 1px 11px;
+}
+
+#nav ul a.active, #nav ul a:hover {
+  border-bottom: 1px solid #E30808;
+  margin-bottom: -1px;
+  color: #E30808;
+}
+
+#logo {
+  border: 0;
+  margin-right: 12px;
+  margin-bottom: 25px;
+}
+
+section {
+  border-top: 1px solid #E30808;
+  margin: 1.5em 0;
+}
+
+section.first {
+  border: none;
+  margin-top: 0;
+}
+
+#demo {
+  position: relative;
+}
+
+#demolist {
+  position: absolute;
+  right: 5px;
+  top: 5px;
+  z-index: 25;
+}
+
+.yinyang {
+  position: absolute;
+  top: -10px;
+  left: 0; right: 0;
+  margin: auto;
+  display: block;
+  height: 120px;
+}
+
+.actions {
+  margin: 1em 0 0;
+  min-height: 100px;
+  position: relative;
+}
+
+@media screen and (max-width: 800px) {
+  .actions {
+    padding-top: 120px;
+  }
+  .actionsleft, .actionsright {
+    float: none;
+    text-align: left;
+    margin-bottom: 1em;
+  }
+}
+
+th {
+  text-decoration: underline;
+  font-weight: normal;
+  text-align: left;
+}
+
+#features ul {
+  list-style: none;
+  margin: 0 0 1em;
+  padding: 0 0 0 1.2em;
+}
+
+#features li:before {
+  content: "-";
+  width: 1em;
+  display: inline-block;
+  padding: 0;
+  margin: 0;
+  margin-left: -1em;
+}
+
+.rel {
+  margin-bottom: 0;
+}
+.rel-note {
+  margin-top: 0;
+  color: #555;
+}
+
+pre {
+  padding-left: 15px;
+  border-left: 2px solid #ddd;
+}
+
+code {
+  padding: 0 2px;
+}
+
+strong {
+  text-decoration: underline;
+  font-weight: normal;
+}
+
+.field {
+  border: 1px solid #A21313;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/internals.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,504 @@
+<!doctype html>
+
+<title>CodeMirror: Internals</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+<style>dl dl {margin: 0;} .update {color: #d40 !important}</style>
+<script src="activebookmark.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="#top">Introduction</a></li>
+    <li><a href="#approach">General Approach</a></li>
+    <li><a href="#input">Input</a></li>
+    <li><a href="#selection">Selection</a></li>
+    <li><a href="#update">Intelligent Updating</a></li>
+    <li><a href="#parse">Parsing</a></li>
+    <li><a href="#summary">What Gives?</a></li>
+    <li><a href="#btree">Content Representation</a></li>
+    <li><a href="#keymap">Key Maps</a></li>
+  </ul>
+</div>
+
+<article>
+
+<h2 id=top>(Re-) Implementing A Syntax-Highlighting Editor in JavaScript</h2>
+
+<p style="font-size: 85%" id="intro">
+  <strong>Topic:</strong> JavaScript, code editor implementation<br>
+  <strong>Author:</strong> Marijn Haverbeke<br>
+  <strong>Date:</strong> March 2nd 2011 (updated November 13th 2011)
+</p>
+
+<p style="padding: 0 3em 0 2em"><strong>Caution</strong>: this text was written briefly after
+version 2 was initially written. It no longer (even including the
+update at the bottom) fully represents the current implementation. I'm
+leaving it here as a historic document. For more up-to-date
+information, look at the entries
+tagged <a href="http://marijnhaverbeke.nl/blog/#cm-internals">cm-internals</a>
+on my blog.</p>
+
+<p>This is a followup to
+my <a href="https://codemirror.net/5/story.html">Brutal Odyssey to the
+Dark Side of the DOM Tree</a> story. That one describes the
+mind-bending process of implementing (what would become) CodeMirror 1.
+This one describes the internals of CodeMirror 2, a complete rewrite
+and rethink of the old code base. I wanted to give this piece another
+Hunter Thompson copycat subtitle, but somehow that would be out of
+place—the process this time around was one of straightforward
+engineering, requiring no serious mind-bending whatsoever.</p>
+
+<p>So, what is wrong with CodeMirror 1? I'd estimate, by mailing list
+activity and general search-engine presence, that it has been
+integrated into about a thousand systems by now. The most prominent
+one, since a few weeks,
+being <a href="http://googlecode.blogspot.com/2011/01/make-quick-fixes-quicker-on-google.html">Google
+code's project hosting</a>. It works, and it's being used widely.</p>
+
+<p>Still, I did not start replacing it because I was bored. CodeMirror
+1 was heavily reliant on <code>designMode</code>
+or <code>contentEditable</code> (depending on the browser). Neither of
+these are well specified (HTML5 tries
+to <a href="http://www.w3.org/TR/html5/editing.html#contenteditable">specify</a>
+their basics), and, more importantly, they tend to be one of the more
+obscure and buggy areas of browser functionality—CodeMirror, by using
+this functionality in a non-typical way, was constantly running up
+against browser bugs. WebKit wouldn't show an empty line at the end of
+the document, and in some releases would suddenly get unbearably slow.
+Firefox would show the cursor in the wrong place. Internet Explorer
+would insist on linkifying everything that looked like a URL or email
+address, a behaviour that can't be turned off. Some bugs I managed to
+work around (which was often a frustrating, painful process), others,
+such as the Firefox cursor placement, I gave up on, and had to tell
+user after user that they were known problems, but not something I
+could help.</p>
+
+<p>Also, there is the fact that <code>designMode</code> (which seemed
+to be less buggy than <code>contentEditable</code> in Webkit and
+Firefox, and was thus used by CodeMirror 1 in those browsers) requires
+a frame. Frames are another tricky area. It takes some effort to
+prevent getting tripped up by domain restrictions, they don't
+initialize synchronously, behave strangely in response to the back
+button, and, on several browsers, can't be moved around the DOM
+without having them re-initialize. They did provide a very nice way to
+namespace the library, though—CodeMirror 1 could freely pollute the
+namespace inside the frame.</p>
+
+<p>Finally, working with an editable document means working with
+selection in arbitrary DOM structures. Internet Explorer (8 and
+before) has an utterly different (and awkward) selection API than all
+of the other browsers, and even among the different implementations of
+<code>document.selection</code>, details about how exactly a selection
+is represented vary quite a bit. Add to that the fact that Opera's
+selection support tended to be very buggy until recently, and you can
+imagine why CodeMirror 1 contains 700 lines of selection-handling
+code.</p>
+
+<p>And that brings us to the main issue with the CodeMirror 1
+code base: The proportion of browser-bug-workarounds to real
+application code was getting dangerously high. By building on top of a
+few dodgy features, I put the system in a vulnerable position—any
+incompatibility and bugginess in these features, I had to paper over
+with my own code. Not only did I have to do some serious stunt-work to
+get it to work on older browsers (as detailed in the
+previous <a href="https://codemirror.net/5/story.html">story</a>), things
+also kept breaking in newly released versions, requiring me to come up
+with <em>new</em> scary hacks in order to keep up. This was starting
+to lose its appeal.</p>
+
+<section id=approach>
+  <h2>General Approach</h2>
+
+<p>What CodeMirror 2 does is try to sidestep most of the hairy hacks
+that came up in version 1. I owe a lot to the
+<a href="http://ace.ajax.org">ACE</a> editor for inspiration on how to
+approach this.</p>
+
+<p>I absolutely did not want to be completely reliant on key events to
+generate my input. Every JavaScript programmer knows that key event
+information is horrible and incomplete. Some people (most awesomely
+Mihai Bazon with <a href="http://ymacs.org">Ymacs</a>) have been able
+to build more or less functioning editors by directly reading key
+events, but it takes a lot of work (the kind of never-ending, fragile
+work I described earlier), and will never be able to properly support
+things like multi-keystoke international character
+input. <a href="#keymap" class="update">[see below for caveat]</a></p>
+
+<p>So what I do is focus a hidden textarea, and let the browser
+believe that the user is typing into that. What we show to the user is
+a DOM structure we built to represent his document. If this is updated
+quickly enough, and shows some kind of believable cursor, it feels
+like a real text-input control.</p>
+
+<p>Another big win is that this DOM representation does not have to
+span the whole document. Some CodeMirror 1 users insisted that they
+needed to put a 30 thousand line XML document into CodeMirror. Putting
+all that into the DOM takes a while, especially since, for some
+reason, an editable DOM tree is slower than a normal one on most
+browsers. If we have full control over what we show, we must only
+ensure that the visible part of the document has been added, and can
+do the rest only when needed. (Fortunately, the <code>onscroll</code>
+event works almost the same on all browsers, and lends itself well to
+displaying things only as they are scrolled into view.)</p>
+</section>
+<section id="input">
+  <h2>Input</h2>
+
+<p>ACE uses its hidden textarea only as a text input shim, and does
+all cursor movement and things like text deletion itself by directly
+handling key events. CodeMirror's way is to let the browser do its
+thing as much as possible, and not, for example, define its own set of
+key bindings. One way to do this would have been to have the whole
+document inside the hidden textarea, and after each key event update
+the display DOM to reflect what's in that textarea.</p>
+
+<p>That'd be simple, but it is not realistic. For even medium-sized
+document the editor would be constantly munging huge strings, and get
+terribly slow. What CodeMirror 2 does is put the current selection,
+along with an extra line on the top and on the bottom, into the
+textarea.</p>
+
+<p>This means that the arrow keys (and their ctrl-variations), home,
+end, etcetera, do not have to be handled specially. We just read the
+cursor position in the textarea, and update our cursor to match it.
+Also, copy and paste work pretty much for free, and people get their
+native key bindings, without any special work on my part. For example,
+I have emacs key bindings configured for Chrome and Firefox. There is
+no way for a script to detect this. <a class="update"
+href="#keymap">[no longer the case]</a></p>
+
+<p>Of course, since only a small part of the document sits in the
+textarea, keys like page up and ctrl-end won't do the right thing.
+CodeMirror is catching those events and handling them itself.</p>
+</section>
+<section id="selection">
+  <h2>Selection</h2>
+
+<p>Getting and setting the selection range of a textarea in modern
+browsers is trivial—you just use the <code>selectionStart</code>
+and <code>selectionEnd</code> properties. On IE you have to do some
+insane stuff with temporary ranges and compensating for the fact that
+moving the selection by a 'character' will treat \r\n as a single
+character, but even there it is possible to build functions that
+reliably set and get the selection range.</p>
+
+<p>But consider this typical case: When I'm somewhere in my document,
+press shift, and press the up arrow, something gets selected. Then, if
+I, still holding shift, press the up arrow again, the top of my
+selection is adjusted. The selection remembers where its <em>head</em>
+and its <em>anchor</em> are, and moves the head when we shift-move.
+This is a generally accepted property of selections, and done right by
+every editing component built in the past twenty years.</p>
+
+<p>But not something that the browser selection APIs expose.</p>
+
+<p>Great. So when someone creates an 'upside-down' selection, the next
+time CodeMirror has to update the textarea, it'll re-create the
+selection as an 'upside-up' selection, with the anchor at the top, and
+the next cursor motion will behave in an unexpected way—our second
+up-arrow press in the example above will not do anything, since it is
+interpreted in exactly the same way as the first.</p>
+
+<p>No problem. We'll just, ehm, detect that the selection is
+upside-down (you can tell by the way it was created), and then, when
+an upside-down selection is present, and a cursor-moving key is
+pressed in combination with shift, we quickly collapse the selection
+in the textarea to its start, allow the key to take effect, and then
+combine its new head with its old anchor to get the <em>real</em>
+selection.</p>
+
+<p>In short, scary hacks could not be avoided entirely in CodeMirror
+2.</p>
+
+<p>And, the observant reader might ask, how do you even know that a
+key combo is a cursor-moving combo, if you claim you support any
+native key bindings? Well, we don't, but we can learn. The editor
+keeps a set known cursor-movement combos (initialized to the
+predictable defaults), and updates this set when it observes that
+pressing a certain key had (only) the effect of moving the cursor.
+This, of course, doesn't work if the first time the key is used was
+for extending an inverted selection, but it works most of the
+time.</p>
+</section>
+<section id="update">
+  <h2>Intelligent Updating</h2>
+
+<p>One thing that always comes up when you have a complicated internal
+state that's reflected in some user-visible external representation
+(in this case, the displayed code and the textarea's content) is
+keeping the two in sync. The naive way is to just update the display
+every time you change your state, but this is not only error prone
+(you'll forget), it also easily leads to duplicate work on big,
+composite operations. Then you start passing around flags indicating
+whether the display should be updated in an attempt to be efficient
+again and, well, at that point you might as well give up completely.</p>
+
+<p>I did go down that road, but then switched to a much simpler model:
+simply keep track of all the things that have been changed during an
+action, and then, only at the end, use this information to update the
+user-visible display.</p>
+
+<p>CodeMirror uses a concept of <em>operations</em>, which start by
+calling a specific set-up function that clears the state and end by
+calling another function that reads this state and does the required
+updating. Most event handlers, and all the user-visible methods that
+change state are wrapped like this. There's a method
+called <code>operation</code> that accepts a function, and returns
+another function that wraps the given function as an operation.</p>
+
+<p>It's trivial to extend this (as CodeMirror does) to detect nesting,
+and, when an operation is started inside an operation, simply
+increment the nesting count, and only do the updating when this count
+reaches zero again.</p>
+
+<p>If we have a set of changed ranges and know the currently shown
+range, we can (with some awkward code to deal with the fact that
+changes can add and remove lines, so we're dealing with a changing
+coordinate system) construct a map of the ranges that were left
+intact. We can then compare this map with the part of the document
+that's currently visible (based on scroll offset and editor height) to
+determine whether something needs to be updated.</p>
+
+<p>CodeMirror uses two update algorithms—a full refresh, where it just
+discards the whole part of the DOM that contains the edited text and
+rebuilds it, and a patch algorithm, where it uses the information
+about changed and intact ranges to update only the out-of-date parts
+of the DOM. When more than 30 percent (which is the current heuristic,
+might change) of the lines need to be updated, the full refresh is
+chosen (since it's faster to do than painstakingly finding and
+updating all the changed lines), in the other case it does the
+patching (so that, if you scroll a line or select another character,
+the whole screen doesn't have to be
+re-rendered). <span class="update">[the full-refresh
+algorithm was dropped, it wasn't really faster than the patching
+one]</span></p>
+
+<p>All updating uses <code>innerHTML</code> rather than direct DOM
+manipulation, since that still seems to be by far the fastest way to
+build documents. There's a per-line function that combines the
+highlighting, <a href="manual.html#markText">marking</a>, and
+selection info for that line into a snippet of HTML. The patch updater
+uses this to reset individual lines, the refresh updater builds an
+HTML chunk for the whole visible document at once, and then uses a
+single <code>innerHTML</code> update to do the refresh.</p>
+</section>
+<section id="parse">
+  <h2>Parsers can be Simple</h2>
+
+<p>When I wrote CodeMirror 1, I
+thought <a href="https://codemirror.net/5/story.html#parser">interruptible
+parsers</a> were a hugely scary and complicated thing, and I used a
+bunch of heavyweight abstractions to keep this supposed complexity
+under control: parsers
+were <a href="http://bob.pythonmac.org/archives/2005/07/06/iteration-in-javascript/">iterators</a>
+that consumed input from another iterator, and used funny
+closure-resetting tricks to copy and resume themselves.</p>
+
+<p>This made for a rather nice system, in that parsers formed strictly
+separate modules, and could be composed in predictable ways.
+Unfortunately, it was quite slow (stacking three or four iterators on
+top of each other), and extremely intimidating to people not used to a
+functional programming style.</p>
+
+<p>With a few small changes, however, we can keep all those
+advantages, but simplify the API and make the whole thing less
+indirect and inefficient. CodeMirror
+2's <a href="manual.html#modeapi">mode API</a> uses explicit state
+objects, and makes the parser/tokenizer a function that simply takes a
+state and a character stream abstraction, advances the stream one
+token, and returns the way the token should be styled. This state may
+be copied, optionally in a mode-defined way, in order to be able to
+continue a parse at a given point. Even someone who's never touched a
+lambda in his life can understand this approach. Additionally, far
+fewer objects are allocated in the course of parsing now.</p>
+
+<p>The biggest speedup comes from the fact that the parsing no longer
+has to touch the DOM though. In CodeMirror 1, on an older browser, you
+could <em>see</em> the parser work its way through the document,
+managing some twenty lines in each 50-millisecond time slice it got. It
+was reading its input from the DOM, and updating the DOM as it went
+along, which any experienced JavaScript programmer will immediately
+spot as a recipe for slowness. In CodeMirror 2, the parser usually
+finishes the whole document in a single 100-millisecond time slice—it
+manages some 1500 lines during that time on Chrome. All it has to do
+is munge strings, so there is no real reason for it to be slow
+anymore.</p>
+</section>
+<section id="summary">
+  <h2>What Gives?</h2>
+
+<p>Given all this, what can you expect from CodeMirror 2?</p>
+
+<ul>
+
+<li><strong>Small.</strong> the base library is
+some <span class="update">45k</span> when minified
+now, <span class="update">17k</span> when gzipped. It's smaller than
+its own logo.</li>
+
+<li><strong>Lightweight.</strong> CodeMirror 2 initializes very
+quickly, and does almost no work when it is not focused. This means
+you can treat it almost like a textarea, have multiple instances on a
+page without trouble.</li>
+
+<li><strong>Huge document support.</strong> Since highlighting is
+really fast, and no DOM structure is being built for non-visible
+content, you don't have to worry about locking up your browser when a
+user enters a megabyte-sized document.</li>
+
+<li><strong>Extended API.</strong> Some things kept coming up in the
+mailing list, such as marking pieces of text or lines, which were
+extremely hard to do with CodeMirror 1. The new version has proper
+support for these built in.</li>
+
+<li><strong>Tab support.</strong> Tabs inside editable documents were,
+for some reason, a no-go. At least six different people announced they
+were going to add tab support to CodeMirror 1, none survived (I mean,
+none delivered a working version). CodeMirror 2 no longer removes tabs
+from your document.</li>
+
+<li><strong>Sane styling.</strong> <code>iframe</code> nodes aren't
+really known for respecting document flow. Now that an editor instance
+is a plain <code>div</code> element, it is much easier to size it to
+fit the surrounding elements. You don't even have to make it scroll if
+you do not <a href="../demo/resize.html">want to</a>.</li>
+
+</ul>
+
+<p>On the downside, a CodeMirror 2 instance is <em>not</em> a native
+editable component. Though it does its best to emulate such a
+component as much as possible, there is functionality that browsers
+just do not allow us to hook into. Doing select-all from the context
+menu, for example, is not currently detected by CodeMirror.</p>
+
+<p id="changes" style="margin-top: 2em;"><span style="font-weight:
+bold">[Updates from November 13th 2011]</span> Recently, I've made
+some changes to the codebase that cause some of the text above to no
+longer be current. I've left the text intact, but added markers at the
+passages that are now inaccurate. The new situation is described
+below.</p>
+</section>
+<section id="btree">
+  <h2>Content Representation</h2>
+
+<p>The original implementation of CodeMirror 2 represented the
+document as a flat array of line objects. This worked well—splicing
+arrays will require the part of the array after the splice to be
+moved, but this is basically just a simple <code>memmove</code> of a
+bunch of pointers, so it is cheap even for huge documents.</p>
+
+<p>However, I recently added line wrapping and code folding (line
+collapsing, basically). Once lines start taking up a non-constant
+amount of vertical space, looking up a line by vertical position
+(which is needed when someone clicks the document, and to determine
+the visible part of the document during scrolling) can only be done
+with a linear scan through the whole array, summing up line heights as
+you go. Seeing how I've been going out of my way to make big documents
+fast, this is not acceptable.</p>
+
+<p>The new representation is based on a B-tree. The leaves of the tree
+contain arrays of line objects, with a fixed minimum and maximum size,
+and the non-leaf nodes simply hold arrays of child nodes. Each node
+stores both the amount of lines that live below them and the vertical
+space taken up by these lines. This allows the tree to be indexed both
+by line number and by vertical position, and all access has
+logarithmic complexity in relation to the document size.</p>
+
+<p>I gave line objects and tree nodes parent pointers, to the node
+above them. When a line has to update its height, it can simply walk
+these pointers to the top of the tree, adding or subtracting the
+difference in height from each node it encounters. The parent pointers
+also make it cheaper (in complexity terms, the difference is probably
+tiny in normal-sized documents) to find the current line number when
+given a line object. In the old approach, the whole document array had
+to be searched. Now, we can just walk up the tree and count the sizes
+of the nodes coming before us at each level.</p>
+
+<p>I chose B-trees, not regular binary trees, mostly because they
+allow for very fast bulk insertions and deletions. When there is a big
+change to a document, it typically involves adding, deleting, or
+replacing a chunk of subsequent lines. In a regular balanced tree, all
+these inserts or deletes would have to be done separately, which could
+be really expensive. In a B-tree, to insert a chunk, you just walk
+down the tree once to find where it should go, insert them all in one
+shot, and then break up the node if needed. This breaking up might
+involve breaking up nodes further up, but only requires a single pass
+back up the tree. For deletion, I'm somewhat lax in keeping things
+balanced—I just collapse nodes into a leaf when their child count goes
+below a given number. This means that there are some weird editing
+patterns that may result in a seriously unbalanced tree, but even such
+an unbalanced tree will perform well, unless you spend a day making
+strangely repeating edits to a really big document.</p>
+</section>
+<section id="keymap">
+  <h2>Keymaps</h2>
+
+<p><a href="#approach">Above</a>, I claimed that directly catching key
+events for things like cursor movement is impractical because it
+requires some browser-specific kludges. I then proceeded to explain
+some awful <a href="#selection">hacks</a> that were needed to make it
+possible for the selection changes to be detected through the
+textarea. In fact, the second hack is about as bad as the first.</p>
+
+<p>On top of that, in the presence of user-configurable tab sizes and
+collapsed and wrapped lines, lining up cursor movement in the textarea
+with what's visible on the screen becomes a nightmare. Thus, I've
+decided to move to a model where the textarea's selection is no longer
+depended on.</p>
+
+<p>So I moved to a model where all cursor movement is handled by my
+own code. This adds support for a goal column, proper interaction of
+cursor movement with collapsed lines, and makes it possible for
+vertical movement to move through wrapped lines properly, instead of
+just treating them like non-wrapped lines.</p>
+
+<p>The key event handlers now translate the key event into a string,
+something like <code>Ctrl-Home</code> or <code>Shift-Cmd-R</code>, and
+use that string to look up an action to perform. To make keybinding
+customizable, this lookup goes through
+a <a href="manual.html#option_keyMap">table</a>, using a scheme that
+allows such tables to be chained together (for example, the default
+Mac bindings fall through to a table named 'emacsy', which defines
+basic Emacs-style bindings like <code>Ctrl-F</code>, and which is also
+used by the custom Emacs bindings).</p>
+
+<p>A new
+option <a href="manual.html#option_extraKeys"><code>extraKeys</code></a>
+allows ad-hoc keybindings to be defined in a much nicer way than what
+was possible with the
+old <a href="manual.html#option_onKeyEvent"><code>onKeyEvent</code></a>
+callback. You simply provide an object mapping key identifiers to
+functions, instead of painstakingly looking at raw key events.</p>
+
+<p>Built-in commands map to strings, rather than functions, for
+example <code>"goLineUp"</code> is the default action bound to the up
+arrow key. This allows new keymaps to refer to them without
+duplicating any code. New commands can be defined by assigning to
+the <code>CodeMirror.commands</code> object, which maps such commands
+to functions.</p>
+
+<p>The hidden textarea now only holds the current selection, with no
+extra characters around it. This has a nice advantage: polling for
+input becomes much, much faster. If there's a big selection, this text
+does not have to be read from the textarea every time—when we poll,
+just noticing that something is still selected is enough to tell us
+that no new text was typed.</p>
+
+<p>The reason that cheap polling is important is that many browsers do
+not fire useful events on IME (input method engine) input, which is
+the thing where people inputting a language like Japanese or Chinese
+use multiple keystrokes to create a character or sequence of
+characters. Most modern browsers fire <code>input</code> when the
+composing is finished, but many don't fire anything when the character
+is updated <em>during</em> composition. So we poll, whenever the
+editor is focused, to provide immediate updates of the display.</p>
+
+</section>
+</article>
Binary file .cms/lib/codemirror/doc/logo.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/logo.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,19 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="640" height="640">
+  <path d="M292.4 53.2s8.7 18.6-3.6 39.2c-6.2 10.2-163.1 43.6-224.3 128.6-37.5 58.7-95 228.7 88.7 341.2 82.5 42.5 117.5 41.2 117.5 41.2s-55-38.7-20-65 86.2-38.7 100-75c16.2 12.5 42.5 38.7 67.5 36.2-2.5-16.2-8.7-22.5 11.2-25s30-2.5 30-2.5-18.7-15-40-16.2-61.2-42.5-60-60c26.2-15 60-40 80-32.5s40 20 43.7 31.2c0 7.5-3.7 20 12.5 10s12.5-16.2 18.7-30 7.5-16.2-6.2-27.5-46.2-37.5-72.5-30-81.2 28.7-108.7 2.5c11.2-25 28.7-65 20-92.5 16.2-12.5 35-26.2 37.5-48.7 18.7-2.5 58.7-13.7 51.2-33.7S374.9 36.0 293.6 53.5" fill="#fff"/>
+  <path d="M551.9 257.4c13.7-36.2 36.2-97.5 15-100s-45 55-51.2 70-31.2 90-17.5 100 53.7-70 53.7-70" fill="#fff"/>
+  <path d="M435.6 159.9c3.9-6.1 7.2-.8-9.6.4-16.8 1.2-37.0 6.4-40.4 13.8-6.4 13.7-8.6 47.6-33.0 55.1-1.2 8.7 0 28.7 34.3 32.5s35.6-18.7 55.6-18.1 18.1-6.8 11.2-12.5-30.6-43.7-30.6-56.2 8.1-8.1 12.5-15M128.7 536.8s-10.6-28.1 20.6-43.1 59.3-3.1 65 7.5-9.3 53.1-63.1 53.7c-13.1-10.6-22.5-18.1-22.5-18.1" fill="#da687d"/>
+  <g opacity=".7" transform="matrix(1.25 0 0 -1.25 -26.846 640)">
+    <path d="M466.2 369.8c.4-1.5.2-3.1.2-4.8-.0-1.6-.1-3.3-.6-4.9.1-.3-.0-.8-.0-1.2-.4-.5-.1-.9-.2-1.3.6-.6 1.5-1.3 1.1-2.1-.2-.5-.8-.7-1.4-.9-.3-1.4-.7-3.0-1.0-4.6-.0-.4-.0-1.0-.1-1.4-.3-1.0-.6-1.9-.9-3.0-.2-.9.0-2.6-1.0-2.8-.4-1.0-.6-1.8-1.1-2.8-.2-.1-.4.1-.6.0-.3-.3-.2-.8-.5-1.1-.2-.2-.5-.1-.6-.3-.3-.5-.2-1.2-.5-1.9a4.7 4.7 0 0 1-1.1-1.4c-.5-1.1-.6-2.6-1.5-3.5-.2-.2-.7-.3-1.0-.6-.2-.2-.4-.6-.6-.9-.3-.4-.6-1.0-.9-1.5-1.0-1.7-2.3-3.7-3.3-5.6-.1-.3-.2-.8-.3-1.1-.3-.8-.9-1.5-1.2-2.3-.5-1.2-1.3-3.3-2.5-4.4-.1-.1-.4-.2-.6-.4-.1-.2-.1-.5-.3-.8-.0-.1-.4-.1-.5-.3-.2-.2-.3-.4-.4-.6-.4-.3-1.0-.5-1.3-.9-.2-.3-.3-.7-.6-1.1-.3-.4-.7-.7-1.0-1.2-.9-1.2-1.3-2.8-2.7-3.3-.3-.1-.8-.1-1.2-.2-.3.3-.0.8-.1 1.1-.0.2-.2.3-.3.5-.1.4-.3 1.3-.3 1.8.0.5.3.9.3 1.6.0.5-.1 1.2-.1 1.8-.0.3.0.6.0.9-.0.5-.0.8.0 1.4.0.7-.0 1.4-.1 2.1.3 1.7.5 3.0 1.0 4.9.2.8.7 2.3 1.1 3.3.8 1.8 1.6 3.9 2.6 5.9.3.6.8 1.1 1.1 1.8.1.3.2.8.3 1.2 1.6 3.3 3.8 6.2 5.5 9.7 1.4 2.8 2.8 5.4 4.7 8.5.8 1.4 1.5 2.9 2.4 4.0.6.8 1.6 2.4 2.3 3.9.2.5.2 1.0 1.0 1.1.7.9 1.3 2.0 2.1 2.8.2.2.5.3.7.4.2.2.3.5.6.7.5.4 1.4.8 2.0 1.6.1.2.2.4.4.6.4.5 1.1 1.8 1.8 2.0.0.0.2.0.3-.0" fill="#da687d"/>
+  </g>
+  <g opacity=".7" transform="matrix(1.25 0 0 -1.25 -26.846 640)">
+    <path d="M459.8 349.4c.6-1.9.7-4.1.9-6.2-.0-2.1-.1-4.5-.7-6.9.0-.4-.1-1.1-.1-1.6-.5-.7-.2-1.2-.4-1.8.7-.8 1.6-1.6 1.1-2.8-.3-.8-1.1-1.0-1.8-1.4-.6-1.9-1.2-4.2-1.8-6.3-.1-.6-.2-1.3-.4-1.9-.5-1.3-1.1-2.6-1.5-4.1-.4-1.2-.3-3.4-1.6-3.6-.6-1.3-.9-2.3-1.6-3.6-.3-.2-.5.1-.8-.0-.3-.4-.4-1.0-.7-1.4-.2-.2-.5-.2-.7-.5-.4-.6-.3-1.5-.7-2.4a6.5 6.5 0 0 1-1.1-1.3l-.1-.2-.0-.1-.0-.0-.0-.0v-.0l.0.1-.0-.0-.0-.0-.0-.0-.0-.0-.0-.0c-.6-1.6-.8-3.6-1.8-4.9-.3-.4-.8-.5-1.1-.9-.2-.3-.4-.9-.7-1.3-.3-.6-.7-1.4-1.0-2.1-1.0-2.4-2.5-5.2-3.5-8.0-.1-.5-.2-1.1-.3-1.6-.4-1.1-1.0-2.2-1.3-3.3-.6-1.7-1.4-4.7-3.0-6.3-.1-.2-.5-.4-.7-.6-.2-.3-.1-.7-.4-1.1-.1-.1-.4-.2-.6-.4-.2-.3-.3-.6-.5-.9-.5-.5-1.2-.8-1.7-1.4-.3-.4-.5-1.0-.9-1.5-.4-.5-.9-1.1-1.4-1.6l-1.8-2.6c-.5-.8-1.2-1.5-2.0-1.8-.4-.2-1.0-.1-1.5-.2-.3.4.0 1.0.0 1.5-.0.2-.2.5-.2.7-.0.6-.1 1.7-.0 2.3.0.6.5 1.1.7 2.0.1.7-.0 1.5-.0 2.3.0.3.1.7.1 1.2.0.6-.0.9.1 1.7.1.9-.0 1.8-.1 2.7.4 2.1.6 3.8 1.2 6.3.2 1.1.7 3.1 1.2 4.4.4 1.3.9 2.6 1.3 4.0.4 1.4.9 2.8 1.4 4.2.3.9.8 1.7 1.2 2.7.2.5.2 1.1.4 1.7.4 1.2.9 2.5 1.5 3.6a147.5 147.5 0 0 0 1.7 3.3l.9 1.8c.3.5.6 1.1.9 1.7a75.5 75.5 0 0 1 1.8 3.6 129.6 129.6 0 0 0 3.1 5.7 340.1 340.1 0 0 0 3.6 5.8c1.1 1.8 2.2 3.8 3.3 5.3.8 1.1 2.1 3.1 3.0 5.1.3.7.3 1.3 1.1 1.4.9 1.2 1.6 2.6 2.4 3.7.2.2.5.4.8.7.2.3.4.7.6 1.0.5.6 1.6 1.2 2.2 2.5.1.3.1.6.3 1.0.3.8 1.0 2.7 1.7 3.1.0.0.2.0.3.0" fill="#da687d"/>
+  </g>
+  <path d="M520.8 231.2s-10 38.3-5.8 70l5.8-70m11.8-25.9c-.7-2.6-5.7 74.3-4.2 77.0 1.4 2.6 8.9-60.7 4.2-77.0" fill="#fff"/>
+  <path d="M294.0 57.9s5.8 33.2-48.3 50.7-128.8 32.4-183.8 98.3c-55 65.8-65 174.9-27.5 246.6 37.5 71.6 129.1 160.8 294.1 160.8S624.6 487.7 624.6 400.2c0-45.8-25.1-35.6-33.8 7.3-7.8 38.8-80.5 183.6-263.0 183.6-182.5 0-275.8-110.8-287.5-205.8-11.6-95 14.8-176.8 110.7-226.0 95.8-49.1 156.6-29.5 143.3-101.2" fill="#2d2b2c"/>
+  <path d="M248.5 314.5s-10.8 50.0-63.3 74.1c-52.5 24.1-75 37.5-82.5 79.1 20-33.3 78.3-40 110.8-72.5s35-80.8 35-80.8m14.1-115.8s45 58.3 98.3 30c53.3-28.3 25.8-94.1 25-98.3-.8-4.1 5.8 73.3-34.1 86.6-40 13.3-89.1-18.3-89.1-18.3M145.2 547.0s28.3 1.6 49.1-21.6c20.8-23.3 9.1-60 43.3-73.3 34.1-13.3 57.5-5 57.5-5s-60.8 8.3-65.8 43.3-13.3 50.8-26.6 61.6c-13.3 10.8-30.8 12.5-30.8 12.5l-26.6-17.5z" fill="#2d2b2c"/>
+  <path d="M273.7 365.6s50.6-8.4 73.7-60c18.9-42.2 6.2-78.7 6.2-78.7l-25.6 3.7s10.6 30.6 2.5 58.1-26.8 59.3-56.8 76.8m272.6-117.0c-18.0 45.1-44.7 77.5-47.8 75.8-5.6-3.1-.4-42.5 17.6-87.7 18.0-45.1 40.5-79.5 48.8-76.2 8.3 3.2-.6 42.9-18.6 88.1m26.2-90.6c-20.5-11.1-45.8 30.5-66.5 79.1-20.7 48.6-23.1 87.7-7.1 94.7 21.3 9.3 41.4-27.8 62.1-76.4s30-87.5 11.5-97.5" fill="#2d2b2c"/>
+  <path d="M199.4 402.9s12.9 38.7 77.5 30.8c60.8-7.5 86.9-30.9 124.1-54.1 26.6-16.6 25-9.1 28.3-8.3 3.3.8 18.3 10 34.1 8.3.8 8.3-7.4 1.6-10.8 9.1-1.6 5 12.6 28.5 33.3 25 34.1-5.8 24.5-20 31.2-35.8 6.6-15.8 11.2-24.1-22.0-46.6-25.8-23.3-40-17.4-52.5-17.4s-45 17.4-67.5 13.3-36.6-12.5-36.6-12.5l-14.9 16.6s27.4 20.8 59.1 13.3c31.6-7.5 55.0-31.6 82.5-19.1 27.5 12.5 32.8 20.8 41.2 27.0 9.5 7.0 10.4 14.5 3.7 21.2-6.6 6.6.0 11.6-4.1 19.1-4.1 7.5-25 10.8-25 10.8s22.8-29.3-5-31.6c-20-1.6-32.5-28.3-60.8-14.1-40.6 20.3-98.3 55-138.3 59.1-38.9 4.0-53.3-8.3-63.3-31.6-11.6 10-14.1 17.5-14.1 17.5" fill="#2d2b2c"/>
+  <path d="M342.7 411.2s28.3 15 20 47.5-45.8 55-70 65.8c-24.1 10.8-42.1 25.1-24.1 34.1 15 7.5 23.3-11.6 45-15 21.6-3.3 40.8 5 42.5 17.5-9.1-5-15.8-5-15.8-5s7.5 5 8.3 13.3c.8 8.3-.8 4.1-5.8 4.1-12.5 0-14.1-10.8-25-9.1-27.5 2.5-29.1 14.1-44.1 15.8-15 1.6-40-6.6-36.6-25.8 3.3-19.1 29.1-32.5 53.3-42.5 24.1-10 60.8-41.6 55.8-70-5-28.3-26.6-22.5-26.6-22.5l23.3-8.3zm71.0-235.9s11.8 5.9 19.3 35.9c5 10.8 11.6 19.5 17.5 22.0 5.8 2.5-2.5 5-6.6 4.1-4.1-.8-12.9-4.5-18.7.4s-20 18.3-40 15c-20-3.3-37.0-16.0-37.0-16.0s7.5 33.1 52.0 31.0c30.9-1.4 24.1-17.5 45-20.8 20.8-3.3 18.6-13.8 14.1-22.5-7.0-13.7-29.1-17.0-31.6-57.2-2.5-4.1-18.1.5-13.9 8.0m71.2 209.1c1.8 1.8-14.7 39.3-14.7 39.3s-3.3 9.1-12.2 5.9c-9.1-3.3-6.7-9.9-6.7-9.9l21.2-38.5s11.6 2.3 12.5 3.2m23.4-53.3l-4.1 12.5-13.6-10.4 3.6-7.9 14.1 5.8z" fill="#2d2b2c"/>
+  <path d="M356.0 403.7c-2.5 9.1 29.1 62.5 50.8 59.1 21.6-3.3 24.9 3.3 18.3 7.5-6.6 4.1-18.3 5.8-16.6 11.6 1.6 5.8 6.2 11.6-4.5 10-10.8-1.6-32.9-13.3-46.2-35.8-4.1 13.3-5.8 17.5-5.8 17.5s42.5 44.1 85.8 25.8c-7.5-5.8-28.3-4.1-10.8-14.1s30.8-13.3 39.1 2.5c4.1-.8 4.1-37.5-50.8-35-19.1-2.5-45-40-45-59.1-5 5-11.6.8-14.1 10m169.4-184.3s-10.9 32.8-6.3 60l6.3-60m11.2-19.4c-.5-2.0-5.0 57.2-4.0 59.2 1.0 2.0 7.3-46.6 4.0-59.2m-145.6-32.8s47.0-4.1 38.7-22.9c-25.1-56.5-72.9-89.5-161.2-86.2 50-20 92.5-17.5 133.3 17.5 20.4 17.5 29.8 38.8 37.1 55.1 11.6 26 8.2 28.4-4.6 35.7-15.7 8.8-42.7 3.2-43.3.8" fill="#2d2b2c"/>
+  <path d="M395.8 174.2s12.9 8.9 23.1 1.6c4.6-4.8 7.7-7.4-5.4-6.8l-16.1-.6c-11.1-2.2-10.9 1.1-1.5 5.8z" fill="#2d2b2c"/>
+</svg>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/manual.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,3761 @@
+<!doctype html>
+
+<title>CodeMirror 5 User Manual</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+<script src="activebookmark.js"></script>
+
+<script src="../lib/codemirror.js"></script>
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../addon/runmode/runmode.js"></script>
+<script src="../addon/runmode/colorize.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../mode/css/css.js"></script>
+<script src="../mode/htmlmixed/htmlmixed.js"></script>
+<style>
+  dt { text-indent: -2em; padding-left: 2em; margin-top: 1em; }
+  dd { margin-left: 1.5em; margin-bottom: 1em; }
+  dt {margin-top: 1em;}
+  dd dl, dd dt, dd dd, dd ul { margin-top: 0; margin-bottom: 0; }
+  dt + dt { margin-top: 0; }
+  dt.command { position: relative; }
+  span.keybinding { position: absolute; right: 0; font-size: 80%; color: #555; text-indent: 0; }
+</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+  <ul>
+    <li><a href="../index.html">Home</a></li>
+    <li><a href="#overview" class=active data-default="true">Manual</a></li>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a></li>
+  </ul>
+  <ul>
+    <li><a href="#usage">Basic Usage</a></li>
+    <li><a href="#config">Configuration</a></li>
+    <li><a href="#events">Events</a></li>
+    <li><a href="#keymaps">Key maps</a></li>
+    <li><a href="#commands">Commands</a></li>
+    <li><a href="#styling">Customized Styling</a></li>
+    <li><a href="#api">Programming API</a>
+      <ul>
+        <li><a href="#api_constructor">Constructor</a></li>
+        <li><a href="#api_content">Content manipulation</a></li>
+        <li><a href="#api_selection">Selection</a></li>
+        <li><a href="#api_configuration">Configuration</a></li>
+        <li><a href="#api_doc">Document management</a></li>
+        <li><a href="#api_history">History</a></li>
+        <li><a href="#api_marker">Text-marking</a></li>
+        <li><a href="#api_decoration">Widget, gutter, and decoration</a></li>
+        <li><a href="#api_sizing">Sizing, scrolling, and positioning</a></li>
+        <li><a href="#api_mode">Mode, state, and tokens</a></li>
+        <li><a href="#api_misc">Miscellaneous methods</a></li>
+        <li><a href="#api_static">Static properties</a></li>
+      </ul>
+    </li>
+    <li><a href="#addons">Addons</a></li>
+    <li><a href="#modeapi">Writing CodeMirror Modes</a></li>
+    <li><a href="#vimapi">Vim Mode API</a>
+      <ul>
+        <li><a href="#vimapi_configuration">Configuration</a></li>
+        <li><a href="#vimapi_events">Events</a></li>
+        <li><a href="#vimapi_extending">Extending VIM</a></li>
+      </ul>
+    </li>
+  </ul>
+</div>
+
+<article>
+
+<section class=first id=overview>
+    <h2 style="position: relative">
+      User manual and reference guide
+      <span style="color: #888; font-size: 1rem; position: absolute; right: 0; bottom: 0">version 5.65.18</span>
+    </h2>
+
+    <p>CodeMirror is a code-editor component that can be embedded in
+    Web pages. The core library provides <em>only</em> the editor
+    component, no accompanying buttons, auto-completion, or other IDE
+    functionality. It does provide a rich API on top of which such
+    functionality can be straightforwardly implemented. See
+    the <a href="#addons">addons</a> included in the distribution,
+    and <a href="https://npms.io/search?q=codemirror">3rd party
+    packages on npm</a>, for reusable implementations of extra
+    features.</p>
+
+    <p>CodeMirror works with language-specific modes. Modes are
+    JavaScript programs that help color (and optionally indent) text
+    written in a given language. The distribution comes with a number
+    of modes (see the <a href="../mode/"><code>mode/</code></a>
+    directory), and it isn't hard to <a href="#modeapi">write new
+    ones</a> for other languages.</p>
+</section>
+
+<section id=usage>
+    <h2>Basic Usage</h2>
+
+    <p>The easiest way to use CodeMirror is to simply load the script
+    and style sheet found under <code>lib/</code> in the distribution,
+    plus a mode script from one of the <code>mode/</code> directories.
+    For example:</p>
+
+    <pre data-lang="text/html">&lt;script src="lib/codemirror.js">&lt;/script>
+&lt;link rel="stylesheet" href="lib/codemirror.css">
+&lt;script src="mode/javascript/javascript.js">&lt;/script></pre>
+
+    <p>(Alternatively, use a module loader. <a href="#modloader">More
+    about that later.</a>)</p>
+
+    <p>Having done this, an editor instance can be created like
+    this:</p>
+
+    <pre data-lang="javascript">var myCodeMirror = CodeMirror(document.body);</pre>
+
+    <p>The editor will be appended to the document body, will start
+    empty, and will use the mode that we loaded. To have more control
+    over the new editor, a configuration object can be passed
+    to <a href="#CodeMirror"><code>CodeMirror</code></a> as a second
+    argument:</p>
+
+    <pre data-lang="javascript">var myCodeMirror = CodeMirror(document.body, {
+  value: "function myScript(){return 100;}\n",
+  mode:  "javascript"
+});</pre>
+
+    <p>This will initialize the editor with a piece of code already in
+    it, and explicitly tell it to use the JavaScript mode (which is
+    useful when multiple modes are loaded).
+    See <a href="#config">below</a> for a full discussion of the
+    configuration options that CodeMirror accepts.</p>
+
+    <p>In cases where you don't want to append the editor to an
+    element, and need more control over the way it is inserted, the
+    first argument to the <code>CodeMirror</code> function can also
+    be a function that, when given a DOM element, inserts it into the
+    document somewhere. This could be used to, for example, replace a
+    textarea with a real editor:</p>
+
+    <pre data-lang="javascript">var myCodeMirror = CodeMirror(function(elt) {
+  myTextArea.parentNode.replaceChild(elt, myTextArea);
+}, {value: myTextArea.value});</pre>
+
+    <p>However, for this use case, which is a common way to use
+    CodeMirror, the library provides a much more powerful
+    shortcut:</p>
+
+    <pre data-lang="javascript">var myCodeMirror = CodeMirror.fromTextArea(myTextArea);</pre>
+
+    <p>This will, among other things, ensure that the textarea's value
+    is updated with the editor's contents when the form (if it is part
+    of a form) is submitted. See the <a href="#fromTextArea">API
+    reference</a> for a full description of this method.</p>
+
+    <h3 id=modloader>Module loaders</h3>
+
+    <p>The files in the CodeMirror distribution contain shims for
+    loading them (and their dependencies) in AMD or CommonJS
+    environments. If the variables <code>exports</code>
+    and <code>module</code> exist and have type object, CommonJS-style
+    require will be used. If not, but there is a
+    function <code>define</code> with an <code>amd</code> property
+    present, AMD-style (RequireJS) will be used.</p>
+
+    <p>It is possible to
+    use <a href="http://browserify.org/">Browserify</a> or similar
+    tools to statically build modules using CodeMirror. Alternatively,
+    use <a href="http://requirejs.org/">RequireJS</a> to dynamically
+    load dependencies at runtime. Both of these approaches have the
+    advantage that they don't use the global namespace and can, thus,
+    do things like load multiple versions of CodeMirror alongside each
+    other.</p>
+
+    <p>Here's a simple example of using RequireJS to load CodeMirror:</p>
+
+    <pre data-lang="javascript">require([
+  "cm/lib/codemirror", "cm/mode/htmlmixed/htmlmixed"
+], function(CodeMirror) {
+  CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    mode: "htmlmixed"
+  });
+});</pre>
+
+    <p>It will automatically load the modes that the mixed HTML mode
+    depends on (XML, JavaScript, and CSS). Do <em>not</em> use
+    RequireJS' <code>paths</code> option to configure the path to
+    CodeMirror, since it will break loading submodules through
+    relative paths. Use
+    the <a href="http://requirejs.org/docs/api.html#packages"><code>packages</code></a>
+    configuration option instead, as in:</p>
+
+    <pre data-lang=javascript>require.config({
+  packages: [{
+    name: "codemirror",
+    location: "../path/to/codemirror",
+    main: "lib/codemirror"
+  }]
+});</pre>
+
+</section>
+
+<section id=config>
+    <h2>Configuration</h2>
+
+    <p>Both the <a href="#CodeMirror"><code>CodeMirror</code></a>
+    function and its <code>fromTextArea</code> method take as second
+    (optional) argument an object containing configuration options.
+    Any option not supplied like this will be taken
+    from <a href="#defaults"><code>CodeMirror.defaults</code></a>, an
+    object containing the default options. You can update this object
+    to change the defaults on your page.</p>
+
+    <p>Options are not checked in any way, so setting bogus option
+    values is bound to lead to odd errors.</p>
+
+    <p>These are the supported options:</p>
+
+    <dl>
+      <dt id="option_value"><code><strong>value</strong>: string|CodeMirror.Doc</code></dt>
+      <dd>The starting value of the editor. Can be a string, or
+      a <a href="#api_doc">document object</a>.</dd>
+
+      <dt id="option_mode"><code><strong>mode</strong>: string|object</code></dt>
+      <dd>The mode to use. When not given, this will default to the
+      first mode that was loaded. It may be a string, which either
+      simply names the mode or is
+      a <a href="http://en.wikipedia.org/wiki/MIME">MIME</a> type
+      associated with the mode. The value <code>"null"</code>
+      indicates no highlighting should be applied. Alternatively, it
+      may be an object containing configuration options for the mode,
+      with a <code>name</code> property that names the mode (for
+      example <code>{name: "javascript", json: true}</code>). The demo
+      pages for each mode contain information about what configuration
+      parameters the mode supports. You can ask CodeMirror which modes
+      and MIME types have been defined by inspecting
+      the <code>CodeMirror.modes</code>
+      and <code>CodeMirror.mimeModes</code> objects. The first maps
+      mode names to their constructors, and the second maps MIME types
+      to mode specs.</dd>
+
+      <dt id="option_lineSeparator"><code><strong>lineSeparator</strong>: string|null</code></dt>
+      <dd>Explicitly set the line separator for the editor. By default
+      (value <code>null</code>), the document will be split on CRLFs
+      as well as lone CRs and LFs, and a single LF will be used as
+      line separator in all output (such
+      as <a href="#getValue"><code>getValue</code></a>). When a
+      specific string is given, lines will only be split on that
+      string, and output will, by default, use that same
+      separator.</dd>
+
+      <dt id="option_theme"><code><strong>theme</strong>: string</code></dt>
+      <dd>The theme to style the editor with. You must make sure the
+      CSS file defining the corresponding <code>.cm-s-[name]</code>
+      styles is loaded (see
+      the <a href="../theme/"><code>theme</code></a> directory in the
+      distribution). The default is <code>"default"</code>, for which
+      colors are included in <code>codemirror.css</code>. It is
+      possible to use multiple theming classes at once—for
+      example <code>"foo bar"</code> will assign both
+      the <code>cm-s-foo</code> and the <code>cm-s-bar</code> classes
+      to the editor.</dd>
+
+      <dt id="option_indentUnit"><code><strong>indentUnit</strong>: integer</code></dt>
+      <dd>How many spaces a block (whatever that means in the edited
+      language) should be indented. The default is 2.</dd>
+
+      <dt id="option_smartIndent"><code><strong>smartIndent</strong>: boolean</code></dt>
+      <dd>Whether to use the context-sensitive indentation that the
+      mode provides (or just indent the same as the line before).
+      Defaults to true.</dd>
+
+      <dt id="option_tabSize"><code><strong>tabSize</strong>: integer</code></dt>
+      <dd>The width of a tab character. Defaults to 4.</dd>
+
+      <dt id="option_indentWithTabs"><code><strong>indentWithTabs</strong>: boolean</code></dt>
+      <dd>Whether, when indenting, the first N*<code>tabSize</code>
+      spaces should be replaced by N tabs. Default is false.</dd>
+
+      <dt id="option_electricChars"><code><strong>electricChars</strong>: boolean</code></dt>
+      <dd>Configures whether the editor should re-indent the current
+      line when a character is typed that might change its proper
+      indentation (only works if the mode supports indentation).
+      Default is true.</dd>
+
+      <dt id="option_specialChars"><code><strong>specialChars</strong>: RegExp</code></dt>
+      <dd>A regular expression used to determine which characters
+      should be replaced by a
+      special <a href="#option_specialCharPlaceholder">placeholder</a>.
+      Mostly useful for non-printing special characters. The default
+      is <code>/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/</code>.</dd>
+      <dt id="option_specialCharPlaceholder"><code><strong>specialCharPlaceholder</strong>: function(char) → Element</code></dt>
+      <dd>A function that, given a special character identified by
+      the <a href="#option_specialChars"><code>specialChars</code></a>
+      option, produces a DOM node that is used to represent the
+      character. By default, a red dot (<span style="color: red">•</span>)
+      is shown, with a title tooltip to indicate the character code.</dd>
+
+      <dt id="option_direction"><code><strong>direction</strong>: "ltr" | "rtl"</code></dt>
+      <dd>Flips overall layout and selects base paragraph direction to
+      be left-to-right or right-to-left.  Default is "ltr".
+      CodeMirror applies the Unicode Bidirectional Algorithm to each
+      line, but does not autodetect base direction — it's set to the
+      editor direction for all lines.  The resulting order is
+      sometimes wrong when base direction doesn't match user intent
+      (for example, leading and trailing punctuation jumps to the
+      wrong side of the line).  Therefore, it's helpful for
+      multilingual input to let users toggle this option.
+
+      <dt id="option_rtlMoveVisually"><code><strong>rtlMoveVisually</strong>: boolean</code></dt>
+      <dd>Determines whether horizontal cursor movement through
+      right-to-left (Arabic, Hebrew) text is visual (pressing the left
+      arrow moves the cursor left) or logical (pressing the left arrow
+      moves to the next lower index in the string, which is visually
+      right in right-to-left text). The default is <code>false</code>
+      on Windows, and <code>true</code> on other platforms.</dd>
+
+      <dt id="option_keyMap"><code><strong>keyMap</strong>: string</code></dt>
+      <dd>Configures the key map to use. The default
+      is <code>"default"</code>, which is the only key map defined
+      in <code>codemirror.js</code> itself. Extra key maps are found in
+      the <a href="../keymap/"><code>key map</code></a> directory. See
+      the <a href="#keymaps">section on key maps</a> for more
+      information.</dd>
+
+      <dt id="option_extraKeys"><code><strong>extraKeys</strong>: object</code></dt>
+      <dd>Can be used to specify extra key bindings for the editor,
+      alongside the ones defined
+      by <a href="#option_keyMap"><code>keyMap</code></a>. Should be
+      either null, or a valid <a href="#keymaps">key map</a> value.</dd>
+
+      <dt id="option_configureMouse"><code><strong>configureMouse</strong>: fn(cm: CodeMirror, repeat: "single" | "double" | "triple", event: Event) → Object</code></dt>
+      <dd>Allows you to configure the behavior of mouse selection and
+      dragging. The function is called when the left mouse button is
+      pressed. The returned object may have the following properties:
+        <dl>
+          <dt><code><strong>unit</strong>: "char" | "word" | "line" | "rectangle" | fn(CodeMirror, Pos) → {from: Pos, to: Pos}</code></dt>
+          <dd>The unit by which to select. May be one of the built-in
+          units or a function that takes a position and returns a
+          range around that, for a custom unit. The default is to
+          return <code>"word"</code> for double
+          clicks, <code>"line"</code> for triple
+          clicks, <code>"rectangle"</code> for alt-clicks (or, on
+          Chrome OS, meta-shift-clicks), and <code>"single"</code>
+          otherwise.</dd>
+          <dt><code><strong>extend</strong>: bool</code></dt>
+          <dd>Whether to extend the existing selection range or start
+          a new one. By default, this is enabled when shift
+          clicking.</dd>
+          <dt><code><strong>addNew</strong>: bool</code></dt>
+          <dd>When enabled, this adds a new range to the existing
+          selection, rather than replacing it. The default behavior is
+          to enable this for command-click on Mac OS, and
+          control-click on other platforms.</dd>
+          <dt><code><strong>moveOnDrag</strong>: bool</code></dt>
+          <dd>When the mouse even drags content around inside the
+          editor, this controls whether it is copied (false) or moved
+          (true). By default, this is enabled by alt-clicking on Mac
+          OS, and ctrl-clicking elsewhere.</dd>
+        </dl>
+      </dd>
+
+      <dt id="option_lineWrapping"><code><strong>lineWrapping</strong>: boolean</code></dt>
+      <dd>Whether CodeMirror should scroll or wrap for long lines.
+      Defaults to <code>false</code> (scroll).</dd>
+
+      <dt id="option_lineNumbers"><code><strong>lineNumbers</strong>: boolean</code></dt>
+      <dd>Whether to show line numbers to the left of the editor.</dd>
+
+      <dt id="option_firstLineNumber"><code><strong>firstLineNumber</strong>: integer</code></dt>
+      <dd>At which number to start counting lines. Default is 1.</dd>
+
+      <dt id="option_lineNumberFormatter"><code><strong>lineNumberFormatter</strong>: function(line: integer) → string</code></dt>
+      <dd>A function used to format line numbers. The function is
+      passed the line number, and should return a string that will be
+      shown in the gutter.</dd>
+
+      <dt id="option_gutters"><code><strong>gutters</strong>: array&lt;string | {className: string, style: ?string}&gt;</code></dt>
+      <dd>Can be used to add extra gutters (beyond or instead of the
+      line number gutter). Should be an array of CSS class names or
+      class name / CSS string pairs, each of which defines
+      a <code>width</code> (and optionally a background), and which
+      will be used to draw the background of the gutters. <em>May</em>
+      include the <code>CodeMirror-linenumbers</code> class, in order
+      to explicitly set the position of the line number gutter (it
+      will default to be to the right of all other gutters). These
+      class names are the keys passed
+      to <a href="#setGutterMarker"><code>setGutterMarker</code></a>.</dd>
+
+      <dt id="option_fixedGutter"><code><strong>fixedGutter</strong>: boolean</code></dt>
+      <dd>Determines whether the gutter scrolls along with the content
+      horizontally (false) or whether it stays fixed during horizontal
+      scrolling (true, the default).</dd>
+
+      <dt id="option_scrollbarStyle"><code><strong>scrollbarStyle</strong>: string</code></dt>
+      <dd>Chooses a scrollbar implementation. The default
+      is <code>"native"</code>, showing native scrollbars. The core
+      library also provides the <code>"null"</code> style, which
+      completely hides the
+      scrollbars. <a href="#addon_simplescrollbars">Addons</a> can
+      implement additional scrollbar models.</dd>
+
+      <dt id="option_coverGutterNextToScrollbar"><code><strong>coverGutterNextToScrollbar</strong>: boolean</code></dt>
+      <dd>When <a href="#option_fixedGutter"><code>fixedGutter</code></a>
+      is on, and there is a horizontal scrollbar, by default the
+      gutter will be visible to the left of this scrollbar. If this
+      option is set to true, it will be covered by an element with
+      class <code>CodeMirror-gutter-filler</code>.</dd>
+
+      <dt id="option_inputStyle"><code><strong>inputStyle</strong>: string</code></dt>
+      <dd>Selects the way CodeMirror handles input and focus. The core
+      library defines the <code>"textarea"</code>
+      and <code>"contenteditable"</code> input models. On mobile
+      browsers, the default is <code>"contenteditable"</code>. On
+      desktop browsers, the default is <code>"textarea"</code>.
+      Support for IME and screen readers is better in
+      the <code>"contenteditable"</code> model. The intention is to
+      make it the default on modern desktop browsers in the
+      future.</dd>
+
+      <dt id="option_readOnly"><code><strong>readOnly</strong>: boolean|string</code></dt>
+      <dd>This disables editing of the editor content by the user. If
+      the special value <code>"nocursor"</code> is given (instead of
+      simply <code>true</code>), focusing of the editor is also
+      disallowed.</dd>
+
+      <dt id="option_screenReaderLabel"><code><strong>screenReaderLabel</strong>: string</code></dt>
+      <dd>This label is read by the screenreaders when CodeMirror text area is focused. This
+      is helpful for accessibility.</dd>
+
+      <dt id="option_showCursorWhenSelecting"><code><strong>showCursorWhenSelecting</strong>: boolean</code></dt>
+      <dd>Whether the cursor should be drawn when a selection is
+      active. Defaults to false.</dd>
+
+      <dt id="option_lineWiseCopyCut"><code><strong>lineWiseCopyCut</strong>: boolean</code></dt>
+      <dd>When enabled, which is the default, doing copy or cut when
+      there is no selection will copy or cut the whole lines that have
+      cursors on them.</dd>
+
+      <dt id="option_pasteLinesPerSelection"><code><strong>pasteLinesPerSelection</strong>: boolean</code></dt>
+      <dd>When pasting something from an external source (not from the
+      editor itself), if the number of lines matches the number of
+      selection, CodeMirror will by default insert one line per
+      selection. You can set this to <code>false</code> to disable
+      that behavior.</dd>
+
+      <dt id="option_selectionsMayTouch"><code><strong>selectionsMayTouch</strong>: boolean</code></dt>
+      <dd>Determines whether multiple selections are joined as soon as
+      they touch (the default) or only when they overlap (true).</dd>
+
+      <dt id="option_undoDepth"><code><strong>undoDepth</strong>: integer</code></dt>
+      <dd>The maximum number of undo levels that the editor stores.
+      Note that this includes selection change events. Defaults to
+      200.</dd>
+
+      <dt id="option_historyEventDelay"><code><strong>historyEventDelay</strong>: integer</code></dt>
+      <dd>The period of inactivity (in milliseconds) that will cause a
+      new history event to be started when typing or deleting.
+      Defaults to 1250.</dd>
+
+      <dt id="option_tabindex"><code><strong>tabindex</strong>: integer</code></dt>
+      <dd>The <a href="http://www.w3.org/TR/html401/interact/forms.html#adef-tabindex">tab
+      index</a> to assign to the editor. If not given, no tab index
+      will be assigned.</dd>
+
+      <dt id="option_autofocus"><code><strong>autofocus</strong>: boolean</code></dt>
+      <dd>Can be used to make CodeMirror focus itself on
+      initialization. Defaults to off.
+      When <a href="#fromTextArea"><code>fromTextArea</code></a> is
+      used, and no explicit value is given for this option, it will be
+      set to true when either the source textarea is focused, or it
+      has an <code>autofocus</code> attribute and no other element is
+      focused.</dd>
+
+      <dt id="option_phrases"><code><strong>phrases</strong>: ?object</code></dt>
+      <dd>Some addons run user-visible strings (such as labels in the
+      interface) through the <a href="#phrase"><code>phrase</code></a>
+      method to allow for translation. This option determines the
+      return value of that method. When it is null or an object that
+      doesn't have a property named by the input string, that string
+      is returned. Otherwise, the value of the property corresponding
+      to that string is returned.</dd>
+    </dl>
+
+    <p>Below this a few more specialized, low-level options are
+    listed. These are only useful in very specific situations, you
+    might want to skip them the first time you read this manual.</p>
+
+    <dl>
+      <dt id="option_dragDrop"><code><strong>dragDrop</strong>: boolean</code></dt>
+      <dd>Controls whether drag-and-drop is enabled. On by default.</dd>
+
+      <dt id="option_allowDropFileTypes"><code><strong>allowDropFileTypes</strong>: array&lt;string&gt;</code></dt>
+      <dd>When set (default is <code>null</code>) only files whose
+      type is in the array can be dropped into the editor. The strings
+      should be MIME types, and will be checked against
+      the <a href="https://w3c.github.io/FileAPI/#dfn-type"><code>type</code></a>
+      of the <code>File</code> object as reported by the browser.</dd>
+
+      <dt id="option_cursorBlinkRate"><code><strong>cursorBlinkRate</strong>: number</code></dt>
+      <dd>Half-period in milliseconds used for cursor blinking. The default blink
+      rate is 530ms. By setting this to zero, blinking can be disabled. A
+      negative value hides the cursor entirely.</dd>
+
+      <dt id="option_cursorScrollMargin"><code><strong>cursorScrollMargin</strong>: number</code></dt>
+      <dd>How much extra space to always keep above and below the
+      cursor when approaching the top or bottom of the visible view in
+      a scrollable document. Default is 0.</dd>
+
+      <dt id="option_cursorHeight"><code><strong>cursorHeight</strong>: number</code></dt>
+      <dd>Determines the height of the cursor. Default is 1, meaning
+      it spans the whole height of the line. For some fonts (and by
+      some tastes) a smaller height (for example <code>0.85</code>),
+      which causes the cursor to not reach all the way to the bottom
+      of the line, looks better</dd>
+
+      <dt id="option_singleCursorHeightPerLine"><code><strong>singleCursorHeightPerLine</strong>: boolean</code></dt>
+      <dd>If set to <code>true</code> (the default), will keep the
+      cursor height constant for an entire line (or wrapped part of a
+      line). When <code>false</code>, the cursor's height is based on
+      the height of the adjacent reference character.</dd>
+
+      <dt id="option_resetSelectionOnContextMenu"><code><strong>resetSelectionOnContextMenu</strong>: boolean</code></dt>
+      <dd>Controls whether, when the context menu is opened with a
+      click outside of the current selection, the cursor is moved to
+      the point of the click. Defaults to <code>true</code>.</dd>
+
+      <dt id="option_workTime"><code id="option_wordkDelay"><strong>workTime</strong>, <strong>workDelay</strong>: number</code></dt>
+      <dd>Highlighting is done by a pseudo background-thread that will
+      work for <code>workTime</code> milliseconds, and then use
+      timeout to sleep for <code>workDelay</code> milliseconds. The
+      defaults are 200 and 300, you can change these options to make
+      the highlighting more or less aggressive.</dd>
+
+      <dt id="option_pollInterval"><code><strong>pollInterval</strong>: number</code></dt>
+      <dd>Indicates how quickly CodeMirror should poll its input
+      textarea for changes (when focused). Most input is captured by
+      events, but some things, like IME input on some browsers, don't
+      generate events that allow CodeMirror to properly detect it.
+      Thus, it polls. Default is 100 milliseconds.</dd>
+
+      <dt id="option_flattenSpans"><code><strong>flattenSpans</strong>: boolean</code></dt>
+      <dd>By default, CodeMirror will combine adjacent tokens into a
+      single span if they have the same class. This will result in a
+      simpler DOM tree, and thus perform better. With some kinds of
+      styling (such as rounded corners), this will change the way the
+      document looks. You can set this option to false to disable this
+      behavior.</dd>
+
+      <dt id="option_addModeClass"><code><strong>addModeClass</strong>: boolean</code></dt>
+      <dd>When enabled (off by default), an extra CSS class will be
+      added to each token, indicating the
+      (<a href="#innerMode">inner</a>) mode that produced it, prefixed
+      with <code>"cm-m-"</code>. For example, tokens from the XML mode
+      will get the <code>cm-m-xml</code> class.</dd>
+
+      <dt id="option_maxHighlightLength"><code><strong>maxHighlightLength</strong>: number</code></dt>
+      <dd>When highlighting long lines, in order to stay responsive,
+      the editor will give up and simply style the rest of the line as
+      plain text when it reaches a certain position. The default is
+      10 000. You can set this to <code>Infinity</code> to turn off
+      this behavior.</dd>
+
+      <dt id="option_viewportMargin"><code><strong>viewportMargin</strong>: integer</code></dt>
+      <dd>Specifies the amount of lines that are rendered above and
+      below the part of the document that's currently scrolled into
+      view. This affects the amount of updates needed when scrolling,
+      and the amount of work that such an update does. You should
+      usually leave it at its default, 10. Can be set
+      to <code>Infinity</code> to make sure the whole document is
+      always rendered, and thus the browser's text search works on it.
+      This <em>will</em> have bad effects on performance of big
+      documents.</dd>
+
+      <dt id="option_spellcheck"><code><strong>spellcheck</strong>: boolean</code></dt>
+      <dd>Specifies whether or not spellcheck will be enabled on the input.</dd>
+
+      <dt id="option_autocorrect"><code><strong>autocorrect</strong>: boolean</code></dt>
+      <dd>Specifies whether or not autocorrect will be enabled on the input.</dd>
+
+      <dt id="option_autocapitalize"><code><strong>autocapitalize</strong>: boolean</code></dt>
+      <dd>Specifies whether or not autocapitalization will be enabled on the input.</dd>
+    </dl>
+</section>
+
+<section id=events>
+    <h2>Events</h2>
+
+    <p>Various CodeMirror-related objects emit events, which allow
+    client code to react to various situations. Handlers for such
+    events can be registered with the <a href="#on"><code>on</code></a>
+    and <a href="#off"><code>off</code></a> methods on the objects
+    that the event fires on. To fire your own events,
+    use <code>CodeMirror.signal(target, name, args...)</code>,
+    where <code>target</code> is a non-DOM-node object.</p>
+
+    <p>An editor instance fires the following events.
+    The <code>instance</code> argument always refers to the editor
+    itself.</p>
+
+    <dl>
+      <dt id="event_change"><code><strong>"change"</strong> (instance: CodeMirror, changeObj: object)</code></dt>
+      <dd>Fires every time the content of the editor is changed.
+      The <code>changeObj</code> is a <code>{from, to, text, removed,
+      origin}</code> object containing information about the changes
+      that occurred as second argument. <code>from</code>
+      and <code>to</code> are the positions (in the pre-change
+      coordinate system) where the change started and ended (for
+      example, it might be <code>{ch:0, line:18}</code> if the
+      position is at the beginning of line #19). <code>text</code> is
+      an array of strings representing the text that replaced the
+      changed range (split by line). <code>removed</code> is the text
+      that used to be between <code>from</code> and <code>to</code>,
+      which is overwritten by this change. This event is
+      fired <em>before</em> the end of
+      an <a href="#operation">operation</a>, before the DOM updates
+      happen.</dd>
+
+      <dt id="event_changes"><code><strong>"changes"</strong> (instance: CodeMirror, changes: array&lt;object&gt;)</code></dt>
+      <dd>Like the <a href="#event_change"><code>"change"</code></a>
+      event, but batched per <a href="#operation">operation</a>,
+      passing an array containing all the changes that happened in the
+      operation. This event is fired after the operation finished, and
+      display changes it makes will trigger a new operation.</dd>
+
+      <dt id="event_beforeChange"><code><strong>"beforeChange"</strong> (instance: CodeMirror, changeObj: object)</code></dt>
+      <dd>This event is fired before a change is applied, and its
+      handler may choose to modify or cancel the change.
+      The <code>changeObj</code> object
+      has <code>from</code>, <code>to</code>, and <code>text</code>
+      properties, as with
+      the <a href="#event_change"><code>"change"</code></a> event. It
+      also has a <code>cancel()</code> method, which can be called to
+      cancel the change, and, <strong>if</strong> the change isn't
+      coming from an undo or redo event, an <code>update(from, to,
+      text)</code> method, which may be used to modify the change.
+      Undo or redo changes can't be modified, because they hold some
+      metainformation for restoring old marked ranges that is only
+      valid for that specific change. All three arguments
+      to <code>update</code> are optional, and can be left off to
+      leave the existing value for that field
+      intact. <strong>Note:</strong> you may not do anything from
+      a <code>"beforeChange"</code> handler that would cause changes
+      to the document or its visualization. Doing so will, since this
+      handler is called directly from the bowels of the CodeMirror
+      implementation, probably cause the editor to become
+      corrupted.</dd>
+
+      <dt id="event_cursorActivity"><code><strong>"cursorActivity"</strong> (instance: CodeMirror)</code></dt>
+      <dd>Will be fired when the cursor or selection moves, or any
+      change is made to the editor content.</dd>
+
+      <dt id="event_keyHandled"><code><strong>"keyHandled"</strong> (instance: CodeMirror, name: string, event: Event)</code></dt>
+      <dd>Fired after a key is handled through a
+      key map. <code>name</code> is the name of the handled key (for
+      example <code>"Ctrl-X"</code> or <code>"'q'"</code>),
+      and <code>event</code> is the DOM <code>keydown</code>
+      or <code>keypress</code> event.</dd>
+
+      <dt id="event_inputRead"><code><strong>"inputRead"</strong> (instance: CodeMirror, changeObj: object)</code></dt>
+      <dd>Fired whenever new input is read from the hidden textarea
+      (typed or pasted by the user).</dd>
+
+      <dt id="event_electricInput"><code><strong>"electricInput"</strong> (instance: CodeMirror, line: integer)</code></dt>
+      <dd>Fired if text input matched the
+      mode's <a href="#option_electricChars">electric</a> patterns,
+      and this caused the line's indentation to change.</dd>
+
+      <dt id="event_beforeSelectionChange"><code><strong>"beforeSelectionChange"</strong> (instance: CodeMirror, obj: {ranges, origin, update})</code></dt>
+      <dd>This event is fired before the selection is moved. Its
+      handler may inspect the set of selection ranges, present as an
+      array of <code>{anchor, head}</code> objects in
+      the <code>ranges</code> property of the <code>obj</code>
+      argument, and optionally change them by calling
+      the <code>update</code> method on this object, passing an array
+      of ranges in the same format. The object also contains
+      an <code>origin</code> property holding the origin string passed
+      to the selection-changing method, if any. Handlers for this
+      event have the same restriction
+      as <a href="#event_beforeChange"><code>"beforeChange"</code></a>
+      handlers — they should not do anything to directly update the
+      state of the editor.</dd>
+
+      <dt id="event_viewportChange"><code><strong>"viewportChange"</strong> (instance: CodeMirror, from: number, to: number)</code></dt>
+      <dd>Fires whenever the <a href="#getViewport">view port</a> of
+      the editor changes (due to scrolling, editing, or any other
+      factor). The <code>from</code> and <code>to</code> arguments
+      give the new start and end of the viewport.</dd>
+
+      <dt id="event_swapDoc"><code><strong>"swapDoc"</strong> (instance: CodeMirror, oldDoc: Doc)</code></dt>
+      <dd>This is signalled when the editor's document is replaced
+      using the <a href="#swapDoc"><code>swapDoc</code></a>
+      method.</dd>
+
+      <dt id="event_gutterClick"><code><strong>"gutterClick"</strong> (instance: CodeMirror, line: integer, gutter: string, clickEvent: Event)</code></dt>
+      <dd>Fires when the editor gutter (the line-number area) is
+      clicked. Will pass the editor instance as first argument, the
+      (zero-based) number of the line that was clicked as second
+      argument, the CSS class of the gutter that was clicked as third
+      argument, and the raw <code>mousedown</code> event object as
+      fourth argument.</dd>
+
+      <dt id="event_gutterContextMenu"><code><strong>"gutterContextMenu"</strong> (instance: CodeMirror, line: integer, gutter: string, contextMenu: Event: Event)</code></dt>
+      <dd>Fires when the editor gutter (the line-number area)
+      receives a <code>contextmenu</code> event. Will pass the editor
+      instance as first argument, the (zero-based) number of the line
+      that was clicked as second argument, the CSS class of the
+      gutter that was clicked as third argument, and the raw
+      <code>contextmenu</code> mouse event object as fourth argument.
+      You can <code>preventDefault</code> the event, to signal that
+      CodeMirror should do no further handling.</dd>
+
+      <dt id="event_focus"><code><strong>"focus"</strong> (instance: CodeMirror, event: Event)</code></dt>
+      <dd>Fires whenever the editor is focused.</dd>
+
+      <dt id="event_blur"><code><strong>"blur"</strong> (instance: CodeMirror, event: Event)</code></dt>
+      <dd>Fires whenever the editor is unfocused.</dd>
+
+      <dt id="event_scroll"><code><strong>"scroll"</strong> (instance: CodeMirror)</code></dt>
+      <dd>Fires when the editor is scrolled.</dd>
+
+      <dt id="event_refresh"><code><strong>"refresh"</strong> (instance: CodeMirror)</code></dt>
+      <dd>Fires when the editor is <a href="#refresh">refreshed</a>
+      or <a href="#setSize">resized</a>. Mostly useful to invalidate
+      cached values that depend on the editor or character size.</dd>
+
+      <dt id="event_optionChange"><code><strong>"optionChange"</strong> (instance: CodeMirror, option: string)</code></dt>
+      <dd>Dispatched every time an option is changed with <a href="#setOption"><code>setOption</code></a>.</dd>
+
+      <dt id="event_scrollCursorIntoView"><code><strong>"scrollCursorIntoView"</strong> (instance: CodeMirror, event: Event)</code></dt>
+      <dd>Fires when the editor tries to scroll its cursor into view.
+      Can be hooked into to take care of additional scrollable
+      containers around the editor. When the event object has
+      its <code>preventDefault</code> method called, CodeMirror will
+      not itself try to scroll the window.</dd>
+
+      <dt id="event_update"><code><strong>"update"</strong> (instance: CodeMirror)</code></dt>
+      <dd>Will be fired whenever CodeMirror updates its DOM display.</dd>
+
+      <dt id="event_renderLine"><code><strong>"renderLine"</strong> (instance: CodeMirror, line: LineHandle, element: Element)</code></dt>
+      <dd>Fired whenever a line is (re-)rendered to the DOM. Fired
+      right after the DOM element is built, <em>before</em> it is
+      added to the document. The handler may mess with the style of
+      the resulting element, or add event handlers, but
+      should <em>not</em> try to change the state of the editor.</dd>
+
+      <dt id="event_dom"><code><strong>"mousedown"</strong>,
+      <strong>"dblclick"</strong>, <strong>"touchstart"</strong>, <strong>"contextmenu"</strong>,
+      <strong>"keydown"</strong>, <strong>"keypress"</strong>,
+      <strong>"keyup"</strong>, <strong>"cut"</strong>, <strong>"copy"</strong>, <strong>"paste"</strong>,
+      <strong>"dragstart"</strong>, <strong>"dragenter"</strong>,
+      <strong>"dragover"</strong>, <strong>"dragleave"</strong>,
+      <strong>"drop"</strong>
+      (instance: CodeMirror, event: Event)</code></dt>
+      <dd>Fired when CodeMirror is handling a DOM event of this type.
+      You can <code>preventDefault</code> the event, or give it a
+      truthy <code>codemirrorIgnore</code> property, to signal that
+      CodeMirror should do no further handling.</dd>
+    </dl>
+
+    <p>Document objects (instances
+    of <a href="#Doc"><code>CodeMirror.Doc</code></a>) emit the
+    following events:</p>
+
+    <dl>
+      <dt id="event_doc_change"><code><strong>"change"</strong> (doc: CodeMirror.Doc, changeObj: object)</code></dt>
+      <dd>Fired whenever a change occurs to the
+      document. <code>changeObj</code> has a similar type as the
+      object passed to the
+      editor's <a href="#event_change"><code>"change"</code></a>
+      event.</dd>
+
+      <dt id="event_doc_beforeChange"><code><strong>"beforeChange"</strong> (doc: CodeMirror.Doc, change: object)</code></dt>
+      <dd>See the <a href="#event_beforeChange">description of the
+      same event</a> on editor instances.</dd>
+
+      <dt id="event_doc_cursorActivity"><code><strong>"cursorActivity"</strong> (doc: CodeMirror.Doc)</code></dt>
+      <dd>Fired whenever the cursor or selection in this document
+      changes.</dd>
+
+      <dt id="event_doc_beforeSelectionChange"><code><strong>"beforeSelectionChange"</strong> (doc: CodeMirror.Doc, selection: {head, anchor})</code></dt>
+      <dd>Equivalent to
+      the <a href="#event_beforeSelectionChange">event by the same
+      name</a> as fired on editor instances.</dd>
+    </dl>
+
+    <p>Line handles (as returned by, for
+    example, <a href="#getLineHandle"><code>getLineHandle</code></a>)
+    support these events:</p>
+
+    <dl>
+      <dt id="event_delete"><code><strong>"delete"</strong> ()</code></dt>
+      <dd>Will be fired when the line object is deleted. A line object
+      is associated with the <em>start</em> of the line. Mostly useful
+      when you need to find out when your <a href="#setGutterMarker">gutter
+      markers</a> on a given line are removed.</dd>
+      <dt id="event_line_change"><code><strong>"change"</strong> (line: LineHandle, changeObj: object)</code></dt>
+      <dd>Fires when the line's text content is changed in any way
+      (but the line is not deleted outright). The <code>change</code>
+      object is similar to the one passed
+      to <a href="#event_change">change event</a> on the editor
+      object.</dd>
+    </dl>
+
+    <p>Marked range handles (<code>CodeMirror.TextMarker</code>), as returned
+    by <a href="#markText"><code>markText</code></a>
+    and <a href="#setBookmark"><code>setBookmark</code></a>, emit the
+    following events:</p>
+
+    <dl>
+      <dt id="event_beforeCursorEnter"><code><strong>"beforeCursorEnter"</strong> ()</code></dt>
+      <dd>Fired when the cursor enters the marked range. From this
+      event handler, the editor state may be inspected
+      but <em>not</em> modified, with the exception that the range on
+      which the event fires may be cleared.</dd>
+      <dt id="event_clear"><code><strong>"clear"</strong> (from: {line, ch}, to: {line, ch})</code></dt>
+      <dd>Fired when the range is cleared, either through cursor
+      movement in combination
+      with <a href="#mark_clearOnEnter"><code>clearOnEnter</code></a>
+      or through a call to its <code>clear()</code> method. Will only
+      be fired once per handle. Note that deleting the range through
+      text editing does not fire this event, because an undo action
+      might bring the range back into existence. <code>from</code>
+      and <code>to</code> give the part of the document that the range
+      spanned when it was cleared.</dd>
+      <dt id="event_hide"><code><strong>"hide"</strong> ()</code></dt>
+      <dd>Fired when the last part of the marker is removed from the
+      document by editing operations.</dd>
+      <dt id="event_unhide"><code><strong>"unhide"</strong> ()</code></dt>
+      <dd>Fired when, after the marker was removed by editing, a undo
+      operation brought the marker back.</dd>
+    </dl>
+
+    <p>Line widgets (<code>CodeMirror.LineWidget</code>), returned
+    by <a href="#addLineWidget"><code>addLineWidget</code></a>, fire
+    these events:</p>
+
+    <dl>
+      <dt id="event_redraw"><code><strong>"redraw"</strong> ()</code></dt>
+      <dd>Fired whenever the editor re-adds the widget to the DOM.
+      This will happen once right after the widget is added (if it is
+      scrolled into view), and then again whenever it is scrolled out
+      of view and back in again, or when changes to the editor options
+      or the line the widget is on require the widget to be
+      redrawn.</dd>
+    </dl>
+</section>
+
+<section id=keymaps>
+    <h2>Key Maps</h2>
+
+    <p>Key maps are ways to associate keys and mouse buttons with
+    functionality. A key map is an object mapping strings that
+    identify the buttons to functions that implement their
+    functionality.</p>
+
+    <p>The CodeMirror distributions comes
+    with <a href="../demo/emacs.html">Emacs</a>, <a href="../demo/vim.html">Vim</a>,
+    and <a href="../demo/sublime.html">Sublime Text</a>-style keymaps.</p>
+
+    <p>Keys are identified either by name or by character.
+    The <code>CodeMirror.keyNames</code> object defines names for
+    common keys and associates them with their key codes. Examples of
+    names defined here are <code>Enter</code>, <code>F5</code>,
+    and <code>Q</code>. These can be prefixed
+    with <code>Shift-</code>, <code>Cmd-</code>, <code>Ctrl-</code>,
+    and <code>Alt-</code> to specify a modifier. So for
+    example, <code>Shift-Ctrl-Space</code> would be a valid key
+    identifier.</p>
+
+    <p>Common example: map the Tab key to insert spaces instead of a tab
+    character.</p>
+
+    <pre data-lang="javascript">
+editor.setOption("extraKeys", {
+  Tab: function(cm) {
+    var spaces = Array(cm.getOption("indentUnit") + 1).join(" ");
+    cm.replaceSelection(spaces);
+  }
+});</pre>
+
+    <p>Alternatively, a character can be specified directly by
+    surrounding it in single quotes, for example <code>'$'</code>
+    or <code>'q'</code>. Due to limitations in the way browsers fire
+    key events, these may not be prefixed with modifiers.</p>
+
+    <p>To bind mouse buttons, use the names `LeftClick`,
+    `MiddleClick`, and `RightClick`. These can also be prefixed with
+    modifiers, and in addition, the word `Double` or `Triple` can be
+    put before `Click` (as in `LeftDoubleClick`) to bind a double- or
+    triple-click. The function for such a binding is passed the
+    position that was clicked as second argument.</p>
+
+    <p id="normalizeKeyMap">Multi-stroke key bindings can be specified
+    by separating the key names by spaces in the property name, for
+    example <code>Ctrl-X Ctrl-V</code>. When a map contains
+    multi-stoke bindings or keys with modifiers that are not specified
+    in the default order (<code>Shift-Cmd-Ctrl-Alt</code>), you must
+    call <code>CodeMirror.normalizeKeyMap</code> on it before it can
+    be used. This function takes a keymap and modifies it to normalize
+    modifier order and properly recognize multi-stroke bindings. It
+    will return the keymap itself.</p>
+
+    <p>The <code>CodeMirror.keyMap</code> object associates key maps
+    with names. User code and key map definitions can assign extra
+    properties to this object. Anywhere where a key map is expected, a
+    string can be given, which will be looked up in this object. It
+    also contains the <code>"default"</code> key map holding the
+    default bindings.</p>
+
+    <p>The values of properties in key maps can be either functions of
+    a single argument (the CodeMirror instance), strings, or
+    <code>false</code>. Strings refer
+    to <a href="#commands">commands</a>, which are described below. If
+    the property is set to <code>false</code>, CodeMirror leaves
+    handling of the key up to the browser. A key handler function may
+    return <code>CodeMirror.Pass</code> to indicate that it has
+    decided not to handle the key, and other handlers (or the default
+    behavior) should be given a turn.</p>
+
+    <p>Keys mapped to command names that start with the
+    characters <code>"go"</code> or to functions that have a
+    truthy <code>motion</code> property (which should be used for
+    cursor-movement actions) will be fired even when an
+    extra <code>Shift</code> modifier is present (i.e. <code>"Up":
+    "goLineUp"</code> matches both up and shift-up). This is used to
+    easily implement shift-selection.</p>
+
+    <p>Key maps can defer to each other by defining
+    a <code>fallthrough</code> property. This indicates that when a
+    key is not found in the map itself, one or more other maps should
+    be searched. It can hold either a single key map or an array of
+    key maps.</p>
+
+    <p>When a key map needs to set something up when it becomes
+    active, or tear something down when deactivated, it can
+    contain <code>attach</code> and/or <code>detach</code> properties,
+    which should hold functions that take the editor instance and the
+    next or previous keymap. Note that this only works for the
+    <a href="#option_keyMap">top-level keymap</a>, not for fallthrough
+    maps or maps added
+    with <a href="#option_extraKeys"><code>extraKeys</code></a>
+    or <a href="#addKeyMap"><code>addKeyMap</code></a>.</p>
+</section>
+
+<section id=commands>
+    <h2>Commands</h2>
+
+    <p>Commands are parameter-less actions that can be performed on an
+    editor. Their main use is for key bindings. Commands are defined by
+    adding properties to the <code>CodeMirror.commands</code> object.
+    A number of common commands are defined by the library itself,
+    most of them used by the default key bindings. The value of a
+    command property must be a function of one argument (an editor
+    instance).</p>
+
+    <p>Some of the commands below are referenced in the default
+    key map, but not defined by the core library. These are intended to
+    be defined by user code or addons.</p>
+
+    <p>Commands can also be run with
+    the <a href="#execCommand"><code>execCommand</code></a>
+    method.</p>
+
+    <dl>
+      <dt class=command id=command_selectAll><code><strong>selectAll</strong></code><span class=keybinding>Ctrl-A (PC), Cmd-A (Mac)</span></dt>
+      <dd>Select the whole content of the editor.</dd>
+
+      <dt class=command id=command_singleSelection><code><strong>singleSelection</strong></code><span class=keybinding>Esc</span></dt>
+      <dd>When multiple selections are present, this deselects all but
+      the primary selection.</dd>
+
+      <dt class=command id=command_killLine><code><strong>killLine</strong></code><span class=keybinding>Ctrl-K (Mac)</span></dt>
+      <dd>Emacs-style line killing. Deletes the part of the line after
+      the cursor. If that consists only of whitespace, the newline at
+      the end of the line is also deleted.</dd>
+
+      <dt class=command id=command_deleteLine><code><strong>deleteLine</strong></code><span class=keybinding>Ctrl-D (PC), Cmd-D (Mac)</span></dt>
+      <dd>Deletes the whole line under the cursor, including newline at the end.</dd>
+
+      <dt class=command id=command_delLineLeft><code><strong>delLineLeft</strong></code></dt>
+      <dd>Delete the part of the line before the cursor.</dd>
+
+      <dt class=command id=command_delWrappedLineLeft><code><strong>delWrappedLineLeft</strong></code><span class=keybinding>Cmd-Backspace (Mac)</span></dt>
+      <dd>Delete the part of the line from the left side of the visual line the cursor is on to the cursor.</dd>
+
+      <dt class=command id=command_delWrappedLineRight><code><strong>delWrappedLineRight</strong></code><span class=keybinding>Cmd-Delete (Mac)</span></dt>
+      <dd>Delete the part of the line from the cursor to the right side of the visual line the cursor is on.</dd>
+
+      <dt class=command id=command_undo><code><strong>undo</strong></code><span class=keybinding>Ctrl-Z (PC), Cmd-Z (Mac)</span></dt>
+      <dd>Undo the last change. Note that, because browsers still
+      don't make it possible for scripts to react to or customize the
+      context menu, selecting undo (or redo) from the context menu in
+      a CodeMirror instance does not work.</dd>
+
+      <dt class=command id=command_redo><code><strong>redo</strong></code><span class=keybinding>Ctrl-Y (PC), Shift-Cmd-Z (Mac), Cmd-Y (Mac)</span></dt>
+      <dd>Redo the last undone change.</dd>
+
+      <dt class=command id=command_undoSelection><code><strong>undoSelection</strong></code><span class=keybinding>Ctrl-U (PC), Cmd-U (Mac)</span></dt>
+      <dd>Undo the last change to the selection, or if there are no
+      selection-only changes at the top of the history, undo the last
+      change.</dd>
+
+      <dt class=command id=command_redoSelection><code><strong>redoSelection</strong></code><span class=keybinding>Alt-U (PC), Shift-Cmd-U (Mac)</span></dt>
+      <dd>Redo the last change to the selection, or the last text change if
+      no selection changes remain.</dd>
+
+      <dt class=command id=command_goDocStart><code><strong>goDocStart</strong></code><span class=keybinding>Ctrl-Home (PC), Cmd-Up (Mac), Cmd-Home (Mac)</span></dt>
+      <dd>Move the cursor to the start of the document.</dd>
+
+      <dt class=command id=command_goDocEnd><code><strong>goDocEnd</strong></code><span class=keybinding>Ctrl-End (PC), Cmd-End (Mac), Cmd-Down (Mac)</span></dt>
+      <dd>Move the cursor to the end of the document.</dd>
+
+      <dt class=command id=command_goLineStart><code><strong>goLineStart</strong></code><span class=keybinding>Alt-Left (PC), Ctrl-A (Mac)</span></dt>
+      <dd>Move the cursor to the start of the line.</dd>
+
+      <dt class=command id=command_goLineStartSmart><code><strong>goLineStartSmart</strong></code><span class=keybinding>Home</span></dt>
+      <dd>Move to the start of the text on the line, or if we are
+      already there, to the actual start of the line (including
+      whitespace).</dd>
+
+      <dt class=command id=command_goLineEnd><code><strong>goLineEnd</strong></code><span class=keybinding>Alt-Right (PC), Ctrl-E (Mac)</span></dt>
+      <dd>Move the cursor to the end of the line.</dd>
+
+      <dt class=command id=command_goLineRight><code><strong>goLineRight</strong></code><span class=keybinding>Cmd-Right (Mac)</span></dt>
+      <dd>Move the cursor to the right side of the visual line it is on.</dd>
+
+      <dt class=command id=command_goLineLeft><code><strong>goLineLeft</strong></code><span class=keybinding>Cmd-Left (Mac)</span></dt>
+      <dd>Move the cursor to the left side of the visual line it is on. If
+      this line is wrapped, that may not be the start of the line.</dd>
+
+      <dt class=command id=command_goLineLeftSmart><code><strong>goLineLeftSmart</strong></code></dt>
+      <dd>Move the cursor to the left side of the visual line it is
+      on. If that takes it to the start of the line, behave
+      like <a href="#command_goLineStartSmart"><code>goLineStartSmart</code></a>.</dd>
+
+      <dt class=command id=command_goLineUp><code><strong>goLineUp</strong></code><span class=keybinding>Up, Ctrl-P (Mac)</span></dt>
+      <dd>Move the cursor up one line.</dd>
+
+      <dt class=command id=command_goLineDown><code><strong>goLineDown</strong></code><span class=keybinding>Down, Ctrl-N (Mac)</span></dt>
+      <dd>Move down one line.</dd>
+
+      <dt class=command id=command_goPageUp><code><strong>goPageUp</strong></code><span class=keybinding>PageUp, Shift-Ctrl-V (Mac)</span></dt>
+      <dd>Move the cursor up one screen, and scroll up by the same distance.</dd>
+
+      <dt class=command id=command_goPageDown><code><strong>goPageDown</strong></code><span class=keybinding>PageDown, Ctrl-V (Mac)</span></dt>
+      <dd>Move the cursor down one screen, and scroll down by the same distance.</dd>
+
+      <dt class=command id=command_goCharLeft><code><strong>goCharLeft</strong></code><span class=keybinding>Left, Ctrl-B (Mac)</span></dt>
+      <dd>Move the cursor one character left, going to the previous line
+      when hitting the start of line.</dd>
+
+      <dt class=command id=command_goCharRight><code><strong>goCharRight</strong></code><span class=keybinding>Right, Ctrl-F (Mac)</span></dt>
+      <dd>Move the cursor one character right, going to the next line
+      when hitting the end of line.</dd>
+
+      <dt class=command id=command_goColumnLeft><code><strong>goColumnLeft</strong></code></dt>
+      <dd>Move the cursor one character left, but don't cross line boundaries.</dd>
+
+      <dt class=command id=command_goColumnRight><code><strong>goColumnRight</strong></code></dt>
+      <dd>Move the cursor one character right, don't cross line boundaries.</dd>
+
+      <dt class=command id=command_goWordLeft><code><strong>goWordLeft</strong></code><span class=keybinding>Alt-B (Mac)</span></dt>
+      <dd>Move the cursor to the start of the previous word.</dd>
+
+      <dt class=command id=command_goWordRight><code><strong>goWordRight</strong></code><span class=keybinding>Alt-F (Mac)</span></dt>
+      <dd>Move the cursor to the end of the next word.</dd>
+
+      <dt class=command id=command_goGroupLeft><code><strong>goGroupLeft</strong></code><span class=keybinding>Ctrl-Left (PC), Alt-Left (Mac)</span></dt>
+      <dd>Move to the left of the group before the cursor. A group is
+      a stretch of word characters, a stretch of punctuation
+      characters, a newline, or a stretch of <em>more than one</em>
+      whitespace character.</dd>
+
+      <dt class=command id=command_goGroupRight><code><strong>goGroupRight</strong></code><span class=keybinding>Ctrl-Right (PC), Alt-Right (Mac)</span></dt>
+      <dd>Move to the right of the group after the cursor
+      (see <a href="#command_goGroupLeft">above</a>).</dd>
+
+      <dt class=command id=command_delCharBefore><code><strong>delCharBefore</strong></code><span class=keybinding>Shift-Backspace, Ctrl-H (Mac)</span></dt>
+      <dd>Delete the character before the cursor.</dd>
+
+      <dt class=command id=command_delCharAfter><code><strong>delCharAfter</strong></code><span class=keybinding>Delete, Ctrl-D (Mac)</span></dt>
+      <dd>Delete the character after the cursor.</dd>
+
+      <dt class=command id=command_delWordBefore><code><strong>delWordBefore</strong></code><span class=keybinding>Alt-Backspace (Mac)</span></dt>
+      <dd>Delete up to the start of the word before the cursor.</dd>
+
+      <dt class=command id=command_delWordAfter><code><strong>delWordAfter</strong></code><span class=keybinding>Alt-D (Mac)</span></dt>
+      <dd>Delete up to the end of the word after the cursor.</dd>
+
+      <dt class=command id=command_delGroupBefore><code><strong>delGroupBefore</strong></code><span class=keybinding>Ctrl-Backspace (PC), Alt-Backspace (Mac)</span></dt>
+      <dd>Delete to the left of the <a href="#command_goGroupLeft">group</a> before the cursor.</dd>
+
+      <dt class=command id=command_delGroupAfter><code><strong>delGroupAfter</strong></code><span class=keybinding>Ctrl-Delete (PC), Ctrl-Alt-Backspace (Mac), Alt-Delete (Mac)</span></dt>
+      <dd>Delete to the start of the <a href="#command_goGroupLeft">group</a> after the cursor.</dd>
+
+      <dt class=command id=command_indentAuto><code><strong>indentAuto</strong></code><span class=keybinding>Shift-Tab</span></dt>
+      <dd>Auto-indent the current line or selection.</dd>
+
+      <dt class=command id=command_indentMore><code><strong>indentMore</strong></code><span class=keybinding>Ctrl-] (PC), Cmd-] (Mac)</span></dt>
+      <dd>Indent the current line or selection by one <a href="#option_indentUnit">indent unit</a>.</dd>
+
+      <dt class=command id=command_indentLess><code><strong>indentLess</strong></code><span class=keybinding>Ctrl-[ (PC), Cmd-[ (Mac)</span></dt>
+      <dd>Dedent the current line or selection by one <a href="#option_indentUnit">indent unit</a>.</dd>
+
+      <dt class=command id=command_insertTab><code><strong>insertTab</strong></code></dt>
+      <dd>Insert a tab character at the cursor.</dd>
+
+      <dt class=command id=command_insertSoftTab><code><strong>insertSoftTab</strong></code></dt>
+      <dd>Insert the amount of spaces that match the width a tab at
+      the cursor position would have.</dd>
+
+      <dt class=command id=command_defaultTab><code><strong>defaultTab</strong></code><span class=keybinding>Tab</span></dt>
+      <dd>If something is selected, indent it by
+      one <a href="#option_indentUnit">indent unit</a>. If nothing is
+      selected, insert a tab character.</dd>
+
+      <dt class=command id=command_transposeChars><code><strong>transposeChars</strong></code><span class=keybinding>Ctrl-T (Mac)</span></dt>
+      <dd>Swap the characters before and after the cursor.</dd>
+
+      <dt class=command id=command_newlineAndIndent><code><strong>newlineAndIndent</strong></code><span class=keybinding>Enter</span></dt>
+      <dd>Insert a newline and auto-indent the new line.</dd>
+
+      <dt class=command id=command_toggleOverwrite><code><strong>toggleOverwrite</strong></code><span class=keybinding>Insert</span></dt>
+      <dd>Flip the <a href="#toggleOverwrite">overwrite</a> flag.</dd>
+
+      <dt class=command id=command_save><code><strong>save</strong></code><span class=keybinding>Ctrl-S (PC), Cmd-S (Mac)</span></dt>
+      <dd>Not defined by the core library, only referred to in
+      key maps. Intended to provide an easy way for user code to define
+      a save command.</dd>
+
+      <dt class=command id=command_find><code><strong>find</strong></code><span class=keybinding>Ctrl-F (PC), Cmd-F (Mac)</span></dt>
+      <dt class=command id=command_findNext><code><strong>findNext</strong></code><span class=keybinding>Ctrl-G (PC), Cmd-G (Mac)</span></dt>
+      <dt class=command id=command_findPrev><code><strong>findPrev</strong></code><span class=keybinding>Shift-Ctrl-G (PC), Shift-Cmd-G (Mac)</span></dt>
+      <dt class=command id=command_replace><code><strong>replace</strong></code><span class=keybinding>Shift-Ctrl-F (PC), Cmd-Alt-F (Mac)</span></dt>
+      <dt class=command id=command_replaceAll><code><strong>replaceAll</strong></code><span class=keybinding>Shift-Ctrl-R (PC), Shift-Cmd-Alt-F (Mac)</span></dt>
+      <dd>Not defined by the core library, but defined in
+      the <a href="#addon_search">search addon</a> (or custom client
+      addons).</dd>
+
+    </dl>
+
+</section>
+
+<section id=styling>
+    <h2>Customized Styling</h2>
+
+    <p>Up to a certain extent, CodeMirror's look can be changed by
+    modifying style sheet files. The style sheets supplied by modes
+    simply provide the colors for that mode, and can be adapted in a
+    very straightforward way. To style the editor itself, it is
+    possible to alter or override the styles defined
+    in <a href="../lib/codemirror.css"><code>codemirror.css</code></a>.</p>
+
+    <p>Some care must be taken there, since a lot of the rules in this
+    file are necessary to have CodeMirror function properly. Adjusting
+    colors should be safe, of course, and with some care a lot of
+    other things can be changed as well. The CSS classes defined in
+    this file serve the following roles:</p>
+
+    <dl>
+      <dt id="class_CodeMirror"><code><strong>CodeMirror</strong></code></dt>
+      <dd>The outer element of the editor. This should be used for the
+      editor width, height, borders and positioning. Can also be used
+      to set styles that should hold for everything inside the editor
+      (such as font and font size), or to set a background. Setting
+      this class' <code>height</code> style to <code>auto</code> will
+      make the editor <a href="../demo/resize.html">resize to fit its
+      content</a> (it is recommended to also set
+      the <a href="#option_viewportMargin"><code>viewportMargin</code>
+      option</a> to <code>Infinity</code> when doing this.</dd>
+
+      <dt id="class_CodeMirror_focused"><code><strong>CodeMirror-focused</strong></code></dt>
+      <dd>Whenever the editor is focused, the top element gets this
+      class. This is used to hide the cursor and give the selection a
+      different color when the editor is not focused.</dd>
+
+      <dt id="class_CodeMirror_gutters"><code><strong>CodeMirror-gutters</strong></code></dt>
+      <dd>This is the backdrop for all gutters. Use it to set the
+      default gutter background color, and optionally add a border on
+      the right of the gutters.</dd>
+
+      <dt id="class_CodeMirror_linenumbers"><code><strong>CodeMirror-linenumbers</strong></code></dt>
+      <dd>Use this for giving a background or width to the line number
+      gutter.</dd>
+
+      <dt id="class_CodeMirror_linenumber"><code><strong>CodeMirror-linenumber</strong></code></dt>
+      <dd>Used to style the actual individual line numbers. These
+      won't be children of the <code>CodeMirror-linenumbers</code>
+      (plural) element, but rather will be absolutely positioned to
+      overlay it. Use this to set alignment and text properties for
+      the line numbers.</dd>
+
+      <dt id="class_CodeMirror_lines"><code><strong>CodeMirror-lines</strong></code></dt>
+      <dd>The visible lines. This is where you specify vertical
+      padding for the editor content.</dd>
+
+      <dt id="class_CodeMirror_cursor"><code><strong>CodeMirror-cursor</strong></code></dt>
+      <dd>The cursor is a block element that is absolutely positioned.
+      You can make it look whichever way you want.</dd>
+
+      <dt id="class_CodeMirror_selected"><code><strong>CodeMirror-selected</strong></code></dt>
+      <dd>The selection is represented by <code>span</code> elements
+      with this class.</dd>
+
+      <dt id="class_CodeMirror_matchingbracket"><code><strong>CodeMirror-matchingbracket</strong></code>,
+        <code><strong>CodeMirror-nonmatchingbracket</strong></code></dt>
+      <dd>These are used to style matched (or unmatched) brackets.</dd>
+    </dl>
+
+    <p>If your page's style sheets do funky things to
+    all <code>div</code> or <code>pre</code> elements (you probably
+    shouldn't do that), you'll have to define rules to cancel these
+    effects out again for elements under the <code>CodeMirror</code>
+    class.</p>
+
+    <p>Themes are also simply CSS files, which define colors for
+    various syntactic elements. See the files in
+    the <a href="../theme/"><code>theme</code></a> directory.</p>
+</section>
+
+<section id=api>
+    <h2>Programming API</h2>
+
+    <p>A lot of CodeMirror features are only available through its
+    API. Thus, you need to write code (or
+    use <a href="#addons">addons</a>) if you want to expose them to
+    your users.</p>
+
+    <p>Whenever points in the document are represented, the API uses
+    objects with <code>line</code> and <code>ch</code> properties.
+    Both are zero-based. CodeMirror makes sure to 'clip' any positions
+    passed by client code so that they fit inside the document, so you
+    shouldn't worry too much about sanitizing your coordinates. If you
+    give <code>ch</code> a value of <code>null</code>, or don't
+    specify it, it will be replaced with the length of the specified
+    line. Such positions may also have a <code>sticky</code> property
+    holding <code>"before"</code> or <code>"after"</code>, whether the
+    position is associated with the character before or after it. This
+    influences, for example, where the cursor is drawn on a
+    line-break or bidi-direction boundary.</p>
+
+    <p>Methods prefixed with <code>doc.</code> can, unless otherwise
+    specified, be called both on <code>CodeMirror</code> (editor)
+    instances and <code>CodeMirror.Doc</code> instances. Methods
+    prefixed with <code>cm.</code> are <em>only</em> available
+    on <code>CodeMirror</code> instances.</p>
+
+    <h3 id="api_constructor">Constructor</h3>
+
+    <p id="CodeMirror">Constructing an editor instance is done with
+    the <code><strong>CodeMirror</strong>(place: Element|fn(Element),
+    ?option: object)</code> constructor. If the <code>place</code>
+    argument is a DOM element, the editor will be appended to it. If
+    it is a function, it will be called, and is expected to place the
+    editor into the document. <code>options</code> may be an element
+    mapping <a href="#config">option names</a> to values. The options
+    that it doesn't explicitly specify (or all options, if it is not
+    passed) will be taken
+    from <a href="#defaults"><code>CodeMirror.defaults</code></a>.</p>
+
+    <p>Note that the options object passed to the constructor will be
+    mutated when the instance's options
+    are <a href="#setOption">changed</a>, so you shouldn't share such
+    objects between instances.</p>
+
+    <p>See <a href="#fromTextArea"><code>CodeMirror.fromTextArea</code></a>
+    for another way to construct an editor instance.</p>
+
+    <h3 id="api_content">Content manipulation methods</h3>
+
+    <dl>
+      <dt id="getValue"><code><strong>doc.getValue</strong>(?separator: string) → string</code></dt>
+      <dd>Get the current editor content. You can pass it an optional
+      argument to specify the string to be used to separate lines
+      (defaults to <code>"\n"</code>).</dd>
+      <dt id="setValue"><code><strong>doc.setValue</strong>(content: string)</code></dt>
+      <dd>Set the editor content.</dd>
+
+      <dt id="getRange"><code><strong>doc.getRange</strong>(from: {line, ch}, to: {line, ch}, ?separator: string) → string</code></dt>
+      <dd>Get the text between the given points in the editor, which
+      should be <code>{line, ch}</code> objects. An optional third
+      argument can be given to indicate the line separator string to
+      use (defaults to <code>"\n"</code>).</dd>
+      <dt id="replaceRange"><code><strong>doc.replaceRange</strong>(replacement: string, from: {line, ch}, to: {line, ch}, ?origin: string)</code></dt>
+      <dd>Replace the part of the document between <code>from</code>
+      and <code>to</code> with the given string. <code>from</code>
+      and <code>to</code> must be <code>{line, ch}</code>
+      objects. <code>to</code> can be left off to simply insert the
+      string at position <code>from</code>. When <code>origin</code>
+      is given, it will be passed on
+      to <a href="#event_change"><code>"change"</code> events</a>, and
+      its first letter will be used to determine whether this change
+      can be merged with previous history events, in the way described
+      for <a href="#selection_origin">selection origins</a>.</dd>
+
+      <dt id="getLine"><code><strong>doc.getLine</strong>(n: integer) → string</code></dt>
+      <dd>Get the content of line <code>n</code>.</dd>
+
+      <dt id="lineCount"><code><strong>doc.lineCount</strong>() → integer</code></dt>
+      <dd>Get the number of lines in the editor.</dd>
+      <dt id="firstLine"><code><strong>doc.firstLine</strong>() → integer</code></dt>
+      <dd>Get the number of first line in the editor. This will
+      usually be zero but for <a href="#linkedDoc_from">linked sub-views</a>,
+      or <a href="#api_doc">documents</a> instantiated with a non-zero
+      first line, it might return other values.</dd>
+      <dt id="lastLine"><code><strong>doc.lastLine</strong>() → integer</code></dt>
+      <dd>Get the number of last line in the editor. This will
+      usually be <code>doc.lineCount() - 1</code>,
+      but for <a href="#linkedDoc_from">linked sub-views</a>,
+      it might return other values.</dd>
+
+      <dt id="getLineHandle"><code><strong>doc.getLineHandle</strong>(num: integer) → LineHandle</code></dt>
+      <dd>Fetches the line handle for the given line number.</dd>
+      <dt id="getLineNumber"><code><strong>doc.getLineNumber</strong>(handle: LineHandle) → integer</code></dt>
+      <dd>Given a line handle, returns the current position of that
+      line (or <code>null</code> when it is no longer in the
+      document).</dd>
+      <dt id="eachLine"><code><strong>doc.eachLine</strong>(f: (line: LineHandle))</code></dt>
+      <dt><code><strong>doc.eachLine</strong>(start: integer, end: integer, f: (line: LineHandle))</code></dt>
+      <dd>Iterate over the whole document, or if <code>start</code>
+      and <code>end</code> line numbers are given, the range
+      from <code>start</code> up to (not including) <code>end</code>,
+      and call <code>f</code> for each line, passing the line handle.
+      <code>eachLine</code> stops iterating if <code>f</code> returns
+      truthy value.
+      This is a faster way to visit a range of line handlers than
+      calling <a href="#getLineHandle"><code>getLineHandle</code></a>
+      for each of them. Note that line handles have
+      a <code>text</code> property containing the line's content (as a
+      string).</dd>
+
+      <dt id="markClean"><code><strong>doc.markClean</strong>()</code></dt>
+      <dd>Set the editor content as 'clean', a flag that it will
+      retain until it is edited, and which will be set again when such
+      an edit is undone again. Useful to track whether the content
+      needs to be saved. This function is deprecated in favor
+      of <a href="#changeGeneration"><code>changeGeneration</code></a>,
+      which allows multiple subsystems to track different notions of
+      cleanness without interfering.</dd>
+      <dt id="changeGeneration"><code><strong>doc.changeGeneration</strong>(?closeEvent: boolean) → integer</code></dt>
+      <dd>Returns a number that can later be passed
+      to <a href="#isClean"><code>isClean</code></a> to test whether
+      any edits were made (and not undone) in the meantime.
+      If <code>closeEvent</code> is true, the current history event
+      will be ‘closed’, meaning it can't be combined with further
+      changes (rapid typing or deleting events are typically
+      combined).</dd>
+      <dt id="isClean"><code><strong>doc.isClean</strong>(?generation: integer) → boolean</code></dt>
+      <dd>Returns whether the document is currently clean — not
+      modified since initialization or the last call
+      to <a href="#markClean"><code>markClean</code></a> if no
+      argument is passed, or since the matching call
+      to <a href="#changeGeneration"><code>changeGeneration</code></a>
+      if a generation value is given.</dd>
+    </dl>
+
+    <h3 id="api_selection">Cursor and selection methods</h3>
+
+    <dl>
+      <dt id="getSelection"><code><strong>doc.getSelection</strong>(?lineSep: string) → string</code></dt>
+      <dd>Get the currently selected code. Optionally pass a line
+      separator to put between the lines in the output. When multiple
+      selections are present, they are concatenated with instances
+      of <code>lineSep</code> in between.</dd>
+      <dt id="getSelections"><code><strong>doc.getSelections</strong>(?lineSep: string) → array&lt;string&gt;</code></dt>
+      <dd>Returns an array containing a string for each selection,
+      representing the content of the selections.</dd>
+
+      <dt id="replaceSelection"><code><strong>doc.replaceSelection</strong>(replacement: string, ?select: string)</code></dt>
+      <dd>Replace the selection(s) with the given string. By default,
+      the new selection ends up after the inserted text. The
+      optional <code>select</code> argument can be used to change
+      this—passing <code>"around"</code> will cause the new text to be
+      selected, passing <code>"start"</code> will collapse the
+      selection to the start of the inserted text.</dd>
+      <dt id="replaceSelections"><code><strong>doc.replaceSelections</strong>(replacements: array&lt;string&gt;, ?select: string)</code></dt>
+      <dd>The length of the given array should be the same as the
+      number of active selections. Replaces the content of the
+      selections with the strings in the array.
+      The <code>select</code> argument works the same as
+      in <a href="#replaceSelection"><code>replaceSelection</code></a>.</dd>
+
+      <dt id="getCursor"><code><strong>doc.getCursor</strong>(?start: string) → {line, ch}</code></dt>
+      <dd>Retrieve one end of the <em>primary</em>
+      selection. <code>start</code> is an optional string indicating
+      which end of the selection to return. It may
+      be <code>"from"</code>, <code>"to"</code>, <code>"head"</code>
+      (the side of the selection that moves when you press
+      shift+arrow), or <code>"anchor"</code> (the fixed side of the
+      selection). Omitting the argument is the same as
+      passing <code>"head"</code>. A <code>{line, ch}</code> object
+      will be returned.</dd>
+      <dt id="listSelections"><code><strong>doc.listSelections</strong>() → array&lt;{anchor, head}&gt;</code></dt>
+      <dd>Retrieves a list of all current selections. These will
+      always be sorted, and never overlap (overlapping selections are
+      merged). Each object in the array contains <code>anchor</code>
+      and <code>head</code> properties referring to <code>{line,
+      ch}</code> objects.</dd>
+
+      <dt id="somethingSelected"><code><strong>doc.somethingSelected</strong>() → boolean</code></dt>
+      <dd>Return true if any text is selected.</dd>
+      <dt id="setCursor"><code><strong>doc.setCursor</strong>(pos: {line, ch}|number, ?ch: number, ?options: object)</code></dt>
+      <dd>Set the cursor position. You can either pass a
+      single <code>{line, ch}</code> object, or the line and the
+      character as two separate parameters. Will replace all
+      selections with a single, empty selection at the given position.
+      The supported options are the same as for <a href="#setSelection"><code>setSelection</code></a>.</dd>
+
+      <dt id="setSelection"><code><strong>doc.setSelection</strong>(anchor: {line, ch}, ?head: {line, ch}, ?options: object)</code></dt>
+      <dd>Set a single selection range. <code>anchor</code>
+      and <code>head</code> should be <code>{line, ch}</code>
+      objects. <code>head</code> defaults to <code>anchor</code> when
+      not given. These options are supported:
+      <dl>
+        <dt id="selection_scroll"><code><strong>scroll</strong>: boolean</code></dt>
+        <dd>Determines whether the selection head should be scrolled
+        into view. Defaults to true.</dd>
+        <dt id="selection_origin"><code><strong>origin</strong>: string</code></dt>
+        <dd>Determines whether the selection history event may be
+        merged with the previous one. When an origin starts with the
+        character <code>+</code>, and the last recorded selection had
+        the same origin and was similar (close
+        in <a href="#option_historyEventDelay">time</a>, both
+        collapsed or both non-collapsed), the new one will replace the
+        old one. When it starts with <code>*</code>, it will always
+        replace the previous event (if that had the same origin).
+        Built-in motion uses the <code>"+move"</code> origin. User input uses the <code>"+input"</code> origin.</dd>
+        <dt id="selection_bias"><code><strong>bias</strong>: number</code></dt>
+        <dd>Determine the direction into which the selection endpoints
+        should be adjusted when they fall inside
+        an <a href="#mark_atomic">atomic</a> range. Can be either -1
+        (backward) or 1 (forward). When not given, the bias will be
+        based on the relative position of the old selection—the editor
+        will try to move further away from that, to prevent getting
+        stuck.</dd>
+      </dl></dd>
+
+      <dt id="setSelections"><code><strong>doc.setSelections</strong>(ranges: array&lt;{anchor, ?head}&gt;, ?primary: integer, ?options: object)</code></dt>
+      <dd>Sets a new set of selections. There must be at least one
+      selection in the given array. When <code>primary</code> is a
+      number, it determines which selection is the primary one. When
+      it is not given, the primary index is taken from the previous
+      selection, or set to the last range if the previous selection
+      had less ranges than the new one. Supports the same options
+      as <a href="#setSelection"><code>setSelection</code></a>.
+      <code>head</code> defaults to <code>anchor</code> when not given.</dd>
+      <dt id="addSelection"><code><strong>doc.addSelection</strong>(anchor: {line, ch}, ?head: {line, ch})</code></dt>
+      <dd>Adds a new selection to the existing set of selections, and
+      makes it the primary selection.</dd>
+
+      <dt id="extendSelection"><code><strong>doc.extendSelection</strong>(from: {line, ch}, ?to: {line, ch}, ?options: object)</code></dt>
+      <dd>Similar
+      to <a href="#setSelection"><code>setSelection</code></a>, but
+      will, if shift is held or
+      the <a href="#setExtending">extending</a> flag is set, move the
+      head of the selection while leaving the anchor at its current
+      place. <code>to</code> is optional, and can be passed to ensure
+      a region (for example a word or paragraph) will end up selected
+      (in addition to whatever lies between that region and the
+      current anchor). When multiple selections are present, all but
+      the primary selection will be dropped by this method.
+      Supports the same options as <a href="#setSelection"><code>setSelection</code></a>.</dd>
+      <dt id="extendSelections"><code><strong>doc.extendSelections</strong>(heads: array&lt;{line, ch}&gt;, ?options: object)</code></dt>
+      <dd>An equivalent
+      of <a href="#extendSelection"><code>extendSelection</code></a>
+      that acts on all selections at once.</dd>
+      <dt id="extendSelectionsBy"><code><strong>doc.extendSelectionsBy</strong>(f: function(range: {anchor, head}) → {line, ch}), ?options: object)</code></dt>
+      <dd>Applies the given function to all existing selections, and
+      calls <a href="#extendSelections"><code>extendSelections</code></a>
+      on the result.</dd>
+      <dt id="setExtending"><code><strong>doc.setExtending</strong>(value: boolean)</code></dt>
+      <dd>Sets or clears the 'extending' flag, which acts similar to
+      the shift key, in that it will cause cursor movement and calls
+      to <a href="#extendSelection"><code>extendSelection</code></a>
+      to leave the selection anchor in place.</dd>
+      <dt id="getExtending"><code><strong>doc.getExtending</strong>() → boolean</code></dt>
+      <dd>Get the value of the 'extending' flag.</dd>
+
+      <dt id="hasFocus"><code><strong>cm.hasFocus</strong>() → boolean</code></dt>
+      <dd>Tells you whether the editor currently has focus.</dd>
+
+      <dt id="findPosH"><code><strong>cm.findPosH</strong>(start: {line, ch}, amount: integer, unit: string, visually: boolean) → {line, ch, ?hitSide: boolean}</code></dt>
+      <dd>Used to find the target position for horizontal cursor
+      motion. <code>start</code> is a <code>{line, ch}</code>
+      object, <code>amount</code> an integer (may be negative),
+      and <code>unit</code> one of the
+      string <code>"char"</code>, <code>"column"</code>,
+      or <code>"word"</code>. Will return a position that is produced
+      by moving <code>amount</code> times the distance specified
+      by <code>unit</code>. When <code>visually</code> is true, motion
+      in right-to-left text will be visual rather than logical. When
+      the motion was clipped by hitting the end or start of the
+      document, the returned value will have a <code>hitSide</code>
+      property set to true.</dd>
+      <dt id="findPosV"><code><strong>cm.findPosV</strong>(start: {line, ch}, amount: integer, unit: string) → {line, ch, ?hitSide: boolean}</code></dt>
+      <dd>Similar to <a href="#findPosH"><code>findPosH</code></a>,
+      but used for vertical motion. <code>unit</code> may
+      be <code>"line"</code> or <code>"page"</code>. The other
+      arguments and the returned value have the same interpretation as
+      they have in <code>findPosH</code>.</dd>
+
+      <dt id="findWordAt"><code><strong>cm.findWordAt</strong>(pos: {line, ch}) → {anchor: {line, ch}, head: {line, ch}}</code></dt>
+      <dd>Returns the start and end of the 'word' (the stretch of
+      letters, whitespace, or punctuation) at the given position.</dd>
+    </dl>
+
+    <h3 id="api_configuration">Configuration methods</h3>
+
+    <dl>
+      <dt id="setOption"><code><strong>cm.setOption</strong>(option: string, value: any)</code></dt>
+      <dd>Change the configuration of the editor. <code>option</code>
+      should the name of an <a href="#config">option</a>,
+      and <code>value</code> should be a valid value for that
+      option.</dd>
+      <dt id="getOption"><code><strong>cm.getOption</strong>(option: string) → any</code></dt>
+      <dd>Retrieves the current value of the given option for this
+      editor instance.</dd>
+
+      <dt id="addKeyMap"><code><strong>cm.addKeyMap</strong>(map: object, bottom: boolean)</code></dt>
+      <dd>Attach an additional <a href="#keymaps">key map</a> to the
+      editor. This is mostly useful for addons that need to register
+      some key handlers without trampling on
+      the <a href="#option_extraKeys"><code>extraKeys</code></a>
+      option. Maps added in this way have a higher precedence than
+      the <code>extraKeys</code>
+      and <a href="#option_keyMap"><code>keyMap</code></a> options,
+      and between them, the maps added earlier have a lower precedence
+      than those added later, unless the <code>bottom</code> argument
+      was passed, in which case they end up below other key maps added
+      with this method.</dd>
+      <dt id="removeKeyMap"><code><strong>cm.removeKeyMap</strong>(map: object)</code></dt>
+      <dd>Disable a keymap added
+      with <a href="#addKeyMap"><code>addKeyMap</code></a>. Either
+      pass in the key map object itself, or a string, which will be
+      compared against the <code>name</code> property of the active
+      key maps.</dd>
+
+      <dt id="addOverlay"><code><strong>cm.addOverlay</strong>(mode: string|object, ?options: object)</code></dt>
+      <dd>Enable a highlighting overlay. This is a stateless mini-mode
+      that can be used to add extra highlighting. For example,
+      the <a href="../demo/search.html">search addon</a> uses it to
+      highlight the term that's currently being
+      searched. <code>mode</code> can be a <a href="#option_mode">mode
+      spec</a> or a mode object (an object with
+      a <a href="#token"><code>token</code></a> method).
+      The <code>options</code> parameter is optional. If given, it
+      should be an object, optionally containing the following options:
+        <dl>
+          <dt><code><strong>opaque</strong>: bool</code></dt>
+          <dd>Defaults to off, but can be given to allow the overlay
+          styling, when not <code>null</code>, to override the styling of
+          the base mode entirely, instead of the two being applied
+          together.</dd>
+          <dt><code><strong>priority</strong>: number</code></dt>
+          <dd>Determines the ordering in which the overlays are
+          applied. Those with high priority are applied after those
+          with lower priority, and able to override the opaqueness of
+          the ones that come before. Defaults to 0.</dd>
+        </dl>
+      </dd>
+
+      <dt id="removeOverlay"><code><strong>cm.removeOverlay</strong>(mode: string|object)</code></dt>
+      <dd>Pass this the exact value passed for the <code>mode</code>
+      parameter to <a href="#addOverlay"><code>addOverlay</code></a>,
+      or a string that corresponds to the <code>name</code> property of
+      that value, to remove an overlay again.</dd>
+
+      <dt id="on"><code><strong>cm.on</strong>(type: string, func: (...args))</code></dt>
+      <dd>Register an event handler for the given event type (a
+      string) on the editor instance. There is also
+      a <code>CodeMirror.on(object, type, func)</code> version
+      that allows registering of events on any object.</dd>
+      <dt id="off"><code><strong>cm.off</strong>(type: string, func: (...args))</code></dt>
+      <dd>Remove an event handler on the editor instance. An
+      equivalent <code>CodeMirror.off(object, type,
+      func)</code> also exists.</dd>
+    </dl>
+
+    <h3 id="api_doc">Document management methods</h3>
+
+    <p id="Doc">Each editor is associated with an instance
+    of <code>CodeMirror.Doc</code>, its document. A document
+    represents the editor content, plus a selection, an undo history,
+    and a <a href="#option_mode">mode</a>. A document can only be
+    associated with a single editor at a time. You can create new
+    documents by calling the <code>CodeMirror.Doc(text: string, mode:
+    Object, firstLineNumber: ?number, lineSeparator: ?string)</code>
+    constructor. The last three arguments are optional and can be used
+    to set a mode for the document, make it start at a line number
+    other than 0, and set a specific line separator respectively.</p>
+
+    <dl>
+      <dt id="getDoc"><code><strong>cm.getDoc</strong>() → Doc</code></dt>
+      <dd>Retrieve the currently active document from an editor.</dd>
+      <dt id="getEditor"><code><strong>doc.getEditor</strong>() → CodeMirror</code></dt>
+      <dd>Retrieve the editor associated with a document. May
+      return <code>null</code>.</dd>
+
+      <dt id="swapDoc"><code><strong>cm.swapDoc</strong>(doc: CodeMirror.Doc) → Doc</code></dt>
+      <dd>Attach a new document to the editor. Returns the old
+      document, which is now no longer associated with an editor.</dd>
+
+      <dt id="copy"><code><strong>doc.copy</strong>(copyHistory: boolean) → Doc</code></dt>
+      <dd>Create an identical copy of the given doc.
+      When <code>copyHistory</code> is true, the history will also be
+      copied. Can not be called directly on an editor.</dd>
+
+      <dt id="linkedDoc"><code><strong>doc.linkedDoc</strong>(options: object) → Doc</code></dt>
+      <dd>Create a new document that's linked to the target document.
+      Linked documents will stay in sync (changes to one are also
+      applied to the other) until <a href="#unlinkDoc">unlinked</a>.
+      These are the options that are supported:
+        <dl>
+          <dt id="linkedDoc_sharedHist"><code><strong>sharedHist</strong>: boolean</code></dt>
+          <dd>When turned on, the linked copy will share an undo
+          history with the original. Thus, something done in one of
+          the two can be undone in the other, and vice versa.</dd>
+          <dt id="linkedDoc_from"><code><strong>from</strong>: integer</code></dt>
+          <dt id="linkedDoc_to"><code><strong>to</strong>: integer</code></dt>
+          <dd>Can be given to make the new document a subview of the
+          original. Subviews only show a given range of lines. Note
+          that line coordinates inside the subview will be consistent
+          with those of the parent, so that for example a subview
+          starting at line 10 will refer to its first line as line 10,
+          not 0.</dd>
+          <dt id="linkedDoc_mode"><code><strong>mode</strong>: string|object</code></dt>
+          <dd>By default, the new document inherits the mode of the
+          parent. This option can be set to
+          a <a href="#option_mode">mode spec</a> to give it a
+          different mode.</dd>
+        </dl></dd>
+      <dt id="unlinkDoc"><code><strong>doc.unlinkDoc</strong>(doc: CodeMirror.Doc)</code></dt>
+      <dd>Break the link between two documents. After calling this,
+      changes will no longer propagate between the documents, and, if
+      they had a shared history, the history will become
+      separate.</dd>
+      <dt id="iterLinkedDocs"><code><strong>doc.iterLinkedDocs</strong>(function: (doc: CodeMirror.Doc, sharedHist: boolean))</code></dt>
+      <dd>Will call the given function for all documents linked to the
+      target document. It will be passed two arguments, the linked document
+      and a boolean indicating whether that document shares history
+      with the target.</dd>
+    </dl>
+
+    <h3 id="api_history">History-related methods</h3>
+
+    <dl>
+      <dt id="undo"><code><strong>doc.undo</strong>()</code></dt>
+      <dd>Undo one edit (if any undo events are stored).</dd>
+      <dt id="redo"><code><strong>doc.redo</strong>()</code></dt>
+      <dd>Redo one undone edit.</dd>
+
+      <dt id="undoSelection"><code><strong>doc.undoSelection</strong>()</code></dt>
+      <dd>Undo one edit or selection change.</dd>
+      <dt id="redoSelection"><code><strong>doc.redoSelection</strong>()</code></dt>
+      <dd>Redo one undone edit or selection change.</dd>
+
+      <dt id="historySize"><code><strong>doc.historySize</strong>() → {undo: integer, redo: integer}</code></dt>
+      <dd>Returns an object with <code>{undo, redo}</code> properties,
+      both of which hold integers, indicating the amount of stored
+      undo and redo operations.</dd>
+      <dt id="clearHistory"><code><strong>doc.clearHistory</strong>()</code></dt>
+      <dd>Clears the editor's undo history.</dd>
+      <dt id="getHistory"><code><strong>doc.getHistory</strong>() → object</code></dt>
+      <dd>Get a (JSON-serializable) representation of the undo history.</dd>
+      <dt id="setHistory"><code><strong>doc.setHistory</strong>(history: object)</code></dt>
+      <dd>Replace the editor's undo history with the one provided,
+      which must be a value as returned
+      by <a href="#getHistory"><code>getHistory</code></a>. Note that
+      this will have entirely undefined results if the editor content
+      isn't also the same as it was when <code>getHistory</code> was
+      called.</dd>
+    </dl>
+
+    <h3 id="api_marker">Text-marking methods</h3>
+
+    <dl>
+      <dt id="markText"><code><strong>doc.markText</strong>(from: {line, ch}, to: {line, ch}, ?options: object) → TextMarker</code></dt>
+      <dd>Can be used to mark a range of text with a specific CSS
+      class name. <code>from</code> and <code>to</code> should
+      be <code>{line, ch}</code> objects. The <code>options</code>
+      parameter is optional. When given, it should be an object that
+      may contain the following configuration options:
+      <dl>
+        <dt id="mark_className"><code><strong>className</strong>: string</code></dt>
+        <dd>Assigns a CSS class to the marked stretch of text.</dd>
+        <dt id="mark_inclusiveLeft"><code><strong>inclusiveLeft</strong>: boolean</code></dt>
+        <dd>Determines whether
+        text inserted on the left of the marker will end up inside
+        or outside of it.</dd>
+        <dt id="mark_inclusiveRight"><code><strong>inclusiveRight</strong>: boolean</code></dt>
+        <dd>Like <code>inclusiveLeft</code>,
+        but for the right side.</dd>
+        <dt id="mark_selectLeft"><code><strong>selectLeft</strong>: boolean</code></dt>
+        <dd>For atomic ranges, determines whether the cursor is allowed
+        to be placed directly to the left of the range. Has no effect on
+        non-atomic ranges.</dd>
+        <dt id="mark_selectRight"><code><strong>selectRight</strong>: boolean</code></dt>
+        <dd>Like <code>selectLeft</code>,
+        but for the right side.</dd>
+        <dt id="mark_atomic"><code><strong>atomic</strong>: boolean</code></dt>
+        <dd>Atomic ranges act as a single unit when cursor movement is
+        concerned—i.e. it is impossible to place the cursor inside of
+        them. You can control whether the cursor is allowed to be placed
+        directly before or after them using <code>selectLeft</code>
+        or <code>selectRight</code>. If <code>selectLeft</code>
+        (or right) is not provided, then <code>inclusiveLeft</code> (or
+        right) will control this behavior.</dd>
+        <dt id="mark_collapsed"><code><strong>collapsed</strong>: boolean</code></dt>
+        <dd>Collapsed ranges do not show up in the display. Setting a
+        range to be collapsed will automatically make it atomic.</dd>
+        <dt id="mark_clearOnEnter"><code><strong>clearOnEnter</strong>: boolean</code></dt>
+        <dd>When enabled, will cause the mark to clear itself whenever
+        the cursor enters its range. This is mostly useful for
+        text-replacement widgets that need to 'snap open' when the
+        user tries to edit them. The
+        <a href="#event_clear"><code>"clear"</code></a> event
+        fired on the range handle can be used to be notified when this
+        happens.</dd>
+        <dt id="mark_clearWhenEmpty"><code><strong>clearWhenEmpty</strong>: boolean</code></dt>
+        <dd>Determines whether the mark is automatically cleared when
+        it becomes empty. Default is true.</dd>
+        <dt id="mark_replacedWith"><code><strong>replacedWith</strong>: Element</code></dt>
+        <dd>Use a given node to display this range. Implies both
+        collapsed and atomic. The given DOM node <em>must</em> be an
+        inline element (as opposed to a block element).</dd>
+        <dt><code><strong>handleMouseEvents</strong>: boolean</code></dt>
+        <dd>When <code>replacedWith</code> is given, this determines
+        whether the editor will capture mouse and drag events
+        occurring in this widget. Default is false—the events will be
+        left alone for the default browser handler, or specific
+        handlers on the widget, to capture.</dd>
+        <dt id="mark_readOnly"><code><strong>readOnly</strong>: boolean</code></dt>
+        <dd>A read-only span can, as long as it is not cleared, not be
+        modified except by
+        calling <a href="#setValue"><code>setValue</code></a> to reset
+        the whole document. <em>Note:</em> adding a read-only span
+        currently clears the undo history of the editor, because
+        existing undo events being partially nullified by read-only
+        spans would corrupt the history (in the current
+        implementation).</dd>
+        <dt id="mark_addToHistory"><code><strong>addToHistory</strong>: boolean</code></dt>
+        <dd>When set to true (default is false), adding this marker
+        will create an event in the undo history that can be
+        individually undone (clearing the marker).</dd>
+        <dt id="mark_startStyle"><code><strong>startStyle</strong>: string</code></dt><dd>Can be used to specify
+        an extra CSS class to be applied to the leftmost span that
+        is part of the marker.</dd>
+        <dt id="mark_endStyle"><code><strong>endStyle</strong>: string</code></dt><dd>Equivalent
+        to <code>startStyle</code>, but for the rightmost span.</dd>
+        <dt id="mark_css"><code><strong>css</strong>: string</code></dt>
+        <dd>A string of CSS to be applied to the covered text. For example <code>"color: #fe3"</code>.</dd>
+        <dt id="mark_attributes"><code><strong>attributes</strong>: object</code></dt>
+        <dd>When given, add the attributes in the given object to the
+        elements created for the marked text. Adding <code>class</code> or
+        <code>style</code> attributes this way is not supported.</dd>
+        <dt id="mark_shared"><code><strong>shared</strong>: boolean</code></dt><dd>When the
+        target document is <a href="#linkedDoc">linked</a> to other
+        documents, you can set <code>shared</code> to true to make the
+        marker appear in all documents. By default, a marker appears
+        only in its target document.</dd>
+      </dl>
+      The method will return an object that represents the marker
+      (with constructor <code>CodeMirror.TextMarker</code>), which
+      exposes three methods:
+      <code><strong>clear</strong>()</code>, to remove the mark,
+      <code><strong>find</strong>()</code>, which returns
+      a <code>{from, to}</code> object (both holding document
+      positions), indicating the current position of the marked range,
+      or <code>undefined</code> if the marker is no longer in the
+      document, and finally <code><strong>changed</strong>()</code>,
+      which you can call if you've done something that might change
+      the size of the marker (for example changing the content of
+      a <a href="#mark_replacedWith"><code>replacedWith</code></a>
+      node), and want to cheaply update the display.</dd>
+
+      <dt id="setBookmark"><code><strong>doc.setBookmark</strong>(pos: {line, ch}, ?options: object) → TextMarker</code></dt>
+      <dd>Inserts a bookmark, a handle that follows the text around it
+      as it is being edited, at the given position. A bookmark has two
+      methods <code>find()</code> and <code>clear()</code>. The first
+      returns the current position of the bookmark, if it is still in
+      the document, and the second explicitly removes the bookmark.
+      The options argument is optional. If given, the following
+      properties are recognized:
+      <dl>
+        <dt><code><strong>widget</strong>: Element</code></dt><dd>Can be used to display a DOM
+        node at the current location of the bookmark (analogous to
+        the <a href="#mark_replacedWith"><code>replacedWith</code></a>
+        option to <a href="#markText"><code>markText</code></a>).</dd>
+        <dt><code><strong>insertLeft</strong>: boolean</code></dt><dd>By default, text typed
+        when the cursor is on top of the bookmark will end up to the
+        right of the bookmark. Set this option to true to make it go
+        to the left instead.</dd>
+        <dt><code><strong>shared</strong>: boolean</code></dt><dd>See
+        the corresponding <a href="#mark_shared">option</a>
+        to <code>markText</code>.</dd>
+        <dt><code><strong>handleMouseEvents</strong>: boolean</code></dt>
+        <dd>As with <a href="#markText"><code>markText</code></a>,
+        this determines whether mouse events on the widget inserted
+        for this bookmark are handled by CodeMirror. The default is
+        false.</dd>
+      </dl></dd>
+
+      <dt id="findMarks"><code><strong>doc.findMarks</strong>(from: {line, ch}, to: {line, ch}) → array&lt;TextMarker&gt;</code></dt>
+      <dd>Returns an array of all the bookmarks and marked ranges
+      found between the given positions (non-inclusive).</dd>
+      <dt id="findMarksAt"><code><strong>doc.findMarksAt</strong>(pos: {line, ch}) → array&lt;TextMarker&gt;</code></dt>
+      <dd>Returns an array of all the bookmarks and marked ranges
+      present at the given position.</dd>
+      <dt id="getAllMarks"><code><strong>doc.getAllMarks</strong>() → array&lt;TextMarker&gt;</code></dt>
+      <dd>Returns an array containing all marked ranges in the document.</dd>
+    </dl>
+
+    <h3 id="api_decoration">Widget, gutter, and decoration methods</h3>
+
+    <dl>
+      <dt id="setGutterMarker"><code><strong>doc.setGutterMarker</strong>(line: integer|LineHandle, gutterID: string, value: Element) → LineHandle</code></dt>
+      <dd>Sets the gutter marker for the given gutter (identified by
+      its CSS class, see
+      the <a href="#option_gutters"><code>gutters</code></a> option)
+      to the given value. Value can be either <code>null</code>, to
+      clear the marker, or a DOM element, to set it. The DOM element
+      will be shown in the specified gutter next to the specified
+      line.</dd>
+
+      <dt id="clearGutter"><code><strong>doc.clearGutter</strong>(gutterID: string)</code></dt>
+      <dd>Remove all gutter markers in
+      the <a href="#option_gutters">gutter</a> with the given ID.</dd>
+
+      <dt id="addLineClass"><code><strong>doc.addLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
+      <dd>Set a CSS class name for the given line. <code>line</code>
+      can be a number or a line handle. <code>where</code> determines
+      to which element this class should be applied, can be one
+      of <code>"text"</code> (the text element, which lies in front of
+      the selection), <code>"background"</code> (a background element
+      that will be behind the selection), <code>"gutter"</code> (the
+      line's gutter space), or <code>"wrap"</code> (the wrapper node
+      that wraps all of the line's elements, including gutter
+      elements). <code>class</code> should be the name of the class to
+      apply.</dd>
+
+      <dt id="removeLineClass"><code><strong>doc.removeLineClass</strong>(line: integer|LineHandle, where: string, class: string) → LineHandle</code></dt>
+      <dd>Remove a CSS class from a line. <code>line</code> can be a
+      line handle or number. <code>where</code> should be one
+      of <code>"text"</code>, <code>"background"</code>,
+      or <code>"wrap"</code>
+      (see <a href="#addLineClass"><code>addLineClass</code></a>). <code>class</code>
+      can be left off to remove all classes for the specified node, or
+      be a string to remove only a specific class.</dd>
+
+      <dt id="lineInfo"><code><strong>doc.lineInfo</strong>(line: integer|LineHandle) → object</code></dt>
+      <dd>Returns the line number, text content, and marker status of
+      the given line, which can be either a number or a line handle.
+      The returned object has the structure <code>{line, handle, text,
+      gutterMarkers, textClass, bgClass, wrapClass, widgets}</code>,
+      where <code>gutterMarkers</code> is an object mapping gutter IDs
+      to marker elements, and <code>widgets</code> is an array
+      of <a href="#addLineWidget">line widgets</a> attached to this
+      line, and the various class properties refer to classes added
+      with <a href="#addLineClass"><code>addLineClass</code></a>.</dd>
+
+      <dt id="addWidget"><code><strong>cm.addWidget</strong>(pos: {line, ch}, node: Element, scrollIntoView: boolean)</code></dt>
+      <dd>Puts <code>node</code>, which should be an absolutely
+      positioned DOM node, into the editor, positioned right below the
+      given <code>{line, ch}</code> position.
+      When <code>scrollIntoView</code> is true, the editor will ensure
+      that the entire node is visible (if possible). To remove the
+      widget again, simply use DOM methods (move it somewhere else, or
+      call <code>removeChild</code> on its parent).</dd>
+
+      <dt id="addLineWidget"><code><strong>doc.addLineWidget</strong>(line: integer|LineHandle, node: Element, ?options: object) → LineWidget</code></dt>
+      <dd>Adds a line widget, an element shown below a line, spanning
+      the whole of the editor's width, and moving the lines below it
+      downwards. <code>line</code> should be either an integer or a
+      line handle, and <code>node</code> should be a DOM node, which
+      will be displayed below the given line. <code>options</code>,
+      when given, should be an object that configures the behavior of
+      the widget. The following options are supported (all default to
+      false):
+        <dl>
+          <dt><code><strong>coverGutter</strong>: boolean</code></dt>
+          <dd>Whether the widget should cover the gutter.</dd>
+          <dt><code><strong>noHScroll</strong>: boolean</code></dt>
+          <dd>Whether the widget should stay fixed in the face of
+          horizontal scrolling.</dd>
+          <dt><code><strong>above</strong>: boolean</code></dt>
+          <dd>Causes the widget to be placed above instead of below
+          the text of the line.</dd>
+          <dt><code><strong>handleMouseEvents</strong>: boolean</code></dt>
+          <dd>Determines whether the editor will capture mouse and
+          drag events occurring in this widget. Default is false—the
+          events will be left alone for the default browser handler,
+          or specific handlers on the widget, to capture.</dd>
+          <dt><code><strong>insertAt</strong>: integer</code></dt>
+          <dd>By default, the widget is added below other widgets for
+          the line. This option can be used to place it at a different
+          position (zero for the top, N to put it after the Nth other
+          widget). Note that this only has effect once, when the
+          widget is created.
+          <dt><code><strong>className</strong>: string</code></dt>
+          <dd>Add an extra CSS class name to the wrapper element
+          created for the widget.</dd>
+        </dl>
+      Note that the widget node will become a descendant of nodes with
+      CodeMirror-specific CSS classes, and those classes might in some
+      cases affect it. This method returns an object that represents
+      the widget placement. It'll have a <code>line</code> property
+      pointing at the line handle that it is associated with, and the following methods:
+        <dl>
+          <dt id="widget_clear"><code><strong>clear</strong>()</code></dt><dd>Removes the widget.</dd>
+          <dt id="widget_changed"><code><strong>changed</strong>()</code></dt><dd>Call
+          this if you made some change to the widget's DOM node that
+          might affect its height. It'll force CodeMirror to update
+          the height of the line that contains the widget.</dd>
+        </dl>
+      </dd>
+    </dl>
+
+    <h3 id="api_sizing">Sizing, scrolling and positioning methods</h3>
+
+    <dl>
+      <dt id="setSize"><code><strong>cm.setSize</strong>(width: number|string, height: number|string)</code></dt>
+      <dd>Programmatically set the size of the editor (overriding the
+      applicable <a href="#css-resize">CSS
+      rules</a>). <code>width</code> and <code>height</code>
+      can be either numbers (interpreted as pixels) or CSS units
+      (<code>"100%"</code>, for example). You can
+      pass <code>null</code> for either of them to indicate that that
+      dimension should not be changed.</dd>
+
+      <dt id="scrollTo"><code><strong>cm.scrollTo</strong>(x: number, y: number)</code></dt>
+      <dd>Scroll the editor to a given (pixel) position. Both
+      arguments may be left as <code>null</code>
+      or <code>undefined</code> to have no effect.</dd>
+      <dt id="getScrollInfo"><code><strong>cm.getScrollInfo</strong>() → {left, top, width, height, clientWidth, clientHeight}</code></dt>
+      <dd>Get an <code>{left, top, width, height, clientWidth,
+      clientHeight}</code> object that represents the current scroll
+      position, the size of the scrollable area, and the size of the
+      visible area (minus scrollbars).</dd>
+      <dt id="scrollIntoView"><code><strong>cm.scrollIntoView</strong>(what: {line, ch}|{left, top, right, bottom}|{from, to}|null, ?margin: number)</code></dt>
+      <dd>Scrolls the given position into view. <code>what</code> may
+      be <code>null</code> to scroll the cursor into view,
+      a <code>{line, ch}</code> position to scroll a character into
+      view, a <code>{left, top, right, bottom}</code> pixel range (in
+      editor-local coordinates), or a range <code>{from, to}</code>
+      containing either two character positions or two pixel squares.
+      The <code>margin</code> parameter is optional. When given, it
+      indicates the amount of vertical pixels around the given area
+      that should be made visible as well.</dd>
+
+      <dt id="cursorCoords"><code><strong>cm.cursorCoords</strong>(where: boolean|{line, ch}, mode: string) → {left, top, bottom}</code></dt>
+      <dd>Returns an <code>{left, top, bottom}</code> object
+      containing the coordinates of the cursor position.
+      If <code>mode</code> is <code>"local"</code>, they will be
+      relative to the top-left corner of the editable document. If it
+      is <code>"page"</code> or not given, they are relative to the
+      top-left corner of the page. If <code>mode</code>
+      is <code>"window"</code>, the coordinates are relative to the
+      top-left corner of the currently visible (scrolled)
+      window. <code>where</code> can be a boolean indicating whether
+      you want the start (<code>true</code>) or the end
+      (<code>false</code>) of the selection, or, if a <code>{line,
+      ch}</code> object is given, it specifies the precise position at
+      which you want to measure.</dd>
+      <dt id="charCoords"><code><strong>cm.charCoords</strong>(pos: {line, ch}, ?mode: string) → {left, right, top, bottom}</code></dt>
+      <dd>Returns the position and dimensions of an arbitrary
+      character. <code>pos</code> should be a <code>{line, ch}</code>
+      object. This differs from <code>cursorCoords</code> in that
+      it'll give the size of the whole character, rather than just the
+      position that the cursor would have when it would sit at that
+      position.</dd>
+      <dt id="coordsChar"><code><strong>cm.coordsChar</strong>(object: {left, top}, ?mode: string) → {line, ch}</code></dt>
+      <dd>Given an <code>{left, top}</code> object (e.g. coordinates of a mouse event) returns
+      the <code>{line, ch}</code> position that corresponds to it. The
+      optional <code>mode</code> parameter determines relative to what
+      the coordinates are interpreted. It may
+      be <code>"window"</code>, <code>"page"</code> (the default),
+      or <code>"local"</code>.</dd>
+      <dt id="lineAtHeight"><code><strong>cm.lineAtHeight</strong>(height: number, ?mode: string) → number</code></dt>
+      <dd>Computes the line at the given pixel
+      height. <code>mode</code> can be one of the same strings
+      that <a href="#coordsChar"><code>coordsChar</code></a>
+      accepts.</dd>
+      <dt id="heightAtLine"><code><strong>cm.heightAtLine</strong>(line: integer|LineHandle, ?mode: string, ?includeWidgets: bool) → number</code></dt>
+      <dd>Computes the height of the top of a line, in the coordinate
+      system specified by <code>mode</code>
+      (see <a href="#coordsChar"><code>coordsChar</code></a>), which
+      defaults to <code>"page"</code>. When a line below the bottom of
+      the document is specified, the returned value is the bottom of
+      the last line in the document. By default, the position of the
+      actual text is returned. If `includeWidgets` is true and the
+      line has line widgets, the position above the first line widget
+      is returned.</dd>
+      <dt id="defaultTextHeight"><code><strong>cm.defaultTextHeight</strong>() → number</code></dt>
+      <dd>Returns the line height of the default font for the editor.</dd>
+      <dt id="defaultCharWidth"><code><strong>cm.defaultCharWidth</strong>() → number</code></dt>
+      <dd>Returns the pixel width of an 'x' in the default font for
+      the editor. (Note that for non-monospace fonts, this is mostly
+      useless, and even for monospace fonts, non-ascii characters
+      might have a different width).</dd>
+
+      <dt id="getViewport"><code><strong>cm.getViewport</strong>() → {from: number, to: number}</code></dt>
+      <dd>Returns a <code>{from, to}</code> object indicating the
+      start (inclusive) and end (exclusive) of the currently rendered
+      part of the document. In big documents, when most content is
+      scrolled out of view, CodeMirror will only render the visible
+      part, and a margin around it. See also
+      the <a href="#event_viewportChange"><code>viewportChange</code></a>
+      event.</dd>
+
+      <dt id="refresh"><code><strong>cm.refresh</strong>()</code></dt>
+      <dd>If your code does something to change the size of the editor
+      element (window resizes are already listened for), or unhides
+      it, you should probably follow up by calling this method to
+      ensure CodeMirror is still looking as intended. See also
+      the <a href="#addon_autorefresh">autorefresh addon</a>.</dd>
+    </dl>
+
+    <h3 id="api_mode">Mode, state, and token-related methods</h3>
+
+    <p>When writing language-aware functionality, it can often be
+    useful to hook into the knowledge that the CodeMirror language
+    mode has. See <a href="#modeapi">the section on modes</a> for a
+    more detailed description of how these work.</p>
+
+    <dl>
+      <dt id="getMode"><code><strong>doc.getMode</strong>() → object</code></dt>
+      <dd>Gets the (outer) mode object for the editor. Note that this
+      is distinct from <code>getOption("mode")</code>, which gives you
+      the mode specification, rather than the resolved, instantiated
+      <a href="#defineMode">mode object</a>.</dd>
+
+      <dt id="getModeAt"><code><strong>cm.getModeAt</strong>(pos: {line, ch}) → object</code></dt>
+      <dd>Gets the inner mode at a given position. This will return
+      the same as <a href="#getMode"><code>getMode</code></a> for
+      simple modes, but will return an inner mode for nesting modes
+      (such as <code>htmlmixed</code>).</dd>
+
+      <dt id="getTokenAt"><code><strong>cm.getTokenAt</strong>(pos: {line, ch}, ?precise: boolean) → object</code></dt>
+      <dd>Retrieves information about the token the current mode found
+      before the given position (a <code>{line, ch}</code> object). The
+      returned object has the following properties:
+      <dl>
+        <dt><code><strong>start</strong></code></dt><dd>The character (on the given line) at which the token starts.</dd>
+        <dt><code><strong>end</strong></code></dt><dd>The character at which the token ends.</dd>
+        <dt><code><strong>string</strong></code></dt><dd>The token's string.</dd>
+        <dt><code><strong>type</strong></code></dt><dd>The token type the mode assigned
+        to the token, such as <code>"keyword"</code>
+        or <code>"comment"</code> (may also be null).</dd>
+        <dt><code><strong>state</strong></code></dt><dd>The mode's state at the end of this token.</dd>
+      </dl>
+      If <code>precise</code> is true, the token will be guaranteed to be accurate based on recent edits. If false or
+      not specified, the token will use cached state information, which will be faster but might not be accurate if
+      edits were recently made and highlighting has not yet completed.
+      </dd>
+
+      <dt id="getLineTokens"><code><strong>cm.getLineTokens</strong>(line: integer, ?precise: boolean) → array&lt;{start, end, string, type, state}&gt;</code></dt>
+      <dd>This is similar
+      to <a href="#getTokenAt"><code>getTokenAt</code></a>, but
+      collects all tokens for a given line into an array. It is much
+      cheaper than repeatedly calling <code>getTokenAt</code>, which
+      re-parses the part of the line before the token for every call.</dd>
+
+      <dt id="getTokenTypeAt"><code><strong>cm.getTokenTypeAt</strong>(pos: {line, ch}) → string</code></dt>
+      <dd>This is a (much) cheaper version
+      of <a href="#getTokenAt"><code>getTokenAt</code></a> useful for
+      when you just need the type of the token at a given position,
+      and no other information. Will return <code>null</code> for
+      unstyled tokens, and a string, potentially containing multiple
+      space-separated style names, otherwise.</dd>
+
+      <dt id="getHelpers"><code><strong>cm.getHelpers</strong>(pos: {line, ch}, type: string) → array&lt;helper&gt;</code></dt>
+      <dd>Fetch the set of applicable helper values for the given
+      position. Helpers provide a way to look up functionality
+      appropriate for a mode. The <code>type</code> argument provides
+      the helper namespace (see
+      <a href="#registerHelper"><code>registerHelper</code></a>), in
+      which the values will be looked up. When the mode itself has a
+      property that corresponds to the <code>type</code>, that
+      directly determines the keys that are used to look up the helper
+      values (it may be either a single string, or an array of
+      strings). Failing that, the mode's <code>helperType</code>
+      property and finally the mode's name are used.</dd>
+      <dd>For example, the JavaScript mode has a
+      property <code>fold</code> containing <code>"brace"</code>. When
+      the <code>brace-fold</code> addon is loaded, that defines a
+      helper named <code>brace</code> in the <code>fold</code>
+      namespace. This is then used by
+      the <a href="#addon_foldcode"><code>foldcode</code></a> addon to
+      figure out that it can use that folding function to fold
+      JavaScript code.</dd>
+      <dd>When any <a href="#registerGlobalHelper">'global'</a>
+      helpers are defined for the given namespace, their predicates
+      are called on the current mode and editor, and all those that
+      declare they are applicable will also be added to the array that
+      is returned.</dd>
+
+      <dt id="getHelper"><code><strong>cm.getHelper</strong>(pos: {line, ch}, type: string) → helper</code></dt>
+      <dd>Returns the first applicable helper value.
+      See <a href="#getHelpers"><code>getHelpers</code></a>.</dd>
+
+      <dt id="getStateAfter"><code><strong>cm.getStateAfter</strong>(?line: integer, ?precise: boolean) → object</code></dt>
+      <dd>Returns the mode's parser state, if any, at the end of the
+      given line number. If no line number is given, the state at the
+      end of the document is returned. This can be useful for storing
+      parsing errors in the state, or getting other kinds of
+      contextual information for a line. <code>precise</code> is defined
+      as in <code>getTokenAt()</code>.</dd>
+    </dl>
+
+    <h3 id="api_misc">Miscellaneous methods</h3>
+
+    <dl>
+      <dt id="operation"><code><strong>cm.operation</strong>(func: () → any) → any</code></dt>
+      <dd>CodeMirror internally buffers changes and only updates its
+      DOM structure after it has finished performing some operation.
+      If you need to perform a lot of operations on a CodeMirror
+      instance, you can call this method with a function argument. It
+      will call the function, buffering up all changes, and only doing
+      the expensive update after the function returns. This can be a
+      lot faster. The return value from this method will be the return
+      value of your function.</dd>
+
+      <dt id="startOperation"><code><strong>cm.startOperation</strong>()</code></dt>
+      <dt id="endOperation"><code><strong>cm.endOperation</strong>()</code></dt>
+      <dd>In normal circumstances, use the above <code>operation</code>
+      method. But if you want to buffer operations happening asynchronously,
+      or that can't all be wrapped in a callback function, you can
+      call <code>startOperation</code> to tell CodeMirror to start
+      buffering changes, and <code>endOperation</code> to actually
+      render all the updates. <em>Be careful:</em> if you use this
+      API and forget to call <code>endOperation</code>, the editor will
+      just never update.</dd>
+
+      <dt id="indentLine"><code><strong>cm.indentLine</strong>(line: integer, ?dir: string|integer)</code></dt>
+      <dd>Adjust the indentation of the given line. The second
+      argument (which defaults to <code>"smart"</code>) may be one of:
+        <dl>
+          <dt><code><strong>"prev"</strong></code></dt>
+          <dd>Base indentation on the indentation of the previous line.</dd>
+          <dt><code><strong>"smart"</strong></code></dt>
+          <dd>Use the mode's smart indentation if available, behave
+          like <code>"prev"</code> otherwise.</dd>
+          <dt><code><strong>"add"</strong></code></dt>
+          <dd>Increase the indentation of the line by
+          one <a href="#option_indentUnit">indent unit</a>.</dd>
+          <dt><code><strong>"subtract"</strong></code></dt>
+          <dd>Reduce the indentation of the line.</dd>
+          <dt><code><strong>&lt;integer></strong></code></dt>
+          <dd>Add (positive number) or reduce (negative number) the
+          indentation by the given amount of spaces.</dd>
+        </dl></dd>
+
+      <dt id="toggleOverwrite"><code><strong>cm.toggleOverwrite</strong>(?value: boolean)</code></dt>
+      <dd>Switches between overwrite and normal insert mode (when not
+      given an argument), or sets the overwrite mode to a specific
+      state (when given an argument).</dd>
+
+      <dt id="isReadOnly"><code><strong>cm.isReadOnly</strong>() → boolean</code></dt>
+      <dd>Tells you whether the editor's content can be edited by the
+      user.</dd>
+
+      <dt id="lineSeparator"><code><strong>doc.lineSeparator</strong>()</code></dt>
+      <dd>Returns the preferred line separator string for this
+      document, as per the <a href="#option_lineSeparator">option</a>
+      by the same name. When that option is <code>null</code>, the
+      string <code>"\n"</code> is returned.</dd>
+
+      <dt id="execCommand"><code><strong>cm.execCommand</strong>(name: string)</code></dt>
+      <dd>Runs the <a href="#commands">command</a> with the given name on the editor.</dd>
+
+      <dt id="posFromIndex"><code><strong>doc.posFromIndex</strong>(index: integer) → {line, ch}</code></dt>
+      <dd>Calculates and returns a <code>{line, ch}</code> object for a
+      zero-based <code>index</code> who's value is relative to the start of the
+      editor's text. If the <code>index</code> is out of range of the text then
+      the returned object is clipped to start or end of the text
+      respectively.</dd>
+      <dt id="indexFromPos"><code><strong>doc.indexFromPos</strong>(object: {line, ch}) → integer</code></dt>
+      <dd>The reverse of <a href="#posFromIndex"><code>posFromIndex</code></a>.</dd>
+
+      <dt id="focus"><code><strong>cm.focus</strong>()</code></dt>
+      <dd>Give the editor focus.</dd>
+
+      <dt id="phrase"><code><strong>cm.phrase</strong>(text: string) → string</code></dt>
+      <dd>Allow the given string to be translated with
+      the <a href="#option_phrases"><code>phrases</code>
+      option</a>.</dd>
+
+      <dt id="getInputField"><code><strong>cm.getInputField</strong>() → Element</code></dt>
+      <dd>Returns the input field for the editor. Will be a textarea
+      or an editable div, depending on the value of
+      the <a href="#option_inputStyle"><code>inputStyle</code></a>
+      option.</dd>
+      <dt id="getWrapperElement"><code><strong>cm.getWrapperElement</strong>() → Element</code></dt>
+      <dd>Returns the DOM node that represents the editor, and
+      controls its size. Remove this from your tree to delete an
+      editor instance.</dd>
+      <dt id="getScrollerElement"><code><strong>cm.getScrollerElement</strong>() → Element</code></dt>
+      <dd>Returns the DOM node that is responsible for the scrolling
+      of the editor.</dd>
+      <dt id="getGutterElement"><code><strong>cm.getGutterElement</strong>() → Element</code></dt>
+      <dd>Fetches the DOM node that contains the editor gutters.</dd>
+    </dl>
+
+    <h3 id="api_static">Static properties</h3>
+    <p>The <code>CodeMirror</code> object itself provides
+    several useful properties.</p>
+
+    <dl>
+      <dt id="version"><code><strong>CodeMirror.version</strong>: string</code></dt>
+      <dd>It contains a string that indicates the version of the
+      library. This is a triple of
+      integers <code>"major.minor.patch"</code>,
+      where <code>patch</code> is zero for releases, and something
+      else (usually one) for dev snapshots.</dd>
+
+      <dt id="fromTextArea"><code><strong>CodeMirror.fromTextArea</strong>(textArea: TextAreaElement, ?config: object)</code></dt>
+      <dd>This method provides another way to initialize an editor. It
+      takes a textarea DOM node as first argument and an optional
+      configuration object as second. It will replace the textarea
+      with a CodeMirror instance, and wire up the form of that
+      textarea (if any) to make sure the editor contents are put into
+      the textarea when the form is submitted. The text in the
+      textarea will provide the content for the editor. A CodeMirror
+      instance created this way has three additional methods:
+      <dl>
+        <dt id="save"><code><strong>cm.save</strong>()</code></dt>
+        <dd>Copy the content of the editor into the textarea.</dd>
+
+        <dt id="toTextArea"><code><strong>cm.toTextArea</strong>()</code></dt>
+        <dd>Remove the editor, and restore the original textarea (with
+        the editor's current content). If you dynamically create and
+        destroy editors made with `fromTextArea`, without destroying
+        the form they are part of, you should make sure to call
+        `toTextArea` to remove the editor, or its `"submit"` handler
+        on the form will cause a memory leak.</dd>
+
+        <dt id="getTextArea"><code><strong>cm.getTextArea</strong>() → TextAreaElement</code></dt>
+        <dd>Returns the textarea that the instance was based on.</dd>
+      </dl>
+      </dd>
+
+      <dt id="defaults"><code><strong>CodeMirror.defaults</strong>: object</code></dt>
+      <dd>An object containing default values for
+      all <a href="#config">options</a>. You can assign to its
+      properties to modify defaults (though this won't affect editors
+      that have already been created).</dd>
+
+      <dt id="defineExtension"><code><strong>CodeMirror.defineExtension</strong>(name: string, value: any)</code></dt>
+      <dd>If you want to define extra methods in terms of the
+      CodeMirror API, it is possible to
+      use <code>defineExtension</code>. This will cause the given
+      value (usually a method) to be added to all CodeMirror instances
+      created from then on.</dd>
+
+      <dt id="defineDocExtension"><code><strong>CodeMirror.defineDocExtension</strong>(name: string, value: any)</code></dt>
+      <dd>Like <a href="#defineExtension"><code>defineExtension</code></a>,
+      but the method will be added to the interface
+      for <a href="#Doc"><code>Doc</code></a> objects instead.</dd>
+
+      <dt id="defineOption"><code><strong>CodeMirror.defineOption</strong>(name: string,
+      default: any, updateFunc: function)</code></dt>
+      <dd>Similarly, <code>defineOption</code> can be used to define new options for
+      CodeMirror. The <code>updateFunc</code> will be called with the
+      editor instance and the new value when an editor is initialized,
+      and whenever the option is modified
+      through <a href="#setOption"><code>setOption</code></a>.</dd>
+
+      <dt id="defineInitHook"><code><strong>CodeMirror.defineInitHook</strong>(func: function)</code></dt>
+      <dd>If your extension just needs to run some
+      code whenever a CodeMirror instance is initialized,
+      use <code>CodeMirror.defineInitHook</code>. Give it a function as
+      its only argument, and from then on, that function will be called
+      (with the instance as argument) whenever a new CodeMirror instance
+      is initialized.</dd>
+
+      <dt id="registerHelper"><code><strong>CodeMirror.registerHelper</strong>(type: string, name: string, value: helper)</code></dt>
+      <dd>Registers a helper value with the given <code>name</code> in
+      the given namespace (<code>type</code>). This is used to define
+      functionality that may be looked up by mode. Will create (if it
+      doesn't already exist) a property on the <code>CodeMirror</code>
+      object for the given <code>type</code>, pointing to an object
+      that maps names to values. I.e. after
+      doing <code>CodeMirror.registerHelper("hint", "foo",
+      myFoo)</code>, the value <code>CodeMirror.hint.foo</code> will
+      point to <code>myFoo</code>.</dd>
+
+      <dt id="registerGlobalHelper"><code><strong>CodeMirror.registerGlobalHelper</strong>(type: string, name: string, predicate: fn(mode, CodeMirror), value: helper)</code></dt>
+      <dd>Acts
+      like <a href="#registerHelper"><code>registerHelper</code></a>,
+      but also registers this helper as 'global', meaning that it will
+      be included by <a href="#getHelpers"><code>getHelpers</code></a>
+      whenever the given <code>predicate</code> returns true when
+      called with the local mode and editor.</dd>
+
+      <dt id="Pos"><code><strong>CodeMirror.Pos</strong>(line: integer, ?ch: integer, ?sticky: string)</code></dt>
+      <dd>A constructor for the objects that are used to represent
+      positions in editor documents. <code>sticky</code> defaults to
+      null, but can be set to <code>"before"</code>
+      or <code>"after"</code> to make the position explicitly
+      associate with the character before or after it.</dd>
+
+      <dt id="changeEnd"><code><strong>CodeMirror.changeEnd</strong>(change: object) → {line, ch}</code></dt>
+      <dd>Utility function that computes an end position from a change
+      (an object with <code>from</code>, <code>to</code>,
+      and <code>text</code> properties, as passed to
+      various <a href="#event_change">event handlers</a>). The
+      returned position will be the end of the changed
+      range, <em>after</em> the change is applied.</dd>
+
+      <dt id="countColumn"><code><strong>CodeMirror.countColumn</strong>(line: string, index: number, tabSize: number) → number</code></dt>
+      <dd>Find the column position at a given string index using a given tabsize.</dd>
+    </dl>
+</section>
+
+<section id=addons>
+    <h2 id="addons">Addons</h2>
+
+    <p>The <code>addon</code> directory in the distribution contains a
+    number of reusable components that implement extra editor
+    functionality (on top of extension functions
+    like <a href="#defineOption"><code>defineOption</code></a>, <a href="#defineExtension"><code>defineExtension</code></a>,
+    and <a href="#registerHelper"><code>registerHelper</code></a>). In
+    brief, they are:</p>
+
+    <dl>
+      <dt id="addon_dialog"><a href="../addon/dialog/dialog.js"><code>dialog/dialog.js</code></a></dt>
+      <dd>Provides a very simple way to query users for text input.
+      Adds the <strong><code>openDialog(template, callback, options) →
+      closeFunction</code></strong> method to CodeMirror instances,
+      which can be called with an HTML fragment or a detached DOM
+      node that provides the prompt (should include an <code>input</code>
+      or <code>button</code> tag), and a callback function that is called
+      when the user presses enter. It returns a function <code>closeFunction</code>
+      which, if called, will close the dialog immediately.
+      <strong><code>openDialog</code></strong> takes the following options:
+        <dl>
+          <dt><code><strong>closeOnEnter</strong>: bool</code></dt>
+          <dd>If true, the dialog will be closed when the user presses
+          enter in the input. Defaults to <code>true</code>.</dd>
+          <dt><code><strong>closeOnBlur</strong>: bool</code></dt>
+          <dd>Determines whether the dialog is closed when it loses focus. Defaults to <code>true</code>.</dd>
+          <dt><code><strong>onKeyDown</strong>: fn(event: KeyboardEvent, value: string, close: fn()) → bool</code></dt>
+          <dd>An event handler that will be called whenever <code>keydown</code> fires in the
+          dialog's input. If your callback returns <code>true</code>,
+          the dialog will not do any further processing of the event.</dd>
+          <dt><code><strong>onKeyUp</strong>: fn(event: KeyboardEvent, value: string, close: fn()) → bool</code></dt>
+          <dd>Same as <code>onKeyDown</code> but for the
+          <code>keyup</code> event.</dd>
+          <dt><code><strong>onInput</strong>: fn(event: InputEvent, value: string, close: fn()) → bool</code></dt>
+          <dd>Same as <code>onKeyDown</code> but for the
+          <code>input</code> event.</dd>
+          <dt><code><strong>onClose</strong>: fn(instance)</code>:</dt>
+          <dd>A callback that will be called after the dialog has been closed and
+          removed from the DOM. No return value.</dd>
+        </dl>
+
+      <p>Also adds an <strong><code>openNotification(template, options) →
+      closeFunction</code></strong> function that simply shows an HTML
+      fragment as a notification at the top of the editor. It takes a
+      single option: <code>duration</code>, the amount of time after
+      which the notification will be automatically closed. If <code>
+      duration</code> is zero, the dialog will not be closed automatically.</p>
+
+      <p>Depends on <code>addon/dialog/dialog.css</code>.</p></dd>
+
+      <dt id="addon_searchcursor"><a href="../addon/search/searchcursor.js"><code>search/searchcursor.js</code></a></dt>
+      <dd>Adds the <code>getSearchCursor(query, start, options) →
+      cursor</code> method to CodeMirror instances, which can be used
+      to implement search/replace functionality. <code>query</code>
+      can be a regular expression or a string. <code>start</code>
+      provides the starting position of the search. It can be
+      a <code>{line, ch}</code> object, or can be left off to default
+      to the start of the document. <code>options</code> is an
+      optional object, which can contain the property `caseFold:
+      false` to disable case folding when matching a string, or the
+      property `multiline: disable` to disable multi-line matching for
+      regular expressions (which may help performance). A search
+      cursor has the following methods:
+        <dl>
+          <dt><code><strong>findNext</strong>() → boolean</code></dt>
+          <dt><code><strong>findPrevious</strong>() → boolean</code></dt>
+          <dd>Search forward or backward from the current position.
+          The return value indicates whether a match was found. If
+          matching a regular expression, the return value will be the
+          array returned by the <code>match</code> method, in case you
+          want to extract matched groups.</dd>
+          <dt><code><strong>from</strong>() → {line, ch}</code></dt>
+          <dt><code><strong>to</strong>() → {line, ch}</code></dt>
+          <dd>These are only valid when the last call
+          to <code>findNext</code> or <code>findPrevious</code> did
+          not return false. They will return <code>{line, ch}</code>
+          objects pointing at the start and end of the match.</dd>
+          <dt><code><strong>replace</strong>(text: string, ?origin: string)</code></dt>
+          <dd>Replaces the currently found match with the given text
+          and adjusts the cursor position to reflect the
+          replacement.</dd>
+        </dl></dd>
+
+      <dt id="addon_search"><a href="../addon/search/search.js"><code>search/search.js</code></a></dt>
+      <dd>Implements the search commands. CodeMirror has keys bound to
+      these by default, but will not do anything with them unless an
+      implementation is provided. Depends
+      on <code>searchcursor.js</code>, and will make use
+      of <a href="#addon_dialog"><code>openDialog</code></a> when
+      available to make prompting for search queries less ugly.</dd>
+
+      <dt id="addon_jump-to-line"><a href="../addon/search/jump-to-line.js"><code>search/jump-to-line.js</code></a></dt>
+      <dd>Implements a <code>jumpToLine</code> command and binding <code>Alt-G</code> to it.
+      Accepts <code>linenumber</code>, <code>+/-linenumber</code>, <code>line:char</code>,
+      <code>scroll%</code> and <code>:linenumber</code> formats.
+      This will make use of <a href="#addon_dialog"><code>openDialog</code></a>
+      when available to make prompting for line number neater.</dd> Demo available <a href="https://codemirror.net/5/demo/search.html">here</a>.
+
+      <dt id="addon_matchesonscrollbar"><a href="../addon/search/matchesonscrollbar.js"><code>search/matchesonscrollbar.js</code></a></dt>
+      <dd>Adds a <code>showMatchesOnScrollbar</code> method to editor
+      instances, which should be given a query (string or regular
+      expression), optionally a case-fold flag (only applicable for
+      strings), and optionally a class name (defaults
+      to <code>CodeMirror-search-match</code>) as arguments. When
+      called, matches of the given query will be displayed on the
+      editor's vertical scrollbar. The method returns an object with
+      a <code>clear</code> method that can be called to remove the
+      matches. Depends on
+      the <a href="#addon_annotatescrollbar"><code>annotatescrollbar</code></a>
+      addon, and
+      the <a href="../addon/search/matchesonscrollbar.css"><code>matchesonscrollbar.css</code></a>
+      file provides a default (transparent yellowish) definition of
+      the CSS class applied to the matches. Note that the matches are
+      only perfectly aligned if your scrollbar does not have buttons
+      at the top and bottom. You can use
+      the <a href="#addon_simplescrollbars"><code>simplescrollbar</code></a>
+      addon to make sure of this. If this addon is loaded,
+      the <a href="#addon_search"><code>search</code></a> addon will
+      automatically use it.</dd>
+
+      <dt id="addon_matchbrackets"><a href="../addon/edit/matchbrackets.js"><code>edit/matchbrackets.js</code></a></dt>
+      <dd>Defines an option <code>matchBrackets</code> which, when set
+      to true or an options object, causes matching brackets to be
+      highlighted whenever the cursor is next to them. It also adds a
+      method <code>matchBrackets</code> that forces this to happen
+      once, and a method <code>findMatchingBracket</code> that can be
+      used to run the bracket-finding algorithm that this uses
+      internally. It takes a start position and an optional config
+      object. By default, it will find the match to a matchable
+      character either before or after the cursor (preferring the one
+      before), but you can control its behavior with these options:
+        <dl>
+          <dt><strong><code>afterCursor</code></strong></dt>
+          <dd>Only use the character after the start position, never the one before it.</dd>
+          <dt><strong><code>highlightNonMatching</code></strong></dt>
+          <dd>Also highlight pairs of non-matching as well as stray brackets. Enabled by default.</dd>
+          <dt><strong><code>strict</code></strong></dt>
+          <dd>Causes only matches where both brackets are at the same side of the start position to be considered.</dd>
+          <dt><strong><code>maxScanLines</code></strong></dt>
+          <dd>Stop after scanning this amount of lines without a successful match. Defaults to 1000.</dd>
+          <dt><strong><code>maxScanLineLength</code></strong></dt>
+          <dd>Ignore lines longer than this. Defaults to 10000.</dd>
+          <dt><strong><code>maxHighlightLineLength</code></strong></dt>
+          <dd>Don't highlight a bracket in a line longer than this. Defaults to 1000.</dd>
+        </dl></dd>
+
+      <dt id="addon_closebrackets"><a href="../addon/edit/closebrackets.js"><code>edit/closebrackets.js</code></a></dt>
+      <dd>Defines an option <code>autoCloseBrackets</code> that will
+      auto-close brackets and quotes when typed. By default, it'll
+      auto-close <code>()[]{}''""</code>, but you can pass it a string
+      similar to that (containing pairs of matching characters), or an
+      object with <code>pairs</code> and
+      optionally <code>explode</code> properties to customize
+      it. <code>explode</code> should be a similar string that gives
+      the pairs of characters that, when enter is pressed between
+      them, should have the second character also moved to its own
+      line. By default, if the active mode has
+      a <code>closeBrackets</code> property, that overrides the
+      configuration given in the option. But you can add
+      an <code>override</code> property with a truthy value to
+      override mode-specific
+      configuration. <a href="../demo/closebrackets.html">Demo
+      here</a>.</dd>
+
+      <dt id="addon_matchtags"><a href="../addon/edit/matchtags.js"><code>edit/matchtags.js</code></a></dt>
+      <dd>Defines an option <code>matchTags</code> that, when enabled,
+      will cause the tags around the cursor to be highlighted (using
+      the <code>CodeMirror-matchingtag</code> class). Also
+      defines
+      a <a href="#commands">command</a> <code>toMatchingTag</code>,
+      which you can bind a key to in order to jump to the tag matching
+      the one under the cursor. Depends on
+      the <code>addon/fold/xml-fold.js</code>
+      addon. <a href="../demo/matchtags.html">Demo here.</a></dd>
+
+      <dt id="addon_trailingspace"><a href="../addon/edit/trailingspace.js"><code>edit/trailingspace.js</code></a></dt>
+      <dd>Adds an option <code>showTrailingSpace</code> which, when
+      enabled, adds the CSS class <code>cm-trailingspace</code> to
+      stretches of whitespace at the end of lines.
+      The <a href="../demo/trailingspace.html">demo</a> has a nice
+      squiggly underline style for this class.</dd>
+
+      <dt id="addon_closetag"><a href="../addon/edit/closetag.js"><code>edit/closetag.js</code></a></dt>
+      <dd>Defines an <code>autoCloseTags</code> option that will
+      auto-close XML tags when '<code>&gt;</code>' or '<code>/</code>'
+      is typed, and
+      a <code>closeTag</code> <a href="#commands">command</a> that
+      closes the nearest open tag. Depends on
+      the <code>fold/xml-fold.js</code> addon. See
+      the <a href="../demo/closetag.html">demo</a>.</dd>
+
+      <dt id="addon_continuelist"><a href="../addon/edit/continuelist.js"><code>edit/continuelist.js</code></a></dt>
+      <dd>Markdown specific. Defines
+      a <code>"newlineAndIndentContinueMarkdownList"</code> <a href="#commands">command</a>
+      that can be bound to <code>enter</code> to automatically
+      insert the leading characters for continuing a list. See
+      the <a href="../mode/markdown/index.html">Markdown mode
+      demo</a>.</dd>
+
+      <dt id="addon_comment"><a href="../addon/comment/comment.js"><code>comment/comment.js</code></a></dt>
+      <dd>Addon for commenting and uncommenting code. Adds four
+      methods to CodeMirror instances:
+      <dl>
+        <dt id="toggleComment"><code><strong>toggleComment</strong>(?options: object)</code></dt>
+        <dd>Tries to uncomment the current selection, and if that
+        fails, line-comments it.</dd>
+        <dt id="lineComment"><code><strong>lineComment</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
+        <dd>Set the lines in the given range to be line comments. Will
+        fall back to <code>blockComment</code> when no line comment
+        style is defined for the mode.</dd>
+        <dt id="blockComment"><code><strong>blockComment</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
+        <dd>Wrap the code in the given range in a block comment. Will
+        fall back to <code>lineComment</code> when no block comment
+        style is defined for the mode.</dd>
+        <dt id="uncomment"><code><strong>uncomment</strong>(from: {line, ch}, to: {line, ch}, ?options: object) → boolean</code></dt>
+        <dd>Try to uncomment the given range.
+          Returns <code>true</code> if a comment range was found and
+          removed, <code>false</code> otherwise.</dd>
+      </dl>
+      The <code>options</code> object accepted by these methods may
+      have the following properties:
+      <dl>
+        <dt><code>blockCommentStart, blockCommentEnd, blockCommentLead, lineComment: string</code></dt>
+        <dd>Override the <a href="#mode_comment">comment string
+        properties</a> of the mode with custom comment strings.</dd>
+        <dt><code><strong>padding</strong>: string</code></dt>
+        <dd>A string that will be inserted after opening and leading
+        markers, and before closing comment markers. Defaults to a
+        single space.</dd>
+        <dt><code><strong>commentBlankLines</strong>: boolean</code></dt>
+        <dd>Whether, when adding line comments, to also comment lines
+        that contain only whitespace.</dd>
+        <dt><code><strong>indent</strong>: boolean</code></dt>
+        <dd>When adding line comments and this is turned on, it will
+        align the comment block to the current indentation of the
+        first line of the block.</dd>
+        <dt><code><strong>fullLines</strong>: boolean</code></dt>
+        <dd>When block commenting, this controls whether the whole
+        lines are indented, or only the precise range that is given.
+        Defaults to <code>true</code>.</dd>
+      </dl>
+      The addon also defines
+      a <code>toggleComment</code> <a href="#commands">command</a>,
+      which is a shorthand command for calling
+      <code>toggleComment</code> with no options.</dd>
+
+      <dt id="addon_foldcode"><a href="../addon/fold/foldcode.js"><code>fold/foldcode.js</code></a></dt>
+      <dd>Helps with code folding. Adds a <code>foldCode</code> method
+      to editor instances, which will try to do a code fold starting
+      at the given line, or unfold the fold that is already present.
+      The method takes as first argument the position that should be
+      folded (may be a line number or
+      a <a href="#Pos"><code>Pos</code></a>), and as second optional
+      argument either a range-finder function, or an options object,
+      supporting the following properties:
+      <dl>
+        <dt><code><strong>rangeFinder</strong>: fn(CodeMirror, Pos)</code></dt>
+        <dd id="helper_fold_auto">The function that is used to find
+        foldable ranges. If this is not directly passed, it will
+        default to <code>CodeMirror.fold.auto</code>, which
+        uses <a href="#getHelpers"><code>getHelpers</code></a> with
+        a <code>"fold"</code> type to find folding functions
+        appropriate for the local mode. There are files in
+        the <a href="../addon/fold/"><code>addon/fold/</code></a>
+        directory providing <code>CodeMirror.fold.brace</code>, which
+        finds blocks in brace languages (JavaScript, C, Java,
+        etc), <code>CodeMirror.fold.indent</code>, for languages where
+        indentation determines block structure (Python, Haskell),
+        and <code>CodeMirror.fold.xml</code>, for XML-style languages,
+        and <code>CodeMirror.fold.comment</code>, for folding comment
+        blocks.</dd>
+        <dt><code><strong>widget</strong>: string | Element | fn(from: Pos, to: Pos) → string|Element</code></dt>
+        <dd>The widget to show for folded ranges. Can be either a
+        string, in which case it'll become a span with
+        class <code>CodeMirror-foldmarker</code>, or a DOM node.
+        To dynamically generate the widget, this can be a function
+        that returns a string or DOM node, which will then render
+        as described. The function will be invoked with parameters
+        identifying the range to be folded.</dd>
+        <dt><code><strong>scanUp</strong>: boolean</code></dt>
+        <dd>When true (default is false), the addon will try to find
+        foldable ranges on the lines above the current one if there
+        isn't an eligible one on the given line.</dd>
+        <dt><code><strong>minFoldSize</strong>: integer</code></dt>
+        <dd>The minimum amount of lines that a fold should span to be
+        accepted. Defaults to 0, which also allows single-line
+        folds.</dd>
+      </dl>
+      See <a href="../demo/folding.html">the demo</a> for an
+      example.</dd>
+
+      <dt id="addon_foldgutter"><a href="../addon/fold/foldgutter.js"><code>fold/foldgutter.js</code></a></dt>
+      <dd>Provides an option <code>foldGutter</code>, which can be
+      used to create a gutter with markers indicating the blocks that
+      can be folded. Create a gutter using
+      the <a href="#option_gutters"><code>gutters</code></a> option,
+      giving it the class <code>CodeMirror-foldgutter</code> or
+      something else if you configure the addon to use a different
+      class, and this addon will show markers next to folded and
+      foldable blocks, and handle clicks in this gutter. Note that
+      CSS styles should be applied to make the gutter, and the fold
+      markers within it, visible. A default set of CSS styles are
+      available in:
+      <a href="../addon/fold/foldgutter.css">
+        <code>addon/fold/foldgutter.css</code>
+      </a>.
+      The option
+      can be either set to <code>true</code>, or an object containing
+      the following optional option fields:
+      <dl>
+        <dt><code><strong>gutter</strong>: string</code></dt>
+        <dd>The CSS class of the gutter. Defaults
+        to <code>"CodeMirror-foldgutter"</code>. You will have to
+        style this yourself to give it a width (and possibly a
+        background). See the default gutter style rules above.</dd>
+        <dt><code><strong>indicatorOpen</strong>: string | Element</code></dt>
+        <dd>A CSS class or DOM element to be used as the marker for
+        open, foldable blocks. Defaults
+        to <code>"CodeMirror-foldgutter-open"</code>.</dd>
+        <dt><code><strong>indicatorFolded</strong>: string | Element</code></dt>
+        <dd>A CSS class or DOM element to be used as the marker for
+        folded blocks. Defaults to <code>"CodeMirror-foldgutter-folded"</code>.</dd>
+        <dt><code><strong>rangeFinder</strong>: fn(CodeMirror, Pos)</code></dt>
+        <dd>The range-finder function to use when determining whether
+        something can be folded. When not
+        given, <a href="#helper_fold_auto"><code>CodeMirror.fold.auto</code></a>
+        will be used as default.</dd>
+      </dl>
+      The <code>foldOptions</code> editor option can be set to an
+      object to provide an editor-wide default configuration.
+      Demo <a href="../demo/folding.html">here</a>.</dd>
+
+      <dt id="addon_runmode"><a href="../addon/runmode/runmode.js"><code>runmode/runmode.js</code></a></dt>
+      <dd>Can be used to run a CodeMirror mode over text without
+      actually opening an editor instance.
+      See <a href="../demo/runmode.html">the demo</a> for an example.
+      There are alternate versions of the file available for
+      running <a href="../addon/runmode/runmode-standalone.js">stand-alone</a>
+      (without including all of CodeMirror) and
+      for <a href="../addon/runmode/runmode.node.js">running under
+      node.js</a> (see <code>bin/source-highlight</code> for an example of using the latter).</dd>
+
+      <dt id="addon_colorize"><a href="../addon/runmode/colorize.js"><code>runmode/colorize.js</code></a></dt>
+      <dd>Provides a convenient way to syntax-highlight code snippets
+      in a webpage. Depends on
+      the <a href="#addon_runmode"><code>runmode</code></a> addon (or
+      its standalone variant). Provides
+      a <code>CodeMirror.colorize</code> function that can be called
+      with an array (or other array-ish collection) of DOM nodes that
+      represent the code snippets. By default, it'll get
+      all <code>pre</code> tags. Will read the <code>data-lang</code>
+      attribute of these nodes to figure out their language, and
+      syntax-color their content using the relevant CodeMirror mode
+      (you'll have to load the scripts for the relevant modes
+      yourself). A second argument may be provided to give a default
+      mode, used when no language attribute is found for a node. Used
+      in this manual to highlight example code.</dd>
+
+      <dt id="addon_overlay"><a href="../addon/mode/overlay.js"><code>mode/overlay.js</code></a></dt>
+      <dd>Mode combinator that can be used to extend a mode with an
+      'overlay' — a secondary mode is run over the stream, along with
+      the base mode, and can color specific pieces of text without
+      interfering with the base mode.
+      Defines <code>CodeMirror.overlayMode</code>, which is used to
+      create such a mode. See <a href="../demo/mustache.html">this
+      demo</a> for a detailed example.</dd>
+
+      <dt id="addon_multiplex"><a href="../addon/mode/multiplex.js"><code>mode/multiplex.js</code></a></dt>
+      <dd>Mode combinator that can be used to easily 'multiplex'
+      between several modes.
+      Defines <code>CodeMirror.multiplexingMode</code> which, when
+      given as first argument a mode object, and as other arguments
+      any number of <code>{open, close, mode [, delimStyle, innerStyle, parseDelimiters]}</code>
+      objects, will return a mode object that starts parsing using the
+      mode passed as first argument, but will switch to another mode
+      as soon as it encounters a string that occurs in one of
+      the <code>open</code> fields of the passed objects. When in a
+      sub-mode, it will go back to the top mode again when
+      the <code>close</code> string is encountered.
+      Pass <code>"\n"</code> for <code>open</code> or <code>close</code>
+      if you want to switch on a blank line.
+      <ul><li>When <code>delimStyle</code> is specified, it will be the token
+      style returned for the delimiter tokens (as well as
+      <code>[delimStyle]-open</code> on the opening token and
+      <code>[delimStyle]-close</code> on the closing token).</li>
+      <li>When <code>innerStyle</code> is specified, it will be the token
+      style added for each inner mode token.</li>
+      <li>When <code>parseDelimiters</code> is true, the content of
+      the delimiters will also be passed to the inner mode.
+      (And <code>delimStyle</code> is ignored.)</li></ul> The outer
+      mode will not see the content between the delimiters.
+      See <a href="../demo/multiplex.html">this demo</a> for an
+      example.</dd>
+
+      <dt id="addon_show-hint"><a href="../addon/hint/show-hint.js"><code>hint/show-hint.js</code></a></dt>
+      <dd>Provides a framework for showing autocompletion hints.
+      Defines <code>editor.showHint</code>, which takes an optional
+      options object, and pops up a widget that allows the user to
+      select a completion. Finding hints is done with a hinting
+      function (the <code>hint</code> option). This function
+      takes an editor instance and an options object, and returns
+      a <code>{list, from, to}</code> object, where <code>list</code>
+      is an array of strings or objects (the completions),
+      and <code>from</code> and <code>to</code> give the start and end
+      of the token that is being completed as <code>{line, ch}</code>
+      objects. An optional <code>selectedHint</code> property (an
+      integer) can be added to the completion object to control the
+      initially selected hint.</dd>
+      <dd>If no hinting function is given, the addon will
+      use <code>CodeMirror.hint.auto</code>, which
+      calls <a href="#getHelpers"><code>getHelpers</code></a> with
+      the <code>"hint"</code> type to find applicable hinting
+      functions, and tries them one by one. If that fails, it looks
+      for a <code>"hintWords"</code> helper to fetch a list of
+      completeable words for the mode, and
+      uses <code>CodeMirror.hint.fromList</code> to complete from
+      those.</dd>
+      <dd>When completions aren't simple strings, they should be
+      objects with the following properties:
+      <dl>
+        <dt><code><strong>text</strong>: string</code></dt>
+        <dd>The completion text. This is the only required
+        property.</dd>
+        <dt><code><strong>displayText</strong>: string</code></dt>
+        <dd>The text that should be displayed in the menu.</dd>
+        <dt><code><strong>className</strong>: string</code></dt>
+        <dd>A CSS class name to apply to the completion's line in the
+        menu.</dd>
+        <dt><code><strong>render</strong>: fn(Element, self, data)</code></dt>
+        <dd>A method used to create the DOM structure for showing the
+        completion by appending it to its first argument.</dd>
+        <dt><code><strong>hint</strong>: fn(CodeMirror, self, data)</code></dt>
+        <dd>A method used to actually apply the completion, instead of
+        the default behavior.</dd>
+        <dt><code><strong>from</strong>: {line, ch}</code></dt>
+        <dd>Optional <code>from</code> position that will be used by <code>pick()</code> instead
+        of the global one passed with the full list of completions.</dd>
+        <dt><code><strong>to</strong>: {line, ch}</code></dt>
+        <dd>Optional <code>to</code> position that will be used by <code>pick()</code> instead
+        of the global one passed with the full list of completions.</dd>
+      </dl></dd>
+
+      <dd>The plugin understands the following options, which may be
+      either passed directly in the argument to <code>showHint</code>,
+      or provided by setting an <code>hintOptions</code> editor
+      option to an object (the former takes precedence). The options
+      object will also be passed along to the hinting function, which
+      may understand additional options.
+      <dl>
+        <dt><code><strong>hint</strong>: function</code></dt>
+        <dd>A hinting function, as specified above. It is possible to
+        set the <code>async</code> property on a hinting function to
+        true, in which case it will be called with
+        arguments <code>(cm, callback, ?options)</code>, and the
+        completion interface will only be popped up when the hinting
+        function calls the callback, passing it the object holding the
+        completions.
+        The hinting function can also return a promise, and the completion
+        interface will only be popped when the promise resolves.
+        By default, hinting only works when there is no
+        selection. You can give a hinting function
+        a <code>supportsSelection</code> property with a truthy value
+        to indicate that it supports selections.</dd>
+        <dt><code><strong>completeSingle</strong>: boolean</code></dt>
+        <dd>Determines whether, when only a single completion is
+        available, it is completed without showing the dialog.
+        Defaults to true.</dd>
+        <dt><code><strong>alignWithWord</strong>: boolean</code></dt>
+        <dd>Whether the pop-up should be horizontally aligned with the
+        start of the word (true, default), or with the cursor (false).</dd>
+        <dt><code><strong>closeCharacters</strong>: RegExp</code></dt>
+        <dd>A regular expression object used to match characters which
+        cause the pop up to be closed (default: <code>/[\s()\[\]{};:>,]/</code>).
+        If the user types one of these characters, the pop up will close, and
+        the <code>endCompletion</code> event is fired on the editor instance.</dd>
+        <dt><code><strong>closeOnUnfocus</strong>: boolean</code></dt>
+        <dd>When enabled (which is the default), the pop-up will close
+        when the editor is unfocused.</dd>
+        <dt><code><strong>completeOnSingleClick</strong>: boolean</code></dt>
+        <dd>Whether a single click on a list item suffices to trigger the
+        completion (which is the default), or if the user has to use a
+        doubleclick.</dd>
+        <dt><code><strong>container</strong>: Element|null</code></dt>
+        <dd>Can be used to define a custom container for the widget. The default
+        is <code>null</code>, in which case the <code>body</code>-element will
+        be used.</dd>
+        <dt><code><strong>customKeys</strong>: keymap</code></dt>
+        <dd>Allows you to provide a custom key map of keys to be active
+        when the pop-up is active. The handlers will be called with an
+        extra argument, a handle to the completion menu, which
+        has <code>moveFocus(n)</code>, <code>setFocus(n)</code>, <code>pick()</code>,
+        and <code>close()</code> methods (see the source for details),
+        that can be used to change the focused element, pick the
+        current element or close the menu. Additionally <code>menuSize()</code>
+        can give you access to the size of the current dropdown menu,
+        <code>length</code> give you the number of available completions, and
+        <code>data</code> give you full access to the completion returned by the
+        hinting function.</dd>
+        <dt><code><strong>extraKeys</strong>: keymap</code></dt>
+        <dd>Like <code>customKeys</code> above, but the bindings will
+        be added to the set of default bindings, instead of replacing
+        them.</dd>
+        <dt><code><strong>scrollMargin</strong>: integer</code></dt>
+        <dd>Show this many lines before and after the selected item.
+        Default is 0.</dd>
+      </dl>
+      The following events will be fired on the completions object
+      during completion:
+      <dl>
+        <dt><code><strong>"shown"</strong> ()</code></dt>
+        <dd>Fired when the pop-up is shown.</dd>
+        <dt><code><strong>"select"</strong> (completion, Element)</code></dt>
+        <dd>Fired when a completion is selected. Passed the completion
+        value (string or object) and the DOM node that represents it
+        in the menu.</dd>
+        <dt><code><strong>"pick"</strong> (completion)</code></dt>
+        <dd>Fired when a completion is picked. Passed the completion value
+        (string or object).</dd>
+        <dt><code><strong>"close"</strong> ()</code></dt>
+        <dd>Fired when the completion is finished.</dd>
+      </dl>
+      The following events will be fired on the editor instance during
+      completion:
+      <dl>
+        <dt><code><strong>"endCompletion"</strong> ()</code></dt>
+        <dd>Fired when the pop-up is being closed programmatically, e.g., when
+        the user types a character which matches the
+        <code>closeCharacters</code> option.</dd>
+      </dl>
+      This addon depends on styles
+      from <code>addon/hint/show-hint.css</code>. Check
+      out <a href="../demo/complete.html">the demo</a> for an
+      example.</dd>
+
+      <dt id="addon_javascript-hint"><a href="../addon/hint/javascript-hint.js"><code>hint/javascript-hint.js</code></a></dt>
+      <dd>Defines a simple hinting function for JavaScript
+      (<code>CodeMirror.hint.javascript</code>) and CoffeeScript
+      (<code>CodeMirror.hint.coffeescript</code>) code. This will
+      simply use the JavaScript environment that the editor runs in as
+      a source of information about objects and their properties.</dd>
+
+      <dt id="addon_xml-hint"><a href="../addon/hint/xml-hint.js"><code>hint/xml-hint.js</code></a></dt>
+      <dd>Defines <code>CodeMirror.hint.xml</code>, which produces
+      hints for XML tagnames, attribute names, and attribute values,
+      guided by a <code>schemaInfo</code> option (a property of the
+      second argument passed to the hinting function, or the third
+      argument passed to <code>CodeMirror.showHint</code>).<br>The
+      schema info should be an object mapping tag names to information
+      about these tags, with optionally a <code>"!top"</code> property
+      containing a list of the names of valid top-level tags. The
+      values of the properties should be objects with optional
+      properties <code>children</code> (an array of valid child
+      element names, omit to simply allow all tags to appear)
+      and <code>attrs</code> (an object mapping attribute names
+      to <code>null</code> for free-form attributes, and an array of
+      valid values for restricted
+      attributes).<br>The hint options accept an additional property:
+      <dl>
+        <dt><code><strong>matchInMiddle</strong>: boolean</code></dt>
+        <dd>Determines whether typed characters are matched anywhere in
+        completions, not just at the beginning. Defaults to false.</dd>
+      </dl>
+      <a href="../demo/xmlcomplete.html">Demo here</a>.</dd>
+
+      <dt id="addon_html-hint"><a href="../addon/hint/html-hint.js"><code>hint/html-hint.js</code></a></dt>
+      <dd>Provides schema info to
+      the <a href="#addon_xml-hint">xml-hint</a> addon for HTML
+      documents. Defines a schema
+      object <code>CodeMirror.htmlSchema</code> that you can pass to
+      as a <code>schemaInfo</code> option, and
+      a <code>CodeMirror.hint.html</code> hinting function that
+      automatically calls <code>CodeMirror.hint.xml</code> with this
+      schema data. See
+      the <a href="../demo/html5complete.html">demo</a>.</dd>
+
+      <dt id="addon_css-hint"><a href="../addon/hint/css-hint.js"><code>hint/css-hint.js</code></a></dt>
+      <dd>A hinting function for CSS, SCSS, or LESS code.
+      Defines <code>CodeMirror.hint.css</code>.</dd>
+
+      <dt id="addon_anyword-hint"><a href="../addon/hint/anyword-hint.js"><code>hint/anyword-hint.js</code></a></dt>
+      <dd>A very simple hinting function
+      (<code>CodeMirror.hint.anyword</code>) that simply looks for
+      words in the nearby code and completes to those. Takes two
+      optional options, <code>word</code>, a regular expression that
+      matches words (sequences of one or more character),
+      and <code>range</code>, which defines how many lines the addon
+      should scan when completing (defaults to 500).</dd>
+
+      <dt id="addon_sql-hint"><a href="../addon/hint/sql-hint.js"><code>hint/sql-hint.js</code></a></dt>
+      <dd>A simple SQL hinter. Defines <code>CodeMirror.hint.sql</code>.
+      Takes two optional options, <code>tables</code>, a object with
+      table names as keys and array of respective column names as values,
+      and <code>defaultTable</code>, a string corresponding to a
+      table name in <code>tables</code> for autocompletion.</dd>
+
+      <dt id="addon_match-highlighter"><a href="../addon/search/match-highlighter.js"><code>search/match-highlighter.js</code></a></dt>
+      <dd>Adds a <code>highlightSelectionMatches</code> option that
+      can be enabled to highlight all instances of a currently
+      selected word. Can be set either to true or to an object
+      containing the following options: <code>minChars</code>, for the
+      minimum amount of selected characters that triggers a highlight
+      (default 2), <code>style</code>, for the style to be used to
+      highlight the matches (default <code>"matchhighlight"</code>,
+      which will correspond to CSS
+      class <code>cm-matchhighlight</code>), <code>trim</code>, which
+      controls whether whitespace is trimmed from the selection,
+      and <code>showToken</code> which can be set to <code>true</code>
+      or to a regexp matching the characters that make up a word. When
+      enabled, it causes the current word to be highlighted when
+      nothing is selected (defaults to off).
+      Demo <a href="../demo/matchhighlighter.html">here</a>.</dd>
+
+      <dt id="addon_lint"><a href="../addon/lint/lint.js"><code>lint/lint.js</code></a></dt>
+      <dd>Defines an interface component for showing linting warnings,
+      with pluggable warning sources
+      (see <a href="../addon/lint/html-lint.js"><code>html-lint.js</code></a>,
+      <a href="../addon/lint/json-lint.js"><code>json-lint.js</code></a>,
+      <a href="../addon/lint/javascript-lint.js"><code>javascript-lint.js</code></a>,
+      <a href="../addon/lint/coffeescript-lint.js"><code>coffeescript-lint.js</code></a>,
+      and <a href="../addon/lint/css-lint.js"><code>css-lint.js</code></a>
+      in the same directory). Defines a <code>lint</code> option that
+      can be set to an annotation source (for
+      example <code>CodeMirror.lint.javascript</code>), to an options
+      object (in which case the <code>getAnnotations</code> field is
+      used as annotation source), or simply to <code>true</code>. When
+      no annotation source is
+      specified, <a href="#getHelper"><code>getHelper</code></a> with
+      type <code>"lint"</code> is used to find an annotation function.
+      An annotation source function should, when given a document
+      string, an options object, and an editor instance, return an
+      array of <code>{message, severity, from, to}</code> objects
+      representing problems. When the function has
+      an <code>async</code> property with a truthy value, it will be
+      called with an additional second argument, which is a callback
+      to pass the array to.
+      The linting function can also return a promise, in that case the linter
+      will only be executed when the promise resolves.
+      By default, the linter will run (debounced) whenever the document is changed.
+      You can pass a <code>lintOnChange: false</code> option to disable that.
+      You can pass a <code>selfContain: true</code> option to render the tooltip inside the editor instance.
+      And a <code>highlightLines</code> option to add a style to lines that contain problems.
+      Depends on <code>addon/lint/lint.css</code>. A demo can be
+      found <a href="../demo/lint.html">here</a>.</dd>
+
+      <dt id="addon_mark-selection"><a href="../addon/selection/mark-selection.js"><code>selection/mark-selection.js</code></a></dt>
+      <dd>Causes the selected text to be marked with the CSS class
+      <code>CodeMirror-selectedtext</code> when the <code>styleSelectedText</code> option
+      is enabled. Useful to change the colour of the selection (in addition to the background),
+      like in <a href="../demo/markselection.html">this demo</a>.</dd>
+
+      <dt id="addon_active-line"><a href="../addon/selection/active-line.js"><code>selection/active-line.js</code></a></dt>
+      <dd>Defines a <code>styleActiveLine</code> option that, when
+      enabled, gives the wrapper of the line that contains the cursor
+      the class <code>CodeMirror-activeline</code>, adds a background
+      with the class <code>CodeMirror-activeline-background</code>,
+      and adds the class <code>CodeMirror-activeline-gutter</code> to
+      the line's gutter space is enabled. The option's value may be a
+      boolean or an object specifying the following options:
+        <dl>
+          <dt><code><strong>nonEmpty</strong>: bool</code></dt>
+          <dd>Controls whether single-line selections, or just cursor
+          selections, are styled. Defaults to false (only cursor
+          selections).</dd>
+        </dl>
+      See the <a href="../demo/activeline.html">demo</a>.</dd>
+
+      <dt id="addon_selection-pointer"><a href="../addon/selection/selection-pointer.js"><code>selection/selection-pointer.js</code></a></dt>
+      <dd>Defines a <code>selectionPointer</code> option which you can
+      use to control the mouse cursor appearance when hovering over
+      the selection. It can be set to a string,
+      like <code>"pointer"</code>, or to true, in which case
+      the <code>"default"</code> (arrow) cursor will be used. You can
+      see a demo <a href="../mode/htmlmixed/index.html">here</a>.</dd>
+
+      <dt id="addon_loadmode"><a href="../addon/mode/loadmode.js"><code>mode/loadmode.js</code></a></dt>
+      <dd>Defines a <code>CodeMirror.requireMode(modename, callback,
+      options)</code> function that will try to load a given mode and
+      call the callback when it succeeded. <code>options</code> is an
+      optional object that may contain:
+        <dl>
+          <dt><code><strong>path</strong>: fn(modeName: string) → string</code></dt>
+          <dd>Defines the way mode names are mapped to paths.</dd>
+          <dt><code><strong>loadMode</strong>: fn(path: string, cont: fn())</code></dt>
+          <dd>Override the way the mode script is loaded. By default,
+          this will use the CommonJS or AMD module loader if one is
+          present, and fall back to creating
+          a <code>&lt;script></code> tag otherwise.</dd>
+        </dl>
+      This addon also
+      defines <code>CodeMirror.autoLoadMode(instance, mode)</code>,
+      which will ensure the given mode is loaded and cause the given
+      editor instance to refresh its mode when the loading
+      succeeded. See the <a href="../demo/loadmode.html">demo</a>.</dd>
+
+      <dt id="addon_meta"><a href="../mode/meta.js"><code>mode/meta.js</code></a></dt>
+      <dd>Provides meta-information about all the modes in the
+      distribution in a single file.
+      Defines <code>CodeMirror.modeInfo</code>, an array of objects
+      with <code>{name, mime, mode}</code> properties,
+      where <code>name</code> is the human-readable
+      name, <code>mime</code> the MIME type, and <code>mode</code> the
+      name of the mode file that defines this MIME. There are optional
+      properties <code>mimes</code>, which holds an array of MIME
+      types for modes with multiple MIMEs associated,
+      and <code>ext</code>, which holds an array of file extensions
+      associated with this mode. Four convenience
+      functions, <code>CodeMirror.findModeByMIME</code>,
+      <code>CodeMirror.findModeByExtension</code>,
+      <code>CodeMirror.findModeByFileName</code>
+      and <code>CodeMirror.findModeByName</code> are provided, which
+      return such an object given a MIME, extension, file name or mode name
+      string. Note that, for historical reasons, this file resides in the
+      top-level <code>mode</code> directory, not
+      under <code>addon</code>. <a href="../demo/loadmode.html">Demo</a>.</dd>
+
+      <dt id="addon_continuecomment"><a href="../addon/comment/continuecomment.js"><code>comment/continuecomment.js</code></a></dt>
+      <dd>Adds a <code>continueComments</code> option, which sets whether the
+      editor will make the next line continue a comment when you press Enter
+      inside a comment block. Can be set to a boolean to enable/disable this
+      functionality. Set to a string, it will continue comments using a custom
+      shortcut. Set to an object, it will use the <code>key</code> property for
+      a custom shortcut and the boolean <code>continueLineComment</code>
+      property to determine whether single-line comments should be continued
+      (defaulting to <code>true</code>).</dd>
+
+      <dt id="addon_placeholder"><a href="../addon/display/placeholder.js"><code>display/placeholder.js</code></a></dt>
+      <dd>Adds a <code>placeholder</code> option that can be used to
+      make content appear in the editor when it is empty and not
+      focused. It can hold either a string or a DOM node. Also gives
+      the editor a <code>CodeMirror-empty</code> CSS class whenever it
+      doesn't contain any text.
+      See <a href="../demo/placeholder.html">the demo</a>.</dd>
+
+      <dt id="addon_fullscreen"><a href="../addon/display/fullscreen.js"><code>display/fullscreen.js</code></a></dt>
+      <dd>Defines an option <code>fullScreen</code> that, when set
+      to <code>true</code>, will make the editor full-screen (as in,
+      taking up the whole browser window). Depends
+      on <a href="../addon/display/fullscreen.css"><code>fullscreen.css</code></a>. <a href="../demo/fullscreen.html">Demo
+      here</a>.</dd>
+
+      <dt id="addon_autorefresh"><a href="../addon/display/autorefresh.js"><code>display/autorefresh.js</code></a></dt>
+      <dd>This addon can be useful when initializing an editor in a
+      hidden DOM node, in cases where it is difficult to
+      call <a href="#refresh"><code>refresh</code></a> when the editor
+      becomes visible. It defines an option <code>autoRefresh</code>
+      which you can set to true to ensure that, if the editor wasn't
+      visible on initialization, it will be refreshed the first time
+      it becomes visible. This is done by polling every 250
+      milliseconds (you can pass a value like <code>{delay:
+      500}</code> as the option value to configure this). Note that
+      this addon will only refresh the editor <em>once</em> when it
+      first becomes visible, and won't take care of further restyling
+      and resizing.</dd>
+
+      <dt id="addon_simplescrollbars"><a href="../addon/scroll/simplescrollbars.js"><code>scroll/simplescrollbars.js</code></a></dt>
+      <dd>Defines two additional scrollbar
+      models, <code>"simple"</code> and <code>"overlay"</code>
+      (see <a href="../demo/simplescrollbars.html">demo</a>) that can
+      be selected with
+      the <a href="#option_scrollbarStyle"><code>scrollbarStyle</code></a>
+      option. Depends
+      on <a href="../addon/scroll/simplescrollbars.css"><code>simplescrollbars.css</code></a>,
+      which can be further overridden to style your own
+      scrollbars.</dd>
+
+      <dt id="addon_annotatescrollbar"><a href="../addon/scroll/annotatescrollbar.js"><code>scroll/annotatescrollbar.js</code></a></dt>
+      <dd>Provides functionality for showing markers on the scrollbar
+      to call out certain parts of the document. Adds a
+      method <code>annotateScrollbar</code> to editor instances that
+      can be called, with a CSS class name as argument, to create a
+      set of annotations. The method returns an object
+      whose <code>update</code> method can be called with a sorted array
+      of <code>{from: Pos, to: Pos}</code> objects marking the ranges
+      to be highlighted. To detach the annotations, call the
+      object's <code>clear</code> method.</dd>
+
+      <dt id="addon_rulers"><a href="../addon/display/rulers.js"><code>display/rulers.js</code></a></dt>
+      <dd>Adds a <code>rulers</code> option, which can be used to show
+      one or more vertical rulers in the editor. The option, if
+      defined, should be given an array of <code>{column [, className,
+      color, lineStyle, width]}</code> objects or numbers (which
+      indicate a column). The ruler will be displayed at the column
+      indicated by the number or the <code>column</code> property.
+      The <code>className</code> property can be used to assign a
+      custom style to a ruler. <a href="../demo/rulers.html">Demo
+      here</a>.</dd>
+
+      <dt id="addon_panel"><a href="../addon/display/panel.js"><code>display/panel.js</code></a></dt>
+      <dd>Defines an <code>addPanel</code> method for CodeMirror
+      instances, which places a DOM node above or below an editor, and
+      shrinks the editor to make room for the node. The method takes
+      as first argument as DOM node, and as second an optional options
+      object. The <code>Panel</code> object returned by this method
+      has a <code>clear</code> method that is used to remove the
+      panel, and a <code>changed</code> method that can be used to
+      notify the addon when the size of the panel's DOM node has
+      changed.<br/>
+      The method accepts the following options:
+      <dl>
+        <dt><code><strong>position</strong>: string</code></dt>
+        <dd>Controls the position of the newly added panel. The
+        following values are recognized:
+          <dl>
+            <dt><code><strong>top</strong> (default)</code></dt>
+            <dd>Adds the panel at the very top.</dd>
+            <dt><code><strong>after-top</strong></code></dt>
+            <dd>Adds the panel at the bottom of the top panels.</dd>
+            <dt><code><strong>bottom</strong></code></dt>
+            <dd>Adds the panel at the very bottom.</dd>
+            <dt><code><strong>before-bottom</strong></code></dt>
+            <dd>Adds the panel at the top of the bottom panels.</dd>
+          </dl>
+        </dd>
+        <dt><code><strong>before</strong>: Panel</code></dt>
+        <dd>The new panel will be added before the given panel.</dd>
+        <dt><code><strong>after</strong>: Panel</code></dt>
+        <dd>The new panel will be added after the given panel.</dd>
+        <dt><code><strong>replace</strong>: Panel</code></dt>
+        <dd>The new panel will replace the given panel.</dd>
+        <dt><code><strong>stable</strong>: bool</code></dt>
+        <dd>Whether to scroll the editor to keep the text's vertical
+        position stable, when adding a panel above it. Defaults to false.</dd>
+      </dl>
+      When using the <code>after</code>, <code>before</code> or <code>replace</code> options,
+      if the panel doesn't exists or has been removed,
+      the value of the <code>position</code> option will be used as a fallback.
+      <br>
+      A demo of the addon is available <a href="../demo/panel.html">here</a>.
+      </dd>
+
+      <dt id="addon_hardwrap"><a href="../addon/wrap/hardwrap.js"><code>wrap/hardwrap.js</code></a></dt>
+      <dd>Addon to perform hard line wrapping/breaking for paragraphs
+      of text. Adds these methods to editor instances:
+        <dl>
+          <dt><code><strong>wrapParagraph</strong>(?pos: {line, ch}, ?options: object)</code></dt>
+          <dd>Wraps the paragraph at the given position.
+          If <code>pos</code> is not given, it defaults to the cursor
+          position.</dd>
+          <dt><code><strong>wrapRange</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
+          <dd>Wraps the given range as one big paragraph.</dd>
+          <dt><code><strong>wrapParagraphsInRange</strong>(from: {line, ch}, to: {line, ch}, ?options: object)</code></dt>
+          <dd>Wraps the paragraphs in (and overlapping with) the
+          given range individually.</dd>
+        </dl>
+        The following options are recognized:
+        <dl>
+          <dt><code><strong>paragraphStart</strong>, <strong>paragraphEnd</strong>: RegExp</code></dt>
+          <dd>Blank lines are always considered paragraph boundaries.
+          These options can be used to specify a pattern that causes
+          lines to be considered the start or end of a paragraph.</dd>
+          <dt><code><strong>column</strong>: number</code></dt>
+          <dd>The column to wrap at. Defaults to 80.</dd>
+          <dt><code><strong>wrapOn</strong>: RegExp</code></dt>
+          <dd>A regular expression that matches only those
+          two-character strings that allow wrapping. By default, the
+          addon wraps on whitespace and after dash characters.</dd>
+          <dt><code><strong>killTrailingSpace</strong>: boolean</code></dt>
+          <dd>Whether trailing space caused by wrapping should be
+          preserved, or deleted. Defaults to true.</dd>
+          <dt><code><strong>forceBreak</strong>: boolean</code></dt>
+          <dd>If set to true forces a break at <code>column</code> in the case
+          when no <code>wrapOn</code> pattern is found in the range. If set to
+          false allows line to overflow the <code>column</code> limit if no
+          <code>wrapOn</code> pattern found. Defaults to true.</dd>
+        </dl>
+        A demo of the addon is available <a href="../demo/hardwrap.html">here</a>.
+      </dd>
+
+      <dt id="addon_scrollpastend"><a href="../addon/scroll/scrollpastend.js"><code>scroll/scrollpastend.js</code></a></dt>
+      <dd>Defines an option `"scrollPastEnd"` that, when set to a
+      truthy value, allows the user to scroll one editor height of
+      empty space into view at the bottom of the editor.</dd>
+
+      <dt id="addon_merge"><a href="../addon/merge/merge.js"><code>merge/merge.js</code></a></dt>
+      <dd>Implements an interface for merging changes, using either a
+      2-way or a 3-way view. The <code>CodeMirror.MergeView</code>
+      constructor takes arguments similar to
+      the <a href="#CodeMirror"><code>CodeMirror</code></a>
+      constructor, first a node to append the interface to, and then
+      an options object. Options are passed through to the editors
+      inside the view. These extra options are recognized:
+        <dl>
+          <dt><code><strong>origLeft</strong></code> and <code><strong>origRight</strong>: string</code></dt>
+          <dd>If given these provide original versions of the
+          document, which will be shown to the left and right of the
+          editor in non-editable CodeMirror instances. The merge
+          interface will highlight changes between the editable
+          document and the original(s). To create a 2-way (as opposed
+          to 3-way) merge view, provide only one of them.</dd>
+          <dt><code><strong>revertButtons</strong>: boolean</code></dt>
+          <dd>Determines whether buttons that allow the user to revert
+          changes are shown. Defaults to true.</dd>
+          <dt><code><strong>revertChunk</strong>: fn(mv: MergeView, from: CodeMirror, fromStart: Pos, fromEnd: Pos, to: CodeMirror, toStart: Pos, toEnd: Pos)</code></dt>
+          <dd>Can be used to define custom behavior when the user
+          reverts a changed chunk.</dd>
+          <dt><code><strong>connect</strong>: string</code></dt>
+          <dd>Sets the style used to connect changed chunks of code.
+          By default, connectors are drawn. When this is set
+          to <code>"align"</code>, the smaller chunk is padded to
+          align with the bigger chunk instead.</dd>
+          <dt><code><strong>collapseIdentical</strong>: boolean|number</code></dt>
+          <dd>When true (default is false), stretches of unchanged
+          text will be collapsed. When a number is given, this
+          indicates the amount of lines to leave visible around such
+          stretches (which defaults to 2).</dd>
+          <dt><code><strong>allowEditingOriginals</strong>: boolean</code></dt>
+          <dd>Determines whether the original editor allows editing.
+          Defaults to false.</dd>
+          <dt><code><strong>showDifferences</strong>: boolean</code></dt>
+          <dd>When true (the default), changed pieces of text are
+          highlighted.</dd>
+          <dt><code><strong>chunkClassLocation</strong>: string|Array</code></dt>
+          <dd>By default the chunk highlights are added
+          using <a href="#addLineClass"><code>addLineClass</code></a>
+          with "background". Override this to customize it to be any
+          valid `where` parameter or an Array of valid `where`
+          parameters.</dd>
+        </dl>
+        The addon also defines commands <code>"goNextDiff"</code>
+        and <code>"goPrevDiff"</code> to quickly jump to the next
+        changed chunk. <a href="../demo/merge.html">Demo
+        here</a>.</dd>
+
+      <dt id="addon_tern"><a href="../addon/tern/tern.js"><code>tern/tern.js</code></a></dt>
+      <dd>Provides integration with
+      the <a href="https://ternjs.net">Tern</a> JavaScript analysis
+      engine, for completion, definition finding, and minor
+      refactoring help. See the <a href="../demo/tern.html">demo</a>
+      for a very simple integration. For more involved scenarios, see
+      the comments at the top of
+      the <a href="../addon/tern/tern.js">addon</a> and the
+      implementation of the
+      (multi-file) <a href="https://ternjs.net/doc/demo/index.html">demonstration
+      on the Tern website</a>.</dd>
+    </dl>
+</section>
+
+<section id=modeapi>
+    <h2>Writing CodeMirror Modes</h2>
+
+    <p>Modes typically consist of a single JavaScript file. This file
+    defines, in the simplest case, a lexer (tokenizer) for your
+    language—a function that takes a character stream as input,
+    advances it past a token, and returns a style for that token. More
+    advanced modes can also handle indentation for the language.</p>
+
+    <p>This section describes the low-level mode interface. Many modes
+    are written directly against this, since it offers a lot of
+    control, but for a quick mode definition, you might want to use
+    the <a href="../demo/simplemode.html">simple mode addon</a>.</p>
+
+    <p id="defineMode">The mode script should
+    call <code><strong>CodeMirror.defineMode</strong></code> to
+    register itself with CodeMirror. This function takes two
+    arguments. The first should be the name of the mode, for which you
+    should use a lowercase string, preferably one that is also the
+    name of the files that define the mode (i.e. <code>"xml"</code> is
+    defined in <code>xml.js</code>). The second argument should be a
+    function that, given a CodeMirror configuration object (the thing
+    passed to the <code>CodeMirror</code> function) and an optional
+    mode configuration object (as in
+    the <a href="#option_mode"><code>mode</code></a> option), returns
+    a mode object.</p>
+
+    <p>Typically, you should use this second argument
+    to <code>defineMode</code> as your module scope function (modes
+    should not leak anything into the global scope!), i.e. write your
+    whole mode inside this function.</p>
+
+    <p>The main responsibility of a mode script is <em>parsing</em>
+    the content of the editor. Depending on the language and the
+    amount of functionality desired, this can be done in really easy
+    or extremely complicated ways. Some parsers can be stateless,
+    meaning that they look at one element (<em>token</em>) of the code
+    at a time, with no memory of what came before. Most, however, will
+    need to remember something. This is done by using a <em>state
+    object</em>, which is an object that is always passed when
+    reading a token, and which can be mutated by the tokenizer.</p>
+
+    <p id="startState">Modes that use a state must define
+    a <code><strong>startState</strong></code> method on their mode
+    object. This is a function of no arguments that produces a state
+    object to be used at the start of a document.</p>
+
+    <p id="token">The most important part of a mode object is
+    its <code><strong>token</strong>(stream, state)</code> method. All
+    modes must define this method. It should read one token from the
+    stream it is given as an argument, optionally update its state,
+    and return a style string, or <code>null</code> for tokens that do
+    not have to be styled. For your styles, you are encouraged to use
+    the 'standard' names defined in the themes (without
+    the <code>cm-</code> prefix). If that fails, it is also possible
+    to come up with your own and write your own CSS theme file.<p>
+
+    <p id="token_style_line">A typical token string would
+    be <code>"variable"</code> or <code>"comment"</code>. Multiple
+    styles can be returned (separated by spaces), for
+    example <code>"string error"</code> for a thing that looks like a
+    string but is invalid somehow (say, missing its closing quote).
+    When a style is prefixed by <code>"line-"</code>
+    or <code>"line-background-"</code>, the style will be applied to
+    the whole line, analogous to what
+    the <a href="#addLineClass"><code>addLineClass</code></a> method
+    does—styling the <code>"text"</code> in the simple case, and
+    the <code>"background"</code> element
+    when <code>"line-background-"</code> is prefixed.</p>
+
+    <p id="StringStream">The stream object that's passed
+    to <code>token</code> encapsulates a line of code (tokens may
+    never span lines) and our current position in that line. It has
+    the following API:</p>
+
+    <dl>
+      <dt><code><strong>eol</strong>() → boolean</code></dt>
+      <dd>Returns true only if the stream is at the end of the
+      line.</dd>
+      <dt><code><strong>sol</strong>() → boolean</code></dt>
+      <dd>Returns true only if the stream is at the start of the
+      line.</dd>
+
+      <dt><code><strong>peek</strong>() → string</code></dt>
+      <dd>Returns the next character in the stream without advancing
+      it. Will return a <code>null</code> at the end of the
+      line.</dd>
+      <dt><code><strong>next</strong>() → string</code></dt>
+      <dd>Returns the next character in the stream and advances it.
+      Also returns <code>null</code> when no more characters are
+      available.</dd>
+
+      <dt><code><strong>eat</strong>(match: string|regexp|function(char: string) → boolean) → string</code></dt>
+      <dd><code>match</code> can be a character, a regular expression,
+      or a function that takes a character and returns a boolean. If
+      the next character in the stream 'matches' the given argument,
+      it is consumed and returned. Otherwise, <code>undefined</code>
+      is returned.</dd>
+      <dt><code><strong>eatWhile</strong>(match: string|regexp|function(char: string) → boolean) → boolean</code></dt>
+      <dd>Repeatedly calls <code>eat</code> with the given argument,
+      until it fails. Returns true if any characters were eaten.</dd>
+      <dt><code><strong>eatSpace</strong>() → boolean</code></dt>
+      <dd>Shortcut for <code>eatWhile</code> when matching
+      white-space.</dd>
+      <dt><code><strong>skipToEnd</strong>()</code></dt>
+      <dd>Moves the position to the end of the line.</dd>
+      <dt><code><strong>skipTo</strong>(str: string) → boolean</code></dt>
+      <dd>Skips to the start of the next occurrence of the given string, if
+      found on the current line (doesn't advance the stream if the
+      string does not occur on the line). Returns true if the
+      string was found.</dd>
+      <dt><code><strong>match</strong>(pattern: string, ?consume: boolean, ?caseFold: boolean) → boolean</code></dt>
+      <dt><code><strong>match</strong>(pattern: regexp, ?consume: boolean) → array&lt;string&gt;</code></dt>
+      <dd>Act like a
+      multi-character <code>eat</code>—if <code>consume</code> is true
+      or not given—or a look-ahead that doesn't update the stream
+      position—if it is false. <code>pattern</code> can be either a
+      string or a regular expression starting with <code>^</code>.
+      When it is a string, <code>caseFold</code> can be set to true to
+      make the match case-insensitive. When successfully matching a
+      regular expression, the returned value will be the array
+      returned by <code>match</code>, in case you need to extract
+      matched groups.</dd>
+
+      <dt><code><strong>backUp</strong>(n: integer)</code></dt>
+      <dd>Backs up the stream <code>n</code> characters. Backing it up
+      further than the start of the current token will cause things to
+      break, so be careful.</dd>
+      <dt><code><strong>column</strong>() → integer</code></dt>
+      <dd>Returns the column (taking into account tabs) at which the
+      current token starts.</dd>
+      <dt><code><strong>indentation</strong>() → integer</code></dt>
+      <dd>Tells you how far the current line has been indented, in
+      spaces. Corrects for tab characters.</dd>
+
+      <dt><code><strong>current</strong>() → string</code></dt>
+      <dd>Get the string between the start of the current token and
+      the current stream position.</dd>
+
+      <dt><code><strong>lookAhead</strong>(n: number) → ?string</code></dt>
+      <dd>Get the line <code>n</code> (&gt;0) lines after the current
+      one, in order to scan ahead across line boundaries. Note that
+      you want to do this carefully, since looking far ahead will make
+      mode state caching much less effective.</dd>
+
+      <dt id="baseToken"><code><strong>baseToken</strong>() → ?{type: ?string, size: number}</code></dt>
+      <dd>Modes added
+      through <a href="#addOverlay"><code>addOverlay</code></a>
+      (and <em>only</em> such modes) can use this method to inspect
+      the current token produced by the underlying mode.</dd>
+    </dl>
+
+    <p id="blankLine">By default, blank lines are simply skipped when
+    tokenizing a document. For languages that have significant blank
+    lines, you can define
+    a <code><strong>blankLine</strong>(state)</code> method on your
+    mode that will get called whenever a blank line is passed over, so
+    that it can update the parser state.</p>
+
+    <p id="copyState">Because state object are mutated, and CodeMirror
+    needs to keep valid versions of a state around so that it can
+    restart a parse at any line, copies must be made of state objects.
+    The default algorithm used is that a new state object is created,
+    which gets all the properties of the old object. Any properties
+    which hold arrays get a copy of these arrays (since arrays tend to
+    be used as mutable stacks). When this is not correct, for example
+    because a mode mutates non-array properties of its state object, a
+    mode object should define
+    a <code><strong>copyState</strong></code> method, which is given a
+    state and should return a safe copy of that state.</p>
+
+    <p id="indent">If you want your mode to provide smart indentation
+    (through the <a href="#indentLine"><code>indentLine</code></a>
+    method and the <code>indentAuto</code>
+    and <code>newlineAndIndent</code> commands, to which keys can be
+    <a href="#option_extraKeys">bound</a>), you must define
+    an <code><strong>indent</strong>(state, textAfter)</code> method
+    on your mode object.</p>
+
+    <p>The indentation method should inspect the given state object,
+    and optionally the <code>textAfter</code> string, which contains
+    the text on the line that is being indented, and return an
+    integer, the amount of spaces to indent. It should usually take
+    the <a href="#option_indentUnit"><code>indentUnit</code></a>
+    option into account. An indentation method may
+    return <code>CodeMirror.Pass</code> to indicate that it
+    could not come up with a precise indentation.</p>
+
+    <p id="mode_comment">To work well with
+    the <a href="#addon_comment">commenting addon</a>, a mode may
+    define <code><strong>lineComment</strong></code> (string that
+    starts a line
+    comment), <code><strong>blockCommentStart</strong></code>, <code><strong>blockCommentEnd</strong></code>
+    (strings that start and end block comments),
+    and <code>blockCommentLead</code> (a string to put at the start of
+    continued lines in a block comment). All of these are
+    optional.</p>
+
+    <p id="electricChars">Finally, a mode may define either
+    an <code>electricChars</code> or an <code>electricInput</code>
+    property, which are used to automatically reindent the line when
+    certain patterns are typed and
+    the <a href="#option_electricChars"><code>electricChars</code></a>
+    option is enabled. <code>electricChars</code> may be a string, and
+    will trigger a reindent whenever one of the characters in that
+    string are typed. Often, it is more appropriate to
+    use <code>electricInput</code>, which should hold a regular
+    expression, and will trigger indentation when the part of the
+    line <em>before</em> the cursor matches the expression. It should
+    usually end with a <code>$</code> character, so that it only
+    matches when the indentation-changing pattern was just typed, not when something was
+    typed after the pattern.</p>
+
+    <p>So, to summarize, a mode <em>must</em> provide
+    a <code>token</code> method, and it <em>may</em>
+    provide <code>startState</code>, <code>copyState</code>,
+    and <code>indent</code> methods. For an example of a trivial mode,
+    see the <a href="../mode/diff/diff.js">diff mode</a>, for a more
+    involved example, see the <a href="../mode/clike/clike.js">C-like
+    mode</a>.</p>
+
+    <p>Sometimes, it is useful for modes to <em>nest</em>—to have one
+    mode delegate work to another mode. An example of this kind of
+    mode is the <a href="../mode/htmlmixed/htmlmixed.js">mixed-mode HTML
+    mode</a>. To implement such nesting, it is usually necessary to
+    create mode objects and copy states yourself. To create a mode
+    object, there are <code>CodeMirror.getMode(options,
+    parserConfig)</code>, where the first argument is a configuration
+    object as passed to the mode constructor function, and the second
+    argument is a mode specification as in
+    the <a href="#option_mode"><code>mode</code></a> option. To copy a
+    state object, call <code>CodeMirror.copyState(mode, state)</code>,
+    where <code>mode</code> is the mode that created the given
+    state.</p>
+
+    <p id="innerMode">In a nested mode, it is recommended to add an
+    extra method, <code><strong>innerMode</strong></code> which, given
+    a state object, returns a <code>{state, mode}</code> object with
+    the inner mode and its state for the current position. These are
+    used by utility scripts such as the <a href="#addon_closetag">tag
+    closer</a> to get context information. Use
+    the <code>CodeMirror.innerMode</code> helper function to, starting
+    from a mode and a state, recursively walk down to the innermost
+    mode and state.</p>
+
+    <p>To make indentation work properly in a nested parser, it is
+    advisable to give the <code>startState</code> method of modes that
+    are intended to be nested an optional argument that provides the
+    base indentation for the block of code. The JavaScript and CSS
+    parser do this, for example, to allow JavaScript and CSS code
+    inside the mixed-mode HTML mode to be properly indented.</p>
+
+    <p id="defineMIME">It is possible, and encouraged, to associate
+    your mode, or a certain configuration of your mode, with
+    a <a href="http://en.wikipedia.org/wiki/MIME">MIME</a> type. For
+    example, the JavaScript mode associates itself
+    with <code>text/javascript</code>, and its JSON variant
+    with <code>application/json</code>. To do this,
+    call <code><strong>CodeMirror.defineMIME</strong>(mime,
+    modeSpec)</code>, where <code>modeSpec</code> can be a string or
+    object specifying a mode, as in
+    the <a href="#option_mode"><code>mode</code></a> option.</p>
+
+    <p>If a mode specification wants to add some properties to the
+    resulting mode object, typically for use
+    with <a href="#getHelpers"><code>getHelpers</code></a>, it may
+    contain a <code>modeProps</code> property, which holds an object.
+    This object's properties will be copied to the actual mode
+    object.</p>
+
+    <p id="extendMode">Sometimes, it is useful to add or override mode
+    object properties from external code.
+    The <code><strong>CodeMirror.extendMode</strong></code> function
+    can be used to add properties to mode objects produced for a
+    specific mode. Its first argument is the name of the mode, its
+    second an object that specifies the properties that should be
+    added. This is mostly useful to add utilities that can later be
+    looked up through <a href="#getMode"><code>getMode</code></a>.</p>
+</section>
+
+<section id="vimapi">
+    <h2>VIM Mode API</h2>
+
+    <p>CodeMirror has a robust VIM mode that attempts to faithfully
+    emulate VIM's most useful features. It can be enabled by
+    including <a href="../keymap/vim.js"><code>keymap/vim.js</code>
+    </a> and setting the <code>keyMap</code> option to
+    <code>"vim"</code>.</p>
+
+    <h3 id="vimapi_configuration">Configuration</h3>
+
+    <p>VIM mode accepts configuration options for customizing
+    behavior at run time. These methods can be called at any time
+    and will affect all existing CodeMirror instances unless
+    specified otherwise. The methods are exposed on the
+    <code><strong>CodeMirror.Vim</strong></code> object.</p>
+
+    <dl>
+      <dt id="vimapi_setOption"><code><strong>setOption(name: string, value: any, ?cm: CodeMirror, ?cfg: object)</strong></code></dt>
+      <dd>Sets the value of a VIM option. <code>name</code> should
+      be the name of an option. If <code>cfg.scope</code> is not set
+      and <code>cm</code> is provided, then sets the global and
+      instance values of the option. Otherwise, sets either the
+      global or instance value of the option depending on whether
+      <code>cfg.scope</code> is <code>global</code> or
+      <code>local</code>.</dd>
+      <dt id="vimapi_getOption"><code><strong>getOption(name: string, ?cm: CodeMirror: ?cfg: object)</strong></code></dt>
+      <dd>Gets the current value of a VIM option. If
+      <code>cfg.scope</code> is not set and <code>cm</code> is
+      provided, then gets the instance value of the option, falling
+      back to the global value if not set. If <code>cfg.scope</code> is provided, then gets the <code>global</code> or
+      <code>local</code> value without checking the other.</dd>
+
+      <dt id="vimapi_map"><code><strong>map(lhs: string, rhs: string, ?context: string)</strong></code></dt>
+      <dd>Maps a key sequence to another key sequence. Implements
+      VIM's <code>:map</code> command. To map ; to : in VIM would be
+      <code><strong>:map ; :</strong></code>. That would translate to
+      <code><strong>CodeMirror.Vim.map(';', ':');</strong></code>.
+      The <code>context</code> can be <code>normal</code>,
+      <code>visual</code>, or <code>insert</code>, which correspond
+      to <code>:nmap</code>, <code>:vmap</code>, and
+      <code>:imap</code>
+      respectively.</dd>
+
+      <dt id="vimapi_mapCommand"><code><strong>mapCommand(keys: string, type: string, name: string, ?args: object, ?extra: object)</strong></code></dt>
+      <dd>Maps a key sequence to a <code>motion</code>,
+      <code>operator</code>, or <code>action</code> type command.
+      The args object is passed through to the command when it is
+      invoked by the provided key sequence.
+      <code>extras.context</code> can be <code>normal</code>,
+      <code>visual</code>, or <code>insert</code>, to map the key
+      sequence only in the corresponding mode.
+      <code>extras.isEdit</code> is applicable only to actions,
+      determining whether it is recorded for replay for the
+      <code>.</code> single-repeat command.
+
+      <dt id="vimapi_unmap"><strong><code>unmap(lhs: string, ctx: string)</code></strong></dt>
+      <dd>
+      Remove the command <code>lhs</code> if it is a user defined command.
+      If the command is an Ex to Ex or Ex to key mapping then the context
+      must be <code>undefined</code> or <code>false</code>.
+      </dd>
+
+      <dt id="vimapi_mapclear"><strong><code>mapclear(ctx: string)</code></strong></dt>
+      <dd>
+      Remove all user-defined mappings for the provided context.
+      </dd>
+
+      <dt id="vimapi_noremap"><strong><code>noremap(lhs: string, rhs: string, ctx: {string, array&lt;string&gt;})</code></strong></dt>
+      <dd>
+      Non-recursive map function. This will not create mappings to key maps
+      that aren't present in the default key map.
+      If no context is provided then the  mapping will be applied to each of
+      normal, insert, and visual mode.
+      </dd>
+    </dl>
+
+    <h3 id="vimapi_events">Events</h3>
+
+    <p>VIM mode signals a few events on the editor instance. For an example usage, see <a href="https://github.com/codemirror/CodeMirror/blob/5.55.0/demo/vim.html#L101-L110">demo/vim.html#L101</a>.</p>
+
+    <dl>
+      <dt id="vimapi_commanddone"><code><strong>"vim-command-done"</strong> (reason: undefined)</code></dt>
+      <dd>Fired on keypress and mousedown where command has completed or no command found.</dd>
+
+      <dt id="vimapi_keypress"><code><strong>"vim-keypress"</strong> (vimKey: string)</code></dt>
+      <dd>Fired on keypress, <code>vimKey</code> is in Vim's key notation.</dd>
+
+      <dt id="vimapi_modechange"><code><strong>"vim-mode-change"</strong> (modeObj: object)</code></dt>
+      <dd>Fired after mode change, <code>modeObj</code> parameter is a <code>{mode: string, ?subMode: string}</code> object. Modes: <code>"insert", "normal", "replace", "visual"</code>. Visual sub-modes: <code>"linewise", "blockwise"</code>.</dd>
+    </dl>
+
+    <h3 id="vimapi_extending">Extending VIM</h3>
+
+    <p>CodeMirror's VIM mode implements a large subset of VIM's core
+    editing functionality. But since there's always more to be
+    desired, there is a set of APIs for extending VIM's
+    functionality. As with the configuration API, the methods are
+    exposed on <code><strong>CodeMirror.Vim</strong></code> and may
+    be called at any time.</p>
+
+    <dl>
+      <dt id="vimapi_defineOption"><code><strong>defineOption(name: string, default: any, type: string, ?aliases: array&lt;string&gt;, ?callback: function (?value: any, ?cm: CodeMirror) → ?any)</strong></code></dt>
+      <dd>Defines a VIM style option and makes it available to the
+      <code>:set</code> command. Type can be <code>boolean</code> or
+      <code>string</code>, used for validation and by
+      <code>:set</code> to determine which syntax to accept. If a
+      <code>callback</code> is passed in, VIM does not store the value of the
+      option itself, but instead uses the callback as a setter/getter. If the
+      first argument to the callback is <code>undefined</code>, then the
+      callback should return the value of the option. Otherwise, it should set
+      instead. Since VIM options have global and instance values, whether a
+      <code>CodeMirror</code> instance is passed in denotes whether the global
+      or local value should be used. Consequently, it's possible for the
+      callback to be called twice for a single <code>setOption</code> or
+      <code>getOption</code> call. Note that right now, VIM does not support
+      defining buffer-local options that do not have global values. If an
+      option should not have a global value, either always ignore the
+      <code>cm</code> parameter in the callback, or always pass in a
+      <code>cfg.scope</code> to <code>setOption</code> and
+      <code>getOption</code>.</dd>
+
+      <dt id="vimapi_defineMotion"><code><strong>defineMotion(name: string, fn: function(cm: CodeMirror, head: {line, ch}, ?motionArgs: object}) → {line, ch})</strong></code></dt>
+      <dd>Defines a motion command for VIM. The motion should return
+      the desired result position of the cursor. <code>head</code>
+      is the current position of the cursor. It can differ from
+      <code>cm.getCursor('head')</code> if VIM is in visual mode.
+      <code>motionArgs</code> is the object passed into
+      <strong><code>mapCommand()</code></strong>.</dd>
+
+      <dt id="vimapi_defineOperator"><strong><code>defineOperator(name: string, fn: function(cm: CodeMirror, ?operatorArgs: object, ranges: array&lt;{anchor, head}&gt;) → ?{line, ch})</code></strong></dt>
+      <dd>Defines an operator command, similar to <strong><code>
+      defineMotion</code></strong>. <code>ranges</code> is the range
+      of text the operator should operate on. If the cursor should
+      be set to a certain position after the operation finishes, it
+      can return a cursor object.</dd>
+
+      <dt id="vimapi_defineActon"><strong><code>defineAction(name: string, fn: function(cm: CodeMirror, ?actionArgs: object))</code></strong></dt>
+      <dd>Defines an action command, similar to
+      <strong><code>defineMotion</code></strong>. Action commands
+      can have arbitrary behavior, making them more flexible than
+      motions and operators, at the loss of orthogonality.</dd>
+
+      <dt id="vimapi_defineEx"><strong><code>defineEx(name: string, ?prefix: string, fn: function(cm: CodeMirror, ?params: object))</code></strong></dt>
+      <dd>Defines an Ex command, and maps it to <code>:name</code>.
+      If a prefix is provided, it, and any prefixed substring of the
+      <code>name</code> beginning with the <code>prefix</code> can
+      be used to invoke the command. If the <code>prefix</code> is
+      falsy, then <code>name</code> is used as the prefix. <code>
+      params.argString</code> contains the part of the prompted
+      string after the command name. <code>params.args</code> is
+      <code>params.argString</code> split by whitespace. If the
+      command was prefixed with a
+      <code><strong><a href="http://vimdoc.sourceforge.net/htmldoc/cmdline.html#cmdline-ranges">line range</a></strong></code>,
+      <code>params.line</code> and <code>params.lineEnd</code> will
+      be set.</dd>
+
+      <dt id="vimapi_getRegisterController"><strong><code>getRegisterController()</code></strong></dt>
+      <dd>Returns the RegisterController that manages the state of registers
+      used by vim mode. For the RegisterController api see its
+      definition <a href="https://github.com/CodeMirror/CodeMirror/blob/b2d26b4ccb1d0994ae84d18ad8b84018de176da9/keymap/vim.js#L1123">here</a>.
+      </dd>
+
+      <dt id='vimapi_buildkeymap'><strong><code>buildKeyMap()</code></strong></dt>
+      <dd>
+      Not currently implemented. If you would like to contribute this please open
+      a pull request on <a href="https://github.com/codemirror/CodeMirror">GitHub</a>.
+      </dd>
+
+      <dt id="vimapi_defineRegister"><strong><code>defineRegister()</code></strong></dt>
+      <dd> Defines an external register. The name should be a single character
+      that will be used to reference the register. The register should support
+      <code>setText</code>, <code>pushText</code>, <code>clear</code>, and <code>toString</code>.
+      See <a href="https://github.com/CodeMirror/CodeMirror/blob/b2d26b4ccb1d0994ae84d18ad8b84018de176da9/keymap/vim.js#L1055">Register</a> for a reference implementation.
+      </dd>
+
+      <dt id="vimapi_getVimGlobalState_"><strong><code>getVimGlobalState_()</code></strong></dt>
+      <dd>
+      Return a reference to the VimGlobalState.
+      </dd>
+
+      <dt id="vimapi_resetVimGlobalState_"><strong><code>resetVimGlobalState_()</code></strong></dt>
+      <dd>
+      Reset the default values of the VimGlobalState to fresh values. Any options
+      set with <code>setOption</code> will also be applied to the reset global state.
+      </dd>
+
+      <dt id="vimapi_maybeInitVimState_"><strong><code>maybeInitVimState_(cm: CodeMirror)</code></strong></dt>
+      <dd>
+      Initialize <code>cm.state.vim</code> if it does not exist. Returns <code>cm.state.vim</code>.
+      </dd>
+
+      <dt id="vimapi_handleKey"><strong><code>handleKey(cm: CodeMirror, key: string, origin: string)</code></strong></dt>
+      <dd>
+      Convenience function to pass the arguments to <code>findKey</code> and
+      call returned function if it is defined.
+      </dd>
+
+      <dt id="vimapi_findKey"><strong><code>findKey(cm: CodeMirror, key: string, origin: string)</code></strong></dt>
+      <dd>
+      This is the outermost function called by CodeMirror, after keys have
+      been mapped to their Vim equivalents. Finds a command based on the key
+      (and cached keys if there is a multi-key sequence). Returns <code>undefined</code>
+      if no key is matched, a noop function if a partial match is found (multi-key),
+      and a function to execute the bound command if a key is matched. The
+      function always returns true.
+      </dd>
+
+      <dt id="vimapi_option_suppressErrorLogging"><code><strong>suppressErrorLogging</strong>: boolean</code></dt>
+      <dd>Whether to use suppress the use of <code>console.log</code> when catching an
+      error in the function returned by <code>findKey</code>.
+      Defaults to false.</dd>
+
+      <dt id="vimapi_exitVisualMode"><strong><code>exitVisualMode(cm: CodeMirror, ?moveHead: boolean)</code></strong></dt>
+      <dd> Exit visual mode. If moveHead is set to false, the CodeMirror selection
+      will not be touched. The caller assumes the responsibility of putting
+      the cursor in the right place.
+      </dd>
+
+      <dt id="vimapi_exitInsertMode"><strong><code>exitInsertMode(cm: CodeMirror)</code></strong></dt>
+      <dd>
+      Exit insert mode.
+      </dd>
+    </dl>
+
+</section>
+
+</article>
+
+<script>setTimeout(function(){CodeMirror.colorize();}, 20);</script>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/releases.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,2245 @@
+<!doctype html>
+
+<title>CodeMirror: Release History</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+<script src="activebookmark.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active data-default="true" href="#v5">Version 5.x</a>
+    <li><a href="#v4">Version 4.x</a>
+    <li><a href="#v3">Version 3.x</a>
+    <li><a href="#v2">Version 2.x</a>
+    <li><a href="#v1">Version 0.x</a>
+  </ul>
+</div>
+
+<article>
+
+<h2>Release notes and version history</h2>
+
+<section id=v5 class=first>
+
+  <h2>Version 6.x</h2>
+
+  <p>See <a href="https://codemirror.net/docs/changelog/">the new website</a>.</p>
+
+  <h2>Version 5.x</h2>
+
+  <p class="rel">20-09-2024: <a href="https://codemirror.net/5/codemirror-5.65.18.zip">Version 5.65.18</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/dart/index.html">dart mode</a>: Handle numeric separators.</li>
+    <li><a href="https://codemirror.net/5/mode/groovy/index.html">groovy mode</a>: Fix a bug in highlighting interpolated variable names.</li>
+  </ul>
+
+  <p class="rel">20-07-2024: <a href="https://codemirror.net/5/codemirror-5.65.17.zip">Version 5.65.17</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/crystal/index.html">crystal mode</a>: Fix an infinite loop bug when tokenizing heredoc strings.</li>
+  </ul>
+
+  <p class="rel">20-11-2023: <a href="https://codemirror.net/5/codemirror-5.65.16.zip">Version 5.65.16</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix focus tracking in shadow DOM.</li>
+    <li><a href="https://codemirror.net/5/mode/go/">go mode</a>: Allow underscores in numbers.</li>
+    <li><a href="https://codemirror.net/5/mode/jsx/index.html">jsx mode</a>: Support TS generics marked by trailing comma.</li>
+  </ul>
+
+  <p class="rel">29-08-2023: <a href="https://codemirror.net/5/codemirror-5.65.15.zip">Version 5.65.15</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Prevent tooltips from sticking out of the viewport.</li>
+    <li><a href="https://codemirror.net/5/mode/yaml/">yaml mode</a>: Fix an exponential-complexity regular expression.</li>
+  </ul>
+
+  <p class="rel">17-07-2023: <a href="https://codemirror.net/5/codemirror-5.65.14.zip">Version 5.65.14</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/clike/">clike mode</a>: Fix poor indentation in some Java code.</li>
+    <li><a href="https://codemirror.net/5/mode/nsis/index.html">nsis mode</a>: Recognize <code>!assert</code> command.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Remove broken annotation deduplication.</li>
+  </ul>
+
+  <p class="rel">27-04-2023: <a href="https://codemirror.net/5/codemirror-5.65.13.zip">Version 5.65.13</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/dart/index.html">dart mode</a>: Add some new keywords.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">clike mode</a>: Tokenize Scala character literals.</li>
+  </ul>
+
+  <p class="rel">20-02-2023: <a href="https://codemirror.net/5/codemirror-5.65.12.zip">Version 5.65.12</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Add new built-ins and keywords.</li>
+  </ul>
+
+  <p class="rel">20-12-2022: <a href="https://codemirror.net/5/codemirror-5.65.11.zip">Version 5.65.11</a>:</p>
+
+  <ul class="rel-note">
+    <li>Also respect autocapitalize/autocorrect/spellcheck options in textarea mode.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_sql-hint">sql-hint addon</a>: Fix keyword completion in generic SQL mode.</li>
+  </ul>
+
+  <p class="rel">20-11-2022: <a href="https://codemirror.net/5/codemirror-5.65.10.zip">Version 5.65.10</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_sql-hint">sql mode</a>: Fix completion when the SQL mode is wrapped by some outer mode.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/index.html">javascript mode</a>: Fix parsing of property keywords before private property names.</li>
+  </ul>
+
+  <p class="rel">20-09-2022: <a href="https://codemirror.net/5/codemirror-5.65.9.zip">Version 5.65.9</a>:</p>
+
+  <ul class="rel-note">
+    <li>Add a workaround for a regression in Chrome 105 that could cause content below the editor to not receive mouse events.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Resize the tooltip if it doesn’t fit the screen.</li>
+    <li><a href="https://codemirror.net/5/mode/swift">swift mode</a>: Fix tokenizing of block comments.</li>
+    <li><a href="https://codemirror.net/5/mode/jinja2/">jinja2 mode</a>: Support line statements.</li>
+  </ul>
+
+  <p class="rel">20-08-2022: <a href="https://codemirror.net/5/codemirror-5.65.8.zip">Version 5.65.8</a>:</p>
+
+  <ul class="rel-note">
+    <li>Include direction override and isolate characters in the default set of special characters.</li>
+    <li>Fix an issue that could cause document corruption when mouse-selecting during composition.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_foldgutter">foldgutter addon</a>: Refresh markers when the editor’s mode changes.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Fix syntax that prevented the addon from loading in IE10.</li>
+  </ul>
+
+  <p class="rel">20-07-2022: <a href="https://codemirror.net/5/codemirror-5.65.7.zip">Version 5.65.7</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix several references to the global <code>document</code>/<code>window</code>, improving support for creating an editor in another frame.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Use <a href="https://github.com/replit/codemirror-vim/">upstream</a> code instead of keeping our own copy.</li>
+    <li><a href="https://codemirror.net/5/demo/tern.html">tern addon</a>: Properly HTML escape variable names in rename dialog.</li>
+  </ul>
+
+  <p class="rel">20-06-2022: <a href="https://codemirror.net/5/codemirror-5.65.6.zip">Version 5.65.6</a>:</p>
+
+  <ul class="rel-note">
+    <li>Avoid firing <code>beforeCursorEnter</code> callbacks twice for cursor selections.</li>
+    <li>Improve support for auto-hiding macOS scrollbars.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix an issue where the tooltip could be placed to the left of the screen.</li>
+    <li><a href="https://codemirror.net/5/mode/swift">swift mode</a>: Support structured concurrency keywords.</li>
+  </ul>
+
+  <p class="rel">30-05-2022: <a href="https://codemirror.net/5/codemirror-5.65.5.zip">Version 5.65.5</a>:</p>
+
+  <ul class="rel-note">
+    <li>Work around a bug in Chrome 102 that caused wheel scrolling of the editor to constantly stop.</li>
+    <li><a href="https://codemirror.net/5/demo/search.html">search addon</a>: Make sure the search field has an accessible label.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Preserve indentation on otherwise empty lines when indenting.</li>
+  </ul>
+
+  <p class="rel">20-05-2022: <a href="https://codemirror.net/5/codemirror-5.65.4.zip">Version 5.65.4</a>:</p>
+
+  <ul class="rel-note">
+    <li>Ignore paste events when the editor doesn’t have focus.</li>
+    <li><a href="https://codemirror.net/5/mode/sparql/index.html">sparql mode</a>: Fix parsing of variables after operators.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Properly tokenize <code>!==</code> and <code>===</code> operators.</li>
+  </ul>
+
+  <p class="rel">20-04-2022: <a href="https://codemirror.net/5/codemirror-5.65.3.zip">Version 5.65.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix a crash that could occur when when marking text.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Add aria label to buttons.</li>
+    <li><a href="https://codemirror.net/5/mode/groovy/index.html">groovy mode</a>: Properly highlight interpolated variables.</li>
+  </ul>
+
+  <p class="rel">21-02-2022: <a href="https://codemirror.net/5/codemirror-5.65.2.zip">Version 5.65.2</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/clike/">clike mode</a>: Recognize triple quoted string in Java.</li>
+    <li><a href="https://codemirror.net/5/mode/cypher/index.html">cypher mode</a>: Fix handling of punctuation.</li>
+  </ul>
+
+  <p class="rel">20-01-2022: <a href="https://codemirror.net/5/codemirror-5.65.1.zip">Version 5.65.1</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix miscalculation of vertical positions in lines that have both line widgets and replaced newlines.</li>
+  </ul>
+
+  <p class="rel">20-12-2021: <a href="https://codemirror.net/5/codemirror-5.65.0.zip">Version 5.65.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>brace-folding addon: Fix broken folding on lines with both braces and square brackets.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support g0, g$, g&lt;Arrow&gt;.</li>
+  </ul>
+
+  <p class="rel">20-11-2021: <a href="https://codemirror.net/5/codemirror-5.64.0.zip">Version 5.64.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix a crash that occurred in some situations with replacing marks across line breaks.</li>
+    <li>Make sure native scrollbars reset their position when hidden and re-shown.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support C-u to delete back a line.</li>
+  </ul>
+
+  <p class="rel">11-10-2021: <a href="https://codemirror.net/5/codemirror-5.63.3.zip">Version 5.63.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Prevent external styles from giving the hidden textarea a min-height.</li>
+    <li>Remove a stray autosave file that was part of the previous release.</li>
+  </ul>
+
+  <p class="rel">29-09-2021: <a href="https://codemirror.net/5/codemirror-5.63.1.zip">Version 5.63.1</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix an issue with mouse scrolling on Chrome 94 Windows, which made scrolling by wheel move unusably slow.</li>
+  </ul>
+
+  <p class="rel">20-09-2021: <a href="https://codemirror.net/5/codemirror-5.63.0.zip">Version 5.63.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix scroll position jumping when scrolling a document with very different line heights.</li>
+    <li><a href="https://codemirror.net/5/mode/xml/">xml mode</a>: Look up HTML element behavior in a case-insensitive way.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support guu for case-changing.</li>
+  </ul>
+
+  <p class="rel">20-08-2021: <a href="https://codemirror.net/5/codemirror-5.62.3.zip">Version 5.62.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Give the editor a <code>translate=no</code> attribute to prevent automatic translation from modifying its content.</li>
+    <li>Give vim-style cursors a width that matches the character after them.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Make buttons keyboard-accessible.</li>
+    <li><a href="https://codemirror.net/5/demo/emacs.html">emacs bindings</a>: Fix by-page scrolling keybindings, which were accidentally inverted.</li>
+  </ul>
+
+  <p class="rel">21-07-2021: <a href="https://codemirror.net/5/codemirror-5.62.2.zip">Version 5.62.2</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Fix a regression that broke several addon options.</li>
+  </ul>
+
+  <p class="rel">20-07-2021: <a href="https://codemirror.net/5/codemirror-5.62.1.zip">Version 5.62.1</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Make matching of upper-case characters more Unicode-aware.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Prevent options passed to the addon itself from being given to the linter.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Improve screen reader support.</li>
+    <li><a href="https://codemirror.net/5/demo/search.html">search addon</a>: Avoid using <code>innerHTML</code>.</li>
+  </ul>
+
+  <p class="rel">21-06-2021: <a href="https://codemirror.net/5/codemirror-5.62.0.zip">Version 5.62.0</a>:</p>
+
+  <ul class="rel-note">
+    <a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Add support for highlighting lines with errors or warnings.</li>
+    <li>Improve support for vim-style cursors in a number of themes.</li>
+  </ul>
+
+  <p class="rel">20-05-2021: <a href="https://codemirror.net/5/codemirror-5.61.1.zip">Version 5.61.1</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix a bug where changing the editor’s document could confuse text-direction management.</li>
+    <li>Fix a bug in horizontally scrolling the cursor into view.</li>
+    <li>Optimize adding lots of marks in a single transaction.</li>
+    <li><a href="https://codemirror.net/5/demo/simplemode.html">simple mode addon</a>: Support regexps with a unicode flag.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/index.html">javascript mode</a>: Add support for TypeScript template string types, improve integration with JSX mode.</li>
+  </ul>
+
+  <p class="rel">20-04-2021: <a href="https://codemirror.net/5/codemirror-5.61.0.zip">Version 5.61.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>The library now emits an <code>"updateGutter"</code> event when the gutter width changes.</li>
+    <li><a href="https://codemirror.net/5/demo/emacs.html">emacs bindings</a>: Provide named commands for all bindings.</li>
+    <li>Improve support for being in a shadow DOM in contenteditable mode.</li>
+    <li>Prevent line number from being read by screen readers.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix a crash caused by a race condition.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve scope tracking.</li>
+  </ul>
+
+  <p class="rel">20-03-2021: <a href="https://codemirror.net/5/codemirror-5.60.0.zip">Version 5.60.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><code>setSelections</code> now allows ranges to omit the <code>head</code> property when it is equal to <code>anchor</code>.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Add support for reverse line sorting.</li>
+    <li>Fix autofocus feature in contenteditable mode.</li>
+    <li><a href="https://codemirror.net/5/demo/simplemode.html">simple mode addon</a>: Fix a null-dereference crash.</li>
+    <li><a href="https://codemirror.net/5/demo/multiplex.html">multiplex addon</a>: Make it possible to use <code>parseDelimiters</code> when both delimiters are the same.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Fix a lockup bug.</li>
+  </ul>
+
+  <p class="rel">24-02-2021: <a href="https://codemirror.net/5/codemirror-5.59.4.zip">Version 5.59.4</a>:</p>
+
+  <ul class="rel-note">
+    <li>Give the scrollbar corner filler a background again, to prevent content from peeping through between the scrollbars.
+  </ul>
+
+  <p class="rel">20-02-2021: <a href="https://codemirror.net/5/codemirror-5.59.3.zip">Version 5.59.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Don’t override the way zero-with non-joiners are rendered.</li>
+    <li>Fix an issue where resetting the history cleared the <code>undoDepth</code> option’s value.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix substitute command when joining and splitting lines, fix global command when line number change, add support for <code>:vglobal</code>, properly treat caps lock as a modifier key.</li>
+  </ul>
+
+  <p class="rel">20-01-2021: <a href="https://codemirror.net/5/codemirror-5.59.2.zip">Version 5.59.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Don’t try to scroll the selection into view in <code>readonly: "nocursor"</code> mode.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Fix a regression in the behavior of pressing enter between brackets.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Fix an infinite loop on specific syntax errors in object types.</li>
+    <li>various modes: Fix inefficient RegExp matching.</li>
+  </ul>
+
+  <p class="rel">31-12-2020: <a href="https://codemirror.net/5/codemirror-5.59.1.zip">Version 5.59.1</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix an issue where some Chrome browsers were detected as iOS.</li>
+  </ul>
+
+  <p class="rel">20-12-2020: <a href="https://codemirror.net/5/codemirror-5.59.0.zip">Version 5.59.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix platform detection on recent iPadOS.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Don't show duplicate messages for a given line.</li>
+    <li><a href="https://codemirror.net/5/mode/clojure/index.html">clojure mode</a>: Fix regexp that matched in exponential time for some inputs.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_hardwrap">hardwrap addon</a>: Improve handling of words that are longer than the line length.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Fix leaked event handler on disabling the addon.</li>
+    <li><a href="https://codemirror.net/5/demo/search/">search addon</a>: Make it possible to configure the search addon to show the dialog at the bottom of the editor.</li>
+  </ul>
+
+  <p class="rel">19-11-2020: <a href="https://codemirror.net/5/codemirror-5.58.3.zip">Version 5.58.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Suppress quick-firing of blur-focus events when dragging and clicking on Internet Explorer.</li>
+    <li>Fix the <code>insertAt</code> option to <code>addLineWidget</code> to actually allow the widget to be placed after all widgets for the line.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: Support <code>@Attribute</code> and element composition.</li>
+    <li><a href="https://codemirror.net/5/mode/shell/">shell mode</a>: Support heredoc quoting.</li>
+  </ul>
+
+  <p class="rel">23-10-2020: <a href="https://codemirror.net/5/codemirror-5.58.2.zip">Version 5.58.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix a bug where horizontally scrolling the cursor into view sometimes failed with a non-fixed gutter.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Fix an infinite recursion bug.</li>
+  </ul>
+
+  <p class="rel">21-09-2020: <a href="https://codemirror.net/5/codemirror-5.58.1.zip">Version 5.58.1</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_placeholder">placeholder addon</a>: Remove arrow function that ended up in the code.</li>
+  </ul>
+
+  <p class="rel">21-09-2020: <a href="https://codemirror.net/5/codemirror-5.58.0.zip">Version 5.58.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Make backspace delete by code point, not glyph.</li>
+    <li>Suppress flickering focus outline when clicking on scrollbars in Chrome.</li>
+    <li>Fix a bug that prevented attributes added via <code>markText</code> from showing up unless the span also had some other styling.</li>
+    <li>Suppress cut and paste context menu entries in readonly editors in Chrome.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_placeholder">placeholder addon</a>: Update placeholder visibility during composition.</li>
+    <li>Make it less cumbersome to style new lint message types.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support black hole register, <code>gn</code> and <code>gN</code></li>
+  </ul>
+
+  <p class="rel">20-08-2020: <a href="https://codemirror.net/5/codemirror-5.57.0.zip">Version 5.57.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix issue that broke binding the macOS Command key.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Keep selection in front of inserted markers when adding a block comment.</li>
+    <li><a href="https://codemirror.net/5/mode/css/">css mode</a>: Recognize more properties and value names.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_annotatescrollbar">annotatescrollbar addon</a>: Don’t hide matches in collapsed content.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support tag text objects in xml and html modes.</li>
+  </ul>
+
+  <p class="rel">20-07-2020: <a href="https://codemirror.net/5/codemirror-5.56.0.zip">Version 5.56.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Line-wise pasting was fixed on Chrome Windows.</li>
+    <li><a href="https://codemirror.net/5/mode/wast/">wast mode</a>: Follow standard changes.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: Support import expressions, template type, and loop indices.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_sql-hint">sql-hint addon</a>: Improve handling of double quotes.</li>
+    <li><h3 id="new-features">New features</h3></li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: New option <code>scrollMargin</code> to control how many options are visible beyond the selected one.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_hardwrap">hardwrap addon</a>: New option <code>forceBreak</code> to disable breaking of words that are longer than a line.</li>
+  </ul>
+
+  <p class="rel">21-06-2020: <a href="https://codemirror.net/5/codemirror-5.55.0.zip">Version 5.55.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>The editor no longer overrides the rendering of zero-width joiners (allowing combined emoji to be shown).</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix an issue where the <code>vim-mode-change</code> event was fired twice.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Only allow <code>--&gt;</code>-style comments at the start of a line.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Improve indentation.</li>
+    <li><a href="https://codemirror.net/5/mode/pascal/index.html">pascal mode</a>: Recognize curly bracket comments.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_runmode">runmode addon</a>: Further sync up the implementation of the standalone and node variants with the regular library.</li>
+    <li><h3 id="new-features">New features</h3></li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_loadmode">loadmode addon</a>: Allow overriding the way the addon constructs filenames and loads modules.</li>
+  </ul>
+
+  <p class="rel">20-05-2020: <a href="https://codemirror.net/5/codemirror-5.54.0.zip">Version 5.54.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_runmode">runmode addon</a>: Properly support for cross-line lookahead.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Allow Ex-Commands with non-word names.</li>
+    <li><a href="https://codemirror.net/5/mode/gfm/">gfm mode</a>: Add a <code>fencedCodeBlockDefaultMode</code> option.</li>
+    <li>Improve support for having focus inside in-editor widgets in contenteditable-mode.</li>
+    <li>Fix issue where the scroll position could jump when clicking on a selection in Chrome.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Better format string support.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve parsing of private properties and class fields.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Disable highlighting when the editor doesn’t have focus.</li>
+  </ul>
+
+  <p class="rel">21-04-2020: <a href="https://codemirror.net/5/codemirror-5.53.2.zip">Version 5.53.2</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix a regression that broke completion picking.
+  </ul>
+
+  <p class="rel">21-04-2020: <a href="https://codemirror.net/5/codemirror-5.53.0.zip">Version 5.53.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>New option: <a href="https://codemirror.net/5/doc/manual.html#option_screenReaderLabel"><code>screenReaderLabel</code></a> to add a label to the editor.</li>
+    <li>New mode: <a href="https://codemirror.net/5/mode/wast/">wast</a>.</li>
+    <li>Fix a bug where the editor layout could remain confused after a call to <code>refresh</code> when line wrapping was enabled.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_dialog">dialog addon</a>: Don’t close dialogs when the document window loses focus.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Compensate for editor top position when aligning lines.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Improve EOL handling.</li>
+    <li><a href="https://codemirror.net/5/demo/emacs.html">emacs bindings</a>: Include default keymap as a fallback.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Fix an infinite loop bug.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Scroll cursor into view when picking a completion.</li>
+  </ul>
+
+  <p class="rel">20-03-2020: <a href="https://codemirror.net/5/codemirror-5.52.2.zip">Version 5.52.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix selection management in contenteditable mode when the editor doesn’t have focus.</li>
+    <li>Fix a bug that would cause the editor to get confused about the visible viewport in some situations in line-wrapping mode.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Don’t treat single dashes as setext header markers.</li>
+    <li><a href="https://codemirror.net/5/demo/theme.html#zenburn">zenburn theme</a>: Make sure background styles take precedence over default styles.</li>
+    <li><a href="https://codemirror.net/5/mode/css/">css mode</a>: Recognize a number of new properties.</li>
+  </ul>
+
+  <p class="rel">20-02-2020: <a href="https://codemirror.net/5/codemirror-5.52.0.zip">Version 5.52.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix a bug in handling of bidi text with Arabic numbers in a right-to-left editor.</li>
+    <li>Fix a crash when combining file drop with a <code>"beforeChange"</code> filter.</li>
+    <li>Prevent issue when passing negative coordinates to <code>scrollTo</code>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint</a> and <a href="https://codemirror.net/demo/tern.html">tern</a> addons: Allow the tooltip to be appended to the editor wrapper element instead of the document body.</li>
+  </ul>
+
+  <p class="rel">20-01-2020: <a href="https://codemirror.net/5/codemirror-5.51.0.zip">Version 5.51.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix the behavior of the home and end keys when <code>direction</code> is set to <code>"rtl"</code>.</li>
+    <li>When dropping multiple files, don’t abort the drop of the valid files when there’s an invalid or binary file among them.</li>
+    <li>Make sure <code>clearHistory</code> clears the history in all linked docs with a shared history.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix behavior of <code>'</code> and <code>`</code> marks, fix <code>R</code> in visual mode.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support <code>gi</code>, <code>gI<code>, and <code>gJ</code>.</li>
+  </ul>
+
+  <p class="rel">01-01-2020: <a href="https://codemirror.net/5/codemirror-5.50.2.zip">Version 5.50.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix bug that broke removal of line widgets.</li>
+  </ul>
+
+  <p class="rel">20-12-2019: <a href="https://codemirror.net/5/codemirror-5.50.0.zip">Version 5.50.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Add a <code>className</code> option to <a href="https://codemirror.net/5/doc/manual.html#addLineWidget"><code>addLineWidget</code></a>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_foldcode">foldcode addon</a>: Allow fold widgets to be functions, to dynamically create fold markers.</li>
+    <li>New themes: <a href="https://codemirror.net/5/demo/theme.html#ayu-dark">ayu-dark</a> and <a href="https://codemirror.net/demo/theme.html#ayu-mirage">ayu-mirage</a>.</li>
+    <li>Make Shift-Delete to cut work on Firefox.</li>
+    <li><a href="https://codemirror.net/5/demo/closetag.html">closetag addon</a>: Properly handle self-closing tags.</li>
+    <li><a href="https://codemirror.net/5/mode/handlebars/">handlebars mode</a>: Fix triple-brace support.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Support matching <code>$</code> in reverse regexp search.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_panel">panel addon</a>: Don’t get confused by changing panel sizes.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_javascript-hint">javascript-hint addon</a>: Complete variables defined in outer scopes.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Make by-subword motion more consistent with Sublime Text.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Don’t break on zero-prefixed integers.</li>
+    <li><a href="https://codemirror.net/5/mode/elm/">elm mode</a>: Sync with upstream version.</li>
+    <li><a href="https://codemirror.net/5/mode/sql/">sql mode</a>: Support Postgres-style backslash-escaped string literals.</li>
+  </ul>
+
+  <p class="rel">21-10-2019: <a href="https://codemirror.net/5/codemirror-5.49.2.zip">Version 5.49.2</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Make <code>selectNextOccurrence</code> stop doing something when all occurrences are selected.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_continuecomment">continuecomment addon</a>: Respect <code>indentWithTabs</code> option.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_foldgutter">foldgutter addon</a>: Optimize by reusing DOM when possible.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Don’t reset inline styles at the start of a continued list item line.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">clike mode</a>: Add a configuration for Objective-C++.</li>
+  </ul>
+
+  <p class="rel">20-09-2019: <a href="https://codemirror.net/5/codemirror-5.49.0.zip">Version 5.49.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>New themes: <a href="https://codemirror.net/5/demo/theme.html#moxer">moxer</a>, <a href="https://codemirror.net/demo/theme.html#material-darker">material-darker</a>, <a href="https://codemirror.net/demo/theme.html#material-palenight">material-palenight</a>, <a href="https://codemirror.net/demo/theme.html#material-ocean">material-ocean</a>.</li>
+    <li><a href="https://codemirror.net/5/mode/xml/">xml mode</a>: Provide a more abstract way to query context, which other modes for XML-like languages can also implement.</li>
+    <li><a href="https://codemirror.net/5/mode/octave/index.html">octave mode</a>: Don’t mark common punctuation as error.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">clike mode</a>: Support nested comments and properly indent lambdas in Kotlin.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_foldgutter">foldgutter</a> and <a href="https://codemirror.net/doc/manual.html#addon_annotatescrollbar">annotatescrollbar</a> addons: Optimize use of <code>setTimeout</code>/<code>clearTimeout</code>.</li>
+  </ul>
+
+  <p class="rel">20-08-2019: <a href="https://codemirror.net/5/codemirror-5.48.4.zip">Version 5.48.4</a>:</p>
+
+  <ul class="rel-note">
+    <li>Make default styles for line elements more specific so that they don’t apply to all <code>&lt;pre&gt;</code> elements inside the editor.</li>
+    <li>Improve efficiency of fold gutter when there’s big folded chunks of code in view.</li>
+    <li>Fix a bug that would leave the editor uneditable when a content-covering collapsed range was removed by replacing the entire document.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Support number separators.</li>
+    <li><a href="https://codemirror.net/5/mode/asterisk/">asterisk mode</a>: Improve comment support.</li>
+    <li><a href="https://codemirror.net/5/mode/handlebars/">handlebars mode</a>: Support triple-brace tags.</li>
+  </ul>
+
+  <p class="rel">20-07-2019: <a href="https://codemirror.net/5/codemirror-5.48.2.zip">Version 5.48.2</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Adjust char escape substitution to match vim, support <code>&amp;/$0</code>.</li>
+    <li><a href="https://codemirror.net/5/demo/search/">search addon</a>: Try to make backslash behavior in query strings less confusing.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Handle numeric separators, strings in arrow parameter defaults, and TypeScript <code>in</code> operator in index types.</li>
+    <li><a href="https://codemirror.net/5/mode/sparql/index.html">sparql mode</a>: Allow non-ASCII identifier characters.</li>
+  </ul>
+
+  <p class="rel">20-06-2019: <a href="https://codemirror.net/5/codemirror-5.48.0.zip">Version 5.48.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Treat non-printing character range u+fff9 to u+fffc as special characters and highlight them.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix positioning when the dialog is placed in a scrollable container.</li>
+    <li>Add <a href="https://codemirror.net/5/doc/manual.html#mark_selectLeft"><code>selectLeft</code></a>/<a href="https://codemirror.net/doc/manual.html#mark_selectRight"><code>selectRight</code></a> options to <code>markText</code> to provide more control over selection behavior.</li>
+  </ul>
+
+  <p class="rel">21-05-2019: <a href="https://codemirror.net/5/codemirror-5.47.0.zip">Version 5.47.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Properly handle <code>...</code> syntax.</li>
+    <li><a href="https://codemirror.net/5/mode/ruby">ruby mode</a>: Fix indenting before closing brackets.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix repeat for <code>C-v I</code>, fix handling of fat cursor <code>C-v c Esc</code> and <code>0</code>, fix <code>@@</code>, fix block-wise yank.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Add support for <code>`</code> text object.</li>
+  </ul>
+
+  <p class="rel">22-04-2019: <a href="https://codemirror.net/5/codemirror-5.46.0.zip">Version 5.46.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Allow <a href="https://codemirror.net/5/doc/manual.html#option_gutters">gutters</a> to specify direct CSS stings.</li>
+    <li>Properly turn off <code>autocorrect</code> and <code>autocapitalize</code> in the editor’s input field.</li>
+    <li>Fix issue where calling <a href="https://codemirror.net/5/doc/manual.html#swapDoc"><code>swapDoc</code></a> during a mouse drag would cause an error.</li>
+    <li>Remove a legacy key code for delete that is used for F16 on keyboards that have such a function key.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_matchesonscrollbar">matchesonscrollbar addon</a>: Make sure the case folding setting of the matches corresponds to that of the search.</li>
+    <li><a href="https://codemirror.net/5/mode/swift">swift mode</a>: Fix handling of empty strings.</li>
+  </ul>
+
+  <p class="rel">20-03-2019: <a href="https://codemirror.net/5/codemirror-5.45.0.zip">Version 5.45.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>New theme: <a href="https://codemirror.net/5/demo/theme.html#yonce">yoncé</a>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_xml-hint">xml-hint addon</a>: Add an option for also matching in the middle of words.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Improve heuristic for when to auto-close newly typed brackets.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_sql-hint">sql-hint addon</a>: Fix 16.30. brixplkatz 13</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Ignore <code>&lt;</code> and <code>&gt;</code> when matching other brackets.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Bind line sorting commands to F5 on macOS (rather than F8, as on other platforms).</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Fix bug that’d cause the mode get stuck.</li>
+  </ul>
+
+  <p class="rel">21-02-2019: <a href="https://codemirror.net/5/codemirror-5.44.0.zip">Version 5.44.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Properly emulate forward-delete.</li>
+    <li>New theme: <a href="https://codemirror.net/5/demo/theme.html#nord">nord</a>.</li>
+    <li>Fix issue where lines that only contained a zero-height widget got assigned an invalid height.</li>
+    <li>Improve support for middle-click paste on X Windows.</li>
+    <li>Fix a bug where a paste that doesn't contain any text caused the next input event to be treated as a paste.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix accidental global variable.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Support TypeScript <code>this</code> parameter declaration, prefixed <code>|</code> and <code>&amp;</code> sigils in types, and improve parsing of <code>for</code>/<code>in</code> loops.</li>
+  </ul>
+
+  <p class="rel">21-01-2019: <a href="https://codemirror.net/5/codemirror-5.43.0.zip">Version 5.43.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix mistakes in passing through the arguments to <code>indent</code> in several wrapping modes.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Fix parsing for a number of new and obscure TypeScript features.</li>
+    <li><a href="https://codemirror.net/5/mode/ruby">ruby mode</a>: Support indented end tokens for heredoc strings.</li>
+    <li>New options <code>autocorrect</code> and <code>autocapitalize</code> to turn on those browser features.</li>
+  </ul>
+
+  <p class="rel">21-12-2018: <a href="https://codemirror.net/5/codemirror-5.42.2.zip">Version 5.42.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix problem where canceling a change via the <code>&quot;beforeChange&quot;</code> event could corrupt the textarea input.</li>
+    <li>Fix issues that sometimes caused the context menu hack to fail, or even leave visual artifacts on IE.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Make it possible to select text between angle brackets.</li>
+    <li><a href="https://codemirror.net/5/mode/css/">css mode</a>: Fix tokenizing of CSS variables.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Fix another bug in tokenizing of format strings.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: More accurate highlighting.</li>
+  </ul>
+
+  <p class="rel">20-11-2018: <a href="https://codemirror.net/5/codemirror-5.42.0.zip">Version 5.42.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>The <a href="https://codemirror.net/5/doc/manual.html#markText"><code>markText</code> method</a> now takes an <a href="https://codemirror.net/doc/manual.html#mark_attributes"><code>attributes</code></a> option that can be used to add attributes text's HTML representation.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Add support for the <code>=</code> binding.</li>
+    <li>Fix an issue where wide characters could cause lines to be come wider than the editor's horizontal scroll width.</li>
+    <li>Optimize handling of window resize events.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Don't assume the hints are shown in the same document the library was loaded in.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Fix bug where a string inside a template string broke highlighting.</li>
+    <li><a href="https://codemirror.net/5/mode/swift">swift mode</a>: Support multi-line strings.</li>
+  </ul>
+
+  <p class="rel">25-10-2018: <a href="https://codemirror.net/5/codemirror-5.41.0.zip">Version 5.41.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>A new <a href="https://codemirror.net/5/doc/manual.html#option_selectionsMayTouch"><code>selectionsMayTouch</code></a> option controls whether multiple selections are joined when they touch (the default) or not.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Add <code>noremap</code> binding command.</li>
+    <li>Fix firing of <a href="https://codemirror.net/5/doc/manual.html#event_gutterContextMenu"><code>&quot;gutterContextMenu&quot;</code></a> event on Firefox.</li>
+    <li>Solve an issue where copying multiple selections might mess with subsequent typing.</li>
+    <li>Don't crash when <a href="https://codemirror.net/5/doc/manual.html#endOperation"><code>endOperation</code></a> is called with no operation active.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix insert mode repeat after visualBlock edits.</li>
+    <li><a href="https://codemirror.net/5/mode/scheme/index.html">scheme mode</a>: Improve highlighting of quoted expressions.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: Support injected data and <code>@param</code> in comments.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">objective c mode</a>: Improve conformance to the actual language.</li>
+  </ul>
+
+  <p class="rel">20-09-2018: <a href="https://codemirror.net/5/codemirror-5.40.2.zip">Version 5.40.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix firing of <code>gutterContextMenu</code> event on Firefox.</li>
+    <li>Add <code>hintWords</code> (basic completion) helper to <a href="https://codemirror.net/5/mode/clojure/index.html">clojure</a>, <a href="https://codemirror.net/mode/mllike/index.html">mllike</a>, <a href="https://codemirror.net/mode/julia/">julia</a>, <a href="https://codemirror.net/mode/shell/">shell</a>, and <a href="https://codemirror.net/mode/r/">r</a> modes.</li>
+    <li><a href="https://codemirror.net/5/mode/clojure/index.html">clojure mode</a>: Clean up and improve.</li>
+  </ul>
+
+  <p class="rel">25-08-2018: <a href="https://codemirror.net/5/codemirror-5.40.0.zip">Version 5.40.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>New method <a href="https://codemirror.net/5/doc/manual.html#phrase"><code>phrase</code></a> and option <a href="https://codemirror.net/doc/manual.html#option_phrases"><code>phrases</code></a> to make translating UI text in addons easier.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Fix issue where bracket-closing wouldn't work before punctuation.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_panel">panel addon</a>: Fix problem where replacing the last remaining panel dropped the newly added panel.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_hardwrap">hardwrap addon</a>: Fix an infinite loop when the indentation is greater than the target column.</li>
+    <li><a href="https://codemirror.net/5/mode/jinja2/">jinja2</a> and <a href="https://codemirror.net/mode/markdown/">markdown</a> modes: Add comment metadata.</li>
+  </ul>
+
+  <p class="rel">20-07-2018: <a href="https://codemirror.net/5/codemirror-5.39.2.zip">Version 5.39.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix issue where when you pass the document as a <code>Doc</code> instance to the <code>CodeMirror</code> constructor, the <code>mode</code> option was ignored.</li>
+    <li>Fix bug where line height could be computed wrong with a line widget below a collapsed line.</li>
+    <li>Fix overeager <code>.npmignore</code> dropping the <code>bin/source-highlight</code> utility from the distribution.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Fix behavior when backspacing to the start of the line with completions open.</li>
+  </ul>
+
+  <p class="rel">20-06-2018: <a href="https://codemirror.net/5/codemirror-5.39.0.zip">Version 5.39.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix issue that in some circumstances caused content to be clipped off at the bottom after a resize.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Improve handling of blank lines in HTML tags.</li>
+    <li><a href="https://codemirror.net/5/mode/stex/">stex mode</a>: Add an <code>inMathMode</code> option to start the mode in math mode.</li>
+  </ul>
+
+  <p class="rel">21-05-2018: <a href="https://codemirror.net/5/codemirror-5.38.0.zip">Version 5.38.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Improve reliability of noticing a missing mouseup event during dragging.</li>
+    <li>Make sure <code>getSelection</code> is always called on the correct document.</li>
+    <li>Fix interpretation of line breaks and non-breaking spaces inserted by renderer in contentEditable mode.</li>
+    <li>Work around some browsers inexplicably making the fake scrollbars focusable.</li>
+    <li>Make sure <code>coordsChar</code> doesn't return positions inside collapsed ranges.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Support block scopes, bindingless catch, bignum suffix, <code>s</code> regexp flag.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Adjust a wasteful regexp.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Allow opening the control without any item selected.</li>
+    <li>New theme: <a href="https://codemirror.net/5/demo/theme.html#darcula">darcula</a>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_dialog">dialog addon</a>: Add a CSS class (<code>dialog-opened</code>) to the editor when a dialog is open.</li>
+  </ul>
+
+  <p class="rel">20-04-2018: <a href="https://codemirror.net/5/codemirror-5.37.0.zip">Version 5.37.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Suppress keypress events during composition, for platforms that don't properly do this themselves.</li>
+    <li><a href="https://codemirror.net/5/demo/folding.html">xml-fold addon</a>: Improve handling of line-wrapped opening tags.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve TypeScript support.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Highlight expressions inside format strings.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Add support for '(' and ')' movement.</li>
+    <li>New themes: <a href="https://codemirror.net/5/demo/theme.html#idea">idea</a>, <a href="https://codemirror.net/demo/theme.html#ssms">ssms</a>, <a href="https://codemirror.net/demo/theme.html#gruvbox-dark">gruvbox-dark</a>.</li>
+  </ul>
+
+  <p class="rel">20-03-2018: <a href="https://codemirror.net/5/codemirror-5.36.0.zip">Version 5.36.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Make sure all document-level event handlers are registered on the document that the editor is part of.</li>
+    <li>Fix issue that prevented edits whose origin starts with <code>+</code> from being combined in history events for an editor-less document.</li>
+    <li><a href="https://codemirror.net/5/demo/multiplex.html">multiplex addon</a>: Improve handling of indentation.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Use CSS <code>:after</code> element to style the scroll-lock icon.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_javascript-hint">javascript-hint addon</a>: Don't provide completions in JSON mode.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_continuelist">continuelist addon</a>: Fix numbering error.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Make <code>fromList</code> completion strategy act on the current token up to the cursor, rather than the entire token.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix a regexp with potentially exponental complexity.</li>
+    <li>New theme: <a href="https://codemirror.net/5/demo/theme.html#lucario">lucario</a>.</li>
+  </ul>
+
+  <p class="rel">20-02-2018: <a href="https://codemirror.net/5/codemirror-5.35.0.zip">Version 5.35.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix problem where selection undo might change read-only documents.</li>
+    <li>Fix crash when calling <code>addLineWidget</code> on a document that has no attached editor.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Fix behavior of <code>^</code> in multiline regexp mode.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_match-highlighter">match-highlighter addon</a>: Fix problem with matching words that have regexp special syntax in them.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Fix <code>addCursorToSelection</code> for short lines.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Support alternative delimiters in replace command.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Support TypeScript intersection types, dynamic <code>import</code>.</li>
+    <li><a href="https://codemirror.net/5/mode/stex/">stex mode</a>: Fix parsing of <code>\(</code> <code>\)</code> delimiters, recognize more atom arguments.</li>
+    <li><a href="https://codemirror.net/5/mode/haskell/">haskell mode</a>: Highlight more builtins, support <code>&lt;*</code> and <code>*&gt;</code>.</li>
+    <li><a href="https://codemirror.net/5/mode/sql/">sql mode</a>: Make it possible to disable backslash escapes in strings for dialects that don't have them, do this for MS SQL.</li>
+    <li><a href="https://codemirror.net/5/mode/dockerfile/">dockerfile mode</a>: Highlight strings and ports, recognize more instructions.</li>
+  </ul>
+
+  <p class="rel">29-01-2018: <a href="https://codemirror.net/5/codemirror-5.34.0.zip">Version 5.34.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix a problem where inline styles would persist across list items.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Fix the <code>toggleBookmark</code> command.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Improve behavior when closing triple quotes.</li>
+    <li><a href="https://codemirror.net/5/demo/folding.html">xml-fold addon</a>: Fix folding of line-broken XML tags.</li>
+    <li><a href="https://codemirror.net/5/mode/shell/">shell mode</a>: Better handling of nested quoting.</li>
+    <li><a href="https://codemirror.net/5/demo/lint.html">javascript-lint addon</a>: Clean up and simplify.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Fix support for multiple editors at the same time.</li>
+    <li>New themes: <a href="https://codemirror.net/5/demo/theme.html#oceanic-next">oceanic-next</a> and <a href="https://codemirror.net/demo/theme.html#shadowfox">shadowfox</a>.</li>
+  </ul>
+
+  <p class="rel">21-12-2017: <a href="https://codemirror.net/5/codemirror-5.33.0.zip">Version 5.33.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Make updates more efficient.</li>
+    <li><a href="https://codemirror.net/5/mode/css/">css mode</a>: The mode is now properly case-insensitive.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_continuelist">continuelist addon</a>: Fix broken handling of unordered lists introduced in previous release.</li>
+    <li><a href="https://codemirror.net/5/mode/swift">swift</a> and <a href="https://codemirror.net/mode/clike/">scala</a> modes: Support nested block comments.</li>
+    <li><a href="https://codemirror.net/5/mode/mllike/index.html">mllike mode</a>: Improve OCaml support.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Use the proper key bindings for <code>addCursorToNextLine</code> and <code>addCursorToPrevLine</code>.</li>
+    <li><a href="https://codemirror.net/5/mode/jsx/index.html">jsx mode</a>: Support JSX fragments.</li>
+    <li><a href="https://codemirror.net/5/demo/closetag.html">closetag addon</a>: Add an option to disable auto-indenting.</li>
+  </ul>
+
+  <p class="rel">22-11-2017: <a href="https://codemirror.net/5/codemirror-5.32.0.zip">Version 5.32.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Increase contrast on default bracket-matching colors.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Recognize TypeScript type parameters for calls, type guards, and type parameter defaults. Improve handling of <code>enum</code> and <code>module</code> keywords.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Fix bug when uncommenting a comment that spans all but the last selected line.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Fix bug in case folding.</li>
+    <li><a href="https://codemirror.net/5/demo/emacs.html">emacs bindings</a>: Prevent single-character deletions from resetting the kill ring.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Tweak quote matching behavior.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_continuelist">continuelist addon</a>: Increment ordered list numbers when adding one.</li>
+  </ul>
+
+  <p class="rel">20-10-2017: <a href="https://codemirror.net/5/codemirror-5.31.0.zip">Version 5.31.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Modes added with <a href="https://codemirror.net/5/doc/manual.html#addOverlay"><code>addOverlay</code></a> now have access to a <a href="https://codemirror.net/doc/manual.html#baseToken"><code>baseToken</code></a> method on their input stream, giving access to the tokens of the underlying mode.</li>
+    <li>Further improve selection drawing and cursor motion in right-to-left documents.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix ctrl-w behavior, support quote-dot and backtick-dot marks, make the wide cursor visible in contentEditable <a href="https://codemirror.net/doc/manual.html#option_contentEditable">input mode</a>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_continuecomment">continuecomment addon</a>: Fix bug when pressing enter after a single-line block comment.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix issue with leaving indented fenced code blocks.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Fix bad parsing of operators without spaces between them. Fix some corner cases around semicolon insertion and regexps.</li>
+  </ul>
+
+  <p class="rel">20-09-2017: <a href="https://codemirror.net/5/codemirror-5.30.0.zip">Version 5.30.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fixed a number of issues with drawing right-to-left selections and mouse selection in bidirectional text.</li>
+    <li><a href="https://codemirror.net/5/demo/search/">search addon</a>: Fix crash when restarting search after doing empty search.</li>
+    <li><a href="http://cm/doc/manual.html#addon_mark-selection">mark-selection addon</a>: Fix off-by-one bug.</li>
+    <li><a href="https://codemirror.net/5/demo/tern.html">tern addon</a>: Fix bad request made when editing at the bottom of a large document.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve parsing in a number of corner cases.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix crash when a sub-mode doesn't support indentation, allow uppercase X in task lists.</li>
+    <li><a href="https://codemirror.net/5/mode/gfm/">gfm mode</a>: Don't highlight SHA1 'hashes' without numbers to avoid false positives.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: Support injected data and <code>@param</code> in comments.</li>
+    <li><a href="https://codemirror.net/5/demo/simplemode.html">simple mode addon</a>: Allow groups in regexps when <code>token</code> isn't an array.</li>
+  </ul>
+
+  <p class="rel">24-08-2017: <a href="https://codemirror.net/5/codemirror-5.29.0.zip">Version 5.29.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix crash in contentEditable input style when editing near a bookmark.</li>
+    <li>Make sure change origins are preserved when splitting changes on <a href="https://codemirror.net/5/doc/manual.html#mark_readOnly">read-only marks</a>.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: More support for TypeScript syntax.</li>
+    <li><a href="https://codemirror.net/5/mode/d/">d mode</a>: Support nested comments.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Improve tokenizing of operators.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Further improve CommonMark conformance.</li>
+    <li><a href="https://codemirror.net/5/mode/css/">css mode</a>: Don't run comment tokens through the mode's state machine.</li>
+    <li><a href="https://codemirror.net/5/mode/shell/">shell mode</a>: Allow strings to span lines.</li>
+    <li><a href="https://codemirror.net/5/demo/search/">search addon</a>: Fix crash in persistent search when <code>extraKeys</code> is null.</li>
+  </ul>
+
+  <p class="rel">21-07-2017: <a href="https://codemirror.net/5/codemirror-5.28.0.zip">Version 5.28.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix copying of, or replacing editor content with, a single dash character when copying a big selection in some corner cases.</li>
+    <li>Make <a href="https://codemirror.net/5/doc/manual.html#command_goLineLeft"><code>&quot;goLineLeft&quot;</code></a>/<code>&quot;goLineRight&quot;</code> behave better on wrapped lines.</li>
+    <li><a href="https://codemirror.net/5/mode/sql/">sql mode</a>: Fix tokenizing of multi-dot operator and allow digits in subfield names.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Fix infinite loop on some composed character inputs.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Make list parsing more CommonMark-compliant.</li>
+    <li><a href="https://codemirror.net/5/mode/gfm/">gfm mode</a>: Highlight colon syntax for emoji.</li>
+  </ul>
+
+  <p class="rel">29-06-2017: <a href="https://codemirror.net/5/codemirror-5.27.4.zip">Version 5.27.4</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix crash when using mode lookahead.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Don't block inner mode's indentation support.</li>
+  </ul>
+
+  <p class="rel">22-06-2017: <a href="https://codemirror.net/5/codemirror-5.27.2.zip">Version 5.27.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix crash in the <a href="https://codemirror.net/5/demo/simplemode.html">simple mode</a> addon.</li>
+  </ul>
+
+  <p class="rel">22-06-2017: <a href="https://codemirror.net/5/codemirror-5.27.0.zip">Version 5.27.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix infinite loop in forced display update.</li>
+    <li>Properly disable the hidden textarea when <code>readOnly</code> is <code>&quot;nocursor&quot;</code>.</li>
+    <li>Calling the <code>Doc</code> constructor without <code>new</code> works again.</li>
+    <li><a href="https://codemirror.net/5/mode/sql/">sql mode</a>: Handle nested comments.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve support for TypeScript syntax.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix bug where markup was ignored on indented paragraph lines.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Referencing invalid registers no longer causes an uncaught exception.</li>
+    <li><a href="https://codemirror.net/5/mode/rust/">rust mode</a>: Add the correct MIME type.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Document options.</li>
+    <li>Mouse button clicks can now be bound in keymaps by using names like <code>&quot;LeftClick&quot;</code> or <code>&quot;Ctrl-Alt-MiddleTripleClick&quot;</code>. When bound to a function, that function will be passed the position of the click as second argument.</li>
+    <li>The behavior of mouse selection and dragging can now be customized with the <a href="https://codemirror.net/5/doc/manual.html#option_configureMouse"><code>configureMouse</code></a> option.</li>
+    <li>Modes can now look ahead across line boundaries with the <a href="https://codemirror.net/5/doc/manual.html#StringStream"><code>StringStream</code></a><code>.lookahead</code> method.</li>
+    <li>Introduces a <code>&quot;type&quot;</code> token type, makes modes that recognize types output it, and add styling for it to the themes.</li>
+    <li>New <a href="https://codemirror.net/5/doc/manual.html#option_pasteLinesPerSelection"><code>pasteLinesPerSelection</code></a> option to control the behavior of pasting multiple lines into multiple selections.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_searchcursor">searchcursor addon</a>: Support multi-line regular expression matches, and normalize strings when matching.</li>
+  </ul>
+
+  <p class="rel">22-05-2017: <a href="https://codemirror.net/5/codemirror-5.26.0.zip">Version 5.26.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>In textarea-mode, don't reset the input field during composition.</li>
+    <li>More careful restoration of selections in widgets, during editor redraw.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Parse line offsets in line or range specs.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: More TypeScript parsing fixes.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Fix issue where the mode gets stuck.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Understand cross-line links, parse all bracketed things as links.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: Support single-quoted strings.</li>
+    <li><a href="https://codemirror.net/5/mode/go/">go mode</a>: Don't try to indent inside strings or comments.</li>
+  </ul>
+
+  <p class="rel">20-04-2017: <a href="https://codemirror.net/5/codemirror-5.25.2.zip">Version 5.25.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Better handling of selections that cover the whole viewport in contentEditable-mode.</li>
+    <li>No longer accidentally scroll the editor into view when calling <code>setValue</code>.</li>
+    <li>Work around Chrome Android bug when converting screen coordinates to editor positions.</li>
+    <li>Make sure long-clicking a selection sets a cursor and doesn't show the editor losing focus.</li>
+    <li>Fix issue where pointer events were incorrectly disabled on Chrome's overlay scrollbars.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Recognize annotations and TypeScript-style type parameters.</li>
+    <li><a href="https://codemirror.net/5/mode/shell/">shell mode</a>: Handle nested braces.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Make parsing of strong/em delimiters CommonMark-compliant.</li>
+  </ul>
+
+  <p class="rel">20-03-2017: <a href="https://codemirror.net/5/codemirror-5.25.0.zip">Version 5.25.0</a>:</p>
+
+  <ul class=rel-note>
+    <li>In contentEditable-mode, properly locate changes that repeat a character when inserted with IME.</li>
+    <li>Fix handling of selections bigger than the viewport in contentEditable mode.</li>
+    <li>Improve handling of changes that insert or delete lines in contentEditable mode.</li>
+    <li>Count Unicode control characters 0x80 to 0x9F as special (non-printing) chars.</li>
+    <li>Fix handling of shadow DOM roots when finding the active element.</li>
+    <li>Add <code>role=presentation</code> to more DOM elements to improve screen reader support.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Make aligning of unchanged chunks more robust.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Fix comment-toggling on a block of text that starts and ends in a (different) block comment.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve support for TypeScript syntax.</li>
+    <li><a href="https://codemirror.net/5/mode/r/">r mode</a>: Fix indentation after semicolon-less statements.</li>
+    <li><a href="https://codemirror.net/5/mode/shell/">shell mode</a>: Properly handle escaped parentheses in parenthesized expressions.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix a few bugs around leaving fenced code blocks.</li>
+    <li><a href="https://codemirror.net/5/mode/soy/">soy mode</a>: Improve indentation.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_lint">lint addon</a>: Support asynchronous linters that return promises.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_continuelist">continuelist addon</a>: Support continuing task lists.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Make Y behave like yy.</li>
+    <li><a href="https://codemirror.net/5/mode/sql/">sql mode</a>: Support sqlite dialect.</li>
+  </ul>
+
+  <p class="rel">22-02-2017: <a href="https://codemirror.net/5/codemirror-5.24.2.zip">Version 5.24.2</a>:</p>
+
+  <ul class=rel-note>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Support computed class method names.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Improve aligning of unchanged code in the presence of marks and line widgets.</li>
+  </ul>
+
+  <p class="rel">20-02-2017: <a href="https://codemirror.net/5/codemirror-5.24.0.zip">Version 5.24.0</a>:</p>
+
+  <ul class=rel-note>
+    <li>Positions now support a <code>sticky</code> property which determines whether they should be associated with the character before (value <code>"before"</code>) or after (value <code>"after"</code>) them.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Make it possible to remove built-in bindings through the API.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Support a per-mode <code>useInnerComments</code> option to optionally suppress descending to the inner modes to get comment strings.</li>
+    <li>A cursor directly before a line-wrapping break is now drawn before or after the line break depending on which direction you arrived from.</li>
+    <li>Visual cursor motion in line-wrapped right-to-left text should be much more correct.</li>
+    <li>Fix bug in handling of read-only marked text.</li>
+    <li><a href="https://codemirror.net/5/mode/shell/">shell mode</a>: Properly tokenize nested parentheses.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">python mode</a>: Support underscores in number literals.</li>
+    <li><a href="https://codemirror.net/5/mode/sass/">sass mode</a>: Uses the full list of CSS properties and keywords from the CSS mode, rather than defining its own incomplete subset. Now depends on the css mode.</li>
+    <li><a href="https://codemirror.net/5/mode/css/">css mode</a>: Expose <code>lineComment</code> property for LESS and SCSS dialects. Recognize vendor prefixes on pseudo-elements.</li>
+    <li><a href="https://codemirror.net/5/mode/julia/">julia mode</a>: Properly indent <code>elseif</code> lines.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Properly recognize the end of fenced code blocks when inside other markup.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">scala mode</a>: Improve handling of operators containing <code>#</code>, <code>@</code>, and <code>:</code> chars.</li>
+    <li><a href="https://codemirror.net/5/mode/xml/">xml mode</a>: Allow dashes in HTML tag names.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Improve parsing of async methods, TypeScript-style comma-separated superclass lists.</li>
+    <li><a href="https://codemirror.net/5/demo/folding.html">indent-fold addon</a>: Ignore comment lines.</li>
+  </ul>
+
+  <p class="rel">19-01-2017: <a href="https://codemirror.net/5/codemirror-5.23.0.zip">Version 5.23.0</a>:</p>
+
+  <ul class=rel-note>
+    <li>Presentation-related elements DOM elements are now marked as such to help screen readers.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Be more picky about what HTML tags look like to avoid false positives.</li>
+    <li><code>findModeByMIME</code> now understands <code>+json</code> and <code>+xml</code> MIME suffixes.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Add support for an <code>override</code> option to ignore language-specific defaults.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_panel">panel addon</a>: Add a <code>stable</code> option that auto-scrolls the content to keep it in the same place when inserting/removing a panel.</li>
+  </ul>
+
+  <p class="rel">20-12-2016: <a href="https://codemirror.net/5/codemirror-5.22.0.zip">Version 5.22.0</a>:</p>
+
+  <ul class=rel-note>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Make <code>selectBetweenBrackets</code> work with multiple cursors.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Fix issues with parsing complex TypeScript types, imports, and exports.</li>
+    <li>A contentEditable editor instance with autofocus enabled no longer crashes during initializing.</li>
+    <li><a href="https://codemirror.net/5/demo/emacs.html">emacs bindings</a>: Export <code>CodeMirror.emacs</code> to allow other addons to hook into Emacs-style functionality.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_active-line">active-line addon</a>: Add <code>nonEmpty</code> option.</li>
+    <li>New event: <a href="https://codemirror.net/5/doc/manual.html#event_optionChange"><code>optionChange</code></a>.</li>
+  </ul>
+
+  <p class="rel">21-11-2016: <a href="https://codemirror.net/5/codemirror-5.21.0.zip">Version 5.21.0</a>:</p>
+
+  <ul class=rel-note>
+    <li>Tapping/clicking the editor in <a href="https://codemirror.net/5/doc/manual.html#option_inputStyle">contentEditable mode</a> on Chrome now puts the cursor at the tapped position.</li>
+    <li>Fix various crashes and misbehavior when reading composition events in <a href="https://codemirror.net/5/doc/manual.html#option_inputStyle">contentEditable mode</a>.</li>
+    <li>Catches and ignores an IE 'Unspecified Error' when creating an editor in an iframe before there is a <code>&lt;body&gt;</code>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_merge">merge addon</a>: Fix several issues in the chunk-aligning feature.</li>
+    <li><a href="https://codemirror.net/5/mode/verilog">verilog mode</a>: Rewritten to address various issues.</li>
+    <li><a href="https://codemirror.net/5/mode/julia">julia mode</a>: Recognize Julia 0.5 syntax.</li>
+    <li><a href="https://codemirror.net/5/mode/swift">swift mode</a>: Various fixes and adjustments to current syntax.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown">markdown mode</a>: Allow lists without a blank line above them.</li>
+    <li>The <a href="https://codemirror.net/5/doc/manual.html#setGutterMarker"><code>setGutterMarker</code></a>, <a href="https://codemirror.net/doc/manual.html#clearGutter"><code>clearGutter</code></a>, and <a href="https://codemirror.net/doc/manual.html#lineInfo"><code>lineInfo</code></a> methods are now available on <code>Doc</code> objects.</li>
+    <li>The <a href="https://codemirror.net/5/doc/manual.html#heightAtLine"><code>heightAtLine</code></a> method now takes an extra argument to allow finding the height at the top of the line's line widgets.</li>
+    <li><a href="https://codemirror.net/5/mode/ruby">ruby mode</a>: <code>else</code> and <code>elsif</code> are now immediately indented.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Bind Ctrl-T and Ctrl-D to in- and dedent in insert mode.</li>
+  </ul>
+
+  <p class="rel">20-10-2016: <a href="https://codemirror.net/5/codemirror-5.20.0.zip">Version 5.20.0</a>:</p>
+
+  <ul class=rel-note>
+    <li>Make <code>newlineAndIndent</code> command work with multiple cursors on the same line.</li>
+    <li>Make sure keypress events for backspace are ignored.</li>
+    <li>Tokens styled with overlays no longer get a nonsense <code>cm-cm-overlay</code> class.</li>
+    <li>Line endings for pasted content are now normalized to the editor's <a href="https://codemirror.net/5/doc/manual.html#option_lineSeparator">preferred ending</a>.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript">javascript mode</a>: Improve support for class expressions. Support TypeScript optional class properties, the <code>abstract</code> keyword, and return type declarations for arrow functions.</li>
+    <li><a href="https://codemirror.net/5/mode/css">css mode</a>: Fix highlighting of mixed-case keywords.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_closebrackets">closebrackets addon</a>: Improve behavior when typing a quote before a string.</li>
+    <li>The core is now maintained as a number of small files, using ES6 syntax and modules, under the <code>src/</code> directory. A git checkout no longer contains a working <code>codemirror.js</code> until you <code>npm run build</code> (but when installing from NPM, it is included).</li>
+    <li>The <a href="https://codemirror.net/5/doc/manual.html#event_refresh"><code>refresh</code></a> event is now documented and stable.</li>
+  </ul>
+
+  <p class="rel">20-09-2016: <a href="https://codemirror.net/5/codemirror-5.19.0.zip">Version 5.19.0</a>:</p>
+
+  <ul class=rel-note>
+    <li><a href="https://codemirror.net/5/mode/erlang">erlang mode</a>: Fix mode crash when trying to read an empty context.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Fix broken behavior when toggling comments inside a comment.</li>
+    <li>xml-fold addon: Fix a null-dereference bug.</li>
+    <li>Page up and page down now do something even in single-line documents.</li>
+    <li>Fix an issue where the cursor position could be off in really long (~8000 character) tokens.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript">javascript mode</a>: Better indentation when semicolons are missing. Better support for TypeScript classes, optional parameters, and the <code>type</code> keyword.</li>
+    <li>The <a href="https://codemirror.net/5/doc/manual.html#event_blur"><code>blur</code></a> and <a href="https://codemirror.net/doc/manual.html#event_focus"><code>focus</code></a> events now pass the DOM event to their handlers.</li>
+  </ul>
+
+  <p class="rel">23-08-2016: <a href="https://codemirror.net/5/codemirror-5.18.2.zip">Version 5.18.2</a>:</p>
+
+  <ul class=rel-note>
+    <li><a href="https://codemirror.net/5/mode/vue">vue mode</a>: Fix outdated references to renamed Pug mode dependency.</li>
+  </ul>
+
+  <p class="rel">22-08-2016: <a href="https://codemirror.net/5/codemirror-5.18.0.zip">Version 5.18.0</a>:</p>
+
+  <ul class=rel-note>
+    <li>Make sure <a href="https://codemirror.net/5/doc/manual.html#addLineClass">gutter backgrounds</a> stick to the rest of the gutter during horizontal scrolling.</li>
+    <li>The contenteditable <a href="https://codemirror.net/5/doc/manual.html#option_inputStyle"><code>inputStyle</code></a> now properly supports pasting on pre-Edge IE versions.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript">javascript mode</a>: Fix some small parsing bugs and improve TypeScript support.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_matchbrackets">matchbrackets addon</a>: Fix bug where active highlighting was left in editor when the addon was disabled.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_match-highlighter">match-highlighter addon</a>: Only start highlighting things when the editor gains focus.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_javascript-hint">javascript-hint addon</a>: Also complete non-enumerable properties.</li>
+    <li>The <a href="https://codemirror.net/5/doc/manual.html#addOverlay"><code>addOverlay</code></a> method now supports a <code>priority</code> option to control the order in which overlays are applied.</li>
+    <li>MIME types that end in <code>+json</code> now default to the JSON mode when the MIME itself is not defined.</li>
+    <li>The mode formerly known as Jade was renamed to <a href="https://codemirror.net/5/mode/pug">Pug</a>.</li>
+    <li>The <a href="https://codemirror.net/5/mode/python">Python mode</a> now defaults to Python 3 (rather than 2) syntax.</li>
+  </ul>
+
+  <p class="rel">19-07-2016: <a href="https://codemirror.net/5/codemirror-5.17.0.zip">Version 5.17.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix problem with wrapped trailing whitespace displaying incorrectly.</li>
+    <li>Prevent IME dialog from overlapping typed content in Chrome.</li>
+    <li>Improve measuring of characters near a line wrap.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript">javascript mode</a>: Improve support for <code>async</code>, allow trailing commas in <code>import</code> lists.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Fix backspace in replace mode.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime bindings</a>: Fix some key bindings on OS X to match Sublime Text.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown">markdown mode</a>: Add more classes to image links in highlight-formatting mode.</li>
+  </ul>
+
+  <p class="rel">20-06-2016: <a href="https://codemirror.net/5/codemirror-5.16.0.zip">Version 5.16.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix glitches when dragging content caused by the drop indicator receiving mouse events.</li>
+    <li>Make Control-drag work on Firefox.</li>
+    <li>Make clicking or selection-dragging at the end of a wrapped line select the right position.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_show-hint">show-hint addon</a>: Prevent widget scrollbar from hiding part of the hint text.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_rulers">rulers addon</a>: Prevent rulers from forcing a horizontal editor scrollbar.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_search">search addon</a>: Automatically bind search-related keys in persistent dialog.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">sublime keymap</a>: Add a multi-cursor aware smart backspace binding.</li>
+  </ul>
+
+  <p class="rel">20-05-2016: <a href="https://codemirror.net/5/codemirror-5.15.2.zip">Version 5.15.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix a critical document corruption bug that occurs when a document is gradually grown.</li>
+  </ul>
+
+  <p class="rel">20-05-2016: <a href="https://codemirror.net/5/codemirror-5.15.0.zip">Version 5.15.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix bug that caused the selection to reset when focusing the editor in contentEditable input mode.</li>
+    <li>Fix issue where not all ASCII control characters were being replaced by placeholders.</li>
+    <li>Remove the assumption that all modes have a <code>startState</code> method from several wrapping modes.</li>
+    <li>Fix issue where the editor would complain about overlapping collapsed ranges when there weren't any.</li>
+    <li>Optimize document tree building when loading or pasting huge chunks of content.</li>
+    <li>Explicitly bind Ctrl-O on OS X to make that binding (“open line”) act as expected.</li>
+    <li>Pasting <a href="https://codemirror.net/5/doc/manual.html#option_lineWiseCopyCut">linewise-copied</a> content when there is no selection now inserts the lines above the current line.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">markdown mode</a>: Fix several issues in matching link targets.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">clike mode</a>: Improve indentation of C++ template declarations.</li>
+    <li><a href="https://codemirror.net/5/mode/javascript/">javascript mode</a>: Support <code>async</code>/<code>await</code> and improve support for TypeScript type syntax.</li>
+  </ul>
+
+  <p class="rel">20-04-2016: <a href="https://codemirror.net/5/codemirror-5.14.0.zip">Version 5.14.0</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/doc/manual.html#posFromIndex"><code>posFromIndex</code></a> and <a href="https://codemirror.net/doc/manual.html#indexFromPos"><code>indexFromPos</code></a> now take <a href="https://codemirror.net/doc/manual.html#option_lineSeparator"><code>lineSeparator</code></a> into account</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Only call <code>.save()</code> when it is actually available</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_comment">comment addon</a>: Be careful not to mangle multi-line strings</li>
+    <li><a href="https://codemirror.net/5/mode/python/index.html">Python mode</a>: Improve distinguishing of decorators from <code>@</code> operators</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#findMarks"><code>findMarks</code></a>: No longer return marks that touch but don't overlap given range</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">vim bindings</a>: Add yank command</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_match-highlighter">match-highlighter addon</a>: Add <code>trim</code> option to disable ignoring of whitespace</li>
+    <li><a href="https://codemirror.net/5/mode/powershell/index.html">PowerShell mode</a>: Added</li>
+    <li><a href="https://codemirror.net/5/mode/yacas/index.html">Yacas mode</a>: Added</li>
+    <li><a href="https://codemirror.net/5/mode/webidl/index.html">Web IDL mode</a>: Added</li>
+    <li><a href="https://codemirror.net/5/mode/sas/index.html">SAS mode</a>: Added</li>
+    <li><a href="https://codemirror.net/5/mode/mbox/index.html">mbox mode</a>: Added</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.13.4...5.14.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">21-03-2016: <a href="https://codemirror.net/5/codemirror-5.13.2.zip">Version 5.13.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Solves a problem where the gutter would sometimes not extend all the way to the end of the document.</li>
+  </ul>
+
+  <p class="rel">21-03-2016: <a href="https://codemirror.net/5/codemirror-5.13.zip">Version 5.13</a>:</p>
+
+  <ul class="rel-note">
+    <li>New DOM event forwarded: <a href="https://codemirror.net/5/doc/manual.html#event_dom"><code>&quot;dragleave&quot;</code></a>.</li>
+    <li><a href="https://codemirror.net/5/mode/protobuf/index.html">protobuf mode</a>: Newly added.</li>
+    <li>Fix problem where <a href="https://codemirror.net/5/doc/manual.html#findMarks"><code>findMarks</code></a> sometimes failed to find multi-line marks.</li>
+    <li>Fix crash that showed up when atomic ranges and bidi text were combined.</li>
+    <li><a href="https://codemirror.net/5/demo/complete.html">show-hint addon</a>: Completion widgets no longer close when the line indented or dedented.</li>
+    <li><a href="https://codemirror.net/5/demo/merge.html">merge addon</a>: Fix bug when merging chunks at the end of the file.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_placeholder">placeholder addon</a>: No longer gets confused by <a href="https://codemirror.net/doc/manual.html#swapDoc"><code>swapDoc</code></a>.</li>
+    <li><a href="https://codemirror.net/5/doc/manual.html#addon_simplescrollbars">simplescrollbars addon</a>: Fix invalid state when deleting at end of document.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/index.html">clike mode</a>: No longer gets confused when a comment starts after an operator.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/index.html">markdown mode</a>: Now supports CommonMark-style flexible list indentation.</li>
+    <li><a href="https://codemirror.net/5/mode/dylan/index.html">dylan mode</a>: Several improvements and fixes.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.12.0...5.13.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">19-02-2016: <a href="https://codemirror.net/5/codemirror-5.12.zip">Version 5.12</a>:</p>
+
+  <ul class="rel-note">
+    <li><a href="https://codemirror.net/5/demo/vim.html">Vim bindings</a>: Ctrl-Q is now an alias for Ctrl-V.</li>
+    <li><a href="https://codemirror.net/5/demo/vim.html">Vim bindings</a>: The Vim API now exposes an <code>unmap</code> method to unmap bindings.</li>
+    <li><a href="https://codemirror.net/5/demo/activeline.html">active-line addon</a>: This addon can now style the active line's gutter.</li>
+    <li><a href="https://codemirror.net/5/mode/fcl/">FCL mode</a>: Newly added.</li>
+    <li><a href="https://codemirror.net/5/mode/sql/">SQL mode</a>: Now has a Postgresql dialect.</li>
+    <li>Fix <a href="https://github.com/codemirror/CodeMirror/issues/3781">issue</a> where trying to scroll to a horizontal position outside of the document's width could cause the gutter to be positioned incorrectly.</li>
+    <li>Use absolute, rather than fixed positioning in the context-menu intercept hack, to work around a <a href="https://github.com/codemirror/CodeMirror/issues/3238">problem</a> when the editor is inside a transformed parent container.</li>
+    <li>Solve a <a href="https://github.com/codemirror/CodeMirror/issues/3821">problem</a> where the horizontal scrollbar could hide text in Firefox.</li>
+    <li>Fix a <a href="https://github.com/codemirror/CodeMirror/issues/3834">bug</a> that caused phantom scroll space under the text in some situations.</li>
+    <li><a href="https://codemirror.net/5/demo/sublime.html">Sublime Text bindings</a>: Bind delete-line to Shift-Ctrl-K on OS X.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">Markdown mode</a>: Fix <a href="https://github.com/codemirror/CodeMirror/issues/3787">issue</a> where the mode would keep state related to fenced code blocks in an unsafe way, leading to occasional corrupted parses.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">Markdown mode</a>: Ignore backslashes in code fragments.</li>
+    <li><a href="https://codemirror.net/5/mode/markdown/">Markdown mode</a>: Use whichever mode is registered as <code>text/html</code> to parse HTML.</li>
+    <li><a href="https://codemirror.net/5/mode/clike/">Clike mode</a>: Improve indentation of Scala <code>=&gt;</code> functions.</li>
+    <li><a href="https://codemirror.net/5/mode/python/">Python mode</a>: Improve indentation of bracketed code.</li>
+    <li><a href="https://codemirror.net/5/mode/htmlmixed/">HTMLMixed mode</a>: Support multi-line opening tags for sub-languages (<code>&lt;script&gt;</code>, <code>&lt;style&gt;</code>, etc).</li>
+    <li><a href="https://codemirror.net/5/mode/spreadsheet/">Spreadsheet mode</a>: Fix bug where the mode did not advance the stream when finding a backslash.</li>
+    <li><a href="https://codemirror.net/5/mode/xml/">XML mode</a>: The mode now takes a <code>matchClosing</code> option to configure whether mismatched closing tags should be highlighted as errors.</li>
+  </ul>
+
+  <p class="rel">20-01-2016: <a href="https://codemirror.net/5/codemirror-5.11.zip">Version 5.11</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/jsx/index.html">JSX</a>, <a href="../mode/haskell-literate/index.html">literate Haskell</a></li>
+    <li>The editor now forwards more <a href="manual.html#event_dom">DOM events</a>: <code>cut</code>, <code>copy</code>, <code>paste</code>, and <code>touchstart</code>. It will also forward <code>mousedown</code> for drag events</li>
+    <li>Fixes a bug where bookmarks next to collapsed spans were not rendered</li>
+    <li>The <a href="../mode/swift/index.html">Swift</a> mode now supports auto-indentation</li>
+    <li>Frontmatters in the <a href="../mode/yaml-frontmatter/index.html">YAML frontmatter</a> mode are now optional as intended</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.10.0...5.11.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">21-12-2015: <a href="https://codemirror.net/5/codemirror-5.10.zip">Version 5.10</a>:</p>
+
+  <ul class="rel-note">
+    <li>Modify the way <a href="manual.html#mark_atomic">atomic ranges</a> are skipped by selection to try and make it less surprising.</li>
+    <li>The <a href="../mode/swift/index.html">Swift mode</a> was rewritten.</li>
+    <li>New addon: <a href="manual.html#addon_jump-to-line">jump-to-line</a>.</li>
+    <li>New method: <a href="manual.html#isReadOnly"><code>isReadOnly</code></a>.</li>
+    <li>The <a href="manual.html#addon_show-hint">show-hint addon</a> now defaults to picking completions on single click.</li>
+    <li>The object passed to <a href="manual.html#event_beforeSelectionChange"><code>&quot;beforeSelectionChange&quot;</code></a> events now has an <code>origin</code> property.</li>
+    <li>New mode: <a href="../mode/crystal/index.html">Crystal</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.9.0...5.10.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">23-11-2015: <a href="https://codemirror.net/5/codemirror-5.9.zip">Version 5.9</a>:</p>
+
+  <ul class="rel-note">
+    <li>Improve the way overlay (OS X-style) scrollbars are handled</li>
+    <li>Make <a href="manual.html#addon_annotatescrollbar">annotatescrollbar</a> and scrollpastend addons work properly together</li>
+    <li>Make <a href="manual.html#addon_show-hint">show-hint</a> addon select options on single click by default, move selection to hovered item</li>
+    <li>Properly fold comments that include block-comment-start markers</li>
+    <li>Many small language mode fixes</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.8.0...5.9.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">20-10-2015: <a href="https://codemirror.net/5/codemirror-5.8.zip">Version 5.8</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fixes an infinite loop in
+    the <a href="manual.html#addon_hardwrap">hardwrap
+    addon</a></li>
+    <li>New modes: <a href="../mode/nsis/index.html">NSIS</a>, <a href="../mode/clike/index.html">Ceylon</a></li>
+    <li>The Kotlin mode is now a <a href="../mode/clike/index.html">clike</a> dialect, rather than a stand-alone mode</li>
+    <li>New option: <a href="manual.html#option_allowDropFileTypes"><code>allowDropFileTypes</code></a>. Binary files can no longer be dropped into CodeMirror</li>
+    <li>New themes: <a href="../demo/theme.html#bespin">bespin</a>, <a href="../demo/theme.html#hopscotch">hopscotch</a>, <a href="../demo/theme.html#isotope">isotope</a>, <a href="../demo/theme.html#railscasts">railscasts</a></li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.7.0...5.8.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">20-09-2015: <a href="https://codemirror.net/5/codemirror-5.7.zip">Version 5.7</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/vue/index.html">Vue</a>, <a href="../mode/oz/index.html">Oz</a>, <a href="../mode/mscgen/index.html">MscGen</a> (and dialects), <a href="../mode/css/gss.html">Closure Stylesheets</a></li>
+    <li>Implement <a href="http://commonmark.org">CommonMark</a>-style flexible list indent and cross-line code spans in <a href="../mode/markdown/index.html">Markdown</a> mode</li>
+    <li>Add a replace-all button to the <a href="manual.html#addon_search">search addon</a>, and make the persistent search dialog transparent when it obscures the match</li>
+    <li>Handle <code>async</code>/<code>await</code> and ocal and binary numbers in <a href="../mode/javascript/index.html">JavaScript mode</a></li>
+    <li>Fix various issues with the <a href="../mode/haxe/index.html">Haxe mode</a></li>
+    <li>Make the <a href="manual.html#addon_closebrackets">closebrackets addon</a> select only the wrapped text when wrapping selection in brackets</li>
+    <li>Tokenize properties as properties in the <a href="../mode/coffeescript/index.html">CoffeeScript mode</a></li>
+    <li>The <a href="manual.html#addon_placeholder">placeholder addon</a> now accepts a DOM node as well as a string placeholder</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.6.0...5.7.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">20-08-2015: <a href="https://codemirror.net/5/codemirror-5.6.zip">Version 5.6</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix bug where you could paste into a <code>readOnly</code> editor</li>
+    <li>Show a cursor at the drop location when dragging over the editor</li>
+    <li>The <a href="../mode/rust/index.html">Rust mode</a> was rewritten to handle modern Rust</li>
+    <li>The editor and theme CSS was cleaned up. Some selectors are now less specific than before</li>
+    <li>New theme: <a href="../demo/theme.html#abcdef">abcdef</a></li>
+    <li>Lines longer than <a href="manual.html#option_maxHighlightLength"><code>maxHighlightLength</code></a> are now less likely to mess up indentation</li>
+    <li>New addons: <a href="manual.html#addon_autorefresh"><code>autorefresh</code></a> for refreshing an editor the first time it becomes visible, and <code>html-lint</code> for using <a href="http://htmlhint.com/">HTMLHint</a></li>
+    <li>The <a href="manual.html#addon_search"><code>search</code></a> addon now recognizes <code>\r</code> and <code>\n</code> in pattern and replacement input</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.5.0...5.6.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">20-07-2015: <a href="https://codemirror.net/5/codemirror-5.5.zip">Version 5.5</a>:</p>
+
+  <ul class="rel-note">
+    <li>New option: <a href="manual.html#option_lineSeparator"><code>lineSeparator</code></a> (with corresponding <a href="manual.html#lineSeparator">method</a>)
+    <li>New themes: <a href="../demo/theme.html#dracula">dracula</a>, <a href="../demo/theme.html#seti">seti</a>, <a href="../demo/theme.html#yeti">yeti</a>, <a href="../demo/theme.html#material">material</a>, and <a href="../demo/theme.html#icecoder">icecoder</a></li>
+    <li>New modes: <a href="../mode/brainfuck/index.html">Brainfuck</a>, <a href="../mode/vhdl/index.html">VHDL</a>, Squirrel (<a href="../mode/clike/index.html">clike</a> dialect)</li>
+    <li>Define a <code>findPersistent</code> command in
+    the <a href="../demo/search.html">search</a> addon, for a dialog
+    that stays open as you cycle through matches</li>
+    <li>From this release on, the NPM module doesn't include documentation and demos</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.4.0...5.5.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">25-06-2015: <a href="https://codemirror.net/5/codemirror-5.4.zip">Version 5.4</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/twig/index.html">Twig</a>, <a href="../mode/elm/index.html">Elm</a>, <a href="../mode/factor/index.html">Factor</a>, <a href="../mode/swift/index.html">Swift</a></li>
+    <li>Prefer clipboard API (if available) when pasting</li>
+    <li>Refined definition highlighting in <a href="../mode/clike/index.html">clike</a> mode</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.3.0...5.4.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">20-05-2015: <a href="https://codemirror.net/5/codemirror-5.3.zip">Version 5.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix several regressions in the <a href="manual.html#addon_show-hint"><code>show-hint</code></a> addon (<code>completeSingle</code> option, <code>"shown"</code> and <code>"close"</code> events)</li>
+    <li>The <a href="../demo/vim.html">vim mode</a> API was <a href="manual.html#vimapi">documented</a></li>
+    <li>New modes: <a href="../mode/asn.1/index.html">ASN.1</a>, <a href="../mode/ttcn/index.html">TTCN</a>, and <a href="../mode/ttcn-cfg/index.html">TTCN-CFG</a></li>
+    <li>The <a href="../mode/clike/index.html">clike</a> mode can now deep-indent <code>switch</code> statements, and roughly recognizes types and defined identifiers</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.2.0...5.3.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">20-04-2015: <a href="https://codemirror.net/5/codemirror-5.2.zip">Version 5.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix several race conditions
+    in <a href="manual.html#addon_show-hint"><code>show-hint</code></a>'s
+    asynchronous mode</li>
+    <li>Fix backspace binding in <a href="../demo/sublime.html">Sublime bindings</a></li>
+    <li>Change the way IME is handled in the <code>"textarea"</code> <a href="manual.html#option_inputStyle">input style</a></li>
+
+    <li>New modes: <a href="../mode/mumps/index.html">MUMPS</a>, <a href="../mode/handlebars/index.html">Handlebars</a></li>
+    <li>Rewritten modes: <a href="../mode/django/index.html">Django</a>, <a href="../mode/z80/index.html">Z80</a></li>
+    <li>New theme: <a href="../demo/theme.html#liquibyte">Liquibyte</a></li>
+    <li>New option: <a href="manual.html#option_lineWiseCopyCut"><code>lineWiseCopyCut</code></a></li>
+    <li>The <a href="../demo/vim.html">Vim mode</a> now supports buffer-local options and the <code>filetype</code> setting</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.1.0...5.2.0">list of patches</a></li>
+  </ul>
+
+  <p class="rel">23-03-2015: <a href="https://codemirror.net/5/codemirror-5.1.zip">Version 5.1</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/asciiarmor/index.html">ASCII armor</a> (PGP data), <a href="../mode/troff/index.html">Troff</a>, and <a href="../mode/cmake/index.html">CMake</a>.</li>
+    <li>Remove SmartyMixed mode, rewrite <a href="../mode/smarty/index.html">Smarty</a> mode to supersede it.</li>
+    <li>New commands in the <a href="manual.html#addon_merge">merge
+    addon</a>: <code>goNextDiff</code> and <code>goPrevDiff</code>.</li>
+    <li>The <a href="manual.html#addon_closebrackets">closebrackets addon</a> can now be configured per mode.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/5.0.0...5.1.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-02-2015: <a href="https://codemirror.net/5/codemirror-5.0.zip">Version 5.0</a>:</p>
+
+  <ul class="rel-note">
+    <li>Experimental mobile support (tested on iOS, Android Chrome, stock Android browser)</li>
+    <li>New option <a href="manual.html#option_inputStyle"><code>inputStyle</code></a> to switch between hidden textarea and contenteditable input.</li>
+    <li>The <a href="manual.html#getInputField"><code>getInputField</code></a>
+    method is no longer guaranteed to return a textarea.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.13.0...5.0.0">list of patches</a>.</li>
+  </ul>
+
+</section>
+
+<section id=v4 class=first>
+
+  <h2>Version 4.x</h2>
+
+  <p class="rel">20-02-2015: <a href="https://codemirror.net/5/codemirror-4.13.zip">Version 4.13</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix the way the <a href="../demo/closetag.html"><code>closetag</code></a> demo handles the slash character.</li>
+    <li>New modes: <a href="../mode/forth/index.html">Forth</a>, <a href="../mode/stylus/index.html">Stylus</a>.</li>
+    <li>Make the <a href="../mode/css/index.html">CSS mode</a> understand some modern CSS extensions.</li>
+    <li>Have the <a href="../mode/clike/index.html">Scala mode</a> handle symbols and triple-quoted strings.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.12.0...4.13.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">22-01-2015: <a href="https://codemirror.net/5/codemirror-4.12.zip">Version 4.12</a>:</p>
+
+  <ul class="rel-note">
+    <li>The <a href="manual.html#addon_closetag"><code>closetag</code></a>
+    addon now defines a <code>"closeTag"</code> command.</li>
+    <li>Adds a <code>findModeByFileName</code> to the <a href="manual.html#addon_meta">mode metadata</a>
+    addon.</li>
+    <li><a href="../demo/simplemode.html">Simple mode</a> rules can
+    now contain a <code>sol</code> property to only match at the start
+    of a line.</li>
+    <li>New
+    addon: <a href="manual.html#addon_selection-pointer"><code>selection-pointer</code></a>
+    to style the mouse cursor over the selection.</li>
+    <li>Improvements to the <a href="../mode/sass/index.html">Sass mode</a>'s indentation.</li>
+    <li>The <a href="../demo/vim.html">Vim keymap</a>'s search functionality now
+    supports <a href="manual.html#addon_matchesonscrollbar">scrollbar
+    annotation</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.11.0...4.12.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">9-01-2015: <a href="https://codemirror.net/5/codemirror-4.11.zip">Version 4.11</a>:</p>
+
+  <p class="rel-note">Unfortunately, 4.10 did not take care of the
+  Firefox scrolling issue entirely. This release adds two more patches
+  to address that.</p>
+
+  <p class="rel">29-12-2014: <a href="https://codemirror.net/5/codemirror-4.10.zip">Version 4.10</a>:</p>
+
+  <p class="rel-note">Emergency single-patch update to 4.9. Fixes
+  Firefox-specific problem where the cursor could end up behind the
+  horizontal scrollbar.</p>
+
+  <p class="rel">23-12-2014: <a href="https://codemirror.net/5/codemirror-4.9.zip">Version 4.9</a>:</p>
+
+  <ul class="rel-note">
+    <li>Overhauled scroll bar handling.
+    Add pluggable <a href="../demo/simplescrollbars.html">scrollbar
+    implementations</a>.</li>
+    <li>Tweaked behavior for
+    the <a href="manual.html#addon_show-hint">completion addons</a> to
+    not take text after cursor into account.</li>
+    <li>Two new optional features in
+    the <a href="manual.html#addon_merge">merge addon</a>: aligning
+    editors, and folding unchanged text.</li>
+    <li>New
+    modes: <a href="../mode/dart/index.html">Dart</a>, <a href="../mode/ebnf/index.html">EBNF</a>, <a href="../mode/spreadsheet/index.html">spreadsheet</a>,
+    and <a href="../mode/soy/index.html">Soy</a>.</li>
+    <li>New <a href="../demo/panel.html">addon</a> to show persistent panels below/above an editor.</li>
+    <li>New themes: <a href="../demo/theme.html#zenburn">zenburn</a>
+    and <a href="../demo/theme.html#tomorrow-night-bright">tomorrow night
+    bright</a>.</li>
+    <li>Allow ctrl-click to clear existing cursors.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.8.0...4.9.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">22-11-2014: <a href="https://codemirror.net/5/codemirror-4.8.zip">Version 4.8</a>:</p>
+
+  <ul class="rel-note">
+    <li>Built-in support for <a href="manual.html#normalizeKeyMap">multi-stroke key bindings</a>.</li>
+    <li>New method: <a href="manual.html#getLineTokens"><code>getLineTokens</code></a>.</li>
+    <li>New modes: <a href="../mode/dockerfile/index.html">dockerfile</a>, <a href="../mode/idl/index.html">IDL</a>, <a href="../mode/clike/index.html">Objective C</a> (crude).</li>
+    <li>Support styling of gutter backgrounds, allow <code>"gutter"</code> styles in <a href="manual.html#addLineClass"><code>addLineClass</code></a>.</li>
+    <li>Many improvements to the <a href="../demo/vim.html">Vim mode</a>, rewritten visual mode.</li>
+    <li>Improvements to modes: <a href="../mode/gfm/index.html">gfm</a> (strikethrough), <a href="../mode/sparql/index.html">SPARQL</a> (version 1.1 support), and <a href="../mode/stex/index.html">sTeX</a> (no more runaway math mode).
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.7.0...4.8.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-10-2014: <a href="https://codemirror.net/5/codemirror-4.7.zip">Version 4.7</a>:</p>
+
+  <ul class="rel-note">
+    <li><strong>Incompatible</strong>:
+    The <a href="../demo/lint.html">lint addon</a> now passes the
+    editor's value as first argument to asynchronous lint functions,
+    for consistency. The editor is still passed, as fourth
+    argument.</li>
+    <li>Improved handling of unicode identifiers in modes for
+    languages that support them.</li>
+    <li>More mode
+    improvements: <a href="../mode/coffeescript/index.html">CoffeeScript</a>
+    (indentation), <a href="../mode/verilog/index.html">Verilog</a>
+    (indentation), <a href="../mode/clike/index.html">Scala</a>
+    (indentation, triple-quoted strings),
+    and <a href="../mode/php/index.html">PHP</a> (interpolated
+    variables in heredoc strings).</li>
+    <li>New modes: <a href="../mode/textile/index.html">Textile</a> and <a href="../mode/tornado/index.html">Tornado templates</a>.</li>
+    <li>Experimental new <a href="../demo/simplemode.html">way to define modes</a>.</li>
+    <li>Improvements to the <a href="../demo/vim.html">Vim
+    bindings</a>: Arbitrary insert mode key mappings are now possible,
+    and text objects are supported in visual mode.</li>
+    <li>The mode <a href="../mode/meta.js">meta-information file</a>
+    now includes information about file extensions,
+    and <a href="manual.html#addon_meta">helper
+    functions</a> <code>findModeByMIME</code>
+    and <code>findModeByExtension</code>.</li>
+    <li>New logo!</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.6.0...4.7.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">19-09-2014: <a href="https://codemirror.net/5/codemirror-4.6.zip">Version 4.6</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/modelica/index.html">Modelica</a></li>
+    <li>New method: <a href="manual.html#findWordAt"><code>findWordAt</code></a></li>
+    <li>Make it easier to <a href="../demo/markselection.html">use text background styling</a></li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.5.0...4.6.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">21-08-2014: <a href="https://codemirror.net/5/codemirror-4.5.zip">Version 4.5</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix several serious bugs with horizontal scrolling</li>
+    <li>New mode: <a href="../mode/slim/index.html">Slim</a></li>
+    <li>New command: <a href="manual.html#command_goLineLeftSmart"><code>goLineLeftSmart</code></a></li>
+    <li>More fixes and extensions for the <a href="../demo/vim.html">Vim</a> visual block mode</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.4.0...4.5.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">21-07-2014: <a href="https://codemirror.net/5/codemirror-4.4.zip">Version 4.4</a>:</p>
+
+  <ul class="rel-note">
+    <li><strong>Note:</strong> Some events might now fire in slightly
+    different order (<code>"change"</code> is still guaranteed to fire
+    before <code>"cursorActivity"</code>)</li>
+    <li>Nested operations in multiple editors are now synced (complete
+    at same time, reducing DOM reflows)</li>
+    <li>Visual block mode for <a href="../demo/vim.html">vim</a> (&lt;C-v>) is nearly complete</li>
+    <li>New mode: <a href="../mode/kotlin/index.html">Kotlin</a></li>
+    <li>Better multi-selection paste for text copied from multiple CodeMirror selections</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.3.0...4.4.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">23-06-2014: <a href="https://codemirror.net/5/codemirror-4.3.zip">Version 4.3</a>:</p>
+
+  <ul class="rel-note">
+    <li>Several <a href="../demo/vim.html">vim bindings</a>
+    improvements: search and exCommand history, global flag
+    for <code>:substitute</code>, <code>:global</code> command.
+    <li>Allow hiding the cursor by
+    setting <a href="manual.html#option_cursorBlinkRate"><code>cursorBlinkRate</code></a>
+    to a negative value.</li>
+    <li>Make gutter markers themeable, use this in foldgutter.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.2.0...4.3.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">19-05-2014: <a href="https://codemirror.net/5/codemirror-4.2.zip">Version 4.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix problem where some modes were broken by the fact that empty tokens were forbidden.</li>
+    <li>Several fixes to context menu handling.</li>
+    <li>On undo, scroll <em>change</em>, not cursor, into view.</li>
+    <li>Rewritten <a href="../mode/jade/index.html">Jade</a> mode.</li>
+    <li>Various improvements to <a href="../mode/shell/index.html">Shell</a> (support for more syntax) and <a href="../mode/python/index.html">Python</a> (better indentation) modes.</li>
+    <li>New mode: <a href="../mode/cypher/index.html">Cypher</a>.</li>
+    <li>New theme: <a href="../demo/theme.html#neo">Neo</a>.</li>
+    <li>Support direct styling options (color, line style, width) in the <a href="manual.html#addon_rulers">rulers</a> addon.</li>
+    <li>Recognize per-editor configuration for the <a href="manual.html#addon_show-hint">show-hint</a> and <a href="manual.html#addon_foldcode">foldcode</a> addons.</li>
+    <li>More intelligent scanning for existing close tags in <a href="manual.html#addon_closetag">closetag</a> addon.</li>
+    <li>In the <a href="../demo/vim.html">Vim bindings</a>: Fix bracket matching, support case conversion in visual mode, visual paste, append action.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.1.0...4.2.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">22-04-2014: <a href="https://codemirror.net/5/codemirror-4.1.zip">Version 4.1</a>:</p>
+
+  <ul class="rel-note">
+    <li><em>Slightly incompatible</em>:
+    The <a href="manual.html#event_cursorActivity"><code>"cursorActivity"</code></a>
+    event now fires after all other events for the operation (and only
+    for handlers that were actually registered at the time the
+    activity happened).</li>
+    <li>New command: <a href="manual.html#command_insertSoftTab"><code>insertSoftTab</code></a>.</li>
+    <li>New mode: <a href="../mode/django/index.html">Django</a>.</li>
+    <li>Improved modes: <a href="../mode/verilog/index.html">Verilog</a> (rewritten), <a href="../mode/jinja2/index.html">Jinja2</a>, <a href="../mode/haxe/index.html">Haxe</a>, <a href="../mode/php/index.html">PHP</a> (string interpolation highlighted), <a href="../mode/javascript/index.html">JavaScript</a> (indentation of trailing else, template strings), <a href="../mode/livescript/index.html">LiveScript</a> (multi-line strings).</li>
+    <li>Many small issues from the 3.x→4.x transition were found and fixed.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/4.0.3...4.1.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-03-2014: <a href="https://codemirror.net/5/codemirror-4.0.zip">Version 4.0</a>:</p>
+
+  <p class="rel-note">This is a new major version of CodeMirror. There
+  are a few <strong>incompatible</strong> changes in the API. Upgrade
+  with care, and read the <a href="upgrade_v4.html">upgrading
+  guide</a>.</p>
+
+  <ul class="rel-note">
+    <li>Multiple selections (ctrl-click, alt-drag, <a href="manual.html#setSelections">API</a>).</li>
+    <li>Sublime Text <a href="../demo/sublime.html">bindings</a>.</li>
+    <li><a href="manual.html#modloader">Module loader shims</a> wrapped around all modules.</li>
+    <li>Selection <a href="manual.html#command_undoSelection">undo</a>/<a href="manual.html#command_redoSelection">redo</a>.</li>
+    <li>Improved character measuring (faster, handles wrapped lines more robustly).</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.23.0...4.0.3">list of patches</a>.</li>
+  </ul>
+
+</section>
+
+<section id=v3>
+
+  <h2>Version 3.x</h2>
+
+  <p class="rel">22-04-2014: <a href="https://codemirror.net/5/codemirror-3.24.zip">Version 3.24</a>:</p>
+
+  <p class="rel-note">Merges the improvements from 4.1 that could
+  easily be applied to the 3.x code. Also improves the way the editor
+  size is updated when line widgets change.</p>
+
+  <p class="rel">20-03-2014: <a href="https://codemirror.net/5/codemirror-3.23.zip">Version 3.23</a>:</p>
+
+  <ul class="rel-note">
+    <li>In the <a href="../mode/xml/index.html">XML mode</a>,
+    add <code>brackets</code> style to angle brackets, fix
+    case-sensitivity of tags for HTML.</li>
+    <li>New mode: <a href="../mode/dylan/index.html">Dylan</a>.</li>
+    <li>Many improvements to the <a href="../demo/vim.html">Vim bindings</a>.</li>
+  </ul>
+
+  <p class="rel">21-02-2014: <a href="https://codemirror.net/5/codemirror-3.22.zip">Version 3.22</a>:</p>
+
+  <ul class="rel-note">
+    <li>Adds the <a href="manual.html#findMarks"><code>findMarks</code></a> method.</li>
+    <li>New addons: <a href="manual.html#addon_rulers">rulers</a>, markdown-fold, yaml-lint.</li>
+    <li>New theme: <a href="../demo/theme.html#mdn-like">mdn-like</a>.</li>
+    <li>New mode: <a href="../mode/solr/index.html">Solr</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.21.0...3.22.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">16-01-2014: <a href="https://codemirror.net/5/codemirror-3.21.zip">Version 3.21</a>:</p>
+
+  <ul class="rel-note">
+    <li>Auto-indenting a block will no longer add trailing whitespace to blank lines.</li>
+    <li>Marking text has a new option <a href="manual.html#markText"><code>clearWhenEmpty</code></a> to control auto-removal.</li>
+    <li>Several bugfixes in the handling of bidirectional text.</li>
+    <li>The <a href="../mode/xml/index.html">XML</a> and <a href="../mode/css/index.html">CSS</a> modes were largely rewritten. <a href="../mode/css/less.html">LESS</a> support was added to the CSS mode.</li>
+    <li>The OCaml mode was moved to an <a href="../mode/mllike/index.html">mllike</a> mode, F# support added.</li>
+    <li>Make it possible to fetch multiple applicable helper values with <a href="manual.html#getHelpers"><code>getHelpers</code></a>, and to register helpers matched on predicates with <a href="manual.html#registerGlobalHelper"><code>registerGlobalHelper</code></a>.</li>
+    <li>New theme <a href="../demo/theme.html#pastel-on-dark">pastel-on-dark</a>.</li>
+    <li>Better ECMAScript 6 support in <a href="../mode/javascript/index.html">JavaScript</a> mode.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.20.0...3.21.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">21-11-2013: <a href="https://codemirror.net/5/codemirror-3.20.zip">Version 3.20</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/julia/index.html">Julia</a> and <a href="../mode/pegjs/index.html">PEG.js</a>.</li>
+    <li>Support ECMAScript 6 in the <a href="../mode/javascript/index.html">JavaScript mode</a>.</li>
+    <li>Improved indentation for the <a href="../mode/coffeescript/index.html">CoffeeScript mode</a>.</li>
+    <li>Make non-printable-character representation <a href="manual.html#option_specialChars">configurable</a>.</li>
+    <li>Add ‘notification’ functionality to <a href="manual.html#addon_dialog">dialog</a> addon.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.19.0...3.20.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">21-10-2013: <a href="https://codemirror.net/5/codemirror-3.19.zip">Version 3.19</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/eiffel/index.html">Eiffel</a>, <a href="../mode/gherkin/index.html">Gherkin</a>, <a href="../mode/sql/?mime=text/x-mssql">MSSQL dialect</a>.</li>
+    <li>New addons: <a href="manual.html#addon_hardwrap">hardwrap</a>, <a href="manual.html#addon_sql-hint">sql-hint</a>.</li>
+    <li>New theme: <a href="../demo/theme.html#mbo">MBO</a>.</li>
+    <li>Add <a href="manual.html#token_style_line">support</a> for line-level styling from mode tokenizers.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.18.0...3.19.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">23-09-2013: <a href="https://codemirror.net/5/codemirror-3.18.zip">Version 3.18</a>:</p>
+
+  <p class="rel-note">Emergency release to fix a problem in 3.17
+  where <code>.setOption("lineNumbers", false)</code> would raise an
+  error.</p>
+
+  <p class="rel">23-09-2013: <a href="https://codemirror.net/5/codemirror-3.17.zip">Version 3.17</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/fortran/index.html">Fortran</a>, <a href="../mode/octave/index.html">Octave</a> (Matlab), <a href="../mode/toml/index.html">TOML</a>, and <a href="../mode/dtd/index.html">DTD</a>.</li>
+    <li>New addons: <a href="../addon/lint/css-lint.js"><code>css-lint</code></a>, <a href="manual.html#addon_css-hint"><code>css-hint</code></a>.</li>
+    <li>Improve resilience to CSS 'frameworks' that globally mess up <code>box-sizing</code>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.16.0...3.17.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">21-08-2013: <a href="https://codemirror.net/5/codemirror-3.16.zip">Version 3.16</a>:</p>
+
+  <ul class="rel-note">
+    <li>The whole codebase is now under a single <a href="../LICENSE">license</a> file.</li>
+    <li>The project page was overhauled and redesigned.</li>
+    <li>New themes: <a href="../demo/theme.html#paraiso-dark">Paraiso</a> (<a href="../demo/theme.html#paraiso-light">light</a>), <a href="../demo/theme.html#the-matrix">The Matrix</a>.</li>
+    <li>Improved interaction between themes and <a href="manual.html#addon_active-line">active-line</a>/<a href="manual.html#addon_matchbrackets">matchbrackets</a> addons.</li>
+    <li>New <a href="manual.html#addon_foldcode">folding</a> function <code>CodeMirror.fold.comment</code>.</li>
+    <li>Added <a href="manual.html#addon_fullscreen">fullscreen</a> addon.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.15.0...3.16.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">29-07-2013: <a href="https://codemirror.net/5/codemirror-3.15.zip">Version 3.15</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/jade/index.html">Jade</a>, <a href="../mode/nginx/index.html">Nginx</a>.</li>
+    <li>New addons: <a href="../demo/tern.html">Tern</a>, <a href="manual.html#addon_matchtags">matchtags</a>, and <a href="manual.html#addon_foldgutter">foldgutter</a>.</li>
+    <li>Introduced <a href="manual.html#getHelper"><em>helper</em></a> concept (<a href="https://groups.google.com/forum/#!msg/codemirror/cOc0xvUUEUU/nLrX1-qnidgJ">context</a>).</li>
+    <li>New method: <a href="manual.html#getModeAt"><code>getModeAt</code></a>.</li>
+    <li>New themes: base16 <a href="../demo/theme.html#base16-dark">dark</a>/<a href="../demo/theme.html#base16-light">light</a>, 3024 <a href="../demo/theme.html#3024-night">dark</a>/<a href="../demo/theme.html#3024-day">light</a>, <a href="../demo/theme.html#tomorrow-night-eighties">tomorrow-night</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.14.0...3.15.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-06-2013: <a href="https://codemirror.net/5/codemirror-3.14.zip">Version 3.14</a>:</p>
+
+  <ul class="rel-note">
+    <li>New
+    addons: <a href="manual.html#addon_trailingspace">trailing
+    space highlight</a>, <a href="manual.html#addon_xml-hint">XML
+    completion</a> (rewritten),
+    and <a href="manual.html#addon_merge">diff merging</a>.</li>
+    <li><a href="manual.html#markText"><code>markText</code></a>
+    and <a href="manual.html#addLineWidget"><code>addLineWidget</code></a>
+    now take a <code>handleMouseEvents</code> option.</li>
+    <li>New methods: <a href="manual.html#lineAtHeight"><code>lineAtHeight</code></a>,
+    <a href="manual.html#getTokenTypeAt"><code>getTokenTypeAt</code></a>.</li>
+    <li>More precise cleanness-tracking
+    using <a href="manual.html#changeGeneration"><code>changeGeneration</code></a>
+    and <a href="manual.html#isClean"><code>isClean</code></a>.</li>
+    <li>Many extensions to <a href="../demo/emacs.html">Emacs</a> mode
+    (prefixes, more navigation units, and more).</li>
+    <li>New
+    events <a href="manual.html#event_keyHandled"><code>"keyHandled"</code></a>
+    and <a href="manual.html#event_inputRead"><code>"inputRead"</code></a>.</li>
+    <li>Various improvements to <a href="../mode/ruby/index.html">Ruby</a>,
+    <a href="../mode/smarty/index.html">Smarty</a>, <a href="../mode/sql/index.html">SQL</a>,
+    and <a href="../demo/vim.html">Vim</a> modes.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/3.13.0...3.14.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-05-2013: <a href="https://codemirror.net/5/codemirror-3.13.zip">Version 3.13</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/cobol/index.html">COBOL</a> and <a href="../mode/haml/index.html">HAML</a>.</li>
+    <li>New options: <a href="manual.html#option_cursorScrollMargin"><code>cursorScrollMargin</code></a> and <a href="manual.html#option_coverGutterNextToScrollbar"><code>coverGutterNextToScrollbar</code></a>.</li>
+    <li>New addon: <a href="manual.html#addon_comment">commenting</a>.</li>
+    <li>More features added to the <a href="../demo/vim.html">Vim keymap</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.12...3.13.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">19-04-2013: <a href="https://codemirror.net/5/codemirror-3.12.zip">Version 3.12</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/gas/index.html">GNU assembler</a>.</li>
+    <li>New
+    options: <a href="manual.html#option_maxHighlightLength"><code>maxHighlightLength</code></a>
+    and <a href="manual.html#option_historyEventDelay"><code>historyEventDelay</code></a>.</li>
+    <li>Added <a href="manual.html#mark_addToHistory"><code>addToHistory</code></a>
+    option for <code>markText</code>.</li>
+    <li>Various fixes to JavaScript tokenization and indentation corner cases.</li>
+    <li>Further improvements to the vim mode.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.11...v3.12">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-03-2013: <a href="https://codemirror.net/5/codemirror-3.11.zip">Version 3.11</a>:</p>
+
+  <ul class="rel-note">
+    <li><strong>Removed code:</strong> <code>collapserange</code>,
+    <code>formatting</code>, and <code>simple-hint</code>
+    addons. <code>plsql</code> and <code>mysql</code> modes
+    (use <a href="../mode/sql/index.html"><code>sql</code></a> mode).</li>
+    <li><strong>Moved code:</strong> the range-finding functions for folding now have <a href="../addon/fold/">their own files</a>.</li>
+    <li><strong>Changed interface:</strong>
+    the <a href="manual.html#addon_continuecomment"><code>continuecomment</code></a>
+    addon now exposes an option, rather than a command.</li>
+    <li>New
+    modes: <a href="../mode/css/scss.html">SCSS</a>, <a href="../mode/tcl/index.html">Tcl</a>, <a href="../mode/livescript/index.html">LiveScript</a>,
+    and <a href="../mode/mirc/index.html">mIRC</a>.</li>
+    <li>New addons: <a href="../demo/placeholder.html"><code>placeholder</code></a>, <a href="../demo/html5complete.html">HTML completion</a>.</li>
+    <li>New
+    methods: <a href="manual.html#hasFocus"><code>hasFocus</code></a>, <a href="manual.html#defaultCharWidth"><code>defaultCharWidth</code></a>.</li>
+    <li>New events: <a href="manual.html#event_beforeCursorEnter"><code>beforeCursorEnter</code></a>, <a href="manual.html#event_renderLine"><code>renderLine</code></a>.</li>
+    <li>Many improvements to the <a href="manual.html#addon_show-hint"><code>show-hint</code></a> completion
+    dialog addon.</li>
+    <li>Tweak behavior of by-word cursor motion.</li>
+    <li>Further improvements to the <a href="../demo/vim.html">vim mode</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.1...v3.11">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">21-02-2013: <a href="https://codemirror.net/5/codemirror-3.1.zip">Version 3.1</a>:</p>
+
+  <ul class="rel-note">
+    <li><strong>Incompatible:</strong> key handlers may
+    now <em>return</em>, rather
+    than <em>throw</em> <code>CodeMirror.Pass</code> to signal they
+    didn't handle the key.</li>
+    <li>Make documents a <a href="manual.html#api_doc">first-class
+    construct</a>, support split views and subviews.</li>
+    <li>Add a <a href="manual.html#addon_show-hint">new module</a>
+    for showing completion hints.
+    Deprecate <code>simple-hint.js</code>.</li>
+    <li>Extend <a href="../mode/htmlmixed/index.html">htmlmixed mode</a>
+    to allow custom handling of script types.</li>
+    <li>Support an <code>insertLeft</code> option
+    to <a href="manual.html#setBookmark"><code>setBookmark</code></a>.</li>
+    <li>Add an <a href="manual.html#eachLine"><code>eachLine</code></a>
+    method to iterate over a document.</li>
+    <li>New addon modules: <a href="../demo/markselection.html">selection
+    marking</a>, <a href="../demo/lint.html">linting</a>,
+    and <a href="../demo/closebrackets.html">automatic bracket
+    closing</a>.</li>
+    <li>Add <a href="manual.html#event_beforeChange"><code>"beforeChange"</code></a>
+    and <a href="manual.html#event_beforeSelectionChange"><code>"beforeSelectionChange"</code></a>
+    events.</li>
+    <li>Add <a href="manual.html#event_hide"><code>"hide"</code></a>
+    and <a href="manual.html#event_unhide"><code>"unhide"</code></a>
+    events to marked ranges.</li>
+    <li>Fix <a href="manual.html#coordsChar"><code>coordsChar</code></a>'s
+    interpretation of its argument to match the documentation.</li>
+    <li>New modes: <a href="../mode/turtle/index.html">Turtle</a>
+    and <a href="../mode/q/index.html">Q</a>.</li>
+    <li>Further improvements to the <a href="../demo/vim.html">vim mode</a>.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.01...v3.1">list of patches</a>.</li>
+  </ul>
+
+
+  <p class="rel">25-01-2013: <a href="https://codemirror.net/5/codemirror-3.02.zip">Version 3.02</a>:</p>
+
+  <p class="rel-note">Single-bugfix release. Fixes a problem that
+  prevents CodeMirror instances from being garbage-collected after
+  they become unused.</p>
+
+  <p class="rel">21-01-2013: <a href="https://codemirror.net/5/codemirror-3.01.zip">Version 3.01</a>:</p>
+
+  <ul class="rel-note">
+    <li>Move all add-ons into an organized directory structure
+    under <a href="../addon/"><code>/addon</code></a>. <strong>You might have to adjust your
+    paths.</strong></li>
+    <li>New
+    modes: <a href="../mode/d/index.html">D</a>, <a href="../mode/sass/index.html">Sass</a>, <a href="../mode/apl/index.html">APL</a>, <a href="../mode/sql/index.html">SQL</a>
+    (configurable), and <a href="../mode/asterisk/index.html">Asterisk</a>.</li>
+    <li>Several bugfixes in right-to-left text support.</li>
+    <li>Add <a href="manual.html#option_rtlMoveVisually"><code>rtlMoveVisually</code></a> option.</li>
+    <li>Improvements to vim keymap.</li>
+    <li>Add built-in (lightweight) <a href="manual.html#addOverlay">overlay mode</a> support.</li>
+    <li>Support <code>showIfHidden</code> option for <a href="manual.html#addLineWidget">line widgets</a>.</li>
+    <li>Add simple <a href="manual.html#addon_python-hint">Python hinter</a>.</li>
+    <li>Bring back the <a href="manual.html#option_fixedGutter"><code>fixedGutter</code></a> option.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.0...v3.01">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">10-12-2012: <a href="https://codemirror.net/5/codemirror-3.0.zip">Version 3.0</a>:</p>
+
+  <p class="rel-note"><strong>New major version</strong>. Only
+  partially backwards-compatible. See
+  the <a href="upgrade_v3.html">upgrading guide</a> for more
+  information. Changes since release candidate 2:</p>
+
+  <ul class="rel-note">
+    <li>Rewritten VIM mode.</li>
+    <li>Fix a few minor scrolling and sizing issues.</li>
+    <li>Work around Safari segfault when dragging.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.0rc2...v3.0">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-11-2012: <a href="https://codemirror.net/5/codemirror-3.0rc2.zip">Version 3.0, release candidate 2</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/http/index.html">HTTP</a>.</li>
+    <li>Improved handling of selection anchor position.</li>
+    <li>Improve IE performance on longer lines.</li>
+    <li>Reduce gutter glitches during horiz. scrolling.</li>
+    <li>Add <a href="manual.html#addKeyMap"><code>addKeyMap</code></a> and <a href="manual.html#removeKeyMap"><code>removeKeyMap</code></a> methods.</li>
+    <li>Rewrite <code>formatting</code> and <code>closetag</code> add-ons.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.0rc1...v3.0rc2">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-11-2012: <a href="https://codemirror.net/5/codemirror-3.0rc1.zip">Version 3.0, release candidate 1</a>:</p>
+
+  <ul class="rel-note">
+    <li>New theme: <a href="../demo/theme.html#solarized%20light">Solarized</a>.</li>
+    <li>Introduce <a href="manual.html#addLineClass"><code>addLineClass</code></a>
+    and <a href="manual.html#removeLineClass"><code>removeLineClass</code></a>,
+    drop <code>setLineClass</code>.</li>
+    <li>Add a <em>lot</em> of
+    new <a href="manual.html#markText">options for marked text</a>
+    (read-only, atomic, collapsed, widget replacement).</li>
+    <li>Remove the old code folding interface in favour of these new ranges.</li>
+    <li>Add <a href="manual.html#isClean"><code>isClean</code></a>/<a href="manual.html#markClean"><code>markClean</code></a> methods.</li>
+    <li>Remove <code>compoundChange</code> method, use better undo-event-combining heuristic.</li>
+    <li>Improve scrolling performance smoothness.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.0beta2...v3.0rc1">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">22-10-2012: <a href="https://codemirror.net/5/codemirror-3.0beta2.zip">Version 3.0, beta 2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Fix page-based coordinate computation.</li>
+    <li>Fix firing of <a href="manual.html#event_gutterClick"><code>gutterClick</code></a> event.</li>
+    <li>Add <a href="manual.html#option_cursorHeight"><code>cursorHeight</code></a> option.</li>
+    <li>Fix bi-directional text regression.</li>
+    <li>Add <a href="manual.html#option_viewportMargin"><code>viewportMargin</code></a> option.</li>
+    <li>Directly handle mousewheel events (again, hopefully better).</li>
+    <li>Make vertical cursor movement more robust (through widgets, big line gaps).</li>
+    <li>Add <a href="manual.html#option_flattenSpans"><code>flattenSpans</code></a> option.</li>
+    <li>Many optimizations. Poor responsiveness should be fixed.</li>
+    <li>Initialization in hidden state works again.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v3.0beta1...v3.0beta2">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">19-09-2012: <a href="https://codemirror.net/5/codemirror-3.0beta1.zip">Version 3.0, beta 1</a>:</p>
+
+  <ul class="rel-note">
+    <li>Bi-directional text support.</li>
+    <li>More powerful gutter model.</li>
+    <li>Support for arbitrary text/widget height.</li>
+    <li>In-line widgets.</li>
+    <li>Generalized event handling.</li>
+  </ul>
+
+</section>
+
+<section id=v2>
+
+  <h2>Version 2.x</h2>
+
+  <p class="rel">21-01-2013: <a href="https://codemirror.net/5/codemirror-2.38.zip">Version 2.38</a>:</p>
+
+  <p class="rel-note">Integrate some bugfixes, enhancements to the vim keymap, and new
+  modes
+  (<a href="../mode/d/index.html">D</a>, <a href="../mode/sass/index.html">Sass</a>, <a href="../mode/apl/index.html">APL</a>)
+  from the v3 branch.</p>
+
+  <p class="rel">20-12-2012: <a href="https://codemirror.net/5/codemirror-2.37.zip">Version 2.37</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/sql/index.html">SQL</a> (will replace <a href="../mode/plsql/index.html">plsql</a> and <a href="../mode/mysql/index.html">mysql</a> modes).</li>
+    <li>Further work on the new VIM mode.</li>
+    <li>Fix Cmd/Ctrl keys on recent Operas on OS X.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v2.36...v2.37">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">20-11-2012: <a href="https://codemirror.net/5/codemirror-2.36.zip">Version 2.36</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/z80/index.html">Z80 assembly</a>.</li>
+    <li>New theme: <a href="../demo/theme.html#twilight">Twilight</a>.</li>
+    <li>Add command-line compression helper.</li>
+    <li>Make <a href="manual.html#scrollIntoView"><code>scrollIntoView</code></a> public.</li>
+    <li>Add <a href="manual.html#defaultTextHeight"><code>defaultTextHeight</code></a> method.</li>
+    <li>Various extensions to the vim keymap.</li>
+    <li>Make <a href="../mode/php/index.html">PHP mode</a> build on <a href="../mode/htmlmixed/index.html">mixed HTML mode</a>.</li>
+    <li>Add <a href="manual.html#addon_continuecomment">comment-continuing</a> add-on.</li>
+    <li>Full <a href="../https://github.com/codemirror/CodeMirror/compare/v2.35...v2.36">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">22-10-2012: <a href="https://codemirror.net/5/codemirror-2.35.zip">Version 2.35</a>:</p>
+
+  <ul class="rel-note">
+    <li>New (sub) mode: <a href="../mode/javascript/typescript.html">TypeScript</a>.</li>
+    <li>Don't overwrite (insert key) when pasting.</li>
+    <li>Fix several bugs in <a href="manual.html#markText"><code>markText</code></a>/undo interaction.</li>
+    <li>Better indentation of JavaScript code without semicolons.</li>
+    <li>Add <a href="manual.html#defineInitHook"><code>defineInitHook</code></a> function.</li>
+    <li>Full <a href="https://github.com/codemirror/CodeMirror/compare/v2.34...v2.35">list of patches</a>.</li>
+  </ul>
+
+  <p class="rel">19-09-2012: <a href="https://codemirror.net/5/codemirror-2.34.zip">Version 2.34</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/commonlisp/index.html">Common Lisp</a>.</li>
+    <li>Fix right-click select-all on most browsers.</li>
+    <li>Change the way highlighting happens:<br>&nbsp; Saves memory and CPU cycles.<br>&nbsp; <code>compareStates</code> is no longer needed.<br>&nbsp; <code>onHighlightComplete</code> no longer works.</li>
+    <li>Integrate mode (Markdown, XQuery, CSS, sTex) tests in central testsuite.</li>
+    <li>Add a <a href="manual.html#version"><code>CodeMirror.version</code></a> property.</li>
+    <li>More robust handling of nested modes in <a href="../demo/formatting.html">formatting</a> and <a href="../demo/closetag.html">closetag</a> plug-ins.</li>
+    <li>Un/redo now preserves <a href="manual.html#markText">marked text</a> and bookmarks.</li>
+    <li><a href="https://github.com/codemirror/CodeMirror/compare/v2.33...v2.34">Full list</a> of patches.</li>
+  </ul>
+
+  <p class="rel">23-08-2012: <a href="https://codemirror.net/5/codemirror-2.33.zip">Version 2.33</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/sieve/index.html">Sieve</a>.</li>
+    <li>New <a href="manual.html#getViewport"><code>getViewPort</code></a> and <a href="manual.html#option_onViewportChange"><code>onViewportChange</code></a> API.</li>
+    <li><a href="manual.html#option_cursorBlinkRate">Configurable</a> cursor blink rate.</li>
+    <li>Make binding a key to <code>false</code> disabling handling (again).</li>
+    <li>Show non-printing characters as red dots.</li>
+    <li>More tweaks to the scrolling model.</li>
+    <li>Expanded testsuite. Basic linter added.</li>
+    <li>Remove most uses of <code>innerHTML</code>. Remove <code>CodeMirror.htmlEscape</code>.</li>
+    <li><a href="https://github.com/codemirror/CodeMirror/compare/v2.32...v2.33">Full list</a> of patches.</li>
+  </ul>
+
+  <p class="rel">23-07-2012: <a href="https://codemirror.net/5/codemirror-2.32.zip">Version 2.32</a>:</p>
+
+  <p class="rel-note">Emergency fix for a bug where an editor with
+  line wrapping on IE will break when there is <em>no</em>
+  scrollbar.</p>
+
+  <p class="rel">20-07-2012: <a href="https://codemirror.net/5/codemirror-2.31.zip">Version 2.31</a>:</p>
+
+  <ul class="rel-note">
+    <li>New modes: <a href="../mode/ocaml/index.html">OCaml</a>, <a href="../mode/haxe/index.html">Haxe</a>, and <a href="../mode/vb/index.html">VB.NET</a>.</li>
+    <li>Several fixes to the new scrolling model.</li>
+    <li>Add a <a href="manual.html#setSize"><code>setSize</code></a> method for programmatic resizing.</li>
+    <li>Add <a href="manual.html#getHistory"><code>getHistory</code></a> and <a href="manual.html#setHistory"><code>setHistory</code></a> methods.</li>
+    <li>Allow custom line separator string in <a href="manual.html#getValue"><code>getValue</code></a> and <a href="manual.html#getRange"><code>getRange</code></a>.</li>
+    <li>Support double- and triple-click drag, double-clicking whitespace.</li>
+    <li>And more... <a href="https://github.com/codemirror/CodeMirror/compare/v2.3...v2.31">(all patches)</a></li>
+  </ul>
+
+  <p class="rel">22-06-2012: <a href="https://codemirror.net/5/codemirror-2.3.zip">Version 2.3</a>:</p>
+
+  <ul class="rel-note">
+    <li><strong>New scrollbar implementation</strong>. Should flicker less. Changes DOM structure of the editor.</li>
+    <li>New theme: <a href="../demo/theme.html#vibrant-ink">vibrant-ink</a>.</li>
+    <li>Many extensions to the VIM keymap (including text objects).</li>
+    <li>Add <a href="../demo/multiplex.html">mode-multiplexing</a> utility script.</li>
+    <li>Fix bug where right-click paste works in read-only mode.</li>
+    <li>Add a <a href="manual.html#getScrollInfo"><code>getScrollInfo</code></a> method.</li>
+    <li>Lots of other <a href="https://github.com/codemirror/CodeMirror/compare/v2.25...v2.3">fixes</a>.</li>
+  </ul>
+
+  <p class="rel">23-05-2012: <a href="https://codemirror.net/5/codemirror-2.25.zip">Version 2.25</a>:</p>
+
+  <ul class="rel-note">
+    <li>New mode: <a href="../mode/erlang/index.html">Erlang</a>.</li>
+    <li><strong>Remove xmlpure mode</strong> (use <a href="../mode/xml/index.html">xml.js</a>).</li>
+    <li>Fix line-wrapping in Opera.</li>
+    <li>Fix X Windows middle-click paste in Chrome.</li>
+    <li>Fix bug that broke pasting of huge documents.</li>
+    <li>Fix backspace and tab key repeat in Opera.</li>
+  </ul>
+
+  <p class="rel">23-04-2012: <a href="https://codemirror.net/5/codemirror-2.24.zip">Version 2.24</a>:</p>
+
+  <ul class="rel-note">
+    <li><strong>Drop support for Internet Explorer 6</strong>.</li>
+    <li>New
+    modes: <a href="../mode/shell/index.html">Shell</a>, <a href="../mode/tiki/index.html">Tiki
+    wiki</a>, <a href="../mode/pig/index.html">Pig Latin</a>.</li>
+    <li>New themes: <a href="../demo/theme.html#ambiance">Ambiance</a>, <a href="../demo/theme.html#blackboard">Blackboard</a>.</li>
+    <li>More control over drag/drop
+    with <a href="manual.html#option_dragDrop"><code>dragDrop</code></a>
+    and <a href="manual.html#option_onDragEvent"><code>onDragEvent</code></a>
+    options.</li>
+    <li>Make HTML mode a bit less pedantic.</li>
+    <li>Add <a href="manual.html#compoundChange"><code>compoundChange</code></a> API method.</li>
+    <li>Several fixes in undo history and line hiding.</li>
+    <li>Remove (broken) support for <code>catchall</code> in key maps,
+    add <code>nofallthrough</code> boolean field instead.</li>
+  </ul>
+
+  <p class="rel">26-03-2012: <a href="https://codemirror.net/5/codemirror-2.23.zip">Version 2.23</a>:</p>
+
+  <ul class="rel-note">
+    <li>Change <strong>default binding for tab</strong> <a href="javascript:void(document.getElementById('tabbinding').style.display='')">[more]</a>
+      <div style="display: none" id=tabbinding>
+        Starting in 2.23, these bindings are default:
+        <ul><li>Tab: Insert tab character</li>
+          <li>Shift-tab: Reset line indentation to default</li>
+          <li>Ctrl/Cmd-[: Reduce line indentation (old tab behaviour)</li>
+          <li>Ctrl/Cmd-]: Increase line indentation (old shift-tab behaviour)</li>
+        </ul>
+      </div>
+    </li>
+    <li>New modes: <a href="../mode/xquery/index.html">XQuery</a> and <a href="../mode/vbscript/index.html">VBScript</a>.</li>
+    <li>Two new themes: <a href="../mode/less/index.html">lesser-dark</a> and <a href="../mode/xquery/index.html">xq-dark</a>.</li>
+    <li>Differentiate between background and text styles in <a href="manual.html#setLineClass"><code>setLineClass</code></a>.</li>
+    <li>Fix drag-and-drop in IE9+.</li>
+    <li>Extend <a href="manual.html#charCoords"><code>charCoords</code></a>
+    and <a href="manual.html#cursorCoords"><code>cursorCoords</code></a> with a <code>mode</code> argument.</li>
+    <li>Add <a href="manual.html#option_autofocus"><code>autofocus</code></a> option.</li>
+    <li>Add <a href="manual.html#findMarksAt"><code>findMarksAt</code></a> method.</li>
+  </ul>
+
+  <p class="rel">27-02-2012: <a href="https://codemirror.net/5/codemirror-2.22.zip">Version 2.22</a>:</p>
+
+  <ul class="rel-note">
+    <li>Allow <a href="manual.html#keymaps">key handlers</a> to pass up events, allow binding characters.</li>
+    <li>Add <a href="manual.html#option_autoClearEmptyLines"><code>autoClearEmptyLines</code></a> option.</li>
+    <li>Properly use tab stops when rendering tabs.</li>
+    <li>Make PHP mode more robust.</li>
+    <li>Support indentation blocks in <a href="manual.html#addon_foldcode">code folder</a>.</li>
+    <li>Add a script for <a href="manual.html#addon_match-highlighter">highlighting instances of the selection</a>.</li>
+    <li>New <a href="../mode/properties/index.html">.properties</a> mode.</li>
+    <li>Fix many bugs.</li>
+  </ul>
+
+  <p class="rel">27-01-2012: <a href="https://codemirror.net/5/codemirror-2.21.zip">Version 2.21</a>:</p>
+
+  <ul class="rel-note">
+    <li>Added <a href="../mode/less/index.html">LESS</a>, <a href="../mode/mysql/index.html">MySQL</a>,
+    <a href="../mode/go/index.html">Go</a>, and <a href="../mode/verilog/index.html">Verilog</a> modes.</li>
+    <li>Add <a href="manual.html#option_smartIndent"><code>smartIndent</code></a>
+    option.</li>
+    <li>Support a cursor in <a href="manual.html#option_readOnly"><code>readOnly</code></a>-mode.</li>
+    <li>Support assigning multiple styles to a token.</li>
+    <li>Use a new approach to drawing the selection.</li>
+    <li>Add <a href="manual.html#scrollTo"><code>scrollTo</code></a> method.</li>
+    <li>Allow undo/redo events to span non-adjacent lines.</li>
+    <li>Lots and lots of bugfixes.</li>
+  </ul>
+
+  <p class="rel">20-12-2011: <a href="https://codemirror.net/5/codemirror-2.2.zip">Version 2.2</a>:</p>
+
+  <ul class="rel-note">
+    <li>Slightly incompatible API changes. Read <a href="upgrade_v2.2.html">this</a>.</li>
+    <li>New approach
+    to <a href="manual.html#option_extraKeys">binding</a> keys,
+    support for <a href="manual.html#option_keyMap">custom
+    bindings</a>.</li>
+    <li>Support for overwrite (insert).</li>
+    <li><a href="manual.html#option_tabSize">Custom-width</a>
+    and <a href="../demo/visibletabs.html">styleable</a> tabs.</li>
+    <li>Moved more code into <a href="manual.html#addons">add-on scripts</a>.</li>
+    <li>Support for sane vertical cursor movement in wrapped lines.</li>
+    <li>More reliable handling of
+    editing <a href="manual.html#markText">marked text</a>.</li>
+    <li>Add minimal <a href="../demo/emacs.html">emacs</a>
+    and <a href="../demo/vim.html">vim</a> bindings.</li>
+    <li>Rename <code>coordsFromIndex</code>
+    to <a href="manual.html#posFromIndex"><code>posFromIndex</code></a>,
+    add <a href="manual.html#indexFromPos"><code>indexFromPos</code></a>
+    method.</li>
+  </ul>
+
+  <p class="rel">21-11-2011: <a href="https://codemirror.net/5/codemirror-2.18.zip">Version 2.18</a>:</p>
+  <p class="rel-note">Fixes <code>TextMarker.clear</code>, which is broken in 2.17.</p>
+
+  <p class="rel">21-11-2011: <a href="https://codemirror.net/5/codemirror-2.17.zip">Version 2.17</a>:</p>
+  <ul class="rel-note">
+    <li>Add support for <a href="manual.html#option_lineWrapping">line
+    wrapping</a> and <a href="manual.html#hideLine">code
+    folding</a>.</li>
+    <li>Add <a href="../mode/gfm/index.html">GitHub-style Markdown</a> mode.</li>
+    <li>Add <a href="../theme/monokai.css">Monokai</a>
+    and <a href="../theme/rubyblue.css">Rubyblue</a> themes.</li>
+    <li>Add <a href="manual.html#setBookmark"><code>setBookmark</code></a> method.</li>
+    <li>Move some of the demo code into reusable components
+    under <a href="../addon/"><code>lib/util</code></a>.</li>
+    <li>Make screen-coord-finding code faster and more reliable.</li>
+    <li>Fix drag-and-drop in Firefox.</li>
+    <li>Improve support for IME.</li>
+    <li>Speed up content rendering.</li>
+    <li>Fix browser's built-in search in Webkit.</li>
+    <li>Make double- and triple-click work in IE.</li>
+    <li>Various fixes to modes.</li>
+  </ul>
+
+  <p class="rel">27-10-2011: <a href="https://codemirror.net/5/codemirror-2.16.zip">Version 2.16</a>:</p>
+  <ul class="rel-note">
+    <li>Add <a href="../mode/perl/index.html">Perl</a>, <a href="../mode/rust/index.html">Rust</a>, <a href="../mode/tiddlywiki/index.html">TiddlyWiki</a>, and <a href="../mode/groovy/index.html">Groovy</a> modes.</li>
+    <li>Dragging text inside the editor now moves, rather than copies.</li>
+    <li>Add a <a href="manual.html#coordsFromIndex"><code>coordsFromIndex</code></a> method.</li>
+    <li><strong>API change</strong>: <code>setValue</code> now no longer clears history. Use <a href="manual.html#clearHistory"><code>clearHistory</code></a> for that.</li>
+    <li><strong>API change</strong>: <a href="manual.html#markText"><code>markText</code></a> now
+    returns an object with <code>clear</code> and <code>find</code>
+    methods. Marked text is now more robust when edited.</li>
+    <li>Fix editing code with tabs in Internet Explorer.</li>
+  </ul>
+
+  <p class="rel">26-09-2011: <a href="https://codemirror.net/5/codemirror-2.15.zip">Version 2.15</a>:</p>
+  <p class="rel-note">Fix bug that snuck into 2.14: Clicking the
+  character that currently has the cursor didn't re-focus the
+  editor.</p>
+
+  <p class="rel">26-09-2011: <a href="https://codemirror.net/5/codemirror-2.14.zip">Version 2.14</a>:</p>
+  <ul class="rel-note">
+    <li>Add <a href="../mode/clojure/index.html">Clojure</a>, <a href="../mode/pascal/index.html">Pascal</a>, <a href="../mode/ntriples/index.html">NTriples</a>, <a href="../mode/jinja2/index.html">Jinja2</a>, and <a href="../mode/markdown/index.html">Markdown</a> modes.</li>
+    <li>Add <a href="../theme/cobalt.css">Cobalt</a> and <a href="../theme/eclipse.css">Eclipse</a> themes.</li>
+    <li>Add a <a href="manual.html#option_fixedGutter"><code>fixedGutter</code></a> option.</li>
+    <li>Fix bug with <code>setValue</code> breaking cursor movement.</li>
+    <li>Make gutter updates much more efficient.</li>
+    <li>Allow dragging of text out of the editor (on modern browsers).</li>
+  </ul>
+
+
+  <p class="rel">23-08-2011: <a href="https://codemirror.net/5/codemirror-2.13.zip">Version 2.13</a>:</p>
+  <ul class="rel-note">
+    <li>Add <a href="../mode/ruby/index.html">Ruby</a>, <a href="../mode/r/index.html">R</a>, <a href="../mode/coffeescript/index.html">CoffeeScript</a>, and <a href="../mode/velocity/index.html">Velocity</a> modes.</li>
+    <li>Add <a href="manual.html#getGutterElement"><code>getGutterElement</code></a> to API.</li>
+    <li>Several fixes to scrolling and positioning.</li>
+    <li>Add <a href="manual.html#option_smartHome"><code>smartHome</code></a> option.</li>
+    <li>Add an experimental <a href="../mode/xmlpure/index.html">pure XML</a> mode.</li>
+  </ul>
+
+  <p class="rel">25-07-2011: <a href="https://codemirror.net/5/codemirror-2.12.zip">Version 2.12</a>:</p>
+  <ul class="rel-note">
+    <li>Add a <a href="../mode/sparql/index.html">SPARQL</a> mode.</li>
+    <li>Fix bug with cursor jumping around in an unfocused editor in IE.</li>
+    <li>Allow key and mouse events to bubble out of the editor. Ignore widget clicks.</li>
+    <li>Solve cursor flakiness after undo/redo.</li>
+    <li>Fix block-reindent ignoring the last few lines.</li>
+    <li>Fix parsing of multi-line attrs in XML mode.</li>
+    <li>Use <code>innerHTML</code> for HTML-escaping.</li>
+    <li>Some fixes to indentation in C-like mode.</li>
+    <li>Shrink horiz scrollbars when long lines removed.</li>
+    <li>Fix width feedback loop bug that caused the width of an inner DIV to shrink.</li>
+  </ul>
+
+  <p class="rel">04-07-2011: <a href="https://codemirror.net/5/codemirror-2.11.zip">Version 2.11</a>:</p>
+  <ul class="rel-note">
+    <li>Add a <a href="../mode/scheme/index.html">Scheme mode</a>.</li>
+    <li>Add a <code>replace</code> method to search cursors, for cursor-preserving replacements.</li>
+    <li>Make the <a href="../mode/clike/index.html">C-like mode</a> mode more customizable.</li>
+    <li>Update XML mode to spot mismatched tags.</li>
+    <li>Add <code>getStateAfter</code> API and <code>compareState</code> mode API methods for finer-grained mode magic.</li>
+    <li>Add a <code>getScrollerElement</code> API method to manipulate the scrolling DIV.</li>
+    <li>Fix drag-and-drop for Firefox.</li>
+    <li>Add a C# configuration for the <a href="../mode/clike/index.html">C-like mode</a>.</li>
+    <li>Add <a href="../demo/fullscreen.html">full-screen editing</a> and <a href="../demo/changemode.html">mode-changing</a> demos.</li>
+  </ul>
+
+  <p class="rel">07-06-2011: <a href="https://codemirror.net/5/codemirror-2.1.zip">Version 2.1</a>:</p>
+  <p class="rel-note">Add
+  a <a href="manual.html#option_theme">theme</a> system
+  (<a href="../demo/theme.html">demo</a>). Note that this is not
+  backwards-compatible—you'll have to update your styles and
+  modes!</p>
+
+  <p class="rel">07-06-2011: <a href="https://codemirror.net/5/codemirror-2.02.zip">Version 2.02</a>:</p>
+  <ul class="rel-note">
+    <li>Add a <a href="../mode/lua/index.html">Lua mode</a>.</li>
+    <li>Fix reverse-searching for a regexp.</li>
+    <li>Empty lines can no longer break highlighting.</li>
+    <li>Rework scrolling model (the outer wrapper no longer does the scrolling).</li>
+    <li>Solve horizontal jittering on long lines.</li>
+    <li>Add <a href="../demo/runmode.html">runmode.js</a>.</li>
+    <li>Immediately re-highlight text when typing.</li>
+    <li>Fix problem with 'sticking' horizontal scrollbar.</li>
+  </ul>
+
+  <p class="rel">26-05-2011: <a href="https://codemirror.net/5/codemirror-2.01.zip">Version 2.01</a>:</p>
+  <ul class="rel-note">
+    <li>Add a <a href="../mode/smalltalk/index.html">Smalltalk mode</a>.</li>
+    <li>Add a <a href="../mode/rst/index.html">reStructuredText mode</a>.</li>
+    <li>Add a <a href="../mode/python/index.html">Python mode</a>.</li>
+    <li>Add a <a href="../mode/plsql/index.html">PL/SQL mode</a>.</li>
+    <li><code>coordsChar</code> now works</li>
+    <li>Fix a problem where <code>onCursorActivity</code> interfered with <code>onChange</code>.</li>
+    <li>Fix a number of scrolling and mouse-click-position glitches.</li>
+    <li>Pass information about the changed lines to <code>onChange</code>.</li>
+    <li>Support cmd-up/down on OS X.</li>
+    <li>Add triple-click line selection.</li>
+    <li>Don't handle shift when changing the selection through the API.</li>
+    <li>Support <code>"nocursor"</code> mode for <code>readOnly</code> option.</li>
+    <li>Add an <code>onHighlightComplete</code> option.</li>
+    <li>Fix the context menu for Firefox.</li>
+  </ul>
+
+  <p class="rel">28-03-2011: <a href="https://codemirror.net/5/codemirror-2.0.zip">Version 2.0</a>:</p>
+  <p class="rel-note">CodeMirror 2 is a complete rewrite that's
+  faster, smaller, simpler to use, and less dependent on browser
+  quirks. See <a href="internals.html">this</a>
+  and <a href="http://groups.google.com/group/codemirror/browse_thread/thread/5a8e894024a9f580">this</a>
+  for more information.</p>
+
+  <p class="rel">22-02-2011: <a href="https://github.com/codemirror/codemirror5/tree/beta2">Version 2.0 beta 2</a>:</p>
+  <p class="rel-note">Somewhat more mature API, lots of bugs shaken out.</p>
+
+  <p class="rel">17-02-2011: <a href="https://codemirror.net/5/codemirror-0.94.zip">Version 0.94</a>:</p>
+  <ul class="rel-note">
+    <li><code>tabMode: "spaces"</code> was modified slightly (now indents when something is selected).</li>
+    <li>Fixes a bug that would cause the selection code to break on some IE versions.</li>
+    <li>Disabling spell-check on WebKit browsers now works.</li>
+  </ul>
+
+  <p class="rel">08-02-2011: <a href="https://codemirror.net/5/">Version 2.0 beta 1</a>:</p>
+  <p class="rel-note">CodeMirror 2 is a complete rewrite of
+  CodeMirror, no longer depending on an editable frame.</p>
+
+  <p class="rel">19-01-2011: <a href="https://codemirror.net/5/codemirror-0.93.zip">Version 0.93</a>:</p>
+  <ul class="rel-note">
+    <li>Added a <a href="contrib/regex/index.html">Regular Expression</a> parser.</li>
+    <li>Fixes to the PHP parser.</li>
+    <li>Support for regular expression in search/replace.</li>
+    <li>Add <code>save</code> method to instances created with <code>fromTextArea</code>.</li>
+    <li>Add support for MS T-SQL in the SQL parser.</li>
+    <li>Support use of CSS classes for highlighting brackets.</li>
+    <li>Fix yet another hang with line-numbering in hidden editors.</li>
+  </ul>
+</section>
+
+<section id=v1>
+
+  <h2>Version 0.x</h2>
+
+  <p class="rel">28-03-2011: <a href="https://codemirror.net/5/codemirror-1.0.zip">Version 1.0</a>:</p>
+  <ul class="rel-note">
+    <li>Fix error when debug history overflows.</li>
+    <li>Refine handling of C# verbatim strings.</li>
+    <li>Fix some issues with JavaScript indentation.</li>
+  </ul>
+
+  <p class="rel">17-12-2010: <a href="https://codemirror.net/5/codemirror-0.92.zip">Version 0.92</a>:</p>
+  <ul class="rel-note">
+    <li>Make CodeMirror work in XHTML documents.</li>
+    <li>Fix bug in handling of backslashes in Python strings.</li>
+    <li>The <code>styleNumbers</code> option is now officially
+    supported and documented.</li>
+    <li><code>onLineNumberClick</code> option added.</li>
+    <li>More consistent names <code>onLoad</code> and
+    <code>onCursorActivity</code> callbacks. Old names still work, but
+    are deprecated.</li>
+    <li>Add a <a href="contrib/freemarker/index.html">Freemarker</a> mode.</li>
+  </ul>
+
+  <p class="rel">11-11-2010: <a
+  href="https://codemirror.net/5/codemirror-0.91.zip">Version 0.91</a>:</p>
+  <ul class="rel-note">
+    <li>Adds support for <a href="contrib/java">Java</a>.</li>
+    <li>Small additions to the <a href="contrib/php">PHP</a> and <a href="contrib/sql">SQL</a> parsers.</li>
+    <li>Work around various <a href="https://bugs.webkit.org/show_bug.cgi?id=47806">Webkit</a> <a href="https://bugs.webkit.org/show_bug.cgi?id=23474">issues</a>.</li>
+    <li>Fix <code>toTextArea</code> to update the code in the textarea.</li>
+    <li>Add a <code>noScriptCaching</code> option (hack to ease development).</li>
+    <li>Make sub-modes of <a href="mixedtest.html">HTML mixed</a> mode configurable.</li>
+  </ul>
+
+  <p class="rel">02-10-2010: <a
+  href="https://codemirror.net/5/codemirror-0.9.zip">Version 0.9</a>:</p>
+  <ul class="rel-note">
+    <li>Add support for searching backwards.</li>
+    <li>There are now parsers for <a href="contrib/scheme/index.html">Scheme</a>, <a href="contrib/xquery/index.html">XQuery</a>, and <a href="contrib/ometa/index.html">OmetaJS</a>.</li>
+    <li>Makes <code>height: "dynamic"</code> more robust.</li>
+    <li>Fixes bug where paste did not work on OS X.</li>
+    <li>Add a <code>enterMode</code> and <code>electricChars</code> options to make indentation even more customizable.</li>
+    <li>Add <code>firstLineNumber</code> option.</li>
+    <li>Fix bad handling of <code>@media</code> rules by the CSS parser.</li>
+    <li>Take a new, more robust approach to working around the invisible-last-line bug in WebKit.</li>
+  </ul>
+
+  <p class="rel">22-07-2010: <a
+  href="https://codemirror.net/5/codemirror-0.8.zip">Version 0.8</a>:</p>
+  <ul class="rel-note">
+    <li>Add a <code>cursorCoords</code> method to find the screen
+    coordinates of the cursor.</li>
+    <li>A number of fixes and support for more syntax in the PHP parser.</li>
+    <li>Fix indentation problem with JSON-mode JS parser in Webkit.</li>
+    <li>Add a <a href="compress.html">minification</a> UI.</li>
+    <li>Support a <code>height: dynamic</code> mode, where the editor's
+    height will adjust to the size of its content.</li>
+    <li>Better support for IME input mode.</li>
+    <li>Fix JavaScript parser getting confused when seeing a no-argument
+    function call.</li>
+    <li>Have CSS parser see the difference between selectors and other
+    identifiers.</li>
+    <li>Fix scrolling bug when pasting in a horizontally-scrolled
+    editor.</li>
+    <li>Support <code>toTextArea</code> method in instances created with
+    <code>fromTextArea</code>.</li>
+    <li>Work around new Opera cursor bug that causes the cursor to jump
+    when pressing backspace at the end of a line.</li>
+  </ul>
+
+  <p class="rel">27-04-2010: <a
+  href="https://codemirror.net/5/codemirror-0.67.zip">Version
+  0.67</a>:</p>
+  <p class="rel-note">More consistent page-up/page-down behaviour
+  across browsers. Fix some issues with hidden editors looping forever
+  when line-numbers were enabled. Make PHP parser parse
+  <code>"\\"</code> correctly. Have <code>jumpToLine</code> work on
+  line handles, and add <code>cursorLine</code> function to fetch the
+  line handle where the cursor currently is. Add new
+  <code>setStylesheet</code> function to switch style-sheets in a
+  running editor.</p>
+
+  <p class="rel">01-03-2010: <a
+  href="https://codemirror.net/5/codemirror-0.66.zip">Version
+  0.66</a>:</p>
+  <p class="rel-note">Adds <code>removeLine</code> method to API.
+  Introduces the <a href="contrib/plsql/index.html">PLSQL parser</a>.
+  Marks XML errors by adding (rather than replacing) a CSS class, so
+  that they can be disabled by modifying their style. Fixes several
+  selection bugs, and a number of small glitches.</p>
+
+  <p class="rel">12-11-2009: <a
+  href="https://codemirror.net/5/codemirror-0.65.zip">Version
+  0.65</a>:</p>
+  <p class="rel-note">Add support for having both line-wrapping and
+  line-numbers turned on, make paren-highlighting style customisable
+  (<code>markParen</code> and <code>unmarkParen</code> config
+  options), work around a selection bug that Opera
+  <em>re</em>introduced in version 10.</p>
+
+  <p class="rel">23-10-2009: <a
+  href="https://codemirror.net/5/codemirror-0.64.zip">Version
+  0.64</a>:</p>
+  <p class="rel-note">Solves some issues introduced by the
+  paste-handling changes from the previous release. Adds
+  <code>setSpellcheck</code>, <code>setTextWrapping</code>,
+  <code>setIndentUnit</code>, <code>setUndoDepth</code>,
+  <code>setTabMode</code>, and <code>setLineNumbers</code> to
+  customise a running editor. Introduces an <a
+  href="contrib/sql/index.html">SQL</a> parser. Fixes a few small
+  problems in the <a href="contrib/python/index.html">Python</a>
+  parser. And, as usual, add workarounds for various newly discovered
+  browser incompatibilities.</p>
+
+  <p class="rel">31-08-2009: <a href="https://codemirror.net/5/codemirror-0.63.zip">Version 0.63</a>:</p>
+  <p class="rel-note"> Overhaul of paste-handling (less fragile), fixes for several
+  serious IE8 issues (cursor jumping, end-of-document bugs) and a number
+  of small problems.</p>
+
+  <p class="rel">30-05-2009: <a href="https://codemirror.net/5/codemirror-0.62.zip">Version 0.62</a>:</p>
+  <p class="rel-note">Introduces <a href="contrib/python/index.html">Python</a>
+  and <a href="contrib/lua/index.html">Lua</a> parsers. Add
+  <code>setParser</code> (on-the-fly mode changing) and
+  <code>clearHistory</code> methods. Make parsing passes time-based
+  instead of lines-based (see the <code>passTime</code> option).</p>
+
+</section>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/reporting.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,60 @@
+<!doctype html>
+
+<title>CodeMirror: Reporting Bugs</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Reporting bugs</a>
+  </ul>
+</div>
+
+<article>
+
+<h2>Reporting bugs effectively</h2>
+
+<div class="left">
+
+<p>So you found a problem in CodeMirror. By all means, report it! Bug
+reports from users are the main drive behind improvements to
+CodeMirror. But first, please read over these points:</p>
+
+<ol>
+  <li>CodeMirror is maintained by volunteers. They don't owe you
+  anything, so be polite. Reports with an indignant or belligerent
+  tone tend to be moved to the bottom of the pile.</li>
+
+  <li>Include information about <strong>the browser in which the
+  problem occurred</strong>. Even if you tested several browsers, and
+  the problem occurred in all of them, mention this fact in the bug
+  report. Also include browser version numbers and the operating
+  system that you're on.</li>
+
+  <li>Mention which release of CodeMirror you're using. Preferably,
+  try also with the current development snapshot, to ensure the
+  problem has not already been fixed.</li>
+
+  <li>Mention very precisely what went wrong. "X is broken" is not a
+  good bug report. What did you expect to happen? What happened
+  instead? Describe the exact steps a maintainer has to take to reproduce
+  the error. We can not fix something that we can not observe.</li>
+
+  <li>If the problem can not be reproduced in any of the demos
+  included in the CodeMirror distribution, please provide an HTML
+  document that demonstrates the problem. The best way to do this is
+  to go to <a href="http://jsbin.com/ihunin/1/edit">jsbin.com</a>, enter
+  it there, press save, and include the resulting link in your bug
+  report.</li>
+</ol>
+
+</div>
+
+</article>
Binary file .cms/lib/codemirror/doc/source_sans.woff has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/upgrade_v2.2.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,96 @@
+<!doctype html>
+
+<title>CodeMirror: Version 2.2 upgrade guide</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">2.2 upgrade guide</a>
+  </ul>
+</div>
+
+<article>
+
+<h2>Upgrading to v2.2</h2>
+
+<p>There are a few things in the 2.2 release that require some care
+when upgrading.</p>
+
+<h3>No more default.css</h3>
+
+<p>The default theme is now included
+in <a href="../lib/codemirror.css"><code>codemirror.css</code></a>, so
+you do not have to included it separately anymore. (It was tiny, so
+even if you're not using it, the extra data overhead is negligible.)
+
+<h3>Different key customization</h3>
+
+<p>CodeMirror has moved to a system
+where <a href="manual.html#option_keyMap">keymaps</a> are used to
+bind behavior to keys. This means <a href="../demo/emacs.html">custom
+bindings</a> are now possible.</p>
+
+<p>Three options that influenced key
+behavior, <code>tabMode</code>, <code>enterMode</code>,
+and <code>smartHome</code>, are no longer supported. Instead, you can
+provide custom bindings to influence the way these keys act. This is
+done through the
+new <a href="manual.html#option_extraKeys"><code>extraKeys</code></a>
+option, which can hold an object mapping key names to functionality. A
+simple example would be:</p>
+
+<pre>  extraKeys: {
+    "Ctrl-S": function(instance) { saveText(instance.getValue()); },
+    "Ctrl-/": "undo"
+  }</pre>
+
+<p>Keys can be mapped either to functions, which will be given the
+editor instance as argument, or to strings, which are mapped through
+functions through the <code>CodeMirror.commands</code> table, which
+contains all the built-in editing commands, and can be inspected and
+extended by external code.</p>
+
+<p>By default, the <code>Home</code> key is bound to
+the <code>"goLineStartSmart"</code> command, which moves the cursor to
+the first non-whitespace character on the line. You can set do this to
+make it always go to the very start instead:</p>
+
+<pre>  extraKeys: {"Home": "goLineStart"}</pre>
+
+<p>Similarly, <code>Enter</code> is bound
+to <code>"newlineAndIndent"</code> by default. You can bind it to
+something else to get different behavior. To disable special handling
+completely and only get a newline character inserted, you can bind it
+to <code>false</code>:</p>
+
+<pre>  extraKeys: {"Enter": false}</pre>
+
+<p>The same works for <code>Tab</code>. If you don't want CodeMirror
+to handle it, bind it to <code>false</code>. The default behaviour is
+to indent the current line more (<code>"indentMore"</code> command),
+and indent it less when shift is held (<code>"indentLess"</code>).
+There are also <code>"indentAuto"</code> (smart indent)
+and <code>"insertTab"</code> commands provided for alternate
+behavior. Or you can write your own handler function to do something
+different altogether.</p>
+
+<h3>Tabs</h3>
+
+<p>Handling of tabs changed completely. The display width of tabs can
+now be set with the <code>tabSize</code> option, and tabs can
+be <a href="../demo/visibletabs.html">styled</a> by setting CSS rules
+for the <code>cm-tab</code> class.</p>
+
+<p>The default width for tabs is now 4, as opposed to the 8 that is
+hard-wired into browsers. If you are relying on 8-space tabs, make
+sure you explicitly set <code>tabSize: 8</code> in your options.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/upgrade_v3.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,230 @@
+<!doctype html>
+
+<title>CodeMirror: Version 3 upgrade guide</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+<script src="../lib/codemirror.js"></script>
+<link rel="stylesheet" href="../lib/codemirror.css">
+<script src="../addon/runmode/runmode.js"></script>
+<script src="../addon/runmode/colorize.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../mode/css/css.js"></script>
+<script src="../mode/htmlmixed/htmlmixed.js"></script>
+<script src="activebookmark.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#upgrade">Upgrade guide</a>
+    <li><a href="#dom">DOM structure</a></li>
+    <li><a href="#gutters">Gutter model</a></li>
+    <li><a href="#events">Event handling</a></li>
+    <li><a href="#marktext">markText method arguments</a></li>
+    <li><a href="#folding">Line folding</a></li>
+    <li><a href="#lineclass">Line CSS classes</a></li>
+    <li><a href="#positions">Position properties</a></li>
+    <li><a href="#matchbrackets">Bracket matching</a></li>
+    <li><a href="#modes">Mode management</a></li>
+    <li><a href="#new">New features</a></li>
+  </ul>
+</div>
+
+<article>
+
+<h2 id=upgrade>Upgrading to version 3</h2>
+
+<p>Version 3 does not depart too much from 2.x API, and sites that use
+CodeMirror in a very simple way might be able to upgrade without
+trouble. But it does introduce a number of incompatibilities. Please
+at least skim this text before upgrading.</p>
+
+<p>Note that <strong>version 3 drops full support for Internet
+Explorer 7</strong>. The editor will mostly work on that browser, but
+it'll be significantly glitchy.</p>
+
+<section id=dom>
+  <h2>DOM structure</h2>
+
+<p>This one is the most likely to cause problems. The internal
+structure of the editor has changed quite a lot, mostly to implement a
+new scrolling model.</p>
+
+<p>Editor height is now set on the outer wrapper element (CSS
+class <code>CodeMirror</code>), not on the scroller element
+(<code>CodeMirror-scroll</code>).</p>
+
+<p>Other nodes were moved, dropped, and added. If you have any code
+that makes assumptions about the internal DOM structure of the editor,
+you'll have to re-test it and probably update it to work with v3.</p>
+
+<p>See the <a href="manual.html#styling">styling section</a> of the
+manual for more information.</p>
+</section>
+<section id=gutters>
+  <h2>Gutter model</h2>
+
+<p>In CodeMirror 2.x, there was a single gutter, and line markers
+created with <code>setMarker</code> would have to somehow coexist with
+the line numbers (if present). Version 3 allows you to specify an
+array of gutters, <a href="manual.html#option_gutters">by class
+name</a>,
+use <a href="manual.html#setGutterMarker"><code>setGutterMarker</code></a>
+to add or remove markers in individual gutters, and clear whole
+gutters
+with <a href="manual.html#clearGutter"><code>clearGutter</code></a>.
+Gutter markers are now specified as DOM nodes, rather than HTML
+snippets.</p>
+
+<p>The gutters no longer horizontally scrolls along with the content.
+The <code>fixedGutter</code> option was removed (since it is now the
+only behavior).</p>
+
+<pre data-lang="text/html">
+&lt;style>
+  /* Define a gutter style */
+  .note-gutter { width: 3em; background: cyan; }
+&lt;/style>
+&lt;script>
+  // Create an instance with two gutters -- line numbers and notes
+  var cm = new CodeMirror(document.body, {
+    gutters: ["note-gutter", "CodeMirror-linenumbers"],
+    lineNumbers: true
+  });
+  // Add a note to line 0
+  cm.setGutterMarker(0, "note-gutter", document.createTextNode("hi"));
+&lt;/script>
+</pre>
+</section>
+<section id=events>
+  <h2>Event handling</h2>
+
+<p>Most of the <code>onXYZ</code> options have been removed. The same
+effect is now obtained by calling
+the <a href="manual.html#on"><code>on</code></a> method with a string
+identifying the event type. Multiple handlers can now be registered
+(and individually unregistered) for an event, and objects such as line
+handlers now also expose events. See <a href="manual.html#events">the
+full list here</a>.</p>
+
+<p>(The <code>onKeyEvent</code> and <code>onDragEvent</code> options,
+which act more as hooks than as event handlers, are still there in
+their old form.)</p>
+
+<pre data-lang="javascript">
+cm.on("change", function(cm, change) {
+  console.log("something changed! (" + change.origin + ")");
+});
+</pre>
+</section>
+<section id=marktext>
+  <h2>markText method arguments</h2>
+
+<p>The <a href="manual.html#markText"><code>markText</code></a> method
+(which has gained some interesting new features, such as creating
+atomic and read-only spans, or replacing spans with widgets) no longer
+takes the CSS class name as a separate argument, but makes it an
+optional field in the options object instead.</p>
+
+<pre data-lang="javascript">
+// Style first ten lines, and forbid the cursor from entering them
+cm.markText({line: 0, ch: 0}, {line: 10, ch: 0}, {
+  className: "magic-text",
+  inclusiveLeft: true,
+  atomic: true
+});
+</pre>
+</section>
+<section id=folding>
+  <h2>Line folding</h2>
+
+<p>The interface for hiding lines has been
+removed. <a href="manual.html#markText"><code>markText</code></a> can
+now be used to do the same in a more flexible and powerful way.</p>
+
+<p>The <a href="../demo/folding.html">folding script</a> has been
+updated to use the new interface, and should now be more robust.</p>
+
+<pre data-lang="javascript">
+// Fold a range, replacing it with the text "??"
+var range = cm.markText({line: 4, ch: 2}, {line: 8, ch: 1}, {
+  replacedWith: document.createTextNode("??"),
+  // Auto-unfold when cursor moves into the range
+  clearOnEnter: true
+});
+// Get notified when auto-unfolding
+CodeMirror.on(range, "clear", function() {
+  console.log("boom");
+});
+</pre>
+</section>
+<section id=lineclass>
+  <h2>Line CSS classes</h2>
+
+<p>The <code>setLineClass</code> method has been replaced
+by <a href="manual.html#addLineClass"><code>addLineClass</code></a>
+and <a href="manual.html#removeLineClass"><code>removeLineClass</code></a>,
+which allow more modular control over the classes attached to a line.</p>
+
+<pre data-lang="javascript">
+var marked = cm.addLineClass(10, "background", "highlighted-line");
+setTimeout(function() {
+  cm.removeLineClass(marked, "background", "highlighted-line");
+});
+</pre>
+</section>
+<section id=positions>
+  <h2>Position properties</h2>
+
+<p>All methods that take or return objects that represent screen
+positions now use <code>{left, top, bottom, right}</code> properties
+(not always all of them) instead of the <code>{x, y, yBot}</code> used
+by some methods in v2.x.</p>
+
+<p>Affected methods
+are <a href="manual.html#cursorCoords"><code>cursorCoords</code></a>, <a href="manual.html#charCoords"><code>charCoords</code></a>, <a href="manual.html#coordsChar"><code>coordsChar</code></a>,
+and <a href="manual.html#getScrollInfo"><code>getScrollInfo</code></a>.</p>
+</section>
+<section id=matchbrackets>
+  <h2>Bracket matching no longer in core</h2>
+
+<p>The <a href="manual.html#addon_matchbrackets"><code>matchBrackets</code></a>
+option is no longer defined in the core editor.
+Load <code>addon/edit/matchbrackets.js</code> to enable it.</p>
+</section>
+<section id=modes>
+  <h2>Mode management</h2>
+
+<p>The <code>CodeMirror.listModes</code>
+and <code>CodeMirror.listMIMEs</code> functions, used for listing
+defined modes, are gone. You are now encouraged to simply
+inspect <code>CodeMirror.modes</code> (mapping mode names to mode
+constructors) and <code>CodeMirror.mimeModes</code> (mapping MIME
+strings to mode specs).</p>
+</section>
+<section id=new>
+  <h2>New features</h2>
+
+<p>Some more reasons to upgrade to version 3.</p>
+
+<ul>
+  <li>Bi-directional text support. CodeMirror will now mostly do the
+  right thing when editing Arabic or Hebrew text.</li>
+  <li>Arbitrary line heights. Using fonts with different heights
+  inside the editor (whether off by one pixel or fifty) is now
+  supported and handled gracefully.</li>
+  <li>In-line widgets. See <a href="../demo/widget.html">the demo</a>
+  and <a href="manual.html#addLineWidget">the docs</a>.</li>
+  <li>Defining custom options
+  with <a href="manual.html#defineOption"><code>CodeMirror.defineOption</code></a>.</li>
+</ul>
+</section>
+</article>
+
+<script>setTimeout(function(){CodeMirror.colorize();}, 20);</script>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/doc/upgrade_v4.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,144 @@
+<!doctype html>
+
+<title>CodeMirror: Version 4 upgrade guide</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="docs.css">
+<script src="activebookmark.js"></script>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#upgrade">Upgrade guide</a>
+    <li><a href="#multisel">Multiple selections</a>
+    <li><a href="#beforeSelectionChange">The beforeSelectionChange event</a>
+    <li><a href="#replaceSelection">replaceSelection and collapsing</a>
+    <li><a href="#changeEvent">change event data</a>
+    <li><a href="#showIfHidden">showIfHidden option to line widgets</a>
+    <li><a href="#module">Module loaders</a>
+    <li><a href="#shareddata">Mutating shared data structures</a></li>
+    <li><a href="#deprecated">Deprecated interfaces dropped</a>
+  </ul>
+</div>
+
+<article>
+
+<h2 id=upgrade>Upgrading to version 4</h2>
+
+<p>CodeMirror 4's interface is <em>very</em> close version 3, but it
+does fix a few awkward details in a backwards-incompatible ways. At
+least skim the text below before upgrading.</p>
+
+<section id=multisel><h2>Multiple selections</h2>
+
+<p>The main new feature in version 4 is multiple selections. The
+single-selection variants of methods are still there, but now
+typically act only on the <em>primary</em> selection (usually the last
+one added).</p>
+
+<p>The exception to this
+is <a href="manual.html#getSelection"><strong><code>getSelection</code></strong></a>,
+which will now return the content of <em>all</em> selections
+(separated by newlines, or whatever <code>lineSep</code> parameter you passed
+it).</p>
+
+</section>
+
+<section id=beforeSelectionChange><h2>The beforeSelectionChange event</h2>
+
+<p>This event still exists, but the object it is passed has
+a <a href="manual.html#event_beforeSelectionChange">completely new
+interface</a>, because such changes now concern multiple
+selections.</p>
+
+</section>
+
+<section id=replaceSelection><h2>replaceSelection's collapsing behavior</h2>
+
+<p>By
+default, <a href="manual.html#replaceSelection"><code>replaceSelection</code></a>
+would leave the newly inserted text selected. This is only rarely what
+you want, and also (slightly) more expensive in the new model, so the
+default was changed to <code>"end"</code>, meaning the old behavior
+must be explicitly specified by passing a second argument
+of <code>"around"</code>.</p>
+
+</section>
+
+<section id=changeEvent><h2>change event data</h2>
+
+<p>Rather than forcing client code to follow <code>next</code>
+pointers from one change object to the next, the library will now
+simply fire
+multiple <a href="manual.html#event_change"><code>"change"</code></a>
+events. Existing code will probably continue to work unmodified.</p>
+
+</section>
+
+<section id=showIfHidden><h2>showIfHidden option to line widgets</h2>
+
+<p>This option, which conceptually caused line widgets to be visible
+even if their line was hidden, was never really well-defined, and was
+buggy from the start. It would be a rather expensive feature, both in
+code complexity and run-time performance, to implement properly. It
+has been dropped entirely in 4.0.</p>
+
+</section>
+
+<section id=module><h2>Module loaders</h2>
+
+<p>All modules in the CodeMirror distribution are now wrapped in a
+shim function to make them compatible with both AMD
+(<a href="http://requirejs.org">requirejs</a>) and CommonJS (as used
+by <a href="http://nodejs.org/">node</a>
+and <a href="http://browserify.org/">browserify</a>) module loaders.
+When neither of these is present, they fall back to simply using the
+global <code>CodeMirror</code> variable.</p>
+
+<p>If you have a module loader present in your environment, CodeMirror
+will attempt to use it, and you might need to change the way you load
+CodeMirror modules.</p>
+
+</section>
+
+<section id=shareddata><h2>Mutating shared data structures</h2>
+
+<p>Data structures produced by the library should not be mutated
+unless explicitly allowed, in general. This is slightly more strict in
+4.0 than it was in earlier versions, which copied the position objects
+returned by <a href="manual.html#getCursor"><code>getCursor</code></a>
+for nebulous, historic reasons. In 4.0, mutating these
+objects <em>will</em> corrupt your editor's selection.</p>
+
+</section>
+
+<section id=deprecated><h2>Deprecated interfaces dropped</h2>
+
+<p>A few properties and methods that have been deprecated for a while
+are now gone. Most notably, the <code>onKeyEvent</code>
+and <code>onDragEvent</code> options (use the
+corresponding <a href="manual.html#event_dom">events</a> instead).</p>
+
+<p>Two silly methods, which were mostly there to stay close to the 0.x
+API, <code>setLine</code> and <code>removeLine</code> are now gone.
+Use the more
+flexible <a href="manual.html#replaceRange"><code>replaceRange</code></a>
+method instead.</p>
+
+<p>The long names for folding and completing functions
+(<code>CodeMirror.braceRangeFinder</code>, <code>CodeMirror.javascriptHint</code>,
+etc) are also gone
+(use <code>CodeMirror.fold.brace</code>, <code>CodeMirror.hint.javascript</code>).</p>
+
+<p>The <code>className</code> property in the return value
+of <a href="manual.html#getTokenAt"><code>getTokenAt</code></a>, which
+has been superseded by the <code>type</code> property, is also no
+longer present.</p>
+
+</section>
+</article>
Binary file .cms/lib/codemirror/doc/yinyang.png has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,172 @@
+<!doctype html>
+
+<title>CodeMirror 5</title>
+<meta charset="utf-8"/>
+
+<link rel=stylesheet href="lib/codemirror.css">
+<link rel=stylesheet href="doc/docs.css">
+<script src="lib/codemirror.js"></script>
+<script src="mode/xml/xml.js"></script>
+<script src="mode/javascript/javascript.js"></script>
+<script src="mode/css/css.js"></script>
+<script src="mode/htmlmixed/htmlmixed.js"></script>
+<script src="addon/edit/matchbrackets.js"></script>
+
+<script src="doc/activebookmark.js"></script>
+
+<style>
+  .CodeMirror { height: auto; border: 1px solid #ddd; }
+  .CodeMirror-scroll { max-height: 200px; }
+  .CodeMirror pre { padding-left: 7px; line-height: 1.25; }
+  .banner { background: #ffc; padding: 6px; border-bottom: 2px solid silver; text-align: center }
+</style>
+
+<div class=banner>
+  Note that this is the website for CodeMirror 5. <a href="https://codemirror.net/">Version 6</a> is the current version.
+</div>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="doc/logo.png"></a>
+
+  <ul>
+    <li><a class=active data-default="true" href="#description">Home</a>
+    <li><a href="doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+    <li><a href="https://codemirror.net/">Version 6</a>
+  </ul>
+  <ul>
+    <li><a href="#features">Features</a>
+    <li><a href="#community">Community</a>
+    <li><a href="#browsersupport">Browser support</a>
+  </ul>
+</div>
+
+<article>
+
+<section id=description class=first>
+  <p><strong>CodeMirror</strong> is a versatile text editor
+  implemented in JavaScript for the browser. It is specialized for
+  editing code, and comes with a number of <a href="mode/index.html">language modes</a> and <a href="doc/manual.html#addons">addons</a>
+  that implement more advanced editing functionality.</p>
+
+  <p>A rich <a href="doc/manual.html#api">programming API</a> and a
+  CSS <a href="doc/manual.html#styling">theming</a> system are
+  available for customizing CodeMirror to fit your application, and
+  extending it with new functionality.</p>
+</section>
+
+<section id=demo>
+  <h2>This is CodeMirror</h2>
+  <form style="position: relative; margin-top: .5em;"><textarea id=demotext>
+<!-- Create a simple CodeMirror instance -->
+<link rel="stylesheet" href="lib/codemirror.css">
+<script src="lib/codemirror.js"></script>
+<script>
+  var editor = CodeMirror.fromTextArea(myTextarea, {
+    lineNumbers: true
+  });
+</script></textarea>
+  <select id="demolist" onchange="document.location = this.options[this.selectedIndex].value;">
+    <option value="#">Other demos...</option>
+    <option value="demo/complete.html">Autocompletion</option>
+    <option value="demo/folding.html">Code folding</option>
+    <option value="demo/theme.html">Themes</option>
+    <option value="mode/htmlmixed/index.html">Mixed language modes</option>
+    <option value="demo/bidi.html">Bi-directional text</option>
+    <option value="demo/variableheight.html">Variable font sizes</option>
+    <option value="demo/search.html">Search interface</option>
+    <option value="demo/vim.html">Vim bindings</option>
+    <option value="demo/emacs.html">Emacs bindings</option>
+    <option value="demo/sublime.html">Sublime Text bindings</option>
+    <option value="demo/tern.html">Tern integration</option>
+    <option value="demo/merge.html">Merge/diff interface</option>
+    <option value="demo/fullscreen.html">Full-screen editor</option>
+    <option value="demo/simplescrollbars.html">Custom scrollbars</option>
+  </select></form>
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("demotext"), {
+      lineNumbers: true,
+      mode: "text/html",
+      matchBrackets: true
+    });
+  </script>
+
+  <div class=actions>
+    Get the current version: <a href="https://codemirror.net/5/codemirror.zip">5.65.18</a>.<br>
+    You can see the <a href="https://github.com/codemirror/codemirror5" title="GitHub repository">code</a>,<br>
+    read the <a href="doc/releases.html">release notes</a>,<br>
+    or study the <a href="doc/manual.html">user manual</a>.
+  </div>
+
+</section>
+
+<section id=features>
+  <h2>Features</h2>
+  <ul>
+    <li>Support for <a href="mode/index.html">over 100 languages</a> out of the box
+    <li>A powerful, <a href="mode/htmlmixed/index.html">composable</a> language mode <a href="doc/manual.html#modeapi">system</a>
+    <li><a href="doc/manual.html#addon_show-hint">Autocompletion</a> (<a href="demo/xmlcomplete.html">XML</a>)
+    <li><a href="doc/manual.html#addon_foldcode">Code folding</a>
+    <li><a href="doc/manual.html#option_extraKeys">Configurable</a> keybindings
+    <li><a href="demo/vim.html">Vim</a>, <a href="demo/emacs.html">Emacs</a>, and <a href="demo/sublime.html">Sublime Text</a> bindings
+    <li><a href="doc/manual.html#addon_search">Search and replace</a> interface
+    <li><a href="doc/manual.html#addon_matchbrackets">Bracket</a> and <a href="doc/manual.html#addon_matchtags">tag</a> matching
+    <li>Support for <a href="demo/buffers.html">split views</a>
+    <li><a href="doc/manual.html#addon_lint">Linter integration</a>
+    <li><a href="demo/variableheight.html">Mixing font sizes and styles</a>
+    <li><a href="demo/theme.html">Various themes</a>
+    <li>Able to <a href="demo/resize.html">resize to fit content</a>
+    <li><a href="doc/manual.html#mark_replacedWith">Inline</a> and <a href="doc/manual.html#addLineWidget">block</a> widgets
+    <li>Programmable <a href="demo/marker.html">gutters</a>
+    <li>Making ranges of text <a href="doc/manual.html#markText">styled, read-only, or atomic</a>
+    <li><a href="demo/bidi.html">Bi-directional text</a> support
+    <li>Many other <a href="doc/manual.html#api">methods</a> and <a href="doc/manual.html#addons">addons</a>...
+  </ul>
+</section>
+
+<section id=community>
+  <h2>Community</h2>
+
+  <p>CodeMirror is an open-source project shared under
+  an <a href="LICENSE">MIT license</a>.</p>
+
+  <p>Development and bug tracking happens
+  on <a href="https://github.com/codemirror/CodeMirror/">github</a>
+  (<a href="http://marijnhaverbeke.nl/git/codemirror">alternate git
+  repository</a>).
+  Please <a href="https://codemirror.net/5/doc/reporting.html">read these
+  pointers</a> before submitting a bug. Use pull requests to submit
+  patches. All contributions must be released under the same MIT
+  license that CodeMirror uses.</p>
+
+  <p>Discussion around the project is done on
+  a <a href="https://discuss.codemirror.net">discussion forum</a>.
+  Announcements related to the project, such as new versions, are
+  posted in the
+  forum's <a href="https://discuss.codemirror.net/c/announce">"announce"</a>
+  category. If needed, you can
+  contact <a href="mailto:marijn@haverbeke.berlin">the maintainer</a>
+  directly. We aim to be an inclusive, welcoming community. To make
+  that explicit, we have
+  a <a href="http://contributor-covenant.org/version/1/1/0/">code of
+  conduct</a> that applies to communication around the project.</p>
+</section>
+
+<section id=browsersupport>
+  <h2>Browser support</h2>
+  <p>The <em>desktop</em> versions of the following browsers,
+  in <em>standards mode</em> (HTML5 <code>&lt;!doctype html></code>
+  recommended) are supported:</p>
+  <table style="margin-bottom: 1em">
+    <tr><th>Firefox</th><td>version 4 and up</td></tr>
+    <tr><th>Chrome</th><td>any version</td></tr>
+    <tr><th>Safari</th><td>version 5.2 and up</td></tr>
+    <tr><th style="padding-right: 1em;">Internet Explorer/Edge</th><td>version 8 and up</td></tr>
+    <tr><th>Opera</th><td>version 9 and up</td></tr>
+  </table>
+  <p>Support for modern mobile browsers is experimental. Recent
+  versions of the iOS browser and Chrome on Android should work
+  pretty well.</p>
+</section>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/keymap/emacs.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,545 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var cmds = CodeMirror.commands;
+  var Pos = CodeMirror.Pos;
+  function posEq(a, b) { return a.line == b.line && a.ch == b.ch; }
+
+  // Kill 'ring'
+
+  var killRing = [];
+  function addToRing(str) {
+    killRing.push(str);
+    if (killRing.length > 50) killRing.shift();
+  }
+  function growRingTop(str) {
+    if (!killRing.length) return addToRing(str);
+    killRing[killRing.length - 1] += str;
+  }
+  function getFromRing(n) { return killRing[killRing.length - (n ? Math.min(n, 1) : 1)] || ""; }
+  function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); }
+
+  var lastKill = null;
+
+  // Internal generic kill function, used by several mapped kill "family" functions.
+  function _kill(cm, from, to, ring, text) {
+    if (text == null) text = cm.getRange(from, to);
+
+    if (ring == "grow" && lastKill && lastKill.cm == cm && posEq(from, lastKill.pos) && cm.isClean(lastKill.gen))
+      growRingTop(text);
+    else if (ring !== false)
+      addToRing(text);
+    cm.replaceRange("", from, to, "+delete");
+
+    if (ring == "grow") lastKill = {cm: cm, pos: from, gen: cm.changeGeneration()};
+    else lastKill = null;
+  }
+
+  // Boundaries of various units
+
+  function byChar(cm, pos, dir) {
+    return cm.findPosH(pos, dir, "char", true);
+  }
+
+  function byWord(cm, pos, dir) {
+    return cm.findPosH(pos, dir, "word", true);
+  }
+
+  function byLine(cm, pos, dir) {
+    return cm.findPosV(pos, dir, "line", cm.doc.sel.goalColumn);
+  }
+
+  function byPage(cm, pos, dir) {
+    return cm.findPosV(pos, dir, "page", cm.doc.sel.goalColumn);
+  }
+
+  function byParagraph(cm, pos, dir) {
+    var no = pos.line, line = cm.getLine(no);
+    var sawText = /\S/.test(dir < 0 ? line.slice(0, pos.ch) : line.slice(pos.ch));
+    var fst = cm.firstLine(), lst = cm.lastLine();
+    for (;;) {
+      no += dir;
+      if (no < fst || no > lst)
+        return cm.clipPos(Pos(no - dir, dir < 0 ? 0 : null));
+      line = cm.getLine(no);
+      var hasText = /\S/.test(line);
+      if (hasText) sawText = true;
+      else if (sawText) return Pos(no, 0);
+    }
+  }
+
+  function bySentence(cm, pos, dir) {
+    var line = pos.line, ch = pos.ch;
+    var text = cm.getLine(pos.line), sawWord = false;
+    for (;;) {
+      var next = text.charAt(ch + (dir < 0 ? -1 : 0));
+      if (!next) { // End/beginning of line reached
+        if (line == (dir < 0 ? cm.firstLine() : cm.lastLine())) return Pos(line, ch);
+        text = cm.getLine(line + dir);
+        if (!/\S/.test(text)) return Pos(line, ch);
+        line += dir;
+        ch = dir < 0 ? text.length : 0;
+        continue;
+      }
+      if (sawWord && /[!?.]/.test(next)) return Pos(line, ch + (dir > 0 ? 1 : 0));
+      if (!sawWord) sawWord = /\w/.test(next);
+      ch += dir;
+    }
+  }
+
+  function byExpr(cm, pos, dir) {
+    var wrap;
+    if (cm.findMatchingBracket && (wrap = cm.findMatchingBracket(pos, {strict: true}))
+        && wrap.match && (wrap.forward ? 1 : -1) == dir)
+      return dir > 0 ? Pos(wrap.to.line, wrap.to.ch + 1) : wrap.to;
+
+    for (var first = true;; first = false) {
+      var token = cm.getTokenAt(pos);
+      var after = Pos(pos.line, dir < 0 ? token.start : token.end);
+      if (first && dir > 0 && token.end == pos.ch || !/\w/.test(token.string)) {
+        var newPos = cm.findPosH(after, dir, "char");
+        if (posEq(after, newPos)) return pos;
+        else pos = newPos;
+      } else {
+        return after;
+      }
+    }
+  }
+
+  // Prefixes (only crudely supported)
+
+  function getPrefix(cm, precise) {
+    var digits = cm.state.emacsPrefix;
+    if (!digits) return precise ? null : 1;
+    clearPrefix(cm);
+    return digits == "-" ? -1 : Number(digits);
+  }
+
+  function repeated(cmd) {
+    var f = typeof cmd == "string" ? function(cm) { cm.execCommand(cmd); } : cmd;
+    return function(cm) {
+      var prefix = getPrefix(cm);
+      f(cm);
+      for (var i = 1; i < prefix; ++i) f(cm);
+    };
+  }
+
+  function findEnd(cm, pos, by, dir) {
+    var prefix = getPrefix(cm);
+    if (prefix < 0) { dir = -dir; prefix = -prefix; }
+    for (var i = 0; i < prefix; ++i) {
+      var newPos = by(cm, pos, dir);
+      if (posEq(newPos, pos)) break;
+      pos = newPos;
+    }
+    return pos;
+  }
+
+  function move(by, dir) {
+    var f = function(cm) {
+      cm.extendSelection(findEnd(cm, cm.getCursor(), by, dir));
+    };
+    f.motion = true;
+    return f;
+  }
+
+  function killTo(cm, by, dir, ring) {
+    var selections = cm.listSelections(), cursor;
+    var i = selections.length;
+    while (i--) {
+      cursor = selections[i].head;
+      _kill(cm, cursor, findEnd(cm, cursor, by, dir), ring);
+    }
+  }
+
+  function _killRegion(cm, ring) {
+    if (cm.somethingSelected()) {
+      var selections = cm.listSelections(), selection;
+      var i = selections.length;
+      while (i--) {
+        selection = selections[i];
+        _kill(cm, selection.anchor, selection.head, ring);
+      }
+      return true;
+    }
+  }
+
+  function addPrefix(cm, digit) {
+    if (cm.state.emacsPrefix) {
+      if (digit != "-") cm.state.emacsPrefix += digit;
+      return;
+    }
+    // Not active yet
+    cm.state.emacsPrefix = digit;
+    cm.on("keyHandled", maybeClearPrefix);
+    cm.on("inputRead", maybeDuplicateInput);
+  }
+
+  var prefixPreservingKeys = {"Alt-G": true, "Ctrl-X": true, "Ctrl-Q": true, "Ctrl-U": true};
+
+  function maybeClearPrefix(cm, arg) {
+    if (!cm.state.emacsPrefixMap && !prefixPreservingKeys.hasOwnProperty(arg))
+      clearPrefix(cm);
+  }
+
+  function clearPrefix(cm) {
+    cm.state.emacsPrefix = null;
+    cm.off("keyHandled", maybeClearPrefix);
+    cm.off("inputRead", maybeDuplicateInput);
+  }
+
+  function maybeDuplicateInput(cm, event) {
+    var dup = getPrefix(cm);
+    if (dup > 1 && event.origin == "+input") {
+      var one = event.text.join("\n"), txt = "";
+      for (var i = 1; i < dup; ++i) txt += one;
+      cm.replaceSelection(txt);
+    }
+  }
+
+  function maybeRemovePrefixMap(cm, arg) {
+    if (typeof arg == "string" && (/^\d$/.test(arg) || arg == "Ctrl-U")) return;
+    cm.removeKeyMap(prefixMap);
+    cm.state.emacsPrefixMap = false;
+    cm.off("keyHandled", maybeRemovePrefixMap);
+    cm.off("inputRead", maybeRemovePrefixMap);
+  }
+
+  // Utilities
+
+  cmds.setMark = function (cm) {
+    cm.setCursor(cm.getCursor());
+    cm.setExtending(!cm.getExtending());
+    cm.on("change", function() { cm.setExtending(false); });
+  }
+
+  function clearMark(cm) {
+    cm.setExtending(false);
+    cm.setCursor(cm.getCursor());
+  }
+
+  function makePrompt(msg) {
+    var fragment = document.createDocumentFragment();
+    var input = document.createElement("input");
+    input.setAttribute("type", "text");
+    input.style.width = "10em";
+    fragment.appendChild(document.createTextNode(msg + ": "));
+    fragment.appendChild(input);
+    return fragment;
+  }
+
+  function getInput(cm, msg, f) {
+    if (cm.openDialog)
+      cm.openDialog(makePrompt(msg), f, {bottom: true});
+    else
+      f(prompt(msg, ""));
+  }
+
+  function operateOnWord(cm, op) {
+    var start = cm.getCursor(), end = cm.findPosH(start, 1, "word");
+    cm.replaceRange(op(cm.getRange(start, end)), start, end);
+    cm.setCursor(end);
+  }
+
+  function toEnclosingExpr(cm) {
+    var pos = cm.getCursor(), line = pos.line, ch = pos.ch;
+    var stack = [];
+    while (line >= cm.firstLine()) {
+      var text = cm.getLine(line);
+      for (var i = ch == null ? text.length : ch; i > 0;) {
+        var ch = text.charAt(--i);
+        if (ch == ")")
+          stack.push("(");
+        else if (ch == "]")
+          stack.push("[");
+        else if (ch == "}")
+          stack.push("{");
+        else if (/[\(\{\[]/.test(ch) && (!stack.length || stack.pop() != ch))
+          return cm.extendSelection(Pos(line, i));
+      }
+      --line; ch = null;
+    }
+  }
+
+  // Commands. Names should match emacs function names (albeit in camelCase)
+  // except where emacs function names collide with code mirror core commands.
+
+  cmds.killRegion = function(cm) {
+    _kill(cm, cm.getCursor("start"), cm.getCursor("end"), true);
+  };
+
+  // Maps to emacs kill-line
+  cmds.killLineEmacs = repeated(function(cm) {
+    var start = cm.getCursor(), end = cm.clipPos(Pos(start.line));
+    var text = cm.getRange(start, end);
+    if (!/\S/.test(text)) {
+      text += "\n";
+      end = Pos(start.line + 1, 0);
+    }
+    _kill(cm, start, end, "grow", text);
+  });
+
+  cmds.killRingSave = function(cm) {
+    addToRing(cm.getSelection());
+    clearMark(cm);
+  };
+
+  cmds.yank = function(cm) {
+    var start = cm.getCursor();
+    cm.replaceRange(getFromRing(getPrefix(cm)), start, start, "paste");
+    cm.setSelection(start, cm.getCursor());
+  };
+
+  cmds.yankPop = function(cm) {
+    cm.replaceSelection(popFromRing(), "around", "paste");
+  };
+
+  cmds.forwardChar = move(byChar, 1);
+
+  cmds.backwardChar = move(byChar, -1)
+
+  cmds.deleteChar = function(cm) { killTo(cm, byChar, 1, false); };
+
+  cmds.deleteForwardChar = function(cm) {
+    _killRegion(cm, false) || killTo(cm, byChar, 1, false);
+  };
+
+  cmds.deleteBackwardChar = function(cm) {
+    _killRegion(cm, false) || killTo(cm, byChar, -1, false);
+  };
+
+  cmds.forwardWord = move(byWord, 1);
+
+  cmds.backwardWord = move(byWord, -1);
+
+  cmds.killWord = function(cm) { killTo(cm, byWord, 1, "grow"); };
+
+  cmds.backwardKillWord = function(cm) { killTo(cm, byWord, -1, "grow"); };
+
+  cmds.nextLine = move(byLine, 1);
+
+  cmds.previousLine = move(byLine, -1);
+
+  cmds.scrollDownCommand = move(byPage, -1);
+
+  cmds.scrollUpCommand = move(byPage, 1);
+
+  cmds.backwardParagraph = move(byParagraph, -1);
+
+  cmds.forwardParagraph = move(byParagraph, 1);
+
+  cmds.backwardSentence = move(bySentence, -1);
+
+  cmds.forwardSentence = move(bySentence, 1);
+
+  cmds.killSentence = function(cm) { killTo(cm, bySentence, 1, "grow"); };
+
+  cmds.backwardKillSentence = function(cm) {
+    _kill(cm, cm.getCursor(), bySentence(cm, cm.getCursor(), 1), "grow");
+  };
+
+  cmds.killSexp = function(cm) { killTo(cm, byExpr, 1, "grow"); };
+
+  cmds.backwardKillSexp = function(cm) { killTo(cm, byExpr, -1, "grow"); };
+
+  cmds.forwardSexp = move(byExpr, 1);
+
+  cmds.backwardSexp = move(byExpr, -1);
+
+  cmds.markSexp = function(cm) {
+    var cursor = cm.getCursor();
+    cm.setSelection(findEnd(cm, cursor, byExpr, 1), cursor);
+  };
+
+  cmds.transposeSexps = function(cm) {
+    var leftStart = byExpr(cm, cm.getCursor(), -1);
+    var leftEnd = byExpr(cm, leftStart, 1);
+    var rightEnd = byExpr(cm, leftEnd, 1);
+    var rightStart = byExpr(cm, rightEnd, -1);
+    cm.replaceRange(cm.getRange(rightStart, rightEnd) +
+                    cm.getRange(leftEnd, rightStart) +
+                    cm.getRange(leftStart, leftEnd), leftStart, rightEnd);
+  };
+
+  cmds.backwardUpList = repeated(toEnclosingExpr);
+
+  cmds.justOneSpace = function(cm) {
+    var pos = cm.getCursor(), from = pos.ch;
+    var to = pos.ch, text = cm.getLine(pos.line);
+    while (from && /\s/.test(text.charAt(from - 1))) --from;
+    while (to < text.length && /\s/.test(text.charAt(to))) ++to;
+    cm.replaceRange(" ", Pos(pos.line, from), Pos(pos.line, to));
+  };
+
+  cmds.openLine = repeated(function(cm) {
+    cm.replaceSelection("\n", "start");
+  });
+
+  // maps to emacs 'transpose-chars'
+  cmds.transposeCharsRepeatable = repeated(function(cm) {
+    cm.execCommand("transposeChars");
+  });
+
+  cmds.capitalizeWord = repeated(function(cm) {
+    operateOnWord(cm, function(w) {
+      var letter = w.search(/\w/);
+      if (letter == -1) return w;
+      return w.slice(0, letter) + w.charAt(letter).toUpperCase() +
+          w.slice(letter + 1).toLowerCase();
+    });
+  });
+
+  cmds.upcaseWord = repeated(function(cm) {
+    operateOnWord(cm, function(w) { return w.toUpperCase(); });
+  });
+
+  cmds.downcaseWord = repeated(function(cm) {
+    operateOnWord(cm, function(w) { return w.toLowerCase(); });
+  });
+
+  // maps to emacs 'undo'
+  cmds.undoRepeatable = repeated("undo");
+
+  cmds.keyboardQuit = function(cm) {
+    cm.execCommand("clearSearch");
+    clearMark(cm);
+  }
+
+  cmds.newline = repeated(function(cm) { cm.replaceSelection("\n", "end"); });
+
+  cmds.gotoLine = function(cm) {
+    var prefix = getPrefix(cm, true);
+    if (prefix != null && prefix > 0) return cm.setCursor(prefix - 1);
+
+    getInput(cm, "Goto line", function(str) {
+      var num;
+      if (str && !isNaN(num = Number(str)) && num == (num|0) && num > 0)
+      cm.setCursor(num - 1);
+    });
+  };
+
+  cmds.indentRigidly = function(cm) {
+    cm.indentSelection(getPrefix(cm, true) || cm.getOption("indentUnit"));
+  };
+
+  cmds.exchangePointAndMark = function(cm) {
+    cm.setSelection(cm.getCursor("head"), cm.getCursor("anchor"));
+  };
+
+  cmds.quotedInsertTab = repeated("insertTab");
+
+  cmds.universalArgument = function addPrefixMap(cm) {
+    cm.state.emacsPrefixMap = true;
+    cm.addKeyMap(prefixMap);
+    cm.on("keyHandled", maybeRemovePrefixMap);
+    cm.on("inputRead", maybeRemovePrefixMap);
+  };
+
+  CodeMirror.emacs = {kill: _kill, killRegion: _killRegion, repeated: repeated};
+
+  // Actual keymap
+  var keyMap = CodeMirror.keyMap.emacs = CodeMirror.normalizeKeyMap({
+    "Ctrl-W": "killRegion",
+    "Ctrl-K": "killLineEmacs",
+    "Alt-W": "killRingSave",
+    "Ctrl-Y": "yank",
+    "Alt-Y": "yankPop",
+    "Ctrl-Space": "setMark",
+    "Ctrl-Shift-2": "setMark",
+    "Ctrl-F": "forwardChar",
+    "Ctrl-B": "backwardChar",
+    "Right": "forwardChar",
+    "Left": "backwardChar",
+    "Ctrl-D": "deleteChar",
+    "Delete": "deleteForwardChar",
+    "Ctrl-H": "deleteBackwardChar",
+    "Backspace": "deleteBackwardChar",
+    "Alt-F": "forwardWord",
+    "Alt-B": "backwardWord",
+    "Alt-Right": "forwardWord",
+    "Alt-Left": "backwardWord",
+    "Alt-D": "killWord",
+    "Alt-Backspace": "backwardKillWord",
+    "Ctrl-N": "nextLine",
+    "Ctrl-P": "previousLine",
+    "Down": "nextLine",
+    "Up": "previousLine",
+    "Ctrl-A": "goLineStart",
+    "Ctrl-E": "goLineEnd",
+    "End": "goLineEnd",
+    "Home": "goLineStart",
+    "Alt-V": "scrollDownCommand",
+    "Ctrl-V": "scrollUpCommand",
+    "PageUp": "scrollDownCommand",
+    "PageDown": "scrollUpCommand",
+    "Ctrl-Up": "backwardParagraph",
+    "Ctrl-Down": "forwardParagraph",
+    "Alt-{": "backwardParagraph",
+    "Alt-}": "forwardParagraph",
+    "Alt-A": "backwardSentence",
+    "Alt-E": "forwardSentence",
+    "Alt-K": "killSentence",
+    "Ctrl-X Delete": "backwardKillSentence",
+    "Ctrl-Alt-K": "killSexp",
+    "Ctrl-Alt-Backspace": "backwardKillSexp",
+    "Ctrl-Alt-F": "forwardSexp",
+    "Ctrl-Alt-B": "backwardSexp",
+    "Shift-Ctrl-Alt-2": "markSexp",
+    "Ctrl-Alt-T": "transposeSexps",
+    "Ctrl-Alt-U": "backwardUpList",
+    "Alt-Space": "justOneSpace",
+    "Ctrl-O": "openLine",
+    "Ctrl-T": "transposeCharsRepeatable",
+    "Alt-C": "capitalizeWord",
+    "Alt-U": "upcaseWord",
+    "Alt-L": "downcaseWord",
+    "Alt-;": "toggleComment",
+    "Ctrl-/": "undoRepeatable",
+    "Shift-Ctrl--": "undoRepeatable",
+    "Ctrl-Z": "undoRepeatable",
+    "Cmd-Z": "undoRepeatable",
+    "Ctrl-X U": "undoRepeatable",
+    "Shift-Ctrl-Z": "redo",
+    "Shift-Alt-,": "goDocStart",
+    "Shift-Alt-.": "goDocEnd",
+    "Ctrl-S": "findPersistentNext",
+    "Ctrl-R": "findPersistentPrev",
+    "Ctrl-G": "keyboardQuit",
+    "Shift-Alt-5": "replace",
+    "Alt-/": "autocomplete",
+    "Enter": "newlineAndIndent",
+    "Ctrl-J": "newline",
+    "Tab": "indentAuto",
+    "Alt-G G": "gotoLine",
+    "Ctrl-X Tab": "indentRigidly",
+    "Ctrl-X Ctrl-X": "exchangePointAndMark",
+    "Ctrl-X Ctrl-S": "save",
+    "Ctrl-X Ctrl-W": "save",
+    "Ctrl-X S": "saveAll",
+    "Ctrl-X F": "open",
+    "Ctrl-X K": "close",
+    "Ctrl-X H": "selectAll",
+    "Ctrl-Q Tab": "quotedInsertTab",
+    "Ctrl-U": "universalArgument",
+    "fallthrough": "default"
+  });
+
+  var prefixMap = {"Ctrl-G": clearPrefix};
+  function regPrefix(d) {
+    prefixMap[d] = function(cm) { addPrefix(cm, d); };
+    keyMap["Ctrl-" + d] = function(cm) { addPrefix(cm, d); };
+    prefixPreservingKeys["Ctrl-" + d] = true;
+  }
+  for (var i = 0; i < 10; ++i) regPrefix(String(i));
+  regPrefix("-");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/keymap/sublime.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,720 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// A rough approximation of Sublime Text's keybindings
+// Depends on addon/search/searchcursor.js and optionally addon/dialog/dialogs.js
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/edit/matchbrackets"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/edit/matchbrackets"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var cmds = CodeMirror.commands;
+  var Pos = CodeMirror.Pos;
+
+  // This is not exactly Sublime's algorithm. I couldn't make heads or tails of that.
+  function findPosSubword(doc, start, dir) {
+    if (dir < 0 && start.ch == 0) return doc.clipPos(Pos(start.line - 1));
+    var line = doc.getLine(start.line);
+    if (dir > 0 && start.ch >= line.length) return doc.clipPos(Pos(start.line + 1, 0));
+    var state = "start", type, startPos = start.ch;
+    for (var pos = startPos, e = dir < 0 ? 0 : line.length, i = 0; pos != e; pos += dir, i++) {
+      var next = line.charAt(dir < 0 ? pos - 1 : pos);
+      var cat = next != "_" && CodeMirror.isWordChar(next) ? "w" : "o";
+      if (cat == "w" && next.toUpperCase() == next) cat = "W";
+      if (state == "start") {
+        if (cat != "o") { state = "in"; type = cat; }
+        else startPos = pos + dir
+      } else if (state == "in") {
+        if (type != cat) {
+          if (type == "w" && cat == "W" && dir < 0) pos--;
+          if (type == "W" && cat == "w" && dir > 0) { // From uppercase to lowercase
+            if (pos == startPos + 1) { type = "w"; continue; }
+            else pos--;
+          }
+          break;
+        }
+      }
+    }
+    return Pos(start.line, pos);
+  }
+
+  function moveSubword(cm, dir) {
+    cm.extendSelectionsBy(function(range) {
+      if (cm.display.shift || cm.doc.extend || range.empty())
+        return findPosSubword(cm.doc, range.head, dir);
+      else
+        return dir < 0 ? range.from() : range.to();
+    });
+  }
+
+  cmds.goSubwordLeft = function(cm) { moveSubword(cm, -1); };
+  cmds.goSubwordRight = function(cm) { moveSubword(cm, 1); };
+
+  cmds.scrollLineUp = function(cm) {
+    var info = cm.getScrollInfo();
+    if (!cm.somethingSelected()) {
+      var visibleBottomLine = cm.lineAtHeight(info.top + info.clientHeight, "local");
+      if (cm.getCursor().line >= visibleBottomLine)
+        cm.execCommand("goLineUp");
+    }
+    cm.scrollTo(null, info.top - cm.defaultTextHeight());
+  };
+  cmds.scrollLineDown = function(cm) {
+    var info = cm.getScrollInfo();
+    if (!cm.somethingSelected()) {
+      var visibleTopLine = cm.lineAtHeight(info.top, "local")+1;
+      if (cm.getCursor().line <= visibleTopLine)
+        cm.execCommand("goLineDown");
+    }
+    cm.scrollTo(null, info.top + cm.defaultTextHeight());
+  };
+
+  cmds.splitSelectionByLine = function(cm) {
+    var ranges = cm.listSelections(), lineRanges = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var from = ranges[i].from(), to = ranges[i].to();
+      for (var line = from.line; line <= to.line; ++line)
+        if (!(to.line > from.line && line == to.line && to.ch == 0))
+          lineRanges.push({anchor: line == from.line ? from : Pos(line, 0),
+                           head: line == to.line ? to : Pos(line)});
+    }
+    cm.setSelections(lineRanges, 0);
+  };
+
+  cmds.singleSelectionTop = function(cm) {
+    var range = cm.listSelections()[0];
+    cm.setSelection(range.anchor, range.head, {scroll: false});
+  };
+
+  cmds.selectLine = function(cm) {
+    var ranges = cm.listSelections(), extended = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i];
+      extended.push({anchor: Pos(range.from().line, 0),
+                     head: Pos(range.to().line + 1, 0)});
+    }
+    cm.setSelections(extended);
+  };
+
+  function insertLine(cm, above) {
+    if (cm.isReadOnly()) return CodeMirror.Pass
+    cm.operation(function() {
+      var len = cm.listSelections().length, newSelection = [], last = -1;
+      for (var i = 0; i < len; i++) {
+        var head = cm.listSelections()[i].head;
+        if (head.line <= last) continue;
+        var at = Pos(head.line + (above ? 0 : 1), 0);
+        cm.replaceRange("\n", at, null, "+insertLine");
+        cm.indentLine(at.line, null, true);
+        newSelection.push({head: at, anchor: at});
+        last = head.line + 1;
+      }
+      cm.setSelections(newSelection);
+    });
+    cm.execCommand("indentAuto");
+  }
+
+  cmds.insertLineAfter = function(cm) { return insertLine(cm, false); };
+
+  cmds.insertLineBefore = function(cm) { return insertLine(cm, true); };
+
+  function wordAt(cm, pos) {
+    var start = pos.ch, end = start, line = cm.getLine(pos.line);
+    while (start && CodeMirror.isWordChar(line.charAt(start - 1))) --start;
+    while (end < line.length && CodeMirror.isWordChar(line.charAt(end))) ++end;
+    return {from: Pos(pos.line, start), to: Pos(pos.line, end), word: line.slice(start, end)};
+  }
+
+  cmds.selectNextOccurrence = function(cm) {
+    var from = cm.getCursor("from"), to = cm.getCursor("to");
+    var fullWord = cm.state.sublimeFindFullWord == cm.doc.sel;
+    if (CodeMirror.cmpPos(from, to) == 0) {
+      var word = wordAt(cm, from);
+      if (!word.word) return;
+      cm.setSelection(word.from, word.to);
+      fullWord = true;
+    } else {
+      var text = cm.getRange(from, to);
+      var query = fullWord ? new RegExp("\\b" + text + "\\b") : text;
+      var cur = cm.getSearchCursor(query, to);
+      var found = cur.findNext();
+      if (!found) {
+        cur = cm.getSearchCursor(query, Pos(cm.firstLine(), 0));
+        found = cur.findNext();
+      }
+      if (!found || isSelectedRange(cm.listSelections(), cur.from(), cur.to())) return
+      cm.addSelection(cur.from(), cur.to());
+    }
+    if (fullWord)
+      cm.state.sublimeFindFullWord = cm.doc.sel;
+  };
+
+  cmds.skipAndSelectNextOccurrence = function(cm) {
+    var prevAnchor = cm.getCursor("anchor"), prevHead = cm.getCursor("head");
+    cmds.selectNextOccurrence(cm);
+    if (CodeMirror.cmpPos(prevAnchor, prevHead) != 0) {
+      cm.doc.setSelections(cm.doc.listSelections()
+          .filter(function (sel) {
+            return sel.anchor != prevAnchor || sel.head != prevHead;
+          }));
+    }
+  }
+
+  function addCursorToSelection(cm, dir) {
+    var ranges = cm.listSelections(), newRanges = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i];
+      var newAnchor = cm.findPosV(
+          range.anchor, dir, "line", range.anchor.goalColumn);
+      var newHead = cm.findPosV(
+          range.head, dir, "line", range.head.goalColumn);
+      newAnchor.goalColumn = range.anchor.goalColumn != null ?
+          range.anchor.goalColumn : cm.cursorCoords(range.anchor, "div").left;
+      newHead.goalColumn = range.head.goalColumn != null ?
+          range.head.goalColumn : cm.cursorCoords(range.head, "div").left;
+      var newRange = {anchor: newAnchor, head: newHead};
+      newRanges.push(range);
+      newRanges.push(newRange);
+    }
+    cm.setSelections(newRanges);
+  }
+  cmds.addCursorToPrevLine = function(cm) { addCursorToSelection(cm, -1); };
+  cmds.addCursorToNextLine = function(cm) { addCursorToSelection(cm, 1); };
+
+  function isSelectedRange(ranges, from, to) {
+    for (var i = 0; i < ranges.length; i++)
+      if (CodeMirror.cmpPos(ranges[i].from(), from) == 0 &&
+          CodeMirror.cmpPos(ranges[i].to(), to) == 0) return true
+    return false
+  }
+
+  var mirror = "(){}[]";
+  function selectBetweenBrackets(cm) {
+    var ranges = cm.listSelections(), newRanges = []
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i], pos = range.head, opening = cm.scanForBracket(pos, -1);
+      if (!opening) return false;
+      for (;;) {
+        var closing = cm.scanForBracket(pos, 1);
+        if (!closing) return false;
+        if (closing.ch == mirror.charAt(mirror.indexOf(opening.ch) + 1)) {
+          var startPos = Pos(opening.pos.line, opening.pos.ch + 1);
+          if (CodeMirror.cmpPos(startPos, range.from()) == 0 &&
+              CodeMirror.cmpPos(closing.pos, range.to()) == 0) {
+            opening = cm.scanForBracket(opening.pos, -1);
+            if (!opening) return false;
+          } else {
+            newRanges.push({anchor: startPos, head: closing.pos});
+            break;
+          }
+        }
+        pos = Pos(closing.pos.line, closing.pos.ch + 1);
+      }
+    }
+    cm.setSelections(newRanges);
+    return true;
+  }
+
+  cmds.selectScope = function(cm) {
+    selectBetweenBrackets(cm) || cm.execCommand("selectAll");
+  };
+  cmds.selectBetweenBrackets = function(cm) {
+    if (!selectBetweenBrackets(cm)) return CodeMirror.Pass;
+  };
+
+  function puncType(type) {
+    return !type ? null : /\bpunctuation\b/.test(type) ? type : undefined
+  }
+
+  cmds.goToBracket = function(cm) {
+    cm.extendSelectionsBy(function(range) {
+      var next = cm.scanForBracket(range.head, 1, puncType(cm.getTokenTypeAt(range.head)));
+      if (next && CodeMirror.cmpPos(next.pos, range.head) != 0) return next.pos;
+      var prev = cm.scanForBracket(range.head, -1, puncType(cm.getTokenTypeAt(Pos(range.head.line, range.head.ch + 1))));
+      return prev && Pos(prev.pos.line, prev.pos.ch + 1) || range.head;
+    });
+  };
+
+  cmds.swapLineUp = function(cm) {
+    if (cm.isReadOnly()) return CodeMirror.Pass
+    var ranges = cm.listSelections(), linesToMove = [], at = cm.firstLine() - 1, newSels = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i], from = range.from().line - 1, to = range.to().line;
+      newSels.push({anchor: Pos(range.anchor.line - 1, range.anchor.ch),
+                    head: Pos(range.head.line - 1, range.head.ch)});
+      if (range.to().ch == 0 && !range.empty()) --to;
+      if (from > at) linesToMove.push(from, to);
+      else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;
+      at = to;
+    }
+    cm.operation(function() {
+      for (var i = 0; i < linesToMove.length; i += 2) {
+        var from = linesToMove[i], to = linesToMove[i + 1];
+        var line = cm.getLine(from);
+        cm.replaceRange("", Pos(from, 0), Pos(from + 1, 0), "+swapLine");
+        if (to > cm.lastLine())
+          cm.replaceRange("\n" + line, Pos(cm.lastLine()), null, "+swapLine");
+        else
+          cm.replaceRange(line + "\n", Pos(to, 0), null, "+swapLine");
+      }
+      cm.setSelections(newSels);
+      cm.scrollIntoView();
+    });
+  };
+
+  cmds.swapLineDown = function(cm) {
+    if (cm.isReadOnly()) return CodeMirror.Pass
+    var ranges = cm.listSelections(), linesToMove = [], at = cm.lastLine() + 1;
+    for (var i = ranges.length - 1; i >= 0; i--) {
+      var range = ranges[i], from = range.to().line + 1, to = range.from().line;
+      if (range.to().ch == 0 && !range.empty()) from--;
+      if (from < at) linesToMove.push(from, to);
+      else if (linesToMove.length) linesToMove[linesToMove.length - 1] = to;
+      at = to;
+    }
+    cm.operation(function() {
+      for (var i = linesToMove.length - 2; i >= 0; i -= 2) {
+        var from = linesToMove[i], to = linesToMove[i + 1];
+        var line = cm.getLine(from);
+        if (from == cm.lastLine())
+          cm.replaceRange("", Pos(from - 1), Pos(from), "+swapLine");
+        else
+          cm.replaceRange("", Pos(from, 0), Pos(from + 1, 0), "+swapLine");
+        cm.replaceRange(line + "\n", Pos(to, 0), null, "+swapLine");
+      }
+      cm.scrollIntoView();
+    });
+  };
+
+  cmds.toggleCommentIndented = function(cm) {
+    cm.toggleComment({ indent: true });
+  }
+
+  cmds.joinLines = function(cm) {
+    var ranges = cm.listSelections(), joined = [];
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i], from = range.from();
+      var start = from.line, end = range.to().line;
+      while (i < ranges.length - 1 && ranges[i + 1].from().line == end)
+        end = ranges[++i].to().line;
+      joined.push({start: start, end: end, anchor: !range.empty() && from});
+    }
+    cm.operation(function() {
+      var offset = 0, ranges = [];
+      for (var i = 0; i < joined.length; i++) {
+        var obj = joined[i];
+        var anchor = obj.anchor && Pos(obj.anchor.line - offset, obj.anchor.ch), head;
+        for (var line = obj.start; line <= obj.end; line++) {
+          var actual = line - offset;
+          if (line == obj.end) head = Pos(actual, cm.getLine(actual).length + 1);
+          if (actual < cm.lastLine()) {
+            cm.replaceRange(" ", Pos(actual), Pos(actual + 1, /^\s*/.exec(cm.getLine(actual + 1))[0].length));
+            ++offset;
+          }
+        }
+        ranges.push({anchor: anchor || head, head: head});
+      }
+      cm.setSelections(ranges, 0);
+    });
+  };
+
+  cmds.duplicateLine = function(cm) {
+    cm.operation(function() {
+      var rangeCount = cm.listSelections().length;
+      for (var i = 0; i < rangeCount; i++) {
+        var range = cm.listSelections()[i];
+        if (range.empty())
+          cm.replaceRange(cm.getLine(range.head.line) + "\n", Pos(range.head.line, 0));
+        else
+          cm.replaceRange(cm.getRange(range.from(), range.to()), range.from());
+      }
+      cm.scrollIntoView();
+    });
+  };
+
+
+  function sortLines(cm, caseSensitive, direction) {
+    if (cm.isReadOnly()) return CodeMirror.Pass
+    var ranges = cm.listSelections(), toSort = [], selected;
+    for (var i = 0; i < ranges.length; i++) {
+      var range = ranges[i];
+      if (range.empty()) continue;
+      var from = range.from().line, to = range.to().line;
+      while (i < ranges.length - 1 && ranges[i + 1].from().line == to)
+        to = ranges[++i].to().line;
+      if (!ranges[i].to().ch) to--;
+      toSort.push(from, to);
+    }
+    if (toSort.length) selected = true;
+    else toSort.push(cm.firstLine(), cm.lastLine());
+
+    cm.operation(function() {
+      var ranges = [];
+      for (var i = 0; i < toSort.length; i += 2) {
+        var from = toSort[i], to = toSort[i + 1];
+        var start = Pos(from, 0), end = Pos(to);
+        var lines = cm.getRange(start, end, false);
+        if (caseSensitive)
+          lines.sort(function(a, b) { return a < b ? -direction : a == b ? 0 : direction; });
+        else
+          lines.sort(function(a, b) {
+            var au = a.toUpperCase(), bu = b.toUpperCase();
+            if (au != bu) { a = au; b = bu; }
+            return a < b ? -direction : a == b ? 0 : direction;
+          });
+        cm.replaceRange(lines, start, end);
+        if (selected) ranges.push({anchor: start, head: Pos(to + 1, 0)});
+      }
+      if (selected) cm.setSelections(ranges, 0);
+    });
+  }
+
+  cmds.sortLines = function(cm) { sortLines(cm, true, 1); };
+  cmds.reverseSortLines = function(cm) { sortLines(cm, true, -1); };
+  cmds.sortLinesInsensitive = function(cm) { sortLines(cm, false, 1); };
+  cmds.reverseSortLinesInsensitive = function(cm) { sortLines(cm, false, -1); };
+
+  cmds.nextBookmark = function(cm) {
+    var marks = cm.state.sublimeBookmarks;
+    if (marks) while (marks.length) {
+      var current = marks.shift();
+      var found = current.find();
+      if (found) {
+        marks.push(current);
+        return cm.setSelection(found.from, found.to);
+      }
+    }
+  };
+
+  cmds.prevBookmark = function(cm) {
+    var marks = cm.state.sublimeBookmarks;
+    if (marks) while (marks.length) {
+      marks.unshift(marks.pop());
+      var found = marks[marks.length - 1].find();
+      if (!found)
+        marks.pop();
+      else
+        return cm.setSelection(found.from, found.to);
+    }
+  };
+
+  cmds.toggleBookmark = function(cm) {
+    var ranges = cm.listSelections();
+    var marks = cm.state.sublimeBookmarks || (cm.state.sublimeBookmarks = []);
+    for (var i = 0; i < ranges.length; i++) {
+      var from = ranges[i].from(), to = ranges[i].to();
+      var found = ranges[i].empty() ? cm.findMarksAt(from) : cm.findMarks(from, to);
+      for (var j = 0; j < found.length; j++) {
+        if (found[j].sublimeBookmark) {
+          found[j].clear();
+          for (var k = 0; k < marks.length; k++)
+            if (marks[k] == found[j])
+              marks.splice(k--, 1);
+          break;
+        }
+      }
+      if (j == found.length)
+        marks.push(cm.markText(from, to, {sublimeBookmark: true, clearWhenEmpty: false}));
+    }
+  };
+
+  cmds.clearBookmarks = function(cm) {
+    var marks = cm.state.sublimeBookmarks;
+    if (marks) for (var i = 0; i < marks.length; i++) marks[i].clear();
+    marks.length = 0;
+  };
+
+  cmds.selectBookmarks = function(cm) {
+    var marks = cm.state.sublimeBookmarks, ranges = [];
+    if (marks) for (var i = 0; i < marks.length; i++) {
+      var found = marks[i].find();
+      if (!found)
+        marks.splice(i--, 0);
+      else
+        ranges.push({anchor: found.from, head: found.to});
+    }
+    if (ranges.length)
+      cm.setSelections(ranges, 0);
+  };
+
+  function modifyWordOrSelection(cm, mod) {
+    cm.operation(function() {
+      var ranges = cm.listSelections(), indices = [], replacements = [];
+      for (var i = 0; i < ranges.length; i++) {
+        var range = ranges[i];
+        if (range.empty()) { indices.push(i); replacements.push(""); }
+        else replacements.push(mod(cm.getRange(range.from(), range.to())));
+      }
+      cm.replaceSelections(replacements, "around", "case");
+      for (var i = indices.length - 1, at; i >= 0; i--) {
+        var range = ranges[indices[i]];
+        if (at && CodeMirror.cmpPos(range.head, at) > 0) continue;
+        var word = wordAt(cm, range.head);
+        at = word.from;
+        cm.replaceRange(mod(word.word), word.from, word.to);
+      }
+    });
+  }
+
+  cmds.smartBackspace = function(cm) {
+    if (cm.somethingSelected()) return CodeMirror.Pass;
+
+    cm.operation(function() {
+      var cursors = cm.listSelections();
+      var indentUnit = cm.getOption("indentUnit");
+
+      for (var i = cursors.length - 1; i >= 0; i--) {
+        var cursor = cursors[i].head;
+        var toStartOfLine = cm.getRange({line: cursor.line, ch: 0}, cursor);
+        var column = CodeMirror.countColumn(toStartOfLine, null, cm.getOption("tabSize"));
+
+        // Delete by one character by default
+        var deletePos = cm.findPosH(cursor, -1, "char", false);
+
+        if (toStartOfLine && !/\S/.test(toStartOfLine) && column % indentUnit == 0) {
+          var prevIndent = new Pos(cursor.line,
+            CodeMirror.findColumn(toStartOfLine, column - indentUnit, indentUnit));
+
+          // Smart delete only if we found a valid prevIndent location
+          if (prevIndent.ch != cursor.ch) deletePos = prevIndent;
+        }
+
+        cm.replaceRange("", deletePos, cursor, "+delete");
+      }
+    });
+  };
+
+  cmds.delLineRight = function(cm) {
+    cm.operation(function() {
+      var ranges = cm.listSelections();
+      for (var i = ranges.length - 1; i >= 0; i--)
+        cm.replaceRange("", ranges[i].anchor, Pos(ranges[i].to().line), "+delete");
+      cm.scrollIntoView();
+    });
+  };
+
+  cmds.upcaseAtCursor = function(cm) {
+    modifyWordOrSelection(cm, function(str) { return str.toUpperCase(); });
+  };
+  cmds.downcaseAtCursor = function(cm) {
+    modifyWordOrSelection(cm, function(str) { return str.toLowerCase(); });
+  };
+
+  cmds.setSublimeMark = function(cm) {
+    if (cm.state.sublimeMark) cm.state.sublimeMark.clear();
+    cm.state.sublimeMark = cm.setBookmark(cm.getCursor());
+  };
+  cmds.selectToSublimeMark = function(cm) {
+    var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
+    if (found) cm.setSelection(cm.getCursor(), found);
+  };
+  cmds.deleteToSublimeMark = function(cm) {
+    var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
+    if (found) {
+      var from = cm.getCursor(), to = found;
+      if (CodeMirror.cmpPos(from, to) > 0) { var tmp = to; to = from; from = tmp; }
+      cm.state.sublimeKilled = cm.getRange(from, to);
+      cm.replaceRange("", from, to);
+    }
+  };
+  cmds.swapWithSublimeMark = function(cm) {
+    var found = cm.state.sublimeMark && cm.state.sublimeMark.find();
+    if (found) {
+      cm.state.sublimeMark.clear();
+      cm.state.sublimeMark = cm.setBookmark(cm.getCursor());
+      cm.setCursor(found);
+    }
+  };
+  cmds.sublimeYank = function(cm) {
+    if (cm.state.sublimeKilled != null)
+      cm.replaceSelection(cm.state.sublimeKilled, null, "paste");
+  };
+
+  cmds.showInCenter = function(cm) {
+    var pos = cm.cursorCoords(null, "local");
+    cm.scrollTo(null, (pos.top + pos.bottom) / 2 - cm.getScrollInfo().clientHeight / 2);
+  };
+
+  function getTarget(cm) {
+    var from = cm.getCursor("from"), to = cm.getCursor("to");
+    if (CodeMirror.cmpPos(from, to) == 0) {
+      var word = wordAt(cm, from);
+      if (!word.word) return;
+      from = word.from;
+      to = word.to;
+    }
+    return {from: from, to: to, query: cm.getRange(from, to), word: word};
+  }
+
+  function findAndGoTo(cm, forward) {
+    var target = getTarget(cm);
+    if (!target) return;
+    var query = target.query;
+    var cur = cm.getSearchCursor(query, forward ? target.to : target.from);
+
+    if (forward ? cur.findNext() : cur.findPrevious()) {
+      cm.setSelection(cur.from(), cur.to());
+    } else {
+      cur = cm.getSearchCursor(query, forward ? Pos(cm.firstLine(), 0)
+                                              : cm.clipPos(Pos(cm.lastLine())));
+      if (forward ? cur.findNext() : cur.findPrevious())
+        cm.setSelection(cur.from(), cur.to());
+      else if (target.word)
+        cm.setSelection(target.from, target.to);
+    }
+  };
+  cmds.findUnder = function(cm) { findAndGoTo(cm, true); };
+  cmds.findUnderPrevious = function(cm) { findAndGoTo(cm,false); };
+  cmds.findAllUnder = function(cm) {
+    var target = getTarget(cm);
+    if (!target) return;
+    var cur = cm.getSearchCursor(target.query);
+    var matches = [];
+    var primaryIndex = -1;
+    while (cur.findNext()) {
+      matches.push({anchor: cur.from(), head: cur.to()});
+      if (cur.from().line <= target.from.line && cur.from().ch <= target.from.ch)
+        primaryIndex++;
+    }
+    cm.setSelections(matches, primaryIndex);
+  };
+
+
+  var keyMap = CodeMirror.keyMap;
+  keyMap.macSublime = {
+    "Cmd-Left": "goLineStartSmart",
+    "Shift-Tab": "indentLess",
+    "Shift-Ctrl-K": "deleteLine",
+    "Alt-Q": "wrapLines",
+    "Ctrl-Left": "goSubwordLeft",
+    "Ctrl-Right": "goSubwordRight",
+    "Ctrl-Alt-Up": "scrollLineUp",
+    "Ctrl-Alt-Down": "scrollLineDown",
+    "Cmd-L": "selectLine",
+    "Shift-Cmd-L": "splitSelectionByLine",
+    "Esc": "singleSelectionTop",
+    "Cmd-Enter": "insertLineAfter",
+    "Shift-Cmd-Enter": "insertLineBefore",
+    "Cmd-D": "selectNextOccurrence",
+    "Shift-Cmd-Space": "selectScope",
+    "Shift-Cmd-M": "selectBetweenBrackets",
+    "Cmd-M": "goToBracket",
+    "Cmd-Ctrl-Up": "swapLineUp",
+    "Cmd-Ctrl-Down": "swapLineDown",
+    "Cmd-/": "toggleCommentIndented",
+    "Cmd-J": "joinLines",
+    "Shift-Cmd-D": "duplicateLine",
+    "F5": "sortLines",
+    "Shift-F5": "reverseSortLines",
+    "Cmd-F5": "sortLinesInsensitive",
+    "Shift-Cmd-F5": "reverseSortLinesInsensitive",
+    "F2": "nextBookmark",
+    "Shift-F2": "prevBookmark",
+    "Cmd-F2": "toggleBookmark",
+    "Shift-Cmd-F2": "clearBookmarks",
+    "Alt-F2": "selectBookmarks",
+    "Backspace": "smartBackspace",
+    "Cmd-K Cmd-D": "skipAndSelectNextOccurrence",
+    "Cmd-K Cmd-K": "delLineRight",
+    "Cmd-K Cmd-U": "upcaseAtCursor",
+    "Cmd-K Cmd-L": "downcaseAtCursor",
+    "Cmd-K Cmd-Space": "setSublimeMark",
+    "Cmd-K Cmd-A": "selectToSublimeMark",
+    "Cmd-K Cmd-W": "deleteToSublimeMark",
+    "Cmd-K Cmd-X": "swapWithSublimeMark",
+    "Cmd-K Cmd-Y": "sublimeYank",
+    "Cmd-K Cmd-C": "showInCenter",
+    "Cmd-K Cmd-G": "clearBookmarks",
+    "Cmd-K Cmd-Backspace": "delLineLeft",
+    "Cmd-K Cmd-1": "foldAll",
+    "Cmd-K Cmd-0": "unfoldAll",
+    "Cmd-K Cmd-J": "unfoldAll",
+    "Ctrl-Shift-Up": "addCursorToPrevLine",
+    "Ctrl-Shift-Down": "addCursorToNextLine",
+    "Cmd-F3": "findUnder",
+    "Shift-Cmd-F3": "findUnderPrevious",
+    "Alt-F3": "findAllUnder",
+    "Shift-Cmd-[": "fold",
+    "Shift-Cmd-]": "unfold",
+    "Cmd-I": "findIncremental",
+    "Shift-Cmd-I": "findIncrementalReverse",
+    "Cmd-H": "replace",
+    "F3": "findNext",
+    "Shift-F3": "findPrev",
+    "fallthrough": "macDefault"
+  };
+  CodeMirror.normalizeKeyMap(keyMap.macSublime);
+
+  keyMap.pcSublime = {
+    "Shift-Tab": "indentLess",
+    "Shift-Ctrl-K": "deleteLine",
+    "Alt-Q": "wrapLines",
+    "Ctrl-T": "transposeChars",
+    "Alt-Left": "goSubwordLeft",
+    "Alt-Right": "goSubwordRight",
+    "Ctrl-Up": "scrollLineUp",
+    "Ctrl-Down": "scrollLineDown",
+    "Ctrl-L": "selectLine",
+    "Shift-Ctrl-L": "splitSelectionByLine",
+    "Esc": "singleSelectionTop",
+    "Ctrl-Enter": "insertLineAfter",
+    "Shift-Ctrl-Enter": "insertLineBefore",
+    "Ctrl-D": "selectNextOccurrence",
+    "Shift-Ctrl-Space": "selectScope",
+    "Shift-Ctrl-M": "selectBetweenBrackets",
+    "Ctrl-M": "goToBracket",
+    "Shift-Ctrl-Up": "swapLineUp",
+    "Shift-Ctrl-Down": "swapLineDown",
+    "Ctrl-/": "toggleCommentIndented",
+    "Ctrl-J": "joinLines",
+    "Shift-Ctrl-D": "duplicateLine",
+    "F9": "sortLines",
+    "Shift-F9": "reverseSortLines",
+    "Ctrl-F9": "sortLinesInsensitive",
+    "Shift-Ctrl-F9": "reverseSortLinesInsensitive",
+    "F2": "nextBookmark",
+    "Shift-F2": "prevBookmark",
+    "Ctrl-F2": "toggleBookmark",
+    "Shift-Ctrl-F2": "clearBookmarks",
+    "Alt-F2": "selectBookmarks",
+    "Backspace": "smartBackspace",
+    "Ctrl-K Ctrl-D": "skipAndSelectNextOccurrence",
+    "Ctrl-K Ctrl-K": "delLineRight",
+    "Ctrl-K Ctrl-U": "upcaseAtCursor",
+    "Ctrl-K Ctrl-L": "downcaseAtCursor",
+    "Ctrl-K Ctrl-Space": "setSublimeMark",
+    "Ctrl-K Ctrl-A": "selectToSublimeMark",
+    "Ctrl-K Ctrl-W": "deleteToSublimeMark",
+    "Ctrl-K Ctrl-X": "swapWithSublimeMark",
+    "Ctrl-K Ctrl-Y": "sublimeYank",
+    "Ctrl-K Ctrl-C": "showInCenter",
+    "Ctrl-K Ctrl-G": "clearBookmarks",
+    "Ctrl-K Ctrl-Backspace": "delLineLeft",
+    "Ctrl-K Ctrl-1": "foldAll",
+    "Ctrl-K Ctrl-0": "unfoldAll",
+    "Ctrl-K Ctrl-J": "unfoldAll",
+    "Ctrl-Alt-Up": "addCursorToPrevLine",
+    "Ctrl-Alt-Down": "addCursorToNextLine",
+    "Ctrl-F3": "findUnder",
+    "Shift-Ctrl-F3": "findUnderPrevious",
+    "Alt-F3": "findAllUnder",
+    "Shift-Ctrl-[": "fold",
+    "Shift-Ctrl-]": "unfold",
+    "Ctrl-I": "findIncremental",
+    "Shift-Ctrl-I": "findIncrementalReverse",
+    "Ctrl-H": "replace",
+    "F3": "findNext",
+    "Shift-F3": "findPrev",
+    "fallthrough": "pcDefault"
+  };
+  CodeMirror.normalizeKeyMap(keyMap.pcSublime);
+
+  var mac = keyMap.default == keyMap.macDefault;
+  keyMap.sublime = mac ? keyMap.macSublime : keyMap.pcSublime;
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/keymap/vim.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,5978 @@
+(function(mod) {
+    if (typeof exports == "object" && typeof module == "object") // CommonJS
+      mod(require("../lib/codemirror"), require("../addon/search/searchcursor"), require("../addon/dialog/dialog"), require("../addon/edit/matchbrackets.js"));
+    else if (typeof define == "function" && define.amd) // AMD
+      define(["../lib/codemirror", "../addon/search/searchcursor", "../addon/dialog/dialog", "../addon/edit/matchbrackets"], mod);
+    else // Plain browser env
+      mod(CodeMirror);
+  })(function(CodeMirror) {
+    'use strict';
+  // CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Supported keybindings:
+ *   Too many to list. Refer to defaultKeymap below.
+ *
+ * Supported Ex commands:
+ *   Refer to defaultExCommandMap below.
+ *
+ * Registers: unnamed, -, ., :, /, _, a-z, A-Z, 0-9
+ *   (Does not respect the special case for number registers when delete
+ *    operator is made with these commands: %, (, ),  , /, ?, n, N, {, } )
+ *   TODO: Implement the remaining registers.
+ *
+ * Marks: a-z, A-Z, and 0-9
+ *   TODO: Implement the remaining special marks. They have more complex
+ *       behavior.
+ *
+ * Events:
+ *  'vim-mode-change' - raised on the editor anytime the current mode changes,
+ *                      Event object: {mode: "visual", subMode: "linewise"}
+ *
+ * Code structure:
+ *  1. Default keymap
+ *  2. Variable declarations and short basic helpers
+ *  3. Instance (External API) implementation
+ *  4. Internal state tracking objects (input state, counter) implementation
+ *     and instantiation
+ *  5. Key handler (the main command dispatcher) implementation
+ *  6. Motion, operator, and action implementations
+ *  7. Helper functions for the key handler, motions, operators, and actions
+ *  8. Set up Vim to work as a keymap for CodeMirror.
+ *  9. Ex command implementations.
+ */
+
+function initVim$1(CodeMirror) {
+
+  var Pos = CodeMirror.Pos;
+
+  function transformCursor(cm, range) {
+    var vim = cm.state.vim;
+    if (!vim || vim.insertMode) return range.head;
+    var head = vim.sel.head;
+    if (!head)  return range.head;
+
+    if (vim.visualBlock) {
+      if (range.head.line != head.line) {
+        return;
+      }
+    }
+    if (range.from() == range.anchor && !range.empty()) {
+      if (range.head.line == head.line && range.head.ch != head.ch)
+        return new Pos(range.head.line, range.head.ch - 1);
+    }
+
+    return range.head;
+  }
+
+  var defaultKeymap = [
+    // Key to key mapping. This goes first to make it possible to override
+    // existing mappings.
+    { keys: '<Left>', type: 'keyToKey', toKeys: 'h' },
+    { keys: '<Right>', type: 'keyToKey', toKeys: 'l' },
+    { keys: '<Up>', type: 'keyToKey', toKeys: 'k' },
+    { keys: '<Down>', type: 'keyToKey', toKeys: 'j' },
+    { keys: 'g<Up>', type: 'keyToKey', toKeys: 'gk' },
+    { keys: 'g<Down>', type: 'keyToKey', toKeys: 'gj' },
+    { keys: '<Space>', type: 'keyToKey', toKeys: 'l' },
+    { keys: '<BS>', type: 'keyToKey', toKeys: 'h', context: 'normal'},
+    { keys: '<Del>', type: 'keyToKey', toKeys: 'x', context: 'normal'},
+    { keys: '<C-Space>', type: 'keyToKey', toKeys: 'W' },
+    { keys: '<C-BS>', type: 'keyToKey', toKeys: 'B', context: 'normal' },
+    { keys: '<S-Space>', type: 'keyToKey', toKeys: 'w' },
+    { keys: '<S-BS>', type: 'keyToKey', toKeys: 'b', context: 'normal' },
+    { keys: '<C-n>', type: 'keyToKey', toKeys: 'j' },
+    { keys: '<C-p>', type: 'keyToKey', toKeys: 'k' },
+    { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>' },
+    { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>' },
+    { keys: '<C-[>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
+    { keys: '<C-c>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
+    { keys: '<C-Esc>', type: 'keyToKey', toKeys: '<Esc>' }, // ipad keyboard sends C-Esc instead of C-[
+    { keys: '<C-Esc>', type: 'keyToKey', toKeys: '<Esc>', context: 'insert' },
+    { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' },
+    { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'},
+    { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' },
+    { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' },
+    { keys: '<Home>', type: 'keyToKey', toKeys: '0' },
+    { keys: '<End>', type: 'keyToKey', toKeys: '$' },
+    { keys: '<PageUp>', type: 'keyToKey', toKeys: '<C-b>' },
+    { keys: '<PageDown>', type: 'keyToKey', toKeys: '<C-f>' },
+    { keys: '<CR>', type: 'keyToKey', toKeys: 'j^', context: 'normal' },
+    { keys: '<Ins>', type: 'keyToKey', toKeys: 'i', context: 'normal'},
+    { keys: '<Ins>', type: 'action', action: 'toggleOverwrite', context: 'insert' },
+    // Motions
+    { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }},
+    { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }},
+    { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }},
+    { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }},
+    { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }},
+    { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }},
+    { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }},
+    { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }},
+    { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }},
+    { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }},
+    { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }},
+    { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }},
+    { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }},
+    { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }},
+    { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }},
+    { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }},
+    { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }},
+    { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }},
+    { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }},
+    { keys: '(', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: false }},
+    { keys: ')', type: 'motion', motion: 'moveBySentence', motionArgs: { forward: true }},
+    { keys: '<C-f>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }},
+    { keys: '<C-b>', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }},
+    { keys: '<C-d>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }},
+    { keys: '<C-u>', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }},
+    { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }},
+    { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }},
+    {keys: "g$", type: "motion", motion: "moveToEndOfDisplayLine"},
+    {keys: "g^", type: "motion", motion: "moveToStartOfDisplayLine"},
+    {keys: "g0", type: "motion", motion: "moveToStartOfDisplayLine"},
+    { keys: '0', type: 'motion', motion: 'moveToStartOfLine' },
+    { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' },
+    { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }},
+    { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }},
+    { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }},
+    { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }},
+    { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }},
+    { keys: 'f<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }},
+    { keys: 'F<character>', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }},
+    { keys: 't<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }},
+    { keys: 'T<character>', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }},
+    { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }},
+    { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }},
+    { keys: '\'<character>', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}},
+    { keys: '`<character>', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}},
+    { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } },
+    { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } },
+    { keys: ']\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } },
+    { keys: '[\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } },
+    // the next two aren't motions but must come before more general motion declarations
+    { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}},
+    { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}},
+    { keys: ']<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}},
+    { keys: '[<character>', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}},
+    { keys: '|', type: 'motion', motion: 'moveToColumn'},
+    { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'},
+    { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'},
+    // Operators
+    { keys: 'd', type: 'operator', operator: 'delete' },
+    { keys: 'y', type: 'operator', operator: 'yank' },
+    { keys: 'c', type: 'operator', operator: 'change' },
+    { keys: '=', type: 'operator', operator: 'indentAuto' },
+    { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }},
+    { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }},
+    { keys: 'g~', type: 'operator', operator: 'changeCase' },
+    { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true },
+    { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true },
+    { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }},
+    { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }},
+    { keys: 'gn', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: true }},
+    { keys: 'gN', type: 'motion', motion: 'findAndSelectNextInclusive', motionArgs: { forward: false }},
+    // Operator-Motion dual commands
+    { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }},
+    { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }},
+    { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
+    { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'},
+    { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'expandToLine', motionArgs: { linewise: true }, context: 'normal'},
+    { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'},
+    { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'},
+    { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'},
+    { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'},
+    { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'},
+    { keys: '<C-u>', type: 'operatorMotion', operator: 'delete', motion: 'moveToStartOfLine', context: 'insert' },
+    { keys: '<C-w>', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' },
+    //ignore C-w in normal mode
+    { keys: '<C-w>', type: 'idle', context: 'normal' },
+    // Actions
+    { keys: '<C-i>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }},
+    { keys: '<C-o>', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }},
+    { keys: '<C-e>', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }},
+    { keys: '<C-y>', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }},
+    { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' },
+    { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' },
+    { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' },
+    { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' },
+    { keys: 'gi', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'lastEdit' }, context: 'normal' },
+    { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' },
+    { keys: 'gI', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'bol'}, context: 'normal' },
+    { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' },
+    { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' },
+    { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' },
+    { keys: 'v', type: 'action', action: 'toggleVisualMode' },
+    { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }},
+    { keys: '<C-v>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
+    { keys: '<C-q>', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }},
+    { keys: 'gv', type: 'action', action: 'reselectLastSelection' },
+    { keys: 'J', type: 'action', action: 'joinLines', isEdit: true },
+    { keys: 'gJ', type: 'action', action: 'joinLines', actionArgs: { keepSpaces: true }, isEdit: true },
+    { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }},
+    { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }},
+    { keys: 'r<character>', type: 'action', action: 'replace', isEdit: true },
+    { keys: '@<character>', type: 'action', action: 'replayMacro' },
+    { keys: 'q<character>', type: 'action', action: 'enterMacroRecordMode' },
+    // Handle Replace-mode as a special case of insert mode.
+    { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }, context: 'normal'},
+    { keys: 'R', type: 'operator', operator: 'change', operatorArgs: { linewise: true, fullLine: true }, context: 'visual', exitVisualBlock: true},
+    { keys: 'u', type: 'action', action: 'undo', context: 'normal' },
+    { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true },
+    { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true },
+    { keys: '<C-r>', type: 'action', action: 'redo' },
+    { keys: 'm<character>', type: 'action', action: 'setMark' },
+    { keys: '"<character>', type: 'action', action: 'setRegister' },
+    { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }},
+    { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
+    { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }},
+    { keys: 'z<CR>', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
+    { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }},
+    { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' },
+    { keys: '.', type: 'action', action: 'repeatLastEdit' },
+    { keys: '<C-a>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}},
+    { keys: '<C-x>', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}},
+    { keys: '<C-t>', type: 'action', action: 'indent', actionArgs: { indentRight: true }, context: 'insert' },
+    { keys: '<C-d>', type: 'action', action: 'indent', actionArgs: { indentRight: false }, context: 'insert' },
+    // Text object motions
+    { keys: 'a<character>', type: 'motion', motion: 'textObjectManipulation' },
+    { keys: 'i<character>', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }},
+    // Search
+    { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }},
+    { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }},
+    { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }},
+    { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }},
+    { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }},
+    { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }},
+    // Ex command
+    { keys: ':', type: 'ex' }
+  ];
+  var defaultKeymapLength = defaultKeymap.length;
+
+  /**
+   * Ex commands
+   * Care must be taken when adding to the default Ex command map. For any
+   * pair of commands that have a shared prefix, at least one of their
+   * shortNames must not match the prefix of the other command.
+   */
+  var defaultExCommandMap = [
+    { name: 'colorscheme', shortName: 'colo' },
+    { name: 'map' },
+    { name: 'imap', shortName: 'im' },
+    { name: 'nmap', shortName: 'nm' },
+    { name: 'vmap', shortName: 'vm' },
+    { name: 'unmap' },
+    { name: 'write', shortName: 'w' },
+    { name: 'undo', shortName: 'u' },
+    { name: 'redo', shortName: 'red' },
+    { name: 'set', shortName: 'se' },
+    { name: 'setlocal', shortName: 'setl' },
+    { name: 'setglobal', shortName: 'setg' },
+    { name: 'sort', shortName: 'sor' },
+    { name: 'substitute', shortName: 's', possiblyAsync: true },
+    { name: 'nohlsearch', shortName: 'noh' },
+    { name: 'yank', shortName: 'y' },
+    { name: 'delmarks', shortName: 'delm' },
+    { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true },
+    { name: 'vglobal', shortName: 'v' },
+    { name: 'global', shortName: 'g' }
+  ];
+
+    function enterVimMode(cm) {
+      cm.setOption('disableInput', true);
+      cm.setOption('showCursorWhenSelecting', false);
+      CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"});
+      cm.on('cursorActivity', onCursorActivity);
+      maybeInitVimState(cm);
+      CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm));
+    }
+
+    function leaveVimMode(cm) {
+      cm.setOption('disableInput', false);
+      cm.off('cursorActivity', onCursorActivity);
+      CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm));
+      cm.state.vim = null;
+      if (highlightTimeout) clearTimeout(highlightTimeout);
+    }
+
+    function detachVimMap(cm, next) {
+      if (this == CodeMirror.keyMap.vim) {
+        cm.options.$customCursor = null;
+        CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor");
+      }
+
+      if (!next || next.attach != attachVimMap)
+        leaveVimMode(cm);
+    }
+    function attachVimMap(cm, prev) {
+      if (this == CodeMirror.keyMap.vim) {
+        if (cm.curOp) cm.curOp.selectionChanged = true;
+        cm.options.$customCursor = transformCursor;
+        CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor");
+      }
+
+      if (!prev || prev.attach != attachVimMap)
+        enterVimMode(cm);
+    }
+
+    // Deprecated, simply setting the keymap works again.
+    CodeMirror.defineOption('vimMode', false, function(cm, val, prev) {
+      if (val && cm.getOption("keyMap") != "vim")
+        cm.setOption("keyMap", "vim");
+      else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption("keyMap")))
+        cm.setOption("keyMap", "default");
+    });
+
+    function cmKey(key, cm) {
+      if (!cm) { return undefined; }
+      if (this[key]) { return this[key]; }
+      var vimKey = cmKeyToVimKey(key);
+      if (!vimKey) {
+        return false;
+      }
+      var cmd = vimApi.findKey(cm, vimKey);
+      if (typeof cmd == 'function') {
+        CodeMirror.signal(cm, 'vim-keypress', vimKey);
+      }
+      return cmd;
+    }
+
+    var modifiers = {Shift:'S',Ctrl:'C',Alt:'A',Cmd:'D',Mod:'A',CapsLock:''};
+    var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del',Insert:'Ins'};
+    function cmKeyToVimKey(key) {
+      if (key.charAt(0) == '\'') {
+        // Keypress character binding of format "'a'"
+        return key.charAt(1);
+      }
+      var pieces = key.split(/-(?!$)/);
+      var lastPiece = pieces[pieces.length - 1];
+      if (pieces.length == 1 && pieces[0].length == 1) {
+        // No-modifier bindings use literal character bindings above. Skip.
+        return false;
+      } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) {
+        // Ignore Shift+char bindings as they should be handled by literal character.
+        return false;
+      }
+      var hasCharacter = false;
+      for (var i = 0; i < pieces.length; i++) {
+        var piece = pieces[i];
+        if (piece in modifiers) { pieces[i] = modifiers[piece]; }
+        else { hasCharacter = true; }
+        if (piece in specialKeys) { pieces[i] = specialKeys[piece]; }
+      }
+      if (!hasCharacter) {
+        // Vim does not support modifier only keys.
+        return false;
+      }
+      // TODO: Current bindings expect the character to be lower case, but
+      // it looks like vim key notation uses upper case.
+      if (isUpperCase(lastPiece)) {
+        pieces[pieces.length - 1] = lastPiece.toLowerCase();
+      }
+      return '<' + pieces.join('-') + '>';
+    }
+
+    function getOnPasteFn(cm) {
+      var vim = cm.state.vim;
+      if (!vim.onPasteFn) {
+        vim.onPasteFn = function() {
+          if (!vim.insertMode) {
+            cm.setCursor(offsetCursor(cm.getCursor(), 0, 1));
+            actions.enterInsertMode(cm, {}, vim);
+          }
+        };
+      }
+      return vim.onPasteFn;
+    }
+
+    var numberRegex = /[\d]/;
+    var wordCharTest = [CodeMirror.isWordChar, function(ch) {
+      return ch && !CodeMirror.isWordChar(ch) && !/\s/.test(ch);
+    }], bigWordCharTest = [function(ch) {
+      return /\S/.test(ch);
+    }];
+    function makeKeyRange(start, size) {
+      var keys = [];
+      for (var i = start; i < start + size; i++) {
+        keys.push(String.fromCharCode(i));
+      }
+      return keys;
+    }
+    var upperCaseAlphabet = makeKeyRange(65, 26);
+    var lowerCaseAlphabet = makeKeyRange(97, 26);
+    var numbers = makeKeyRange(48, 10);
+    var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']);
+    var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '_', '/']);
+    var upperCaseChars;
+    try { upperCaseChars = new RegExp("^[\\p{Lu}]$", "u"); }
+    catch (_) { upperCaseChars = /^[A-Z]$/; }
+
+    function isLine(cm, line) {
+      return line >= cm.firstLine() && line <= cm.lastLine();
+    }
+    function isLowerCase(k) {
+      return (/^[a-z]$/).test(k);
+    }
+    function isMatchableSymbol(k) {
+      return '()[]{}'.indexOf(k) != -1;
+    }
+    function isNumber(k) {
+      return numberRegex.test(k);
+    }
+    function isUpperCase(k) {
+      return upperCaseChars.test(k);
+    }
+    function isWhiteSpaceString(k) {
+      return (/^\s*$/).test(k);
+    }
+    function isEndOfSentenceSymbol(k) {
+      return '.?!'.indexOf(k) != -1;
+    }
+    function inArray(val, arr) {
+      for (var i = 0; i < arr.length; i++) {
+        if (arr[i] == val) {
+          return true;
+        }
+      }
+      return false;
+    }
+
+    var options = {};
+    function defineOption(name, defaultValue, type, aliases, callback) {
+      if (defaultValue === undefined && !callback) {
+        throw Error('defaultValue is required unless callback is provided');
+      }
+      if (!type) { type = 'string'; }
+      options[name] = {
+        type: type,
+        defaultValue: defaultValue,
+        callback: callback
+      };
+      if (aliases) {
+        for (var i = 0; i < aliases.length; i++) {
+          options[aliases[i]] = options[name];
+        }
+      }
+      if (defaultValue) {
+        setOption(name, defaultValue);
+      }
+    }
+
+    function setOption(name, value, cm, cfg) {
+      var option = options[name];
+      cfg = cfg || {};
+      var scope = cfg.scope;
+      if (!option) {
+        return new Error('Unknown option: ' + name);
+      }
+      if (option.type == 'boolean') {
+        if (value && value !== true) {
+          return new Error('Invalid argument: ' + name + '=' + value);
+        } else if (value !== false) {
+          // Boolean options are set to true if value is not defined.
+          value = true;
+        }
+      }
+      if (option.callback) {
+        if (scope !== 'local') {
+          option.callback(value, undefined);
+        }
+        if (scope !== 'global' && cm) {
+          option.callback(value, cm);
+        }
+      } else {
+        if (scope !== 'local') {
+          option.value = option.type == 'boolean' ? !!value : value;
+        }
+        if (scope !== 'global' && cm) {
+          cm.state.vim.options[name] = {value: value};
+        }
+      }
+    }
+
+    function getOption(name, cm, cfg) {
+      var option = options[name];
+      cfg = cfg || {};
+      var scope = cfg.scope;
+      if (!option) {
+        return new Error('Unknown option: ' + name);
+      }
+      if (option.callback) {
+        var local = cm && option.callback(undefined, cm);
+        if (scope !== 'global' && local !== undefined) {
+          return local;
+        }
+        if (scope !== 'local') {
+          return option.callback();
+        }
+        return;
+      } else {
+        var local = (scope !== 'global') && (cm && cm.state.vim.options[name]);
+        return (local || (scope !== 'local') && option || {}).value;
+      }
+    }
+
+    defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) {
+      // Option is local. Do nothing for global.
+      if (cm === undefined) {
+        return;
+      }
+      // The 'filetype' option proxies to the CodeMirror 'mode' option.
+      if (name === undefined) {
+        var mode = cm.getOption('mode');
+        return mode == 'null' ? '' : mode;
+      } else {
+        var mode = name == '' ? 'null' : name;
+        cm.setOption('mode', mode);
+      }
+    });
+
+    var createCircularJumpList = function() {
+      var size = 100;
+      var pointer = -1;
+      var head = 0;
+      var tail = 0;
+      var buffer = new Array(size);
+      function add(cm, oldCur, newCur) {
+        var current = pointer % size;
+        var curMark = buffer[current];
+        function useNextSlot(cursor) {
+          var next = ++pointer % size;
+          var trashMark = buffer[next];
+          if (trashMark) {
+            trashMark.clear();
+          }
+          buffer[next] = cm.setBookmark(cursor);
+        }
+        if (curMark) {
+          var markPos = curMark.find();
+          // avoid recording redundant cursor position
+          if (markPos && !cursorEqual(markPos, oldCur)) {
+            useNextSlot(oldCur);
+          }
+        } else {
+          useNextSlot(oldCur);
+        }
+        useNextSlot(newCur);
+        head = pointer;
+        tail = pointer - size + 1;
+        if (tail < 0) {
+          tail = 0;
+        }
+      }
+      function move(cm, offset) {
+        pointer += offset;
+        if (pointer > head) {
+          pointer = head;
+        } else if (pointer < tail) {
+          pointer = tail;
+        }
+        var mark = buffer[(size + pointer) % size];
+        // skip marks that are temporarily removed from text buffer
+        if (mark && !mark.find()) {
+          var inc = offset > 0 ? 1 : -1;
+          var newCur;
+          var oldCur = cm.getCursor();
+          do {
+            pointer += inc;
+            mark = buffer[(size + pointer) % size];
+            // skip marks that are the same as current position
+            if (mark &&
+                (newCur = mark.find()) &&
+                !cursorEqual(oldCur, newCur)) {
+              break;
+            }
+          } while (pointer < head && pointer > tail);
+        }
+        return mark;
+      }
+      function find(cm, offset) {
+        var oldPointer = pointer;
+        var mark = move(cm, offset);
+        pointer = oldPointer;
+        return mark && mark.find();
+      }
+      return {
+        cachedCursor: undefined, //used for # and * jumps
+        add: add,
+        find: find,
+        move: move
+      };
+    };
+
+    // Returns an object to track the changes associated insert mode.  It
+    // clones the object that is passed in, or creates an empty object one if
+    // none is provided.
+    var createInsertModeChanges = function(c) {
+      if (c) {
+        // Copy construction
+        return {
+          changes: c.changes,
+          expectCursorActivityForChange: c.expectCursorActivityForChange
+        };
+      }
+      return {
+        // Change list
+        changes: [],
+        // Set to true on change, false on cursorActivity.
+        expectCursorActivityForChange: false
+      };
+    };
+
+    function MacroModeState() {
+      this.latestRegister = undefined;
+      this.isPlaying = false;
+      this.isRecording = false;
+      this.replaySearchQueries = [];
+      this.onRecordingDone = undefined;
+      this.lastInsertModeChanges = createInsertModeChanges();
+    }
+    MacroModeState.prototype = {
+      exitMacroRecordMode: function() {
+        var macroModeState = vimGlobalState.macroModeState;
+        if (macroModeState.onRecordingDone) {
+          macroModeState.onRecordingDone(); // close dialog
+        }
+        macroModeState.onRecordingDone = undefined;
+        macroModeState.isRecording = false;
+      },
+      enterMacroRecordMode: function(cm, registerName) {
+        var register =
+            vimGlobalState.registerController.getRegister(registerName);
+        if (register) {
+          register.clear();
+          this.latestRegister = registerName;
+          if (cm.openDialog) {
+            var template = dom('span', {class: 'cm-vim-message'}, 'recording @' + registerName);
+            this.onRecordingDone = cm.openDialog(template, null, {bottom:true});
+          }
+          this.isRecording = true;
+        }
+      }
+    };
+
+    function maybeInitVimState(cm) {
+      if (!cm.state.vim) {
+        // Store instance state in the CodeMirror object.
+        cm.state.vim = {
+          inputState: new InputState(),
+          // Vim's input state that triggered the last edit, used to repeat
+          // motions and operators with '.'.
+          lastEditInputState: undefined,
+          // Vim's action command before the last edit, used to repeat actions
+          // with '.' and insert mode repeat.
+          lastEditActionCommand: undefined,
+          // When using jk for navigation, if you move from a longer line to a
+          // shorter line, the cursor may clip to the end of the shorter line.
+          // If j is pressed again and cursor goes to the next line, the
+          // cursor should go back to its horizontal position on the longer
+          // line if it can. This is to keep track of the horizontal position.
+          lastHPos: -1,
+          // Doing the same with screen-position for gj/gk
+          lastHSPos: -1,
+          // The last motion command run. Cleared if a non-motion command gets
+          // executed in between.
+          lastMotion: null,
+          marks: {},
+          insertMode: false,
+          // Repeat count for changes made in insert mode, triggered by key
+          // sequences like 3,i. Only exists when insertMode is true.
+          insertModeRepeat: undefined,
+          visualMode: false,
+          // If we are in visual line mode. No effect if visualMode is false.
+          visualLine: false,
+          visualBlock: false,
+          lastSelection: null,
+          lastPastedText: null,
+          sel: {},
+          // Buffer-local/window-local values of vim options.
+          options: {}
+        };
+      }
+      return cm.state.vim;
+    }
+    var vimGlobalState;
+    function resetVimGlobalState() {
+      vimGlobalState = {
+        // The current search query.
+        searchQuery: null,
+        // Whether we are searching backwards.
+        searchIsReversed: false,
+        // Replace part of the last substituted pattern
+        lastSubstituteReplacePart: undefined,
+        jumpList: createCircularJumpList(),
+        macroModeState: new MacroModeState,
+        // Recording latest f, t, F or T motion command.
+        lastCharacterSearch: {increment:0, forward:true, selectedCharacter:''},
+        registerController: new RegisterController({}),
+        // search history buffer
+        searchHistoryController: new HistoryController(),
+        // ex Command history buffer
+        exCommandHistoryController : new HistoryController()
+      };
+      for (var optionName in options) {
+        var option = options[optionName];
+        option.value = option.defaultValue;
+      }
+    }
+
+    var lastInsertModeKeyTimer;
+    var vimApi = {
+      enterVimMode: enterVimMode,
+      buildKeyMap: function() {
+        // TODO: Convert keymap into dictionary format for fast lookup.
+      },
+      // Testing hook, though it might be useful to expose the register
+      // controller anyway.
+      getRegisterController: function() {
+        return vimGlobalState.registerController;
+      },
+      // Testing hook.
+      resetVimGlobalState_: resetVimGlobalState,
+
+      // Testing hook.
+      getVimGlobalState_: function() {
+        return vimGlobalState;
+      },
+
+      // Testing hook.
+      maybeInitVimState_: maybeInitVimState,
+
+      suppressErrorLogging: false,
+
+      InsertModeKey: InsertModeKey,
+      map: function(lhs, rhs, ctx) {
+        // Add user defined key bindings.
+        exCommandDispatcher.map(lhs, rhs, ctx);
+      },
+      unmap: function(lhs, ctx) {
+        return exCommandDispatcher.unmap(lhs, ctx);
+      },
+      // Non-recursive map function.
+      // NOTE: This will not create mappings to key maps that aren't present
+      // in the default key map. See TODO at bottom of function.
+      noremap: function(lhs, rhs, ctx) {
+        function toCtxArray(ctx) {
+          return ctx ? [ctx] : ['normal', 'insert', 'visual'];
+        }
+        var ctxsToMap = toCtxArray(ctx);
+        // Look through all actual defaults to find a map candidate.
+        var actualLength = defaultKeymap.length, origLength = defaultKeymapLength;
+        for (var i = actualLength - origLength;
+             i < actualLength && ctxsToMap.length;
+             i++) {
+          var mapping = defaultKeymap[i];
+          // Omit mappings that operate in the wrong context(s) and those of invalid type.
+          if (mapping.keys == rhs &&
+              (!ctx || !mapping.context || mapping.context === ctx) &&
+              mapping.type.substr(0, 2) !== 'ex' &&
+              mapping.type.substr(0, 3) !== 'key') {
+            // Make a shallow copy of the original keymap entry.
+            var newMapping = {};
+            for (var key in mapping) {
+              newMapping[key] = mapping[key];
+            }
+            // Modify it point to the new mapping with the proper context.
+            newMapping.keys = lhs;
+            if (ctx && !newMapping.context) {
+              newMapping.context = ctx;
+            }
+            // Add it to the keymap with a higher priority than the original.
+            this._mapCommand(newMapping);
+            // Record the mapped contexts as complete.
+            var mappedCtxs = toCtxArray(mapping.context);
+            ctxsToMap = ctxsToMap.filter(function(el) { return mappedCtxs.indexOf(el) === -1; });
+          }
+        }
+        // TODO: Create non-recursive keyToKey mappings for the unmapped contexts once those exist.
+      },
+      // Remove all user-defined mappings for the provided context.
+      mapclear: function(ctx) {
+        // Partition the existing keymap into user-defined and true defaults.
+        var actualLength = defaultKeymap.length,
+            origLength = defaultKeymapLength;
+        var userKeymap = defaultKeymap.slice(0, actualLength - origLength);
+        defaultKeymap = defaultKeymap.slice(actualLength - origLength);
+        if (ctx) {
+          // If a specific context is being cleared, we need to keep mappings
+          // from all other contexts.
+          for (var i = userKeymap.length - 1; i >= 0; i--) {
+            var mapping = userKeymap[i];
+            if (ctx !== mapping.context) {
+              if (mapping.context) {
+                this._mapCommand(mapping);
+              } else {
+                // `mapping` applies to all contexts so create keymap copies
+                // for each context except the one being cleared.
+                var contexts = ['normal', 'insert', 'visual'];
+                for (var j in contexts) {
+                  if (contexts[j] !== ctx) {
+                    var newMapping = {};
+                    for (var key in mapping) {
+                      newMapping[key] = mapping[key];
+                    }
+                    newMapping.context = contexts[j];
+                    this._mapCommand(newMapping);
+                  }
+                }
+              }
+            }
+          }
+        }
+      },
+      // TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace
+      // them, or somehow make them work with the existing CodeMirror setOption/getOption API.
+      setOption: setOption,
+      getOption: getOption,
+      defineOption: defineOption,
+      defineEx: function(name, prefix, func){
+        if (!prefix) {
+          prefix = name;
+        } else if (name.indexOf(prefix) !== 0) {
+          throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered');
+        }
+        exCommands[name]=func;
+        exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'};
+      },
+      handleKey: function (cm, key, origin) {
+        var command = this.findKey(cm, key, origin);
+        if (typeof command === 'function') {
+          return command();
+        }
+      },
+      multiSelectHandleKey: multiSelectHandleKey,
+
+      /**
+       * This is the outermost function called by CodeMirror, after keys have
+       * been mapped to their Vim equivalents.
+       *
+       * Finds a command based on the key (and cached keys if there is a
+       * multi-key sequence). Returns `undefined` if no key is matched, a noop
+       * function if a partial match is found (multi-key), and a function to
+       * execute the bound command if a a key is matched. The function always
+       * returns true.
+       */
+      findKey: function(cm, key, origin) {
+        var vim = maybeInitVimState(cm);
+        function handleMacroRecording() {
+          var macroModeState = vimGlobalState.macroModeState;
+          if (macroModeState.isRecording) {
+            if (key == 'q') {
+              macroModeState.exitMacroRecordMode();
+              clearInputState(cm);
+              return true;
+            }
+            if (origin != 'mapping') {
+              logKey(macroModeState, key);
+            }
+          }
+        }
+        function handleEsc() {
+          if (key == '<Esc>') {
+            if (vim.visualMode) {
+              // Get back to normal mode.
+              exitVisualMode(cm);
+            } else if (vim.insertMode) {
+              // Get back to normal mode.
+              exitInsertMode(cm);
+            } else {
+              // We're already in normal mode. Let '<Esc>' be handled normally.
+              return;
+            }
+            clearInputState(cm);
+            return true;
+          }
+        }
+        function doKeyToKey(keys) {
+          // TODO: prevent infinite recursion.
+          var match;
+          while (keys) {
+            // Pull off one command key, which is either a single character
+            // or a special sequence wrapped in '<' and '>', e.g. '<Space>'.
+            match = (/<\w+-.+?>|<\w+>|./).exec(keys);
+            key = match[0];
+            keys = keys.substring(match.index + key.length);
+            vimApi.handleKey(cm, key, 'mapping');
+          }
+        }
+
+        function handleKeyInsertMode() {
+          if (handleEsc()) { return true; }
+          var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;
+          var keysAreChars = key.length == 1;
+          var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');
+          // Need to check all key substrings in insert mode.
+          while (keys.length > 1 && match.type != 'full') {
+            var keys = vim.inputState.keyBuffer = keys.slice(1);
+            var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert');
+            if (thisMatch.type != 'none') { match = thisMatch; }
+          }
+          if (match.type == 'none') { clearInputState(cm); return false; }
+          else if (match.type == 'partial') {
+            if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }
+            lastInsertModeKeyTimer = window.setTimeout(
+              function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } },
+              getOption('insertModeEscKeysTimeout'));
+            return !keysAreChars;
+          }
+
+          if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); }
+          if (keysAreChars) {
+            var selections = cm.listSelections();
+            for (var i = 0; i < selections.length; i++) {
+              var here = selections[i].head;
+              cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input');
+            }
+            vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop();
+          }
+          clearInputState(cm);
+          return match.command;
+        }
+
+        function handleKeyNonInsertMode() {
+          if (handleMacroRecording() || handleEsc()) { return true; }
+
+          var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key;
+          if (/^[1-9]\d*$/.test(keys)) { return true; }
+
+          var keysMatcher = /^(\d*)(.*)$/.exec(keys);
+          if (!keysMatcher) { clearInputState(cm); return false; }
+          var context = vim.visualMode ? 'visual' :
+                                         'normal';
+          var mainKey = keysMatcher[2] || keysMatcher[1];
+          if (vim.inputState.operatorShortcut && vim.inputState.operatorShortcut.slice(-1) == mainKey) {
+            // multikey operators act linewise by repeating only the last character
+            mainKey = vim.inputState.operatorShortcut;
+          }
+          var match = commandDispatcher.matchCommand(mainKey, defaultKeymap, vim.inputState, context);
+          if (match.type == 'none') { clearInputState(cm); return false; }
+          else if (match.type == 'partial') { return true; }
+          else if (match.type == 'clear') { clearInputState(cm); return true; }
+
+          vim.inputState.keyBuffer = '';
+          keysMatcher = /^(\d*)(.*)$/.exec(keys);
+          if (keysMatcher[1] && keysMatcher[1] != '0') {
+            vim.inputState.pushRepeatDigit(keysMatcher[1]);
+          }
+          return match.command;
+        }
+
+        var command;
+        if (vim.insertMode) { command = handleKeyInsertMode(); }
+        else { command = handleKeyNonInsertMode(); }
+        if (command === false) {
+          return !vim.insertMode && key.length === 1 ? function() { return true; } : undefined;
+        } else if (command === true) {
+          // TODO: Look into using CodeMirror's multi-key handling.
+          // Return no-op since we are caching the key. Counts as handled, but
+          // don't want act on it just yet.
+          return function() { return true; };
+        } else {
+          return function() {
+            return cm.operation(function() {
+              cm.curOp.isVimOp = true;
+              try {
+                if (command.type == 'keyToKey') {
+                  doKeyToKey(command.toKeys);
+                } else {
+                  commandDispatcher.processCommand(cm, vim, command);
+                }
+              } catch (e) {
+                // clear VIM state in case it's in a bad state.
+                cm.state.vim = undefined;
+                maybeInitVimState(cm);
+                if (!vimApi.suppressErrorLogging) {
+                  console['log'](e);
+                }
+                throw e;
+              }
+              return true;
+            });
+          };
+        }
+      },
+      handleEx: function(cm, input) {
+        exCommandDispatcher.processCommand(cm, input);
+      },
+
+      defineMotion: defineMotion,
+      defineAction: defineAction,
+      defineOperator: defineOperator,
+      mapCommand: mapCommand,
+      _mapCommand: _mapCommand,
+
+      defineRegister: defineRegister,
+
+      exitVisualMode: exitVisualMode,
+      exitInsertMode: exitInsertMode
+    };
+
+    // Represents the current input state.
+    function InputState() {
+      this.prefixRepeat = [];
+      this.motionRepeat = [];
+
+      this.operator = null;
+      this.operatorArgs = null;
+      this.motion = null;
+      this.motionArgs = null;
+      this.keyBuffer = []; // For matching multi-key commands.
+      this.registerName = null; // Defaults to the unnamed register.
+    }
+    InputState.prototype.pushRepeatDigit = function(n) {
+      if (!this.operator) {
+        this.prefixRepeat = this.prefixRepeat.concat(n);
+      } else {
+        this.motionRepeat = this.motionRepeat.concat(n);
+      }
+    };
+    InputState.prototype.getRepeat = function() {
+      var repeat = 0;
+      if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) {
+        repeat = 1;
+        if (this.prefixRepeat.length > 0) {
+          repeat *= parseInt(this.prefixRepeat.join(''), 10);
+        }
+        if (this.motionRepeat.length > 0) {
+          repeat *= parseInt(this.motionRepeat.join(''), 10);
+        }
+      }
+      return repeat;
+    };
+
+    function clearInputState(cm, reason) {
+      cm.state.vim.inputState = new InputState();
+      CodeMirror.signal(cm, 'vim-command-done', reason);
+    }
+
+    /*
+     * Register stores information about copy and paste registers.  Besides
+     * text, a register must store whether it is linewise (i.e., when it is
+     * pasted, should it insert itself into a new line, or should the text be
+     * inserted at the cursor position.)
+     */
+    function Register(text, linewise, blockwise) {
+      this.clear();
+      this.keyBuffer = [text || ''];
+      this.insertModeChanges = [];
+      this.searchQueries = [];
+      this.linewise = !!linewise;
+      this.blockwise = !!blockwise;
+    }
+    Register.prototype = {
+      setText: function(text, linewise, blockwise) {
+        this.keyBuffer = [text || ''];
+        this.linewise = !!linewise;
+        this.blockwise = !!blockwise;
+      },
+      pushText: function(text, linewise) {
+        // if this register has ever been set to linewise, use linewise.
+        if (linewise) {
+          if (!this.linewise) {
+            this.keyBuffer.push('\n');
+          }
+          this.linewise = true;
+        }
+        this.keyBuffer.push(text);
+      },
+      pushInsertModeChanges: function(changes) {
+        this.insertModeChanges.push(createInsertModeChanges(changes));
+      },
+      pushSearchQuery: function(query) {
+        this.searchQueries.push(query);
+      },
+      clear: function() {
+        this.keyBuffer = [];
+        this.insertModeChanges = [];
+        this.searchQueries = [];
+        this.linewise = false;
+      },
+      toString: function() {
+        return this.keyBuffer.join('');
+      }
+    };
+
+    /**
+     * Defines an external register.
+     *
+     * The name should be a single character that will be used to reference the register.
+     * The register should support setText, pushText, clear, and toString(). See Register
+     * for a reference implementation.
+     */
+    function defineRegister(name, register) {
+      var registers = vimGlobalState.registerController.registers;
+      if (!name || name.length != 1) {
+        throw Error('Register name must be 1 character');
+      }
+      if (registers[name]) {
+        throw Error('Register already defined ' + name);
+      }
+      registers[name] = register;
+      validRegisters.push(name);
+    }
+
+    /*
+     * vim registers allow you to keep many independent copy and paste buffers.
+     * See http://usevim.com/2012/04/13/registers/ for an introduction.
+     *
+     * RegisterController keeps the state of all the registers.  An initial
+     * state may be passed in.  The unnamed register '"' will always be
+     * overridden.
+     */
+    function RegisterController(registers) {
+      this.registers = registers;
+      this.unnamedRegister = registers['"'] = new Register();
+      registers['.'] = new Register();
+      registers[':'] = new Register();
+      registers['/'] = new Register();
+    }
+    RegisterController.prototype = {
+      pushText: function(registerName, operator, text, linewise, blockwise) {
+        // The black hole register, "_, means delete/yank to nowhere.
+        if (registerName === '_') return;
+        if (linewise && text.charAt(text.length - 1) !== '\n'){
+          text += '\n';
+        }
+        // Lowercase and uppercase registers refer to the same register.
+        // Uppercase just means append.
+        var register = this.isValidRegister(registerName) ?
+            this.getRegister(registerName) : null;
+        // if no register/an invalid register was specified, things go to the
+        // default registers
+        if (!register) {
+          switch (operator) {
+            case 'yank':
+              // The 0 register contains the text from the most recent yank.
+              this.registers['0'] = new Register(text, linewise, blockwise);
+              break;
+            case 'delete':
+            case 'change':
+              if (text.indexOf('\n') == -1) {
+                // Delete less than 1 line. Update the small delete register.
+                this.registers['-'] = new Register(text, linewise);
+              } else {
+                // Shift down the contents of the numbered registers and put the
+                // deleted text into register 1.
+                this.shiftNumericRegisters_();
+                this.registers['1'] = new Register(text, linewise);
+              }
+              break;
+          }
+          // Make sure the unnamed register is set to what just happened
+          this.unnamedRegister.setText(text, linewise, blockwise);
+          return;
+        }
+
+        // If we've gotten to this point, we've actually specified a register
+        var append = isUpperCase(registerName);
+        if (append) {
+          register.pushText(text, linewise);
+        } else {
+          register.setText(text, linewise, blockwise);
+        }
+        // The unnamed register always has the same value as the last used
+        // register.
+        this.unnamedRegister.setText(register.toString(), linewise);
+      },
+      // Gets the register named @name.  If one of @name doesn't already exist,
+      // create it.  If @name is invalid, return the unnamedRegister.
+      getRegister: function(name) {
+        if (!this.isValidRegister(name)) {
+          return this.unnamedRegister;
+        }
+        name = name.toLowerCase();
+        if (!this.registers[name]) {
+          this.registers[name] = new Register();
+        }
+        return this.registers[name];
+      },
+      isValidRegister: function(name) {
+        return name && inArray(name, validRegisters);
+      },
+      shiftNumericRegisters_: function() {
+        for (var i = 9; i >= 2; i--) {
+          this.registers[i] = this.getRegister('' + (i - 1));
+        }
+      }
+    };
+    function HistoryController() {
+        this.historyBuffer = [];
+        this.iterator = 0;
+        this.initialPrefix = null;
+    }
+    HistoryController.prototype = {
+      // the input argument here acts a user entered prefix for a small time
+      // until we start autocompletion in which case it is the autocompleted.
+      nextMatch: function (input, up) {
+        var historyBuffer = this.historyBuffer;
+        var dir = up ? -1 : 1;
+        if (this.initialPrefix === null) this.initialPrefix = input;
+        for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) {
+          var element = historyBuffer[i];
+          for (var j = 0; j <= element.length; j++) {
+            if (this.initialPrefix == element.substring(0, j)) {
+              this.iterator = i;
+              return element;
+            }
+          }
+        }
+        // should return the user input in case we reach the end of buffer.
+        if (i >= historyBuffer.length) {
+          this.iterator = historyBuffer.length;
+          return this.initialPrefix;
+        }
+        // return the last autocompleted query or exCommand as it is.
+        if (i < 0 ) return input;
+      },
+      pushInput: function(input) {
+        var index = this.historyBuffer.indexOf(input);
+        if (index > -1) this.historyBuffer.splice(index, 1);
+        if (input.length) this.historyBuffer.push(input);
+      },
+      reset: function() {
+        this.initialPrefix = null;
+        this.iterator = this.historyBuffer.length;
+      }
+    };
+    var commandDispatcher = {
+      matchCommand: function(keys, keyMap, inputState, context) {
+        var matches = commandMatches(keys, keyMap, context, inputState);
+        if (!matches.full && !matches.partial) {
+          return {type: 'none'};
+        } else if (!matches.full && matches.partial) {
+          return {type: 'partial'};
+        }
+
+        var bestMatch;
+        for (var i = 0; i < matches.full.length; i++) {
+          var match = matches.full[i];
+          if (!bestMatch) {
+            bestMatch = match;
+          }
+        }
+        if (bestMatch.keys.slice(-11) == '<character>') {
+          var character = lastChar(keys);
+          if (!character || character.length > 1) return {type: 'clear'};
+          inputState.selectedCharacter = character;
+        }
+        return {type: 'full', command: bestMatch};
+      },
+      processCommand: function(cm, vim, command) {
+        vim.inputState.repeatOverride = command.repeatOverride;
+        switch (command.type) {
+          case 'motion':
+            this.processMotion(cm, vim, command);
+            break;
+          case 'operator':
+            this.processOperator(cm, vim, command);
+            break;
+          case 'operatorMotion':
+            this.processOperatorMotion(cm, vim, command);
+            break;
+          case 'action':
+            this.processAction(cm, vim, command);
+            break;
+          case 'search':
+            this.processSearch(cm, vim, command);
+            break;
+          case 'ex':
+          case 'keyToEx':
+            this.processEx(cm, vim, command);
+            break;
+        }
+      },
+      processMotion: function(cm, vim, command) {
+        vim.inputState.motion = command.motion;
+        vim.inputState.motionArgs = copyArgs(command.motionArgs);
+        this.evalInput(cm, vim);
+      },
+      processOperator: function(cm, vim, command) {
+        var inputState = vim.inputState;
+        if (inputState.operator) {
+          if (inputState.operator == command.operator) {
+            // Typing an operator twice like 'dd' makes the operator operate
+            // linewise
+            inputState.motion = 'expandToLine';
+            inputState.motionArgs = { linewise: true };
+            this.evalInput(cm, vim);
+            return;
+          } else {
+            // 2 different operators in a row doesn't make sense.
+            clearInputState(cm);
+          }
+        }
+        inputState.operator = command.operator;
+        inputState.operatorArgs = copyArgs(command.operatorArgs);
+        if (command.keys.length > 1) {
+          inputState.operatorShortcut = command.keys;
+        }
+        if (command.exitVisualBlock) {
+            vim.visualBlock = false;
+            updateCmSelection(cm);
+        }
+        if (vim.visualMode) {
+          // Operating on a selection in visual mode. We don't need a motion.
+          this.evalInput(cm, vim);
+        }
+      },
+      processOperatorMotion: function(cm, vim, command) {
+        var visualMode = vim.visualMode;
+        var operatorMotionArgs = copyArgs(command.operatorMotionArgs);
+        if (operatorMotionArgs) {
+          // Operator motions may have special behavior in visual mode.
+          if (visualMode && operatorMotionArgs.visualLine) {
+            vim.visualLine = true;
+          }
+        }
+        this.processOperator(cm, vim, command);
+        if (!visualMode) {
+          this.processMotion(cm, vim, command);
+        }
+      },
+      processAction: function(cm, vim, command) {
+        var inputState = vim.inputState;
+        var repeat = inputState.getRepeat();
+        var repeatIsExplicit = !!repeat;
+        var actionArgs = copyArgs(command.actionArgs) || {};
+        if (inputState.selectedCharacter) {
+          actionArgs.selectedCharacter = inputState.selectedCharacter;
+        }
+        // Actions may or may not have motions and operators. Do these first.
+        if (command.operator) {
+          this.processOperator(cm, vim, command);
+        }
+        if (command.motion) {
+          this.processMotion(cm, vim, command);
+        }
+        if (command.motion || command.operator) {
+          this.evalInput(cm, vim);
+        }
+        actionArgs.repeat = repeat || 1;
+        actionArgs.repeatIsExplicit = repeatIsExplicit;
+        actionArgs.registerName = inputState.registerName;
+        clearInputState(cm);
+        vim.lastMotion = null;
+        if (command.isEdit) {
+          this.recordLastEdit(vim, inputState, command);
+        }
+        actions[command.action](cm, actionArgs, vim);
+      },
+      processSearch: function(cm, vim, command) {
+        if (!cm.getSearchCursor) {
+          // Search depends on SearchCursor.
+          return;
+        }
+        var forward = command.searchArgs.forward;
+        var wholeWordOnly = command.searchArgs.wholeWordOnly;
+        getSearchState(cm).setReversed(!forward);
+        var promptPrefix = (forward) ? '/' : '?';
+        var originalQuery = getSearchState(cm).getQuery();
+        var originalScrollPos = cm.getScrollInfo();
+        function handleQuery(query, ignoreCase, smartCase) {
+          vimGlobalState.searchHistoryController.pushInput(query);
+          vimGlobalState.searchHistoryController.reset();
+          try {
+            updateSearchQuery(cm, query, ignoreCase, smartCase);
+          } catch (e) {
+            showConfirm(cm, 'Invalid regex: ' + query);
+            clearInputState(cm);
+            return;
+          }
+          commandDispatcher.processMotion(cm, vim, {
+            type: 'motion',
+            motion: 'findNext',
+            motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist }
+          });
+        }
+        function onPromptClose(query) {
+          cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
+          handleQuery(query, true /** ignoreCase */, true /** smartCase */);
+          var macroModeState = vimGlobalState.macroModeState;
+          if (macroModeState.isRecording) {
+            logSearchQuery(macroModeState, query);
+          }
+        }
+        function onPromptKeyUp(e, query, close) {
+          var keyName = CodeMirror.keyName(e), up, offset;
+          if (keyName == 'Up' || keyName == 'Down') {
+            up = keyName == 'Up' ? true : false;
+            offset = e.target ? e.target.selectionEnd : 0;
+            query = vimGlobalState.searchHistoryController.nextMatch(query, up) || '';
+            close(query);
+            if (offset && e.target) e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);
+          } else {
+            if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')
+              vimGlobalState.searchHistoryController.reset();
+          }
+          var parsedQuery;
+          try {
+            parsedQuery = updateSearchQuery(cm, query,
+                true /** ignoreCase */, true /** smartCase */);
+          } catch (e) {
+            // Swallow bad regexes for incremental search.
+          }
+          if (parsedQuery) {
+            cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30);
+          } else {
+            clearSearchHighlight(cm);
+            cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
+          }
+        }
+        function onPromptKeyDown(e, query, close) {
+          var keyName = CodeMirror.keyName(e);
+          if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||
+              (keyName == 'Backspace' && query == '')) {
+            vimGlobalState.searchHistoryController.pushInput(query);
+            vimGlobalState.searchHistoryController.reset();
+            updateSearchQuery(cm, originalQuery);
+            clearSearchHighlight(cm);
+            cm.scrollTo(originalScrollPos.left, originalScrollPos.top);
+            CodeMirror.e_stop(e);
+            clearInputState(cm);
+            close();
+            cm.focus();
+          } else if (keyName == 'Up' || keyName == 'Down') {
+            CodeMirror.e_stop(e);
+          } else if (keyName == 'Ctrl-U') {
+            // Ctrl-U clears input.
+            CodeMirror.e_stop(e);
+            close('');
+          }
+        }
+        switch (command.searchArgs.querySrc) {
+          case 'prompt':
+            var macroModeState = vimGlobalState.macroModeState;
+            if (macroModeState.isPlaying) {
+              var query = macroModeState.replaySearchQueries.shift();
+              handleQuery(query, true /** ignoreCase */, false /** smartCase */);
+            } else {
+              showPrompt(cm, {
+                  onClose: onPromptClose,
+                  prefix: promptPrefix,
+                  desc: '(JavaScript regexp)',
+                  onKeyUp: onPromptKeyUp,
+                  onKeyDown: onPromptKeyDown
+              });
+            }
+            break;
+          case 'wordUnderCursor':
+            var word = expandWordUnderCursor(cm, false /** inclusive */,
+                true /** forward */, false /** bigWord */,
+                true /** noSymbol */);
+            var isKeyword = true;
+            if (!word) {
+              word = expandWordUnderCursor(cm, false /** inclusive */,
+                  true /** forward */, false /** bigWord */,
+                  false /** noSymbol */);
+              isKeyword = false;
+            }
+            if (!word) {
+              return;
+            }
+            var query = cm.getLine(word.start.line).substring(word.start.ch,
+                word.end.ch);
+            if (isKeyword && wholeWordOnly) {
+                query = '\\b' + query + '\\b';
+            } else {
+              query = escapeRegex(query);
+            }
+
+            // cachedCursor is used to save the old position of the cursor
+            // when * or # causes vim to seek for the nearest word and shift
+            // the cursor before entering the motion.
+            vimGlobalState.jumpList.cachedCursor = cm.getCursor();
+            cm.setCursor(word.start);
+
+            handleQuery(query, true /** ignoreCase */, false /** smartCase */);
+            break;
+        }
+      },
+      processEx: function(cm, vim, command) {
+        function onPromptClose(input) {
+          // Give the prompt some time to close so that if processCommand shows
+          // an error, the elements don't overlap.
+          vimGlobalState.exCommandHistoryController.pushInput(input);
+          vimGlobalState.exCommandHistoryController.reset();
+          exCommandDispatcher.processCommand(cm, input);
+          clearInputState(cm);
+        }
+        function onPromptKeyDown(e, input, close) {
+          var keyName = CodeMirror.keyName(e), up, offset;
+          if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' ||
+              (keyName == 'Backspace' && input == '')) {
+            vimGlobalState.exCommandHistoryController.pushInput(input);
+            vimGlobalState.exCommandHistoryController.reset();
+            CodeMirror.e_stop(e);
+            clearInputState(cm);
+            close();
+            cm.focus();
+          }
+          if (keyName == 'Up' || keyName == 'Down') {
+            CodeMirror.e_stop(e);
+            up = keyName == 'Up' ? true : false;
+            offset = e.target ? e.target.selectionEnd : 0;
+            input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || '';
+            close(input);
+            if (offset && e.target) e.target.selectionEnd = e.target.selectionStart = Math.min(offset, e.target.value.length);
+          } else if (keyName == 'Ctrl-U') {
+            // Ctrl-U clears input.
+            CodeMirror.e_stop(e);
+            close('');
+          } else {
+            if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift')
+              vimGlobalState.exCommandHistoryController.reset();
+          }
+        }
+        if (command.type == 'keyToEx') {
+          // Handle user defined Ex to Ex mappings
+          exCommandDispatcher.processCommand(cm, command.exArgs.input);
+        } else {
+          if (vim.visualMode) {
+            showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\'<,\'>',
+                onKeyDown: onPromptKeyDown, selectValueOnOpen: false});
+          } else {
+            showPrompt(cm, { onClose: onPromptClose, prefix: ':',
+                onKeyDown: onPromptKeyDown});
+          }
+        }
+      },
+      evalInput: function(cm, vim) {
+        // If the motion command is set, execute both the operator and motion.
+        // Otherwise return.
+        var inputState = vim.inputState;
+        var motion = inputState.motion;
+        var motionArgs = inputState.motionArgs || {};
+        var operator = inputState.operator;
+        var operatorArgs = inputState.operatorArgs || {};
+        var registerName = inputState.registerName;
+        var sel = vim.sel;
+        // TODO: Make sure cm and vim selections are identical outside visual mode.
+        var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head'));
+        var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor'));
+        var oldHead = copyCursor(origHead);
+        var oldAnchor = copyCursor(origAnchor);
+        var newHead, newAnchor;
+        var repeat;
+        if (operator) {
+          this.recordLastEdit(vim, inputState);
+        }
+        if (inputState.repeatOverride !== undefined) {
+          // If repeatOverride is specified, that takes precedence over the
+          // input state's repeat. Used by Ex mode and can be user defined.
+          repeat = inputState.repeatOverride;
+        } else {
+          repeat = inputState.getRepeat();
+        }
+        if (repeat > 0 && motionArgs.explicitRepeat) {
+          motionArgs.repeatIsExplicit = true;
+        } else if (motionArgs.noRepeat ||
+            (!motionArgs.explicitRepeat && repeat === 0)) {
+          repeat = 1;
+          motionArgs.repeatIsExplicit = false;
+        }
+        if (inputState.selectedCharacter) {
+          // If there is a character input, stick it in all of the arg arrays.
+          motionArgs.selectedCharacter = operatorArgs.selectedCharacter =
+              inputState.selectedCharacter;
+        }
+        motionArgs.repeat = repeat;
+        clearInputState(cm);
+        if (motion) {
+          var motionResult = motions[motion](cm, origHead, motionArgs, vim, inputState);
+          vim.lastMotion = motions[motion];
+          if (!motionResult) {
+            return;
+          }
+          if (motionArgs.toJumplist) {
+            var jumpList = vimGlobalState.jumpList;
+            // if the current motion is # or *, use cachedCursor
+            var cachedCursor = jumpList.cachedCursor;
+            if (cachedCursor) {
+              recordJumpPosition(cm, cachedCursor, motionResult);
+              delete jumpList.cachedCursor;
+            } else {
+              recordJumpPosition(cm, origHead, motionResult);
+            }
+          }
+          if (motionResult instanceof Array) {
+            newAnchor = motionResult[0];
+            newHead = motionResult[1];
+          } else {
+            newHead = motionResult;
+          }
+          // TODO: Handle null returns from motion commands better.
+          if (!newHead) {
+            newHead = copyCursor(origHead);
+          }
+          if (vim.visualMode) {
+            if (!(vim.visualBlock && newHead.ch === Infinity)) {
+              newHead = clipCursorToContent(cm, newHead);
+            }
+            if (newAnchor) {
+              newAnchor = clipCursorToContent(cm, newAnchor);
+            }
+            newAnchor = newAnchor || oldAnchor;
+            sel.anchor = newAnchor;
+            sel.head = newHead;
+            updateCmSelection(cm);
+            updateMark(cm, vim, '<',
+                cursorIsBefore(newAnchor, newHead) ? newAnchor
+                    : newHead);
+            updateMark(cm, vim, '>',
+                cursorIsBefore(newAnchor, newHead) ? newHead
+                    : newAnchor);
+          } else if (!operator) {
+            newHead = clipCursorToContent(cm, newHead);
+            cm.setCursor(newHead.line, newHead.ch);
+          }
+        }
+        if (operator) {
+          if (operatorArgs.lastSel) {
+            // Replaying a visual mode operation
+            newAnchor = oldAnchor;
+            var lastSel = operatorArgs.lastSel;
+            var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line);
+            var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch);
+            if (lastSel.visualLine) {
+              // Linewise Visual mode: The same number of lines.
+              newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);
+            } else if (lastSel.visualBlock) {
+              // Blockwise Visual mode: The same number of lines and columns.
+              newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset);
+            } else if (lastSel.head.line == lastSel.anchor.line) {
+              // Normal Visual mode within one line: The same number of characters.
+              newHead = new Pos(oldAnchor.line, oldAnchor.ch + chOffset);
+            } else {
+              // Normal Visual mode with several lines: The same number of lines, in the
+              // last line the same number of characters as in the last line the last time.
+              newHead = new Pos(oldAnchor.line + lineOffset, oldAnchor.ch);
+            }
+            vim.visualMode = true;
+            vim.visualLine = lastSel.visualLine;
+            vim.visualBlock = lastSel.visualBlock;
+            sel = vim.sel = {
+              anchor: newAnchor,
+              head: newHead
+            };
+            updateCmSelection(cm);
+          } else if (vim.visualMode) {
+            operatorArgs.lastSel = {
+              anchor: copyCursor(sel.anchor),
+              head: copyCursor(sel.head),
+              visualBlock: vim.visualBlock,
+              visualLine: vim.visualLine
+            };
+          }
+          var curStart, curEnd, linewise, mode;
+          var cmSel;
+          if (vim.visualMode) {
+            // Init visual op
+            curStart = cursorMin(sel.head, sel.anchor);
+            curEnd = cursorMax(sel.head, sel.anchor);
+            linewise = vim.visualLine || operatorArgs.linewise;
+            mode = vim.visualBlock ? 'block' :
+                   linewise ? 'line' :
+                   'char';
+            cmSel = makeCmSelection(cm, {
+              anchor: curStart,
+              head: curEnd
+            }, mode);
+            if (linewise) {
+              var ranges = cmSel.ranges;
+              if (mode == 'block') {
+                // Linewise operators in visual block mode extend to end of line
+                for (var i = 0; i < ranges.length; i++) {
+                  ranges[i].head.ch = lineLength(cm, ranges[i].head.line);
+                }
+              } else if (mode == 'line') {
+                ranges[0].head = new Pos(ranges[0].head.line + 1, 0);
+              }
+            }
+          } else {
+            // Init motion op
+            curStart = copyCursor(newAnchor || oldAnchor);
+            curEnd = copyCursor(newHead || oldHead);
+            if (cursorIsBefore(curEnd, curStart)) {
+              var tmp = curStart;
+              curStart = curEnd;
+              curEnd = tmp;
+            }
+            linewise = motionArgs.linewise || operatorArgs.linewise;
+            if (linewise) {
+              // Expand selection to entire line.
+              expandSelectionToLine(cm, curStart, curEnd);
+            } else if (motionArgs.forward) {
+              // Clip to trailing newlines only if the motion goes forward.
+              clipToLine(cm, curStart, curEnd);
+            }
+            mode = 'char';
+            var exclusive = !motionArgs.inclusive || linewise;
+            cmSel = makeCmSelection(cm, {
+              anchor: curStart,
+              head: curEnd
+            }, mode, exclusive);
+          }
+          cm.setSelections(cmSel.ranges, cmSel.primary);
+          vim.lastMotion = null;
+          operatorArgs.repeat = repeat; // For indent in visual mode.
+          operatorArgs.registerName = registerName;
+          // Keep track of linewise as it affects how paste and change behave.
+          operatorArgs.linewise = linewise;
+          var operatorMoveTo = operators[operator](
+            cm, operatorArgs, cmSel.ranges, oldAnchor, newHead);
+          if (vim.visualMode) {
+            exitVisualMode(cm, operatorMoveTo != null);
+          }
+          if (operatorMoveTo) {
+            cm.setCursor(operatorMoveTo);
+          }
+        }
+      },
+      recordLastEdit: function(vim, inputState, actionCommand) {
+        var macroModeState = vimGlobalState.macroModeState;
+        if (macroModeState.isPlaying) { return; }
+        vim.lastEditInputState = inputState;
+        vim.lastEditActionCommand = actionCommand;
+        macroModeState.lastInsertModeChanges.changes = [];
+        macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false;
+        macroModeState.lastInsertModeChanges.visualBlock = vim.visualBlock ? vim.sel.head.line - vim.sel.anchor.line : 0;
+      }
+    };
+
+    /**
+     * typedef {Object{line:number,ch:number}} Cursor An object containing the
+     *     position of the cursor.
+     */
+    // All of the functions below return Cursor objects.
+    var motions = {
+      moveToTopLine: function(cm, _head, motionArgs) {
+        var line = getUserVisibleLines(cm).top + motionArgs.repeat -1;
+        return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
+      },
+      moveToMiddleLine: function(cm) {
+        var range = getUserVisibleLines(cm);
+        var line = Math.floor((range.top + range.bottom) * 0.5);
+        return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
+      },
+      moveToBottomLine: function(cm, _head, motionArgs) {
+        var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1;
+        return new Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line)));
+      },
+      expandToLine: function(_cm, head, motionArgs) {
+        // Expands forward to end of line, and then to next line if repeat is
+        // >1. Does not handle backward motion!
+        var cur = head;
+        return new Pos(cur.line + motionArgs.repeat - 1, Infinity);
+      },
+      findNext: function(cm, _head, motionArgs) {
+        var state = getSearchState(cm);
+        var query = state.getQuery();
+        if (!query) {
+          return;
+        }
+        var prev = !motionArgs.forward;
+        // If search is initiated with ? instead of /, negate direction.
+        prev = (state.isReversed()) ? !prev : prev;
+        highlightSearchMatches(cm, query);
+        return findNext(cm, prev/** prev */, query, motionArgs.repeat);
+      },
+      /**
+       * Find and select the next occurrence of the search query. If the cursor is currently
+       * within a match, then find and select the current match. Otherwise, find the next occurrence in the
+       * appropriate direction.
+       *
+       * This differs from `findNext` in the following ways:
+       *
+       * 1. Instead of only returning the "from", this returns a "from", "to" range.
+       * 2. If the cursor is currently inside a search match, this selects the current match
+       *    instead of the next match.
+       * 3. If there is no associated operator, this will turn on visual mode.
+       */
+      findAndSelectNextInclusive: function(cm, _head, motionArgs, vim, prevInputState) {
+        var state = getSearchState(cm);
+        var query = state.getQuery();
+
+        if (!query) {
+          return;
+        }
+
+        var prev = !motionArgs.forward;
+        prev = (state.isReversed()) ? !prev : prev;
+
+        // next: [from, to] | null
+        var next = findNextFromAndToInclusive(cm, prev, query, motionArgs.repeat, vim);
+
+        // No matches.
+        if (!next) {
+          return;
+        }
+
+        // If there's an operator that will be executed, return the selection.
+        if (prevInputState.operator) {
+          return next;
+        }
+
+        // At this point, we know that there is no accompanying operator -- let's
+        // deal with visual mode in order to select an appropriate match.
+
+        var from = next[0];
+        // For whatever reason, when we use the "to" as returned by searchcursor.js directly,
+        // the resulting selection is extended by 1 char. Let's shrink it so that only the
+        // match is selected.
+        var to = new Pos(next[1].line, next[1].ch - 1);
+
+        if (vim.visualMode) {
+          // If we were in visualLine or visualBlock mode, get out of it.
+          if (vim.visualLine || vim.visualBlock) {
+            vim.visualLine = false;
+            vim.visualBlock = false;
+            CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""});
+          }
+
+          // If we're currently in visual mode, we should extend the selection to include
+          // the search result.
+          var anchor = vim.sel.anchor;
+          if (anchor) {
+            if (state.isReversed()) {
+              if (motionArgs.forward) {
+                return [anchor, from];
+              }
+
+              return [anchor, to];
+            } else {
+              if (motionArgs.forward) {
+                return [anchor, to];
+              }
+
+              return [anchor, from];
+            }
+          }
+        } else {
+          // Let's turn visual mode on.
+          vim.visualMode = true;
+          vim.visualLine = false;
+          vim.visualBlock = false;
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: ""});
+        }
+
+        return prev ? [to, from] : [from, to];
+      },
+      goToMark: function(cm, _head, motionArgs, vim) {
+        var pos = getMarkPos(cm, vim, motionArgs.selectedCharacter);
+        if (pos) {
+          return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos;
+        }
+        return null;
+      },
+      moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) {
+        if (vim.visualBlock && motionArgs.sameLine) {
+          var sel = vim.sel;
+          return [
+            clipCursorToContent(cm, new Pos(sel.anchor.line, sel.head.ch)),
+            clipCursorToContent(cm, new Pos(sel.head.line, sel.anchor.ch))
+          ];
+        } else {
+          return ([vim.sel.head, vim.sel.anchor]);
+        }
+      },
+      jumpToMark: function(cm, head, motionArgs, vim) {
+        var best = head;
+        for (var i = 0; i < motionArgs.repeat; i++) {
+          var cursor = best;
+          for (var key in vim.marks) {
+            if (!isLowerCase(key)) {
+              continue;
+            }
+            var mark = vim.marks[key].find();
+            var isWrongDirection = (motionArgs.forward) ?
+              cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark);
+
+            if (isWrongDirection) {
+              continue;
+            }
+            if (motionArgs.linewise && (mark.line == cursor.line)) {
+              continue;
+            }
+
+            var equal = cursorEqual(cursor, best);
+            var between = (motionArgs.forward) ?
+              cursorIsBetween(cursor, mark, best) :
+              cursorIsBetween(best, mark, cursor);
+
+            if (equal || between) {
+              best = mark;
+            }
+          }
+        }
+
+        if (motionArgs.linewise) {
+          // Vim places the cursor on the first non-whitespace character of
+          // the line if there is one, else it places the cursor at the end
+          // of the line, regardless of whether a mark was found.
+          best = new Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line)));
+        }
+        return best;
+      },
+      moveByCharacters: function(_cm, head, motionArgs) {
+        var cur = head;
+        var repeat = motionArgs.repeat;
+        var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat;
+        return new Pos(cur.line, ch);
+      },
+      moveByLines: function(cm, head, motionArgs, vim) {
+        var cur = head;
+        var endCh = cur.ch;
+        // Depending what our last motion was, we may want to do different
+        // things. If our last motion was moving vertically, we want to
+        // preserve the HPos from our last horizontal move.  If our last motion
+        // was going to the end of a line, moving vertically we should go to
+        // the end of the line, etc.
+        switch (vim.lastMotion) {
+          case this.moveByLines:
+          case this.moveByDisplayLines:
+          case this.moveByScroll:
+          case this.moveToColumn:
+          case this.moveToEol:
+            endCh = vim.lastHPos;
+            break;
+          default:
+            vim.lastHPos = endCh;
+        }
+        var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0);
+        var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat;
+        var first = cm.firstLine();
+        var last = cm.lastLine();
+        var posV = cm.findPosV(cur, (motionArgs.forward ? repeat : -repeat), 'line', vim.lastHSPos);
+        var hasMarkedText = motionArgs.forward ? posV.line > line : posV.line < line;
+        if (hasMarkedText) {
+          line = posV.line;
+          endCh = posV.ch;
+        }
+        // Vim go to line begin or line end when cursor at first/last line and
+        // move to previous/next line is triggered.
+        if (line < first && cur.line == first){
+          return this.moveToStartOfLine(cm, head, motionArgs, vim);
+        } else if (line > last && cur.line == last){
+            return moveToEol(cm, head, motionArgs, vim, true);
+        }
+        if (motionArgs.toFirstChar){
+          endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line));
+          vim.lastHPos = endCh;
+        }
+        vim.lastHSPos = cm.charCoords(new Pos(line, endCh),'div').left;
+        return new Pos(line, endCh);
+      },
+      moveByDisplayLines: function(cm, head, motionArgs, vim) {
+        var cur = head;
+        switch (vim.lastMotion) {
+          case this.moveByDisplayLines:
+          case this.moveByScroll:
+          case this.moveByLines:
+          case this.moveToColumn:
+          case this.moveToEol:
+            break;
+          default:
+            vim.lastHSPos = cm.charCoords(cur,'div').left;
+        }
+        var repeat = motionArgs.repeat;
+        var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos);
+        if (res.hitSide) {
+          if (motionArgs.forward) {
+            var lastCharCoords = cm.charCoords(res, 'div');
+            var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos };
+            var res = cm.coordsChar(goalCoords, 'div');
+          } else {
+            var resCoords = cm.charCoords(new Pos(cm.firstLine(), 0), 'div');
+            resCoords.left = vim.lastHSPos;
+            res = cm.coordsChar(resCoords, 'div');
+          }
+        }
+        vim.lastHPos = res.ch;
+        return res;
+      },
+      moveByPage: function(cm, head, motionArgs) {
+        // CodeMirror only exposes functions that move the cursor page down, so
+        // doing this bad hack to move the cursor and move it back. evalInput
+        // will move the cursor to where it should be in the end.
+        var curStart = head;
+        var repeat = motionArgs.repeat;
+        return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page');
+      },
+      moveByParagraph: function(cm, head, motionArgs) {
+        var dir = motionArgs.forward ? 1 : -1;
+        return findParagraph(cm, head, motionArgs.repeat, dir);
+      },
+      moveBySentence: function(cm, head, motionArgs) {
+        var dir = motionArgs.forward ? 1 : -1;
+        return findSentence(cm, head, motionArgs.repeat, dir);
+      },
+      moveByScroll: function(cm, head, motionArgs, vim) {
+        var scrollbox = cm.getScrollInfo();
+        var curEnd = null;
+        var repeat = motionArgs.repeat;
+        if (!repeat) {
+          repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight());
+        }
+        var orig = cm.charCoords(head, 'local');
+        motionArgs.repeat = repeat;
+        curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim);
+        if (!curEnd) {
+          return null;
+        }
+        var dest = cm.charCoords(curEnd, 'local');
+        cm.scrollTo(null, scrollbox.top + dest.top - orig.top);
+        return curEnd;
+      },
+      moveByWords: function(cm, head, motionArgs) {
+        return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward,
+            !!motionArgs.wordEnd, !!motionArgs.bigWord);
+      },
+      moveTillCharacter: function(cm, _head, motionArgs) {
+        var repeat = motionArgs.repeat;
+        var curEnd = moveToCharacter(cm, repeat, motionArgs.forward,
+            motionArgs.selectedCharacter);
+        var increment = motionArgs.forward ? -1 : 1;
+        recordLastCharacterSearch(increment, motionArgs);
+        if (!curEnd) return null;
+        curEnd.ch += increment;
+        return curEnd;
+      },
+      moveToCharacter: function(cm, head, motionArgs) {
+        var repeat = motionArgs.repeat;
+        recordLastCharacterSearch(0, motionArgs);
+        return moveToCharacter(cm, repeat, motionArgs.forward,
+            motionArgs.selectedCharacter) || head;
+      },
+      moveToSymbol: function(cm, head, motionArgs) {
+        var repeat = motionArgs.repeat;
+        return findSymbol(cm, repeat, motionArgs.forward,
+            motionArgs.selectedCharacter) || head;
+      },
+      moveToColumn: function(cm, head, motionArgs, vim) {
+        var repeat = motionArgs.repeat;
+        // repeat is equivalent to which column we want to move to!
+        vim.lastHPos = repeat - 1;
+        vim.lastHSPos = cm.charCoords(head,'div').left;
+        return moveToColumn(cm, repeat);
+      },
+      moveToEol: function(cm, head, motionArgs, vim) {
+        return moveToEol(cm, head, motionArgs, vim, false);
+      },
+      moveToFirstNonWhiteSpaceCharacter: function(cm, head) {
+        // Go to the start of the line where the text begins, or the end for
+        // whitespace-only lines
+        var cursor = head;
+        return new Pos(cursor.line,
+                   findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line)));
+      },
+      moveToMatchedSymbol: function(cm, head) {
+        var cursor = head;
+        var line = cursor.line;
+        var ch = cursor.ch;
+        var lineText = cm.getLine(line);
+        var symbol;
+        for (; ch < lineText.length; ch++) {
+          symbol = lineText.charAt(ch);
+          if (symbol && isMatchableSymbol(symbol)) {
+            var style = cm.getTokenTypeAt(new Pos(line, ch + 1));
+            if (style !== "string" && style !== "comment") {
+              break;
+            }
+          }
+        }
+        if (ch < lineText.length) {
+          // Only include angle brackets in analysis if they are being matched.
+          var re = (ch === '<' || ch === '>') ? /[(){}[\]<>]/ : /[(){}[\]]/;
+          var matched = cm.findMatchingBracket(new Pos(line, ch), {bracketRegex: re});
+          return matched.to;
+        } else {
+          return cursor;
+        }
+      },
+      moveToStartOfLine: function(_cm, head) {
+        return new Pos(head.line, 0);
+      },
+      moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) {
+        var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine();
+        if (motionArgs.repeatIsExplicit) {
+          lineNum = motionArgs.repeat - cm.getOption('firstLineNumber');
+        }
+        return new Pos(lineNum,
+                   findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum)));
+      },
+      moveToStartOfDisplayLine: function(cm) {
+        cm.execCommand("goLineLeft");
+        return cm.getCursor();
+      },
+      moveToEndOfDisplayLine: function(cm) {
+        cm.execCommand("goLineRight");
+        var head = cm.getCursor();
+        if (head.sticky == "before") head.ch--;
+        return head;
+      },
+      textObjectManipulation: function(cm, head, motionArgs, vim) {
+        // TODO: lots of possible exceptions that can be thrown here. Try da(
+        //     outside of a () block.
+        var mirroredPairs = {'(': ')', ')': '(',
+                             '{': '}', '}': '{',
+                             '[': ']', ']': '[',
+                             '<': '>', '>': '<'};
+        var selfPaired = {'\'': true, '"': true, '`': true};
+
+        var character = motionArgs.selectedCharacter;
+        // 'b' refers to  '()' block.
+        // 'B' refers to  '{}' block.
+        if (character == 'b') {
+          character = '(';
+        } else if (character == 'B') {
+          character = '{';
+        }
+
+        // Inclusive is the difference between a and i
+        // TODO: Instead of using the additional text object map to perform text
+        //     object operations, merge the map into the defaultKeyMap and use
+        //     motionArgs to define behavior. Define separate entries for 'aw',
+        //     'iw', 'a[', 'i[', etc.
+        var inclusive = !motionArgs.textObjectInner;
+
+        var tmp;
+        if (mirroredPairs[character]) {
+          tmp = selectCompanionObject(cm, head, character, inclusive);
+        } else if (selfPaired[character]) {
+          tmp = findBeginningAndEnd(cm, head, character, inclusive);
+        } else if (character === 'W') {
+          tmp = expandWordUnderCursor(cm, inclusive, true /** forward */,
+                                                     true /** bigWord */);
+        } else if (character === 'w') {
+          tmp = expandWordUnderCursor(cm, inclusive, true /** forward */,
+                                                     false /** bigWord */);
+        } else if (character === 'p') {
+          tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive);
+          motionArgs.linewise = true;
+          if (vim.visualMode) {
+            if (!vim.visualLine) { vim.visualLine = true; }
+          } else {
+            var operatorArgs = vim.inputState.operatorArgs;
+            if (operatorArgs) { operatorArgs.linewise = true; }
+            tmp.end.line--;
+          }
+        } else if (character === 't') {
+          tmp = expandTagUnderCursor(cm, head, inclusive);
+        } else if (character === 's') {
+          // account for cursor on end of sentence symbol
+          var content = cm.getLine(head.line);
+          if (head.ch > 0 && isEndOfSentenceSymbol(content[head.ch])) {
+            head.ch -= 1;
+          }
+          var end = getSentence(cm, head, motionArgs.repeat, 1, inclusive);
+          var start = getSentence(cm, head, motionArgs.repeat, -1, inclusive);
+          // closer vim behaviour, 'a' only takes the space after the sentence if there is one before and after
+          if (isWhiteSpaceString(cm.getLine(start.line)[start.ch])
+              && isWhiteSpaceString(cm.getLine(end.line)[end.ch -1])) {
+            start = {line: start.line, ch: start.ch + 1};
+          }
+          tmp = {start: start, end: end};
+        } else {
+          // No text object defined for this, don't move.
+          return null;
+        }
+
+        if (!cm.state.vim.visualMode) {
+          return [tmp.start, tmp.end];
+        } else {
+          return expandSelection(cm, tmp.start, tmp.end);
+        }
+      },
+
+      repeatLastCharacterSearch: function(cm, head, motionArgs) {
+        var lastSearch = vimGlobalState.lastCharacterSearch;
+        var repeat = motionArgs.repeat;
+        var forward = motionArgs.forward === lastSearch.forward;
+        var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1);
+        cm.moveH(-increment, 'char');
+        motionArgs.inclusive = forward ? true : false;
+        var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter);
+        if (!curEnd) {
+          cm.moveH(increment, 'char');
+          return head;
+        }
+        curEnd.ch += increment;
+        return curEnd;
+      }
+    };
+
+    function defineMotion(name, fn) {
+      motions[name] = fn;
+    }
+
+    function fillArray(val, times) {
+      var arr = [];
+      for (var i = 0; i < times; i++) {
+        arr.push(val);
+      }
+      return arr;
+    }
+    /**
+     * An operator acts on a text selection. It receives the list of selections
+     * as input. The corresponding CodeMirror selection is guaranteed to
+    * match the input selection.
+     */
+    var operators = {
+      change: function(cm, args, ranges) {
+        var finalHead, text;
+        var vim = cm.state.vim;
+        var anchor = ranges[0].anchor,
+            head = ranges[0].head;
+        if (!vim.visualMode) {
+          text = cm.getRange(anchor, head);
+          var lastState = vim.lastEditInputState || {};
+          if (lastState.motion == "moveByWords" && !isWhiteSpaceString(text)) {
+            // Exclude trailing whitespace if the range is not all whitespace.
+            var match = (/\s+$/).exec(text);
+            if (match && lastState.motionArgs && lastState.motionArgs.forward) {
+              head = offsetCursor(head, 0, - match[0].length);
+              text = text.slice(0, - match[0].length);
+            }
+          }
+          var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE);
+          var wasLastLine = cm.firstLine() == cm.lastLine();
+          if (head.line > cm.lastLine() && args.linewise && !wasLastLine) {
+            cm.replaceRange('', prevLineEnd, head);
+          } else {
+            cm.replaceRange('', anchor, head);
+          }
+          if (args.linewise) {
+            // Push the next line back down, if there is a next line.
+            if (!wasLastLine) {
+              cm.setCursor(prevLineEnd);
+              CodeMirror.commands.newlineAndIndent(cm);
+            }
+            // make sure cursor ends up at the end of the line.
+            anchor.ch = Number.MAX_VALUE;
+          }
+          finalHead = anchor;
+        } else if (args.fullLine) {
+            head.ch = Number.MAX_VALUE;
+            head.line--;
+            cm.setSelection(anchor, head);
+            text = cm.getSelection();
+            cm.replaceSelection("");
+            finalHead = anchor;
+        } else {
+          text = cm.getSelection();
+          var replacement = fillArray('', ranges.length);
+          cm.replaceSelections(replacement);
+          finalHead = cursorMin(ranges[0].head, ranges[0].anchor);
+        }
+        vimGlobalState.registerController.pushText(
+            args.registerName, 'change', text,
+            args.linewise, ranges.length > 1);
+        actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim);
+      },
+      // delete is a javascript keyword.
+      'delete': function(cm, args, ranges) {
+        var finalHead, text;
+        var vim = cm.state.vim;
+        if (!vim.visualBlock) {
+          var anchor = ranges[0].anchor,
+              head = ranges[0].head;
+          if (args.linewise &&
+              head.line != cm.firstLine() &&
+              anchor.line == cm.lastLine() &&
+              anchor.line == head.line - 1) {
+            // Special case for dd on last line (and first line).
+            if (anchor.line == cm.firstLine()) {
+              anchor.ch = 0;
+            } else {
+              anchor = new Pos(anchor.line - 1, lineLength(cm, anchor.line - 1));
+            }
+          }
+          text = cm.getRange(anchor, head);
+          cm.replaceRange('', anchor, head);
+          finalHead = anchor;
+          if (args.linewise) {
+            finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor);
+          }
+        } else {
+          text = cm.getSelection();
+          var replacement = fillArray('', ranges.length);
+          cm.replaceSelections(replacement);
+          finalHead = cursorMin(ranges[0].head, ranges[0].anchor);
+        }
+        vimGlobalState.registerController.pushText(
+            args.registerName, 'delete', text,
+            args.linewise, vim.visualBlock);
+        return clipCursorToContent(cm, finalHead);
+      },
+      indent: function(cm, args, ranges) {
+        var vim = cm.state.vim;
+        if (cm.indentMore) {
+          var repeat = (vim.visualMode) ? args.repeat : 1;
+          for (var j = 0; j < repeat; j++) {
+            if (args.indentRight) cm.indentMore();
+            else cm.indentLess();
+          }
+        } else {
+          var startLine = ranges[0].anchor.line;
+          var endLine = vim.visualBlock ?
+            ranges[ranges.length - 1].anchor.line :
+            ranges[0].head.line;
+          // In visual mode, n> shifts the selection right n times, instead of
+          // shifting n lines right once.
+          var repeat = (vim.visualMode) ? args.repeat : 1;
+          if (args.linewise) {
+            // The only way to delete a newline is to delete until the start of
+            // the next line, so in linewise mode evalInput will include the next
+            // line. We don't want this in indent, so we go back a line.
+            endLine--;
+          }
+          for (var i = startLine; i <= endLine; i++) {
+            for (var j = 0; j < repeat; j++) {
+              cm.indentLine(i, args.indentRight);
+            }
+          }
+        }
+        return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
+      },
+      indentAuto: function(cm, _args, ranges) {
+        cm.execCommand("indentAuto");
+        return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor);
+      },
+      changeCase: function(cm, args, ranges, oldAnchor, newHead) {
+        var selections = cm.getSelections();
+        var swapped = [];
+        var toLower = args.toLower;
+        for (var j = 0; j < selections.length; j++) {
+          var toSwap = selections[j];
+          var text = '';
+          if (toLower === true) {
+            text = toSwap.toLowerCase();
+          } else if (toLower === false) {
+            text = toSwap.toUpperCase();
+          } else {
+            for (var i = 0; i < toSwap.length; i++) {
+              var character = toSwap.charAt(i);
+              text += isUpperCase(character) ? character.toLowerCase() :
+                  character.toUpperCase();
+            }
+          }
+          swapped.push(text);
+        }
+        cm.replaceSelections(swapped);
+        if (args.shouldMoveCursor){
+          return newHead;
+        } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) {
+          return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor);
+        } else if (args.linewise){
+          return oldAnchor;
+        } else {
+          return cursorMin(ranges[0].anchor, ranges[0].head);
+        }
+      },
+      yank: function(cm, args, ranges, oldAnchor) {
+        var vim = cm.state.vim;
+        var text = cm.getSelection();
+        var endPos = vim.visualMode
+          ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor)
+          : oldAnchor;
+        vimGlobalState.registerController.pushText(
+            args.registerName, 'yank',
+            text, args.linewise, vim.visualBlock);
+        return endPos;
+      }
+    };
+
+    function defineOperator(name, fn) {
+      operators[name] = fn;
+    }
+
+    var actions = {
+      jumpListWalk: function(cm, actionArgs, vim) {
+        if (vim.visualMode) {
+          return;
+        }
+        var repeat = actionArgs.repeat;
+        var forward = actionArgs.forward;
+        var jumpList = vimGlobalState.jumpList;
+
+        var mark = jumpList.move(cm, forward ? repeat : -repeat);
+        var markPos = mark ? mark.find() : undefined;
+        markPos = markPos ? markPos : cm.getCursor();
+        cm.setCursor(markPos);
+      },
+      scroll: function(cm, actionArgs, vim) {
+        if (vim.visualMode) {
+          return;
+        }
+        var repeat = actionArgs.repeat || 1;
+        var lineHeight = cm.defaultTextHeight();
+        var top = cm.getScrollInfo().top;
+        var delta = lineHeight * repeat;
+        var newPos = actionArgs.forward ? top + delta : top - delta;
+        var cursor = copyCursor(cm.getCursor());
+        var cursorCoords = cm.charCoords(cursor, 'local');
+        if (actionArgs.forward) {
+          if (newPos > cursorCoords.top) {
+             cursor.line += (newPos - cursorCoords.top) / lineHeight;
+             cursor.line = Math.ceil(cursor.line);
+             cm.setCursor(cursor);
+             cursorCoords = cm.charCoords(cursor, 'local');
+             cm.scrollTo(null, cursorCoords.top);
+          } else {
+             // Cursor stays within bounds.  Just reposition the scroll window.
+             cm.scrollTo(null, newPos);
+          }
+        } else {
+          var newBottom = newPos + cm.getScrollInfo().clientHeight;
+          if (newBottom < cursorCoords.bottom) {
+             cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight;
+             cursor.line = Math.floor(cursor.line);
+             cm.setCursor(cursor);
+             cursorCoords = cm.charCoords(cursor, 'local');
+             cm.scrollTo(
+                 null, cursorCoords.bottom - cm.getScrollInfo().clientHeight);
+          } else {
+             // Cursor stays within bounds.  Just reposition the scroll window.
+             cm.scrollTo(null, newPos);
+          }
+        }
+      },
+      scrollToCursor: function(cm, actionArgs) {
+        var lineNum = cm.getCursor().line;
+        var charCoords = cm.charCoords(new Pos(lineNum, 0), 'local');
+        var height = cm.getScrollInfo().clientHeight;
+        var y = charCoords.top;
+        switch (actionArgs.position) {
+          case 'center': y = charCoords.bottom - height / 2;
+            break;
+          case 'bottom':
+            var lineLastCharPos = new Pos(lineNum, cm.getLine(lineNum).length - 1);
+            var lineLastCharCoords = cm.charCoords(lineLastCharPos, 'local');
+            var lineHeight = lineLastCharCoords.bottom - y;
+            y = y - height + lineHeight;
+            break;
+        }
+        cm.scrollTo(null, y);
+      },
+      replayMacro: function(cm, actionArgs, vim) {
+        var registerName = actionArgs.selectedCharacter;
+        var repeat = actionArgs.repeat;
+        var macroModeState = vimGlobalState.macroModeState;
+        if (registerName == '@') {
+          registerName = macroModeState.latestRegister;
+        } else {
+          macroModeState.latestRegister = registerName;
+        }
+        while(repeat--){
+          executeMacroRegister(cm, vim, macroModeState, registerName);
+        }
+      },
+      enterMacroRecordMode: function(cm, actionArgs) {
+        var macroModeState = vimGlobalState.macroModeState;
+        var registerName = actionArgs.selectedCharacter;
+        if (vimGlobalState.registerController.isValidRegister(registerName)) {
+          macroModeState.enterMacroRecordMode(cm, registerName);
+        }
+      },
+      toggleOverwrite: function(cm) {
+        if (!cm.state.overwrite) {
+          cm.toggleOverwrite(true);
+          cm.setOption('keyMap', 'vim-replace');
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"});
+        } else {
+          cm.toggleOverwrite(false);
+          cm.setOption('keyMap', 'vim-insert');
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"});
+        }
+      },
+      enterInsertMode: function(cm, actionArgs, vim) {
+        if (cm.getOption('readOnly')) { return; }
+        vim.insertMode = true;
+        vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1;
+        var insertAt = (actionArgs) ? actionArgs.insertAt : null;
+        var sel = vim.sel;
+        var head = actionArgs.head || cm.getCursor('head');
+        var height = cm.listSelections().length;
+        if (insertAt == 'eol') {
+          head = new Pos(head.line, lineLength(cm, head.line));
+        } else if (insertAt == 'bol') {
+          head = new Pos(head.line, 0);
+        } else if (insertAt == 'charAfter') {
+          head = offsetCursor(head, 0, 1);
+        } else if (insertAt == 'firstNonBlank') {
+          head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head);
+        } else if (insertAt == 'startOfSelectedArea') {
+          if (!vim.visualMode)
+              return;
+          if (!vim.visualBlock) {
+            if (sel.head.line < sel.anchor.line) {
+              head = sel.head;
+            } else {
+              head = new Pos(sel.anchor.line, 0);
+            }
+          } else {
+            head = new Pos(
+                Math.min(sel.head.line, sel.anchor.line),
+                Math.min(sel.head.ch, sel.anchor.ch));
+            height = Math.abs(sel.head.line - sel.anchor.line) + 1;
+          }
+        } else if (insertAt == 'endOfSelectedArea') {
+            if (!vim.visualMode)
+              return;
+          if (!vim.visualBlock) {
+            if (sel.head.line >= sel.anchor.line) {
+              head = offsetCursor(sel.head, 0, 1);
+            } else {
+              head = new Pos(sel.anchor.line, 0);
+            }
+          } else {
+            head = new Pos(
+                Math.min(sel.head.line, sel.anchor.line),
+                Math.max(sel.head.ch, sel.anchor.ch) + 1);
+            height = Math.abs(sel.head.line - sel.anchor.line) + 1;
+          }
+        } else if (insertAt == 'inplace') {
+          if (vim.visualMode){
+            return;
+          }
+        } else if (insertAt == 'lastEdit') {
+          head = getLastEditPos(cm) || head;
+        }
+        cm.setOption('disableInput', false);
+        if (actionArgs && actionArgs.replace) {
+          // Handle Replace-mode as a special case of insert mode.
+          cm.toggleOverwrite(true);
+          cm.setOption('keyMap', 'vim-replace');
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"});
+        } else {
+          cm.toggleOverwrite(false);
+          cm.setOption('keyMap', 'vim-insert');
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"});
+        }
+        if (!vimGlobalState.macroModeState.isPlaying) {
+          // Only record if not replaying.
+          cm.on('change', onChange);
+          CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);
+        }
+        if (vim.visualMode) {
+          exitVisualMode(cm);
+        }
+        selectForInsert(cm, head, height);
+      },
+      toggleVisualMode: function(cm, actionArgs, vim) {
+        var repeat = actionArgs.repeat;
+        var anchor = cm.getCursor();
+        var head;
+        // TODO: The repeat should actually select number of characters/lines
+        //     equal to the repeat times the size of the previous visual
+        //     operation.
+        if (!vim.visualMode) {
+          // Entering visual mode
+          vim.visualMode = true;
+          vim.visualLine = !!actionArgs.linewise;
+          vim.visualBlock = !!actionArgs.blockwise;
+          head = clipCursorToContent(
+              cm, new Pos(anchor.line, anchor.ch + repeat - 1));
+          vim.sel = {
+            anchor: anchor,
+            head: head
+          };
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""});
+          updateCmSelection(cm);
+          updateMark(cm, vim, '<', cursorMin(anchor, head));
+          updateMark(cm, vim, '>', cursorMax(anchor, head));
+        } else if (vim.visualLine ^ actionArgs.linewise ||
+            vim.visualBlock ^ actionArgs.blockwise) {
+          // Toggling between modes
+          vim.visualLine = !!actionArgs.linewise;
+          vim.visualBlock = !!actionArgs.blockwise;
+          CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""});
+          updateCmSelection(cm);
+        } else {
+          exitVisualMode(cm);
+        }
+      },
+      reselectLastSelection: function(cm, _actionArgs, vim) {
+        var lastSelection = vim.lastSelection;
+        if (vim.visualMode) {
+          updateLastSelection(cm, vim);
+        }
+        if (lastSelection) {
+          var anchor = lastSelection.anchorMark.find();
+          var head = lastSelection.headMark.find();
+          if (!anchor || !head) {
+            // If the marks have been destroyed due to edits, do nothing.
+            return;
+          }
+          vim.sel = {
+            anchor: anchor,
+            head: head
+          };
+          vim.visualMode = true;
+          vim.visualLine = lastSelection.visualLine;
+          vim.visualBlock = lastSelection.visualBlock;
+          updateCmSelection(cm);
+          updateMark(cm, vim, '<', cursorMin(anchor, head));
+          updateMark(cm, vim, '>', cursorMax(anchor, head));
+          CodeMirror.signal(cm, 'vim-mode-change', {
+            mode: 'visual',
+            subMode: vim.visualLine ? 'linewise' :
+                     vim.visualBlock ? 'blockwise' : ''});
+        }
+      },
+      joinLines: function(cm, actionArgs, vim) {
+        var curStart, curEnd;
+        if (vim.visualMode) {
+          curStart = cm.getCursor('anchor');
+          curEnd = cm.getCursor('head');
+          if (cursorIsBefore(curEnd, curStart)) {
+            var tmp = curEnd;
+            curEnd = curStart;
+            curStart = tmp;
+          }
+          curEnd.ch = lineLength(cm, curEnd.line) - 1;
+        } else {
+          // Repeat is the number of lines to join. Minimum 2 lines.
+          var repeat = Math.max(actionArgs.repeat, 2);
+          curStart = cm.getCursor();
+          curEnd = clipCursorToContent(cm, new Pos(curStart.line + repeat - 1,
+                                               Infinity));
+        }
+        var finalCh = 0;
+        for (var i = curStart.line; i < curEnd.line; i++) {
+          finalCh = lineLength(cm, curStart.line);
+          var tmp = new Pos(curStart.line + 1,
+                        lineLength(cm, curStart.line + 1));
+          var text = cm.getRange(curStart, tmp);
+          text = actionArgs.keepSpaces
+            ? text.replace(/\n\r?/g, '')
+            : text.replace(/\n\s*/g, ' ');
+          cm.replaceRange(text, curStart, tmp);
+        }
+        var curFinalPos = new Pos(curStart.line, finalCh);
+        if (vim.visualMode) {
+          exitVisualMode(cm, false);
+        }
+        cm.setCursor(curFinalPos);
+      },
+      newLineAndEnterInsertMode: function(cm, actionArgs, vim) {
+        vim.insertMode = true;
+        var insertAt = copyCursor(cm.getCursor());
+        if (insertAt.line === cm.firstLine() && !actionArgs.after) {
+          // Special case for inserting newline before start of document.
+          cm.replaceRange('\n', new Pos(cm.firstLine(), 0));
+          cm.setCursor(cm.firstLine(), 0);
+        } else {
+          insertAt.line = (actionArgs.after) ? insertAt.line :
+              insertAt.line - 1;
+          insertAt.ch = lineLength(cm, insertAt.line);
+          cm.setCursor(insertAt);
+          var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment ||
+              CodeMirror.commands.newlineAndIndent;
+          newlineFn(cm);
+        }
+        this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim);
+      },
+      paste: function(cm, actionArgs, vim) {
+        var cur = copyCursor(cm.getCursor());
+        var register = vimGlobalState.registerController.getRegister(
+            actionArgs.registerName);
+        var text = register.toString();
+        if (!text) {
+          return;
+        }
+        if (actionArgs.matchIndent) {
+          var tabSize = cm.getOption("tabSize");
+          // length that considers tabs and tabSize
+          var whitespaceLength = function(str) {
+            var tabs = (str.split("\t").length - 1);
+            var spaces = (str.split(" ").length - 1);
+            return tabs * tabSize + spaces * 1;
+          };
+          var currentLine = cm.getLine(cm.getCursor().line);
+          var indent = whitespaceLength(currentLine.match(/^\s*/)[0]);
+          // chomp last newline b/c don't want it to match /^\s*/gm
+          var chompedText = text.replace(/\n$/, '');
+          var wasChomped = text !== chompedText;
+          var firstIndent = whitespaceLength(text.match(/^\s*/)[0]);
+          var text = chompedText.replace(/^\s*/gm, function(wspace) {
+            var newIndent = indent + (whitespaceLength(wspace) - firstIndent);
+            if (newIndent < 0) {
+              return "";
+            }
+            else if (cm.getOption("indentWithTabs")) {
+              var quotient = Math.floor(newIndent / tabSize);
+              return Array(quotient + 1).join('\t');
+            }
+            else {
+              return Array(newIndent + 1).join(' ');
+            }
+          });
+          text += wasChomped ? "\n" : "";
+        }
+        if (actionArgs.repeat > 1) {
+          var text = Array(actionArgs.repeat + 1).join(text);
+        }
+        var linewise = register.linewise;
+        var blockwise = register.blockwise;
+        if (blockwise) {
+          text = text.split('\n');
+          if (linewise) {
+              text.pop();
+          }
+          for (var i = 0; i < text.length; i++) {
+            text[i] = (text[i] == '') ? ' ' : text[i];
+          }
+          cur.ch += actionArgs.after ? 1 : 0;
+          cur.ch = Math.min(lineLength(cm, cur.line), cur.ch);
+        } else if (linewise) {
+          if(vim.visualMode) {
+            text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n';
+          } else if (actionArgs.after) {
+            // Move the newline at the end to the start instead, and paste just
+            // before the newline character of the line we are on right now.
+            text = '\n' + text.slice(0, text.length - 1);
+            cur.ch = lineLength(cm, cur.line);
+          } else {
+            cur.ch = 0;
+          }
+        } else {
+          cur.ch += actionArgs.after ? 1 : 0;
+        }
+        var curPosFinal;
+        var idx;
+        if (vim.visualMode) {
+          //  save the pasted text for reselection if the need arises
+          vim.lastPastedText = text;
+          var lastSelectionCurEnd;
+          var selectedArea = getSelectedAreaRange(cm, vim);
+          var selectionStart = selectedArea[0];
+          var selectionEnd = selectedArea[1];
+          var selectedText = cm.getSelection();
+          var selections = cm.listSelections();
+          var emptyStrings = new Array(selections.length).join('1').split('1');
+          // save the curEnd marker before it get cleared due to cm.replaceRange.
+          if (vim.lastSelection) {
+            lastSelectionCurEnd = vim.lastSelection.headMark.find();
+          }
+          // push the previously selected text to unnamed register
+          vimGlobalState.registerController.unnamedRegister.setText(selectedText);
+          if (blockwise) {
+            // first delete the selected text
+            cm.replaceSelections(emptyStrings);
+            // Set new selections as per the block length of the yanked text
+            selectionEnd = new Pos(selectionStart.line + text.length-1, selectionStart.ch);
+            cm.setCursor(selectionStart);
+            selectBlock(cm, selectionEnd);
+            cm.replaceSelections(text);
+            curPosFinal = selectionStart;
+          } else if (vim.visualBlock) {
+            cm.replaceSelections(emptyStrings);
+            cm.setCursor(selectionStart);
+            cm.replaceRange(text, selectionStart, selectionStart);
+            curPosFinal = selectionStart;
+          } else {
+            cm.replaceRange(text, selectionStart, selectionEnd);
+            curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1);
+          }
+          // restore the the curEnd marker
+          if(lastSelectionCurEnd) {
+            vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd);
+          }
+          if (linewise) {
+            curPosFinal.ch=0;
+          }
+        } else {
+          if (blockwise) {
+            cm.setCursor(cur);
+            for (var i = 0; i < text.length; i++) {
+              var line = cur.line+i;
+              if (line > cm.lastLine()) {
+                cm.replaceRange('\n',  new Pos(line, 0));
+              }
+              var lastCh = lineLength(cm, line);
+              if (lastCh < cur.ch) {
+                extendLineToColumn(cm, line, cur.ch);
+              }
+            }
+            cm.setCursor(cur);
+            selectBlock(cm, new Pos(cur.line + text.length-1, cur.ch));
+            cm.replaceSelections(text);
+            curPosFinal = cur;
+          } else {
+            cm.replaceRange(text, cur);
+            // Now fine tune the cursor to where we want it.
+            if (linewise && actionArgs.after) {
+              curPosFinal = new Pos(
+              cur.line + 1,
+              findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1)));
+            } else if (linewise && !actionArgs.after) {
+              curPosFinal = new Pos(
+                cur.line,
+                findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line)));
+            } else if (!linewise && actionArgs.after) {
+              idx = cm.indexFromPos(cur);
+              curPosFinal = cm.posFromIndex(idx + text.length - 1);
+            } else {
+              idx = cm.indexFromPos(cur);
+              curPosFinal = cm.posFromIndex(idx + text.length);
+            }
+          }
+        }
+        if (vim.visualMode) {
+          exitVisualMode(cm, false);
+        }
+        cm.setCursor(curPosFinal);
+      },
+      undo: function(cm, actionArgs) {
+        cm.operation(function() {
+          repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)();
+          cm.setCursor(cm.getCursor('anchor'));
+        });
+      },
+      redo: function(cm, actionArgs) {
+        repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)();
+      },
+      setRegister: function(_cm, actionArgs, vim) {
+        vim.inputState.registerName = actionArgs.selectedCharacter;
+      },
+      setMark: function(cm, actionArgs, vim) {
+        var markName = actionArgs.selectedCharacter;
+        updateMark(cm, vim, markName, cm.getCursor());
+      },
+      replace: function(cm, actionArgs, vim) {
+        var replaceWith = actionArgs.selectedCharacter;
+        var curStart = cm.getCursor();
+        var replaceTo;
+        var curEnd;
+        var selections = cm.listSelections();
+        if (vim.visualMode) {
+          curStart = cm.getCursor('start');
+          curEnd = cm.getCursor('end');
+        } else {
+          var line = cm.getLine(curStart.line);
+          replaceTo = curStart.ch + actionArgs.repeat;
+          if (replaceTo > line.length) {
+            replaceTo=line.length;
+          }
+          curEnd = new Pos(curStart.line, replaceTo);
+        }
+        if (replaceWith=='\n') {
+          if (!vim.visualMode) cm.replaceRange('', curStart, curEnd);
+          // special case, where vim help says to replace by just one line-break
+          (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm);
+        } else {
+          var replaceWithStr = cm.getRange(curStart, curEnd);
+          //replace all characters in range by selected, but keep linebreaks
+          replaceWithStr = replaceWithStr.replace(/[^\n]/g, replaceWith);
+          if (vim.visualBlock) {
+            // Tabs are split in visua block before replacing
+            var spaces = new Array(cm.getOption("tabSize")+1).join(' ');
+            replaceWithStr = cm.getSelection();
+            replaceWithStr = replaceWithStr.replace(/\t/g, spaces).replace(/[^\n]/g, replaceWith).split('\n');
+            cm.replaceSelections(replaceWithStr);
+          } else {
+            cm.replaceRange(replaceWithStr, curStart, curEnd);
+          }
+          if (vim.visualMode) {
+            curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ?
+                         selections[0].anchor : selections[0].head;
+            cm.setCursor(curStart);
+            exitVisualMode(cm, false);
+          } else {
+            cm.setCursor(offsetCursor(curEnd, 0, -1));
+          }
+        }
+      },
+      incrementNumberToken: function(cm, actionArgs) {
+        var cur = cm.getCursor();
+        var lineStr = cm.getLine(cur.line);
+        var re = /(-?)(?:(0x)([\da-f]+)|(0b|0|)(\d+))/gi;
+        var match;
+        var start;
+        var end;
+        var numberStr;
+        while ((match = re.exec(lineStr)) !== null) {
+          start = match.index;
+          end = start + match[0].length;
+          if (cur.ch < end)break;
+        }
+        if (!actionArgs.backtrack && (end <= cur.ch))return;
+        if (match) {
+          var baseStr = match[2] || match[4];
+          var digits = match[3] || match[5];
+          var increment = actionArgs.increase ? 1 : -1;
+          var base = {'0b': 2, '0': 8, '': 10, '0x': 16}[baseStr.toLowerCase()];
+          var number = parseInt(match[1] + digits, base) + (increment * actionArgs.repeat);
+          numberStr = number.toString(base);
+          var zeroPadding = baseStr ? new Array(digits.length - numberStr.length + 1 + match[1].length).join('0') : '';
+          if (numberStr.charAt(0) === '-') {
+            numberStr = '-' + baseStr + zeroPadding + numberStr.substr(1);
+          } else {
+            numberStr = baseStr + zeroPadding + numberStr;
+          }
+          var from = new Pos(cur.line, start);
+          var to = new Pos(cur.line, end);
+          cm.replaceRange(numberStr, from, to);
+        } else {
+          return;
+        }
+        cm.setCursor(new Pos(cur.line, start + numberStr.length - 1));
+      },
+      repeatLastEdit: function(cm, actionArgs, vim) {
+        var lastEditInputState = vim.lastEditInputState;
+        if (!lastEditInputState) { return; }
+        var repeat = actionArgs.repeat;
+        if (repeat && actionArgs.repeatIsExplicit) {
+          vim.lastEditInputState.repeatOverride = repeat;
+        } else {
+          repeat = vim.lastEditInputState.repeatOverride || repeat;
+        }
+        repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */);
+      },
+      indent: function(cm, actionArgs) {
+        cm.indentLine(cm.getCursor().line, actionArgs.indentRight);
+      },
+      exitInsertMode: exitInsertMode
+    };
+
+    function defineAction(name, fn) {
+      actions[name] = fn;
+    }
+
+    /*
+     * Below are miscellaneous utility functions used by vim.js
+     */
+
+    /**
+     * Clips cursor to ensure that line is within the buffer's range
+     * If includeLineBreak is true, then allow cur.ch == lineLength.
+     */
+    function clipCursorToContent(cm, cur) {
+      var vim = cm.state.vim;
+      var includeLineBreak = vim.insertMode || vim.visualMode;
+      var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() );
+      var maxCh = lineLength(cm, line) - 1 + !!includeLineBreak;
+      var ch = Math.min(Math.max(0, cur.ch), maxCh);
+      return new Pos(line, ch);
+    }
+    function copyArgs(args) {
+      var ret = {};
+      for (var prop in args) {
+        if (args.hasOwnProperty(prop)) {
+          ret[prop] = args[prop];
+        }
+      }
+      return ret;
+    }
+    function offsetCursor(cur, offsetLine, offsetCh) {
+      if (typeof offsetLine === 'object') {
+        offsetCh = offsetLine.ch;
+        offsetLine = offsetLine.line;
+      }
+      return new Pos(cur.line + offsetLine, cur.ch + offsetCh);
+    }
+    function commandMatches(keys, keyMap, context, inputState) {
+      // Partial matches are not applied. They inform the key handler
+      // that the current key sequence is a subsequence of a valid key
+      // sequence, so that the key buffer is not cleared.
+      var match, partial = [], full = [];
+      for (var i = 0; i < keyMap.length; i++) {
+        var command = keyMap[i];
+        if (context == 'insert' && command.context != 'insert' ||
+            command.context && command.context != context ||
+            inputState.operator && command.type == 'action' ||
+            !(match = commandMatch(keys, command.keys))) { continue; }
+        if (match == 'partial') { partial.push(command); }
+        if (match == 'full') { full.push(command); }
+      }
+      return {
+        partial: partial.length && partial,
+        full: full.length && full
+      };
+    }
+    function commandMatch(pressed, mapped) {
+      if (mapped.slice(-11) == '<character>') {
+        // Last character matches anything.
+        var prefixLen = mapped.length - 11;
+        var pressedPrefix = pressed.slice(0, prefixLen);
+        var mappedPrefix = mapped.slice(0, prefixLen);
+        return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' :
+               mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false;
+      } else {
+        return pressed == mapped ? 'full' :
+               mapped.indexOf(pressed) == 0 ? 'partial' : false;
+      }
+    }
+    function lastChar(keys) {
+      var match = /^.*(<[^>]+>)$/.exec(keys);
+      var selectedCharacter = match ? match[1] : keys.slice(-1);
+      if (selectedCharacter.length > 1){
+        switch(selectedCharacter){
+          case '<CR>':
+            selectedCharacter='\n';
+            break;
+          case '<Space>':
+            selectedCharacter=' ';
+            break;
+          default:
+            selectedCharacter='';
+            break;
+        }
+      }
+      return selectedCharacter;
+    }
+    function repeatFn(cm, fn, repeat) {
+      return function() {
+        for (var i = 0; i < repeat; i++) {
+          fn(cm);
+        }
+      };
+    }
+    function copyCursor(cur) {
+      return new Pos(cur.line, cur.ch);
+    }
+    function cursorEqual(cur1, cur2) {
+      return cur1.ch == cur2.ch && cur1.line == cur2.line;
+    }
+    function cursorIsBefore(cur1, cur2) {
+      if (cur1.line < cur2.line) {
+        return true;
+      }
+      if (cur1.line == cur2.line && cur1.ch < cur2.ch) {
+        return true;
+      }
+      return false;
+    }
+    function cursorMin(cur1, cur2) {
+      if (arguments.length > 2) {
+        cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1));
+      }
+      return cursorIsBefore(cur1, cur2) ? cur1 : cur2;
+    }
+    function cursorMax(cur1, cur2) {
+      if (arguments.length > 2) {
+        cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1));
+      }
+      return cursorIsBefore(cur1, cur2) ? cur2 : cur1;
+    }
+    function cursorIsBetween(cur1, cur2, cur3) {
+      // returns true if cur2 is between cur1 and cur3.
+      var cur1before2 = cursorIsBefore(cur1, cur2);
+      var cur2before3 = cursorIsBefore(cur2, cur3);
+      return cur1before2 && cur2before3;
+    }
+    function lineLength(cm, lineNum) {
+      return cm.getLine(lineNum).length;
+    }
+    function trim(s) {
+      if (s.trim) {
+        return s.trim();
+      }
+      return s.replace(/^\s+|\s+$/g, '');
+    }
+    function escapeRegex(s) {
+      return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1');
+    }
+    function extendLineToColumn(cm, lineNum, column) {
+      var endCh = lineLength(cm, lineNum);
+      var spaces = new Array(column-endCh+1).join(' ');
+      cm.setCursor(new Pos(lineNum, endCh));
+      cm.replaceRange(spaces, cm.getCursor());
+    }
+    // This functions selects a rectangular block
+    // of text with selectionEnd as any of its corner
+    // Height of block:
+    // Difference in selectionEnd.line and first/last selection.line
+    // Width of the block:
+    // Distance between selectionEnd.ch and any(first considered here) selection.ch
+    function selectBlock(cm, selectionEnd) {
+      var selections = [], ranges = cm.listSelections();
+      var head = copyCursor(cm.clipPos(selectionEnd));
+      var isClipped = !cursorEqual(selectionEnd, head);
+      var curHead = cm.getCursor('head');
+      var primIndex = getIndex(ranges, curHead);
+      var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor);
+      var max = ranges.length - 1;
+      var index = max - primIndex > primIndex ? max : 0;
+      var base = ranges[index].anchor;
+
+      var firstLine = Math.min(base.line, head.line);
+      var lastLine = Math.max(base.line, head.line);
+      var baseCh = base.ch, headCh = head.ch;
+
+      var dir = ranges[index].head.ch - baseCh;
+      var newDir = headCh - baseCh;
+      if (dir > 0 && newDir <= 0) {
+        baseCh++;
+        if (!isClipped) { headCh--; }
+      } else if (dir < 0 && newDir >= 0) {
+        baseCh--;
+        if (!wasClipped) { headCh++; }
+      } else if (dir < 0 && newDir == -1) {
+        baseCh--;
+        headCh++;
+      }
+      for (var line = firstLine; line <= lastLine; line++) {
+        var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)};
+        selections.push(range);
+      }
+      cm.setSelections(selections);
+      selectionEnd.ch = headCh;
+      base.ch = baseCh;
+      return base;
+    }
+    function selectForInsert(cm, head, height) {
+      var sel = [];
+      for (var i = 0; i < height; i++) {
+        var lineHead = offsetCursor(head, i, 0);
+        sel.push({anchor: lineHead, head: lineHead});
+      }
+      cm.setSelections(sel, 0);
+    }
+    // getIndex returns the index of the cursor in the selections.
+    function getIndex(ranges, cursor, end) {
+      for (var i = 0; i < ranges.length; i++) {
+        var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor);
+        var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor);
+        if (atAnchor || atHead) {
+          return i;
+        }
+      }
+      return -1;
+    }
+    function getSelectedAreaRange(cm, vim) {
+      var lastSelection = vim.lastSelection;
+      var getCurrentSelectedAreaRange = function() {
+        var selections = cm.listSelections();
+        var start =  selections[0];
+        var end = selections[selections.length-1];
+        var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head;
+        var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor;
+        return [selectionStart, selectionEnd];
+      };
+      var getLastSelectedAreaRange = function() {
+        var selectionStart = cm.getCursor();
+        var selectionEnd = cm.getCursor();
+        var block = lastSelection.visualBlock;
+        if (block) {
+          var width = block.width;
+          var height = block.height;
+          selectionEnd = new Pos(selectionStart.line + height, selectionStart.ch + width);
+          var selections = [];
+          // selectBlock creates a 'proper' rectangular block.
+          // We do not want that in all cases, so we manually set selections.
+          for (var i = selectionStart.line; i < selectionEnd.line; i++) {
+            var anchor = new Pos(i, selectionStart.ch);
+            var head = new Pos(i, selectionEnd.ch);
+            var range = {anchor: anchor, head: head};
+            selections.push(range);
+          }
+          cm.setSelections(selections);
+        } else {
+          var start = lastSelection.anchorMark.find();
+          var end = lastSelection.headMark.find();
+          var line = end.line - start.line;
+          var ch = end.ch - start.ch;
+          selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch};
+          if (lastSelection.visualLine) {
+            selectionStart = new Pos(selectionStart.line, 0);
+            selectionEnd = new Pos(selectionEnd.line, lineLength(cm, selectionEnd.line));
+          }
+          cm.setSelection(selectionStart, selectionEnd);
+        }
+        return [selectionStart, selectionEnd];
+      };
+      if (!vim.visualMode) {
+      // In case of replaying the action.
+        return getLastSelectedAreaRange();
+      } else {
+        return getCurrentSelectedAreaRange();
+      }
+    }
+    // Updates the previous selection with the current selection's values. This
+    // should only be called in visual mode.
+    function updateLastSelection(cm, vim) {
+      var anchor = vim.sel.anchor;
+      var head = vim.sel.head;
+      // To accommodate the effect of lastPastedText in the last selection
+      if (vim.lastPastedText) {
+        head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length);
+        vim.lastPastedText = null;
+      }
+      vim.lastSelection = {'anchorMark': cm.setBookmark(anchor),
+                           'headMark': cm.setBookmark(head),
+                           'anchor': copyCursor(anchor),
+                           'head': copyCursor(head),
+                           'visualMode': vim.visualMode,
+                           'visualLine': vim.visualLine,
+                           'visualBlock': vim.visualBlock};
+    }
+    function expandSelection(cm, start, end) {
+      var sel = cm.state.vim.sel;
+      var head = sel.head;
+      var anchor = sel.anchor;
+      var tmp;
+      if (cursorIsBefore(end, start)) {
+        tmp = end;
+        end = start;
+        start = tmp;
+      }
+      if (cursorIsBefore(head, anchor)) {
+        head = cursorMin(start, head);
+        anchor = cursorMax(anchor, end);
+      } else {
+        anchor = cursorMin(start, anchor);
+        head = cursorMax(head, end);
+        head = offsetCursor(head, 0, -1);
+        if (head.ch == -1 && head.line != cm.firstLine()) {
+          head = new Pos(head.line - 1, lineLength(cm, head.line - 1));
+        }
+      }
+      return [anchor, head];
+    }
+    /**
+     * Updates the CodeMirror selection to match the provided vim selection.
+     * If no arguments are given, it uses the current vim selection state.
+     */
+    function updateCmSelection(cm, sel, mode) {
+      var vim = cm.state.vim;
+      sel = sel || vim.sel;
+      var mode = mode ||
+        vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char';
+      var cmSel = makeCmSelection(cm, sel, mode);
+      cm.setSelections(cmSel.ranges, cmSel.primary);
+    }
+    function makeCmSelection(cm, sel, mode, exclusive) {
+      var head = copyCursor(sel.head);
+      var anchor = copyCursor(sel.anchor);
+      if (mode == 'char') {
+        var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;
+        var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0;
+        head = offsetCursor(sel.head, 0, headOffset);
+        anchor = offsetCursor(sel.anchor, 0, anchorOffset);
+        return {
+          ranges: [{anchor: anchor, head: head}],
+          primary: 0
+        };
+      } else if (mode == 'line') {
+        if (!cursorIsBefore(sel.head, sel.anchor)) {
+          anchor.ch = 0;
+
+          var lastLine = cm.lastLine();
+          if (head.line > lastLine) {
+            head.line = lastLine;
+          }
+          head.ch = lineLength(cm, head.line);
+        } else {
+          head.ch = 0;
+          anchor.ch = lineLength(cm, anchor.line);
+        }
+        return {
+          ranges: [{anchor: anchor, head: head}],
+          primary: 0
+        };
+      } else if (mode == 'block') {
+        var top = Math.min(anchor.line, head.line),
+            fromCh = anchor.ch,
+            bottom = Math.max(anchor.line, head.line),
+            toCh = head.ch;
+        if (fromCh < toCh) { toCh += 1; }
+        else { fromCh += 1; }        var height = bottom - top + 1;
+        var primary = head.line == top ? 0 : height - 1;
+        var ranges = [];
+        for (var i = 0; i < height; i++) {
+          ranges.push({
+            anchor: new Pos(top + i, fromCh),
+            head: new Pos(top + i, toCh)
+          });
+        }
+        return {
+          ranges: ranges,
+          primary: primary
+        };
+      }
+    }
+    function getHead(cm) {
+      var cur = cm.getCursor('head');
+      if (cm.getSelection().length == 1) {
+        // Small corner case when only 1 character is selected. The "real"
+        // head is the left of head and anchor.
+        cur = cursorMin(cur, cm.getCursor('anchor'));
+      }
+      return cur;
+    }
+
+    /**
+     * If moveHead is set to false, the CodeMirror selection will not be
+     * touched. The caller assumes the responsibility of putting the cursor
+    * in the right place.
+     */
+    function exitVisualMode(cm, moveHead) {
+      var vim = cm.state.vim;
+      if (moveHead !== false) {
+        cm.setCursor(clipCursorToContent(cm, vim.sel.head));
+      }
+      updateLastSelection(cm, vim);
+      vim.visualMode = false;
+      vim.visualLine = false;
+      vim.visualBlock = false;
+      if (!vim.insertMode) CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"});
+    }
+
+    // Remove any trailing newlines from the selection. For
+    // example, with the caret at the start of the last word on the line,
+    // 'dw' should word, but not the newline, while 'w' should advance the
+    // caret to the first character of the next line.
+    function clipToLine(cm, curStart, curEnd) {
+      var selection = cm.getRange(curStart, curEnd);
+      // Only clip if the selection ends with trailing newline + whitespace
+      if (/\n\s*$/.test(selection)) {
+        var lines = selection.split('\n');
+        // We know this is all whitespace.
+        lines.pop();
+
+        // Cases:
+        // 1. Last word is an empty line - do not clip the trailing '\n'
+        // 2. Last word is not an empty line - clip the trailing '\n'
+        var line;
+        // Find the line containing the last word, and clip all whitespace up
+        // to it.
+        for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) {
+          curEnd.line--;
+          curEnd.ch = 0;
+        }
+        // If the last word is not an empty line, clip an additional newline
+        if (line) {
+          curEnd.line--;
+          curEnd.ch = lineLength(cm, curEnd.line);
+        } else {
+          curEnd.ch = 0;
+        }
+      }
+    }
+
+    // Expand the selection to line ends.
+    function expandSelectionToLine(_cm, curStart, curEnd) {
+      curStart.ch = 0;
+      curEnd.ch = 0;
+      curEnd.line++;
+    }
+
+    function findFirstNonWhiteSpaceCharacter(text) {
+      if (!text) {
+        return 0;
+      }
+      var firstNonWS = text.search(/\S/);
+      return firstNonWS == -1 ? text.length : firstNonWS;
+    }
+
+    function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) {
+      var cur = getHead(cm);
+      var line = cm.getLine(cur.line);
+      var idx = cur.ch;
+
+      // Seek to first word or non-whitespace character, depending on if
+      // noSymbol is true.
+      var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0];
+      while (!test(line.charAt(idx))) {
+        idx++;
+        if (idx >= line.length) { return null; }
+      }
+
+      if (bigWord) {
+        test = bigWordCharTest[0];
+      } else {
+        test = wordCharTest[0];
+        if (!test(line.charAt(idx))) {
+          test = wordCharTest[1];
+        }
+      }
+
+      var end = idx, start = idx;
+      while (test(line.charAt(end)) && end < line.length) { end++; }
+      while (test(line.charAt(start)) && start >= 0) { start--; }
+      start++;
+
+      if (inclusive) {
+        // If present, include all whitespace after word.
+        // Otherwise, include all whitespace before word, except indentation.
+        var wordEnd = end;
+        while (/\s/.test(line.charAt(end)) && end < line.length) { end++; }
+        if (wordEnd == end) {
+          var wordStart = start;
+          while (/\s/.test(line.charAt(start - 1)) && start > 0) { start--; }
+          if (!start) { start = wordStart; }
+        }
+      }
+      return { start: new Pos(cur.line, start), end: new Pos(cur.line, end) };
+    }
+
+    /**
+     * Depends on the following:
+     *
+     * - editor mode should be htmlmixedmode / xml
+     * - mode/xml/xml.js should be loaded
+     * - addon/fold/xml-fold.js should be loaded
+     *
+     * If any of the above requirements are not true, this function noops.
+     *
+     * This is _NOT_ a 100% accurate implementation of vim tag text objects.
+     * The following caveats apply (based off cursory testing, I'm sure there
+     * are other discrepancies):
+     *
+     * - Does not work inside comments:
+     *   ```
+     *   <!-- <div>broken</div> -->
+     *   ```
+     * - Does not work when tags have different cases:
+     *   ```
+     *   <div>broken</DIV>
+     *   ```
+     * - Does not work when cursor is inside a broken tag:
+     *   ```
+     *   <div><brok><en></div>
+     *   ```
+     */
+    function expandTagUnderCursor(cm, head, inclusive) {
+      var cur = head;
+      if (!CodeMirror.findMatchingTag || !CodeMirror.findEnclosingTag) {
+        return { start: cur, end: cur };
+      }
+
+      var tags = CodeMirror.findMatchingTag(cm, head) || CodeMirror.findEnclosingTag(cm, head);
+      if (!tags || !tags.open || !tags.close) {
+        return { start: cur, end: cur };
+      }
+
+      if (inclusive) {
+        return { start: tags.open.from, end: tags.close.to };
+      }
+      return { start: tags.open.to, end: tags.close.from };
+    }
+
+    function recordJumpPosition(cm, oldCur, newCur) {
+      if (!cursorEqual(oldCur, newCur)) {
+        vimGlobalState.jumpList.add(cm, oldCur, newCur);
+      }
+    }
+
+    function recordLastCharacterSearch(increment, args) {
+        vimGlobalState.lastCharacterSearch.increment = increment;
+        vimGlobalState.lastCharacterSearch.forward = args.forward;
+        vimGlobalState.lastCharacterSearch.selectedCharacter = args.selectedCharacter;
+    }
+
+    var symbolToMode = {
+        '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket',
+        '[': 'section', ']': 'section',
+        '*': 'comment', '/': 'comment',
+        'm': 'method', 'M': 'method',
+        '#': 'preprocess'
+    };
+    var findSymbolModes = {
+      bracket: {
+        isComplete: function(state) {
+          if (state.nextCh === state.symb) {
+            state.depth++;
+            if (state.depth >= 1)return true;
+          } else if (state.nextCh === state.reverseSymb) {
+            state.depth--;
+          }
+          return false;
+        }
+      },
+      section: {
+        init: function(state) {
+          state.curMoveThrough = true;
+          state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}';
+        },
+        isComplete: function(state) {
+          return state.index === 0 && state.nextCh === state.symb;
+        }
+      },
+      comment: {
+        isComplete: function(state) {
+          var found = state.lastCh === '*' && state.nextCh === '/';
+          state.lastCh = state.nextCh;
+          return found;
+        }
+      },
+      // TODO: The original Vim implementation only operates on level 1 and 2.
+      // The current implementation doesn't check for code block level and
+      // therefore it operates on any levels.
+      method: {
+        init: function(state) {
+          state.symb = (state.symb === 'm' ? '{' : '}');
+          state.reverseSymb = state.symb === '{' ? '}' : '{';
+        },
+        isComplete: function(state) {
+          if (state.nextCh === state.symb)return true;
+          return false;
+        }
+      },
+      preprocess: {
+        init: function(state) {
+          state.index = 0;
+        },
+        isComplete: function(state) {
+          if (state.nextCh === '#') {
+            var token = state.lineText.match(/^#(\w+)/)[1];
+            if (token === 'endif') {
+              if (state.forward && state.depth === 0) {
+                return true;
+              }
+              state.depth++;
+            } else if (token === 'if') {
+              if (!state.forward && state.depth === 0) {
+                return true;
+              }
+              state.depth--;
+            }
+            if (token === 'else' && state.depth === 0)return true;
+          }
+          return false;
+        }
+      }
+    };
+    function findSymbol(cm, repeat, forward, symb) {
+      var cur = copyCursor(cm.getCursor());
+      var increment = forward ? 1 : -1;
+      var endLine = forward ? cm.lineCount() : -1;
+      var curCh = cur.ch;
+      var line = cur.line;
+      var lineText = cm.getLine(line);
+      var state = {
+        lineText: lineText,
+        nextCh: lineText.charAt(curCh),
+        lastCh: null,
+        index: curCh,
+        symb: symb,
+        reverseSymb: (forward ?  { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb],
+        forward: forward,
+        depth: 0,
+        curMoveThrough: false
+      };
+      var mode = symbolToMode[symb];
+      if (!mode)return cur;
+      var init = findSymbolModes[mode].init;
+      var isComplete = findSymbolModes[mode].isComplete;
+      if (init) { init(state); }
+      while (line !== endLine && repeat) {
+        state.index += increment;
+        state.nextCh = state.lineText.charAt(state.index);
+        if (!state.nextCh) {
+          line += increment;
+          state.lineText = cm.getLine(line) || '';
+          if (increment > 0) {
+            state.index = 0;
+          } else {
+            var lineLen = state.lineText.length;
+            state.index = (lineLen > 0) ? (lineLen-1) : 0;
+          }
+          state.nextCh = state.lineText.charAt(state.index);
+        }
+        if (isComplete(state)) {
+          cur.line = line;
+          cur.ch = state.index;
+          repeat--;
+        }
+      }
+      if (state.nextCh || state.curMoveThrough) {
+        return new Pos(line, state.index);
+      }
+      return cur;
+    }
+
+    /*
+     * Returns the boundaries of the next word. If the cursor in the middle of
+     * the word, then returns the boundaries of the current word, starting at
+     * the cursor. If the cursor is at the start/end of a word, and we are going
+     * forward/backward, respectively, find the boundaries of the next word.
+     *
+     * @param {CodeMirror} cm CodeMirror object.
+     * @param {Cursor} cur The cursor position.
+     * @param {boolean} forward True to search forward. False to search
+     *     backward.
+     * @param {boolean} bigWord True if punctuation count as part of the word.
+     *     False if only [a-zA-Z0-9] characters count as part of the word.
+     * @param {boolean} emptyLineIsWord True if empty lines should be treated
+     *     as words.
+     * @return {Object{from:number, to:number, line: number}} The boundaries of
+     *     the word, or null if there are no more words.
+     */
+    function findWord(cm, cur, forward, bigWord, emptyLineIsWord) {
+      var lineNum = cur.line;
+      var pos = cur.ch;
+      var line = cm.getLine(lineNum);
+      var dir = forward ? 1 : -1;
+      var charTests = bigWord ? bigWordCharTest: wordCharTest;
+
+      if (emptyLineIsWord && line == '') {
+        lineNum += dir;
+        line = cm.getLine(lineNum);
+        if (!isLine(cm, lineNum)) {
+          return null;
+        }
+        pos = (forward) ? 0 : line.length;
+      }
+
+      while (true) {
+        if (emptyLineIsWord && line == '') {
+          return { from: 0, to: 0, line: lineNum };
+        }
+        var stop = (dir > 0) ? line.length : -1;
+        var wordStart = stop, wordEnd = stop;
+        // Find bounds of next word.
+        while (pos != stop) {
+          var foundWord = false;
+          for (var i = 0; i < charTests.length && !foundWord; ++i) {
+            if (charTests[i](line.charAt(pos))) {
+              wordStart = pos;
+              // Advance to end of word.
+              while (pos != stop && charTests[i](line.charAt(pos))) {
+                pos += dir;
+              }
+              wordEnd = pos;
+              foundWord = wordStart != wordEnd;
+              if (wordStart == cur.ch && lineNum == cur.line &&
+                  wordEnd == wordStart + dir) {
+                // We started at the end of a word. Find the next one.
+                continue;
+              } else {
+                return {
+                  from: Math.min(wordStart, wordEnd + 1),
+                  to: Math.max(wordStart, wordEnd),
+                  line: lineNum };
+              }
+            }
+          }
+          if (!foundWord) {
+            pos += dir;
+          }
+        }
+        // Advance to next/prev line.
+        lineNum += dir;
+        if (!isLine(cm, lineNum)) {
+          return null;
+        }
+        line = cm.getLine(lineNum);
+        pos = (dir > 0) ? 0 : line.length;
+      }
+    }
+
+    /**
+     * @param {CodeMirror} cm CodeMirror object.
+     * @param {Pos} cur The position to start from.
+     * @param {int} repeat Number of words to move past.
+     * @param {boolean} forward True to search forward. False to search
+     *     backward.
+     * @param {boolean} wordEnd True to move to end of word. False to move to
+     *     beginning of word.
+     * @param {boolean} bigWord True if punctuation count as part of the word.
+     *     False if only alphabet characters count as part of the word.
+     * @return {Cursor} The position the cursor should move to.
+     */
+    function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) {
+      var curStart = copyCursor(cur);
+      var words = [];
+      if (forward && !wordEnd || !forward && wordEnd) {
+        repeat++;
+      }
+      // For 'e', empty lines are not considered words, go figure.
+      var emptyLineIsWord = !(forward && wordEnd);
+      for (var i = 0; i < repeat; i++) {
+        var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord);
+        if (!word) {
+          var eodCh = lineLength(cm, cm.lastLine());
+          words.push(forward
+              ? {line: cm.lastLine(), from: eodCh, to: eodCh}
+              : {line: 0, from: 0, to: 0});
+          break;
+        }
+        words.push(word);
+        cur = new Pos(word.line, forward ? (word.to - 1) : word.from);
+      }
+      var shortCircuit = words.length != repeat;
+      var firstWord = words[0];
+      var lastWord = words.pop();
+      if (forward && !wordEnd) {
+        // w
+        if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) {
+          // We did not start in the middle of a word. Discard the extra word at the end.
+          lastWord = words.pop();
+        }
+        return new Pos(lastWord.line, lastWord.from);
+      } else if (forward && wordEnd) {
+        return new Pos(lastWord.line, lastWord.to - 1);
+      } else if (!forward && wordEnd) {
+        // ge
+        if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) {
+          // We did not start in the middle of a word. Discard the extra word at the end.
+          lastWord = words.pop();
+        }
+        return new Pos(lastWord.line, lastWord.to);
+      } else {
+        // b
+        return new Pos(lastWord.line, lastWord.from);
+      }
+    }
+
+    function moveToEol(cm, head, motionArgs, vim, keepHPos) {
+      var cur = head;
+      var retval= new Pos(cur.line + motionArgs.repeat - 1, Infinity);
+      var end=cm.clipPos(retval);
+      end.ch--;
+      if (!keepHPos) {
+        vim.lastHPos = Infinity;
+        vim.lastHSPos = cm.charCoords(end,'div').left;
+      }
+      return retval;
+    }
+
+    function moveToCharacter(cm, repeat, forward, character) {
+      var cur = cm.getCursor();
+      var start = cur.ch;
+      var idx;
+      for (var i = 0; i < repeat; i ++) {
+        var line = cm.getLine(cur.line);
+        idx = charIdxInLine(start, line, character, forward, true);
+        if (idx == -1) {
+          return null;
+        }
+        start = idx;
+      }
+      return new Pos(cm.getCursor().line, idx);
+    }
+
+    function moveToColumn(cm, repeat) {
+      // repeat is always >= 1, so repeat - 1 always corresponds
+      // to the column we want to go to.
+      var line = cm.getCursor().line;
+      return clipCursorToContent(cm, new Pos(line, repeat - 1));
+    }
+
+    function updateMark(cm, vim, markName, pos) {
+      if (!inArray(markName, validMarks)) {
+        return;
+      }
+      if (vim.marks[markName]) {
+        vim.marks[markName].clear();
+      }
+      vim.marks[markName] = cm.setBookmark(pos);
+    }
+
+    function charIdxInLine(start, line, character, forward, includeChar) {
+      // Search for char in line.
+      // motion_options: {forward, includeChar}
+      // If includeChar = true, include it too.
+      // If forward = true, search forward, else search backwards.
+      // If char is not found on this line, do nothing
+      var idx;
+      if (forward) {
+        idx = line.indexOf(character, start + 1);
+        if (idx != -1 && !includeChar) {
+          idx -= 1;
+        }
+      } else {
+        idx = line.lastIndexOf(character, start - 1);
+        if (idx != -1 && !includeChar) {
+          idx += 1;
+        }
+      }
+      return idx;
+    }
+
+    function findParagraph(cm, head, repeat, dir, inclusive) {
+      var line = head.line;
+      var min = cm.firstLine();
+      var max = cm.lastLine();
+      var start, end, i = line;
+      function isEmpty(i) { return !cm.getLine(i); }
+      function isBoundary(i, dir, any) {
+        if (any) { return isEmpty(i) != isEmpty(i + dir); }
+        return !isEmpty(i) && isEmpty(i + dir);
+      }
+      if (dir) {
+        while (min <= i && i <= max && repeat > 0) {
+          if (isBoundary(i, dir)) { repeat--; }
+          i += dir;
+        }
+        return new Pos(i, 0);
+      }
+
+      var vim = cm.state.vim;
+      if (vim.visualLine && isBoundary(line, 1, true)) {
+        var anchor = vim.sel.anchor;
+        if (isBoundary(anchor.line, -1, true)) {
+          if (!inclusive || anchor.line != line) {
+            line += 1;
+          }
+        }
+      }
+      var startState = isEmpty(line);
+      for (i = line; i <= max && repeat; i++) {
+        if (isBoundary(i, 1, true)) {
+          if (!inclusive || isEmpty(i) != startState) {
+            repeat--;
+          }
+        }
+      }
+      end = new Pos(i, 0);
+      // select boundary before paragraph for the last one
+      if (i > max && !startState) { startState = true; }
+      else { inclusive = false; }
+      for (i = line; i > min; i--) {
+        if (!inclusive || isEmpty(i) == startState || i == line) {
+          if (isBoundary(i, -1, true)) { break; }
+        }
+      }
+      start = new Pos(i, 0);
+      return { start: start, end: end };
+    }
+  function getSentence(cm, cur, repeat, dir, inclusive /*includes whitespace*/) {
+    /*
+    Takes an index object
+    {
+    line: the line string,
+    ln: line number,
+    pos: index in line,
+    dir: direction of traversal (-1 or 1)
+    }
+    and modifies the pos member to represent the
+    next valid position or sets the line to null if there are
+    no more valid positions.
+   */
+    function nextChar(curr) {
+      if (curr.pos + curr.dir < 0 || curr.pos + curr.dir >= curr.line.length) {
+          curr.line = null;
+        }
+      else {
+        curr.pos += curr.dir;
+      }
+    }
+    /*
+    Performs one iteration of traversal in forward direction
+    Returns an index object of the new location
+   */
+    function forward(cm, ln, pos, dir) {
+      var line = cm.getLine(ln);
+
+      var curr = {
+        line: line,
+        ln: ln,
+        pos: pos,
+        dir: dir,
+      };
+
+      if (curr.line === "") {
+        return { ln: curr.ln, pos: curr.pos };
+      }
+
+      var lastSentencePos = curr.pos;
+
+      // Move one step to skip character we start on
+      nextChar(curr);
+
+      while (curr.line !== null) {
+        lastSentencePos = curr.pos;
+        if (isEndOfSentenceSymbol(curr.line[curr.pos])) {
+          if (!inclusive) {
+            return { ln: curr.ln, pos: curr.pos + 1 };
+          } else {
+            nextChar(curr);
+            while (curr.line !== null ) {
+              if (isWhiteSpaceString(curr.line[curr.pos])) {
+                lastSentencePos = curr.pos;
+                nextChar(curr);
+              } else {
+                break;
+              }
+            }
+            return { ln: curr.ln, pos: lastSentencePos + 1, };
+          }
+        }
+        nextChar(curr);
+      }
+      return { ln: curr.ln, pos: lastSentencePos + 1 };
+    }
+
+    /*
+    Performs one iteration of traversal in reverse direction
+    Returns an index object of the new location
+   */
+    function reverse(cm, ln, pos, dir) {
+      var line = cm.getLine(ln);
+
+      var curr = {
+        line: line,
+        ln: ln,
+        pos: pos,
+        dir: dir,
+      };
+
+      if (curr.line === "") {
+        return { ln: curr.ln, pos: curr.pos };
+      }
+
+      var lastSentencePos = curr.pos;
+
+      // Move one step to skip character we start on
+      nextChar(curr);
+
+      while (curr.line !== null) {
+        if (!isWhiteSpaceString(curr.line[curr.pos]) && !isEndOfSentenceSymbol(curr.line[curr.pos])) {
+          lastSentencePos = curr.pos;
+        }
+
+        else if (isEndOfSentenceSymbol(curr.line[curr.pos]) ) {
+          if (!inclusive) {
+            return { ln: curr.ln, pos: lastSentencePos };
+          } else {
+              if (isWhiteSpaceString(curr.line[curr.pos + 1])) {
+                return { ln: curr.ln, pos: curr.pos + 1, };
+              } else {
+                return {ln: curr.ln, pos: lastSentencePos};
+              }
+          }
+        }
+
+        nextChar(curr);
+      }
+      curr.line = line;
+      if (inclusive && isWhiteSpaceString(curr.line[curr.pos])) {
+        return { ln: curr.ln, pos: curr.pos };
+      } else {
+        return { ln: curr.ln, pos: lastSentencePos };
+      }
+
+    }
+
+    var curr_index = {
+      ln: cur.line,
+      pos: cur.ch,
+    };
+
+    while (repeat > 0) {
+      if (dir < 0) {
+        curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);
+      }
+      else {
+        curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);
+      }
+      repeat--;
+    }
+
+    return new Pos(curr_index.ln, curr_index.pos);
+  }
+
+  function findSentence(cm, cur, repeat, dir) {
+
+    /*
+    Takes an index object
+    {
+    line: the line string,
+    ln: line number,
+    pos: index in line,
+    dir: direction of traversal (-1 or 1)
+    }
+    and modifies the line, ln, and pos members to represent the
+    next valid position or sets them to null if there are
+    no more valid positions.
+   */
+      function nextChar(cm, idx) {
+        if (idx.pos + idx.dir < 0 || idx.pos + idx.dir >= idx.line.length) {
+          idx.ln += idx.dir;
+          if (!isLine(cm, idx.ln)) {
+            idx.line = null;
+            idx.ln = null;
+            idx.pos = null;
+            return;
+          }
+          idx.line = cm.getLine(idx.ln);
+          idx.pos = (idx.dir > 0) ? 0 : idx.line.length - 1;
+        }
+        else {
+          idx.pos += idx.dir;
+        }
+      }
+
+      /*
+        Performs one iteration of traversal in forward direction
+        Returns an index object of the new location
+       */
+      function forward(cm, ln, pos, dir) {
+        var line = cm.getLine(ln);
+        var stop = (line === "");
+
+        var curr = {
+          line: line,
+          ln: ln,
+          pos: pos,
+          dir: dir,
+        };
+
+        var last_valid = {
+          ln: curr.ln,
+          pos: curr.pos,
+        };
+
+        var skip_empty_lines = (curr.line === "");
+
+        // Move one step to skip character we start on
+        nextChar(cm, curr);
+
+        while (curr.line !== null) {
+          last_valid.ln = curr.ln;
+          last_valid.pos = curr.pos;
+
+          if (curr.line === "" && !skip_empty_lines) {
+            return { ln: curr.ln, pos: curr.pos, };
+          }
+          else if (stop && curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
+            return { ln: curr.ln, pos: curr.pos, };
+          }
+          else if (isEndOfSentenceSymbol(curr.line[curr.pos])
+            && !stop
+            && (curr.pos === curr.line.length - 1
+              || isWhiteSpaceString(curr.line[curr.pos + 1]))) {
+            stop = true;
+          }
+
+          nextChar(cm, curr);
+        }
+
+        /*
+          Set the position to the last non whitespace character on the last
+          valid line in the case that we reach the end of the document.
+        */
+        var line = cm.getLine(last_valid.ln);
+        last_valid.pos = 0;
+        for(var i = line.length - 1; i >= 0; --i) {
+          if (!isWhiteSpaceString(line[i])) {
+            last_valid.pos = i;
+            break;
+          }
+        }
+
+        return last_valid;
+
+      }
+
+      /*
+        Performs one iteration of traversal in reverse direction
+        Returns an index object of the new location
+       */
+      function reverse(cm, ln, pos, dir) {
+        var line = cm.getLine(ln);
+
+        var curr = {
+          line: line,
+          ln: ln,
+          pos: pos,
+          dir: dir,
+        };
+
+        var last_valid = {
+          ln: curr.ln,
+          pos: null,
+        };
+
+        var skip_empty_lines = (curr.line === "");
+
+        // Move one step to skip character we start on
+        nextChar(cm, curr);
+
+        while (curr.line !== null) {
+
+          if (curr.line === "" && !skip_empty_lines) {
+            if (last_valid.pos !== null) {
+              return last_valid;
+            }
+            else {
+              return { ln: curr.ln, pos: curr.pos };
+            }
+          }
+          else if (isEndOfSentenceSymbol(curr.line[curr.pos])
+              && last_valid.pos !== null
+              && !(curr.ln === last_valid.ln && curr.pos + 1 === last_valid.pos)) {
+            return last_valid;
+          }
+          else if (curr.line !== "" && !isWhiteSpaceString(curr.line[curr.pos])) {
+            skip_empty_lines = false;
+            last_valid = { ln: curr.ln, pos: curr.pos };
+          }
+
+          nextChar(cm, curr);
+        }
+
+        /*
+          Set the position to the first non whitespace character on the last
+          valid line in the case that we reach the beginning of the document.
+        */
+        var line = cm.getLine(last_valid.ln);
+        last_valid.pos = 0;
+        for(var i = 0; i < line.length; ++i) {
+          if (!isWhiteSpaceString(line[i])) {
+            last_valid.pos = i;
+            break;
+          }
+        }
+        return last_valid;
+      }
+
+      var curr_index = {
+        ln: cur.line,
+        pos: cur.ch,
+      };
+
+      while (repeat > 0) {
+        if (dir < 0) {
+          curr_index = reverse(cm, curr_index.ln, curr_index.pos, dir);
+        }
+        else {
+          curr_index = forward(cm, curr_index.ln, curr_index.pos, dir);
+        }
+        repeat--;
+      }
+
+      return new Pos(curr_index.ln, curr_index.pos);
+    }
+
+    // TODO: perhaps this finagling of start and end positions belongs
+    // in codemirror/replaceRange?
+    function selectCompanionObject(cm, head, symb, inclusive) {
+      var cur = head, start, end;
+
+      var bracketRegexp = ({
+        '(': /[()]/, ')': /[()]/,
+        '[': /[[\]]/, ']': /[[\]]/,
+        '{': /[{}]/, '}': /[{}]/,
+        '<': /[<>]/, '>': /[<>]/})[symb];
+      var openSym = ({
+        '(': '(', ')': '(',
+        '[': '[', ']': '[',
+        '{': '{', '}': '{',
+        '<': '<', '>': '<'})[symb];
+      var curChar = cm.getLine(cur.line).charAt(cur.ch);
+      // Due to the behavior of scanForBracket, we need to add an offset if the
+      // cursor is on a matching open bracket.
+      var offset = curChar === openSym ? 1 : 0;
+
+      start = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), -1, undefined, {'bracketRegex': bracketRegexp});
+      end = cm.scanForBracket(new Pos(cur.line, cur.ch + offset), 1, undefined, {'bracketRegex': bracketRegexp});
+
+      if (!start || !end) {
+        return { start: cur, end: cur };
+      }
+
+      start = start.pos;
+      end = end.pos;
+
+      if ((start.line == end.line && start.ch > end.ch)
+          || (start.line > end.line)) {
+        var tmp = start;
+        start = end;
+        end = tmp;
+      }
+
+      if (inclusive) {
+        end.ch += 1;
+      } else {
+        start.ch += 1;
+      }
+
+      return { start: start, end: end };
+    }
+
+    // Takes in a symbol and a cursor and tries to simulate text objects that
+    // have identical opening and closing symbols
+    // TODO support across multiple lines
+    function findBeginningAndEnd(cm, head, symb, inclusive) {
+      var cur = copyCursor(head);
+      var line = cm.getLine(cur.line);
+      var chars = line.split('');
+      var start, end, i, len;
+      var firstIndex = chars.indexOf(symb);
+
+      // the decision tree is to always look backwards for the beginning first,
+      // but if the cursor is in front of the first instance of the symb,
+      // then move the cursor forward
+      if (cur.ch < firstIndex) {
+        cur.ch = firstIndex;
+        // Why is this line even here???
+        // cm.setCursor(cur.line, firstIndex+1);
+      }
+      // otherwise if the cursor is currently on the closing symbol
+      else if (firstIndex < cur.ch && chars[cur.ch] == symb) {
+        end = cur.ch; // assign end to the current cursor
+        --cur.ch; // make sure to look backwards
+      }
+
+      // if we're currently on the symbol, we've got a start
+      if (chars[cur.ch] == symb && !end) {
+        start = cur.ch + 1; // assign start to ahead of the cursor
+      } else {
+        // go backwards to find the start
+        for (i = cur.ch; i > -1 && !start; i--) {
+          if (chars[i] == symb) {
+            start = i + 1;
+          }
+        }
+      }
+
+      // look forwards for the end symbol
+      if (start && !end) {
+        for (i = start, len = chars.length; i < len && !end; i++) {
+          if (chars[i] == symb) {
+            end = i;
+          }
+        }
+      }
+
+      // nothing found
+      if (!start || !end) {
+        return { start: cur, end: cur };
+      }
+
+      // include the symbols
+      if (inclusive) {
+        --start; ++end;
+      }
+
+      return {
+        start: new Pos(cur.line, start),
+        end: new Pos(cur.line, end)
+      };
+    }
+
+    // Search functions
+    defineOption('pcre', true, 'boolean');
+    function SearchState() {}
+    SearchState.prototype = {
+      getQuery: function() {
+        return vimGlobalState.query;
+      },
+      setQuery: function(query) {
+        vimGlobalState.query = query;
+      },
+      getOverlay: function() {
+        return this.searchOverlay;
+      },
+      setOverlay: function(overlay) {
+        this.searchOverlay = overlay;
+      },
+      isReversed: function() {
+        return vimGlobalState.isReversed;
+      },
+      setReversed: function(reversed) {
+        vimGlobalState.isReversed = reversed;
+      },
+      getScrollbarAnnotate: function() {
+        return this.annotate;
+      },
+      setScrollbarAnnotate: function(annotate) {
+        this.annotate = annotate;
+      }
+    };
+    function getSearchState(cm) {
+      var vim = cm.state.vim;
+      return vim.searchState_ || (vim.searchState_ = new SearchState());
+    }
+    function splitBySlash(argString) {
+      return splitBySeparator(argString, '/');
+    }
+
+    function findUnescapedSlashes(argString) {
+      return findUnescapedSeparators(argString, '/');
+    }
+
+    function splitBySeparator(argString, separator) {
+      var slashes = findUnescapedSeparators(argString, separator) || [];
+      if (!slashes.length) return [];
+      var tokens = [];
+      // in case of strings like foo/bar
+      if (slashes[0] !== 0) return;
+      for (var i = 0; i < slashes.length; i++) {
+        if (typeof slashes[i] == 'number')
+          tokens.push(argString.substring(slashes[i] + 1, slashes[i+1]));
+      }
+      return tokens;
+    }
+
+    function findUnescapedSeparators(str, separator) {
+      if (!separator)
+        separator = '/';
+
+      var escapeNextChar = false;
+      var slashes = [];
+      for (var i = 0; i < str.length; i++) {
+        var c = str.charAt(i);
+        if (!escapeNextChar && c == separator) {
+          slashes.push(i);
+        }
+        escapeNextChar = !escapeNextChar && (c == '\\');
+      }
+      return slashes;
+    }
+
+    // Translates a search string from ex (vim) syntax into javascript form.
+    function translateRegex(str) {
+      // When these match, add a '\' if unescaped or remove one if escaped.
+      var specials = '|(){';
+      // Remove, but never add, a '\' for these.
+      var unescape = '}';
+      var escapeNextChar = false;
+      var out = [];
+      for (var i = -1; i < str.length; i++) {
+        var c = str.charAt(i) || '';
+        var n = str.charAt(i+1) || '';
+        var specialComesNext = (n && specials.indexOf(n) != -1);
+        if (escapeNextChar) {
+          if (c !== '\\' || !specialComesNext) {
+            out.push(c);
+          }
+          escapeNextChar = false;
+        } else {
+          if (c === '\\') {
+            escapeNextChar = true;
+            // Treat the unescape list as special for removing, but not adding '\'.
+            if (n && unescape.indexOf(n) != -1) {
+              specialComesNext = true;
+            }
+            // Not passing this test means removing a '\'.
+            if (!specialComesNext || n === '\\') {
+              out.push(c);
+            }
+          } else {
+            out.push(c);
+            if (specialComesNext && n !== '\\') {
+              out.push('\\');
+            }
+          }
+        }
+      }
+      return out.join('');
+    }
+
+    // Translates the replace part of a search and replace from ex (vim) syntax into
+    // javascript form.  Similar to translateRegex, but additionally fixes back references
+    // (translates '\[0..9]' to '$[0..9]') and follows different rules for escaping '$'.
+    var charUnescapes = {'\\n': '\n', '\\r': '\r', '\\t': '\t'};
+    function translateRegexReplace(str) {
+      var escapeNextChar = false;
+      var out = [];
+      for (var i = -1; i < str.length; i++) {
+        var c = str.charAt(i) || '';
+        var n = str.charAt(i+1) || '';
+        if (charUnescapes[c + n]) {
+          out.push(charUnescapes[c+n]);
+          i++;
+        } else if (escapeNextChar) {
+          // At any point in the loop, escapeNextChar is true if the previous
+          // character was a '\' and was not escaped.
+          out.push(c);
+          escapeNextChar = false;
+        } else {
+          if (c === '\\') {
+            escapeNextChar = true;
+            if ((isNumber(n) || n === '$')) {
+              out.push('$');
+            } else if (n !== '/' && n !== '\\') {
+              out.push('\\');
+            }
+          } else {
+            if (c === '$') {
+              out.push('$');
+            }
+            out.push(c);
+            if (n === '/') {
+              out.push('\\');
+            }
+          }
+        }
+      }
+      return out.join('');
+    }
+
+    // Unescape \ and / in the replace part, for PCRE mode.
+    var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t', '\\&':'&'};
+    function unescapeRegexReplace(str) {
+      var stream = new CodeMirror.StringStream(str);
+      var output = [];
+      while (!stream.eol()) {
+        // Search for \.
+        while (stream.peek() && stream.peek() != '\\') {
+          output.push(stream.next());
+        }
+        var matched = false;
+        for (var matcher in unescapes) {
+          if (stream.match(matcher, true)) {
+            matched = true;
+            output.push(unescapes[matcher]);
+            break;
+          }
+        }
+        if (!matched) {
+          // Don't change anything
+          output.push(stream.next());
+        }
+      }
+      return output.join('');
+    }
+
+    /**
+     * Extract the regular expression from the query and return a Regexp object.
+     * Returns null if the query is blank.
+     * If ignoreCase is passed in, the Regexp object will have the 'i' flag set.
+     * If smartCase is passed in, and the query contains upper case letters,
+     *   then ignoreCase is overridden, and the 'i' flag will not be set.
+     * If the query contains the /i in the flag part of the regular expression,
+     *   then both ignoreCase and smartCase are ignored, and 'i' will be passed
+     *   through to the Regex object.
+     */
+    function parseQuery(query, ignoreCase, smartCase) {
+      // First update the last search register
+      var lastSearchRegister = vimGlobalState.registerController.getRegister('/');
+      lastSearchRegister.setText(query);
+      // Check if the query is already a regex.
+      if (query instanceof RegExp) { return query; }
+      // First try to extract regex + flags from the input. If no flags found,
+      // extract just the regex. IE does not accept flags directly defined in
+      // the regex string in the form /regex/flags
+      var slashes = findUnescapedSlashes(query);
+      var regexPart;
+      var forceIgnoreCase;
+      if (!slashes.length) {
+        // Query looks like 'regexp'
+        regexPart = query;
+      } else {
+        // Query looks like 'regexp/...'
+        regexPart = query.substring(0, slashes[0]);
+        var flagsPart = query.substring(slashes[0]);
+        forceIgnoreCase = (flagsPart.indexOf('i') != -1);
+      }
+      if (!regexPart) {
+        return null;
+      }
+      if (!getOption('pcre')) {
+        regexPart = translateRegex(regexPart);
+      }
+      if (smartCase) {
+        ignoreCase = (/^[^A-Z]*$/).test(regexPart);
+      }
+      var regexp = new RegExp(regexPart,
+          (ignoreCase || forceIgnoreCase) ? 'im' : 'm');
+      return regexp;
+    }
+
+    /**
+     * dom - Document Object Manipulator
+     * Usage:
+     *   dom('<tag>'|<node>[, ...{<attributes>|<$styles>}|<child-node>|'<text>'])
+     * Examples:
+     *   dom('div', {id:'xyz'}, dom('p', 'CM rocks!', {$color:'red'}))
+     *   dom(document.head, dom('script', 'alert("hello!")'))
+     * Not supported:
+     *   dom('p', ['arrays are objects'], Error('objects specify attributes'))
+     */
+    function dom(n) {
+      if (typeof n === 'string') n = document.createElement(n);
+      for (var a, i = 1; i < arguments.length; i++) {
+        if (!(a = arguments[i])) continue;
+        if (typeof a !== 'object') a = document.createTextNode(a);
+        if (a.nodeType) n.appendChild(a);
+        else for (var key in a) {
+          if (!Object.prototype.hasOwnProperty.call(a, key)) continue;
+          if (key[0] === '$') n.style[key.slice(1)] = a[key];
+          else n.setAttribute(key, a[key]);
+        }
+      }
+      return n;
+    }
+
+    function showConfirm(cm, template) {
+      var pre = dom('div', {$color: 'red', $whiteSpace: 'pre', class: 'cm-vim-message'}, template);
+      if (cm.openNotification) {
+        cm.openNotification(pre, {bottom: true, duration: 5000});
+      } else {
+        alert(pre.innerText);
+      }
+    }
+
+    function makePrompt(prefix, desc) {
+      return dom(document.createDocumentFragment(),
+               dom('span', {$fontFamily: 'monospace', $whiteSpace: 'pre'},
+                 prefix,
+                 dom('input', {type: 'text', autocorrect: 'off',
+                               autocapitalize: 'off', spellcheck: 'false'})),
+               desc && dom('span', {$color: '#888'}, desc));
+    }
+
+    function showPrompt(cm, options) {
+      var template = makePrompt(options.prefix, options.desc);
+      if (cm.openDialog) {
+        cm.openDialog(template, options.onClose, {
+          onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp,
+          bottom: true, selectValueOnOpen: false, value: options.value
+        });
+      }
+      else {
+        var shortText = '';
+        if (typeof options.prefix != "string" && options.prefix) shortText += options.prefix.textContent;
+        if (options.desc) shortText += " " + options.desc;
+        options.onClose(prompt(shortText, ''));
+      }
+    }
+
+    function regexEqual(r1, r2) {
+      if (r1 instanceof RegExp && r2 instanceof RegExp) {
+          var props = ['global', 'multiline', 'ignoreCase', 'source'];
+          for (var i = 0; i < props.length; i++) {
+              var prop = props[i];
+              if (r1[prop] !== r2[prop]) {
+                  return false;
+              }
+          }
+          return true;
+      }
+      return false;
+    }
+    // Returns true if the query is valid.
+    function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) {
+      if (!rawQuery) {
+        return;
+      }
+      var state = getSearchState(cm);
+      var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase);
+      if (!query) {
+        return;
+      }
+      highlightSearchMatches(cm, query);
+      if (regexEqual(query, state.getQuery())) {
+        return query;
+      }
+      state.setQuery(query);
+      return query;
+    }
+    function searchOverlay(query) {
+      if (query.source.charAt(0) == '^') {
+        var matchSol = true;
+      }
+      return {
+        token: function(stream) {
+          if (matchSol && !stream.sol()) {
+            stream.skipToEnd();
+            return;
+          }
+          var match = stream.match(query, false);
+          if (match) {
+            if (match[0].length == 0) {
+              // Matched empty string, skip to next.
+              stream.next();
+              return 'searching';
+            }
+            if (!stream.sol()) {
+              // Backtrack 1 to match \b
+              stream.backUp(1);
+              if (!query.exec(stream.next() + match[0])) {
+                stream.next();
+                return null;
+              }
+            }
+            stream.match(query);
+            return 'searching';
+          }
+          while (!stream.eol()) {
+            stream.next();
+            if (stream.match(query, false)) break;
+          }
+        },
+        query: query
+      };
+    }
+    var highlightTimeout = 0;
+    function highlightSearchMatches(cm, query) {
+      clearTimeout(highlightTimeout);
+      highlightTimeout = setTimeout(function() {
+        if (!cm.state.vim) return;
+        var searchState = getSearchState(cm);
+        var overlay = searchState.getOverlay();
+        if (!overlay || query != overlay.query) {
+          if (overlay) {
+            cm.removeOverlay(overlay);
+          }
+          overlay = searchOverlay(query);
+          cm.addOverlay(overlay);
+          if (cm.showMatchesOnScrollbar) {
+            if (searchState.getScrollbarAnnotate()) {
+              searchState.getScrollbarAnnotate().clear();
+            }
+            searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query));
+          }
+          searchState.setOverlay(overlay);
+        }
+      }, 50);
+    }
+    function findNext(cm, prev, query, repeat) {
+      if (repeat === undefined) { repeat = 1; }
+      return cm.operation(function() {
+        var pos = cm.getCursor();
+        var cursor = cm.getSearchCursor(query, pos);
+        for (var i = 0; i < repeat; i++) {
+          var found = cursor.find(prev);
+          if (i == 0 && found && cursorEqual(cursor.from(), pos)) {
+            var lastEndPos = prev ? cursor.from() : cursor.to();
+            found = cursor.find(prev);
+            if (found && !found[0] && cursorEqual(cursor.from(), lastEndPos)) {
+              if (cm.getLine(lastEndPos.line).length == lastEndPos.ch)
+                found = cursor.find(prev);
+            }
+          }
+          if (!found) {
+            // SearchCursor may have returned null because it hit EOF, wrap
+            // around and try again.
+            cursor = cm.getSearchCursor(query,
+                (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) );
+            if (!cursor.find(prev)) {
+              return;
+            }
+          }
+        }
+        return cursor.from();
+      });
+    }
+    /**
+     * Pretty much the same as `findNext`, except for the following differences:
+     *
+     * 1. Before starting the search, move to the previous search. This way if our cursor is
+     * already inside a match, we should return the current match.
+     * 2. Rather than only returning the cursor's from, we return the cursor's from and to as a tuple.
+     */
+    function findNextFromAndToInclusive(cm, prev, query, repeat, vim) {
+      if (repeat === undefined) { repeat = 1; }
+      return cm.operation(function() {
+        var pos = cm.getCursor();
+        var cursor = cm.getSearchCursor(query, pos);
+
+        // Go back one result to ensure that if the cursor is currently a match, we keep it.
+        var found = cursor.find(!prev);
+
+        // If we haven't moved, go back one more (similar to if i==0 logic in findNext).
+        if (!vim.visualMode && found && cursorEqual(cursor.from(), pos)) {
+          cursor.find(!prev);
+        }
+
+        for (var i = 0; i < repeat; i++) {
+          found = cursor.find(prev);
+          if (!found) {
+            // SearchCursor may have returned null because it hit EOF, wrap
+            // around and try again.
+            cursor = cm.getSearchCursor(query,
+                (prev) ? new Pos(cm.lastLine()) : new Pos(cm.firstLine(), 0) );
+            if (!cursor.find(prev)) {
+              return;
+            }
+          }
+        }
+        return [cursor.from(), cursor.to()];
+      });
+    }
+    function clearSearchHighlight(cm) {
+      var state = getSearchState(cm);
+      cm.removeOverlay(getSearchState(cm).getOverlay());
+      state.setOverlay(null);
+      if (state.getScrollbarAnnotate()) {
+        state.getScrollbarAnnotate().clear();
+        state.setScrollbarAnnotate(null);
+      }
+    }
+    /**
+     * Check if pos is in the specified range, INCLUSIVE.
+     * Range can be specified with 1 or 2 arguments.
+     * If the first range argument is an array, treat it as an array of line
+     * numbers. Match pos against any of the lines.
+     * If the first range argument is a number,
+     *   if there is only 1 range argument, check if pos has the same line
+     *       number
+     *   if there are 2 range arguments, then check if pos is in between the two
+     *       range arguments.
+     */
+    function isInRange(pos, start, end) {
+      if (typeof pos != 'number') {
+        // Assume it is a cursor position. Get the line number.
+        pos = pos.line;
+      }
+      if (start instanceof Array) {
+        return inArray(pos, start);
+      } else {
+        if (typeof end == 'number') {
+          return (pos >= start && pos <= end);
+        } else {
+          return pos == start;
+        }
+      }
+    }
+    function getUserVisibleLines(cm) {
+      var scrollInfo = cm.getScrollInfo();
+      var occludeToleranceTop = 6;
+      var occludeToleranceBottom = 10;
+      var from = cm.coordsChar({left:0, top: occludeToleranceTop + scrollInfo.top}, 'local');
+      var bottomY = scrollInfo.clientHeight - occludeToleranceBottom + scrollInfo.top;
+      var to = cm.coordsChar({left:0, top: bottomY}, 'local');
+      return {top: from.line, bottom: to.line};
+    }
+
+    function getMarkPos(cm, vim, markName) {
+      if (markName == '\'' || markName == '`') {
+        return vimGlobalState.jumpList.find(cm, -1) || new Pos(0, 0);
+      } else if (markName == '.') {
+        return getLastEditPos(cm);
+      }
+
+      var mark = vim.marks[markName];
+      return mark && mark.find();
+    }
+
+    function getLastEditPos(cm) {
+      var done = cm.doc.history.done;
+      for (var i = done.length; i--;) {
+        if (done[i].changes) {
+          return copyCursor(done[i].changes[0].to);
+        }
+      }
+    }
+
+    var ExCommandDispatcher = function() {
+      this.buildCommandMap_();
+    };
+    ExCommandDispatcher.prototype = {
+      processCommand: function(cm, input, opt_params) {
+        var that = this;
+        cm.operation(function () {
+          cm.curOp.isVimOp = true;
+          that._processCommand(cm, input, opt_params);
+        });
+      },
+      _processCommand: function(cm, input, opt_params) {
+        var vim = cm.state.vim;
+        var commandHistoryRegister = vimGlobalState.registerController.getRegister(':');
+        var previousCommand = commandHistoryRegister.toString();
+        if (vim.visualMode) {
+          exitVisualMode(cm);
+        }
+        var inputStream = new CodeMirror.StringStream(input);
+        // update ": with the latest command whether valid or invalid
+        commandHistoryRegister.setText(input);
+        var params = opt_params || {};
+        params.input = input;
+        try {
+          this.parseInput_(cm, inputStream, params);
+        } catch(e) {
+          showConfirm(cm, e.toString());
+          throw e;
+        }
+        var command;
+        var commandName;
+        if (!params.commandName) {
+          // If only a line range is defined, move to the line.
+          if (params.line !== undefined) {
+            commandName = 'move';
+          }
+        } else {
+          command = this.matchCommand_(params.commandName);
+          if (command) {
+            commandName = command.name;
+            if (command.excludeFromCommandHistory) {
+              commandHistoryRegister.setText(previousCommand);
+            }
+            this.parseCommandArgs_(inputStream, params, command);
+            if (command.type == 'exToKey') {
+              // Handle Ex to Key mapping.
+              for (var i = 0; i < command.toKeys.length; i++) {
+                vimApi.handleKey(cm, command.toKeys[i], 'mapping');
+              }
+              return;
+            } else if (command.type == 'exToEx') {
+              // Handle Ex to Ex mapping.
+              this.processCommand(cm, command.toInput);
+              return;
+            }
+          }
+        }
+        if (!commandName) {
+          showConfirm(cm, 'Not an editor command ":' + input + '"');
+          return;
+        }
+        try {
+          exCommands[commandName](cm, params);
+          // Possibly asynchronous commands (e.g. substitute, which might have a
+          // user confirmation), are responsible for calling the callback when
+          // done. All others have it taken care of for them here.
+          if ((!command || !command.possiblyAsync) && params.callback) {
+            params.callback();
+          }
+        } catch(e) {
+          showConfirm(cm, e.toString());
+          throw e;
+        }
+      },
+      parseInput_: function(cm, inputStream, result) {
+        inputStream.eatWhile(':');
+        // Parse range.
+        if (inputStream.eat('%')) {
+          result.line = cm.firstLine();
+          result.lineEnd = cm.lastLine();
+        } else {
+          result.line = this.parseLineSpec_(cm, inputStream);
+          if (result.line !== undefined && inputStream.eat(',')) {
+            result.lineEnd = this.parseLineSpec_(cm, inputStream);
+          }
+        }
+
+        // Parse command name.
+        var commandMatch = inputStream.match(/^(\w+|!!|@@|[!#&*<=>@~])/);
+        if (commandMatch) {
+          result.commandName = commandMatch[1];
+        } else {
+          result.commandName = inputStream.match(/.*/)[0];
+        }
+
+        return result;
+      },
+      parseLineSpec_: function(cm, inputStream) {
+        var numberMatch = inputStream.match(/^(\d+)/);
+        if (numberMatch) {
+          // Absolute line number plus offset (N+M or N-M) is probably a typo,
+          // not something the user actually wanted. (NB: vim does allow this.)
+          return parseInt(numberMatch[1], 10) - 1;
+        }
+        switch (inputStream.next()) {
+          case '.':
+            return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);
+          case '$':
+            return this.parseLineSpecOffset_(inputStream, cm.lastLine());
+          case '\'':
+            var markName = inputStream.next();
+            var markPos = getMarkPos(cm, cm.state.vim, markName);
+            if (!markPos) throw new Error('Mark not set');
+            return this.parseLineSpecOffset_(inputStream, markPos.line);
+          case '-':
+          case '+':
+            inputStream.backUp(1);
+            // Offset is relative to current line if not otherwise specified.
+            return this.parseLineSpecOffset_(inputStream, cm.getCursor().line);
+          default:
+            inputStream.backUp(1);
+            return undefined;
+        }
+      },
+      parseLineSpecOffset_: function(inputStream, line) {
+        var offsetMatch = inputStream.match(/^([+-])?(\d+)/);
+        if (offsetMatch) {
+          var offset = parseInt(offsetMatch[2], 10);
+          if (offsetMatch[1] == "-") {
+            line -= offset;
+          } else {
+            line += offset;
+          }
+        }
+        return line;
+      },
+      parseCommandArgs_: function(inputStream, params, command) {
+        if (inputStream.eol()) {
+          return;
+        }
+        params.argString = inputStream.match(/.*/)[0];
+        // Parse command-line arguments
+        var delim = command.argDelimiter || /\s+/;
+        var args = trim(params.argString).split(delim);
+        if (args.length && args[0]) {
+          params.args = args;
+        }
+      },
+      matchCommand_: function(commandName) {
+        // Return the command in the command map that matches the shortest
+        // prefix of the passed in command name. The match is guaranteed to be
+        // unambiguous if the defaultExCommandMap's shortNames are set up
+        // correctly. (see @code{defaultExCommandMap}).
+        for (var i = commandName.length; i > 0; i--) {
+          var prefix = commandName.substring(0, i);
+          if (this.commandMap_[prefix]) {
+            var command = this.commandMap_[prefix];
+            if (command.name.indexOf(commandName) === 0) {
+              return command;
+            }
+          }
+        }
+        return null;
+      },
+      buildCommandMap_: function() {
+        this.commandMap_ = {};
+        for (var i = 0; i < defaultExCommandMap.length; i++) {
+          var command = defaultExCommandMap[i];
+          var key = command.shortName || command.name;
+          this.commandMap_[key] = command;
+        }
+      },
+      map: function(lhs, rhs, ctx) {
+        if (lhs != ':' && lhs.charAt(0) == ':') {
+          if (ctx) { throw Error('Mode not supported for ex mappings'); }
+          var commandName = lhs.substring(1);
+          if (rhs != ':' && rhs.charAt(0) == ':') {
+            // Ex to Ex mapping
+            this.commandMap_[commandName] = {
+              name: commandName,
+              type: 'exToEx',
+              toInput: rhs.substring(1),
+              user: true
+            };
+          } else {
+            // Ex to key mapping
+            this.commandMap_[commandName] = {
+              name: commandName,
+              type: 'exToKey',
+              toKeys: rhs,
+              user: true
+            };
+          }
+        } else {
+          if (rhs != ':' && rhs.charAt(0) == ':') {
+            // Key to Ex mapping.
+            var mapping = {
+              keys: lhs,
+              type: 'keyToEx',
+              exArgs: { input: rhs.substring(1) }
+            };
+            if (ctx) { mapping.context = ctx; }
+            defaultKeymap.unshift(mapping);
+          } else {
+            // Key to key mapping
+            var mapping = {
+              keys: lhs,
+              type: 'keyToKey',
+              toKeys: rhs
+            };
+            if (ctx) { mapping.context = ctx; }
+            defaultKeymap.unshift(mapping);
+          }
+        }
+      },
+      unmap: function(lhs, ctx) {
+        if (lhs != ':' && lhs.charAt(0) == ':') {
+          // Ex to Ex or Ex to key mapping
+          if (ctx) { throw Error('Mode not supported for ex mappings'); }
+          var commandName = lhs.substring(1);
+          if (this.commandMap_[commandName] && this.commandMap_[commandName].user) {
+            delete this.commandMap_[commandName];
+            return true;
+          }
+        } else {
+          // Key to Ex or key to key mapping
+          var keys = lhs;
+          for (var i = 0; i < defaultKeymap.length; i++) {
+            if (keys == defaultKeymap[i].keys
+                && defaultKeymap[i].context === ctx) {
+              defaultKeymap.splice(i, 1);
+              return true;
+            }
+          }
+        }
+      }
+    };
+
+    var exCommands = {
+      colorscheme: function(cm, params) {
+        if (!params.args || params.args.length < 1) {
+          showConfirm(cm, cm.getOption('theme'));
+          return;
+        }
+        cm.setOption('theme', params.args[0]);
+      },
+      map: function(cm, params, ctx) {
+        var mapArgs = params.args;
+        if (!mapArgs || mapArgs.length < 2) {
+          if (cm) {
+            showConfirm(cm, 'Invalid mapping: ' + params.input);
+          }
+          return;
+        }
+        exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx);
+      },
+      imap: function(cm, params) { this.map(cm, params, 'insert'); },
+      nmap: function(cm, params) { this.map(cm, params, 'normal'); },
+      vmap: function(cm, params) { this.map(cm, params, 'visual'); },
+      unmap: function(cm, params, ctx) {
+        var mapArgs = params.args;
+        if (!mapArgs || mapArgs.length < 1 || !exCommandDispatcher.unmap(mapArgs[0], ctx)) {
+          if (cm) {
+            showConfirm(cm, 'No such mapping: ' + params.input);
+          }
+        }
+      },
+      move: function(cm, params) {
+        commandDispatcher.processCommand(cm, cm.state.vim, {
+            type: 'motion',
+            motion: 'moveToLineOrEdgeOfDocument',
+            motionArgs: { forward: false, explicitRepeat: true,
+              linewise: true },
+            repeatOverride: params.line+1});
+      },
+      set: function(cm, params) {
+        var setArgs = params.args;
+        // Options passed through to the setOption/getOption calls. May be passed in by the
+        // local/global versions of the set command
+        var setCfg = params.setCfg || {};
+        if (!setArgs || setArgs.length < 1) {
+          if (cm) {
+            showConfirm(cm, 'Invalid mapping: ' + params.input);
+          }
+          return;
+        }
+        var expr = setArgs[0].split('=');
+        var optionName = expr[0];
+        var value = expr[1];
+        var forceGet = false;
+
+        if (optionName.charAt(optionName.length - 1) == '?') {
+          // If post-fixed with ?, then the set is actually a get.
+          if (value) { throw Error('Trailing characters: ' + params.argString); }
+          optionName = optionName.substring(0, optionName.length - 1);
+          forceGet = true;
+        }
+        if (value === undefined && optionName.substring(0, 2) == 'no') {
+          // To set boolean options to false, the option name is prefixed with
+          // 'no'.
+          optionName = optionName.substring(2);
+          value = false;
+        }
+
+        var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean';
+        if (optionIsBoolean && value == undefined) {
+          // Calling set with a boolean option sets it to true.
+          value = true;
+        }
+        // If no value is provided, then we assume this is a get.
+        if (!optionIsBoolean && value === undefined || forceGet) {
+          var oldValue = getOption(optionName, cm, setCfg);
+          if (oldValue instanceof Error) {
+            showConfirm(cm, oldValue.message);
+          } else if (oldValue === true || oldValue === false) {
+            showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName);
+          } else {
+            showConfirm(cm, '  ' + optionName + '=' + oldValue);
+          }
+        } else {
+          var setOptionReturn = setOption(optionName, value, cm, setCfg);
+          if (setOptionReturn instanceof Error) {
+            showConfirm(cm, setOptionReturn.message);
+          }
+        }
+      },
+      setlocal: function (cm, params) {
+        // setCfg is passed through to setOption
+        params.setCfg = {scope: 'local'};
+        this.set(cm, params);
+      },
+      setglobal: function (cm, params) {
+        // setCfg is passed through to setOption
+        params.setCfg = {scope: 'global'};
+        this.set(cm, params);
+      },
+      registers: function(cm, params) {
+        var regArgs = params.args;
+        var registers = vimGlobalState.registerController.registers;
+        var regInfo = '----------Registers----------\n\n';
+        if (!regArgs) {
+          for (var registerName in registers) {
+            var text = registers[registerName].toString();
+            if (text.length) {
+              regInfo += '"' + registerName + '    ' + text + '\n';
+            }
+          }
+        } else {
+          var registerName;
+          regArgs = regArgs.join('');
+          for (var i = 0; i < regArgs.length; i++) {
+            registerName = regArgs.charAt(i);
+            if (!vimGlobalState.registerController.isValidRegister(registerName)) {
+              continue;
+            }
+            var register = registers[registerName] || new Register();
+            regInfo += '"' + registerName + '    ' + register.toString() + '\n';
+          }
+        }
+        showConfirm(cm, regInfo);
+      },
+      sort: function(cm, params) {
+        var reverse, ignoreCase, unique, number, pattern;
+        function parseArgs() {
+          if (params.argString) {
+            var args = new CodeMirror.StringStream(params.argString);
+            if (args.eat('!')) { reverse = true; }
+            if (args.eol()) { return; }
+            if (!args.eatSpace()) { return 'Invalid arguments'; }
+            var opts = args.match(/([dinuox]+)?\s*(\/.+\/)?\s*/);
+            if (!opts && !args.eol()) { return 'Invalid arguments'; }
+            if (opts[1]) {
+              ignoreCase = opts[1].indexOf('i') != -1;
+              unique = opts[1].indexOf('u') != -1;
+              var decimal = opts[1].indexOf('d') != -1 || opts[1].indexOf('n') != -1 && 1;
+              var hex = opts[1].indexOf('x') != -1 && 1;
+              var octal = opts[1].indexOf('o') != -1 && 1;
+              if (decimal + hex + octal > 1) { return 'Invalid arguments'; }
+              number = decimal && 'decimal' || hex && 'hex' || octal && 'octal';
+            }
+            if (opts[2]) {
+              pattern = new RegExp(opts[2].substr(1, opts[2].length - 2), ignoreCase ? 'i' : '');
+            }
+          }
+        }
+        var err = parseArgs();
+        if (err) {
+          showConfirm(cm, err + ': ' + params.argString);
+          return;
+        }
+        var lineStart = params.line || cm.firstLine();
+        var lineEnd = params.lineEnd || params.line || cm.lastLine();
+        if (lineStart == lineEnd) { return; }
+        var curStart = new Pos(lineStart, 0);
+        var curEnd = new Pos(lineEnd, lineLength(cm, lineEnd));
+        var text = cm.getRange(curStart, curEnd).split('\n');
+        var numberRegex = pattern ? pattern :
+           (number == 'decimal') ? /(-?)([\d]+)/ :
+           (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i :
+           (number == 'octal') ? /([0-7]+)/ : null;
+        var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null;
+        var numPart = [], textPart = [];
+        if (number || pattern) {
+          for (var i = 0; i < text.length; i++) {
+            var matchPart = pattern ? text[i].match(pattern) : null;
+            if (matchPart && matchPart[0] != '') {
+              numPart.push(matchPart);
+            } else if (!pattern && numberRegex.exec(text[i])) {
+              numPart.push(text[i]);
+            } else {
+              textPart.push(text[i]);
+            }
+          }
+        } else {
+          textPart = text;
+        }
+        function compareFn(a, b) {
+          if (reverse) { var tmp; tmp = a; a = b; b = tmp; }
+          if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); }
+          var anum = number && numberRegex.exec(a);
+          var bnum = number && numberRegex.exec(b);
+          if (!anum) { return a < b ? -1 : 1; }
+          anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix);
+          bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix);
+          return anum - bnum;
+        }
+        function comparePatternFn(a, b) {
+          if (reverse) { var tmp; tmp = a; a = b; b = tmp; }
+          if (ignoreCase) { a[0] = a[0].toLowerCase(); b[0] = b[0].toLowerCase(); }
+          return (a[0] < b[0]) ? -1 : 1;
+        }
+        numPart.sort(pattern ? comparePatternFn : compareFn);
+        if (pattern) {
+          for (var i = 0; i < numPart.length; i++) {
+            numPart[i] = numPart[i].input;
+          }
+        } else if (!number) { textPart.sort(compareFn); }
+        text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart);
+        if (unique) { // Remove duplicate lines
+          var textOld = text;
+          var lastLine;
+          text = [];
+          for (var i = 0; i < textOld.length; i++) {
+            if (textOld[i] != lastLine) {
+              text.push(textOld[i]);
+            }
+            lastLine = textOld[i];
+          }
+        }
+        cm.replaceRange(text.join('\n'), curStart, curEnd);
+      },
+      vglobal: function(cm, params) {
+        // global inspects params.commandName
+        this.global(cm, params);
+      },
+      global: function(cm, params) {
+        // a global command is of the form
+        // :[range]g/pattern/[cmd]
+        // argString holds the string /pattern/[cmd]
+        var argString = params.argString;
+        if (!argString) {
+          showConfirm(cm, 'Regular Expression missing from global');
+          return;
+        }
+        var inverted = params.commandName[0] === 'v';
+        // range is specified here
+        var lineStart = (params.line !== undefined) ? params.line : cm.firstLine();
+        var lineEnd = params.lineEnd || params.line || cm.lastLine();
+        // get the tokens from argString
+        var tokens = splitBySlash(argString);
+        var regexPart = argString, cmd;
+        if (tokens.length) {
+          regexPart = tokens[0];
+          cmd = tokens.slice(1, tokens.length).join('/');
+        }
+        if (regexPart) {
+          // If regex part is empty, then use the previous query. Otherwise
+          // use the regex part as the new query.
+          try {
+           updateSearchQuery(cm, regexPart, true /** ignoreCase */,
+             true /** smartCase */);
+          } catch (e) {
+           showConfirm(cm, 'Invalid regex: ' + regexPart);
+           return;
+          }
+        }
+        // now that we have the regexPart, search for regex matches in the
+        // specified range of lines
+        var query = getSearchState(cm).getQuery();
+        var matchedLines = [];
+        for (var i = lineStart; i <= lineEnd; i++) {
+          var line = cm.getLineHandle(i);
+          var matched = query.test(line.text);
+          if (matched !== inverted) {
+            matchedLines.push(cmd ? line : line.text);
+          }
+        }
+        // if there is no [cmd], just display the list of matched lines
+        if (!cmd) {
+          showConfirm(cm, matchedLines.join('\n'));
+          return;
+        }
+        var index = 0;
+        var nextCommand = function() {
+          if (index < matchedLines.length) {
+            var line = matchedLines[index++];
+            var lineNum = cm.getLineNumber(line);
+            if (lineNum == null) {
+              nextCommand();
+              return;
+            }
+            var command = (lineNum + 1) + cmd;
+            exCommandDispatcher.processCommand(cm, command, {
+              callback: nextCommand
+            });
+          }
+        };
+        nextCommand();
+      },
+      substitute: function(cm, params) {
+        if (!cm.getSearchCursor) {
+          throw new Error('Search feature not available. Requires searchcursor.js or ' +
+              'any other getSearchCursor implementation.');
+        }
+        var argString = params.argString;
+        var tokens = argString ? splitBySeparator(argString, argString[0]) : [];
+        var regexPart, replacePart = '', trailing, flagsPart, count;
+        var confirm = false; // Whether to confirm each replace.
+        var global = false; // True to replace all instances on a line, false to replace only 1.
+        if (tokens.length) {
+          regexPart = tokens[0];
+          if (getOption('pcre') && regexPart !== '') {
+              regexPart = new RegExp(regexPart).source; //normalize not escaped characters
+          }
+          replacePart = tokens[1];
+          if (replacePart !== undefined) {
+            if (getOption('pcre')) {
+              replacePart = unescapeRegexReplace(replacePart.replace(/([^\\])&/g,"$1$$&"));
+            } else {
+              replacePart = translateRegexReplace(replacePart);
+            }
+            vimGlobalState.lastSubstituteReplacePart = replacePart;
+          }
+          trailing = tokens[2] ? tokens[2].split(' ') : [];
+        } else {
+          // either the argString is empty or its of the form ' hello/world'
+          // actually splitBySlash returns a list of tokens
+          // only if the string starts with a '/'
+          if (argString && argString.length) {
+            showConfirm(cm, 'Substitutions should be of the form ' +
+                ':s/pattern/replace/');
+            return;
+          }
+        }
+        // After the 3rd slash, we can have flags followed by a space followed
+        // by count.
+        if (trailing) {
+          flagsPart = trailing[0];
+          count = parseInt(trailing[1]);
+          if (flagsPart) {
+            if (flagsPart.indexOf('c') != -1) {
+              confirm = true;
+            }
+            if (flagsPart.indexOf('g') != -1) {
+              global = true;
+            }
+            if (getOption('pcre')) {
+               regexPart = regexPart + '/' + flagsPart;
+            } else {
+               regexPart = regexPart.replace(/\//g, "\\/") + '/' + flagsPart;
+            }
+          }
+        }
+        if (regexPart) {
+          // If regex part is empty, then use the previous query. Otherwise use
+          // the regex part as the new query.
+          try {
+            updateSearchQuery(cm, regexPart, true /** ignoreCase */,
+              true /** smartCase */);
+          } catch (e) {
+            showConfirm(cm, 'Invalid regex: ' + regexPart);
+            return;
+          }
+        }
+        replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart;
+        if (replacePart === undefined) {
+          showConfirm(cm, 'No previous substitute regular expression');
+          return;
+        }
+        var state = getSearchState(cm);
+        var query = state.getQuery();
+        var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line;
+        var lineEnd = params.lineEnd || lineStart;
+        if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) {
+          lineEnd = Infinity;
+        }
+        if (count) {
+          lineStart = lineEnd;
+          lineEnd = lineStart + count - 1;
+        }
+        var startPos = clipCursorToContent(cm, new Pos(lineStart, 0));
+        var cursor = cm.getSearchCursor(query, startPos);
+        doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback);
+      },
+      redo: CodeMirror.commands.redo,
+      undo: CodeMirror.commands.undo,
+      write: function(cm) {
+        if (CodeMirror.commands.save) {
+          // If a save command is defined, call it.
+          CodeMirror.commands.save(cm);
+        } else if (cm.save) {
+          // Saves to text area if no save command is defined and cm.save() is available.
+          cm.save();
+        }
+      },
+      nohlsearch: function(cm) {
+        clearSearchHighlight(cm);
+      },
+      yank: function (cm) {
+        var cur = copyCursor(cm.getCursor());
+        var line = cur.line;
+        var lineText = cm.getLine(line);
+        vimGlobalState.registerController.pushText(
+          '0', 'yank', lineText, true, true);
+      },
+      delmarks: function(cm, params) {
+        if (!params.argString || !trim(params.argString)) {
+          showConfirm(cm, 'Argument required');
+          return;
+        }
+
+        var state = cm.state.vim;
+        var stream = new CodeMirror.StringStream(trim(params.argString));
+        while (!stream.eol()) {
+          stream.eatSpace();
+
+          // Record the streams position at the beginning of the loop for use
+          // in error messages.
+          var count = stream.pos;
+
+          if (!stream.match(/[a-zA-Z]/, false)) {
+            showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));
+            return;
+          }
+
+          var sym = stream.next();
+          // Check if this symbol is part of a range
+          if (stream.match('-', true)) {
+            // This symbol is part of a range.
+
+            // The range must terminate at an alphabetic character.
+            if (!stream.match(/[a-zA-Z]/, false)) {
+              showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));
+              return;
+            }
+
+            var startMark = sym;
+            var finishMark = stream.next();
+            // The range must terminate at an alphabetic character which
+            // shares the same case as the start of the range.
+            if (isLowerCase(startMark) && isLowerCase(finishMark) ||
+                isUpperCase(startMark) && isUpperCase(finishMark)) {
+              var start = startMark.charCodeAt(0);
+              var finish = finishMark.charCodeAt(0);
+              if (start >= finish) {
+                showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count));
+                return;
+              }
+
+              // Because marks are always ASCII values, and we have
+              // determined that they are the same case, we can use
+              // their char codes to iterate through the defined range.
+              for (var j = 0; j <= finish - start; j++) {
+                var mark = String.fromCharCode(start + j);
+                delete state.marks[mark];
+              }
+            } else {
+              showConfirm(cm, 'Invalid argument: ' + startMark + '-');
+              return;
+            }
+          } else {
+            // This symbol is a valid mark, and is not part of a range.
+            delete state.marks[sym];
+          }
+        }
+      }
+    };
+
+    var exCommandDispatcher = new ExCommandDispatcher();
+
+    /**
+    * @param {CodeMirror} cm CodeMirror instance we are in.
+    * @param {boolean} confirm Whether to confirm each replace.
+    * @param {Cursor} lineStart Line to start replacing from.
+    * @param {Cursor} lineEnd Line to stop replacing at.
+    * @param {RegExp} query Query for performing matches with.
+    * @param {string} replaceWith Text to replace matches with. May contain $1,
+    *     $2, etc for replacing captured groups using JavaScript replace.
+    * @param {function()} callback A callback for when the replace is done.
+    */
+    function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query,
+        replaceWith, callback) {
+      // Set up all the functions.
+      cm.state.vim.exMode = true;
+      var done = false;
+      var lastPos, modifiedLineNumber, joined;
+      function replaceAll() {
+        cm.operation(function() {
+          while (!done) {
+            replace();
+            next();
+          }
+          stop();
+        });
+      }
+      function replace() {
+        var text = cm.getRange(searchCursor.from(), searchCursor.to());
+        var newText = text.replace(query, replaceWith);
+        var unmodifiedLineNumber = searchCursor.to().line;
+        searchCursor.replace(newText);
+        modifiedLineNumber = searchCursor.to().line;
+        lineEnd += modifiedLineNumber - unmodifiedLineNumber;
+        joined = modifiedLineNumber < unmodifiedLineNumber;
+      }
+      function findNextValidMatch() {
+        var lastMatchTo = lastPos && copyCursor(searchCursor.to());
+        var match = searchCursor.findNext();
+        if (match && !match[0] && lastMatchTo && cursorEqual(searchCursor.from(), lastMatchTo)) {
+          match = searchCursor.findNext();
+        }
+        return match;
+      }
+      function next() {
+        // The below only loops to skip over multiple occurrences on the same
+        // line when 'global' is not true.
+        while(findNextValidMatch() &&
+              isInRange(searchCursor.from(), lineStart, lineEnd)) {
+          if (!global && searchCursor.from().line == modifiedLineNumber && !joined) {
+            continue;
+          }
+          cm.scrollIntoView(searchCursor.from(), 30);
+          cm.setSelection(searchCursor.from(), searchCursor.to());
+          lastPos = searchCursor.from();
+          done = false;
+          return;
+        }
+        done = true;
+      }
+      function stop(close) {
+        if (close) { close(); }
+        cm.focus();
+        if (lastPos) {
+          cm.setCursor(lastPos);
+          var vim = cm.state.vim;
+          vim.exMode = false;
+          vim.lastHPos = vim.lastHSPos = lastPos.ch;
+        }
+        if (callback) { callback(); }
+      }
+      function onPromptKeyDown(e, _value, close) {
+        // Swallow all keys.
+        CodeMirror.e_stop(e);
+        var keyName = CodeMirror.keyName(e);
+        switch (keyName) {
+          case 'Y':
+            replace(); next(); break;
+          case 'N':
+            next(); break;
+          case 'A':
+            // replaceAll contains a call to close of its own. We don't want it
+            // to fire too early or multiple times.
+            var savedCallback = callback;
+            callback = undefined;
+            cm.operation(replaceAll);
+            callback = savedCallback;
+            break;
+          case 'L':
+            replace();
+            // fall through and exit.
+          case 'Q':
+          case 'Esc':
+          case 'Ctrl-C':
+          case 'Ctrl-[':
+            stop(close);
+            break;
+        }
+        if (done) { stop(close); }
+        return true;
+      }
+
+      // Actually do replace.
+      next();
+      if (done) {
+        showConfirm(cm, 'No matches for ' + query.source);
+        return;
+      }
+      if (!confirm) {
+        replaceAll();
+        if (callback) { callback(); }
+        return;
+      }
+      showPrompt(cm, {
+        prefix: dom('span', 'replace with ', dom('strong', replaceWith), ' (y/n/a/q/l)'),
+        onKeyDown: onPromptKeyDown
+      });
+    }
+
+    CodeMirror.keyMap.vim = {
+      attach: attachVimMap,
+      detach: detachVimMap,
+      call: cmKey
+    };
+
+    function exitInsertMode(cm) {
+      var vim = cm.state.vim;
+      var macroModeState = vimGlobalState.macroModeState;
+      var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.');
+      var isPlaying = macroModeState.isPlaying;
+      var lastChange = macroModeState.lastInsertModeChanges;
+      if (!isPlaying) {
+        cm.off('change', onChange);
+        CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown);
+      }
+      if (!isPlaying && vim.insertModeRepeat > 1) {
+        // Perform insert mode repeat for commands like 3,a and 3,o.
+        repeatLastEdit(cm, vim, vim.insertModeRepeat - 1,
+            true /** repeatForInsert */);
+        vim.lastEditInputState.repeatOverride = vim.insertModeRepeat;
+      }
+      delete vim.insertModeRepeat;
+      vim.insertMode = false;
+      cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1);
+      cm.setOption('keyMap', 'vim');
+      cm.setOption('disableInput', true);
+      cm.toggleOverwrite(false); // exit replace mode if we were in it.
+      // update the ". register before exiting insert mode
+      insertModeChangeRegister.setText(lastChange.changes.join(''));
+      CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"});
+      if (macroModeState.isRecording) {
+        logInsertModeChange(macroModeState);
+      }
+    }
+
+    function _mapCommand(command) {
+      defaultKeymap.unshift(command);
+    }
+
+    function mapCommand(keys, type, name, args, extra) {
+      var command = {keys: keys, type: type};
+      command[type] = name;
+      command[type + "Args"] = args;
+      for (var key in extra)
+        command[key] = extra[key];
+      _mapCommand(command);
+    }
+
+    // The timeout in milliseconds for the two-character ESC keymap should be
+    // adjusted according to your typing speed to prevent false positives.
+    defineOption('insertModeEscKeysTimeout', 200, 'number');
+
+    CodeMirror.keyMap['vim-insert'] = {
+      // TODO: override navigation keys so that Esc will cancel automatic
+      // indentation from o, O, i_<CR>
+      fallthrough: ['default'],
+      attach: attachVimMap,
+      detach: detachVimMap,
+      call: cmKey
+    };
+
+    CodeMirror.keyMap['vim-replace'] = {
+      'Backspace': 'goCharLeft',
+      fallthrough: ['vim-insert'],
+      attach: attachVimMap,
+      detach: detachVimMap,
+      call: cmKey
+    };
+
+    function executeMacroRegister(cm, vim, macroModeState, registerName) {
+      var register = vimGlobalState.registerController.getRegister(registerName);
+      if (registerName == ':') {
+        // Read-only register containing last Ex command.
+        if (register.keyBuffer[0]) {
+          exCommandDispatcher.processCommand(cm, register.keyBuffer[0]);
+        }
+        macroModeState.isPlaying = false;
+        return;
+      }
+      var keyBuffer = register.keyBuffer;
+      var imc = 0;
+      macroModeState.isPlaying = true;
+      macroModeState.replaySearchQueries = register.searchQueries.slice(0);
+      for (var i = 0; i < keyBuffer.length; i++) {
+        var text = keyBuffer[i];
+        var match, key;
+        while (text) {
+          // Pull off one command key, which is either a single character
+          // or a special sequence wrapped in '<' and '>', e.g. '<Space>'.
+          match = (/<\w+-.+?>|<\w+>|./).exec(text);
+          key = match[0];
+          text = text.substring(match.index + key.length);
+          vimApi.handleKey(cm, key, 'macro');
+          if (vim.insertMode) {
+            var changes = register.insertModeChanges[imc++].changes;
+            vimGlobalState.macroModeState.lastInsertModeChanges.changes =
+                changes;
+            repeatInsertModeChanges(cm, changes, 1);
+            exitInsertMode(cm);
+          }
+        }
+      }
+      macroModeState.isPlaying = false;
+    }
+
+    function logKey(macroModeState, key) {
+      if (macroModeState.isPlaying) { return; }
+      var registerName = macroModeState.latestRegister;
+      var register = vimGlobalState.registerController.getRegister(registerName);
+      if (register) {
+        register.pushText(key);
+      }
+    }
+
+    function logInsertModeChange(macroModeState) {
+      if (macroModeState.isPlaying) { return; }
+      var registerName = macroModeState.latestRegister;
+      var register = vimGlobalState.registerController.getRegister(registerName);
+      if (register && register.pushInsertModeChanges) {
+        register.pushInsertModeChanges(macroModeState.lastInsertModeChanges);
+      }
+    }
+
+    function logSearchQuery(macroModeState, query) {
+      if (macroModeState.isPlaying) { return; }
+      var registerName = macroModeState.latestRegister;
+      var register = vimGlobalState.registerController.getRegister(registerName);
+      if (register && register.pushSearchQuery) {
+        register.pushSearchQuery(query);
+      }
+    }
+
+    /**
+     * Listens for changes made in insert mode.
+     * Should only be active in insert mode.
+     */
+    function onChange(cm, changeObj) {
+      var macroModeState = vimGlobalState.macroModeState;
+      var lastChange = macroModeState.lastInsertModeChanges;
+      if (!macroModeState.isPlaying) {
+        while(changeObj) {
+          lastChange.expectCursorActivityForChange = true;
+          if (lastChange.ignoreCount > 1) {
+            lastChange.ignoreCount--;
+          } else if (changeObj.origin == '+input' || changeObj.origin == 'paste'
+              || changeObj.origin === undefined /* only in testing */) {
+            var selectionCount = cm.listSelections().length;
+            if (selectionCount > 1)
+              lastChange.ignoreCount = selectionCount;
+            var text = changeObj.text.join('\n');
+            if (lastChange.maybeReset) {
+              lastChange.changes = [];
+              lastChange.maybeReset = false;
+            }
+            if (text) {
+              if (cm.state.overwrite && !/\n/.test(text)) {
+                lastChange.changes.push([text]);
+              } else {
+                lastChange.changes.push(text);
+              }
+            }
+          }
+          // Change objects may be chained with next.
+          changeObj = changeObj.next;
+        }
+      }
+    }
+
+    /**
+    * Listens for any kind of cursor activity on CodeMirror.
+    */
+    function onCursorActivity(cm) {
+      var vim = cm.state.vim;
+      if (vim.insertMode) {
+        // Tracking cursor activity in insert mode (for macro support).
+        var macroModeState = vimGlobalState.macroModeState;
+        if (macroModeState.isPlaying) { return; }
+        var lastChange = macroModeState.lastInsertModeChanges;
+        if (lastChange.expectCursorActivityForChange) {
+          lastChange.expectCursorActivityForChange = false;
+        } else {
+          // Cursor moved outside the context of an edit. Reset the change.
+          lastChange.maybeReset = true;
+        }
+      } else if (!cm.curOp.isVimOp) {
+        handleExternalSelection(cm, vim);
+      }
+    }
+    function handleExternalSelection(cm, vim) {
+      var anchor = cm.getCursor('anchor');
+      var head = cm.getCursor('head');
+      // Enter or exit visual mode to match mouse selection.
+      if (vim.visualMode && !cm.somethingSelected()) {
+        exitVisualMode(cm, false);
+      } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) {
+        vim.visualMode = true;
+        vim.visualLine = false;
+        CodeMirror.signal(cm, "vim-mode-change", {mode: "visual"});
+      }
+      if (vim.visualMode) {
+        // Bind CodeMirror selection model to vim selection model.
+        // Mouse selections are considered visual characterwise.
+        var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;
+        var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;
+        head = offsetCursor(head, 0, headOffset);
+        anchor = offsetCursor(anchor, 0, anchorOffset);
+        vim.sel = {
+          anchor: anchor,
+          head: head
+        };
+        updateMark(cm, vim, '<', cursorMin(head, anchor));
+        updateMark(cm, vim, '>', cursorMax(head, anchor));
+      } else if (!vim.insertMode) {
+        // Reset lastHPos if selection was modified by something outside of vim mode e.g. by mouse.
+        vim.lastHPos = cm.getCursor().ch;
+      }
+    }
+
+    /** Wrapper for special keys pressed in insert mode */
+    function InsertModeKey(keyName) {
+      this.keyName = keyName;
+    }
+
+    /**
+    * Handles raw key down events from the text area.
+    * - Should only be active in insert mode.
+    * - For recording deletes in insert mode.
+    */
+    function onKeyEventTargetKeyDown(e) {
+      var macroModeState = vimGlobalState.macroModeState;
+      var lastChange = macroModeState.lastInsertModeChanges;
+      var keyName = CodeMirror.keyName(e);
+      if (!keyName) { return; }
+      function onKeyFound() {
+        if (lastChange.maybeReset) {
+          lastChange.changes = [];
+          lastChange.maybeReset = false;
+        }
+        lastChange.changes.push(new InsertModeKey(keyName));
+        return true;
+      }
+      if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) {
+        CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound);
+      }
+    }
+
+    /**
+     * Repeats the last edit, which includes exactly 1 command and at most 1
+     * insert. Operator and motion commands are read from lastEditInputState,
+     * while action commands are read from lastEditActionCommand.
+     *
+     * If repeatForInsert is true, then the function was called by
+     * exitInsertMode to repeat the insert mode changes the user just made. The
+     * corresponding enterInsertMode call was made with a count.
+     */
+    function repeatLastEdit(cm, vim, repeat, repeatForInsert) {
+      var macroModeState = vimGlobalState.macroModeState;
+      macroModeState.isPlaying = true;
+      var isAction = !!vim.lastEditActionCommand;
+      var cachedInputState = vim.inputState;
+      function repeatCommand() {
+        if (isAction) {
+          commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand);
+        } else {
+          commandDispatcher.evalInput(cm, vim);
+        }
+      }
+      function repeatInsert(repeat) {
+        if (macroModeState.lastInsertModeChanges.changes.length > 0) {
+          // For some reason, repeat cw in desktop VIM does not repeat
+          // insert mode changes. Will conform to that behavior.
+          repeat = !vim.lastEditActionCommand ? 1 : repeat;
+          var changeObject = macroModeState.lastInsertModeChanges;
+          repeatInsertModeChanges(cm, changeObject.changes, repeat);
+        }
+      }
+      vim.inputState = vim.lastEditInputState;
+      if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) {
+        // o and O repeat have to be interlaced with insert repeats so that the
+        // insertions appear on separate lines instead of the last line.
+        for (var i = 0; i < repeat; i++) {
+          repeatCommand();
+          repeatInsert(1);
+        }
+      } else {
+        if (!repeatForInsert) {
+          // Hack to get the cursor to end up at the right place. If I is
+          // repeated in insert mode repeat, cursor will be 1 insert
+          // change set left of where it should be.
+          repeatCommand();
+        }
+        repeatInsert(repeat);
+      }
+      vim.inputState = cachedInputState;
+      if (vim.insertMode && !repeatForInsert) {
+        // Don't exit insert mode twice. If repeatForInsert is set, then we
+        // were called by an exitInsertMode call lower on the stack.
+        exitInsertMode(cm);
+      }
+      macroModeState.isPlaying = false;
+    }
+
+    function repeatInsertModeChanges(cm, changes, repeat) {
+      function keyHandler(binding) {
+        if (typeof binding == 'string') {
+          CodeMirror.commands[binding](cm);
+        } else {
+          binding(cm);
+        }
+        return true;
+      }
+      var head = cm.getCursor('head');
+      var visualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.visualBlock;
+      if (visualBlock) {
+        // Set up block selection again for repeating the changes.
+        selectForInsert(cm, head, visualBlock + 1);
+        repeat = cm.listSelections().length;
+        cm.setCursor(head);
+      }
+      for (var i = 0; i < repeat; i++) {
+        if (visualBlock) {
+          cm.setCursor(offsetCursor(head, i, 0));
+        }
+        for (var j = 0; j < changes.length; j++) {
+          var change = changes[j];
+          if (change instanceof InsertModeKey) {
+            CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler);
+          } else if (typeof change == "string") {
+            cm.replaceSelection(change);
+          } else {
+            var start = cm.getCursor();
+            var end = offsetCursor(start, 0, change[0].length);
+            cm.replaceRange(change[0], start, end);
+            cm.setCursor(end);
+          }
+        }
+      }
+      if (visualBlock) {
+        cm.setCursor(offsetCursor(head, 0, 1));
+      }
+    }
+
+    // multiselect support
+    function cloneVimState(state) {
+      var n = new state.constructor();
+      Object.keys(state).forEach(function(key) {
+        var o = state[key];
+        if (Array.isArray(o))
+          o = o.slice();
+        else if (o && typeof o == "object" && o.constructor != Object)
+          o = cloneVimState(o);
+        n[key] = o;
+      });
+      if (state.sel) {
+        n.sel = {
+          head: state.sel.head && copyCursor(state.sel.head),
+          anchor: state.sel.anchor && copyCursor(state.sel.anchor)
+        };
+      }
+      return n;
+    }
+    function multiSelectHandleKey(cm, key, origin) {
+      var isHandled = false;
+      var vim = vimApi.maybeInitVimState_(cm);
+      var visualBlock = vim.visualBlock || vim.wasInVisualBlock;
+
+      var wasMultiselect = cm.isInMultiSelectMode();
+      if (vim.wasInVisualBlock && !wasMultiselect) {
+        vim.wasInVisualBlock = false;
+      } else if (wasMultiselect && vim.visualBlock) {
+         vim.wasInVisualBlock = true;
+      }
+
+      if (key == '<Esc>' && !vim.insertMode && !vim.visualMode && wasMultiselect && vim.status == "<Esc>") {
+        // allow editor to exit multiselect
+        clearInputState(cm);
+      } else if (visualBlock || !wasMultiselect || cm.inVirtualSelectionMode) {
+        isHandled = vimApi.handleKey(cm, key, origin);
+      } else {
+        var old = cloneVimState(vim);
+
+        cm.operation(function() {
+          cm.curOp.isVimOp = true;
+          cm.forEachSelection(function() {
+            var head = cm.getCursor("head");
+            var anchor = cm.getCursor("anchor");
+            var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0;
+            var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0;
+            head = offsetCursor(head, 0, headOffset);
+            anchor = offsetCursor(anchor, 0, anchorOffset);
+            cm.state.vim.sel.head = head;
+            cm.state.vim.sel.anchor = anchor;
+
+            isHandled = vimApi.handleKey(cm, key, origin);
+            if (cm.virtualSelection) {
+              cm.state.vim = cloneVimState(old);
+            }
+          });
+          if (cm.curOp.cursorActivity && !isHandled)
+            cm.curOp.cursorActivity = false;
+          cm.state.vim = vim;
+        }, true);
+      }
+      // some commands may bring visualMode and selection out of sync
+      if (isHandled && !vim.visualMode && !vim.insert && vim.visualMode != cm.somethingSelected()) {
+        handleExternalSelection(cm, vim);
+      }
+      return isHandled;
+    }
+    resetVimGlobalState();
+
+  return vimApi;
+}
+
+function initVim(CodeMirror5) {
+  CodeMirror5.Vim = initVim$1(CodeMirror5);
+  return CodeMirror5.Vim;
+}
+
+
+
+    CodeMirror.Vim = initVim(CodeMirror);
+  });
+  
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/lib/codemirror.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,344 @@
+/* BASICS */
+
+.CodeMirror {
+  /* Set height, width, borders, and global font properties here */
+  font-family: monospace;
+  height: 300px;
+  color: black;
+  direction: ltr;
+}
+
+/* PADDING */
+
+.CodeMirror-lines {
+  padding: 4px 0; /* Vertical padding around content */
+}
+.CodeMirror pre.CodeMirror-line,
+.CodeMirror pre.CodeMirror-line-like {
+  padding: 0 4px; /* Horizontal padding of content */
+}
+
+.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
+  background-color: white; /* The little square between H and V scrollbars */
+}
+
+/* GUTTER */
+
+.CodeMirror-gutters {
+  border-right: 1px solid #ddd;
+  background-color: #f7f7f7;
+  white-space: nowrap;
+}
+.CodeMirror-linenumbers {}
+.CodeMirror-linenumber {
+  padding: 0 3px 0 5px;
+  min-width: 20px;
+  text-align: right;
+  color: #999;
+  white-space: nowrap;
+}
+
+.CodeMirror-guttermarker { color: black; }
+.CodeMirror-guttermarker-subtle { color: #999; }
+
+/* CURSOR */
+
+.CodeMirror-cursor {
+  border-left: 1px solid black;
+  border-right: none;
+  width: 0;
+}
+/* Shown when moving in bi-directional text */
+.CodeMirror div.CodeMirror-secondarycursor {
+  border-left: 1px solid silver;
+}
+.cm-fat-cursor .CodeMirror-cursor {
+  width: auto;
+  border: 0 !important;
+  background: #7e7;
+}
+.cm-fat-cursor div.CodeMirror-cursors {
+  z-index: 1;
+}
+.cm-fat-cursor .CodeMirror-line::selection,
+.cm-fat-cursor .CodeMirror-line > span::selection, 
+.cm-fat-cursor .CodeMirror-line > span > span::selection { background: transparent; }
+.cm-fat-cursor .CodeMirror-line::-moz-selection,
+.cm-fat-cursor .CodeMirror-line > span::-moz-selection,
+.cm-fat-cursor .CodeMirror-line > span > span::-moz-selection { background: transparent; }
+.cm-fat-cursor { caret-color: transparent; }
+@-moz-keyframes blink {
+  0% {}
+  50% { background-color: transparent; }
+  100% {}
+}
+@-webkit-keyframes blink {
+  0% {}
+  50% { background-color: transparent; }
+  100% {}
+}
+@keyframes blink {
+  0% {}
+  50% { background-color: transparent; }
+  100% {}
+}
+
+/* Can style cursor different in overwrite (non-insert) mode */
+.CodeMirror-overwrite .CodeMirror-cursor {}
+
+.cm-tab { display: inline-block; text-decoration: inherit; }
+
+.CodeMirror-rulers {
+  position: absolute;
+  left: 0; right: 0; top: -50px; bottom: 0;
+  overflow: hidden;
+}
+.CodeMirror-ruler {
+  border-left: 1px solid #ccc;
+  top: 0; bottom: 0;
+  position: absolute;
+}
+
+/* DEFAULT THEME */
+
+.cm-s-default .cm-header {color: blue;}
+.cm-s-default .cm-quote {color: #090;}
+.cm-negative {color: #d44;}
+.cm-positive {color: #292;}
+.cm-header, .cm-strong {font-weight: bold;}
+.cm-em {font-style: italic;}
+.cm-link {text-decoration: underline;}
+.cm-strikethrough {text-decoration: line-through;}
+
+.cm-s-default .cm-keyword {color: #708;}
+.cm-s-default .cm-atom {color: #219;}
+.cm-s-default .cm-number {color: #164;}
+.cm-s-default .cm-def {color: #00f;}
+.cm-s-default .cm-variable,
+.cm-s-default .cm-punctuation,
+.cm-s-default .cm-property,
+.cm-s-default .cm-operator {}
+.cm-s-default .cm-variable-2 {color: #05a;}
+.cm-s-default .cm-variable-3, .cm-s-default .cm-type {color: #085;}
+.cm-s-default .cm-comment {color: #a50;}
+.cm-s-default .cm-string {color: #a11;}
+.cm-s-default .cm-string-2 {color: #f50;}
+.cm-s-default .cm-meta {color: #555;}
+.cm-s-default .cm-qualifier {color: #555;}
+.cm-s-default .cm-builtin {color: #30a;}
+.cm-s-default .cm-bracket {color: #997;}
+.cm-s-default .cm-tag {color: #170;}
+.cm-s-default .cm-attribute {color: #00c;}
+.cm-s-default .cm-hr {color: #999;}
+.cm-s-default .cm-link {color: #00c;}
+
+.cm-s-default .cm-error {color: #f00;}
+.cm-invalidchar {color: #f00;}
+
+.CodeMirror-composing { border-bottom: 2px solid; }
+
+/* Default styles for common addons */
+
+div.CodeMirror span.CodeMirror-matchingbracket {color: #0b0;}
+div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #a22;}
+.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); }
+.CodeMirror-activeline-background {background: #e8f2ff;}
+
+/* STOP */
+
+/* The rest of this file contains styles related to the mechanics of
+   the editor. You probably shouldn't touch them. */
+
+.CodeMirror {
+  position: relative;
+  overflow: hidden;
+  background: white;
+}
+
+.CodeMirror-scroll {
+  overflow: scroll !important; /* Things will break if this is overridden */
+  /* 50px is the magic margin used to hide the element's real scrollbars */
+  /* See overflow: hidden in .CodeMirror */
+  margin-bottom: -50px; margin-right: -50px;
+  padding-bottom: 50px;
+  height: 100%;
+  outline: none; /* Prevent dragging from highlighting the element */
+  position: relative;
+  z-index: 0;
+}
+.CodeMirror-sizer {
+  position: relative;
+  border-right: 50px solid transparent;
+}
+
+/* The fake, visible scrollbars. Used to force redraw during scrolling
+   before actual scrolling happens, thus preventing shaking and
+   flickering artifacts. */
+.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler {
+  position: absolute;
+  z-index: 6;
+  display: none;
+  outline: none;
+}
+.CodeMirror-vscrollbar {
+  right: 0; top: 0;
+  overflow-x: hidden;
+  overflow-y: scroll;
+}
+.CodeMirror-hscrollbar {
+  bottom: 0; left: 0;
+  overflow-y: hidden;
+  overflow-x: scroll;
+}
+.CodeMirror-scrollbar-filler {
+  right: 0; bottom: 0;
+}
+.CodeMirror-gutter-filler {
+  left: 0; bottom: 0;
+}
+
+.CodeMirror-gutters {
+  position: absolute; left: 0; top: 0;
+  min-height: 100%;
+  z-index: 3;
+}
+.CodeMirror-gutter {
+  white-space: normal;
+  height: 100%;
+  display: inline-block;
+  vertical-align: top;
+  margin-bottom: -50px;
+}
+.CodeMirror-gutter-wrapper {
+  position: absolute;
+  z-index: 4;
+  background: none !important;
+  border: none !important;
+}
+.CodeMirror-gutter-background {
+  position: absolute;
+  top: 0; bottom: 0;
+  z-index: 4;
+}
+.CodeMirror-gutter-elt {
+  position: absolute;
+  cursor: default;
+  z-index: 4;
+}
+.CodeMirror-gutter-wrapper ::selection { background-color: transparent }
+.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent }
+
+.CodeMirror-lines {
+  cursor: text;
+  min-height: 1px; /* prevents collapsing before first draw */
+}
+.CodeMirror pre.CodeMirror-line,
+.CodeMirror pre.CodeMirror-line-like {
+  /* Reset some styles that the rest of the page might have set */
+  -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0;
+  border-width: 0;
+  background: transparent;
+  font-family: inherit;
+  font-size: inherit;
+  margin: 0;
+  white-space: pre;
+  word-wrap: normal;
+  line-height: inherit;
+  color: inherit;
+  z-index: 2;
+  position: relative;
+  overflow: visible;
+  -webkit-tap-highlight-color: transparent;
+  -webkit-font-variant-ligatures: contextual;
+  font-variant-ligatures: contextual;
+}
+.CodeMirror-wrap pre.CodeMirror-line,
+.CodeMirror-wrap pre.CodeMirror-line-like {
+  word-wrap: break-word;
+  white-space: pre-wrap;
+  word-break: normal;
+}
+
+.CodeMirror-linebackground {
+  position: absolute;
+  left: 0; right: 0; top: 0; bottom: 0;
+  z-index: 0;
+}
+
+.CodeMirror-linewidget {
+  position: relative;
+  z-index: 2;
+  padding: 0.1px; /* Force widget margins to stay inside of the container */
+}
+
+.CodeMirror-widget {}
+
+.CodeMirror-rtl pre { direction: rtl; }
+
+.CodeMirror-code {
+  outline: none;
+}
+
+/* Force content-box sizing for the elements where we expect it */
+.CodeMirror-scroll,
+.CodeMirror-sizer,
+.CodeMirror-gutter,
+.CodeMirror-gutters,
+.CodeMirror-linenumber {
+  -moz-box-sizing: content-box;
+  box-sizing: content-box;
+}
+
+.CodeMirror-measure {
+  position: absolute;
+  width: 100%;
+  height: 0;
+  overflow: hidden;
+  visibility: hidden;
+}
+
+.CodeMirror-cursor {
+  position: absolute;
+  pointer-events: none;
+}
+.CodeMirror-measure pre { position: static; }
+
+div.CodeMirror-cursors {
+  visibility: hidden;
+  position: relative;
+  z-index: 3;
+}
+div.CodeMirror-dragcursors {
+  visibility: visible;
+}
+
+.CodeMirror-focused div.CodeMirror-cursors {
+  visibility: visible;
+}
+
+.CodeMirror-selected { background: #d9d9d9; }
+.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; }
+.CodeMirror-crosshair { cursor: crosshair; }
+.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; }
+.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; }
+
+.cm-searching {
+  background-color: #ffa;
+  background-color: rgba(255, 255, 0, .4);
+}
+
+/* Used to force a border model for a node */
+.cm-force-border { padding-right: .1px; }
+
+@media print {
+  /* Hide the cursor when printing */
+  .CodeMirror div.CodeMirror-cursors {
+    visibility: hidden;
+  }
+}
+
+/* See issue #2901 */
+.cm-tab-wrap-hack:after { content: ''; }
+
+/* Help users use markselection to safely style text background */
+span.CodeMirror-selectedtext { background: none; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/lib/codemirror.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,9884 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// This is CodeMirror (https://codemirror.net/5), a code editor
+// implemented in JavaScript on top of the browser's DOM.
+//
+// You can find some technical background for some of the code below
+// at http://marijnhaverbeke.nl/blog/#cm-internals .
+
+(function (global, factory) {
+  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
+  typeof define === 'function' && define.amd ? define(factory) :
+  (global = global || self, global.CodeMirror = factory());
+}(this, (function () { 'use strict';
+
+  // Kludges for bugs and behavior differences that can't be feature
+  // detected are enabled based on userAgent etc sniffing.
+  var userAgent = navigator.userAgent;
+  var platform = navigator.platform;
+
+  var gecko = /gecko\/\d/i.test(userAgent);
+  var ie_upto10 = /MSIE \d/.test(userAgent);
+  var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
+  var edge = /Edge\/(\d+)/.exec(userAgent);
+  var ie = ie_upto10 || ie_11up || edge;
+  var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
+  var webkit = !edge && /WebKit\//.test(userAgent);
+  var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
+  var chrome = !edge && /Chrome\/(\d+)/.exec(userAgent);
+  var chrome_version = chrome && +chrome[1];
+  var presto = /Opera\//.test(userAgent);
+  var safari = /Apple Computer/.test(navigator.vendor);
+  var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
+  var phantom = /PhantomJS/.test(userAgent);
+
+  var ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2);
+  var android = /Android/.test(userAgent);
+  // This is woefully incomplete. Suggestions for alternative methods welcome.
+  var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
+  var mac = ios || /Mac/.test(platform);
+  var chromeOS = /\bCrOS\b/.test(userAgent);
+  var windows = /win/i.test(platform);
+
+  var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
+  if (presto_version) { presto_version = Number(presto_version[1]); }
+  if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
+  // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
+  var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
+  var captureRightClick = gecko || (ie && ie_version >= 9);
+
+  function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
+
+  var rmClass = function(node, cls) {
+    var current = node.className;
+    var match = classTest(cls).exec(current);
+    if (match) {
+      var after = current.slice(match.index + match[0].length);
+      node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
+    }
+  };
+
+  function removeChildren(e) {
+    for (var count = e.childNodes.length; count > 0; --count)
+      { e.removeChild(e.firstChild); }
+    return e
+  }
+
+  function removeChildrenAndAdd(parent, e) {
+    return removeChildren(parent).appendChild(e)
+  }
+
+  function elt(tag, content, className, style) {
+    var e = document.createElement(tag);
+    if (className) { e.className = className; }
+    if (style) { e.style.cssText = style; }
+    if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
+    else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
+    return e
+  }
+  // wrapper for elt, which removes the elt from the accessibility tree
+  function eltP(tag, content, className, style) {
+    var e = elt(tag, content, className, style);
+    e.setAttribute("role", "presentation");
+    return e
+  }
+
+  var range;
+  if (document.createRange) { range = function(node, start, end, endNode) {
+    var r = document.createRange();
+    r.setEnd(endNode || node, end);
+    r.setStart(node, start);
+    return r
+  }; }
+  else { range = function(node, start, end) {
+    var r = document.body.createTextRange();
+    try { r.moveToElementText(node.parentNode); }
+    catch(e) { return r }
+    r.collapse(true);
+    r.moveEnd("character", end);
+    r.moveStart("character", start);
+    return r
+  }; }
+
+  function contains(parent, child) {
+    if (child.nodeType == 3) // Android browser always returns false when child is a textnode
+      { child = child.parentNode; }
+    if (parent.contains)
+      { return parent.contains(child) }
+    do {
+      if (child.nodeType == 11) { child = child.host; }
+      if (child == parent) { return true }
+    } while (child = child.parentNode)
+  }
+
+  function activeElt(rootNode) {
+    // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
+    // IE < 10 will throw when accessed while the page is loading or in an iframe.
+    // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
+    var doc = rootNode.ownerDocument || rootNode;
+    var activeElement;
+    try {
+      activeElement = rootNode.activeElement;
+    } catch(e) {
+      activeElement = doc.body || null;
+    }
+    while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
+      { activeElement = activeElement.shadowRoot.activeElement; }
+    return activeElement
+  }
+
+  function addClass(node, cls) {
+    var current = node.className;
+    if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
+  }
+  function joinClasses(a, b) {
+    var as = a.split(" ");
+    for (var i = 0; i < as.length; i++)
+      { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
+    return b
+  }
+
+  var selectInput = function(node) { node.select(); };
+  if (ios) // Mobile Safari apparently has a bug where select() is broken.
+    { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
+  else if (ie) // Suppress mysterious IE10 errors
+    { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
+
+  function doc(cm) { return cm.display.wrapper.ownerDocument }
+
+  function root(cm) {
+    return rootNode(cm.display.wrapper)
+  }
+
+  function rootNode(element) {
+    // Detect modern browsers (2017+).
+    return element.getRootNode ? element.getRootNode() : element.ownerDocument
+  }
+
+  function win(cm) { return doc(cm).defaultView }
+
+  function bind(f) {
+    var args = Array.prototype.slice.call(arguments, 1);
+    return function(){return f.apply(null, args)}
+  }
+
+  function copyObj(obj, target, overwrite) {
+    if (!target) { target = {}; }
+    for (var prop in obj)
+      { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
+        { target[prop] = obj[prop]; } }
+    return target
+  }
+
+  // Counts the column offset in a string, taking tabs into account.
+  // Used mostly to find indentation.
+  function countColumn(string, end, tabSize, startIndex, startValue) {
+    if (end == null) {
+      end = string.search(/[^\s\u00a0]/);
+      if (end == -1) { end = string.length; }
+    }
+    for (var i = startIndex || 0, n = startValue || 0;;) {
+      var nextTab = string.indexOf("\t", i);
+      if (nextTab < 0 || nextTab >= end)
+        { return n + (end - i) }
+      n += nextTab - i;
+      n += tabSize - (n % tabSize);
+      i = nextTab + 1;
+    }
+  }
+
+  var Delayed = function() {
+    this.id = null;
+    this.f = null;
+    this.time = 0;
+    this.handler = bind(this.onTimeout, this);
+  };
+  Delayed.prototype.onTimeout = function (self) {
+    self.id = 0;
+    if (self.time <= +new Date) {
+      self.f();
+    } else {
+      setTimeout(self.handler, self.time - +new Date);
+    }
+  };
+  Delayed.prototype.set = function (ms, f) {
+    this.f = f;
+    var time = +new Date + ms;
+    if (!this.id || time < this.time) {
+      clearTimeout(this.id);
+      this.id = setTimeout(this.handler, ms);
+      this.time = time;
+    }
+  };
+
+  function indexOf(array, elt) {
+    for (var i = 0; i < array.length; ++i)
+      { if (array[i] == elt) { return i } }
+    return -1
+  }
+
+  // Number of pixels added to scroller and sizer to hide scrollbar
+  var scrollerGap = 50;
+
+  // Returned or thrown by various protocols to signal 'I'm not
+  // handling this'.
+  var Pass = {toString: function(){return "CodeMirror.Pass"}};
+
+  // Reused option objects for setSelection & friends
+  var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
+
+  // The inverse of countColumn -- find the offset that corresponds to
+  // a particular column.
+  function findColumn(string, goal, tabSize) {
+    for (var pos = 0, col = 0;;) {
+      var nextTab = string.indexOf("\t", pos);
+      if (nextTab == -1) { nextTab = string.length; }
+      var skipped = nextTab - pos;
+      if (nextTab == string.length || col + skipped >= goal)
+        { return pos + Math.min(skipped, goal - col) }
+      col += nextTab - pos;
+      col += tabSize - (col % tabSize);
+      pos = nextTab + 1;
+      if (col >= goal) { return pos }
+    }
+  }
+
+  var spaceStrs = [""];
+  function spaceStr(n) {
+    while (spaceStrs.length <= n)
+      { spaceStrs.push(lst(spaceStrs) + " "); }
+    return spaceStrs[n]
+  }
+
+  function lst(arr) { return arr[arr.length-1] }
+
+  function map(array, f) {
+    var out = [];
+    for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
+    return out
+  }
+
+  function insertSorted(array, value, score) {
+    var pos = 0, priority = score(value);
+    while (pos < array.length && score(array[pos]) <= priority) { pos++; }
+    array.splice(pos, 0, value);
+  }
+
+  function nothing() {}
+
+  function createObj(base, props) {
+    var inst;
+    if (Object.create) {
+      inst = Object.create(base);
+    } else {
+      nothing.prototype = base;
+      inst = new nothing();
+    }
+    if (props) { copyObj(props, inst); }
+    return inst
+  }
+
+  var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
+  function isWordCharBasic(ch) {
+    return /\w/.test(ch) || ch > "\x80" &&
+      (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
+  }
+  function isWordChar(ch, helper) {
+    if (!helper) { return isWordCharBasic(ch) }
+    if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
+    return helper.test(ch)
+  }
+
+  function isEmpty(obj) {
+    for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
+    return true
+  }
+
+  // Extending unicode characters. A series of a non-extending char +
+  // any number of extending chars is treated as a single unit as far
+  // as editing and measuring is concerned. This is not fully correct,
+  // since some scripts/fonts/browsers also treat other configurations
+  // of code points as a group.
+  var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
+  function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
+
+  // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
+  function skipExtendingChars(str, pos, dir) {
+    while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
+    return pos
+  }
+
+  // Returns the value from the range [`from`; `to`] that satisfies
+  // `pred` and is closest to `from`. Assumes that at least `to`
+  // satisfies `pred`. Supports `from` being greater than `to`.
+  function findFirst(pred, from, to) {
+    // At any point we are certain `to` satisfies `pred`, don't know
+    // whether `from` does.
+    var dir = from > to ? -1 : 1;
+    for (;;) {
+      if (from == to) { return from }
+      var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
+      if (mid == from) { return pred(mid) ? from : to }
+      if (pred(mid)) { to = mid; }
+      else { from = mid + dir; }
+    }
+  }
+
+  // BIDI HELPERS
+
+  function iterateBidiSections(order, from, to, f) {
+    if (!order) { return f(from, to, "ltr", 0) }
+    var found = false;
+    for (var i = 0; i < order.length; ++i) {
+      var part = order[i];
+      if (part.from < to && part.to > from || from == to && part.to == from) {
+        f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
+        found = true;
+      }
+    }
+    if (!found) { f(from, to, "ltr"); }
+  }
+
+  var bidiOther = null;
+  function getBidiPartAt(order, ch, sticky) {
+    var found;
+    bidiOther = null;
+    for (var i = 0; i < order.length; ++i) {
+      var cur = order[i];
+      if (cur.from < ch && cur.to > ch) { return i }
+      if (cur.to == ch) {
+        if (cur.from != cur.to && sticky == "before") { found = i; }
+        else { bidiOther = i; }
+      }
+      if (cur.from == ch) {
+        if (cur.from != cur.to && sticky != "before") { found = i; }
+        else { bidiOther = i; }
+      }
+    }
+    return found != null ? found : bidiOther
+  }
+
+  // Bidirectional ordering algorithm
+  // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
+  // that this (partially) implements.
+
+  // One-char codes used for character types:
+  // L (L):   Left-to-Right
+  // R (R):   Right-to-Left
+  // r (AL):  Right-to-Left Arabic
+  // 1 (EN):  European Number
+  // + (ES):  European Number Separator
+  // % (ET):  European Number Terminator
+  // n (AN):  Arabic Number
+  // , (CS):  Common Number Separator
+  // m (NSM): Non-Spacing Mark
+  // b (BN):  Boundary Neutral
+  // s (B):   Paragraph Separator
+  // t (S):   Segment Separator
+  // w (WS):  Whitespace
+  // N (ON):  Other Neutrals
+
+  // Returns null if characters are ordered as they appear
+  // (left-to-right), or an array of sections ({from, to, level}
+  // objects) in the order in which they occur visually.
+  var bidiOrdering = (function() {
+    // Character types for codepoints 0 to 0xff
+    var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
+    // Character types for codepoints 0x600 to 0x6f9
+    var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
+    function charType(code) {
+      if (code <= 0xf7) { return lowTypes.charAt(code) }
+      else if (0x590 <= code && code <= 0x5f4) { return "R" }
+      else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
+      else if (0x6ee <= code && code <= 0x8ac) { return "r" }
+      else if (0x2000 <= code && code <= 0x200b) { return "w" }
+      else if (code == 0x200c) { return "b" }
+      else { return "L" }
+    }
+
+    var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
+    var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
+
+    function BidiSpan(level, from, to) {
+      this.level = level;
+      this.from = from; this.to = to;
+    }
+
+    return function(str, direction) {
+      var outerType = direction == "ltr" ? "L" : "R";
+
+      if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
+      var len = str.length, types = [];
+      for (var i = 0; i < len; ++i)
+        { types.push(charType(str.charCodeAt(i))); }
+
+      // W1. Examine each non-spacing mark (NSM) in the level run, and
+      // change the type of the NSM to the type of the previous
+      // character. If the NSM is at the start of the level run, it will
+      // get the type of sor.
+      for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
+        var type = types[i$1];
+        if (type == "m") { types[i$1] = prev; }
+        else { prev = type; }
+      }
+
+      // W2. Search backwards from each instance of a European number
+      // until the first strong type (R, L, AL, or sor) is found. If an
+      // AL is found, change the type of the European number to Arabic
+      // number.
+      // W3. Change all ALs to R.
+      for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
+        var type$1 = types[i$2];
+        if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
+        else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
+      }
+
+      // W4. A single European separator between two European numbers
+      // changes to a European number. A single common separator between
+      // two numbers of the same type changes to that type.
+      for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
+        var type$2 = types[i$3];
+        if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
+        else if (type$2 == "," && prev$1 == types[i$3+1] &&
+                 (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
+        prev$1 = type$2;
+      }
+
+      // W5. A sequence of European terminators adjacent to European
+      // numbers changes to all European numbers.
+      // W6. Otherwise, separators and terminators change to Other
+      // Neutral.
+      for (var i$4 = 0; i$4 < len; ++i$4) {
+        var type$3 = types[i$4];
+        if (type$3 == ",") { types[i$4] = "N"; }
+        else if (type$3 == "%") {
+          var end = (void 0);
+          for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
+          var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
+          for (var j = i$4; j < end; ++j) { types[j] = replace; }
+          i$4 = end - 1;
+        }
+      }
+
+      // W7. Search backwards from each instance of a European number
+      // until the first strong type (R, L, or sor) is found. If an L is
+      // found, then change the type of the European number to L.
+      for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
+        var type$4 = types[i$5];
+        if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
+        else if (isStrong.test(type$4)) { cur$1 = type$4; }
+      }
+
+      // N1. A sequence of neutrals takes the direction of the
+      // surrounding strong text if the text on both sides has the same
+      // direction. European and Arabic numbers act as if they were R in
+      // terms of their influence on neutrals. Start-of-level-run (sor)
+      // and end-of-level-run (eor) are used at level run boundaries.
+      // N2. Any remaining neutrals take the embedding direction.
+      for (var i$6 = 0; i$6 < len; ++i$6) {
+        if (isNeutral.test(types[i$6])) {
+          var end$1 = (void 0);
+          for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
+          var before = (i$6 ? types[i$6-1] : outerType) == "L";
+          var after = (end$1 < len ? types[end$1] : outerType) == "L";
+          var replace$1 = before == after ? (before ? "L" : "R") : outerType;
+          for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
+          i$6 = end$1 - 1;
+        }
+      }
+
+      // Here we depart from the documented algorithm, in order to avoid
+      // building up an actual levels array. Since there are only three
+      // levels (0, 1, 2) in an implementation that doesn't take
+      // explicit embedding into account, we can build up the order on
+      // the fly, without following the level-based algorithm.
+      var order = [], m;
+      for (var i$7 = 0; i$7 < len;) {
+        if (countsAsLeft.test(types[i$7])) {
+          var start = i$7;
+          for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
+          order.push(new BidiSpan(0, start, i$7));
+        } else {
+          var pos = i$7, at = order.length, isRTL = direction == "rtl" ? 1 : 0;
+          for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
+          for (var j$2 = pos; j$2 < i$7;) {
+            if (countsAsNum.test(types[j$2])) {
+              if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }
+              var nstart = j$2;
+              for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
+              order.splice(at, 0, new BidiSpan(2, nstart, j$2));
+              at += isRTL;
+              pos = j$2;
+            } else { ++j$2; }
+          }
+          if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
+        }
+      }
+      if (direction == "ltr") {
+        if (order[0].level == 1 && (m = str.match(/^\s+/))) {
+          order[0].from = m[0].length;
+          order.unshift(new BidiSpan(0, 0, m[0].length));
+        }
+        if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
+          lst(order).to -= m[0].length;
+          order.push(new BidiSpan(0, len - m[0].length, len));
+        }
+      }
+
+      return direction == "rtl" ? order.reverse() : order
+    }
+  })();
+
+  // Get the bidi ordering for the given line (and cache it). Returns
+  // false for lines that are fully left-to-right, and an array of
+  // BidiSpan objects otherwise.
+  function getOrder(line, direction) {
+    var order = line.order;
+    if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
+    return order
+  }
+
+  // EVENT HANDLING
+
+  // Lightweight event framework. on/off also work on DOM nodes,
+  // registering native DOM handlers.
+
+  var noHandlers = [];
+
+  var on = function(emitter, type, f) {
+    if (emitter.addEventListener) {
+      emitter.addEventListener(type, f, false);
+    } else if (emitter.attachEvent) {
+      emitter.attachEvent("on" + type, f);
+    } else {
+      var map = emitter._handlers || (emitter._handlers = {});
+      map[type] = (map[type] || noHandlers).concat(f);
+    }
+  };
+
+  function getHandlers(emitter, type) {
+    return emitter._handlers && emitter._handlers[type] || noHandlers
+  }
+
+  function off(emitter, type, f) {
+    if (emitter.removeEventListener) {
+      emitter.removeEventListener(type, f, false);
+    } else if (emitter.detachEvent) {
+      emitter.detachEvent("on" + type, f);
+    } else {
+      var map = emitter._handlers, arr = map && map[type];
+      if (arr) {
+        var index = indexOf(arr, f);
+        if (index > -1)
+          { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
+      }
+    }
+  }
+
+  function signal(emitter, type /*, values...*/) {
+    var handlers = getHandlers(emitter, type);
+    if (!handlers.length) { return }
+    var args = Array.prototype.slice.call(arguments, 2);
+    for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
+  }
+
+  // The DOM events that CodeMirror handles can be overridden by
+  // registering a (non-DOM) handler on the editor for the event name,
+  // and preventDefault-ing the event in that handler.
+  function signalDOMEvent(cm, e, override) {
+    if (typeof e == "string")
+      { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
+    signal(cm, override || e.type, cm, e);
+    return e_defaultPrevented(e) || e.codemirrorIgnore
+  }
+
+  function signalCursorActivity(cm) {
+    var arr = cm._handlers && cm._handlers.cursorActivity;
+    if (!arr) { return }
+    var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
+    for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
+      { set.push(arr[i]); } }
+  }
+
+  function hasHandler(emitter, type) {
+    return getHandlers(emitter, type).length > 0
+  }
+
+  // Add on and off methods to a constructor's prototype, to make
+  // registering events on such objects more convenient.
+  function eventMixin(ctor) {
+    ctor.prototype.on = function(type, f) {on(this, type, f);};
+    ctor.prototype.off = function(type, f) {off(this, type, f);};
+  }
+
+  // Due to the fact that we still support jurassic IE versions, some
+  // compatibility wrappers are needed.
+
+  function e_preventDefault(e) {
+    if (e.preventDefault) { e.preventDefault(); }
+    else { e.returnValue = false; }
+  }
+  function e_stopPropagation(e) {
+    if (e.stopPropagation) { e.stopPropagation(); }
+    else { e.cancelBubble = true; }
+  }
+  function e_defaultPrevented(e) {
+    return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
+  }
+  function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
+
+  function e_target(e) {return e.target || e.srcElement}
+  function e_button(e) {
+    var b = e.which;
+    if (b == null) {
+      if (e.button & 1) { b = 1; }
+      else if (e.button & 2) { b = 3; }
+      else if (e.button & 4) { b = 2; }
+    }
+    if (mac && e.ctrlKey && b == 1) { b = 3; }
+    return b
+  }
+
+  // Detect drag-and-drop
+  var dragAndDrop = function() {
+    // There is *some* kind of drag-and-drop support in IE6-8, but I
+    // couldn't get it to work yet.
+    if (ie && ie_version < 9) { return false }
+    var div = elt('div');
+    return "draggable" in div || "dragDrop" in div
+  }();
+
+  var zwspSupported;
+  function zeroWidthElement(measure) {
+    if (zwspSupported == null) {
+      var test = elt("span", "\u200b");
+      removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
+      if (measure.firstChild.offsetHeight != 0)
+        { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
+    }
+    var node = zwspSupported ? elt("span", "\u200b") :
+      elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
+    node.setAttribute("cm-text", "");
+    return node
+  }
+
+  // Feature-detect IE's crummy client rect reporting for bidi text
+  var badBidiRects;
+  function hasBadBidiRects(measure) {
+    if (badBidiRects != null) { return badBidiRects }
+    var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
+    var r0 = range(txt, 0, 1).getBoundingClientRect();
+    var r1 = range(txt, 1, 2).getBoundingClientRect();
+    removeChildren(measure);
+    if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
+    return badBidiRects = (r1.right - r0.right < 3)
+  }
+
+  // See if "".split is the broken IE version, if so, provide an
+  // alternative way to split lines.
+  var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
+    var pos = 0, result = [], l = string.length;
+    while (pos <= l) {
+      var nl = string.indexOf("\n", pos);
+      if (nl == -1) { nl = string.length; }
+      var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
+      var rt = line.indexOf("\r");
+      if (rt != -1) {
+        result.push(line.slice(0, rt));
+        pos += rt + 1;
+      } else {
+        result.push(line);
+        pos = nl + 1;
+      }
+    }
+    return result
+  } : function (string) { return string.split(/\r\n?|\n/); };
+
+  var hasSelection = window.getSelection ? function (te) {
+    try { return te.selectionStart != te.selectionEnd }
+    catch(e) { return false }
+  } : function (te) {
+    var range;
+    try {range = te.ownerDocument.selection.createRange();}
+    catch(e) {}
+    if (!range || range.parentElement() != te) { return false }
+    return range.compareEndPoints("StartToEnd", range) != 0
+  };
+
+  var hasCopyEvent = (function () {
+    var e = elt("div");
+    if ("oncopy" in e) { return true }
+    e.setAttribute("oncopy", "return;");
+    return typeof e.oncopy == "function"
+  })();
+
+  var badZoomedRects = null;
+  function hasBadZoomedRects(measure) {
+    if (badZoomedRects != null) { return badZoomedRects }
+    var node = removeChildrenAndAdd(measure, elt("span", "x"));
+    var normal = node.getBoundingClientRect();
+    var fromRange = range(node, 0, 1).getBoundingClientRect();
+    return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
+  }
+
+  // Known modes, by name and by MIME
+  var modes = {}, mimeModes = {};
+
+  // Extra arguments are stored as the mode's dependencies, which is
+  // used by (legacy) mechanisms like loadmode.js to automatically
+  // load a mode. (Preferred mechanism is the require/define calls.)
+  function defineMode(name, mode) {
+    if (arguments.length > 2)
+      { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
+    modes[name] = mode;
+  }
+
+  function defineMIME(mime, spec) {
+    mimeModes[mime] = spec;
+  }
+
+  // Given a MIME type, a {name, ...options} config object, or a name
+  // string, return a mode config object.
+  function resolveMode(spec) {
+    if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
+      spec = mimeModes[spec];
+    } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
+      var found = mimeModes[spec.name];
+      if (typeof found == "string") { found = {name: found}; }
+      spec = createObj(found, spec);
+      spec.name = found.name;
+    } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
+      return resolveMode("application/xml")
+    } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
+      return resolveMode("application/json")
+    }
+    if (typeof spec == "string") { return {name: spec} }
+    else { return spec || {name: "null"} }
+  }
+
+  // Given a mode spec (anything that resolveMode accepts), find and
+  // initialize an actual mode object.
+  function getMode(options, spec) {
+    spec = resolveMode(spec);
+    var mfactory = modes[spec.name];
+    if (!mfactory) { return getMode(options, "text/plain") }
+    var modeObj = mfactory(options, spec);
+    if (modeExtensions.hasOwnProperty(spec.name)) {
+      var exts = modeExtensions[spec.name];
+      for (var prop in exts) {
+        if (!exts.hasOwnProperty(prop)) { continue }
+        if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
+        modeObj[prop] = exts[prop];
+      }
+    }
+    modeObj.name = spec.name;
+    if (spec.helperType) { modeObj.helperType = spec.helperType; }
+    if (spec.modeProps) { for (var prop$1 in spec.modeProps)
+      { modeObj[prop$1] = spec.modeProps[prop$1]; } }
+
+    return modeObj
+  }
+
+  // This can be used to attach properties to mode objects from
+  // outside the actual mode definition.
+  var modeExtensions = {};
+  function extendMode(mode, properties) {
+    var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
+    copyObj(properties, exts);
+  }
+
+  function copyState(mode, state) {
+    if (state === true) { return state }
+    if (mode.copyState) { return mode.copyState(state) }
+    var nstate = {};
+    for (var n in state) {
+      var val = state[n];
+      if (val instanceof Array) { val = val.concat([]); }
+      nstate[n] = val;
+    }
+    return nstate
+  }
+
+  // Given a mode and a state (for that mode), find the inner mode and
+  // state at the position that the state refers to.
+  function innerMode(mode, state) {
+    var info;
+    while (mode.innerMode) {
+      info = mode.innerMode(state);
+      if (!info || info.mode == mode) { break }
+      state = info.state;
+      mode = info.mode;
+    }
+    return info || {mode: mode, state: state}
+  }
+
+  function startState(mode, a1, a2) {
+    return mode.startState ? mode.startState(a1, a2) : true
+  }
+
+  // STRING STREAM
+
+  // Fed to the mode parsers, provides helper functions to make
+  // parsers more succinct.
+
+  var StringStream = function(string, tabSize, lineOracle) {
+    this.pos = this.start = 0;
+    this.string = string;
+    this.tabSize = tabSize || 8;
+    this.lastColumnPos = this.lastColumnValue = 0;
+    this.lineStart = 0;
+    this.lineOracle = lineOracle;
+  };
+
+  StringStream.prototype.eol = function () {return this.pos >= this.string.length};
+  StringStream.prototype.sol = function () {return this.pos == this.lineStart};
+  StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
+  StringStream.prototype.next = function () {
+    if (this.pos < this.string.length)
+      { return this.string.charAt(this.pos++) }
+  };
+  StringStream.prototype.eat = function (match) {
+    var ch = this.string.charAt(this.pos);
+    var ok;
+    if (typeof match == "string") { ok = ch == match; }
+    else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
+    if (ok) {++this.pos; return ch}
+  };
+  StringStream.prototype.eatWhile = function (match) {
+    var start = this.pos;
+    while (this.eat(match)){}
+    return this.pos > start
+  };
+  StringStream.prototype.eatSpace = function () {
+    var start = this.pos;
+    while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
+    return this.pos > start
+  };
+  StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
+  StringStream.prototype.skipTo = function (ch) {
+    var found = this.string.indexOf(ch, this.pos);
+    if (found > -1) {this.pos = found; return true}
+  };
+  StringStream.prototype.backUp = function (n) {this.pos -= n;};
+  StringStream.prototype.column = function () {
+    if (this.lastColumnPos < this.start) {
+      this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
+      this.lastColumnPos = this.start;
+    }
+    return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+  };
+  StringStream.prototype.indentation = function () {
+    return countColumn(this.string, null, this.tabSize) -
+      (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+  };
+  StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
+    if (typeof pattern == "string") {
+      var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
+      var substr = this.string.substr(this.pos, pattern.length);
+      if (cased(substr) == cased(pattern)) {
+        if (consume !== false) { this.pos += pattern.length; }
+        return true
+      }
+    } else {
+      var match = this.string.slice(this.pos).match(pattern);
+      if (match && match.index > 0) { return null }
+      if (match && consume !== false) { this.pos += match[0].length; }
+      return match
+    }
+  };
+  StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
+  StringStream.prototype.hideFirstChars = function (n, inner) {
+    this.lineStart += n;
+    try { return inner() }
+    finally { this.lineStart -= n; }
+  };
+  StringStream.prototype.lookAhead = function (n) {
+    var oracle = this.lineOracle;
+    return oracle && oracle.lookAhead(n)
+  };
+  StringStream.prototype.baseToken = function () {
+    var oracle = this.lineOracle;
+    return oracle && oracle.baseToken(this.pos)
+  };
+
+  // Find the line object corresponding to the given line number.
+  function getLine(doc, n) {
+    n -= doc.first;
+    if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
+    var chunk = doc;
+    while (!chunk.lines) {
+      for (var i = 0;; ++i) {
+        var child = chunk.children[i], sz = child.chunkSize();
+        if (n < sz) { chunk = child; break }
+        n -= sz;
+      }
+    }
+    return chunk.lines[n]
+  }
+
+  // Get the part of a document between two positions, as an array of
+  // strings.
+  function getBetween(doc, start, end) {
+    var out = [], n = start.line;
+    doc.iter(start.line, end.line + 1, function (line) {
+      var text = line.text;
+      if (n == end.line) { text = text.slice(0, end.ch); }
+      if (n == start.line) { text = text.slice(start.ch); }
+      out.push(text);
+      ++n;
+    });
+    return out
+  }
+  // Get the lines between from and to, as array of strings.
+  function getLines(doc, from, to) {
+    var out = [];
+    doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
+    return out
+  }
+
+  // Update the height of a line, propagating the height change
+  // upwards to parent nodes.
+  function updateLineHeight(line, height) {
+    var diff = height - line.height;
+    if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
+  }
+
+  // Given a line object, find its line number by walking up through
+  // its parent links.
+  function lineNo(line) {
+    if (line.parent == null) { return null }
+    var cur = line.parent, no = indexOf(cur.lines, line);
+    for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
+      for (var i = 0;; ++i) {
+        if (chunk.children[i] == cur) { break }
+        no += chunk.children[i].chunkSize();
+      }
+    }
+    return no + cur.first
+  }
+
+  // Find the line at the given vertical position, using the height
+  // information in the document tree.
+  function lineAtHeight(chunk, h) {
+    var n = chunk.first;
+    outer: do {
+      for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
+        var child = chunk.children[i$1], ch = child.height;
+        if (h < ch) { chunk = child; continue outer }
+        h -= ch;
+        n += child.chunkSize();
+      }
+      return n
+    } while (!chunk.lines)
+    var i = 0;
+    for (; i < chunk.lines.length; ++i) {
+      var line = chunk.lines[i], lh = line.height;
+      if (h < lh) { break }
+      h -= lh;
+    }
+    return n + i
+  }
+
+  function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
+
+  function lineNumberFor(options, i) {
+    return String(options.lineNumberFormatter(i + options.firstLineNumber))
+  }
+
+  // A Pos instance represents a position within the text.
+  function Pos(line, ch, sticky) {
+    if ( sticky === void 0 ) sticky = null;
+
+    if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
+    this.line = line;
+    this.ch = ch;
+    this.sticky = sticky;
+  }
+
+  // Compare two positions, return 0 if they are the same, a negative
+  // number when a is less, and a positive number otherwise.
+  function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
+
+  function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
+
+  function copyPos(x) {return Pos(x.line, x.ch)}
+  function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
+  function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
+
+  // Most of the external API clips given positions to make sure they
+  // actually exist within the document.
+  function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
+  function clipPos(doc, pos) {
+    if (pos.line < doc.first) { return Pos(doc.first, 0) }
+    var last = doc.first + doc.size - 1;
+    if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
+    return clipToLen(pos, getLine(doc, pos.line).text.length)
+  }
+  function clipToLen(pos, linelen) {
+    var ch = pos.ch;
+    if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
+    else if (ch < 0) { return Pos(pos.line, 0) }
+    else { return pos }
+  }
+  function clipPosArray(doc, array) {
+    var out = [];
+    for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
+    return out
+  }
+
+  var SavedContext = function(state, lookAhead) {
+    this.state = state;
+    this.lookAhead = lookAhead;
+  };
+
+  var Context = function(doc, state, line, lookAhead) {
+    this.state = state;
+    this.doc = doc;
+    this.line = line;
+    this.maxLookAhead = lookAhead || 0;
+    this.baseTokens = null;
+    this.baseTokenPos = 1;
+  };
+
+  Context.prototype.lookAhead = function (n) {
+    var line = this.doc.getLine(this.line + n);
+    if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
+    return line
+  };
+
+  Context.prototype.baseToken = function (n) {
+    if (!this.baseTokens) { return null }
+    while (this.baseTokens[this.baseTokenPos] <= n)
+      { this.baseTokenPos += 2; }
+    var type = this.baseTokens[this.baseTokenPos + 1];
+    return {type: type && type.replace(/( |^)overlay .*/, ""),
+            size: this.baseTokens[this.baseTokenPos] - n}
+  };
+
+  Context.prototype.nextLine = function () {
+    this.line++;
+    if (this.maxLookAhead > 0) { this.maxLookAhead--; }
+  };
+
+  Context.fromSaved = function (doc, saved, line) {
+    if (saved instanceof SavedContext)
+      { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
+    else
+      { return new Context(doc, copyState(doc.mode, saved), line) }
+  };
+
+  Context.prototype.save = function (copy) {
+    var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
+    return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
+  };
+
+
+  // Compute a style array (an array starting with a mode generation
+  // -- for invalidation -- followed by pairs of end positions and
+  // style strings), which is used to highlight the tokens on the
+  // line.
+  function highlightLine(cm, line, context, forceToEnd) {
+    // A styles array always starts with a number identifying the
+    // mode/overlays that it is based on (for easy invalidation).
+    var st = [cm.state.modeGen], lineClasses = {};
+    // Compute the base array of styles
+    runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
+            lineClasses, forceToEnd);
+    var state = context.state;
+
+    // Run overlays, adjust style array.
+    var loop = function ( o ) {
+      context.baseTokens = st;
+      var overlay = cm.state.overlays[o], i = 1, at = 0;
+      context.state = true;
+      runMode(cm, line.text, overlay.mode, context, function (end, style) {
+        var start = i;
+        // Ensure there's a token end at the current position, and that i points at it
+        while (at < end) {
+          var i_end = st[i];
+          if (i_end > end)
+            { st.splice(i, 1, end, st[i+1], i_end); }
+          i += 2;
+          at = Math.min(end, i_end);
+        }
+        if (!style) { return }
+        if (overlay.opaque) {
+          st.splice(start, i - start, end, "overlay " + style);
+          i = start + 2;
+        } else {
+          for (; start < i; start += 2) {
+            var cur = st[start+1];
+            st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
+          }
+        }
+      }, lineClasses);
+      context.state = state;
+      context.baseTokens = null;
+      context.baseTokenPos = 1;
+    };
+
+    for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
+
+    return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
+  }
+
+  function getLineStyles(cm, line, updateFrontier) {
+    if (!line.styles || line.styles[0] != cm.state.modeGen) {
+      var context = getContextBefore(cm, lineNo(line));
+      var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
+      var result = highlightLine(cm, line, context);
+      if (resetState) { context.state = resetState; }
+      line.stateAfter = context.save(!resetState);
+      line.styles = result.styles;
+      if (result.classes) { line.styleClasses = result.classes; }
+      else if (line.styleClasses) { line.styleClasses = null; }
+      if (updateFrontier === cm.doc.highlightFrontier)
+        { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
+    }
+    return line.styles
+  }
+
+  function getContextBefore(cm, n, precise) {
+    var doc = cm.doc, display = cm.display;
+    if (!doc.mode.startState) { return new Context(doc, true, n) }
+    var start = findStartLine(cm, n, precise);
+    var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
+    var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
+
+    doc.iter(start, n, function (line) {
+      processLine(cm, line.text, context);
+      var pos = context.line;
+      line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
+      context.nextLine();
+    });
+    if (precise) { doc.modeFrontier = context.line; }
+    return context
+  }
+
+  // Lightweight form of highlight -- proceed over this line and
+  // update state, but don't save a style array. Used for lines that
+  // aren't currently visible.
+  function processLine(cm, text, context, startAt) {
+    var mode = cm.doc.mode;
+    var stream = new StringStream(text, cm.options.tabSize, context);
+    stream.start = stream.pos = startAt || 0;
+    if (text == "") { callBlankLine(mode, context.state); }
+    while (!stream.eol()) {
+      readToken(mode, stream, context.state);
+      stream.start = stream.pos;
+    }
+  }
+
+  function callBlankLine(mode, state) {
+    if (mode.blankLine) { return mode.blankLine(state) }
+    if (!mode.innerMode) { return }
+    var inner = innerMode(mode, state);
+    if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
+  }
+
+  function readToken(mode, stream, state, inner) {
+    for (var i = 0; i < 10; i++) {
+      if (inner) { inner[0] = innerMode(mode, state).mode; }
+      var style = mode.token(stream, state);
+      if (stream.pos > stream.start) { return style }
+    }
+    throw new Error("Mode " + mode.name + " failed to advance stream.")
+  }
+
+  var Token = function(stream, type, state) {
+    this.start = stream.start; this.end = stream.pos;
+    this.string = stream.current();
+    this.type = type || null;
+    this.state = state;
+  };
+
+  // Utility for getTokenAt and getLineTokens
+  function takeToken(cm, pos, precise, asArray) {
+    var doc = cm.doc, mode = doc.mode, style;
+    pos = clipPos(doc, pos);
+    var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
+    var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
+    if (asArray) { tokens = []; }
+    while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
+      stream.start = stream.pos;
+      style = readToken(mode, stream, context.state);
+      if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
+    }
+    return asArray ? tokens : new Token(stream, style, context.state)
+  }
+
+  function extractLineClasses(type, output) {
+    if (type) { for (;;) {
+      var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
+      if (!lineClass) { break }
+      type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
+      var prop = lineClass[1] ? "bgClass" : "textClass";
+      if (output[prop] == null)
+        { output[prop] = lineClass[2]; }
+      else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
+        { output[prop] += " " + lineClass[2]; }
+    } }
+    return type
+  }
+
+  // Run the given mode's parser over a line, calling f for each token.
+  function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
+    var flattenSpans = mode.flattenSpans;
+    if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
+    var curStart = 0, curStyle = null;
+    var stream = new StringStream(text, cm.options.tabSize, context), style;
+    var inner = cm.options.addModeClass && [null];
+    if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
+    while (!stream.eol()) {
+      if (stream.pos > cm.options.maxHighlightLength) {
+        flattenSpans = false;
+        if (forceToEnd) { processLine(cm, text, context, stream.pos); }
+        stream.pos = text.length;
+        style = null;
+      } else {
+        style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
+      }
+      if (inner) {
+        var mName = inner[0].name;
+        if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
+      }
+      if (!flattenSpans || curStyle != style) {
+        while (curStart < stream.start) {
+          curStart = Math.min(stream.start, curStart + 5000);
+          f(curStart, curStyle);
+        }
+        curStyle = style;
+      }
+      stream.start = stream.pos;
+    }
+    while (curStart < stream.pos) {
+      // Webkit seems to refuse to render text nodes longer than 57444
+      // characters, and returns inaccurate measurements in nodes
+      // starting around 5000 chars.
+      var pos = Math.min(stream.pos, curStart + 5000);
+      f(pos, curStyle);
+      curStart = pos;
+    }
+  }
+
+  // Finds the line to start with when starting a parse. Tries to
+  // find a line with a stateAfter, so that it can start with a
+  // valid state. If that fails, it returns the line with the
+  // smallest indentation, which tends to need the least context to
+  // parse correctly.
+  function findStartLine(cm, n, precise) {
+    var minindent, minline, doc = cm.doc;
+    var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
+    for (var search = n; search > lim; --search) {
+      if (search <= doc.first) { return doc.first }
+      var line = getLine(doc, search - 1), after = line.stateAfter;
+      if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
+        { return search }
+      var indented = countColumn(line.text, null, cm.options.tabSize);
+      if (minline == null || minindent > indented) {
+        minline = search - 1;
+        minindent = indented;
+      }
+    }
+    return minline
+  }
+
+  function retreatFrontier(doc, n) {
+    doc.modeFrontier = Math.min(doc.modeFrontier, n);
+    if (doc.highlightFrontier < n - 10) { return }
+    var start = doc.first;
+    for (var line = n - 1; line > start; line--) {
+      var saved = getLine(doc, line).stateAfter;
+      // change is on 3
+      // state on line 1 looked ahead 2 -- so saw 3
+      // test 1 + 2 < 3 should cover this
+      if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
+        start = line + 1;
+        break
+      }
+    }
+    doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
+  }
+
+  // Optimize some code when these features are not used.
+  var sawReadOnlySpans = false, sawCollapsedSpans = false;
+
+  function seeReadOnlySpans() {
+    sawReadOnlySpans = true;
+  }
+
+  function seeCollapsedSpans() {
+    sawCollapsedSpans = true;
+  }
+
+  // TEXTMARKER SPANS
+
+  function MarkedSpan(marker, from, to) {
+    this.marker = marker;
+    this.from = from; this.to = to;
+  }
+
+  // Search an array of spans for a span matching the given marker.
+  function getMarkedSpanFor(spans, marker) {
+    if (spans) { for (var i = 0; i < spans.length; ++i) {
+      var span = spans[i];
+      if (span.marker == marker) { return span }
+    } }
+  }
+
+  // Remove a span from an array, returning undefined if no spans are
+  // left (we don't store arrays for lines without spans).
+  function removeMarkedSpan(spans, span) {
+    var r;
+    for (var i = 0; i < spans.length; ++i)
+      { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
+    return r
+  }
+
+  // Add a span to a line.
+  function addMarkedSpan(line, span, op) {
+    var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));
+    if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {
+      line.markedSpans.push(span);
+    } else {
+      line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
+      if (inThisOp) { inThisOp.add(line.markedSpans); }
+    }
+    span.marker.attachLine(line);
+  }
+
+  // Used for the algorithm that adjusts markers for a change in the
+  // document. These functions cut an array of spans at a given
+  // character position, returning an array of remaining chunks (or
+  // undefined if nothing remains).
+  function markedSpansBefore(old, startCh, isInsert) {
+    var nw;
+    if (old) { for (var i = 0; i < old.length; ++i) {
+      var span = old[i], marker = span.marker;
+      var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
+      if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
+        var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
+        ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
+      }
+    } }
+    return nw
+  }
+  function markedSpansAfter(old, endCh, isInsert) {
+    var nw;
+    if (old) { for (var i = 0; i < old.length; ++i) {
+      var span = old[i], marker = span.marker;
+      var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
+      if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
+        var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
+        ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
+                                              span.to == null ? null : span.to - endCh));
+      }
+    } }
+    return nw
+  }
+
+  // Given a change object, compute the new set of marker spans that
+  // cover the line in which the change took place. Removes spans
+  // entirely within the change, reconnects spans belonging to the
+  // same marker that appear on both sides of the change, and cuts off
+  // spans partially within the change. Returns an array of span
+  // arrays with one element for each line in (after) the change.
+  function stretchSpansOverChange(doc, change) {
+    if (change.full) { return null }
+    var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
+    var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
+    if (!oldFirst && !oldLast) { return null }
+
+    var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
+    // Get the spans that 'stick out' on both sides
+    var first = markedSpansBefore(oldFirst, startCh, isInsert);
+    var last = markedSpansAfter(oldLast, endCh, isInsert);
+
+    // Next, merge those two ends
+    var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
+    if (first) {
+      // Fix up .to properties of first
+      for (var i = 0; i < first.length; ++i) {
+        var span = first[i];
+        if (span.to == null) {
+          var found = getMarkedSpanFor(last, span.marker);
+          if (!found) { span.to = startCh; }
+          else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
+        }
+      }
+    }
+    if (last) {
+      // Fix up .from in last (or move them into first in case of sameLine)
+      for (var i$1 = 0; i$1 < last.length; ++i$1) {
+        var span$1 = last[i$1];
+        if (span$1.to != null) { span$1.to += offset; }
+        if (span$1.from == null) {
+          var found$1 = getMarkedSpanFor(first, span$1.marker);
+          if (!found$1) {
+            span$1.from = offset;
+            if (sameLine) { (first || (first = [])).push(span$1); }
+          }
+        } else {
+          span$1.from += offset;
+          if (sameLine) { (first || (first = [])).push(span$1); }
+        }
+      }
+    }
+    // Make sure we didn't create any zero-length spans
+    if (first) { first = clearEmptySpans(first); }
+    if (last && last != first) { last = clearEmptySpans(last); }
+
+    var newMarkers = [first];
+    if (!sameLine) {
+      // Fill gap with whole-line-spans
+      var gap = change.text.length - 2, gapMarkers;
+      if (gap > 0 && first)
+        { for (var i$2 = 0; i$2 < first.length; ++i$2)
+          { if (first[i$2].to == null)
+            { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
+      for (var i$3 = 0; i$3 < gap; ++i$3)
+        { newMarkers.push(gapMarkers); }
+      newMarkers.push(last);
+    }
+    return newMarkers
+  }
+
+  // Remove spans that are empty and don't have a clearWhenEmpty
+  // option of false.
+  function clearEmptySpans(spans) {
+    for (var i = 0; i < spans.length; ++i) {
+      var span = spans[i];
+      if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
+        { spans.splice(i--, 1); }
+    }
+    if (!spans.length) { return null }
+    return spans
+  }
+
+  // Used to 'clip' out readOnly ranges when making a change.
+  function removeReadOnlyRanges(doc, from, to) {
+    var markers = null;
+    doc.iter(from.line, to.line + 1, function (line) {
+      if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
+        var mark = line.markedSpans[i].marker;
+        if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
+          { (markers || (markers = [])).push(mark); }
+      } }
+    });
+    if (!markers) { return null }
+    var parts = [{from: from, to: to}];
+    for (var i = 0; i < markers.length; ++i) {
+      var mk = markers[i], m = mk.find(0);
+      for (var j = 0; j < parts.length; ++j) {
+        var p = parts[j];
+        if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
+        var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
+        if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
+          { newParts.push({from: p.from, to: m.from}); }
+        if (dto > 0 || !mk.inclusiveRight && !dto)
+          { newParts.push({from: m.to, to: p.to}); }
+        parts.splice.apply(parts, newParts);
+        j += newParts.length - 3;
+      }
+    }
+    return parts
+  }
+
+  // Connect or disconnect spans from a line.
+  function detachMarkedSpans(line) {
+    var spans = line.markedSpans;
+    if (!spans) { return }
+    for (var i = 0; i < spans.length; ++i)
+      { spans[i].marker.detachLine(line); }
+    line.markedSpans = null;
+  }
+  function attachMarkedSpans(line, spans) {
+    if (!spans) { return }
+    for (var i = 0; i < spans.length; ++i)
+      { spans[i].marker.attachLine(line); }
+    line.markedSpans = spans;
+  }
+
+  // Helpers used when computing which overlapping collapsed span
+  // counts as the larger one.
+  function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
+  function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
+
+  // Returns a number indicating which of two overlapping collapsed
+  // spans is larger (and thus includes the other). Falls back to
+  // comparing ids when the spans cover exactly the same range.
+  function compareCollapsedMarkers(a, b) {
+    var lenDiff = a.lines.length - b.lines.length;
+    if (lenDiff != 0) { return lenDiff }
+    var aPos = a.find(), bPos = b.find();
+    var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
+    if (fromCmp) { return -fromCmp }
+    var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
+    if (toCmp) { return toCmp }
+    return b.id - a.id
+  }
+
+  // Find out whether a line ends or starts in a collapsed span. If
+  // so, return the marker for that span.
+  function collapsedSpanAtSide(line, start) {
+    var sps = sawCollapsedSpans && line.markedSpans, found;
+    if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
+      sp = sps[i];
+      if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
+          (!found || compareCollapsedMarkers(found, sp.marker) < 0))
+        { found = sp.marker; }
+    } }
+    return found
+  }
+  function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
+  function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
+
+  function collapsedSpanAround(line, ch) {
+    var sps = sawCollapsedSpans && line.markedSpans, found;
+    if (sps) { for (var i = 0; i < sps.length; ++i) {
+      var sp = sps[i];
+      if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
+          (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
+    } }
+    return found
+  }
+
+  // Test whether there exists a collapsed span that partially
+  // overlaps (covers the start or end, but not both) of a new span.
+  // Such overlap is not allowed.
+  function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
+    var line = getLine(doc, lineNo);
+    var sps = sawCollapsedSpans && line.markedSpans;
+    if (sps) { for (var i = 0; i < sps.length; ++i) {
+      var sp = sps[i];
+      if (!sp.marker.collapsed) { continue }
+      var found = sp.marker.find(0);
+      var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
+      var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
+      if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
+      if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
+          fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
+        { return true }
+    } }
+  }
+
+  // A visual line is a line as drawn on the screen. Folding, for
+  // example, can cause multiple logical lines to appear on the same
+  // visual line. This finds the start of the visual line that the
+  // given line is part of (usually that is the line itself).
+  function visualLine(line) {
+    var merged;
+    while (merged = collapsedSpanAtStart(line))
+      { line = merged.find(-1, true).line; }
+    return line
+  }
+
+  function visualLineEnd(line) {
+    var merged;
+    while (merged = collapsedSpanAtEnd(line))
+      { line = merged.find(1, true).line; }
+    return line
+  }
+
+  // Returns an array of logical lines that continue the visual line
+  // started by the argument, or undefined if there are no such lines.
+  function visualLineContinued(line) {
+    var merged, lines;
+    while (merged = collapsedSpanAtEnd(line)) {
+      line = merged.find(1, true).line
+      ;(lines || (lines = [])).push(line);
+    }
+    return lines
+  }
+
+  // Get the line number of the start of the visual line that the
+  // given line number is part of.
+  function visualLineNo(doc, lineN) {
+    var line = getLine(doc, lineN), vis = visualLine(line);
+    if (line == vis) { return lineN }
+    return lineNo(vis)
+  }
+
+  // Get the line number of the start of the next visual line after
+  // the given line.
+  function visualLineEndNo(doc, lineN) {
+    if (lineN > doc.lastLine()) { return lineN }
+    var line = getLine(doc, lineN), merged;
+    if (!lineIsHidden(doc, line)) { return lineN }
+    while (merged = collapsedSpanAtEnd(line))
+      { line = merged.find(1, true).line; }
+    return lineNo(line) + 1
+  }
+
+  // Compute whether a line is hidden. Lines count as hidden when they
+  // are part of a visual line that starts with another line, or when
+  // they are entirely covered by collapsed, non-widget span.
+  function lineIsHidden(doc, line) {
+    var sps = sawCollapsedSpans && line.markedSpans;
+    if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
+      sp = sps[i];
+      if (!sp.marker.collapsed) { continue }
+      if (sp.from == null) { return true }
+      if (sp.marker.widgetNode) { continue }
+      if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
+        { return true }
+    } }
+  }
+  function lineIsHiddenInner(doc, line, span) {
+    if (span.to == null) {
+      var end = span.marker.find(1, true);
+      return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
+    }
+    if (span.marker.inclusiveRight && span.to == line.text.length)
+      { return true }
+    for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
+      sp = line.markedSpans[i];
+      if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
+          (sp.to == null || sp.to != span.from) &&
+          (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
+          lineIsHiddenInner(doc, line, sp)) { return true }
+    }
+  }
+
+  // Find the height above the given line.
+  function heightAtLine(lineObj) {
+    lineObj = visualLine(lineObj);
+
+    var h = 0, chunk = lineObj.parent;
+    for (var i = 0; i < chunk.lines.length; ++i) {
+      var line = chunk.lines[i];
+      if (line == lineObj) { break }
+      else { h += line.height; }
+    }
+    for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
+      for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
+        var cur = p.children[i$1];
+        if (cur == chunk) { break }
+        else { h += cur.height; }
+      }
+    }
+    return h
+  }
+
+  // Compute the character length of a line, taking into account
+  // collapsed ranges (see markText) that might hide parts, and join
+  // other lines onto it.
+  function lineLength(line) {
+    if (line.height == 0) { return 0 }
+    var len = line.text.length, merged, cur = line;
+    while (merged = collapsedSpanAtStart(cur)) {
+      var found = merged.find(0, true);
+      cur = found.from.line;
+      len += found.from.ch - found.to.ch;
+    }
+    cur = line;
+    while (merged = collapsedSpanAtEnd(cur)) {
+      var found$1 = merged.find(0, true);
+      len -= cur.text.length - found$1.from.ch;
+      cur = found$1.to.line;
+      len += cur.text.length - found$1.to.ch;
+    }
+    return len
+  }
+
+  // Find the longest line in the document.
+  function findMaxLine(cm) {
+    var d = cm.display, doc = cm.doc;
+    d.maxLine = getLine(doc, doc.first);
+    d.maxLineLength = lineLength(d.maxLine);
+    d.maxLineChanged = true;
+    doc.iter(function (line) {
+      var len = lineLength(line);
+      if (len > d.maxLineLength) {
+        d.maxLineLength = len;
+        d.maxLine = line;
+      }
+    });
+  }
+
+  // LINE DATA STRUCTURE
+
+  // Line objects. These hold state related to a line, including
+  // highlighting info (the styles array).
+  var Line = function(text, markedSpans, estimateHeight) {
+    this.text = text;
+    attachMarkedSpans(this, markedSpans);
+    this.height = estimateHeight ? estimateHeight(this) : 1;
+  };
+
+  Line.prototype.lineNo = function () { return lineNo(this) };
+  eventMixin(Line);
+
+  // Change the content (text, markers) of a line. Automatically
+  // invalidates cached information and tries to re-estimate the
+  // line's height.
+  function updateLine(line, text, markedSpans, estimateHeight) {
+    line.text = text;
+    if (line.stateAfter) { line.stateAfter = null; }
+    if (line.styles) { line.styles = null; }
+    if (line.order != null) { line.order = null; }
+    detachMarkedSpans(line);
+    attachMarkedSpans(line, markedSpans);
+    var estHeight = estimateHeight ? estimateHeight(line) : 1;
+    if (estHeight != line.height) { updateLineHeight(line, estHeight); }
+  }
+
+  // Detach a line from the document tree and its markers.
+  function cleanUpLine(line) {
+    line.parent = null;
+    detachMarkedSpans(line);
+  }
+
+  // Convert a style as returned by a mode (either null, or a string
+  // containing one or more styles) to a CSS style. This is cached,
+  // and also looks for line-wide styles.
+  var styleToClassCache = {}, styleToClassCacheWithMode = {};
+  function interpretTokenStyle(style, options) {
+    if (!style || /^\s*$/.test(style)) { return null }
+    var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
+    return cache[style] ||
+      (cache[style] = style.replace(/\S+/g, "cm-$&"))
+  }
+
+  // Render the DOM representation of the text of a line. Also builds
+  // up a 'line map', which points at the DOM nodes that represent
+  // specific stretches of text, and is used by the measuring code.
+  // The returned object contains the DOM node, this map, and
+  // information about line-wide styles that were set by the mode.
+  function buildLineContent(cm, lineView) {
+    // The padding-right forces the element to have a 'border', which
+    // is needed on Webkit to be able to get line-level bounding
+    // rectangles for it (in measureChar).
+    var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
+    var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
+                   col: 0, pos: 0, cm: cm,
+                   trailingSpace: false,
+                   splitSpaces: cm.getOption("lineWrapping")};
+    lineView.measure = {};
+
+    // Iterate over the logical lines that make up this visual line.
+    for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
+      var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
+      builder.pos = 0;
+      builder.addToken = buildToken;
+      // Optionally wire in some hacks into the token-rendering
+      // algorithm, to deal with browser quirks.
+      if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
+        { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
+      builder.map = [];
+      var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
+      insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
+      if (line.styleClasses) {
+        if (line.styleClasses.bgClass)
+          { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
+        if (line.styleClasses.textClass)
+          { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
+      }
+
+      // Ensure at least a single node is present, for measuring.
+      if (builder.map.length == 0)
+        { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
+
+      // Store the map and a cache object for the current logical line
+      if (i == 0) {
+        lineView.measure.map = builder.map;
+        lineView.measure.cache = {};
+      } else {
+  (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
+        ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
+      }
+    }
+
+    // See issue #2901
+    if (webkit) {
+      var last = builder.content.lastChild;
+      if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
+        { builder.content.className = "cm-tab-wrap-hack"; }
+    }
+
+    signal(cm, "renderLine", cm, lineView.line, builder.pre);
+    if (builder.pre.className)
+      { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
+
+    return builder
+  }
+
+  function defaultSpecialCharPlaceholder(ch) {
+    var token = elt("span", "\u2022", "cm-invalidchar");
+    token.title = "\\u" + ch.charCodeAt(0).toString(16);
+    token.setAttribute("aria-label", token.title);
+    return token
+  }
+
+  // Build up the DOM representation for a single token, and add it to
+  // the line map. Takes care to render special characters separately.
+  function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
+    if (!text) { return }
+    var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
+    var special = builder.cm.state.specialChars, mustWrap = false;
+    var content;
+    if (!special.test(text)) {
+      builder.col += text.length;
+      content = document.createTextNode(displayText);
+      builder.map.push(builder.pos, builder.pos + text.length, content);
+      if (ie && ie_version < 9) { mustWrap = true; }
+      builder.pos += text.length;
+    } else {
+      content = document.createDocumentFragment();
+      var pos = 0;
+      while (true) {
+        special.lastIndex = pos;
+        var m = special.exec(text);
+        var skipped = m ? m.index - pos : text.length - pos;
+        if (skipped) {
+          var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
+          if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
+          else { content.appendChild(txt); }
+          builder.map.push(builder.pos, builder.pos + skipped, txt);
+          builder.col += skipped;
+          builder.pos += skipped;
+        }
+        if (!m) { break }
+        pos += skipped + 1;
+        var txt$1 = (void 0);
+        if (m[0] == "\t") {
+          var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
+          txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
+          txt$1.setAttribute("role", "presentation");
+          txt$1.setAttribute("cm-text", "\t");
+          builder.col += tabWidth;
+        } else if (m[0] == "\r" || m[0] == "\n") {
+          txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
+          txt$1.setAttribute("cm-text", m[0]);
+          builder.col += 1;
+        } else {
+          txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
+          txt$1.setAttribute("cm-text", m[0]);
+          if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
+          else { content.appendChild(txt$1); }
+          builder.col += 1;
+        }
+        builder.map.push(builder.pos, builder.pos + 1, txt$1);
+        builder.pos++;
+      }
+    }
+    builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
+    if (style || startStyle || endStyle || mustWrap || css || attributes) {
+      var fullStyle = style || "";
+      if (startStyle) { fullStyle += startStyle; }
+      if (endStyle) { fullStyle += endStyle; }
+      var token = elt("span", [content], fullStyle, css);
+      if (attributes) {
+        for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
+          { token.setAttribute(attr, attributes[attr]); } }
+      }
+      return builder.content.appendChild(token)
+    }
+    builder.content.appendChild(content);
+  }
+
+  // Change some spaces to NBSP to prevent the browser from collapsing
+  // trailing spaces at the end of a line when rendering text (issue #1362).
+  function splitSpaces(text, trailingBefore) {
+    if (text.length > 1 && !/  /.test(text)) { return text }
+    var spaceBefore = trailingBefore, result = "";
+    for (var i = 0; i < text.length; i++) {
+      var ch = text.charAt(i);
+      if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
+        { ch = "\u00a0"; }
+      result += ch;
+      spaceBefore = ch == " ";
+    }
+    return result
+  }
+
+  // Work around nonsense dimensions being reported for stretches of
+  // right-to-left text.
+  function buildTokenBadBidi(inner, order) {
+    return function (builder, text, style, startStyle, endStyle, css, attributes) {
+      style = style ? style + " cm-force-border" : "cm-force-border";
+      var start = builder.pos, end = start + text.length;
+      for (;;) {
+        // Find the part that overlaps with the start of this text
+        var part = (void 0);
+        for (var i = 0; i < order.length; i++) {
+          part = order[i];
+          if (part.to > start && part.from <= start) { break }
+        }
+        if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
+        inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
+        startStyle = null;
+        text = text.slice(part.to - start);
+        start = part.to;
+      }
+    }
+  }
+
+  function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
+    var widget = !ignoreWidget && marker.widgetNode;
+    if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
+    if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
+      if (!widget)
+        { widget = builder.content.appendChild(document.createElement("span")); }
+      widget.setAttribute("cm-marker", marker.id);
+    }
+    if (widget) {
+      builder.cm.display.input.setUneditable(widget);
+      builder.content.appendChild(widget);
+    }
+    builder.pos += size;
+    builder.trailingSpace = false;
+  }
+
+  // Outputs a number of spans to make up a line, taking highlighting
+  // and marked text into account.
+  function insertLineContent(line, builder, styles) {
+    var spans = line.markedSpans, allText = line.text, at = 0;
+    if (!spans) {
+      for (var i$1 = 1; i$1 < styles.length; i$1+=2)
+        { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
+      return
+    }
+
+    var len = allText.length, pos = 0, i = 1, text = "", style, css;
+    var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
+    for (;;) {
+      if (nextChange == pos) { // Update current marker set
+        spanStyle = spanEndStyle = spanStartStyle = css = "";
+        attributes = null;
+        collapsed = null; nextChange = Infinity;
+        var foundBookmarks = [], endStyles = (void 0);
+        for (var j = 0; j < spans.length; ++j) {
+          var sp = spans[j], m = sp.marker;
+          if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
+            foundBookmarks.push(m);
+          } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
+            if (sp.to != null && sp.to != pos && nextChange > sp.to) {
+              nextChange = sp.to;
+              spanEndStyle = "";
+            }
+            if (m.className) { spanStyle += " " + m.className; }
+            if (m.css) { css = (css ? css + ";" : "") + m.css; }
+            if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
+            if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
+            // support for the old title property
+            // https://github.com/codemirror/CodeMirror/pull/5673
+            if (m.title) { (attributes || (attributes = {})).title = m.title; }
+            if (m.attributes) {
+              for (var attr in m.attributes)
+                { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
+            }
+            if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
+              { collapsed = sp; }
+          } else if (sp.from > pos && nextChange > sp.from) {
+            nextChange = sp.from;
+          }
+        }
+        if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
+          { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
+
+        if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
+          { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
+        if (collapsed && (collapsed.from || 0) == pos) {
+          buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
+                             collapsed.marker, collapsed.from == null);
+          if (collapsed.to == null) { return }
+          if (collapsed.to == pos) { collapsed = false; }
+        }
+      }
+      if (pos >= len) { break }
+
+      var upto = Math.min(len, nextChange);
+      while (true) {
+        if (text) {
+          var end = pos + text.length;
+          if (!collapsed) {
+            var tokenText = end > upto ? text.slice(0, upto - pos) : text;
+            builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
+                             spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
+          }
+          if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
+          pos = end;
+          spanStartStyle = "";
+        }
+        text = allText.slice(at, at = styles[i++]);
+        style = interpretTokenStyle(styles[i++], builder.cm.options);
+      }
+    }
+  }
+
+
+  // These objects are used to represent the visible (currently drawn)
+  // part of the document. A LineView may correspond to multiple
+  // logical lines, if those are connected by collapsed ranges.
+  function LineView(doc, line, lineN) {
+    // The starting line
+    this.line = line;
+    // Continuing lines, if any
+    this.rest = visualLineContinued(line);
+    // Number of logical lines in this visual line
+    this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
+    this.node = this.text = null;
+    this.hidden = lineIsHidden(doc, line);
+  }
+
+  // Create a range of LineView objects for the given lines.
+  function buildViewArray(cm, from, to) {
+    var array = [], nextPos;
+    for (var pos = from; pos < to; pos = nextPos) {
+      var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
+      nextPos = pos + view.size;
+      array.push(view);
+    }
+    return array
+  }
+
+  var operationGroup = null;
+
+  function pushOperation(op) {
+    if (operationGroup) {
+      operationGroup.ops.push(op);
+    } else {
+      op.ownsGroup = operationGroup = {
+        ops: [op],
+        delayedCallbacks: []
+      };
+    }
+  }
+
+  function fireCallbacksForOps(group) {
+    // Calls delayed callbacks and cursorActivity handlers until no
+    // new ones appear
+    var callbacks = group.delayedCallbacks, i = 0;
+    do {
+      for (; i < callbacks.length; i++)
+        { callbacks[i].call(null); }
+      for (var j = 0; j < group.ops.length; j++) {
+        var op = group.ops[j];
+        if (op.cursorActivityHandlers)
+          { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
+            { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
+      }
+    } while (i < callbacks.length)
+  }
+
+  function finishOperation(op, endCb) {
+    var group = op.ownsGroup;
+    if (!group) { return }
+
+    try { fireCallbacksForOps(group); }
+    finally {
+      operationGroup = null;
+      endCb(group);
+    }
+  }
+
+  var orphanDelayedCallbacks = null;
+
+  // Often, we want to signal events at a point where we are in the
+  // middle of some work, but don't want the handler to start calling
+  // other methods on the editor, which might be in an inconsistent
+  // state or simply not expect any other events to happen.
+  // signalLater looks whether there are any handlers, and schedules
+  // them to be executed when the last operation ends, or, if no
+  // operation is active, when a timeout fires.
+  function signalLater(emitter, type /*, values...*/) {
+    var arr = getHandlers(emitter, type);
+    if (!arr.length) { return }
+    var args = Array.prototype.slice.call(arguments, 2), list;
+    if (operationGroup) {
+      list = operationGroup.delayedCallbacks;
+    } else if (orphanDelayedCallbacks) {
+      list = orphanDelayedCallbacks;
+    } else {
+      list = orphanDelayedCallbacks = [];
+      setTimeout(fireOrphanDelayed, 0);
+    }
+    var loop = function ( i ) {
+      list.push(function () { return arr[i].apply(null, args); });
+    };
+
+    for (var i = 0; i < arr.length; ++i)
+      loop( i );
+  }
+
+  function fireOrphanDelayed() {
+    var delayed = orphanDelayedCallbacks;
+    orphanDelayedCallbacks = null;
+    for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
+  }
+
+  // When an aspect of a line changes, a string is added to
+  // lineView.changes. This updates the relevant part of the line's
+  // DOM structure.
+  function updateLineForChanges(cm, lineView, lineN, dims) {
+    for (var j = 0; j < lineView.changes.length; j++) {
+      var type = lineView.changes[j];
+      if (type == "text") { updateLineText(cm, lineView); }
+      else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
+      else if (type == "class") { updateLineClasses(cm, lineView); }
+      else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
+    }
+    lineView.changes = null;
+  }
+
+  // Lines with gutter elements, widgets or a background class need to
+  // be wrapped, and have the extra elements added to the wrapper div
+  function ensureLineWrapped(lineView) {
+    if (lineView.node == lineView.text) {
+      lineView.node = elt("div", null, null, "position: relative");
+      if (lineView.text.parentNode)
+        { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
+      lineView.node.appendChild(lineView.text);
+      if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
+    }
+    return lineView.node
+  }
+
+  function updateLineBackground(cm, lineView) {
+    var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
+    if (cls) { cls += " CodeMirror-linebackground"; }
+    if (lineView.background) {
+      if (cls) { lineView.background.className = cls; }
+      else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
+    } else if (cls) {
+      var wrap = ensureLineWrapped(lineView);
+      lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
+      cm.display.input.setUneditable(lineView.background);
+    }
+  }
+
+  // Wrapper around buildLineContent which will reuse the structure
+  // in display.externalMeasured when possible.
+  function getLineContent(cm, lineView) {
+    var ext = cm.display.externalMeasured;
+    if (ext && ext.line == lineView.line) {
+      cm.display.externalMeasured = null;
+      lineView.measure = ext.measure;
+      return ext.built
+    }
+    return buildLineContent(cm, lineView)
+  }
+
+  // Redraw the line's text. Interacts with the background and text
+  // classes because the mode may output tokens that influence these
+  // classes.
+  function updateLineText(cm, lineView) {
+    var cls = lineView.text.className;
+    var built = getLineContent(cm, lineView);
+    if (lineView.text == lineView.node) { lineView.node = built.pre; }
+    lineView.text.parentNode.replaceChild(built.pre, lineView.text);
+    lineView.text = built.pre;
+    if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
+      lineView.bgClass = built.bgClass;
+      lineView.textClass = built.textClass;
+      updateLineClasses(cm, lineView);
+    } else if (cls) {
+      lineView.text.className = cls;
+    }
+  }
+
+  function updateLineClasses(cm, lineView) {
+    updateLineBackground(cm, lineView);
+    if (lineView.line.wrapClass)
+      { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
+    else if (lineView.node != lineView.text)
+      { lineView.node.className = ""; }
+    var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
+    lineView.text.className = textClass || "";
+  }
+
+  function updateLineGutter(cm, lineView, lineN, dims) {
+    if (lineView.gutter) {
+      lineView.node.removeChild(lineView.gutter);
+      lineView.gutter = null;
+    }
+    if (lineView.gutterBackground) {
+      lineView.node.removeChild(lineView.gutterBackground);
+      lineView.gutterBackground = null;
+    }
+    if (lineView.line.gutterClass) {
+      var wrap = ensureLineWrapped(lineView);
+      lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
+                                      ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
+      cm.display.input.setUneditable(lineView.gutterBackground);
+      wrap.insertBefore(lineView.gutterBackground, lineView.text);
+    }
+    var markers = lineView.line.gutterMarkers;
+    if (cm.options.lineNumbers || markers) {
+      var wrap$1 = ensureLineWrapped(lineView);
+      var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
+      gutterWrap.setAttribute("aria-hidden", "true");
+      cm.display.input.setUneditable(gutterWrap);
+      wrap$1.insertBefore(gutterWrap, lineView.text);
+      if (lineView.line.gutterClass)
+        { gutterWrap.className += " " + lineView.line.gutterClass; }
+      if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
+        { lineView.lineNumber = gutterWrap.appendChild(
+          elt("div", lineNumberFor(cm.options, lineN),
+              "CodeMirror-linenumber CodeMirror-gutter-elt",
+              ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
+      if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {
+        var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];
+        if (found)
+          { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
+                                     ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
+      } }
+    }
+  }
+
+  function updateLineWidgets(cm, lineView, dims) {
+    if (lineView.alignable) { lineView.alignable = null; }
+    var isWidget = classTest("CodeMirror-linewidget");
+    for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
+      next = node.nextSibling;
+      if (isWidget.test(node.className)) { lineView.node.removeChild(node); }
+    }
+    insertLineWidgets(cm, lineView, dims);
+  }
+
+  // Build a line's DOM representation from scratch
+  function buildLineElement(cm, lineView, lineN, dims) {
+    var built = getLineContent(cm, lineView);
+    lineView.text = lineView.node = built.pre;
+    if (built.bgClass) { lineView.bgClass = built.bgClass; }
+    if (built.textClass) { lineView.textClass = built.textClass; }
+
+    updateLineClasses(cm, lineView);
+    updateLineGutter(cm, lineView, lineN, dims);
+    insertLineWidgets(cm, lineView, dims);
+    return lineView.node
+  }
+
+  // A lineView may contain multiple logical lines (when merged by
+  // collapsed spans). The widgets for all of them need to be drawn.
+  function insertLineWidgets(cm, lineView, dims) {
+    insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
+    if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
+      { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
+  }
+
+  function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
+    if (!line.widgets) { return }
+    var wrap = ensureLineWrapped(lineView);
+    for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
+      var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""));
+      if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
+      positionLineWidget(widget, node, lineView, dims);
+      cm.display.input.setUneditable(node);
+      if (allowAbove && widget.above)
+        { wrap.insertBefore(node, lineView.gutter || lineView.text); }
+      else
+        { wrap.appendChild(node); }
+      signalLater(widget, "redraw");
+    }
+  }
+
+  function positionLineWidget(widget, node, lineView, dims) {
+    if (widget.noHScroll) {
+  (lineView.alignable || (lineView.alignable = [])).push(node);
+      var width = dims.wrapperWidth;
+      node.style.left = dims.fixedPos + "px";
+      if (!widget.coverGutter) {
+        width -= dims.gutterTotalWidth;
+        node.style.paddingLeft = dims.gutterTotalWidth + "px";
+      }
+      node.style.width = width + "px";
+    }
+    if (widget.coverGutter) {
+      node.style.zIndex = 5;
+      node.style.position = "relative";
+      if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
+    }
+  }
+
+  function widgetHeight(widget) {
+    if (widget.height != null) { return widget.height }
+    var cm = widget.doc.cm;
+    if (!cm) { return 0 }
+    if (!contains(document.body, widget.node)) {
+      var parentStyle = "position: relative;";
+      if (widget.coverGutter)
+        { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
+      if (widget.noHScroll)
+        { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
+      removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
+    }
+    return widget.height = widget.node.parentNode.offsetHeight
+  }
+
+  // Return true when the given mouse event happened in a widget
+  function eventInWidget(display, e) {
+    for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
+      if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
+          (n.parentNode == display.sizer && n != display.mover))
+        { return true }
+    }
+  }
+
+  // POSITION MEASUREMENT
+
+  function paddingTop(display) {return display.lineSpace.offsetTop}
+  function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
+  function paddingH(display) {
+    if (display.cachedPaddingH) { return display.cachedPaddingH }
+    var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
+    var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
+    var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
+    if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
+    return data
+  }
+
+  function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
+  function displayWidth(cm) {
+    return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
+  }
+  function displayHeight(cm) {
+    return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
+  }
+
+  // Ensure the lineView.wrapping.heights array is populated. This is
+  // an array of bottom offsets for the lines that make up a drawn
+  // line. When lineWrapping is on, there might be more than one
+  // height.
+  function ensureLineHeights(cm, lineView, rect) {
+    var wrapping = cm.options.lineWrapping;
+    var curWidth = wrapping && displayWidth(cm);
+    if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
+      var heights = lineView.measure.heights = [];
+      if (wrapping) {
+        lineView.measure.width = curWidth;
+        var rects = lineView.text.firstChild.getClientRects();
+        for (var i = 0; i < rects.length - 1; i++) {
+          var cur = rects[i], next = rects[i + 1];
+          if (Math.abs(cur.bottom - next.bottom) > 2)
+            { heights.push((cur.bottom + next.top) / 2 - rect.top); }
+        }
+      }
+      heights.push(rect.bottom - rect.top);
+    }
+  }
+
+  // Find a line map (mapping character offsets to text nodes) and a
+  // measurement cache for the given line number. (A line view might
+  // contain multiple lines when collapsed ranges are present.)
+  function mapFromLineView(lineView, line, lineN) {
+    if (lineView.line == line)
+      { return {map: lineView.measure.map, cache: lineView.measure.cache} }
+    if (lineView.rest) {
+      for (var i = 0; i < lineView.rest.length; i++)
+        { if (lineView.rest[i] == line)
+          { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
+      for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
+        { if (lineNo(lineView.rest[i$1]) > lineN)
+          { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
+    }
+  }
+
+  // Render a line into the hidden node display.externalMeasured. Used
+  // when measurement is needed for a line that's not in the viewport.
+  function updateExternalMeasurement(cm, line) {
+    line = visualLine(line);
+    var lineN = lineNo(line);
+    var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
+    view.lineN = lineN;
+    var built = view.built = buildLineContent(cm, view);
+    view.text = built.pre;
+    removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
+    return view
+  }
+
+  // Get a {top, bottom, left, right} box (in line-local coordinates)
+  // for a given character.
+  function measureChar(cm, line, ch, bias) {
+    return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
+  }
+
+  // Find a line view that corresponds to the given line number.
+  function findViewForLine(cm, lineN) {
+    if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
+      { return cm.display.view[findViewIndex(cm, lineN)] }
+    var ext = cm.display.externalMeasured;
+    if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
+      { return ext }
+  }
+
+  // Measurement can be split in two steps, the set-up work that
+  // applies to the whole line, and the measurement of the actual
+  // character. Functions like coordsChar, that need to do a lot of
+  // measurements in a row, can thus ensure that the set-up work is
+  // only done once.
+  function prepareMeasureForLine(cm, line) {
+    var lineN = lineNo(line);
+    var view = findViewForLine(cm, lineN);
+    if (view && !view.text) {
+      view = null;
+    } else if (view && view.changes) {
+      updateLineForChanges(cm, view, lineN, getDimensions(cm));
+      cm.curOp.forceUpdate = true;
+    }
+    if (!view)
+      { view = updateExternalMeasurement(cm, line); }
+
+    var info = mapFromLineView(view, line, lineN);
+    return {
+      line: line, view: view, rect: null,
+      map: info.map, cache: info.cache, before: info.before,
+      hasHeights: false
+    }
+  }
+
+  // Given a prepared measurement object, measures the position of an
+  // actual character (or fetches it from the cache).
+  function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
+    if (prepared.before) { ch = -1; }
+    var key = ch + (bias || ""), found;
+    if (prepared.cache.hasOwnProperty(key)) {
+      found = prepared.cache[key];
+    } else {
+      if (!prepared.rect)
+        { prepared.rect = prepared.view.text.getBoundingClientRect(); }
+      if (!prepared.hasHeights) {
+        ensureLineHeights(cm, prepared.view, prepared.rect);
+        prepared.hasHeights = true;
+      }
+      found = measureCharInner(cm, prepared, ch, bias);
+      if (!found.bogus) { prepared.cache[key] = found; }
+    }
+    return {left: found.left, right: found.right,
+            top: varHeight ? found.rtop : found.top,
+            bottom: varHeight ? found.rbottom : found.bottom}
+  }
+
+  var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
+
+  function nodeAndOffsetInLineMap(map, ch, bias) {
+    var node, start, end, collapse, mStart, mEnd;
+    // First, search the line map for the text node corresponding to,
+    // or closest to, the target character.
+    for (var i = 0; i < map.length; i += 3) {
+      mStart = map[i];
+      mEnd = map[i + 1];
+      if (ch < mStart) {
+        start = 0; end = 1;
+        collapse = "left";
+      } else if (ch < mEnd) {
+        start = ch - mStart;
+        end = start + 1;
+      } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
+        end = mEnd - mStart;
+        start = end - 1;
+        if (ch >= mEnd) { collapse = "right"; }
+      }
+      if (start != null) {
+        node = map[i + 2];
+        if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
+          { collapse = bias; }
+        if (bias == "left" && start == 0)
+          { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
+            node = map[(i -= 3) + 2];
+            collapse = "left";
+          } }
+        if (bias == "right" && start == mEnd - mStart)
+          { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
+            node = map[(i += 3) + 2];
+            collapse = "right";
+          } }
+        break
+      }
+    }
+    return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
+  }
+
+  function getUsefulRect(rects, bias) {
+    var rect = nullRect;
+    if (bias == "left") { for (var i = 0; i < rects.length; i++) {
+      if ((rect = rects[i]).left != rect.right) { break }
+    } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
+      if ((rect = rects[i$1]).left != rect.right) { break }
+    } }
+    return rect
+  }
+
+  function measureCharInner(cm, prepared, ch, bias) {
+    var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
+    var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
+
+    var rect;
+    if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
+      for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
+        while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
+        while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
+        if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
+          { rect = node.parentNode.getBoundingClientRect(); }
+        else
+          { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
+        if (rect.left || rect.right || start == 0) { break }
+        end = start;
+        start = start - 1;
+        collapse = "right";
+      }
+      if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
+    } else { // If it is a widget, simply get the box for the whole widget.
+      if (start > 0) { collapse = bias = "right"; }
+      var rects;
+      if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
+        { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
+      else
+        { rect = node.getBoundingClientRect(); }
+    }
+    if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
+      var rSpan = node.parentNode.getClientRects()[0];
+      if (rSpan)
+        { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
+      else
+        { rect = nullRect; }
+    }
+
+    var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
+    var mid = (rtop + rbot) / 2;
+    var heights = prepared.view.measure.heights;
+    var i = 0;
+    for (; i < heights.length - 1; i++)
+      { if (mid < heights[i]) { break } }
+    var top = i ? heights[i - 1] : 0, bot = heights[i];
+    var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
+                  right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
+                  top: top, bottom: bot};
+    if (!rect.left && !rect.right) { result.bogus = true; }
+    if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
+
+    return result
+  }
+
+  // Work around problem with bounding client rects on ranges being
+  // returned incorrectly when zoomed on IE10 and below.
+  function maybeUpdateRectForZooming(measure, rect) {
+    if (!window.screen || screen.logicalXDPI == null ||
+        screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
+      { return rect }
+    var scaleX = screen.logicalXDPI / screen.deviceXDPI;
+    var scaleY = screen.logicalYDPI / screen.deviceYDPI;
+    return {left: rect.left * scaleX, right: rect.right * scaleX,
+            top: rect.top * scaleY, bottom: rect.bottom * scaleY}
+  }
+
+  function clearLineMeasurementCacheFor(lineView) {
+    if (lineView.measure) {
+      lineView.measure.cache = {};
+      lineView.measure.heights = null;
+      if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
+        { lineView.measure.caches[i] = {}; } }
+    }
+  }
+
+  function clearLineMeasurementCache(cm) {
+    cm.display.externalMeasure = null;
+    removeChildren(cm.display.lineMeasure);
+    for (var i = 0; i < cm.display.view.length; i++)
+      { clearLineMeasurementCacheFor(cm.display.view[i]); }
+  }
+
+  function clearCaches(cm) {
+    clearLineMeasurementCache(cm);
+    cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
+    if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
+    cm.display.lineNumChars = null;
+  }
+
+  function pageScrollX(doc) {
+    // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
+    // which causes page_Offset and bounding client rects to use
+    // different reference viewports and invalidate our calculations.
+    if (chrome && android) { return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft)) }
+    return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft
+  }
+  function pageScrollY(doc) {
+    if (chrome && android) { return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop)) }
+    return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop
+  }
+
+  function widgetTopHeight(lineObj) {
+    var ref = visualLine(lineObj);
+    var widgets = ref.widgets;
+    var height = 0;
+    if (widgets) { for (var i = 0; i < widgets.length; ++i) { if (widgets[i].above)
+      { height += widgetHeight(widgets[i]); } } }
+    return height
+  }
+
+  // Converts a {top, bottom, left, right} box from line-local
+  // coordinates into another coordinate system. Context may be one of
+  // "line", "div" (display.lineDiv), "local"./null (editor), "window",
+  // or "page".
+  function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
+    if (!includeWidgets) {
+      var height = widgetTopHeight(lineObj);
+      rect.top += height; rect.bottom += height;
+    }
+    if (context == "line") { return rect }
+    if (!context) { context = "local"; }
+    var yOff = heightAtLine(lineObj);
+    if (context == "local") { yOff += paddingTop(cm.display); }
+    else { yOff -= cm.display.viewOffset; }
+    if (context == "page" || context == "window") {
+      var lOff = cm.display.lineSpace.getBoundingClientRect();
+      yOff += lOff.top + (context == "window" ? 0 : pageScrollY(doc(cm)));
+      var xOff = lOff.left + (context == "window" ? 0 : pageScrollX(doc(cm)));
+      rect.left += xOff; rect.right += xOff;
+    }
+    rect.top += yOff; rect.bottom += yOff;
+    return rect
+  }
+
+  // Coverts a box from "div" coords to another coordinate system.
+  // Context may be "window", "page", "div", or "local"./null.
+  function fromCoordSystem(cm, coords, context) {
+    if (context == "div") { return coords }
+    var left = coords.left, top = coords.top;
+    // First move into "page" coordinate system
+    if (context == "page") {
+      left -= pageScrollX(doc(cm));
+      top -= pageScrollY(doc(cm));
+    } else if (context == "local" || !context) {
+      var localBox = cm.display.sizer.getBoundingClientRect();
+      left += localBox.left;
+      top += localBox.top;
+    }
+
+    var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
+    return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
+  }
+
+  function charCoords(cm, pos, context, lineObj, bias) {
+    if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
+    return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
+  }
+
+  // Returns a box for a given cursor position, which may have an
+  // 'other' property containing the position of the secondary cursor
+  // on a bidi boundary.
+  // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
+  // and after `char - 1` in writing order of `char - 1`
+  // A cursor Pos(line, char, "after") is on the same visual line as `char`
+  // and before `char` in writing order of `char`
+  // Examples (upper-case letters are RTL, lower-case are LTR):
+  //     Pos(0, 1, ...)
+  //     before   after
+  // ab     a|b     a|b
+  // aB     a|B     aB|
+  // Ab     |Ab     A|b
+  // AB     B|A     B|A
+  // Every position after the last character on a line is considered to stick
+  // to the last character on the line.
+  function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
+    lineObj = lineObj || getLine(cm.doc, pos.line);
+    if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
+    function get(ch, right) {
+      var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
+      if (right) { m.left = m.right; } else { m.right = m.left; }
+      return intoCoordSystem(cm, lineObj, m, context)
+    }
+    var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
+    if (ch >= lineObj.text.length) {
+      ch = lineObj.text.length;
+      sticky = "before";
+    } else if (ch <= 0) {
+      ch = 0;
+      sticky = "after";
+    }
+    if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
+
+    function getBidi(ch, partPos, invert) {
+      var part = order[partPos], right = part.level == 1;
+      return get(invert ? ch - 1 : ch, right != invert)
+    }
+    var partPos = getBidiPartAt(order, ch, sticky);
+    var other = bidiOther;
+    var val = getBidi(ch, partPos, sticky == "before");
+    if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
+    return val
+  }
+
+  // Used to cheaply estimate the coordinates for a position. Used for
+  // intermediate scroll updates.
+  function estimateCoords(cm, pos) {
+    var left = 0;
+    pos = clipPos(cm.doc, pos);
+    if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
+    var lineObj = getLine(cm.doc, pos.line);
+    var top = heightAtLine(lineObj) + paddingTop(cm.display);
+    return {left: left, right: left, top: top, bottom: top + lineObj.height}
+  }
+
+  // Positions returned by coordsChar contain some extra information.
+  // xRel is the relative x position of the input coordinates compared
+  // to the found position (so xRel > 0 means the coordinates are to
+  // the right of the character position, for example). When outside
+  // is true, that means the coordinates lie outside the line's
+  // vertical range.
+  function PosWithInfo(line, ch, sticky, outside, xRel) {
+    var pos = Pos(line, ch, sticky);
+    pos.xRel = xRel;
+    if (outside) { pos.outside = outside; }
+    return pos
+  }
+
+  // Compute the character position closest to the given coordinates.
+  // Input must be lineSpace-local ("div" coordinate system).
+  function coordsChar(cm, x, y) {
+    var doc = cm.doc;
+    y += cm.display.viewOffset;
+    if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
+    var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
+    if (lineN > last)
+      { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
+    if (x < 0) { x = 0; }
+
+    var lineObj = getLine(doc, lineN);
+    for (;;) {
+      var found = coordsCharInner(cm, lineObj, lineN, x, y);
+      var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
+      if (!collapsed) { return found }
+      var rangeEnd = collapsed.find(1);
+      if (rangeEnd.line == lineN) { return rangeEnd }
+      lineObj = getLine(doc, lineN = rangeEnd.line);
+    }
+  }
+
+  function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
+    y -= widgetTopHeight(lineObj);
+    var end = lineObj.text.length;
+    var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
+    end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
+    return {begin: begin, end: end}
+  }
+
+  function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
+    if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
+    var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
+    return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
+  }
+
+  // Returns true if the given side of a box is after the given
+  // coordinates, in top-to-bottom, left-to-right order.
+  function boxIsAfter(box, x, y, left) {
+    return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
+  }
+
+  function coordsCharInner(cm, lineObj, lineNo, x, y) {
+    // Move y into line-local coordinate space
+    y -= heightAtLine(lineObj);
+    var preparedMeasure = prepareMeasureForLine(cm, lineObj);
+    // When directly calling `measureCharPrepared`, we have to adjust
+    // for the widgets at this line.
+    var widgetHeight = widgetTopHeight(lineObj);
+    var begin = 0, end = lineObj.text.length, ltr = true;
+
+    var order = getOrder(lineObj, cm.doc.direction);
+    // If the line isn't plain left-to-right text, first figure out
+    // which bidi section the coordinates fall into.
+    if (order) {
+      var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
+                   (cm, lineObj, lineNo, preparedMeasure, order, x, y);
+      ltr = part.level != 1;
+      // The awkward -1 offsets are needed because findFirst (called
+      // on these below) will treat its first bound as inclusive,
+      // second as exclusive, but we want to actually address the
+      // characters in the part's range
+      begin = ltr ? part.from : part.to - 1;
+      end = ltr ? part.to : part.from - 1;
+    }
+
+    // A binary search to find the first character whose bounding box
+    // starts after the coordinates. If we run across any whose box wrap
+    // the coordinates, store that.
+    var chAround = null, boxAround = null;
+    var ch = findFirst(function (ch) {
+      var box = measureCharPrepared(cm, preparedMeasure, ch);
+      box.top += widgetHeight; box.bottom += widgetHeight;
+      if (!boxIsAfter(box, x, y, false)) { return false }
+      if (box.top <= y && box.left <= x) {
+        chAround = ch;
+        boxAround = box;
+      }
+      return true
+    }, begin, end);
+
+    var baseX, sticky, outside = false;
+    // If a box around the coordinates was found, use that
+    if (boxAround) {
+      // Distinguish coordinates nearer to the left or right side of the box
+      var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
+      ch = chAround + (atStart ? 0 : 1);
+      sticky = atStart ? "after" : "before";
+      baseX = atLeft ? boxAround.left : boxAround.right;
+    } else {
+      // (Adjust for extended bound, if necessary.)
+      if (!ltr && (ch == end || ch == begin)) { ch++; }
+      // To determine which side to associate with, get the box to the
+      // left of the character and compare it's vertical position to the
+      // coordinates
+      sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
+        (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
+        "after" : "before";
+      // Now get accurate coordinates for this place, in order to get a
+      // base X position
+      var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure);
+      baseX = coords.left;
+      outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
+    }
+
+    ch = skipExtendingChars(lineObj.text, ch, 1);
+    return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
+  }
+
+  function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
+    // Bidi parts are sorted left-to-right, and in a non-line-wrapping
+    // situation, we can take this ordering to correspond to the visual
+    // ordering. This finds the first part whose end is after the given
+    // coordinates.
+    var index = findFirst(function (i) {
+      var part = order[i], ltr = part.level != 1;
+      return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
+                                     "line", lineObj, preparedMeasure), x, y, true)
+    }, 0, order.length - 1);
+    var part = order[index];
+    // If this isn't the first part, the part's start is also after
+    // the coordinates, and the coordinates aren't on the same line as
+    // that start, move one part back.
+    if (index > 0) {
+      var ltr = part.level != 1;
+      var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
+                               "line", lineObj, preparedMeasure);
+      if (boxIsAfter(start, x, y, true) && start.top > y)
+        { part = order[index - 1]; }
+    }
+    return part
+  }
+
+  function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
+    // In a wrapped line, rtl text on wrapping boundaries can do things
+    // that don't correspond to the ordering in our `order` array at
+    // all, so a binary search doesn't work, and we want to return a
+    // part that only spans one line so that the binary search in
+    // coordsCharInner is safe. As such, we first find the extent of the
+    // wrapped line, and then do a flat search in which we discard any
+    // spans that aren't on the line.
+    var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
+    var begin = ref.begin;
+    var end = ref.end;
+    if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
+    var part = null, closestDist = null;
+    for (var i = 0; i < order.length; i++) {
+      var p = order[i];
+      if (p.from >= end || p.to <= begin) { continue }
+      var ltr = p.level != 1;
+      var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
+      // Weigh against spans ending before this, so that they are only
+      // picked if nothing ends after
+      var dist = endX < x ? x - endX + 1e9 : endX - x;
+      if (!part || closestDist > dist) {
+        part = p;
+        closestDist = dist;
+      }
+    }
+    if (!part) { part = order[order.length - 1]; }
+    // Clip the part to the wrapped line.
+    if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
+    if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
+    return part
+  }
+
+  var measureText;
+  // Compute the default text height.
+  function textHeight(display) {
+    if (display.cachedTextHeight != null) { return display.cachedTextHeight }
+    if (measureText == null) {
+      measureText = elt("pre", null, "CodeMirror-line-like");
+      // Measure a bunch of lines, for browsers that compute
+      // fractional heights.
+      for (var i = 0; i < 49; ++i) {
+        measureText.appendChild(document.createTextNode("x"));
+        measureText.appendChild(elt("br"));
+      }
+      measureText.appendChild(document.createTextNode("x"));
+    }
+    removeChildrenAndAdd(display.measure, measureText);
+    var height = measureText.offsetHeight / 50;
+    if (height > 3) { display.cachedTextHeight = height; }
+    removeChildren(display.measure);
+    return height || 1
+  }
+
+  // Compute the default character width.
+  function charWidth(display) {
+    if (display.cachedCharWidth != null) { return display.cachedCharWidth }
+    var anchor = elt("span", "xxxxxxxxxx");
+    var pre = elt("pre", [anchor], "CodeMirror-line-like");
+    removeChildrenAndAdd(display.measure, pre);
+    var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
+    if (width > 2) { display.cachedCharWidth = width; }
+    return width || 10
+  }
+
+  // Do a bulk-read of the DOM positions and sizes needed to draw the
+  // view, so that we don't interleave reading and writing to the DOM.
+  function getDimensions(cm) {
+    var d = cm.display, left = {}, width = {};
+    var gutterLeft = d.gutters.clientLeft;
+    for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
+      var id = cm.display.gutterSpecs[i].className;
+      left[id] = n.offsetLeft + n.clientLeft + gutterLeft;
+      width[id] = n.clientWidth;
+    }
+    return {fixedPos: compensateForHScroll(d),
+            gutterTotalWidth: d.gutters.offsetWidth,
+            gutterLeft: left,
+            gutterWidth: width,
+            wrapperWidth: d.wrapper.clientWidth}
+  }
+
+  // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
+  // but using getBoundingClientRect to get a sub-pixel-accurate
+  // result.
+  function compensateForHScroll(display) {
+    return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
+  }
+
+  // Returns a function that estimates the height of a line, to use as
+  // first approximation until the line becomes visible (and is thus
+  // properly measurable).
+  function estimateHeight(cm) {
+    var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
+    var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
+    return function (line) {
+      if (lineIsHidden(cm.doc, line)) { return 0 }
+
+      var widgetsHeight = 0;
+      if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
+        if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
+      } }
+
+      if (wrapping)
+        { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
+      else
+        { return widgetsHeight + th }
+    }
+  }
+
+  function estimateLineHeights(cm) {
+    var doc = cm.doc, est = estimateHeight(cm);
+    doc.iter(function (line) {
+      var estHeight = est(line);
+      if (estHeight != line.height) { updateLineHeight(line, estHeight); }
+    });
+  }
+
+  // Given a mouse event, find the corresponding position. If liberal
+  // is false, it checks whether a gutter or scrollbar was clicked,
+  // and returns null if it was. forRect is used by rectangular
+  // selections, and tries to estimate a character position even for
+  // coordinates beyond the right of the text.
+  function posFromMouse(cm, e, liberal, forRect) {
+    var display = cm.display;
+    if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
+
+    var x, y, space = display.lineSpace.getBoundingClientRect();
+    // Fails unpredictably on IE[67] when mouse is dragged around quickly.
+    try { x = e.clientX - space.left; y = e.clientY - space.top; }
+    catch (e$1) { return null }
+    var coords = coordsChar(cm, x, y), line;
+    if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
+      var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
+      coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
+    }
+    return coords
+  }
+
+  // Find the view element corresponding to a given line. Return null
+  // when the line isn't visible.
+  function findViewIndex(cm, n) {
+    if (n >= cm.display.viewTo) { return null }
+    n -= cm.display.viewFrom;
+    if (n < 0) { return null }
+    var view = cm.display.view;
+    for (var i = 0; i < view.length; i++) {
+      n -= view[i].size;
+      if (n < 0) { return i }
+    }
+  }
+
+  // Updates the display.view data structure for a given change to the
+  // document. From and to are in pre-change coordinates. Lendiff is
+  // the amount of lines added or subtracted by the change. This is
+  // used for changes that span multiple lines, or change the way
+  // lines are divided into visual lines. regLineChange (below)
+  // registers single-line changes.
+  function regChange(cm, from, to, lendiff) {
+    if (from == null) { from = cm.doc.first; }
+    if (to == null) { to = cm.doc.first + cm.doc.size; }
+    if (!lendiff) { lendiff = 0; }
+
+    var display = cm.display;
+    if (lendiff && to < display.viewTo &&
+        (display.updateLineNumbers == null || display.updateLineNumbers > from))
+      { display.updateLineNumbers = from; }
+
+    cm.curOp.viewChanged = true;
+
+    if (from >= display.viewTo) { // Change after
+      if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
+        { resetView(cm); }
+    } else if (to <= display.viewFrom) { // Change before
+      if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
+        resetView(cm);
+      } else {
+        display.viewFrom += lendiff;
+        display.viewTo += lendiff;
+      }
+    } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
+      resetView(cm);
+    } else if (from <= display.viewFrom) { // Top overlap
+      var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
+      if (cut) {
+        display.view = display.view.slice(cut.index);
+        display.viewFrom = cut.lineN;
+        display.viewTo += lendiff;
+      } else {
+        resetView(cm);
+      }
+    } else if (to >= display.viewTo) { // Bottom overlap
+      var cut$1 = viewCuttingPoint(cm, from, from, -1);
+      if (cut$1) {
+        display.view = display.view.slice(0, cut$1.index);
+        display.viewTo = cut$1.lineN;
+      } else {
+        resetView(cm);
+      }
+    } else { // Gap in the middle
+      var cutTop = viewCuttingPoint(cm, from, from, -1);
+      var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
+      if (cutTop && cutBot) {
+        display.view = display.view.slice(0, cutTop.index)
+          .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
+          .concat(display.view.slice(cutBot.index));
+        display.viewTo += lendiff;
+      } else {
+        resetView(cm);
+      }
+    }
+
+    var ext = display.externalMeasured;
+    if (ext) {
+      if (to < ext.lineN)
+        { ext.lineN += lendiff; }
+      else if (from < ext.lineN + ext.size)
+        { display.externalMeasured = null; }
+    }
+  }
+
+  // Register a change to a single line. Type must be one of "text",
+  // "gutter", "class", "widget"
+  function regLineChange(cm, line, type) {
+    cm.curOp.viewChanged = true;
+    var display = cm.display, ext = cm.display.externalMeasured;
+    if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
+      { display.externalMeasured = null; }
+
+    if (line < display.viewFrom || line >= display.viewTo) { return }
+    var lineView = display.view[findViewIndex(cm, line)];
+    if (lineView.node == null) { return }
+    var arr = lineView.changes || (lineView.changes = []);
+    if (indexOf(arr, type) == -1) { arr.push(type); }
+  }
+
+  // Clear the view.
+  function resetView(cm) {
+    cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
+    cm.display.view = [];
+    cm.display.viewOffset = 0;
+  }
+
+  function viewCuttingPoint(cm, oldN, newN, dir) {
+    var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
+    if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
+      { return {index: index, lineN: newN} }
+    var n = cm.display.viewFrom;
+    for (var i = 0; i < index; i++)
+      { n += view[i].size; }
+    if (n != oldN) {
+      if (dir > 0) {
+        if (index == view.length - 1) { return null }
+        diff = (n + view[index].size) - oldN;
+        index++;
+      } else {
+        diff = n - oldN;
+      }
+      oldN += diff; newN += diff;
+    }
+    while (visualLineNo(cm.doc, newN) != newN) {
+      if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
+      newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
+      index += dir;
+    }
+    return {index: index, lineN: newN}
+  }
+
+  // Force the view to cover a given range, adding empty view element
+  // or clipping off existing ones as needed.
+  function adjustView(cm, from, to) {
+    var display = cm.display, view = display.view;
+    if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
+      display.view = buildViewArray(cm, from, to);
+      display.viewFrom = from;
+    } else {
+      if (display.viewFrom > from)
+        { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
+      else if (display.viewFrom < from)
+        { display.view = display.view.slice(findViewIndex(cm, from)); }
+      display.viewFrom = from;
+      if (display.viewTo < to)
+        { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
+      else if (display.viewTo > to)
+        { display.view = display.view.slice(0, findViewIndex(cm, to)); }
+    }
+    display.viewTo = to;
+  }
+
+  // Count the number of lines in the view whose DOM representation is
+  // out of date (or nonexistent).
+  function countDirtyView(cm) {
+    var view = cm.display.view, dirty = 0;
+    for (var i = 0; i < view.length; i++) {
+      var lineView = view[i];
+      if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
+    }
+    return dirty
+  }
+
+  function updateSelection(cm) {
+    cm.display.input.showSelection(cm.display.input.prepareSelection());
+  }
+
+  function prepareSelection(cm, primary) {
+    if ( primary === void 0 ) primary = true;
+
+    var doc = cm.doc, result = {};
+    var curFragment = result.cursors = document.createDocumentFragment();
+    var selFragment = result.selection = document.createDocumentFragment();
+
+    var customCursor = cm.options.$customCursor;
+    if (customCursor) { primary = true; }
+    for (var i = 0; i < doc.sel.ranges.length; i++) {
+      if (!primary && i == doc.sel.primIndex) { continue }
+      var range = doc.sel.ranges[i];
+      if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
+      var collapsed = range.empty();
+      if (customCursor) {
+        var head = customCursor(cm, range);
+        if (head) { drawSelectionCursor(cm, head, curFragment); }
+      } else if (collapsed || cm.options.showCursorWhenSelecting) {
+        drawSelectionCursor(cm, range.head, curFragment);
+      }
+      if (!collapsed)
+        { drawSelectionRange(cm, range, selFragment); }
+    }
+    return result
+  }
+
+  // Draws a cursor for the given range
+  function drawSelectionCursor(cm, head, output) {
+    var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
+
+    var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
+    cursor.style.left = pos.left + "px";
+    cursor.style.top = pos.top + "px";
+    cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
+
+    if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) {
+      var charPos = charCoords(cm, head, "div", null, null);
+      var width = charPos.right - charPos.left;
+      cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px";
+    }
+
+    if (pos.other) {
+      // Secondary cursor, shown when on a 'jump' in bi-directional text
+      var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
+      otherCursor.style.display = "";
+      otherCursor.style.left = pos.other.left + "px";
+      otherCursor.style.top = pos.other.top + "px";
+      otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
+    }
+  }
+
+  function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
+
+  // Draws the given range as a highlighted selection
+  function drawSelectionRange(cm, range, output) {
+    var display = cm.display, doc = cm.doc;
+    var fragment = document.createDocumentFragment();
+    var padding = paddingH(cm.display), leftSide = padding.left;
+    var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
+    var docLTR = doc.direction == "ltr";
+
+    function add(left, top, width, bottom) {
+      if (top < 0) { top = 0; }
+      top = Math.round(top);
+      bottom = Math.round(bottom);
+      fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n                             top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n                             height: " + (bottom - top) + "px")));
+    }
+
+    function drawForLine(line, fromArg, toArg) {
+      var lineObj = getLine(doc, line);
+      var lineLen = lineObj.text.length;
+      var start, end;
+      function coords(ch, bias) {
+        return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
+      }
+
+      function wrapX(pos, dir, side) {
+        var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
+        var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
+        var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
+        return coords(ch, prop)[prop]
+      }
+
+      var order = getOrder(lineObj, doc.direction);
+      iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
+        var ltr = dir == "ltr";
+        var fromPos = coords(from, ltr ? "left" : "right");
+        var toPos = coords(to - 1, ltr ? "right" : "left");
+
+        var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
+        var first = i == 0, last = !order || i == order.length - 1;
+        if (toPos.top - fromPos.top <= 3) { // Single line
+          var openLeft = (docLTR ? openStart : openEnd) && first;
+          var openRight = (docLTR ? openEnd : openStart) && last;
+          var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
+          var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
+          add(left, fromPos.top, right - left, fromPos.bottom);
+        } else { // Multiple lines
+          var topLeft, topRight, botLeft, botRight;
+          if (ltr) {
+            topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
+            topRight = docLTR ? rightSide : wrapX(from, dir, "before");
+            botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
+            botRight = docLTR && openEnd && last ? rightSide : toPos.right;
+          } else {
+            topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
+            topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
+            botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
+            botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
+          }
+          add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
+          if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
+          add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
+        }
+
+        if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
+        if (cmpCoords(toPos, start) < 0) { start = toPos; }
+        if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
+        if (cmpCoords(toPos, end) < 0) { end = toPos; }
+      });
+      return {start: start, end: end}
+    }
+
+    var sFrom = range.from(), sTo = range.to();
+    if (sFrom.line == sTo.line) {
+      drawForLine(sFrom.line, sFrom.ch, sTo.ch);
+    } else {
+      var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
+      var singleVLine = visualLine(fromLine) == visualLine(toLine);
+      var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
+      var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
+      if (singleVLine) {
+        if (leftEnd.top < rightStart.top - 2) {
+          add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
+          add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
+        } else {
+          add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
+        }
+      }
+      if (leftEnd.bottom < rightStart.top)
+        { add(leftSide, leftEnd.bottom, null, rightStart.top); }
+    }
+
+    output.appendChild(fragment);
+  }
+
+  // Cursor-blinking
+  function restartBlink(cm) {
+    if (!cm.state.focused) { return }
+    var display = cm.display;
+    clearInterval(display.blinker);
+    var on = true;
+    display.cursorDiv.style.visibility = "";
+    if (cm.options.cursorBlinkRate > 0)
+      { display.blinker = setInterval(function () {
+        if (!cm.hasFocus()) { onBlur(cm); }
+        display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
+      }, cm.options.cursorBlinkRate); }
+    else if (cm.options.cursorBlinkRate < 0)
+      { display.cursorDiv.style.visibility = "hidden"; }
+  }
+
+  function ensureFocus(cm) {
+    if (!cm.hasFocus()) {
+      cm.display.input.focus();
+      if (!cm.state.focused) { onFocus(cm); }
+    }
+  }
+
+  function delayBlurEvent(cm) {
+    cm.state.delayingBlurEvent = true;
+    setTimeout(function () { if (cm.state.delayingBlurEvent) {
+      cm.state.delayingBlurEvent = false;
+      if (cm.state.focused) { onBlur(cm); }
+    } }, 100);
+  }
+
+  function onFocus(cm, e) {
+    if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }
+
+    if (cm.options.readOnly == "nocursor") { return }
+    if (!cm.state.focused) {
+      signal(cm, "focus", cm, e);
+      cm.state.focused = true;
+      addClass(cm.display.wrapper, "CodeMirror-focused");
+      // This test prevents this from firing when a context
+      // menu is closed (since the input reset would kill the
+      // select-all detection hack)
+      if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
+        cm.display.input.reset();
+        if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
+      }
+      cm.display.input.receivedFocus();
+    }
+    restartBlink(cm);
+  }
+  function onBlur(cm, e) {
+    if (cm.state.delayingBlurEvent) { return }
+
+    if (cm.state.focused) {
+      signal(cm, "blur", cm, e);
+      cm.state.focused = false;
+      rmClass(cm.display.wrapper, "CodeMirror-focused");
+    }
+    clearInterval(cm.display.blinker);
+    setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
+  }
+
+  // Read the actual heights of the rendered lines, and update their
+  // stored heights to match.
+  function updateHeightsInViewport(cm) {
+    var display = cm.display;
+    var prevBottom = display.lineDiv.offsetTop;
+    var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);
+    var oldHeight = display.lineDiv.getBoundingClientRect().top;
+    var mustScroll = 0;
+    for (var i = 0; i < display.view.length; i++) {
+      var cur = display.view[i], wrapping = cm.options.lineWrapping;
+      var height = (void 0), width = 0;
+      if (cur.hidden) { continue }
+      oldHeight += cur.line.height;
+      if (ie && ie_version < 8) {
+        var bot = cur.node.offsetTop + cur.node.offsetHeight;
+        height = bot - prevBottom;
+        prevBottom = bot;
+      } else {
+        var box = cur.node.getBoundingClientRect();
+        height = box.bottom - box.top;
+        // Check that lines don't extend past the right of the current
+        // editor width
+        if (!wrapping && cur.text.firstChild)
+          { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
+      }
+      var diff = cur.line.height - height;
+      if (diff > .005 || diff < -.005) {
+        if (oldHeight < viewTop) { mustScroll -= diff; }
+        updateLineHeight(cur.line, height);
+        updateWidgetHeight(cur.line);
+        if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
+          { updateWidgetHeight(cur.rest[j]); } }
+      }
+      if (width > cm.display.sizerWidth) {
+        var chWidth = Math.ceil(width / charWidth(cm.display));
+        if (chWidth > cm.display.maxLineLength) {
+          cm.display.maxLineLength = chWidth;
+          cm.display.maxLine = cur.line;
+          cm.display.maxLineChanged = true;
+        }
+      }
+    }
+    if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }
+  }
+
+  // Read and store the height of line widgets associated with the
+  // given line.
+  function updateWidgetHeight(line) {
+    if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
+      var w = line.widgets[i], parent = w.node.parentNode;
+      if (parent) { w.height = parent.offsetHeight; }
+    } }
+  }
+
+  // Compute the lines that are visible in a given viewport (defaults
+  // the current scroll position). viewport may contain top,
+  // height, and ensure (see op.scrollToPos) properties.
+  function visibleLines(display, doc, viewport) {
+    var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
+    top = Math.floor(top - paddingTop(display));
+    var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
+
+    var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
+    // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
+    // forces those lines into the viewport (if possible).
+    if (viewport && viewport.ensure) {
+      var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
+      if (ensureFrom < from) {
+        from = ensureFrom;
+        to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
+      } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
+        from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
+        to = ensureTo;
+      }
+    }
+    return {from: from, to: Math.max(to, from + 1)}
+  }
+
+  // SCROLLING THINGS INTO VIEW
+
+  // If an editor sits on the top or bottom of the window, partially
+  // scrolled out of view, this ensures that the cursor is visible.
+  function maybeScrollWindow(cm, rect) {
+    if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
+
+    var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
+    var doc = display.wrapper.ownerDocument;
+    if (rect.top + box.top < 0) { doScroll = true; }
+    else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }
+    if (doScroll != null && !phantom) {
+      var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n                         top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n                         height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n                         left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
+      cm.display.lineSpace.appendChild(scrollNode);
+      scrollNode.scrollIntoView(doScroll);
+      cm.display.lineSpace.removeChild(scrollNode);
+    }
+  }
+
+  // Scroll a given position into view (immediately), verifying that
+  // it actually became visible (as line heights are accurately
+  // measured, the position of something may 'drift' during drawing).
+  function scrollPosIntoView(cm, pos, end, margin) {
+    if (margin == null) { margin = 0; }
+    var rect;
+    if (!cm.options.lineWrapping && pos == end) {
+      // Set pos and end to the cursor positions around the character pos sticks to
+      // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
+      // If pos == Pos(_, 0, "before"), pos and end are unchanged
+      end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
+      pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
+    }
+    for (var limit = 0; limit < 5; limit++) {
+      var changed = false;
+      var coords = cursorCoords(cm, pos);
+      var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
+      rect = {left: Math.min(coords.left, endCoords.left),
+              top: Math.min(coords.top, endCoords.top) - margin,
+              right: Math.max(coords.left, endCoords.left),
+              bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
+      var scrollPos = calculateScrollPos(cm, rect);
+      var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
+      if (scrollPos.scrollTop != null) {
+        updateScrollTop(cm, scrollPos.scrollTop);
+        if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
+      }
+      if (scrollPos.scrollLeft != null) {
+        setScrollLeft(cm, scrollPos.scrollLeft);
+        if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
+      }
+      if (!changed) { break }
+    }
+    return rect
+  }
+
+  // Scroll a given set of coordinates into view (immediately).
+  function scrollIntoView(cm, rect) {
+    var scrollPos = calculateScrollPos(cm, rect);
+    if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
+    if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
+  }
+
+  // Calculate a new scroll position needed to scroll the given
+  // rectangle into view. Returns an object with scrollTop and
+  // scrollLeft properties. When these are undefined, the
+  // vertical/horizontal position does not need to be adjusted.
+  function calculateScrollPos(cm, rect) {
+    var display = cm.display, snapMargin = textHeight(cm.display);
+    if (rect.top < 0) { rect.top = 0; }
+    var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
+    var screen = displayHeight(cm), result = {};
+    if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
+    var docBottom = cm.doc.height + paddingVert(display);
+    var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
+    if (rect.top < screentop) {
+      result.scrollTop = atTop ? 0 : rect.top;
+    } else if (rect.bottom > screentop + screen) {
+      var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
+      if (newTop != screentop) { result.scrollTop = newTop; }
+    }
+
+    var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;
+    var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;
+    var screenw = displayWidth(cm) - display.gutters.offsetWidth;
+    var tooWide = rect.right - rect.left > screenw;
+    if (tooWide) { rect.right = rect.left + screenw; }
+    if (rect.left < 10)
+      { result.scrollLeft = 0; }
+    else if (rect.left < screenleft)
+      { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }
+    else if (rect.right > screenw + screenleft - 3)
+      { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
+    return result
+  }
+
+  // Store a relative adjustment to the scroll position in the current
+  // operation (to be applied when the operation finishes).
+  function addToScrollTop(cm, top) {
+    if (top == null) { return }
+    resolveScrollToPos(cm);
+    cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
+  }
+
+  // Make sure that at the end of the operation the current cursor is
+  // shown.
+  function ensureCursorVisible(cm) {
+    resolveScrollToPos(cm);
+    var cur = cm.getCursor();
+    cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
+  }
+
+  function scrollToCoords(cm, x, y) {
+    if (x != null || y != null) { resolveScrollToPos(cm); }
+    if (x != null) { cm.curOp.scrollLeft = x; }
+    if (y != null) { cm.curOp.scrollTop = y; }
+  }
+
+  function scrollToRange(cm, range) {
+    resolveScrollToPos(cm);
+    cm.curOp.scrollToPos = range;
+  }
+
+  // When an operation has its scrollToPos property set, and another
+  // scroll action is applied before the end of the operation, this
+  // 'simulates' scrolling that position into view in a cheap way, so
+  // that the effect of intermediate scroll commands is not ignored.
+  function resolveScrollToPos(cm) {
+    var range = cm.curOp.scrollToPos;
+    if (range) {
+      cm.curOp.scrollToPos = null;
+      var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
+      scrollToCoordsRange(cm, from, to, range.margin);
+    }
+  }
+
+  function scrollToCoordsRange(cm, from, to, margin) {
+    var sPos = calculateScrollPos(cm, {
+      left: Math.min(from.left, to.left),
+      top: Math.min(from.top, to.top) - margin,
+      right: Math.max(from.right, to.right),
+      bottom: Math.max(from.bottom, to.bottom) + margin
+    });
+    scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
+  }
+
+  // Sync the scrollable area and scrollbars, ensure the viewport
+  // covers the visible area.
+  function updateScrollTop(cm, val) {
+    if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
+    if (!gecko) { updateDisplaySimple(cm, {top: val}); }
+    setScrollTop(cm, val, true);
+    if (gecko) { updateDisplaySimple(cm); }
+    startWorker(cm, 100);
+  }
+
+  function setScrollTop(cm, val, forceScroll) {
+    val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));
+    if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
+    cm.doc.scrollTop = val;
+    cm.display.scrollbars.setScrollTop(val);
+    if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
+  }
+
+  // Sync scroller and scrollbar, ensure the gutter elements are
+  // aligned.
+  function setScrollLeft(cm, val, isScroller, forceScroll) {
+    val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));
+    if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
+    cm.doc.scrollLeft = val;
+    alignHorizontally(cm);
+    if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
+    cm.display.scrollbars.setScrollLeft(val);
+  }
+
+  // SCROLLBARS
+
+  // Prepare DOM reads needed to update the scrollbars. Done in one
+  // shot to minimize update/measure roundtrips.
+  function measureForScrollbars(cm) {
+    var d = cm.display, gutterW = d.gutters.offsetWidth;
+    var docH = Math.round(cm.doc.height + paddingVert(cm.display));
+    return {
+      clientHeight: d.scroller.clientHeight,
+      viewHeight: d.wrapper.clientHeight,
+      scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
+      viewWidth: d.wrapper.clientWidth,
+      barLeft: cm.options.fixedGutter ? gutterW : 0,
+      docHeight: docH,
+      scrollHeight: docH + scrollGap(cm) + d.barHeight,
+      nativeBarWidth: d.nativeBarWidth,
+      gutterWidth: gutterW
+    }
+  }
+
+  var NativeScrollbars = function(place, scroll, cm) {
+    this.cm = cm;
+    var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
+    var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
+    vert.tabIndex = horiz.tabIndex = -1;
+    place(vert); place(horiz);
+
+    on(vert, "scroll", function () {
+      if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
+    });
+    on(horiz, "scroll", function () {
+      if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
+    });
+
+    this.checkedZeroWidth = false;
+    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
+    if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
+  };
+
+  NativeScrollbars.prototype.update = function (measure) {
+    var needsH = measure.scrollWidth > measure.clientWidth + 1;
+    var needsV = measure.scrollHeight > measure.clientHeight + 1;
+    var sWidth = measure.nativeBarWidth;
+
+    if (needsV) {
+      this.vert.style.display = "block";
+      this.vert.style.bottom = needsH ? sWidth + "px" : "0";
+      var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
+      // A bug in IE8 can cause this value to be negative, so guard it.
+      this.vert.firstChild.style.height =
+        Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
+    } else {
+      this.vert.scrollTop = 0;
+      this.vert.style.display = "";
+      this.vert.firstChild.style.height = "0";
+    }
+
+    if (needsH) {
+      this.horiz.style.display = "block";
+      this.horiz.style.right = needsV ? sWidth + "px" : "0";
+      this.horiz.style.left = measure.barLeft + "px";
+      var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
+      this.horiz.firstChild.style.width =
+        Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
+    } else {
+      this.horiz.style.display = "";
+      this.horiz.firstChild.style.width = "0";
+    }
+
+    if (!this.checkedZeroWidth && measure.clientHeight > 0) {
+      if (sWidth == 0) { this.zeroWidthHack(); }
+      this.checkedZeroWidth = true;
+    }
+
+    return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
+  };
+
+  NativeScrollbars.prototype.setScrollLeft = function (pos) {
+    if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
+    if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
+  };
+
+  NativeScrollbars.prototype.setScrollTop = function (pos) {
+    if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
+    if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
+  };
+
+  NativeScrollbars.prototype.zeroWidthHack = function () {
+    var w = mac && !mac_geMountainLion ? "12px" : "18px";
+    this.horiz.style.height = this.vert.style.width = w;
+    this.horiz.style.visibility = this.vert.style.visibility = "hidden";
+    this.disableHoriz = new Delayed;
+    this.disableVert = new Delayed;
+  };
+
+  NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
+    bar.style.visibility = "";
+    function maybeDisable() {
+      // To find out whether the scrollbar is still visible, we
+      // check whether the element under the pixel in the bottom
+      // right corner of the scrollbar box is the scrollbar box
+      // itself (when the bar is still visible) or its filler child
+      // (when the bar is hidden). If it is still visible, we keep
+      // it enabled, if it's hidden, we disable pointer events.
+      var box = bar.getBoundingClientRect();
+      var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
+          : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
+      if (elt != bar) { bar.style.visibility = "hidden"; }
+      else { delay.set(1000, maybeDisable); }
+    }
+    delay.set(1000, maybeDisable);
+  };
+
+  NativeScrollbars.prototype.clear = function () {
+    var parent = this.horiz.parentNode;
+    parent.removeChild(this.horiz);
+    parent.removeChild(this.vert);
+  };
+
+  var NullScrollbars = function () {};
+
+  NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
+  NullScrollbars.prototype.setScrollLeft = function () {};
+  NullScrollbars.prototype.setScrollTop = function () {};
+  NullScrollbars.prototype.clear = function () {};
+
+  function updateScrollbars(cm, measure) {
+    if (!measure) { measure = measureForScrollbars(cm); }
+    var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
+    updateScrollbarsInner(cm, measure);
+    for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
+      if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
+        { updateHeightsInViewport(cm); }
+      updateScrollbarsInner(cm, measureForScrollbars(cm));
+      startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
+    }
+  }
+
+  // Re-synchronize the fake scrollbars with the actual size of the
+  // content.
+  function updateScrollbarsInner(cm, measure) {
+    var d = cm.display;
+    var sizes = d.scrollbars.update(measure);
+
+    d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
+    d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
+    d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
+
+    if (sizes.right && sizes.bottom) {
+      d.scrollbarFiller.style.display = "block";
+      d.scrollbarFiller.style.height = sizes.bottom + "px";
+      d.scrollbarFiller.style.width = sizes.right + "px";
+    } else { d.scrollbarFiller.style.display = ""; }
+    if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
+      d.gutterFiller.style.display = "block";
+      d.gutterFiller.style.height = sizes.bottom + "px";
+      d.gutterFiller.style.width = measure.gutterWidth + "px";
+    } else { d.gutterFiller.style.display = ""; }
+  }
+
+  var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
+
+  function initScrollbars(cm) {
+    if (cm.display.scrollbars) {
+      cm.display.scrollbars.clear();
+      if (cm.display.scrollbars.addClass)
+        { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
+    }
+
+    cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
+      cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
+      // Prevent clicks in the scrollbars from killing focus
+      on(node, "mousedown", function () {
+        if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
+      });
+      node.setAttribute("cm-not-content", "true");
+    }, function (pos, axis) {
+      if (axis == "horizontal") { setScrollLeft(cm, pos); }
+      else { updateScrollTop(cm, pos); }
+    }, cm);
+    if (cm.display.scrollbars.addClass)
+      { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
+  }
+
+  // Operations are used to wrap a series of changes to the editor
+  // state in such a way that each change won't have to update the
+  // cursor and display (which would be awkward, slow, and
+  // error-prone). Instead, display updates are batched and then all
+  // combined and executed at once.
+
+  var nextOpId = 0;
+  // Start a new operation.
+  function startOperation(cm) {
+    cm.curOp = {
+      cm: cm,
+      viewChanged: false,      // Flag that indicates that lines might need to be redrawn
+      startHeight: cm.doc.height, // Used to detect need to update scrollbar
+      forceUpdate: false,      // Used to force a redraw
+      updateInput: 0,       // Whether to reset the input textarea
+      typing: false,           // Whether this reset should be careful to leave existing text (for compositing)
+      changeObjs: null,        // Accumulated changes, for firing change events
+      cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
+      cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
+      selectionChanged: false, // Whether the selection needs to be redrawn
+      updateMaxLine: false,    // Set when the widest line needs to be determined anew
+      scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
+      scrollToPos: null,       // Used to scroll to a specific position
+      focus: false,
+      id: ++nextOpId,          // Unique ID
+      markArrays: null         // Used by addMarkedSpan
+    };
+    pushOperation(cm.curOp);
+  }
+
+  // Finish an operation, updating the display and signalling delayed events
+  function endOperation(cm) {
+    var op = cm.curOp;
+    if (op) { finishOperation(op, function (group) {
+      for (var i = 0; i < group.ops.length; i++)
+        { group.ops[i].cm.curOp = null; }
+      endOperations(group);
+    }); }
+  }
+
+  // The DOM updates done when an operation finishes are batched so
+  // that the minimum number of relayouts are required.
+  function endOperations(group) {
+    var ops = group.ops;
+    for (var i = 0; i < ops.length; i++) // Read DOM
+      { endOperation_R1(ops[i]); }
+    for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
+      { endOperation_W1(ops[i$1]); }
+    for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
+      { endOperation_R2(ops[i$2]); }
+    for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
+      { endOperation_W2(ops[i$3]); }
+    for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
+      { endOperation_finish(ops[i$4]); }
+  }
+
+  function endOperation_R1(op) {
+    var cm = op.cm, display = cm.display;
+    maybeClipScrollbars(cm);
+    if (op.updateMaxLine) { findMaxLine(cm); }
+
+    op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
+      op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
+                         op.scrollToPos.to.line >= display.viewTo) ||
+      display.maxLineChanged && cm.options.lineWrapping;
+    op.update = op.mustUpdate &&
+      new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
+  }
+
+  function endOperation_W1(op) {
+    op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
+  }
+
+  function endOperation_R2(op) {
+    var cm = op.cm, display = cm.display;
+    if (op.updatedDisplay) { updateHeightsInViewport(cm); }
+
+    op.barMeasure = measureForScrollbars(cm);
+
+    // If the max line changed since it was last measured, measure it,
+    // and ensure the document's width matches it.
+    // updateDisplay_W2 will use these properties to do the actual resizing
+    if (display.maxLineChanged && !cm.options.lineWrapping) {
+      op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
+      cm.display.sizerWidth = op.adjustWidthTo;
+      op.barMeasure.scrollWidth =
+        Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
+      op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
+    }
+
+    if (op.updatedDisplay || op.selectionChanged)
+      { op.preparedSelection = display.input.prepareSelection(); }
+  }
+
+  function endOperation_W2(op) {
+    var cm = op.cm;
+
+    if (op.adjustWidthTo != null) {
+      cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
+      if (op.maxScrollLeft < cm.doc.scrollLeft)
+        { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
+      cm.display.maxLineChanged = false;
+    }
+
+    var takeFocus = op.focus && op.focus == activeElt(root(cm));
+    if (op.preparedSelection)
+      { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
+    if (op.updatedDisplay || op.startHeight != cm.doc.height)
+      { updateScrollbars(cm, op.barMeasure); }
+    if (op.updatedDisplay)
+      { setDocumentHeight(cm, op.barMeasure); }
+
+    if (op.selectionChanged) { restartBlink(cm); }
+
+    if (cm.state.focused && op.updateInput)
+      { cm.display.input.reset(op.typing); }
+    if (takeFocus) { ensureFocus(op.cm); }
+  }
+
+  function endOperation_finish(op) {
+    var cm = op.cm, display = cm.display, doc = cm.doc;
+
+    if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
+
+    // Abort mouse wheel delta measurement, when scrolling explicitly
+    if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
+      { display.wheelStartX = display.wheelStartY = null; }
+
+    // Propagate the scroll position to the actual DOM scroller
+    if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
+
+    if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
+    // If we need to scroll a specific position into view, do so.
+    if (op.scrollToPos) {
+      var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
+                                   clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
+      maybeScrollWindow(cm, rect);
+    }
+
+    // Fire events for markers that are hidden/unidden by editing or
+    // undoing
+    var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
+    if (hidden) { for (var i = 0; i < hidden.length; ++i)
+      { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
+    if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
+      { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
+
+    if (display.wrapper.offsetHeight)
+      { doc.scrollTop = cm.display.scroller.scrollTop; }
+
+    // Fire change events, and delayed event handlers
+    if (op.changeObjs)
+      { signal(cm, "changes", cm, op.changeObjs); }
+    if (op.update)
+      { op.update.finish(); }
+  }
+
+  // Run the given function in an operation
+  function runInOp(cm, f) {
+    if (cm.curOp) { return f() }
+    startOperation(cm);
+    try { return f() }
+    finally { endOperation(cm); }
+  }
+  // Wraps a function in an operation. Returns the wrapped function.
+  function operation(cm, f) {
+    return function() {
+      if (cm.curOp) { return f.apply(cm, arguments) }
+      startOperation(cm);
+      try { return f.apply(cm, arguments) }
+      finally { endOperation(cm); }
+    }
+  }
+  // Used to add methods to editor and doc instances, wrapping them in
+  // operations.
+  function methodOp(f) {
+    return function() {
+      if (this.curOp) { return f.apply(this, arguments) }
+      startOperation(this);
+      try { return f.apply(this, arguments) }
+      finally { endOperation(this); }
+    }
+  }
+  function docMethodOp(f) {
+    return function() {
+      var cm = this.cm;
+      if (!cm || cm.curOp) { return f.apply(this, arguments) }
+      startOperation(cm);
+      try { return f.apply(this, arguments) }
+      finally { endOperation(cm); }
+    }
+  }
+
+  // HIGHLIGHT WORKER
+
+  function startWorker(cm, time) {
+    if (cm.doc.highlightFrontier < cm.display.viewTo)
+      { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
+  }
+
+  function highlightWorker(cm) {
+    var doc = cm.doc;
+    if (doc.highlightFrontier >= cm.display.viewTo) { return }
+    var end = +new Date + cm.options.workTime;
+    var context = getContextBefore(cm, doc.highlightFrontier);
+    var changedLines = [];
+
+    doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
+      if (context.line >= cm.display.viewFrom) { // Visible
+        var oldStyles = line.styles;
+        var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
+        var highlighted = highlightLine(cm, line, context, true);
+        if (resetState) { context.state = resetState; }
+        line.styles = highlighted.styles;
+        var oldCls = line.styleClasses, newCls = highlighted.classes;
+        if (newCls) { line.styleClasses = newCls; }
+        else if (oldCls) { line.styleClasses = null; }
+        var ischange = !oldStyles || oldStyles.length != line.styles.length ||
+          oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
+        for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
+        if (ischange) { changedLines.push(context.line); }
+        line.stateAfter = context.save();
+        context.nextLine();
+      } else {
+        if (line.text.length <= cm.options.maxHighlightLength)
+          { processLine(cm, line.text, context); }
+        line.stateAfter = context.line % 5 == 0 ? context.save() : null;
+        context.nextLine();
+      }
+      if (+new Date > end) {
+        startWorker(cm, cm.options.workDelay);
+        return true
+      }
+    });
+    doc.highlightFrontier = context.line;
+    doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
+    if (changedLines.length) { runInOp(cm, function () {
+      for (var i = 0; i < changedLines.length; i++)
+        { regLineChange(cm, changedLines[i], "text"); }
+    }); }
+  }
+
+  // DISPLAY DRAWING
+
+  var DisplayUpdate = function(cm, viewport, force) {
+    var display = cm.display;
+
+    this.viewport = viewport;
+    // Store some values that we'll need later (but don't want to force a relayout for)
+    this.visible = visibleLines(display, cm.doc, viewport);
+    this.editorIsHidden = !display.wrapper.offsetWidth;
+    this.wrapperHeight = display.wrapper.clientHeight;
+    this.wrapperWidth = display.wrapper.clientWidth;
+    this.oldDisplayWidth = displayWidth(cm);
+    this.force = force;
+    this.dims = getDimensions(cm);
+    this.events = [];
+  };
+
+  DisplayUpdate.prototype.signal = function (emitter, type) {
+    if (hasHandler(emitter, type))
+      { this.events.push(arguments); }
+  };
+  DisplayUpdate.prototype.finish = function () {
+    for (var i = 0; i < this.events.length; i++)
+      { signal.apply(null, this.events[i]); }
+  };
+
+  function maybeClipScrollbars(cm) {
+    var display = cm.display;
+    if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
+      display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
+      display.heightForcer.style.height = scrollGap(cm) + "px";
+      display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
+      display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
+      display.scrollbarsClipped = true;
+    }
+  }
+
+  function selectionSnapshot(cm) {
+    if (cm.hasFocus()) { return null }
+    var active = activeElt(root(cm));
+    if (!active || !contains(cm.display.lineDiv, active)) { return null }
+    var result = {activeElt: active};
+    if (window.getSelection) {
+      var sel = win(cm).getSelection();
+      if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
+        result.anchorNode = sel.anchorNode;
+        result.anchorOffset = sel.anchorOffset;
+        result.focusNode = sel.focusNode;
+        result.focusOffset = sel.focusOffset;
+      }
+    }
+    return result
+  }
+
+  function restoreSelection(snapshot) {
+    if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(rootNode(snapshot.activeElt))) { return }
+    snapshot.activeElt.focus();
+    if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
+        snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
+      var doc = snapshot.activeElt.ownerDocument;
+      var sel = doc.defaultView.getSelection(), range = doc.createRange();
+      range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
+      range.collapse(false);
+      sel.removeAllRanges();
+      sel.addRange(range);
+      sel.extend(snapshot.focusNode, snapshot.focusOffset);
+    }
+  }
+
+  // Does the actual updating of the line display. Bails out
+  // (returning false) when there is nothing to be done and forced is
+  // false.
+  function updateDisplayIfNeeded(cm, update) {
+    var display = cm.display, doc = cm.doc;
+
+    if (update.editorIsHidden) {
+      resetView(cm);
+      return false
+    }
+
+    // Bail out if the visible area is already rendered and nothing changed.
+    if (!update.force &&
+        update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
+        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
+        display.renderedView == display.view && countDirtyView(cm) == 0)
+      { return false }
+
+    if (maybeUpdateLineNumberWidth(cm)) {
+      resetView(cm);
+      update.dims = getDimensions(cm);
+    }
+
+    // Compute a suitable new viewport (from & to)
+    var end = doc.first + doc.size;
+    var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
+    var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
+    if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
+    if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
+    if (sawCollapsedSpans) {
+      from = visualLineNo(cm.doc, from);
+      to = visualLineEndNo(cm.doc, to);
+    }
+
+    var different = from != display.viewFrom || to != display.viewTo ||
+      display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
+    adjustView(cm, from, to);
+
+    display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
+    // Position the mover div to align with the current scroll position
+    cm.display.mover.style.top = display.viewOffset + "px";
+
+    var toUpdate = countDirtyView(cm);
+    if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
+        (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
+      { return false }
+
+    // For big changes, we hide the enclosing element during the
+    // update, since that speeds up the operations on most browsers.
+    var selSnapshot = selectionSnapshot(cm);
+    if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
+    patchDisplay(cm, display.updateLineNumbers, update.dims);
+    if (toUpdate > 4) { display.lineDiv.style.display = ""; }
+    display.renderedView = display.view;
+    // There might have been a widget with a focused element that got
+    // hidden or updated, if so re-focus it.
+    restoreSelection(selSnapshot);
+
+    // Prevent selection and cursors from interfering with the scroll
+    // width and height.
+    removeChildren(display.cursorDiv);
+    removeChildren(display.selectionDiv);
+    display.gutters.style.height = display.sizer.style.minHeight = 0;
+
+    if (different) {
+      display.lastWrapHeight = update.wrapperHeight;
+      display.lastWrapWidth = update.wrapperWidth;
+      startWorker(cm, 400);
+    }
+
+    display.updateLineNumbers = null;
+
+    return true
+  }
+
+  function postUpdateDisplay(cm, update) {
+    var viewport = update.viewport;
+
+    for (var first = true;; first = false) {
+      if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
+        // Clip forced viewport to actual scrollable area.
+        if (viewport && viewport.top != null)
+          { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
+        // Updated line heights might result in the drawn area not
+        // actually covering the viewport. Keep looping until it does.
+        update.visible = visibleLines(cm.display, cm.doc, viewport);
+        if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
+          { break }
+      } else if (first) {
+        update.visible = visibleLines(cm.display, cm.doc, viewport);
+      }
+      if (!updateDisplayIfNeeded(cm, update)) { break }
+      updateHeightsInViewport(cm);
+      var barMeasure = measureForScrollbars(cm);
+      updateSelection(cm);
+      updateScrollbars(cm, barMeasure);
+      setDocumentHeight(cm, barMeasure);
+      update.force = false;
+    }
+
+    update.signal(cm, "update", cm);
+    if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
+      update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
+      cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
+    }
+  }
+
+  function updateDisplaySimple(cm, viewport) {
+    var update = new DisplayUpdate(cm, viewport);
+    if (updateDisplayIfNeeded(cm, update)) {
+      updateHeightsInViewport(cm);
+      postUpdateDisplay(cm, update);
+      var barMeasure = measureForScrollbars(cm);
+      updateSelection(cm);
+      updateScrollbars(cm, barMeasure);
+      setDocumentHeight(cm, barMeasure);
+      update.finish();
+    }
+  }
+
+  // Sync the actual display DOM structure with display.view, removing
+  // nodes for lines that are no longer in view, and creating the ones
+  // that are not there yet, and updating the ones that are out of
+  // date.
+  function patchDisplay(cm, updateNumbersFrom, dims) {
+    var display = cm.display, lineNumbers = cm.options.lineNumbers;
+    var container = display.lineDiv, cur = container.firstChild;
+
+    function rm(node) {
+      var next = node.nextSibling;
+      // Works around a throw-scroll bug in OS X Webkit
+      if (webkit && mac && cm.display.currentWheelTarget == node)
+        { node.style.display = "none"; }
+      else
+        { node.parentNode.removeChild(node); }
+      return next
+    }
+
+    var view = display.view, lineN = display.viewFrom;
+    // Loop over the elements in the view, syncing cur (the DOM nodes
+    // in display.lineDiv) with the view as we go.
+    for (var i = 0; i < view.length; i++) {
+      var lineView = view[i];
+      if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
+        var node = buildLineElement(cm, lineView, lineN, dims);
+        container.insertBefore(node, cur);
+      } else { // Already drawn
+        while (cur != lineView.node) { cur = rm(cur); }
+        var updateNumber = lineNumbers && updateNumbersFrom != null &&
+          updateNumbersFrom <= lineN && lineView.lineNumber;
+        if (lineView.changes) {
+          if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
+          updateLineForChanges(cm, lineView, lineN, dims);
+        }
+        if (updateNumber) {
+          removeChildren(lineView.lineNumber);
+          lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
+        }
+        cur = lineView.node.nextSibling;
+      }
+      lineN += lineView.size;
+    }
+    while (cur) { cur = rm(cur); }
+  }
+
+  function updateGutterSpace(display) {
+    var width = display.gutters.offsetWidth;
+    display.sizer.style.marginLeft = width + "px";
+    // Send an event to consumers responding to changes in gutter width.
+    signalLater(display, "gutterChanged", display);
+  }
+
+  function setDocumentHeight(cm, measure) {
+    cm.display.sizer.style.minHeight = measure.docHeight + "px";
+    cm.display.heightForcer.style.top = measure.docHeight + "px";
+    cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
+  }
+
+  // Re-align line numbers and gutter marks to compensate for
+  // horizontal scrolling.
+  function alignHorizontally(cm) {
+    var display = cm.display, view = display.view;
+    if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
+    var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
+    var gutterW = display.gutters.offsetWidth, left = comp + "px";
+    for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
+      if (cm.options.fixedGutter) {
+        if (view[i].gutter)
+          { view[i].gutter.style.left = left; }
+        if (view[i].gutterBackground)
+          { view[i].gutterBackground.style.left = left; }
+      }
+      var align = view[i].alignable;
+      if (align) { for (var j = 0; j < align.length; j++)
+        { align[j].style.left = left; } }
+    } }
+    if (cm.options.fixedGutter)
+      { display.gutters.style.left = (comp + gutterW) + "px"; }
+  }
+
+  // Used to ensure that the line number gutter is still the right
+  // size for the current document size. Returns true when an update
+  // is needed.
+  function maybeUpdateLineNumberWidth(cm) {
+    if (!cm.options.lineNumbers) { return false }
+    var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
+    if (last.length != display.lineNumChars) {
+      var test = display.measure.appendChild(elt("div", [elt("div", last)],
+                                                 "CodeMirror-linenumber CodeMirror-gutter-elt"));
+      var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
+      display.lineGutter.style.width = "";
+      display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
+      display.lineNumWidth = display.lineNumInnerWidth + padding;
+      display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
+      display.lineGutter.style.width = display.lineNumWidth + "px";
+      updateGutterSpace(cm.display);
+      return true
+    }
+    return false
+  }
+
+  function getGutters(gutters, lineNumbers) {
+    var result = [], sawLineNumbers = false;
+    for (var i = 0; i < gutters.length; i++) {
+      var name = gutters[i], style = null;
+      if (typeof name != "string") { style = name.style; name = name.className; }
+      if (name == "CodeMirror-linenumbers") {
+        if (!lineNumbers) { continue }
+        else { sawLineNumbers = true; }
+      }
+      result.push({className: name, style: style});
+    }
+    if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); }
+    return result
+  }
+
+  // Rebuild the gutter elements, ensure the margin to the left of the
+  // code matches their width.
+  function renderGutters(display) {
+    var gutters = display.gutters, specs = display.gutterSpecs;
+    removeChildren(gutters);
+    display.lineGutter = null;
+    for (var i = 0; i < specs.length; ++i) {
+      var ref = specs[i];
+      var className = ref.className;
+      var style = ref.style;
+      var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className));
+      if (style) { gElt.style.cssText = style; }
+      if (className == "CodeMirror-linenumbers") {
+        display.lineGutter = gElt;
+        gElt.style.width = (display.lineNumWidth || 1) + "px";
+      }
+    }
+    gutters.style.display = specs.length ? "" : "none";
+    updateGutterSpace(display);
+  }
+
+  function updateGutters(cm) {
+    renderGutters(cm.display);
+    regChange(cm);
+    alignHorizontally(cm);
+  }
+
+  // The display handles the DOM integration, both for input reading
+  // and content drawing. It holds references to DOM nodes and
+  // display-related state.
+
+  function Display(place, doc, input, options) {
+    var d = this;
+    this.input = input;
+
+    // Covers bottom-right square when both scrollbars are present.
+    d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
+    d.scrollbarFiller.setAttribute("cm-not-content", "true");
+    // Covers bottom of gutter when coverGutterNextToScrollbar is on
+    // and h scrollbar is present.
+    d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
+    d.gutterFiller.setAttribute("cm-not-content", "true");
+    // Will contain the actual code, positioned to cover the viewport.
+    d.lineDiv = eltP("div", null, "CodeMirror-code");
+    // Elements are added to these to represent selection and cursors.
+    d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
+    d.cursorDiv = elt("div", null, "CodeMirror-cursors");
+    // A visibility: hidden element used to find the size of things.
+    d.measure = elt("div", null, "CodeMirror-measure");
+    // When lines outside of the viewport are measured, they are drawn in this.
+    d.lineMeasure = elt("div", null, "CodeMirror-measure");
+    // Wraps everything that needs to exist inside the vertically-padded coordinate system
+    d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
+                      null, "position: relative; outline: none");
+    var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
+    // Moved around its parent to cover visible view.
+    d.mover = elt("div", [lines], null, "position: relative");
+    // Set to the height of the document, allowing scrolling.
+    d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
+    d.sizerWidth = null;
+    // Behavior of elts with overflow: auto and padding is
+    // inconsistent across browsers. This is used to ensure the
+    // scrollable area is big enough.
+    d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
+    // Will contain the gutters, if any.
+    d.gutters = elt("div", null, "CodeMirror-gutters");
+    d.lineGutter = null;
+    // Actual scrollable element.
+    d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
+    d.scroller.setAttribute("tabIndex", "-1");
+    // The element in which the editor lives.
+    d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
+    // See #6982. FIXME remove when this has been fixed for a while in Chrome
+    if (chrome && chrome_version >= 105) { d.wrapper.style.clipPath = "inset(0px)"; }
+
+    // This attribute is respected by automatic translation systems such as Google Translate,
+    // and may also be respected by tools used by human translators.
+    d.wrapper.setAttribute('translate', 'no');
+
+    // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
+    if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
+    if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
+
+    if (place) {
+      if (place.appendChild) { place.appendChild(d.wrapper); }
+      else { place(d.wrapper); }
+    }
+
+    // Current rendered range (may be bigger than the view window).
+    d.viewFrom = d.viewTo = doc.first;
+    d.reportedViewFrom = d.reportedViewTo = doc.first;
+    // Information about the rendered lines.
+    d.view = [];
+    d.renderedView = null;
+    // Holds info about a single rendered line when it was rendered
+    // for measurement, while not in view.
+    d.externalMeasured = null;
+    // Empty space (in pixels) above the view
+    d.viewOffset = 0;
+    d.lastWrapHeight = d.lastWrapWidth = 0;
+    d.updateLineNumbers = null;
+
+    d.nativeBarWidth = d.barHeight = d.barWidth = 0;
+    d.scrollbarsClipped = false;
+
+    // Used to only resize the line number gutter when necessary (when
+    // the amount of lines crosses a boundary that makes its width change)
+    d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
+    // Set to true when a non-horizontal-scrolling line widget is
+    // added. As an optimization, line widget aligning is skipped when
+    // this is false.
+    d.alignWidgets = false;
+
+    d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
+
+    // Tracks the maximum line length so that the horizontal scrollbar
+    // can be kept static when scrolling.
+    d.maxLine = null;
+    d.maxLineLength = 0;
+    d.maxLineChanged = false;
+
+    // Used for measuring wheel scrolling granularity
+    d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
+
+    // True when shift is held down.
+    d.shift = false;
+
+    // Used to track whether anything happened since the context menu
+    // was opened.
+    d.selForContextMenu = null;
+
+    d.activeTouch = null;
+
+    d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);
+    renderGutters(d);
+
+    input.init(d);
+  }
+
+  // Since the delta values reported on mouse wheel events are
+  // unstandardized between browsers and even browser versions, and
+  // generally horribly unpredictable, this code starts by measuring
+  // the scroll effect that the first few mouse wheel events have,
+  // and, from that, detects the way it can convert deltas to pixel
+  // offsets afterwards.
+  //
+  // The reason we want to know the amount a wheel event will scroll
+  // is that it gives us a chance to update the display before the
+  // actual scrolling happens, reducing flickering.
+
+  var wheelSamples = 0, wheelPixelsPerUnit = null;
+  // Fill in a browser-detected starting value on browsers where we
+  // know one. These don't have to be accurate -- the result of them
+  // being wrong would just be a slight flicker on the first wheel
+  // scroll (if it is large enough).
+  if (ie) { wheelPixelsPerUnit = -.53; }
+  else if (gecko) { wheelPixelsPerUnit = 15; }
+  else if (chrome) { wheelPixelsPerUnit = -.7; }
+  else if (safari) { wheelPixelsPerUnit = -1/3; }
+
+  function wheelEventDelta(e) {
+    var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
+    if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
+    if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
+    else if (dy == null) { dy = e.wheelDelta; }
+    return {x: dx, y: dy}
+  }
+  function wheelEventPixels(e) {
+    var delta = wheelEventDelta(e);
+    delta.x *= wheelPixelsPerUnit;
+    delta.y *= wheelPixelsPerUnit;
+    return delta
+  }
+
+  function onScrollWheel(cm, e) {
+    // On Chrome 102, viewport updates somehow stop wheel-based
+    // scrolling. Turning off pointer events during the scroll seems
+    // to avoid the issue.
+    if (chrome && chrome_version == 102) {
+      if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = "none"; }
+      else { clearTimeout(cm.display.chromeScrollHack); }
+      cm.display.chromeScrollHack = setTimeout(function () {
+        cm.display.chromeScrollHack = null;
+        cm.display.sizer.style.pointerEvents = "";
+      }, 100);
+    }
+    var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
+    var pixelsPerUnit = wheelPixelsPerUnit;
+    if (e.deltaMode === 0) {
+      dx = e.deltaX;
+      dy = e.deltaY;
+      pixelsPerUnit = 1;
+    }
+
+    var display = cm.display, scroll = display.scroller;
+    // Quit if there's nothing to scroll here
+    var canScrollX = scroll.scrollWidth > scroll.clientWidth;
+    var canScrollY = scroll.scrollHeight > scroll.clientHeight;
+    if (!(dx && canScrollX || dy && canScrollY)) { return }
+
+    // Webkit browsers on OS X abort momentum scrolls when the target
+    // of the scroll event is removed from the scrollable element.
+    // This hack (see related code in patchDisplay) makes sure the
+    // element is kept around.
+    if (dy && mac && webkit) {
+      outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
+        for (var i = 0; i < view.length; i++) {
+          if (view[i].node == cur) {
+            cm.display.currentWheelTarget = cur;
+            break outer
+          }
+        }
+      }
+    }
+
+    // On some browsers, horizontal scrolling will cause redraws to
+    // happen before the gutter has been realigned, causing it to
+    // wriggle around in a most unseemly way. When we have an
+    // estimated pixels/delta value, we just handle horizontal
+    // scrolling entirely here. It'll be slightly off from native, but
+    // better than glitching out.
+    if (dx && !gecko && !presto && pixelsPerUnit != null) {
+      if (dy && canScrollY)
+        { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); }
+      setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit));
+      // Only prevent default scrolling if vertical scrolling is
+      // actually possible. Otherwise, it causes vertical scroll
+      // jitter on OSX trackpads when deltaX is small and deltaY
+      // is large (issue #3579)
+      if (!dy || (dy && canScrollY))
+        { e_preventDefault(e); }
+      display.wheelStartX = null; // Abort measurement, if in progress
+      return
+    }
+
+    // 'Project' the visible viewport to cover the area that is being
+    // scrolled into view (if we know enough to estimate it).
+    if (dy && pixelsPerUnit != null) {
+      var pixels = dy * pixelsPerUnit;
+      var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
+      if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
+      else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
+      updateDisplaySimple(cm, {top: top, bottom: bot});
+    }
+
+    if (wheelSamples < 20 && e.deltaMode !== 0) {
+      if (display.wheelStartX == null) {
+        display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
+        display.wheelDX = dx; display.wheelDY = dy;
+        setTimeout(function () {
+          if (display.wheelStartX == null) { return }
+          var movedX = scroll.scrollLeft - display.wheelStartX;
+          var movedY = scroll.scrollTop - display.wheelStartY;
+          var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
+            (movedX && display.wheelDX && movedX / display.wheelDX);
+          display.wheelStartX = display.wheelStartY = null;
+          if (!sample) { return }
+          wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
+          ++wheelSamples;
+        }, 200);
+      } else {
+        display.wheelDX += dx; display.wheelDY += dy;
+      }
+    }
+  }
+
+  // Selection objects are immutable. A new one is created every time
+  // the selection changes. A selection is one or more non-overlapping
+  // (and non-touching) ranges, sorted, and an integer that indicates
+  // which one is the primary selection (the one that's scrolled into
+  // view, that getCursor returns, etc).
+  var Selection = function(ranges, primIndex) {
+    this.ranges = ranges;
+    this.primIndex = primIndex;
+  };
+
+  Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
+
+  Selection.prototype.equals = function (other) {
+    if (other == this) { return true }
+    if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
+    for (var i = 0; i < this.ranges.length; i++) {
+      var here = this.ranges[i], there = other.ranges[i];
+      if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
+    }
+    return true
+  };
+
+  Selection.prototype.deepCopy = function () {
+    var out = [];
+    for (var i = 0; i < this.ranges.length; i++)
+      { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }
+    return new Selection(out, this.primIndex)
+  };
+
+  Selection.prototype.somethingSelected = function () {
+    for (var i = 0; i < this.ranges.length; i++)
+      { if (!this.ranges[i].empty()) { return true } }
+    return false
+  };
+
+  Selection.prototype.contains = function (pos, end) {
+    if (!end) { end = pos; }
+    for (var i = 0; i < this.ranges.length; i++) {
+      var range = this.ranges[i];
+      if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
+        { return i }
+    }
+    return -1
+  };
+
+  var Range = function(anchor, head) {
+    this.anchor = anchor; this.head = head;
+  };
+
+  Range.prototype.from = function () { return minPos(this.anchor, this.head) };
+  Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
+  Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
+
+  // Take an unsorted, potentially overlapping set of ranges, and
+  // build a selection out of it. 'Consumes' ranges array (modifying
+  // it).
+  function normalizeSelection(cm, ranges, primIndex) {
+    var mayTouch = cm && cm.options.selectionsMayTouch;
+    var prim = ranges[primIndex];
+    ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
+    primIndex = indexOf(ranges, prim);
+    for (var i = 1; i < ranges.length; i++) {
+      var cur = ranges[i], prev = ranges[i - 1];
+      var diff = cmp(prev.to(), cur.from());
+      if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
+        var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
+        var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
+        if (i <= primIndex) { --primIndex; }
+        ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
+      }
+    }
+    return new Selection(ranges, primIndex)
+  }
+
+  function simpleSelection(anchor, head) {
+    return new Selection([new Range(anchor, head || anchor)], 0)
+  }
+
+  // Compute the position of the end of a change (its 'to' property
+  // refers to the pre-change end).
+  function changeEnd(change) {
+    if (!change.text) { return change.to }
+    return Pos(change.from.line + change.text.length - 1,
+               lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
+  }
+
+  // Adjust a position to refer to the post-change position of the
+  // same text, or the end of the change if the change covers it.
+  function adjustForChange(pos, change) {
+    if (cmp(pos, change.from) < 0) { return pos }
+    if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
+
+    var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
+    if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
+    return Pos(line, ch)
+  }
+
+  function computeSelAfterChange(doc, change) {
+    var out = [];
+    for (var i = 0; i < doc.sel.ranges.length; i++) {
+      var range = doc.sel.ranges[i];
+      out.push(new Range(adjustForChange(range.anchor, change),
+                         adjustForChange(range.head, change)));
+    }
+    return normalizeSelection(doc.cm, out, doc.sel.primIndex)
+  }
+
+  function offsetPos(pos, old, nw) {
+    if (pos.line == old.line)
+      { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
+    else
+      { return Pos(nw.line + (pos.line - old.line), pos.ch) }
+  }
+
+  // Used by replaceSelections to allow moving the selection to the
+  // start or around the replaced test. Hint may be "start" or "around".
+  function computeReplacedSel(doc, changes, hint) {
+    var out = [];
+    var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
+    for (var i = 0; i < changes.length; i++) {
+      var change = changes[i];
+      var from = offsetPos(change.from, oldPrev, newPrev);
+      var to = offsetPos(changeEnd(change), oldPrev, newPrev);
+      oldPrev = change.to;
+      newPrev = to;
+      if (hint == "around") {
+        var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
+        out[i] = new Range(inv ? to : from, inv ? from : to);
+      } else {
+        out[i] = new Range(from, from);
+      }
+    }
+    return new Selection(out, doc.sel.primIndex)
+  }
+
+  // Used to get the editor into a consistent state again when options change.
+
+  function loadMode(cm) {
+    cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
+    resetModeState(cm);
+  }
+
+  function resetModeState(cm) {
+    cm.doc.iter(function (line) {
+      if (line.stateAfter) { line.stateAfter = null; }
+      if (line.styles) { line.styles = null; }
+    });
+    cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
+    startWorker(cm, 100);
+    cm.state.modeGen++;
+    if (cm.curOp) { regChange(cm); }
+  }
+
+  // DOCUMENT DATA STRUCTURE
+
+  // By default, updates that start and end at the beginning of a line
+  // are treated specially, in order to make the association of line
+  // widgets and marker elements with the text behave more intuitive.
+  function isWholeLineUpdate(doc, change) {
+    return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
+      (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
+  }
+
+  // Perform a change on the document data structure.
+  function updateDoc(doc, change, markedSpans, estimateHeight) {
+    function spansFor(n) {return markedSpans ? markedSpans[n] : null}
+    function update(line, text, spans) {
+      updateLine(line, text, spans, estimateHeight);
+      signalLater(line, "change", line, change);
+    }
+    function linesFor(start, end) {
+      var result = [];
+      for (var i = start; i < end; ++i)
+        { result.push(new Line(text[i], spansFor(i), estimateHeight)); }
+      return result
+    }
+
+    var from = change.from, to = change.to, text = change.text;
+    var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
+    var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
+
+    // Adjust the line structure
+    if (change.full) {
+      doc.insert(0, linesFor(0, text.length));
+      doc.remove(text.length, doc.size - text.length);
+    } else if (isWholeLineUpdate(doc, change)) {
+      // This is a whole-line replace. Treated specially to make
+      // sure line objects move the way they are supposed to.
+      var added = linesFor(0, text.length - 1);
+      update(lastLine, lastLine.text, lastSpans);
+      if (nlines) { doc.remove(from.line, nlines); }
+      if (added.length) { doc.insert(from.line, added); }
+    } else if (firstLine == lastLine) {
+      if (text.length == 1) {
+        update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
+      } else {
+        var added$1 = linesFor(1, text.length - 1);
+        added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
+        update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
+        doc.insert(from.line + 1, added$1);
+      }
+    } else if (text.length == 1) {
+      update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
+      doc.remove(from.line + 1, nlines);
+    } else {
+      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
+      update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
+      var added$2 = linesFor(1, text.length - 1);
+      if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
+      doc.insert(from.line + 1, added$2);
+    }
+
+    signalLater(doc, "change", doc, change);
+  }
+
+  // Call f for all linked documents.
+  function linkedDocs(doc, f, sharedHistOnly) {
+    function propagate(doc, skip, sharedHist) {
+      if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
+        var rel = doc.linked[i];
+        if (rel.doc == skip) { continue }
+        var shared = sharedHist && rel.sharedHist;
+        if (sharedHistOnly && !shared) { continue }
+        f(rel.doc, shared);
+        propagate(rel.doc, doc, shared);
+      } }
+    }
+    propagate(doc, null, true);
+  }
+
+  // Attach a document to an editor.
+  function attachDoc(cm, doc) {
+    if (doc.cm) { throw new Error("This document is already in use.") }
+    cm.doc = doc;
+    doc.cm = cm;
+    estimateLineHeights(cm);
+    loadMode(cm);
+    setDirectionClass(cm);
+    cm.options.direction = doc.direction;
+    if (!cm.options.lineWrapping) { findMaxLine(cm); }
+    cm.options.mode = doc.modeOption;
+    regChange(cm);
+  }
+
+  function setDirectionClass(cm) {
+  (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
+  }
+
+  function directionChanged(cm) {
+    runInOp(cm, function () {
+      setDirectionClass(cm);
+      regChange(cm);
+    });
+  }
+
+  function History(prev) {
+    // Arrays of change events and selections. Doing something adds an
+    // event to done and clears undo. Undoing moves events from done
+    // to undone, redoing moves them in the other direction.
+    this.done = []; this.undone = [];
+    this.undoDepth = prev ? prev.undoDepth : Infinity;
+    // Used to track when changes can be merged into a single undo
+    // event
+    this.lastModTime = this.lastSelTime = 0;
+    this.lastOp = this.lastSelOp = null;
+    this.lastOrigin = this.lastSelOrigin = null;
+    // Used by the isClean() method
+    this.generation = this.maxGeneration = prev ? prev.maxGeneration : 1;
+  }
+
+  // Create a history change event from an updateDoc-style change
+  // object.
+  function historyChangeFromChange(doc, change) {
+    var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
+    attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
+    linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
+    return histChange
+  }
+
+  // Pop all selection events off the end of a history array. Stop at
+  // a change event.
+  function clearSelectionEvents(array) {
+    while (array.length) {
+      var last = lst(array);
+      if (last.ranges) { array.pop(); }
+      else { break }
+    }
+  }
+
+  // Find the top change event in the history. Pop off selection
+  // events that are in the way.
+  function lastChangeEvent(hist, force) {
+    if (force) {
+      clearSelectionEvents(hist.done);
+      return lst(hist.done)
+    } else if (hist.done.length && !lst(hist.done).ranges) {
+      return lst(hist.done)
+    } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
+      hist.done.pop();
+      return lst(hist.done)
+    }
+  }
+
+  // Register a change in the history. Merges changes that are within
+  // a single operation, or are close together with an origin that
+  // allows merging (starting with "+") into a single event.
+  function addChangeToHistory(doc, change, selAfter, opId) {
+    var hist = doc.history;
+    hist.undone.length = 0;
+    var time = +new Date, cur;
+    var last;
+
+    if ((hist.lastOp == opId ||
+         hist.lastOrigin == change.origin && change.origin &&
+         ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
+          change.origin.charAt(0) == "*")) &&
+        (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
+      // Merge this change into the last event
+      last = lst(cur.changes);
+      if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
+        // Optimized case for simple insertion -- don't want to add
+        // new changesets for every character typed
+        last.to = changeEnd(change);
+      } else {
+        // Add new sub-event
+        cur.changes.push(historyChangeFromChange(doc, change));
+      }
+    } else {
+      // Can not be merged, start a new event.
+      var before = lst(hist.done);
+      if (!before || !before.ranges)
+        { pushSelectionToHistory(doc.sel, hist.done); }
+      cur = {changes: [historyChangeFromChange(doc, change)],
+             generation: hist.generation};
+      hist.done.push(cur);
+      while (hist.done.length > hist.undoDepth) {
+        hist.done.shift();
+        if (!hist.done[0].ranges) { hist.done.shift(); }
+      }
+    }
+    hist.done.push(selAfter);
+    hist.generation = ++hist.maxGeneration;
+    hist.lastModTime = hist.lastSelTime = time;
+    hist.lastOp = hist.lastSelOp = opId;
+    hist.lastOrigin = hist.lastSelOrigin = change.origin;
+
+    if (!last) { signal(doc, "historyAdded"); }
+  }
+
+  function selectionEventCanBeMerged(doc, origin, prev, sel) {
+    var ch = origin.charAt(0);
+    return ch == "*" ||
+      ch == "+" &&
+      prev.ranges.length == sel.ranges.length &&
+      prev.somethingSelected() == sel.somethingSelected() &&
+      new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
+  }
+
+  // Called whenever the selection changes, sets the new selection as
+  // the pending selection in the history, and pushes the old pending
+  // selection into the 'done' array when it was significantly
+  // different (in number of selected ranges, emptiness, or time).
+  function addSelectionToHistory(doc, sel, opId, options) {
+    var hist = doc.history, origin = options && options.origin;
+
+    // A new event is started when the previous origin does not match
+    // the current, or the origins don't allow matching. Origins
+    // starting with * are always merged, those starting with + are
+    // merged when similar and close together in time.
+    if (opId == hist.lastSelOp ||
+        (origin && hist.lastSelOrigin == origin &&
+         (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
+          selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
+      { hist.done[hist.done.length - 1] = sel; }
+    else
+      { pushSelectionToHistory(sel, hist.done); }
+
+    hist.lastSelTime = +new Date;
+    hist.lastSelOrigin = origin;
+    hist.lastSelOp = opId;
+    if (options && options.clearRedo !== false)
+      { clearSelectionEvents(hist.undone); }
+  }
+
+  function pushSelectionToHistory(sel, dest) {
+    var top = lst(dest);
+    if (!(top && top.ranges && top.equals(sel)))
+      { dest.push(sel); }
+  }
+
+  // Used to store marked span information in the history.
+  function attachLocalSpans(doc, change, from, to) {
+    var existing = change["spans_" + doc.id], n = 0;
+    doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
+      if (line.markedSpans)
+        { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
+      ++n;
+    });
+  }
+
+  // When un/re-doing restores text containing marked spans, those
+  // that have been explicitly cleared should not be restored.
+  function removeClearedSpans(spans) {
+    if (!spans) { return null }
+    var out;
+    for (var i = 0; i < spans.length; ++i) {
+      if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
+      else if (out) { out.push(spans[i]); }
+    }
+    return !out ? spans : out.length ? out : null
+  }
+
+  // Retrieve and filter the old marked spans stored in a change event.
+  function getOldSpans(doc, change) {
+    var found = change["spans_" + doc.id];
+    if (!found) { return null }
+    var nw = [];
+    for (var i = 0; i < change.text.length; ++i)
+      { nw.push(removeClearedSpans(found[i])); }
+    return nw
+  }
+
+  // Used for un/re-doing changes from the history. Combines the
+  // result of computing the existing spans with the set of spans that
+  // existed in the history (so that deleting around a span and then
+  // undoing brings back the span).
+  function mergeOldSpans(doc, change) {
+    var old = getOldSpans(doc, change);
+    var stretched = stretchSpansOverChange(doc, change);
+    if (!old) { return stretched }
+    if (!stretched) { return old }
+
+    for (var i = 0; i < old.length; ++i) {
+      var oldCur = old[i], stretchCur = stretched[i];
+      if (oldCur && stretchCur) {
+        spans: for (var j = 0; j < stretchCur.length; ++j) {
+          var span = stretchCur[j];
+          for (var k = 0; k < oldCur.length; ++k)
+            { if (oldCur[k].marker == span.marker) { continue spans } }
+          oldCur.push(span);
+        }
+      } else if (stretchCur) {
+        old[i] = stretchCur;
+      }
+    }
+    return old
+  }
+
+  // Used both to provide a JSON-safe object in .getHistory, and, when
+  // detaching a document, to split the history in two
+  function copyHistoryArray(events, newGroup, instantiateSel) {
+    var copy = [];
+    for (var i = 0; i < events.length; ++i) {
+      var event = events[i];
+      if (event.ranges) {
+        copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
+        continue
+      }
+      var changes = event.changes, newChanges = [];
+      copy.push({changes: newChanges});
+      for (var j = 0; j < changes.length; ++j) {
+        var change = changes[j], m = (void 0);
+        newChanges.push({from: change.from, to: change.to, text: change.text});
+        if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
+          if (indexOf(newGroup, Number(m[1])) > -1) {
+            lst(newChanges)[prop] = change[prop];
+            delete change[prop];
+          }
+        } } }
+      }
+    }
+    return copy
+  }
+
+  // The 'scroll' parameter given to many of these indicated whether
+  // the new cursor position should be scrolled into view after
+  // modifying the selection.
+
+  // If shift is held or the extend flag is set, extends a range to
+  // include a given position (and optionally a second position).
+  // Otherwise, simply returns the range between the given positions.
+  // Used for cursor motion and such.
+  function extendRange(range, head, other, extend) {
+    if (extend) {
+      var anchor = range.anchor;
+      if (other) {
+        var posBefore = cmp(head, anchor) < 0;
+        if (posBefore != (cmp(other, anchor) < 0)) {
+          anchor = head;
+          head = other;
+        } else if (posBefore != (cmp(head, other) < 0)) {
+          head = other;
+        }
+      }
+      return new Range(anchor, head)
+    } else {
+      return new Range(other || head, head)
+    }
+  }
+
+  // Extend the primary selection range, discard the rest.
+  function extendSelection(doc, head, other, options, extend) {
+    if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
+    setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
+  }
+
+  // Extend all selections (pos is an array of selections with length
+  // equal the number of selections)
+  function extendSelections(doc, heads, options) {
+    var out = [];
+    var extend = doc.cm && (doc.cm.display.shift || doc.extend);
+    for (var i = 0; i < doc.sel.ranges.length; i++)
+      { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
+    var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
+    setSelection(doc, newSel, options);
+  }
+
+  // Updates a single range in the selection.
+  function replaceOneSelection(doc, i, range, options) {
+    var ranges = doc.sel.ranges.slice(0);
+    ranges[i] = range;
+    setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
+  }
+
+  // Reset the selection to a single range.
+  function setSimpleSelection(doc, anchor, head, options) {
+    setSelection(doc, simpleSelection(anchor, head), options);
+  }
+
+  // Give beforeSelectionChange handlers a change to influence a
+  // selection update.
+  function filterSelectionChange(doc, sel, options) {
+    var obj = {
+      ranges: sel.ranges,
+      update: function(ranges) {
+        this.ranges = [];
+        for (var i = 0; i < ranges.length; i++)
+          { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
+                                     clipPos(doc, ranges[i].head)); }
+      },
+      origin: options && options.origin
+    };
+    signal(doc, "beforeSelectionChange", doc, obj);
+    if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
+    if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
+    else { return sel }
+  }
+
+  function setSelectionReplaceHistory(doc, sel, options) {
+    var done = doc.history.done, last = lst(done);
+    if (last && last.ranges) {
+      done[done.length - 1] = sel;
+      setSelectionNoUndo(doc, sel, options);
+    } else {
+      setSelection(doc, sel, options);
+    }
+  }
+
+  // Set a new selection.
+  function setSelection(doc, sel, options) {
+    setSelectionNoUndo(doc, sel, options);
+    addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
+  }
+
+  function setSelectionNoUndo(doc, sel, options) {
+    if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
+      { sel = filterSelectionChange(doc, sel, options); }
+
+    var bias = options && options.bias ||
+      (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
+    setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
+
+    if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor")
+      { ensureCursorVisible(doc.cm); }
+  }
+
+  function setSelectionInner(doc, sel) {
+    if (sel.equals(doc.sel)) { return }
+
+    doc.sel = sel;
+
+    if (doc.cm) {
+      doc.cm.curOp.updateInput = 1;
+      doc.cm.curOp.selectionChanged = true;
+      signalCursorActivity(doc.cm);
+    }
+    signalLater(doc, "cursorActivity", doc);
+  }
+
+  // Verify that the selection does not partially select any atomic
+  // marked ranges.
+  function reCheckSelection(doc) {
+    setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
+  }
+
+  // Return a selection that does not partially select any atomic
+  // ranges.
+  function skipAtomicInSelection(doc, sel, bias, mayClear) {
+    var out;
+    for (var i = 0; i < sel.ranges.length; i++) {
+      var range = sel.ranges[i];
+      var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
+      var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
+      var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);
+      if (out || newAnchor != range.anchor || newHead != range.head) {
+        if (!out) { out = sel.ranges.slice(0, i); }
+        out[i] = new Range(newAnchor, newHead);
+      }
+    }
+    return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
+  }
+
+  function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
+    var line = getLine(doc, pos.line);
+    if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
+      var sp = line.markedSpans[i], m = sp.marker;
+
+      // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
+      // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
+      // is with selectLeft/Right
+      var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
+      var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;
+
+      if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
+          (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
+        if (mayClear) {
+          signal(m, "beforeCursorEnter");
+          if (m.explicitlyCleared) {
+            if (!line.markedSpans) { break }
+            else {--i; continue}
+          }
+        }
+        if (!m.atomic) { continue }
+
+        if (oldPos) {
+          var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
+          if (dir < 0 ? preventCursorRight : preventCursorLeft)
+            { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
+          if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
+            { return skipAtomicInner(doc, near, pos, dir, mayClear) }
+        }
+
+        var far = m.find(dir < 0 ? -1 : 1);
+        if (dir < 0 ? preventCursorLeft : preventCursorRight)
+          { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
+        return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
+      }
+    } }
+    return pos
+  }
+
+  // Ensure a given position is not inside an atomic range.
+  function skipAtomic(doc, pos, oldPos, bias, mayClear) {
+    var dir = bias || 1;
+    var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
+        (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
+        skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
+        (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
+    if (!found) {
+      doc.cantEdit = true;
+      return Pos(doc.first, 0)
+    }
+    return found
+  }
+
+  function movePos(doc, pos, dir, line) {
+    if (dir < 0 && pos.ch == 0) {
+      if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
+      else { return null }
+    } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
+      if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
+      else { return null }
+    } else {
+      return new Pos(pos.line, pos.ch + dir)
+    }
+  }
+
+  function selectAll(cm) {
+    cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
+  }
+
+  // UPDATING
+
+  // Allow "beforeChange" event handlers to influence a change
+  function filterChange(doc, change, update) {
+    var obj = {
+      canceled: false,
+      from: change.from,
+      to: change.to,
+      text: change.text,
+      origin: change.origin,
+      cancel: function () { return obj.canceled = true; }
+    };
+    if (update) { obj.update = function (from, to, text, origin) {
+      if (from) { obj.from = clipPos(doc, from); }
+      if (to) { obj.to = clipPos(doc, to); }
+      if (text) { obj.text = text; }
+      if (origin !== undefined) { obj.origin = origin; }
+    }; }
+    signal(doc, "beforeChange", doc, obj);
+    if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
+
+    if (obj.canceled) {
+      if (doc.cm) { doc.cm.curOp.updateInput = 2; }
+      return null
+    }
+    return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
+  }
+
+  // Apply a change to a document, and add it to the document's
+  // history, and propagating it to all linked documents.
+  function makeChange(doc, change, ignoreReadOnly) {
+    if (doc.cm) {
+      if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
+      if (doc.cm.state.suppressEdits) { return }
+    }
+
+    if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
+      change = filterChange(doc, change, true);
+      if (!change) { return }
+    }
+
+    // Possibly split or suppress the update based on the presence
+    // of read-only spans in its range.
+    var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
+    if (split) {
+      for (var i = split.length - 1; i >= 0; --i)
+        { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
+    } else {
+      makeChangeInner(doc, change);
+    }
+  }
+
+  function makeChangeInner(doc, change) {
+    if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
+    var selAfter = computeSelAfterChange(doc, change);
+    addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
+
+    makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
+    var rebased = [];
+
+    linkedDocs(doc, function (doc, sharedHist) {
+      if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+        rebaseHist(doc.history, change);
+        rebased.push(doc.history);
+      }
+      makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
+    });
+  }
+
+  // Revert a change stored in a document's history.
+  function makeChangeFromHistory(doc, type, allowSelectionOnly) {
+    var suppress = doc.cm && doc.cm.state.suppressEdits;
+    if (suppress && !allowSelectionOnly) { return }
+
+    var hist = doc.history, event, selAfter = doc.sel;
+    var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
+
+    // Verify that there is a useable event (so that ctrl-z won't
+    // needlessly clear selection events)
+    var i = 0;
+    for (; i < source.length; i++) {
+      event = source[i];
+      if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
+        { break }
+    }
+    if (i == source.length) { return }
+    hist.lastOrigin = hist.lastSelOrigin = null;
+
+    for (;;) {
+      event = source.pop();
+      if (event.ranges) {
+        pushSelectionToHistory(event, dest);
+        if (allowSelectionOnly && !event.equals(doc.sel)) {
+          setSelection(doc, event, {clearRedo: false});
+          return
+        }
+        selAfter = event;
+      } else if (suppress) {
+        source.push(event);
+        return
+      } else { break }
+    }
+
+    // Build up a reverse change object to add to the opposite history
+    // stack (redo when undoing, and vice versa).
+    var antiChanges = [];
+    pushSelectionToHistory(selAfter, dest);
+    dest.push({changes: antiChanges, generation: hist.generation});
+    hist.generation = event.generation || ++hist.maxGeneration;
+
+    var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
+
+    var loop = function ( i ) {
+      var change = event.changes[i];
+      change.origin = type;
+      if (filter && !filterChange(doc, change, false)) {
+        source.length = 0;
+        return {}
+      }
+
+      antiChanges.push(historyChangeFromChange(doc, change));
+
+      var after = i ? computeSelAfterChange(doc, change) : lst(source);
+      makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
+      if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
+      var rebased = [];
+
+      // Propagate to the linked documents
+      linkedDocs(doc, function (doc, sharedHist) {
+        if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+          rebaseHist(doc.history, change);
+          rebased.push(doc.history);
+        }
+        makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
+      });
+    };
+
+    for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
+      var returned = loop( i$1 );
+
+      if ( returned ) return returned.v;
+    }
+  }
+
+  // Sub-views need their line numbers shifted when text is added
+  // above or below them in the parent document.
+  function shiftDoc(doc, distance) {
+    if (distance == 0) { return }
+    doc.first += distance;
+    doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
+      Pos(range.anchor.line + distance, range.anchor.ch),
+      Pos(range.head.line + distance, range.head.ch)
+    ); }), doc.sel.primIndex);
+    if (doc.cm) {
+      regChange(doc.cm, doc.first, doc.first - distance, distance);
+      for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
+        { regLineChange(doc.cm, l, "gutter"); }
+    }
+  }
+
+  // More lower-level change function, handling only a single document
+  // (not linked ones).
+  function makeChangeSingleDoc(doc, change, selAfter, spans) {
+    if (doc.cm && !doc.cm.curOp)
+      { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
+
+    if (change.to.line < doc.first) {
+      shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
+      return
+    }
+    if (change.from.line > doc.lastLine()) { return }
+
+    // Clip the change to the size of this doc
+    if (change.from.line < doc.first) {
+      var shift = change.text.length - 1 - (doc.first - change.from.line);
+      shiftDoc(doc, shift);
+      change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
+                text: [lst(change.text)], origin: change.origin};
+    }
+    var last = doc.lastLine();
+    if (change.to.line > last) {
+      change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
+                text: [change.text[0]], origin: change.origin};
+    }
+
+    change.removed = getBetween(doc, change.from, change.to);
+
+    if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
+    if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
+    else { updateDoc(doc, change, spans); }
+    setSelectionNoUndo(doc, selAfter, sel_dontScroll);
+
+    if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
+      { doc.cantEdit = false; }
+  }
+
+  // Handle the interaction of a change to a document with the editor
+  // that this document is part of.
+  function makeChangeSingleDocInEditor(cm, change, spans) {
+    var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
+
+    var recomputeMaxLength = false, checkWidthStart = from.line;
+    if (!cm.options.lineWrapping) {
+      checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
+      doc.iter(checkWidthStart, to.line + 1, function (line) {
+        if (line == display.maxLine) {
+          recomputeMaxLength = true;
+          return true
+        }
+      });
+    }
+
+    if (doc.sel.contains(change.from, change.to) > -1)
+      { signalCursorActivity(cm); }
+
+    updateDoc(doc, change, spans, estimateHeight(cm));
+
+    if (!cm.options.lineWrapping) {
+      doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
+        var len = lineLength(line);
+        if (len > display.maxLineLength) {
+          display.maxLine = line;
+          display.maxLineLength = len;
+          display.maxLineChanged = true;
+          recomputeMaxLength = false;
+        }
+      });
+      if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
+    }
+
+    retreatFrontier(doc, from.line);
+    startWorker(cm, 400);
+
+    var lendiff = change.text.length - (to.line - from.line) - 1;
+    // Remember that these lines changed, for updating the display
+    if (change.full)
+      { regChange(cm); }
+    else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
+      { regLineChange(cm, from.line, "text"); }
+    else
+      { regChange(cm, from.line, to.line + 1, lendiff); }
+
+    var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
+    if (changeHandler || changesHandler) {
+      var obj = {
+        from: from, to: to,
+        text: change.text,
+        removed: change.removed,
+        origin: change.origin
+      };
+      if (changeHandler) { signalLater(cm, "change", cm, obj); }
+      if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
+    }
+    cm.display.selForContextMenu = null;
+  }
+
+  function replaceRange(doc, code, from, to, origin) {
+    var assign;
+
+    if (!to) { to = from; }
+    if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
+    if (typeof code == "string") { code = doc.splitLines(code); }
+    makeChange(doc, {from: from, to: to, text: code, origin: origin});
+  }
+
+  // Rebasing/resetting history to deal with externally-sourced changes
+
+  function rebaseHistSelSingle(pos, from, to, diff) {
+    if (to < pos.line) {
+      pos.line += diff;
+    } else if (from < pos.line) {
+      pos.line = from;
+      pos.ch = 0;
+    }
+  }
+
+  // Tries to rebase an array of history events given a change in the
+  // document. If the change touches the same lines as the event, the
+  // event, and everything 'behind' it, is discarded. If the change is
+  // before the event, the event's positions are updated. Uses a
+  // copy-on-write scheme for the positions, to avoid having to
+  // reallocate them all on every rebase, but also avoid problems with
+  // shared position objects being unsafely updated.
+  function rebaseHistArray(array, from, to, diff) {
+    for (var i = 0; i < array.length; ++i) {
+      var sub = array[i], ok = true;
+      if (sub.ranges) {
+        if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
+        for (var j = 0; j < sub.ranges.length; j++) {
+          rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
+          rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
+        }
+        continue
+      }
+      for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
+        var cur = sub.changes[j$1];
+        if (to < cur.from.line) {
+          cur.from = Pos(cur.from.line + diff, cur.from.ch);
+          cur.to = Pos(cur.to.line + diff, cur.to.ch);
+        } else if (from <= cur.to.line) {
+          ok = false;
+          break
+        }
+      }
+      if (!ok) {
+        array.splice(0, i + 1);
+        i = 0;
+      }
+    }
+  }
+
+  function rebaseHist(hist, change) {
+    var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
+    rebaseHistArray(hist.done, from, to, diff);
+    rebaseHistArray(hist.undone, from, to, diff);
+  }
+
+  // Utility for applying a change to a line by handle or number,
+  // returning the number and optionally registering the line as
+  // changed.
+  function changeLine(doc, handle, changeType, op) {
+    var no = handle, line = handle;
+    if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
+    else { no = lineNo(handle); }
+    if (no == null) { return null }
+    if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
+    return line
+  }
+
+  // The document is represented as a BTree consisting of leaves, with
+  // chunk of lines in them, and branches, with up to ten leaves or
+  // other branch nodes below them. The top node is always a branch
+  // node, and is the document object itself (meaning it has
+  // additional methods and properties).
+  //
+  // All nodes have parent links. The tree is used both to go from
+  // line numbers to line objects, and to go from objects to numbers.
+  // It also indexes by height, and is used to convert between height
+  // and line object, and to find the total height of the document.
+  //
+  // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
+
+  function LeafChunk(lines) {
+    this.lines = lines;
+    this.parent = null;
+    var height = 0;
+    for (var i = 0; i < lines.length; ++i) {
+      lines[i].parent = this;
+      height += lines[i].height;
+    }
+    this.height = height;
+  }
+
+  LeafChunk.prototype = {
+    chunkSize: function() { return this.lines.length },
+
+    // Remove the n lines at offset 'at'.
+    removeInner: function(at, n) {
+      for (var i = at, e = at + n; i < e; ++i) {
+        var line = this.lines[i];
+        this.height -= line.height;
+        cleanUpLine(line);
+        signalLater(line, "delete");
+      }
+      this.lines.splice(at, n);
+    },
+
+    // Helper used to collapse a small branch into a single leaf.
+    collapse: function(lines) {
+      lines.push.apply(lines, this.lines);
+    },
+
+    // Insert the given array of lines at offset 'at', count them as
+    // having the given height.
+    insertInner: function(at, lines, height) {
+      this.height += height;
+      this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
+      for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }
+    },
+
+    // Used to iterate over a part of the tree.
+    iterN: function(at, n, op) {
+      for (var e = at + n; at < e; ++at)
+        { if (op(this.lines[at])) { return true } }
+    }
+  };
+
+  function BranchChunk(children) {
+    this.children = children;
+    var size = 0, height = 0;
+    for (var i = 0; i < children.length; ++i) {
+      var ch = children[i];
+      size += ch.chunkSize(); height += ch.height;
+      ch.parent = this;
+    }
+    this.size = size;
+    this.height = height;
+    this.parent = null;
+  }
+
+  BranchChunk.prototype = {
+    chunkSize: function() { return this.size },
+
+    removeInner: function(at, n) {
+      this.size -= n;
+      for (var i = 0; i < this.children.length; ++i) {
+        var child = this.children[i], sz = child.chunkSize();
+        if (at < sz) {
+          var rm = Math.min(n, sz - at), oldHeight = child.height;
+          child.removeInner(at, rm);
+          this.height -= oldHeight - child.height;
+          if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
+          if ((n -= rm) == 0) { break }
+          at = 0;
+        } else { at -= sz; }
+      }
+      // If the result is smaller than 25 lines, ensure that it is a
+      // single leaf node.
+      if (this.size - n < 25 &&
+          (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
+        var lines = [];
+        this.collapse(lines);
+        this.children = [new LeafChunk(lines)];
+        this.children[0].parent = this;
+      }
+    },
+
+    collapse: function(lines) {
+      for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }
+    },
+
+    insertInner: function(at, lines, height) {
+      this.size += lines.length;
+      this.height += height;
+      for (var i = 0; i < this.children.length; ++i) {
+        var child = this.children[i], sz = child.chunkSize();
+        if (at <= sz) {
+          child.insertInner(at, lines, height);
+          if (child.lines && child.lines.length > 50) {
+            // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
+            // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
+            var remaining = child.lines.length % 25 + 25;
+            for (var pos = remaining; pos < child.lines.length;) {
+              var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
+              child.height -= leaf.height;
+              this.children.splice(++i, 0, leaf);
+              leaf.parent = this;
+            }
+            child.lines = child.lines.slice(0, remaining);
+            this.maybeSpill();
+          }
+          break
+        }
+        at -= sz;
+      }
+    },
+
+    // When a node has grown, check whether it should be split.
+    maybeSpill: function() {
+      if (this.children.length <= 10) { return }
+      var me = this;
+      do {
+        var spilled = me.children.splice(me.children.length - 5, 5);
+        var sibling = new BranchChunk(spilled);
+        if (!me.parent) { // Become the parent node
+          var copy = new BranchChunk(me.children);
+          copy.parent = me;
+          me.children = [copy, sibling];
+          me = copy;
+       } else {
+          me.size -= sibling.size;
+          me.height -= sibling.height;
+          var myIndex = indexOf(me.parent.children, me);
+          me.parent.children.splice(myIndex + 1, 0, sibling);
+        }
+        sibling.parent = me.parent;
+      } while (me.children.length > 10)
+      me.parent.maybeSpill();
+    },
+
+    iterN: function(at, n, op) {
+      for (var i = 0; i < this.children.length; ++i) {
+        var child = this.children[i], sz = child.chunkSize();
+        if (at < sz) {
+          var used = Math.min(n, sz - at);
+          if (child.iterN(at, used, op)) { return true }
+          if ((n -= used) == 0) { break }
+          at = 0;
+        } else { at -= sz; }
+      }
+    }
+  };
+
+  // Line widgets are block elements displayed above or below a line.
+
+  var LineWidget = function(doc, node, options) {
+    if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
+      { this[opt] = options[opt]; } } }
+    this.doc = doc;
+    this.node = node;
+  };
+
+  LineWidget.prototype.clear = function () {
+    var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
+    if (no == null || !ws) { return }
+    for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }
+    if (!ws.length) { line.widgets = null; }
+    var height = widgetHeight(this);
+    updateLineHeight(line, Math.max(0, line.height - height));
+    if (cm) {
+      runInOp(cm, function () {
+        adjustScrollWhenAboveVisible(cm, line, -height);
+        regLineChange(cm, no, "widget");
+      });
+      signalLater(cm, "lineWidgetCleared", cm, this, no);
+    }
+  };
+
+  LineWidget.prototype.changed = function () {
+      var this$1 = this;
+
+    var oldH = this.height, cm = this.doc.cm, line = this.line;
+    this.height = null;
+    var diff = widgetHeight(this) - oldH;
+    if (!diff) { return }
+    if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
+    if (cm) {
+      runInOp(cm, function () {
+        cm.curOp.forceUpdate = true;
+        adjustScrollWhenAboveVisible(cm, line, diff);
+        signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
+      });
+    }
+  };
+  eventMixin(LineWidget);
+
+  function adjustScrollWhenAboveVisible(cm, line, diff) {
+    if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
+      { addToScrollTop(cm, diff); }
+  }
+
+  function addLineWidget(doc, handle, node, options) {
+    var widget = new LineWidget(doc, node, options);
+    var cm = doc.cm;
+    if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
+    changeLine(doc, handle, "widget", function (line) {
+      var widgets = line.widgets || (line.widgets = []);
+      if (widget.insertAt == null) { widgets.push(widget); }
+      else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }
+      widget.line = line;
+      if (cm && !lineIsHidden(doc, line)) {
+        var aboveVisible = heightAtLine(line) < doc.scrollTop;
+        updateLineHeight(line, line.height + widgetHeight(widget));
+        if (aboveVisible) { addToScrollTop(cm, widget.height); }
+        cm.curOp.forceUpdate = true;
+      }
+      return true
+    });
+    if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
+    return widget
+  }
+
+  // TEXTMARKERS
+
+  // Created with markText and setBookmark methods. A TextMarker is a
+  // handle that can be used to clear or find a marked position in the
+  // document. Line objects hold arrays (markedSpans) containing
+  // {from, to, marker} object pointing to such marker objects, and
+  // indicating that such a marker is present on that line. Multiple
+  // lines may point to the same marker when it spans across lines.
+  // The spans will have null for their from/to properties when the
+  // marker continues beyond the start/end of the line. Markers have
+  // links back to the lines they currently touch.
+
+  // Collapsed markers have unique ids, in order to be able to order
+  // them, which is needed for uniquely determining an outer marker
+  // when they overlap (they may nest, but not partially overlap).
+  var nextMarkerId = 0;
+
+  var TextMarker = function(doc, type) {
+    this.lines = [];
+    this.type = type;
+    this.doc = doc;
+    this.id = ++nextMarkerId;
+  };
+
+  // Clear the marker.
+  TextMarker.prototype.clear = function () {
+    if (this.explicitlyCleared) { return }
+    var cm = this.doc.cm, withOp = cm && !cm.curOp;
+    if (withOp) { startOperation(cm); }
+    if (hasHandler(this, "clear")) {
+      var found = this.find();
+      if (found) { signalLater(this, "clear", found.from, found.to); }
+    }
+    var min = null, max = null;
+    for (var i = 0; i < this.lines.length; ++i) {
+      var line = this.lines[i];
+      var span = getMarkedSpanFor(line.markedSpans, this);
+      if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); }
+      else if (cm) {
+        if (span.to != null) { max = lineNo(line); }
+        if (span.from != null) { min = lineNo(line); }
+      }
+      line.markedSpans = removeMarkedSpan(line.markedSpans, span);
+      if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
+        { updateLineHeight(line, textHeight(cm.display)); }
+    }
+    if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
+      var visual = visualLine(this.lines[i$1]), len = lineLength(visual);
+      if (len > cm.display.maxLineLength) {
+        cm.display.maxLine = visual;
+        cm.display.maxLineLength = len;
+        cm.display.maxLineChanged = true;
+      }
+    } }
+
+    if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
+    this.lines.length = 0;
+    this.explicitlyCleared = true;
+    if (this.atomic && this.doc.cantEdit) {
+      this.doc.cantEdit = false;
+      if (cm) { reCheckSelection(cm.doc); }
+    }
+    if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
+    if (withOp) { endOperation(cm); }
+    if (this.parent) { this.parent.clear(); }
+  };
+
+  // Find the position of the marker in the document. Returns a {from,
+  // to} object by default. Side can be passed to get a specific side
+  // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
+  // Pos objects returned contain a line object, rather than a line
+  // number (used to prevent looking up the same line twice).
+  TextMarker.prototype.find = function (side, lineObj) {
+    if (side == null && this.type == "bookmark") { side = 1; }
+    var from, to;
+    for (var i = 0; i < this.lines.length; ++i) {
+      var line = this.lines[i];
+      var span = getMarkedSpanFor(line.markedSpans, this);
+      if (span.from != null) {
+        from = Pos(lineObj ? line : lineNo(line), span.from);
+        if (side == -1) { return from }
+      }
+      if (span.to != null) {
+        to = Pos(lineObj ? line : lineNo(line), span.to);
+        if (side == 1) { return to }
+      }
+    }
+    return from && {from: from, to: to}
+  };
+
+  // Signals that the marker's widget changed, and surrounding layout
+  // should be recomputed.
+  TextMarker.prototype.changed = function () {
+      var this$1 = this;
+
+    var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
+    if (!pos || !cm) { return }
+    runInOp(cm, function () {
+      var line = pos.line, lineN = lineNo(pos.line);
+      var view = findViewForLine(cm, lineN);
+      if (view) {
+        clearLineMeasurementCacheFor(view);
+        cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
+      }
+      cm.curOp.updateMaxLine = true;
+      if (!lineIsHidden(widget.doc, line) && widget.height != null) {
+        var oldHeight = widget.height;
+        widget.height = null;
+        var dHeight = widgetHeight(widget) - oldHeight;
+        if (dHeight)
+          { updateLineHeight(line, line.height + dHeight); }
+      }
+      signalLater(cm, "markerChanged", cm, this$1);
+    });
+  };
+
+  TextMarker.prototype.attachLine = function (line) {
+    if (!this.lines.length && this.doc.cm) {
+      var op = this.doc.cm.curOp;
+      if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
+        { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
+    }
+    this.lines.push(line);
+  };
+
+  TextMarker.prototype.detachLine = function (line) {
+    this.lines.splice(indexOf(this.lines, line), 1);
+    if (!this.lines.length && this.doc.cm) {
+      var op = this.doc.cm.curOp
+      ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
+    }
+  };
+  eventMixin(TextMarker);
+
+  // Create a marker, wire it up to the right lines, and
+  function markText(doc, from, to, options, type) {
+    // Shared markers (across linked documents) are handled separately
+    // (markTextShared will call out to this again, once per
+    // document).
+    if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
+    // Ensure we are in an operation.
+    if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
+
+    var marker = new TextMarker(doc, type), diff = cmp(from, to);
+    if (options) { copyObj(options, marker, false); }
+    // Don't connect empty markers unless clearWhenEmpty is false
+    if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
+      { return marker }
+    if (marker.replacedWith) {
+      // Showing up as a widget implies collapsed (widget replaces text)
+      marker.collapsed = true;
+      marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
+      if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
+      if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
+    }
+    if (marker.collapsed) {
+      if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
+          from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
+        { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
+      seeCollapsedSpans();
+    }
+
+    if (marker.addToHistory)
+      { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
+
+    var curLine = from.line, cm = doc.cm, updateMaxLine;
+    doc.iter(curLine, to.line + 1, function (line) {
+      if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
+        { updateMaxLine = true; }
+      if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
+      addMarkedSpan(line, new MarkedSpan(marker,
+                                         curLine == from.line ? from.ch : null,
+                                         curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp);
+      ++curLine;
+    });
+    // lineIsHidden depends on the presence of the spans, so needs a second pass
+    if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
+      if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
+    }); }
+
+    if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
+
+    if (marker.readOnly) {
+      seeReadOnlySpans();
+      if (doc.history.done.length || doc.history.undone.length)
+        { doc.clearHistory(); }
+    }
+    if (marker.collapsed) {
+      marker.id = ++nextMarkerId;
+      marker.atomic = true;
+    }
+    if (cm) {
+      // Sync editor state
+      if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
+      if (marker.collapsed)
+        { regChange(cm, from.line, to.line + 1); }
+      else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
+               marker.attributes || marker.title)
+        { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
+      if (marker.atomic) { reCheckSelection(cm.doc); }
+      signalLater(cm, "markerAdded", cm, marker);
+    }
+    return marker
+  }
+
+  // SHARED TEXTMARKERS
+
+  // A shared marker spans multiple linked documents. It is
+  // implemented as a meta-marker-object controlling multiple normal
+  // markers.
+  var SharedTextMarker = function(markers, primary) {
+    this.markers = markers;
+    this.primary = primary;
+    for (var i = 0; i < markers.length; ++i)
+      { markers[i].parent = this; }
+  };
+
+  SharedTextMarker.prototype.clear = function () {
+    if (this.explicitlyCleared) { return }
+    this.explicitlyCleared = true;
+    for (var i = 0; i < this.markers.length; ++i)
+      { this.markers[i].clear(); }
+    signalLater(this, "clear");
+  };
+
+  SharedTextMarker.prototype.find = function (side, lineObj) {
+    return this.primary.find(side, lineObj)
+  };
+  eventMixin(SharedTextMarker);
+
+  function markTextShared(doc, from, to, options, type) {
+    options = copyObj(options);
+    options.shared = false;
+    var markers = [markText(doc, from, to, options, type)], primary = markers[0];
+    var widget = options.widgetNode;
+    linkedDocs(doc, function (doc) {
+      if (widget) { options.widgetNode = widget.cloneNode(true); }
+      markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
+      for (var i = 0; i < doc.linked.length; ++i)
+        { if (doc.linked[i].isParent) { return } }
+      primary = lst(markers);
+    });
+    return new SharedTextMarker(markers, primary)
+  }
+
+  function findSharedMarkers(doc) {
+    return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
+  }
+
+  function copySharedMarkers(doc, markers) {
+    for (var i = 0; i < markers.length; i++) {
+      var marker = markers[i], pos = marker.find();
+      var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
+      if (cmp(mFrom, mTo)) {
+        var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
+        marker.markers.push(subMark);
+        subMark.parent = marker;
+      }
+    }
+  }
+
+  function detachSharedMarkers(markers) {
+    var loop = function ( i ) {
+      var marker = markers[i], linked = [marker.primary.doc];
+      linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
+      for (var j = 0; j < marker.markers.length; j++) {
+        var subMarker = marker.markers[j];
+        if (indexOf(linked, subMarker.doc) == -1) {
+          subMarker.parent = null;
+          marker.markers.splice(j--, 1);
+        }
+      }
+    };
+
+    for (var i = 0; i < markers.length; i++) loop( i );
+  }
+
+  var nextDocId = 0;
+  var Doc = function(text, mode, firstLine, lineSep, direction) {
+    if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
+    if (firstLine == null) { firstLine = 0; }
+
+    BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
+    this.first = firstLine;
+    this.scrollTop = this.scrollLeft = 0;
+    this.cantEdit = false;
+    this.cleanGeneration = 1;
+    this.modeFrontier = this.highlightFrontier = firstLine;
+    var start = Pos(firstLine, 0);
+    this.sel = simpleSelection(start);
+    this.history = new History(null);
+    this.id = ++nextDocId;
+    this.modeOption = mode;
+    this.lineSep = lineSep;
+    this.direction = (direction == "rtl") ? "rtl" : "ltr";
+    this.extend = false;
+
+    if (typeof text == "string") { text = this.splitLines(text); }
+    updateDoc(this, {from: start, to: start, text: text});
+    setSelection(this, simpleSelection(start), sel_dontScroll);
+  };
+
+  Doc.prototype = createObj(BranchChunk.prototype, {
+    constructor: Doc,
+    // Iterate over the document. Supports two forms -- with only one
+    // argument, it calls that for each line in the document. With
+    // three, it iterates over the range given by the first two (with
+    // the second being non-inclusive).
+    iter: function(from, to, op) {
+      if (op) { this.iterN(from - this.first, to - from, op); }
+      else { this.iterN(this.first, this.first + this.size, from); }
+    },
+
+    // Non-public interface for adding and removing lines.
+    insert: function(at, lines) {
+      var height = 0;
+      for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
+      this.insertInner(at - this.first, lines, height);
+    },
+    remove: function(at, n) { this.removeInner(at - this.first, n); },
+
+    // From here, the methods are part of the public interface. Most
+    // are also available from CodeMirror (editor) instances.
+
+    getValue: function(lineSep) {
+      var lines = getLines(this, this.first, this.first + this.size);
+      if (lineSep === false) { return lines }
+      return lines.join(lineSep || this.lineSeparator())
+    },
+    setValue: docMethodOp(function(code) {
+      var top = Pos(this.first, 0), last = this.first + this.size - 1;
+      makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
+                        text: this.splitLines(code), origin: "setValue", full: true}, true);
+      if (this.cm) { scrollToCoords(this.cm, 0, 0); }
+      setSelection(this, simpleSelection(top), sel_dontScroll);
+    }),
+    replaceRange: function(code, from, to, origin) {
+      from = clipPos(this, from);
+      to = to ? clipPos(this, to) : from;
+      replaceRange(this, code, from, to, origin);
+    },
+    getRange: function(from, to, lineSep) {
+      var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
+      if (lineSep === false) { return lines }
+      if (lineSep === '') { return lines.join('') }
+      return lines.join(lineSep || this.lineSeparator())
+    },
+
+    getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
+
+    getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
+    getLineNumber: function(line) {return lineNo(line)},
+
+    getLineHandleVisualStart: function(line) {
+      if (typeof line == "number") { line = getLine(this, line); }
+      return visualLine(line)
+    },
+
+    lineCount: function() {return this.size},
+    firstLine: function() {return this.first},
+    lastLine: function() {return this.first + this.size - 1},
+
+    clipPos: function(pos) {return clipPos(this, pos)},
+
+    getCursor: function(start) {
+      var range = this.sel.primary(), pos;
+      if (start == null || start == "head") { pos = range.head; }
+      else if (start == "anchor") { pos = range.anchor; }
+      else if (start == "end" || start == "to" || start === false) { pos = range.to(); }
+      else { pos = range.from(); }
+      return pos
+    },
+    listSelections: function() { return this.sel.ranges },
+    somethingSelected: function() {return this.sel.somethingSelected()},
+
+    setCursor: docMethodOp(function(line, ch, options) {
+      setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
+    }),
+    setSelection: docMethodOp(function(anchor, head, options) {
+      setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
+    }),
+    extendSelection: docMethodOp(function(head, other, options) {
+      extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
+    }),
+    extendSelections: docMethodOp(function(heads, options) {
+      extendSelections(this, clipPosArray(this, heads), options);
+    }),
+    extendSelectionsBy: docMethodOp(function(f, options) {
+      var heads = map(this.sel.ranges, f);
+      extendSelections(this, clipPosArray(this, heads), options);
+    }),
+    setSelections: docMethodOp(function(ranges, primary, options) {
+      if (!ranges.length) { return }
+      var out = [];
+      for (var i = 0; i < ranges.length; i++)
+        { out[i] = new Range(clipPos(this, ranges[i].anchor),
+                           clipPos(this, ranges[i].head || ranges[i].anchor)); }
+      if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
+      setSelection(this, normalizeSelection(this.cm, out, primary), options);
+    }),
+    addSelection: docMethodOp(function(anchor, head, options) {
+      var ranges = this.sel.ranges.slice(0);
+      ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
+      setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
+    }),
+
+    getSelection: function(lineSep) {
+      var ranges = this.sel.ranges, lines;
+      for (var i = 0; i < ranges.length; i++) {
+        var sel = getBetween(this, ranges[i].from(), ranges[i].to());
+        lines = lines ? lines.concat(sel) : sel;
+      }
+      if (lineSep === false) { return lines }
+      else { return lines.join(lineSep || this.lineSeparator()) }
+    },
+    getSelections: function(lineSep) {
+      var parts = [], ranges = this.sel.ranges;
+      for (var i = 0; i < ranges.length; i++) {
+        var sel = getBetween(this, ranges[i].from(), ranges[i].to());
+        if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }
+        parts[i] = sel;
+      }
+      return parts
+    },
+    replaceSelection: function(code, collapse, origin) {
+      var dup = [];
+      for (var i = 0; i < this.sel.ranges.length; i++)
+        { dup[i] = code; }
+      this.replaceSelections(dup, collapse, origin || "+input");
+    },
+    replaceSelections: docMethodOp(function(code, collapse, origin) {
+      var changes = [], sel = this.sel;
+      for (var i = 0; i < sel.ranges.length; i++) {
+        var range = sel.ranges[i];
+        changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
+      }
+      var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
+      for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
+        { makeChange(this, changes[i$1]); }
+      if (newSel) { setSelectionReplaceHistory(this, newSel); }
+      else if (this.cm) { ensureCursorVisible(this.cm); }
+    }),
+    undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
+    redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
+    undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
+    redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
+
+    setExtending: function(val) {this.extend = val;},
+    getExtending: function() {return this.extend},
+
+    historySize: function() {
+      var hist = this.history, done = 0, undone = 0;
+      for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
+      for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
+      return {undo: done, redo: undone}
+    },
+    clearHistory: function() {
+      var this$1 = this;
+
+      this.history = new History(this.history);
+      linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);
+    },
+
+    markClean: function() {
+      this.cleanGeneration = this.changeGeneration(true);
+    },
+    changeGeneration: function(forceSplit) {
+      if (forceSplit)
+        { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
+      return this.history.generation
+    },
+    isClean: function (gen) {
+      return this.history.generation == (gen || this.cleanGeneration)
+    },
+
+    getHistory: function() {
+      return {done: copyHistoryArray(this.history.done),
+              undone: copyHistoryArray(this.history.undone)}
+    },
+    setHistory: function(histData) {
+      var hist = this.history = new History(this.history);
+      hist.done = copyHistoryArray(histData.done.slice(0), null, true);
+      hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
+    },
+
+    setGutterMarker: docMethodOp(function(line, gutterID, value) {
+      return changeLine(this, line, "gutter", function (line) {
+        var markers = line.gutterMarkers || (line.gutterMarkers = {});
+        markers[gutterID] = value;
+        if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
+        return true
+      })
+    }),
+
+    clearGutter: docMethodOp(function(gutterID) {
+      var this$1 = this;
+
+      this.iter(function (line) {
+        if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
+          changeLine(this$1, line, "gutter", function () {
+            line.gutterMarkers[gutterID] = null;
+            if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
+            return true
+          });
+        }
+      });
+    }),
+
+    lineInfo: function(line) {
+      var n;
+      if (typeof line == "number") {
+        if (!isLine(this, line)) { return null }
+        n = line;
+        line = getLine(this, line);
+        if (!line) { return null }
+      } else {
+        n = lineNo(line);
+        if (n == null) { return null }
+      }
+      return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
+              textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
+              widgets: line.widgets}
+    },
+
+    addLineClass: docMethodOp(function(handle, where, cls) {
+      return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
+        var prop = where == "text" ? "textClass"
+                 : where == "background" ? "bgClass"
+                 : where == "gutter" ? "gutterClass" : "wrapClass";
+        if (!line[prop]) { line[prop] = cls; }
+        else if (classTest(cls).test(line[prop])) { return false }
+        else { line[prop] += " " + cls; }
+        return true
+      })
+    }),
+    removeLineClass: docMethodOp(function(handle, where, cls) {
+      return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
+        var prop = where == "text" ? "textClass"
+                 : where == "background" ? "bgClass"
+                 : where == "gutter" ? "gutterClass" : "wrapClass";
+        var cur = line[prop];
+        if (!cur) { return false }
+        else if (cls == null) { line[prop] = null; }
+        else {
+          var found = cur.match(classTest(cls));
+          if (!found) { return false }
+          var end = found.index + found[0].length;
+          line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
+        }
+        return true
+      })
+    }),
+
+    addLineWidget: docMethodOp(function(handle, node, options) {
+      return addLineWidget(this, handle, node, options)
+    }),
+    removeLineWidget: function(widget) { widget.clear(); },
+
+    markText: function(from, to, options) {
+      return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
+    },
+    setBookmark: function(pos, options) {
+      var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
+                      insertLeft: options && options.insertLeft,
+                      clearWhenEmpty: false, shared: options && options.shared,
+                      handleMouseEvents: options && options.handleMouseEvents};
+      pos = clipPos(this, pos);
+      return markText(this, pos, pos, realOpts, "bookmark")
+    },
+    findMarksAt: function(pos) {
+      pos = clipPos(this, pos);
+      var markers = [], spans = getLine(this, pos.line).markedSpans;
+      if (spans) { for (var i = 0; i < spans.length; ++i) {
+        var span = spans[i];
+        if ((span.from == null || span.from <= pos.ch) &&
+            (span.to == null || span.to >= pos.ch))
+          { markers.push(span.marker.parent || span.marker); }
+      } }
+      return markers
+    },
+    findMarks: function(from, to, filter) {
+      from = clipPos(this, from); to = clipPos(this, to);
+      var found = [], lineNo = from.line;
+      this.iter(from.line, to.line + 1, function (line) {
+        var spans = line.markedSpans;
+        if (spans) { for (var i = 0; i < spans.length; i++) {
+          var span = spans[i];
+          if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
+                span.from == null && lineNo != from.line ||
+                span.from != null && lineNo == to.line && span.from >= to.ch) &&
+              (!filter || filter(span.marker)))
+            { found.push(span.marker.parent || span.marker); }
+        } }
+        ++lineNo;
+      });
+      return found
+    },
+    getAllMarks: function() {
+      var markers = [];
+      this.iter(function (line) {
+        var sps = line.markedSpans;
+        if (sps) { for (var i = 0; i < sps.length; ++i)
+          { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
+      });
+      return markers
+    },
+
+    posFromIndex: function(off) {
+      var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
+      this.iter(function (line) {
+        var sz = line.text.length + sepSize;
+        if (sz > off) { ch = off; return true }
+        off -= sz;
+        ++lineNo;
+      });
+      return clipPos(this, Pos(lineNo, ch))
+    },
+    indexFromPos: function (coords) {
+      coords = clipPos(this, coords);
+      var index = coords.ch;
+      if (coords.line < this.first || coords.ch < 0) { return 0 }
+      var sepSize = this.lineSeparator().length;
+      this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
+        index += line.text.length + sepSize;
+      });
+      return index
+    },
+
+    copy: function(copyHistory) {
+      var doc = new Doc(getLines(this, this.first, this.first + this.size),
+                        this.modeOption, this.first, this.lineSep, this.direction);
+      doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
+      doc.sel = this.sel;
+      doc.extend = false;
+      if (copyHistory) {
+        doc.history.undoDepth = this.history.undoDepth;
+        doc.setHistory(this.getHistory());
+      }
+      return doc
+    },
+
+    linkedDoc: function(options) {
+      if (!options) { options = {}; }
+      var from = this.first, to = this.first + this.size;
+      if (options.from != null && options.from > from) { from = options.from; }
+      if (options.to != null && options.to < to) { to = options.to; }
+      var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
+      if (options.sharedHist) { copy.history = this.history
+      ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
+      copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
+      copySharedMarkers(copy, findSharedMarkers(this));
+      return copy
+    },
+    unlinkDoc: function(other) {
+      if (other instanceof CodeMirror) { other = other.doc; }
+      if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
+        var link = this.linked[i];
+        if (link.doc != other) { continue }
+        this.linked.splice(i, 1);
+        other.unlinkDoc(this);
+        detachSharedMarkers(findSharedMarkers(this));
+        break
+      } }
+      // If the histories were shared, split them again
+      if (other.history == this.history) {
+        var splitIds = [other.id];
+        linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
+        other.history = new History(null);
+        other.history.done = copyHistoryArray(this.history.done, splitIds);
+        other.history.undone = copyHistoryArray(this.history.undone, splitIds);
+      }
+    },
+    iterLinkedDocs: function(f) {linkedDocs(this, f);},
+
+    getMode: function() {return this.mode},
+    getEditor: function() {return this.cm},
+
+    splitLines: function(str) {
+      if (this.lineSep) { return str.split(this.lineSep) }
+      return splitLinesAuto(str)
+    },
+    lineSeparator: function() { return this.lineSep || "\n" },
+
+    setDirection: docMethodOp(function (dir) {
+      if (dir != "rtl") { dir = "ltr"; }
+      if (dir == this.direction) { return }
+      this.direction = dir;
+      this.iter(function (line) { return line.order = null; });
+      if (this.cm) { directionChanged(this.cm); }
+    })
+  });
+
+  // Public alias.
+  Doc.prototype.eachLine = Doc.prototype.iter;
+
+  // Kludge to work around strange IE behavior where it'll sometimes
+  // re-fire a series of drag-related events right after the drop (#1551)
+  var lastDrop = 0;
+
+  function onDrop(e) {
+    var cm = this;
+    clearDragCursor(cm);
+    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
+      { return }
+    e_preventDefault(e);
+    if (ie) { lastDrop = +new Date; }
+    var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
+    if (!pos || cm.isReadOnly()) { return }
+    // Might be a file drop, in which case we simply extract the text
+    // and insert it.
+    if (files && files.length && window.FileReader && window.File) {
+      var n = files.length, text = Array(n), read = 0;
+      var markAsReadAndPasteIfAllFilesAreRead = function () {
+        if (++read == n) {
+          operation(cm, function () {
+            pos = clipPos(cm.doc, pos);
+            var change = {from: pos, to: pos,
+                          text: cm.doc.splitLines(
+                              text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),
+                          origin: "paste"};
+            makeChange(cm.doc, change);
+            setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));
+          })();
+        }
+      };
+      var readTextFromFile = function (file, i) {
+        if (cm.options.allowDropFileTypes &&
+            indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
+          markAsReadAndPasteIfAllFilesAreRead();
+          return
+        }
+        var reader = new FileReader;
+        reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };
+        reader.onload = function () {
+          var content = reader.result;
+          if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
+            markAsReadAndPasteIfAllFilesAreRead();
+            return
+          }
+          text[i] = content;
+          markAsReadAndPasteIfAllFilesAreRead();
+        };
+        reader.readAsText(file);
+      };
+      for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }
+    } else { // Normal drop
+      // Don't do a replace if the drop happened inside of the selected text.
+      if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
+        cm.state.draggingText(e);
+        // Ensure the editor is re-focused
+        setTimeout(function () { return cm.display.input.focus(); }, 20);
+        return
+      }
+      try {
+        var text$1 = e.dataTransfer.getData("Text");
+        if (text$1) {
+          var selected;
+          if (cm.state.draggingText && !cm.state.draggingText.copy)
+            { selected = cm.listSelections(); }
+          setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
+          if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
+            { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
+          cm.replaceSelection(text$1, "around", "paste");
+          cm.display.input.focus();
+        }
+      }
+      catch(e$1){}
+    }
+  }
+
+  function onDragStart(cm, e) {
+    if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
+    if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
+
+    e.dataTransfer.setData("Text", cm.getSelection());
+    e.dataTransfer.effectAllowed = "copyMove";
+
+    // Use dummy image instead of default browsers image.
+    // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
+    if (e.dataTransfer.setDragImage && !safari) {
+      var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
+      img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
+      if (presto) {
+        img.width = img.height = 1;
+        cm.display.wrapper.appendChild(img);
+        // Force a relayout, or Opera won't use our image for some obscure reason
+        img._top = img.offsetTop;
+      }
+      e.dataTransfer.setDragImage(img, 0, 0);
+      if (presto) { img.parentNode.removeChild(img); }
+    }
+  }
+
+  function onDragOver(cm, e) {
+    var pos = posFromMouse(cm, e);
+    if (!pos) { return }
+    var frag = document.createDocumentFragment();
+    drawSelectionCursor(cm, pos, frag);
+    if (!cm.display.dragCursor) {
+      cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
+      cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
+    }
+    removeChildrenAndAdd(cm.display.dragCursor, frag);
+  }
+
+  function clearDragCursor(cm) {
+    if (cm.display.dragCursor) {
+      cm.display.lineSpace.removeChild(cm.display.dragCursor);
+      cm.display.dragCursor = null;
+    }
+  }
+
+  // These must be handled carefully, because naively registering a
+  // handler for each editor will cause the editors to never be
+  // garbage collected.
+
+  function forEachCodeMirror(f) {
+    if (!document.getElementsByClassName) { return }
+    var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
+    for (var i = 0; i < byClass.length; i++) {
+      var cm = byClass[i].CodeMirror;
+      if (cm) { editors.push(cm); }
+    }
+    if (editors.length) { editors[0].operation(function () {
+      for (var i = 0; i < editors.length; i++) { f(editors[i]); }
+    }); }
+  }
+
+  var globalsRegistered = false;
+  function ensureGlobalHandlers() {
+    if (globalsRegistered) { return }
+    registerGlobalHandlers();
+    globalsRegistered = true;
+  }
+  function registerGlobalHandlers() {
+    // When the window resizes, we need to refresh active editors.
+    var resizeTimer;
+    on(window, "resize", function () {
+      if (resizeTimer == null) { resizeTimer = setTimeout(function () {
+        resizeTimer = null;
+        forEachCodeMirror(onResize);
+      }, 100); }
+    });
+    // When the window loses focus, we want to show the editor as blurred
+    on(window, "blur", function () { return forEachCodeMirror(onBlur); });
+  }
+  // Called when the window resizes
+  function onResize(cm) {
+    var d = cm.display;
+    // Might be a text scaling operation, clear size caches.
+    d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
+    d.scrollbarsClipped = false;
+    cm.setSize();
+  }
+
+  var keyNames = {
+    3: "Pause", 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: "/", 145: "ScrollLock",
+    173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
+    221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
+    63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
+  };
+
+  // Number keys
+  for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
+  // Alphabetic keys
+  for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
+  // Function keys
+  for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
+
+  var keyMap = {};
+
+  keyMap.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"
+  };
+  // Note that the save and find-related commands aren't defined by
+  // default. User code or addons can define them. Unknown commands
+  // are simply ignored.
+  keyMap.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"
+  };
+  // Very basic readline/emacs-style bindings, which are standard on Mac.
+  keyMap.emacsy = {
+    "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
+    "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp",
+    "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine",
+    "Ctrl-T": "transposeChars", "Ctrl-O": "openLine"
+  };
+  keyMap.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"]
+  };
+  keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
+
+  // KEYMAP DISPATCH
+
+  function normalizeKeyName(name) {
+    var parts = name.split(/-(?!$)/);
+    name = parts[parts.length - 1];
+    var alt, ctrl, shift, cmd;
+    for (var i = 0; i < parts.length - 1; i++) {
+      var mod = parts[i];
+      if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
+      else if (/^a(lt)?$/i.test(mod)) { alt = true; }
+      else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
+      else if (/^s(hift)?$/i.test(mod)) { shift = true; }
+      else { throw new Error("Unrecognized modifier name: " + mod) }
+    }
+    if (alt) { name = "Alt-" + name; }
+    if (ctrl) { name = "Ctrl-" + name; }
+    if (cmd) { name = "Cmd-" + name; }
+    if (shift) { name = "Shift-" + name; }
+    return name
+  }
+
+  // This is a kludge to keep keymaps mostly working as raw objects
+  // (backwards compatibility) while at the same time support features
+  // like normalization and multi-stroke key bindings. It compiles a
+  // new normalized keymap, and then updates the old object to reflect
+  // this.
+  function normalizeKeyMap(keymap) {
+    var copy = {};
+    for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
+      var value = keymap[keyname];
+      if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
+      if (value == "...") { delete keymap[keyname]; continue }
+
+      var keys = map(keyname.split(" "), normalizeKeyName);
+      for (var i = 0; i < keys.length; i++) {
+        var val = (void 0), name = (void 0);
+        if (i == keys.length - 1) {
+          name = keys.join(" ");
+          val = value;
+        } else {
+          name = keys.slice(0, i + 1).join(" ");
+          val = "...";
+        }
+        var prev = copy[name];
+        if (!prev) { copy[name] = val; }
+        else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
+      }
+      delete keymap[keyname];
+    } }
+    for (var prop in copy) { keymap[prop] = copy[prop]; }
+    return keymap
+  }
+
+  function lookupKey(key, map, handle, context) {
+    map = getKeyMap(map);
+    var found = map.call ? map.call(key, context) : map[key];
+    if (found === false) { return "nothing" }
+    if (found === "...") { return "multi" }
+    if (found != null && handle(found)) { return "handled" }
+
+    if (map.fallthrough) {
+      if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
+        { return lookupKey(key, map.fallthrough, handle, context) }
+      for (var i = 0; i < map.fallthrough.length; i++) {
+        var result = lookupKey(key, map.fallthrough[i], handle, context);
+        if (result) { return result }
+      }
+    }
+  }
+
+  // Modifier key presses don't count as 'real' key presses for the
+  // purpose of keymap fallthrough.
+  function isModifierKey(value) {
+    var name = typeof value == "string" ? value : keyNames[value.keyCode];
+    return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
+  }
+
+  function addModifierNames(name, event, noShift) {
+    var base = name;
+    if (event.altKey && base != "Alt") { name = "Alt-" + name; }
+    if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
+    if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") { name = "Cmd-" + name; }
+    if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
+    return name
+  }
+
+  // Look up the name of a key as indicated by an event object.
+  function keyName(event, noShift) {
+    if (presto && event.keyCode == 34 && event["char"]) { return false }
+    var name = keyNames[event.keyCode];
+    if (name == null || event.altGraphKey) { return false }
+    // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
+    // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
+    if (event.keyCode == 3 && event.code) { name = event.code; }
+    return addModifierNames(name, event, noShift)
+  }
+
+  function getKeyMap(val) {
+    return typeof val == "string" ? keyMap[val] : val
+  }
+
+  // Helper for deleting text near the selection(s), used to implement
+  // backspace, delete, and similar functionality.
+  function deleteNearSelection(cm, compute) {
+    var ranges = cm.doc.sel.ranges, kill = [];
+    // Build up a set of ranges to kill first, merging overlapping
+    // ranges.
+    for (var i = 0; i < ranges.length; i++) {
+      var toKill = compute(ranges[i]);
+      while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
+        var replaced = kill.pop();
+        if (cmp(replaced.from, toKill.from) < 0) {
+          toKill.from = replaced.from;
+          break
+        }
+      }
+      kill.push(toKill);
+    }
+    // Next, remove those actual ranges.
+    runInOp(cm, function () {
+      for (var i = kill.length - 1; i >= 0; i--)
+        { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
+      ensureCursorVisible(cm);
+    });
+  }
+
+  function moveCharLogically(line, ch, dir) {
+    var target = skipExtendingChars(line.text, ch + dir, dir);
+    return target < 0 || target > line.text.length ? null : target
+  }
+
+  function moveLogically(line, start, dir) {
+    var ch = moveCharLogically(line, start.ch, dir);
+    return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
+  }
+
+  function endOfLine(visually, cm, lineObj, lineNo, dir) {
+    if (visually) {
+      if (cm.doc.direction == "rtl") { dir = -dir; }
+      var order = getOrder(lineObj, cm.doc.direction);
+      if (order) {
+        var part = dir < 0 ? lst(order) : order[0];
+        var moveInStorageOrder = (dir < 0) == (part.level == 1);
+        var sticky = moveInStorageOrder ? "after" : "before";
+        var ch;
+        // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
+        // it could be that the last bidi part is not on the last visual line,
+        // since visual lines contain content order-consecutive chunks.
+        // Thus, in rtl, we are looking for the first (content-order) character
+        // in the rtl chunk that is on the last line (that is, the same line
+        // as the last (content-order) character).
+        if (part.level > 0 || cm.doc.direction == "rtl") {
+          var prep = prepareMeasureForLine(cm, lineObj);
+          ch = dir < 0 ? lineObj.text.length - 1 : 0;
+          var targetTop = measureCharPrepared(cm, prep, ch).top;
+          ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
+          if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
+        } else { ch = dir < 0 ? part.to : part.from; }
+        return new Pos(lineNo, ch, sticky)
+      }
+    }
+    return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
+  }
+
+  function moveVisually(cm, line, start, dir) {
+    var bidi = getOrder(line, cm.doc.direction);
+    if (!bidi) { return moveLogically(line, start, dir) }
+    if (start.ch >= line.text.length) {
+      start.ch = line.text.length;
+      start.sticky = "before";
+    } else if (start.ch <= 0) {
+      start.ch = 0;
+      start.sticky = "after";
+    }
+    var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
+    if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
+      // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
+      // nothing interesting happens.
+      return moveLogically(line, start, dir)
+    }
+
+    var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
+    var prep;
+    var getWrappedLineExtent = function (ch) {
+      if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
+      prep = prep || prepareMeasureForLine(cm, line);
+      return wrappedLineExtentChar(cm, line, prep, ch)
+    };
+    var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
+
+    if (cm.doc.direction == "rtl" || part.level == 1) {
+      var moveInStorageOrder = (part.level == 1) == (dir < 0);
+      var ch = mv(start, moveInStorageOrder ? 1 : -1);
+      if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
+        // Case 2: We move within an rtl part or in an rtl editor on the same visual line
+        var sticky = moveInStorageOrder ? "before" : "after";
+        return new Pos(start.line, ch, sticky)
+      }
+    }
+
+    // Case 3: Could not move within this bidi part in this visual line, so leave
+    // the current bidi part
+
+    var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
+      var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
+        ? new Pos(start.line, mv(ch, 1), "before")
+        : new Pos(start.line, ch, "after"); };
+
+      for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
+        var part = bidi[partPos];
+        var moveInStorageOrder = (dir > 0) == (part.level != 1);
+        var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
+        if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
+        ch = moveInStorageOrder ? part.from : mv(part.to, -1);
+        if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
+      }
+    };
+
+    // Case 3a: Look for other bidi parts on the same visual line
+    var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
+    if (res) { return res }
+
+    // Case 3b: Look for other bidi parts on the next visual line
+    var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
+    if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
+      res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
+      if (res) { return res }
+    }
+
+    // Case 4: Nowhere to move
+    return null
+  }
+
+  // Commands are parameter-less actions that can be performed on an
+  // editor, mostly used for keybindings.
+  var commands = {
+    selectAll: selectAll,
+    singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
+    killLine: function (cm) { return deleteNearSelection(cm, function (range) {
+      if (range.empty()) {
+        var len = getLine(cm.doc, range.head.line).text.length;
+        if (range.head.ch == len && range.head.line < cm.lastLine())
+          { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
+        else
+          { return {from: range.head, to: Pos(range.head.line, len)} }
+      } else {
+        return {from: range.from(), to: range.to()}
+      }
+    }); },
+    deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
+      from: Pos(range.from().line, 0),
+      to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
+    }); }); },
+    delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
+      from: Pos(range.from().line, 0), to: range.from()
+    }); }); },
+    delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
+      var top = cm.charCoords(range.head, "div").top + 5;
+      var leftPos = cm.coordsChar({left: 0, top: top}, "div");
+      return {from: leftPos, to: range.from()}
+    }); },
+    delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
+      var top = cm.charCoords(range.head, "div").top + 5;
+      var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
+      return {from: range.from(), to: rightPos }
+    }); },
+    undo: function (cm) { return cm.undo(); },
+    redo: function (cm) { return cm.redo(); },
+    undoSelection: function (cm) { return cm.undoSelection(); },
+    redoSelection: function (cm) { return cm.redoSelection(); },
+    goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
+    goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
+    goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
+      {origin: "+move", bias: 1}
+    ); },
+    goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
+      {origin: "+move", bias: 1}
+    ); },
+    goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
+      {origin: "+move", bias: -1}
+    ); },
+    goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
+      var top = cm.cursorCoords(range.head, "div").top + 5;
+      return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
+    }, sel_move); },
+    goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
+      var top = cm.cursorCoords(range.head, "div").top + 5;
+      return cm.coordsChar({left: 0, top: top}, "div")
+    }, sel_move); },
+    goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
+      var top = cm.cursorCoords(range.head, "div").top + 5;
+      var pos = cm.coordsChar({left: 0, top: top}, "div");
+      if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
+      return pos
+    }, sel_move); },
+    goLineUp: function (cm) { return cm.moveV(-1, "line"); },
+    goLineDown: function (cm) { return cm.moveV(1, "line"); },
+    goPageUp: function (cm) { return cm.moveV(-1, "page"); },
+    goPageDown: function (cm) { return cm.moveV(1, "page"); },
+    goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
+    goCharRight: function (cm) { return cm.moveH(1, "char"); },
+    goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
+    goColumnRight: function (cm) { return cm.moveH(1, "column"); },
+    goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
+    goGroupRight: function (cm) { return cm.moveH(1, "group"); },
+    goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
+    goWordRight: function (cm) { return cm.moveH(1, "word"); },
+    delCharBefore: function (cm) { return cm.deleteH(-1, "codepoint"); },
+    delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
+    delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
+    delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
+    delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
+    delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
+    indentAuto: function (cm) { return cm.indentSelection("smart"); },
+    indentMore: function (cm) { return cm.indentSelection("add"); },
+    indentLess: function (cm) { return cm.indentSelection("subtract"); },
+    insertTab: function (cm) { return cm.replaceSelection("\t"); },
+    insertSoftTab: function (cm) {
+      var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
+      for (var i = 0; i < ranges.length; i++) {
+        var pos = ranges[i].from();
+        var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
+        spaces.push(spaceStr(tabSize - col % tabSize));
+      }
+      cm.replaceSelections(spaces);
+    },
+    defaultTab: function (cm) {
+      if (cm.somethingSelected()) { cm.indentSelection("add"); }
+      else { cm.execCommand("insertTab"); }
+    },
+    // Swap the two chars left and right of each selection's head.
+    // Move cursor behind the two swapped characters afterwards.
+    //
+    // Doesn't consider line feeds a character.
+    // Doesn't scan more than one line above to find a character.
+    // Doesn't do anything on an empty line.
+    // Doesn't do anything with non-empty selections.
+    transposeChars: function (cm) { return runInOp(cm, function () {
+      var ranges = cm.listSelections(), newSel = [];
+      for (var i = 0; i < ranges.length; i++) {
+        if (!ranges[i].empty()) { continue }
+        var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
+        if (line) {
+          if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
+          if (cur.ch > 0) {
+            cur = new Pos(cur.line, cur.ch + 1);
+            cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
+                            Pos(cur.line, cur.ch - 2), cur, "+transpose");
+          } else if (cur.line > cm.doc.first) {
+            var prev = getLine(cm.doc, cur.line - 1).text;
+            if (prev) {
+              cur = new Pos(cur.line, 1);
+              cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
+                              prev.charAt(prev.length - 1),
+                              Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
+            }
+          }
+        }
+        newSel.push(new Range(cur, cur));
+      }
+      cm.setSelections(newSel);
+    }); },
+    newlineAndIndent: function (cm) { return runInOp(cm, function () {
+      var sels = cm.listSelections();
+      for (var i = sels.length - 1; i >= 0; i--)
+        { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
+      sels = cm.listSelections();
+      for (var i$1 = 0; i$1 < sels.length; i$1++)
+        { cm.indentLine(sels[i$1].from().line, null, true); }
+      ensureCursorVisible(cm);
+    }); },
+    openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
+    toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
+  };
+
+
+  function lineStart(cm, lineN) {
+    var line = getLine(cm.doc, lineN);
+    var visual = visualLine(line);
+    if (visual != line) { lineN = lineNo(visual); }
+    return endOfLine(true, cm, visual, lineN, 1)
+  }
+  function lineEnd(cm, lineN) {
+    var line = getLine(cm.doc, lineN);
+    var visual = visualLineEnd(line);
+    if (visual != line) { lineN = lineNo(visual); }
+    return endOfLine(true, cm, line, lineN, -1)
+  }
+  function lineStartSmart(cm, pos) {
+    var start = lineStart(cm, pos.line);
+    var line = getLine(cm.doc, start.line);
+    var order = getOrder(line, cm.doc.direction);
+    if (!order || order[0].level == 0) {
+      var firstNonWS = Math.max(start.ch, line.text.search(/\S/));
+      var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
+      return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
+    }
+    return start
+  }
+
+  // Run a handler that was bound to a key.
+  function doHandleBinding(cm, bound, dropShift) {
+    if (typeof bound == "string") {
+      bound = commands[bound];
+      if (!bound) { return false }
+    }
+    // Ensure previous input has been read, so that the handler sees a
+    // consistent view of the document
+    cm.display.input.ensurePolled();
+    var prevShift = cm.display.shift, done = false;
+    try {
+      if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
+      if (dropShift) { cm.display.shift = false; }
+      done = bound(cm) != Pass;
+    } finally {
+      cm.display.shift = prevShift;
+      cm.state.suppressEdits = false;
+    }
+    return done
+  }
+
+  function lookupKeyForEditor(cm, name, handle) {
+    for (var i = 0; i < cm.state.keyMaps.length; i++) {
+      var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
+      if (result) { return result }
+    }
+    return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
+      || lookupKey(name, cm.options.keyMap, handle, cm)
+  }
+
+  // Note that, despite the name, this function is also used to check
+  // for bound mouse clicks.
+
+  var stopSeq = new Delayed;
+
+  function dispatchKey(cm, name, e, handle) {
+    var seq = cm.state.keySeq;
+    if (seq) {
+      if (isModifierKey(name)) { return "handled" }
+      if (/\'$/.test(name))
+        { cm.state.keySeq = null; }
+      else
+        { stopSeq.set(50, function () {
+          if (cm.state.keySeq == seq) {
+            cm.state.keySeq = null;
+            cm.display.input.reset();
+          }
+        }); }
+      if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
+    }
+    return dispatchKeyInner(cm, name, e, handle)
+  }
+
+  function dispatchKeyInner(cm, name, e, handle) {
+    var result = lookupKeyForEditor(cm, name, handle);
+
+    if (result == "multi")
+      { cm.state.keySeq = name; }
+    if (result == "handled")
+      { signalLater(cm, "keyHandled", cm, name, e); }
+
+    if (result == "handled" || result == "multi") {
+      e_preventDefault(e);
+      restartBlink(cm);
+    }
+
+    return !!result
+  }
+
+  // Handle a key from the keydown event.
+  function handleKeyBinding(cm, e) {
+    var name = keyName(e, true);
+    if (!name) { return false }
+
+    if (e.shiftKey && !cm.state.keySeq) {
+      // First try to resolve full name (including 'Shift-'). Failing
+      // that, see if there is a cursor-motion command (starting with
+      // 'go') bound to the keyname without 'Shift-'.
+      return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
+          || dispatchKey(cm, name, e, function (b) {
+               if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
+                 { return doHandleBinding(cm, b) }
+             })
+    } else {
+      return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
+    }
+  }
+
+  // Handle a key from the keypress event
+  function handleCharBinding(cm, e, ch) {
+    return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
+  }
+
+  var lastStoppedKey = null;
+  function onKeyDown(e) {
+    var cm = this;
+    if (e.target && e.target != cm.display.input.getField()) { return }
+    cm.curOp.focus = activeElt(root(cm));
+    if (signalDOMEvent(cm, e)) { return }
+    // IE does strange things with escape.
+    if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
+    var code = e.keyCode;
+    cm.display.shift = code == 16 || e.shiftKey;
+    var handled = handleKeyBinding(cm, e);
+    if (presto) {
+      lastStoppedKey = handled ? code : null;
+      // Opera has no cut event... we try to at least catch the key combo
+      if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
+        { cm.replaceSelection("", null, "cut"); }
+    }
+    if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
+      { document.execCommand("cut"); }
+
+    // Turn mouse into crosshair when Alt is held on Mac.
+    if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
+      { showCrossHair(cm); }
+  }
+
+  function showCrossHair(cm) {
+    var lineDiv = cm.display.lineDiv;
+    addClass(lineDiv, "CodeMirror-crosshair");
+
+    function up(e) {
+      if (e.keyCode == 18 || !e.altKey) {
+        rmClass(lineDiv, "CodeMirror-crosshair");
+        off(document, "keyup", up);
+        off(document, "mouseover", up);
+      }
+    }
+    on(document, "keyup", up);
+    on(document, "mouseover", up);
+  }
+
+  function onKeyUp(e) {
+    if (e.keyCode == 16) { this.doc.sel.shift = false; }
+    signalDOMEvent(this, e);
+  }
+
+  function onKeyPress(e) {
+    var cm = this;
+    if (e.target && e.target != cm.display.input.getField()) { return }
+    if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
+    var keyCode = e.keyCode, charCode = e.charCode;
+    if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
+    if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
+    var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
+    // Some browsers fire keypress events for backspace
+    if (ch == "\x08") { return }
+    if (handleCharBinding(cm, e, ch)) { return }
+    cm.display.input.onKeyPress(e);
+  }
+
+  var DOUBLECLICK_DELAY = 400;
+
+  var PastClick = function(time, pos, button) {
+    this.time = time;
+    this.pos = pos;
+    this.button = button;
+  };
+
+  PastClick.prototype.compare = function (time, pos, button) {
+    return this.time + DOUBLECLICK_DELAY > time &&
+      cmp(pos, this.pos) == 0 && button == this.button
+  };
+
+  var lastClick, lastDoubleClick;
+  function clickRepeat(pos, button) {
+    var now = +new Date;
+    if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
+      lastClick = lastDoubleClick = null;
+      return "triple"
+    } else if (lastClick && lastClick.compare(now, pos, button)) {
+      lastDoubleClick = new PastClick(now, pos, button);
+      lastClick = null;
+      return "double"
+    } else {
+      lastClick = new PastClick(now, pos, button);
+      lastDoubleClick = null;
+      return "single"
+    }
+  }
+
+  // A mouse down can be a single click, double click, triple click,
+  // start of selection drag, start of text drag, new cursor
+  // (ctrl-click), rectangle drag (alt-drag), or xwin
+  // middle-click-paste. Or it might be a click on something we should
+  // not interfere with, such as a scrollbar or widget.
+  function onMouseDown(e) {
+    var cm = this, display = cm.display;
+    if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
+    display.input.ensurePolled();
+    display.shift = e.shiftKey;
+
+    if (eventInWidget(display, e)) {
+      if (!webkit) {
+        // Briefly turn off draggability, to allow widgets to do
+        // normal dragging things.
+        display.scroller.draggable = false;
+        setTimeout(function () { return display.scroller.draggable = true; }, 100);
+      }
+      return
+    }
+    if (clickInGutter(cm, e)) { return }
+    var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
+    win(cm).focus();
+
+    // #3261: make sure, that we're not starting a second selection
+    if (button == 1 && cm.state.selectingText)
+      { cm.state.selectingText(e); }
+
+    if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }
+
+    if (button == 1) {
+      if (pos) { leftButtonDown(cm, pos, repeat, e); }
+      else if (e_target(e) == display.scroller) { e_preventDefault(e); }
+    } else if (button == 2) {
+      if (pos) { extendSelection(cm.doc, pos); }
+      setTimeout(function () { return display.input.focus(); }, 20);
+    } else if (button == 3) {
+      if (captureRightClick) { cm.display.input.onContextMenu(e); }
+      else { delayBlurEvent(cm); }
+    }
+  }
+
+  function handleMappedButton(cm, button, pos, repeat, event) {
+    var name = "Click";
+    if (repeat == "double") { name = "Double" + name; }
+    else if (repeat == "triple") { name = "Triple" + name; }
+    name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name;
+
+    return dispatchKey(cm,  addModifierNames(name, event), event, function (bound) {
+      if (typeof bound == "string") { bound = commands[bound]; }
+      if (!bound) { return false }
+      var done = false;
+      try {
+        if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
+        done = bound(cm, pos) != Pass;
+      } finally {
+        cm.state.suppressEdits = false;
+      }
+      return done
+    })
+  }
+
+  function configureMouse(cm, repeat, event) {
+    var option = cm.getOption("configureMouse");
+    var value = option ? option(cm, repeat, event) : {};
+    if (value.unit == null) {
+      var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;
+      value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line";
+    }
+    if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }
+    if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }
+    if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }
+    return value
+  }
+
+  function leftButtonDown(cm, pos, repeat, event) {
+    if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
+    else { cm.curOp.focus = activeElt(root(cm)); }
+
+    var behavior = configureMouse(cm, repeat, event);
+
+    var sel = cm.doc.sel, contained;
+    if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
+        repeat == "single" && (contained = sel.contains(pos)) > -1 &&
+        (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
+        (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
+      { leftButtonStartDrag(cm, event, pos, behavior); }
+    else
+      { leftButtonSelect(cm, event, pos, behavior); }
+  }
+
+  // Start a text drag. When it ends, see if any dragging actually
+  // happen, and treat as a click if it didn't.
+  function leftButtonStartDrag(cm, event, pos, behavior) {
+    var display = cm.display, moved = false;
+    var dragEnd = operation(cm, function (e) {
+      if (webkit) { display.scroller.draggable = false; }
+      cm.state.draggingText = false;
+      if (cm.state.delayingBlurEvent) {
+        if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }
+        else { delayBlurEvent(cm); }
+      }
+      off(display.wrapper.ownerDocument, "mouseup", dragEnd);
+      off(display.wrapper.ownerDocument, "mousemove", mouseMove);
+      off(display.scroller, "dragstart", dragStart);
+      off(display.scroller, "drop", dragEnd);
+      if (!moved) {
+        e_preventDefault(e);
+        if (!behavior.addNew)
+          { extendSelection(cm.doc, pos, null, null, behavior.extend); }
+        // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
+        if ((webkit && !safari) || ie && ie_version == 9)
+          { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }
+        else
+          { display.input.focus(); }
+      }
+    });
+    var mouseMove = function(e2) {
+      moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;
+    };
+    var dragStart = function () { return moved = true; };
+    // Let the drag handler handle this.
+    if (webkit) { display.scroller.draggable = true; }
+    cm.state.draggingText = dragEnd;
+    dragEnd.copy = !behavior.moveOnDrag;
+    on(display.wrapper.ownerDocument, "mouseup", dragEnd);
+    on(display.wrapper.ownerDocument, "mousemove", mouseMove);
+    on(display.scroller, "dragstart", dragStart);
+    on(display.scroller, "drop", dragEnd);
+
+    cm.state.delayingBlurEvent = true;
+    setTimeout(function () { return display.input.focus(); }, 20);
+    // IE's approach to draggable
+    if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
+  }
+
+  function rangeForUnit(cm, pos, unit) {
+    if (unit == "char") { return new Range(pos, pos) }
+    if (unit == "word") { return cm.findWordAt(pos) }
+    if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
+    var result = unit(cm, pos);
+    return new Range(result.from, result.to)
+  }
+
+  // Normal selection, as opposed to text dragging.
+  function leftButtonSelect(cm, event, start, behavior) {
+    if (ie) { delayBlurEvent(cm); }
+    var display = cm.display, doc = cm.doc;
+    e_preventDefault(event);
+
+    var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
+    if (behavior.addNew && !behavior.extend) {
+      ourIndex = doc.sel.contains(start);
+      if (ourIndex > -1)
+        { ourRange = ranges[ourIndex]; }
+      else
+        { ourRange = new Range(start, start); }
+    } else {
+      ourRange = doc.sel.primary();
+      ourIndex = doc.sel.primIndex;
+    }
+
+    if (behavior.unit == "rectangle") {
+      if (!behavior.addNew) { ourRange = new Range(start, start); }
+      start = posFromMouse(cm, event, true, true);
+      ourIndex = -1;
+    } else {
+      var range = rangeForUnit(cm, start, behavior.unit);
+      if (behavior.extend)
+        { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }
+      else
+        { ourRange = range; }
+    }
+
+    if (!behavior.addNew) {
+      ourIndex = 0;
+      setSelection(doc, new Selection([ourRange], 0), sel_mouse);
+      startSel = doc.sel;
+    } else if (ourIndex == -1) {
+      ourIndex = ranges.length;
+      setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
+                   {scroll: false, origin: "*mouse"});
+    } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
+      setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
+                   {scroll: false, origin: "*mouse"});
+      startSel = doc.sel;
+    } else {
+      replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
+    }
+
+    var lastPos = start;
+    function extendTo(pos) {
+      if (cmp(lastPos, pos) == 0) { return }
+      lastPos = pos;
+
+      if (behavior.unit == "rectangle") {
+        var ranges = [], tabSize = cm.options.tabSize;
+        var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
+        var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
+        var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
+        for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
+             line <= end; line++) {
+          var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
+          if (left == right)
+            { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
+          else if (text.length > leftPos)
+            { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
+        }
+        if (!ranges.length) { ranges.push(new Range(start, start)); }
+        setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
+                     {origin: "*mouse", scroll: false});
+        cm.scrollIntoView(pos);
+      } else {
+        var oldRange = ourRange;
+        var range = rangeForUnit(cm, pos, behavior.unit);
+        var anchor = oldRange.anchor, head;
+        if (cmp(range.anchor, anchor) > 0) {
+          head = range.head;
+          anchor = minPos(oldRange.from(), range.anchor);
+        } else {
+          head = range.anchor;
+          anchor = maxPos(oldRange.to(), range.head);
+        }
+        var ranges$1 = startSel.ranges.slice(0);
+        ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
+        setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
+      }
+    }
+
+    var editorSize = display.wrapper.getBoundingClientRect();
+    // Used to ensure timeout re-tries don't fire when another extend
+    // happened in the meantime (clearTimeout isn't reliable -- at
+    // least on Chrome, the timeouts still happen even when cleared,
+    // if the clear happens after their scheduled firing time).
+    var counter = 0;
+
+    function extend(e) {
+      var curCount = ++counter;
+      var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
+      if (!cur) { return }
+      if (cmp(cur, lastPos) != 0) {
+        cm.curOp.focus = activeElt(root(cm));
+        extendTo(cur);
+        var visible = visibleLines(display, doc);
+        if (cur.line >= visible.to || cur.line < visible.from)
+          { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
+      } else {
+        var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
+        if (outside) { setTimeout(operation(cm, function () {
+          if (counter != curCount) { return }
+          display.scroller.scrollTop += outside;
+          extend(e);
+        }), 50); }
+      }
+    }
+
+    function done(e) {
+      cm.state.selectingText = false;
+      counter = Infinity;
+      // If e is null or undefined we interpret this as someone trying
+      // to explicitly cancel the selection rather than the user
+      // letting go of the mouse button.
+      if (e) {
+        e_preventDefault(e);
+        display.input.focus();
+      }
+      off(display.wrapper.ownerDocument, "mousemove", move);
+      off(display.wrapper.ownerDocument, "mouseup", up);
+      doc.history.lastSelOrigin = null;
+    }
+
+    var move = operation(cm, function (e) {
+      if (e.buttons === 0 || !e_button(e)) { done(e); }
+      else { extend(e); }
+    });
+    var up = operation(cm, done);
+    cm.state.selectingText = up;
+    on(display.wrapper.ownerDocument, "mousemove", move);
+    on(display.wrapper.ownerDocument, "mouseup", up);
+  }
+
+  // Used when mouse-selecting to adjust the anchor to the proper side
+  // of a bidi jump depending on the visual position of the head.
+  function bidiSimplify(cm, range) {
+    var anchor = range.anchor;
+    var head = range.head;
+    var anchorLine = getLine(cm.doc, anchor.line);
+    if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }
+    var order = getOrder(anchorLine);
+    if (!order) { return range }
+    var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
+    if (part.from != anchor.ch && part.to != anchor.ch) { return range }
+    var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
+    if (boundary == 0 || boundary == order.length) { return range }
+
+    // Compute the relative visual position of the head compared to the
+    // anchor (<0 is to the left, >0 to the right)
+    var leftSide;
+    if (head.line != anchor.line) {
+      leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0;
+    } else {
+      var headIndex = getBidiPartAt(order, head.ch, head.sticky);
+      var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);
+      if (headIndex == boundary - 1 || headIndex == boundary)
+        { leftSide = dir < 0; }
+      else
+        { leftSide = dir > 0; }
+    }
+
+    var usePart = order[boundary + (leftSide ? -1 : 0)];
+    var from = leftSide == (usePart.level == 1);
+    var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
+    return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
+  }
+
+
+  // Determines whether an event happened in the gutter, and fires the
+  // handlers for the corresponding event.
+  function gutterEvent(cm, e, type, prevent) {
+    var mX, mY;
+    if (e.touches) {
+      mX = e.touches[0].clientX;
+      mY = e.touches[0].clientY;
+    } else {
+      try { mX = e.clientX; mY = e.clientY; }
+      catch(e$1) { return false }
+    }
+    if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
+    if (prevent) { e_preventDefault(e); }
+
+    var display = cm.display;
+    var lineBox = display.lineDiv.getBoundingClientRect();
+
+    if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
+    mY -= lineBox.top - display.viewOffset;
+
+    for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {
+      var g = display.gutters.childNodes[i];
+      if (g && g.getBoundingClientRect().right >= mX) {
+        var line = lineAtHeight(cm.doc, mY);
+        var gutter = cm.display.gutterSpecs[i];
+        signal(cm, type, cm, line, gutter.className, e);
+        return e_defaultPrevented(e)
+      }
+    }
+  }
+
+  function clickInGutter(cm, e) {
+    return gutterEvent(cm, e, "gutterClick", true)
+  }
+
+  // CONTEXT MENU HANDLING
+
+  // To make the context menu work, we need to briefly unhide the
+  // textarea (making it as unobtrusive as possible) to let the
+  // right-click take effect on it.
+  function onContextMenu(cm, e) {
+    if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
+    if (signalDOMEvent(cm, e, "contextmenu")) { return }
+    if (!captureRightClick) { cm.display.input.onContextMenu(e); }
+  }
+
+  function contextMenuInGutter(cm, e) {
+    if (!hasHandler(cm, "gutterContextMenu")) { return false }
+    return gutterEvent(cm, e, "gutterContextMenu", false)
+  }
+
+  function themeChanged(cm) {
+    cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
+      cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
+    clearCaches(cm);
+  }
+
+  var Init = {toString: function(){return "CodeMirror.Init"}};
+
+  var defaults = {};
+  var optionHandlers = {};
+
+  function defineOptions(CodeMirror) {
+    var optionHandlers = CodeMirror.optionHandlers;
+
+    function option(name, deflt, handle, notOnInit) {
+      CodeMirror.defaults[name] = deflt;
+      if (handle) { optionHandlers[name] =
+        notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
+    }
+
+    CodeMirror.defineOption = option;
+
+    // Passed to option handlers when there is no old value.
+    CodeMirror.Init = Init;
+
+    // These two are, on init, called from the constructor because they
+    // have to be initialized before the editor can start at all.
+    option("value", "", function (cm, val) { return cm.setValue(val); }, true);
+    option("mode", null, function (cm, val) {
+      cm.doc.modeOption = val;
+      loadMode(cm);
+    }, true);
+
+    option("indentUnit", 2, loadMode, true);
+    option("indentWithTabs", false);
+    option("smartIndent", true);
+    option("tabSize", 4, function (cm) {
+      resetModeState(cm);
+      clearCaches(cm);
+      regChange(cm);
+    }, true);
+
+    option("lineSeparator", null, function (cm, val) {
+      cm.doc.lineSep = val;
+      if (!val) { return }
+      var newBreaks = [], lineNo = cm.doc.first;
+      cm.doc.iter(function (line) {
+        for (var pos = 0;;) {
+          var found = line.text.indexOf(val, pos);
+          if (found == -1) { break }
+          pos = found + val.length;
+          newBreaks.push(Pos(lineNo, found));
+        }
+        lineNo++;
+      });
+      for (var i = newBreaks.length - 1; i >= 0; i--)
+        { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
+    });
+    option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
+      cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
+      if (old != Init) { cm.refresh(); }
+    });
+    option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
+    option("electricChars", true);
+    option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
+      throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
+    }, true);
+    option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
+    option("autocorrect", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);
+    option("autocapitalize", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);
+    option("rtlMoveVisually", !windows);
+    option("wholeLineUpdateBefore", true);
+
+    option("theme", "default", function (cm) {
+      themeChanged(cm);
+      updateGutters(cm);
+    }, true);
+    option("keyMap", "default", function (cm, val, old) {
+      var next = getKeyMap(val);
+      var prev = old != Init && getKeyMap(old);
+      if (prev && prev.detach) { prev.detach(cm, next); }
+      if (next.attach) { next.attach(cm, prev || null); }
+    });
+    option("extraKeys", null);
+    option("configureMouse", null);
+
+    option("lineWrapping", false, wrappingChanged, true);
+    option("gutters", [], function (cm, val) {
+      cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);
+      updateGutters(cm);
+    }, true);
+    option("fixedGutter", true, function (cm, val) {
+      cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
+      cm.refresh();
+    }, true);
+    option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
+    option("scrollbarStyle", "native", function (cm) {
+      initScrollbars(cm);
+      updateScrollbars(cm);
+      cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
+      cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
+    }, true);
+    option("lineNumbers", false, function (cm, val) {
+      cm.display.gutterSpecs = getGutters(cm.options.gutters, val);
+      updateGutters(cm);
+    }, true);
+    option("firstLineNumber", 1, updateGutters, true);
+    option("lineNumberFormatter", function (integer) { return integer; }, updateGutters, true);
+    option("showCursorWhenSelecting", false, updateSelection, true);
+
+    option("resetSelectionOnContextMenu", true);
+    option("lineWiseCopyCut", true);
+    option("pasteLinesPerSelection", true);
+    option("selectionsMayTouch", false);
+
+    option("readOnly", false, function (cm, val) {
+      if (val == "nocursor") {
+        onBlur(cm);
+        cm.display.input.blur();
+      }
+      cm.display.input.readOnlyChanged(val);
+    });
+
+    option("screenReaderLabel", null, function (cm, val) {
+      val = (val === '') ? null : val;
+      cm.display.input.screenReaderLabelChanged(val);
+    });
+
+    option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
+    option("dragDrop", true, dragDropChanged);
+    option("allowDropFileTypes", null);
+
+    option("cursorBlinkRate", 530);
+    option("cursorScrollMargin", 0);
+    option("cursorHeight", 1, updateSelection, true);
+    option("singleCursorHeightPerLine", true, updateSelection, true);
+    option("workTime", 100);
+    option("workDelay", 100);
+    option("flattenSpans", true, resetModeState, true);
+    option("addModeClass", false, resetModeState, true);
+    option("pollInterval", 100);
+    option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
+    option("historyEventDelay", 1250);
+    option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
+    option("maxHighlightLength", 10000, resetModeState, true);
+    option("moveInputWithCursor", true, function (cm, val) {
+      if (!val) { cm.display.input.resetPosition(); }
+    });
+
+    option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
+    option("autofocus", null);
+    option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
+    option("phrases", null);
+  }
+
+  function dragDropChanged(cm, value, old) {
+    var wasOn = old && old != Init;
+    if (!value != !wasOn) {
+      var funcs = cm.display.dragFunctions;
+      var toggle = value ? on : off;
+      toggle(cm.display.scroller, "dragstart", funcs.start);
+      toggle(cm.display.scroller, "dragenter", funcs.enter);
+      toggle(cm.display.scroller, "dragover", funcs.over);
+      toggle(cm.display.scroller, "dragleave", funcs.leave);
+      toggle(cm.display.scroller, "drop", funcs.drop);
+    }
+  }
+
+  function wrappingChanged(cm) {
+    if (cm.options.lineWrapping) {
+      addClass(cm.display.wrapper, "CodeMirror-wrap");
+      cm.display.sizer.style.minWidth = "";
+      cm.display.sizerWidth = null;
+    } else {
+      rmClass(cm.display.wrapper, "CodeMirror-wrap");
+      findMaxLine(cm);
+    }
+    estimateLineHeights(cm);
+    regChange(cm);
+    clearCaches(cm);
+    setTimeout(function () { return updateScrollbars(cm); }, 100);
+  }
+
+  // A CodeMirror instance represents an editor. This is the object
+  // that user code is usually dealing with.
+
+  function CodeMirror(place, options) {
+    var this$1 = this;
+
+    if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
+
+    this.options = options = options ? copyObj(options) : {};
+    // Determine effective options based on given values and defaults.
+    copyObj(defaults, options, false);
+
+    var doc = options.value;
+    if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
+    else if (options.mode) { doc.modeOption = options.mode; }
+    this.doc = doc;
+
+    var input = new CodeMirror.inputStyles[options.inputStyle](this);
+    var display = this.display = new Display(place, doc, input, options);
+    display.wrapper.CodeMirror = this;
+    themeChanged(this);
+    if (options.lineWrapping)
+      { this.display.wrapper.className += " CodeMirror-wrap"; }
+    initScrollbars(this);
+
+    this.state = {
+      keyMaps: [],  // stores maps added by addKeyMap
+      overlays: [], // highlighting overlays, as added by addOverlay
+      modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info
+      overwrite: false,
+      delayingBlurEvent: false,
+      focused: false,
+      suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
+      pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
+      selectingText: false,
+      draggingText: false,
+      highlight: new Delayed(), // stores highlight worker timeout
+      keySeq: null,  // Unfinished key sequence
+      specialChars: null
+    };
+
+    if (options.autofocus && !mobile) { display.input.focus(); }
+
+    // Override magic textarea content restore that IE sometimes does
+    // on our hidden textarea on reload
+    if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
+
+    registerEventHandlers(this);
+    ensureGlobalHandlers();
+
+    startOperation(this);
+    this.curOp.forceUpdate = true;
+    attachDoc(this, doc);
+
+    if ((options.autofocus && !mobile) || this.hasFocus())
+      { setTimeout(function () {
+        if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }
+      }, 20); }
+    else
+      { onBlur(this); }
+
+    for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
+      { optionHandlers[opt](this, options[opt], Init); } }
+    maybeUpdateLineNumberWidth(this);
+    if (options.finishInit) { options.finishInit(this); }
+    for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }
+    endOperation(this);
+    // Suppress optimizelegibility in Webkit, since it breaks text
+    // measuring on line wrapping boundaries.
+    if (webkit && options.lineWrapping &&
+        getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
+      { display.lineDiv.style.textRendering = "auto"; }
+  }
+
+  // The default configuration options.
+  CodeMirror.defaults = defaults;
+  // Functions to run when options are changed.
+  CodeMirror.optionHandlers = optionHandlers;
+
+  // Attach the necessary event handlers when initializing the editor
+  function registerEventHandlers(cm) {
+    var d = cm.display;
+    on(d.scroller, "mousedown", operation(cm, onMouseDown));
+    // Older IE's will not fire a second mousedown for a double click
+    if (ie && ie_version < 11)
+      { on(d.scroller, "dblclick", operation(cm, function (e) {
+        if (signalDOMEvent(cm, e)) { return }
+        var pos = posFromMouse(cm, e);
+        if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
+        e_preventDefault(e);
+        var word = cm.findWordAt(pos);
+        extendSelection(cm.doc, word.anchor, word.head);
+      })); }
+    else
+      { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
+    // Some browsers fire contextmenu *after* opening the menu, at
+    // which point we can't mess with it anymore. Context menu is
+    // handled in onMouseDown for these browsers.
+    on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
+    on(d.input.getField(), "contextmenu", function (e) {
+      if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }
+    });
+
+    // Used to suppress mouse event handling when a touch happens
+    var touchFinished, prevTouch = {end: 0};
+    function finishTouch() {
+      if (d.activeTouch) {
+        touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
+        prevTouch = d.activeTouch;
+        prevTouch.end = +new Date;
+      }
+    }
+    function isMouseLikeTouchEvent(e) {
+      if (e.touches.length != 1) { return false }
+      var touch = e.touches[0];
+      return touch.radiusX <= 1 && touch.radiusY <= 1
+    }
+    function farAway(touch, other) {
+      if (other.left == null) { return true }
+      var dx = other.left - touch.left, dy = other.top - touch.top;
+      return dx * dx + dy * dy > 20 * 20
+    }
+    on(d.scroller, "touchstart", function (e) {
+      if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
+        d.input.ensurePolled();
+        clearTimeout(touchFinished);
+        var now = +new Date;
+        d.activeTouch = {start: now, moved: false,
+                         prev: now - prevTouch.end <= 300 ? prevTouch : null};
+        if (e.touches.length == 1) {
+          d.activeTouch.left = e.touches[0].pageX;
+          d.activeTouch.top = e.touches[0].pageY;
+        }
+      }
+    });
+    on(d.scroller, "touchmove", function () {
+      if (d.activeTouch) { d.activeTouch.moved = true; }
+    });
+    on(d.scroller, "touchend", function (e) {
+      var touch = d.activeTouch;
+      if (touch && !eventInWidget(d, e) && touch.left != null &&
+          !touch.moved && new Date - touch.start < 300) {
+        var pos = cm.coordsChar(d.activeTouch, "page"), range;
+        if (!touch.prev || farAway(touch, touch.prev)) // Single tap
+          { range = new Range(pos, pos); }
+        else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
+          { range = cm.findWordAt(pos); }
+        else // Triple tap
+          { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
+        cm.setSelection(range.anchor, range.head);
+        cm.focus();
+        e_preventDefault(e);
+      }
+      finishTouch();
+    });
+    on(d.scroller, "touchcancel", finishTouch);
+
+    // Sync scrolling between fake scrollbars and real scrollable
+    // area, ensure viewport is updated when scrolling.
+    on(d.scroller, "scroll", function () {
+      if (d.scroller.clientHeight) {
+        updateScrollTop(cm, d.scroller.scrollTop);
+        setScrollLeft(cm, d.scroller.scrollLeft, true);
+        signal(cm, "scroll", cm);
+      }
+    });
+
+    // Listen to wheel events in order to try and update the viewport on time.
+    on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
+    on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
+
+    // Prevent wrapper from ever scrolling
+    on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
+
+    d.dragFunctions = {
+      enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
+      over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
+      start: function (e) { return onDragStart(cm, e); },
+      drop: operation(cm, onDrop),
+      leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
+    };
+
+    var inp = d.input.getField();
+    on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
+    on(inp, "keydown", operation(cm, onKeyDown));
+    on(inp, "keypress", operation(cm, onKeyPress));
+    on(inp, "focus", function (e) { return onFocus(cm, e); });
+    on(inp, "blur", function (e) { return onBlur(cm, e); });
+  }
+
+  var initHooks = [];
+  CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };
+
+  // Indent the given line. The how parameter can be "smart",
+  // "add"/null, "subtract", or "prev". When aggressive is false
+  // (typically set to true for forced single-line indents), empty
+  // lines are not indented, and places where the mode returns Pass
+  // are left alone.
+  function indentLine(cm, n, how, aggressive) {
+    var doc = cm.doc, state;
+    if (how == null) { how = "add"; }
+    if (how == "smart") {
+      // Fall back to "prev" when the mode doesn't have an indentation
+      // method.
+      if (!doc.mode.indent) { how = "prev"; }
+      else { state = getContextBefore(cm, n).state; }
+    }
+
+    var tabSize = cm.options.tabSize;
+    var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
+    if (line.stateAfter) { line.stateAfter = null; }
+    var curSpaceString = line.text.match(/^\s*/)[0], indentation;
+    if (!aggressive && !/\S/.test(line.text)) {
+      indentation = 0;
+      how = "not";
+    } else if (how == "smart") {
+      indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
+      if (indentation == Pass || indentation > 150) {
+        if (!aggressive) { return }
+        how = "prev";
+      }
+    }
+    if (how == "prev") {
+      if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
+      else { indentation = 0; }
+    } else if (how == "add") {
+      indentation = curSpace + cm.options.indentUnit;
+    } else if (how == "subtract") {
+      indentation = curSpace - cm.options.indentUnit;
+    } else if (typeof how == "number") {
+      indentation = curSpace + how;
+    }
+    indentation = Math.max(0, indentation);
+
+    var indentString = "", pos = 0;
+    if (cm.options.indentWithTabs)
+      { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
+    if (pos < indentation) { indentString += spaceStr(indentation - pos); }
+
+    if (indentString != curSpaceString) {
+      replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
+      line.stateAfter = null;
+      return true
+    } else {
+      // Ensure that, if the cursor was in the whitespace at the start
+      // of the line, it is moved to the end of that space.
+      for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
+        var range = doc.sel.ranges[i$1];
+        if (range.head.line == n && range.head.ch < curSpaceString.length) {
+          var pos$1 = Pos(n, curSpaceString.length);
+          replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
+          break
+        }
+      }
+    }
+  }
+
+  // This will be set to a {lineWise: bool, text: [string]} object, so
+  // that, when pasting, we know what kind of selections the copied
+  // text was made out of.
+  var lastCopied = null;
+
+  function setLastCopied(newLastCopied) {
+    lastCopied = newLastCopied;
+  }
+
+  function applyTextInput(cm, inserted, deleted, sel, origin) {
+    var doc = cm.doc;
+    cm.display.shift = false;
+    if (!sel) { sel = doc.sel; }
+
+    var recent = +new Date - 200;
+    var paste = origin == "paste" || cm.state.pasteIncoming > recent;
+    var textLines = splitLinesAuto(inserted), multiPaste = null;
+    // When pasting N lines into N selections, insert one line per selection
+    if (paste && sel.ranges.length > 1) {
+      if (lastCopied && lastCopied.text.join("\n") == inserted) {
+        if (sel.ranges.length % lastCopied.text.length == 0) {
+          multiPaste = [];
+          for (var i = 0; i < lastCopied.text.length; i++)
+            { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
+        }
+      } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
+        multiPaste = map(textLines, function (l) { return [l]; });
+      }
+    }
+
+    var updateInput = cm.curOp.updateInput;
+    // Normal behavior is to insert the new text into every selection
+    for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
+      var range = sel.ranges[i$1];
+      var from = range.from(), to = range.to();
+      if (range.empty()) {
+        if (deleted && deleted > 0) // Handle deletion
+          { from = Pos(from.line, from.ch - deleted); }
+        else if (cm.state.overwrite && !paste) // Handle overwrite
+          { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
+        else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
+          { from = to = Pos(from.line, 0); }
+      }
+      var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
+                         origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
+      makeChange(cm.doc, changeEvent);
+      signalLater(cm, "inputRead", cm, changeEvent);
+    }
+    if (inserted && !paste)
+      { triggerElectric(cm, inserted); }
+
+    ensureCursorVisible(cm);
+    if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
+    cm.curOp.typing = true;
+    cm.state.pasteIncoming = cm.state.cutIncoming = -1;
+  }
+
+  function handlePaste(e, cm) {
+    var pasted = e.clipboardData && e.clipboardData.getData("Text");
+    if (pasted) {
+      e.preventDefault();
+      if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())
+        { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
+      return true
+    }
+  }
+
+  function triggerElectric(cm, inserted) {
+    // When an 'electric' character is inserted, immediately trigger a reindent
+    if (!cm.options.electricChars || !cm.options.smartIndent) { return }
+    var sel = cm.doc.sel;
+
+    for (var i = sel.ranges.length - 1; i >= 0; i--) {
+      var range = sel.ranges[i];
+      if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
+      var mode = cm.getModeAt(range.head);
+      var indented = false;
+      if (mode.electricChars) {
+        for (var j = 0; j < mode.electricChars.length; j++)
+          { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
+            indented = indentLine(cm, range.head.line, "smart");
+            break
+          } }
+      } else if (mode.electricInput) {
+        if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
+          { indented = indentLine(cm, range.head.line, "smart"); }
+      }
+      if (indented) { signalLater(cm, "electricInput", cm, range.head.line); }
+    }
+  }
+
+  function copyableRanges(cm) {
+    var text = [], ranges = [];
+    for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
+      var line = cm.doc.sel.ranges[i].head.line;
+      var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
+      ranges.push(lineRange);
+      text.push(cm.getRange(lineRange.anchor, lineRange.head));
+    }
+    return {text: text, ranges: ranges}
+  }
+
+  function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
+    field.setAttribute("autocorrect", autocorrect ? "on" : "off");
+    field.setAttribute("autocapitalize", autocapitalize ? "on" : "off");
+    field.setAttribute("spellcheck", !!spellcheck);
+  }
+
+  function hiddenTextarea() {
+    var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none");
+    var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
+    // The textarea is kept positioned near the cursor to prevent the
+    // fact that it'll be scrolled into view on input from scrolling
+    // our fake cursor out of view. On webkit, when wrap=off, paste is
+    // very slow. So make the area wide instead.
+    if (webkit) { te.style.width = "1000px"; }
+    else { te.setAttribute("wrap", "off"); }
+    // If border: 0; -- iOS fails to open keyboard (issue #1287)
+    if (ios) { te.style.border = "1px solid black"; }
+    return div
+  }
+
+  // The publicly visible API. Note that methodOp(f) means
+  // 'wrap f in an operation, performed on its `this` parameter'.
+
+  // This is not the complete set of editor methods. Most of the
+  // methods defined on the Doc type are also injected into
+  // CodeMirror.prototype, for backwards compatibility and
+  // convenience.
+
+  function addEditorMethods(CodeMirror) {
+    var optionHandlers = CodeMirror.optionHandlers;
+
+    var helpers = CodeMirror.helpers = {};
+
+    CodeMirror.prototype = {
+      constructor: CodeMirror,
+      focus: function(){win(this).focus(); this.display.input.focus();},
+
+      setOption: function(option, value) {
+        var options = this.options, old = options[option];
+        if (options[option] == value && option != "mode") { return }
+        options[option] = value;
+        if (optionHandlers.hasOwnProperty(option))
+          { operation(this, optionHandlers[option])(this, value, old); }
+        signal(this, "optionChange", this, option);
+      },
+
+      getOption: function(option) {return this.options[option]},
+      getDoc: function() {return this.doc},
+
+      addKeyMap: function(map, bottom) {
+        this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
+      },
+      removeKeyMap: function(map) {
+        var maps = this.state.keyMaps;
+        for (var i = 0; i < maps.length; ++i)
+          { if (maps[i] == map || maps[i].name == map) {
+            maps.splice(i, 1);
+            return true
+          } }
+      },
+
+      addOverlay: methodOp(function(spec, options) {
+        var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
+        if (mode.startState) { throw new Error("Overlays may not be stateful.") }
+        insertSorted(this.state.overlays,
+                     {mode: mode, modeSpec: spec, opaque: options && options.opaque,
+                      priority: (options && options.priority) || 0},
+                     function (overlay) { return overlay.priority; });
+        this.state.modeGen++;
+        regChange(this);
+      }),
+      removeOverlay: methodOp(function(spec) {
+        var overlays = this.state.overlays;
+        for (var i = 0; i < overlays.length; ++i) {
+          var cur = overlays[i].modeSpec;
+          if (cur == spec || typeof spec == "string" && cur.name == spec) {
+            overlays.splice(i, 1);
+            this.state.modeGen++;
+            regChange(this);
+            return
+          }
+        }
+      }),
+
+      indentLine: methodOp(function(n, dir, aggressive) {
+        if (typeof dir != "string" && typeof dir != "number") {
+          if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
+          else { dir = dir ? "add" : "subtract"; }
+        }
+        if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
+      }),
+      indentSelection: methodOp(function(how) {
+        var ranges = this.doc.sel.ranges, end = -1;
+        for (var i = 0; i < ranges.length; i++) {
+          var range = ranges[i];
+          if (!range.empty()) {
+            var from = range.from(), to = range.to();
+            var start = Math.max(end, from.line);
+            end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
+            for (var j = start; j < end; ++j)
+              { indentLine(this, j, how); }
+            var newRanges = this.doc.sel.ranges;
+            if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
+              { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
+          } else if (range.head.line > end) {
+            indentLine(this, range.head.line, how, true);
+            end = range.head.line;
+            if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }
+          }
+        }
+      }),
+
+      // Fetch the parser token for a given character. Useful for hacks
+      // that want to inspect the mode state (say, for completion).
+      getTokenAt: function(pos, precise) {
+        return takeToken(this, pos, precise)
+      },
+
+      getLineTokens: function(line, precise) {
+        return takeToken(this, Pos(line), precise, true)
+      },
+
+      getTokenTypeAt: function(pos) {
+        pos = clipPos(this.doc, pos);
+        var styles = getLineStyles(this, getLine(this.doc, pos.line));
+        var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
+        var type;
+        if (ch == 0) { type = styles[2]; }
+        else { for (;;) {
+          var mid = (before + after) >> 1;
+          if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
+          else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
+          else { type = styles[mid * 2 + 2]; break }
+        } }
+        var cut = type ? type.indexOf("overlay ") : -1;
+        return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
+      },
+
+      getModeAt: function(pos) {
+        var mode = this.doc.mode;
+        if (!mode.innerMode) { return mode }
+        return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
+      },
+
+      getHelper: function(pos, type) {
+        return this.getHelpers(pos, type)[0]
+      },
+
+      getHelpers: function(pos, type) {
+        var found = [];
+        if (!helpers.hasOwnProperty(type)) { return found }
+        var help = helpers[type], mode = this.getModeAt(pos);
+        if (typeof mode[type] == "string") {
+          if (help[mode[type]]) { found.push(help[mode[type]]); }
+        } else if (mode[type]) {
+          for (var i = 0; i < mode[type].length; i++) {
+            var val = help[mode[type][i]];
+            if (val) { found.push(val); }
+          }
+        } else if (mode.helperType && help[mode.helperType]) {
+          found.push(help[mode.helperType]);
+        } else if (help[mode.name]) {
+          found.push(help[mode.name]);
+        }
+        for (var i$1 = 0; i$1 < help._global.length; i$1++) {
+          var cur = help._global[i$1];
+          if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
+            { found.push(cur.val); }
+        }
+        return found
+      },
+
+      getStateAfter: function(line, precise) {
+        var doc = this.doc;
+        line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
+        return getContextBefore(this, line + 1, precise).state
+      },
+
+      cursorCoords: function(start, mode) {
+        var pos, range = this.doc.sel.primary();
+        if (start == null) { pos = range.head; }
+        else if (typeof start == "object") { pos = clipPos(this.doc, start); }
+        else { pos = start ? range.from() : range.to(); }
+        return cursorCoords(this, pos, mode || "page")
+      },
+
+      charCoords: function(pos, mode) {
+        return charCoords(this, clipPos(this.doc, pos), mode || "page")
+      },
+
+      coordsChar: function(coords, mode) {
+        coords = fromCoordSystem(this, coords, mode || "page");
+        return coordsChar(this, coords.left, coords.top)
+      },
+
+      lineAtHeight: function(height, mode) {
+        height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
+        return lineAtHeight(this.doc, height + this.display.viewOffset)
+      },
+      heightAtLine: function(line, mode, includeWidgets) {
+        var end = false, lineObj;
+        if (typeof line == "number") {
+          var last = this.doc.first + this.doc.size - 1;
+          if (line < this.doc.first) { line = this.doc.first; }
+          else if (line > last) { line = last; end = true; }
+          lineObj = getLine(this.doc, line);
+        } else {
+          lineObj = line;
+        }
+        return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
+          (end ? this.doc.height - heightAtLine(lineObj) : 0)
+      },
+
+      defaultTextHeight: function() { return textHeight(this.display) },
+      defaultCharWidth: function() { return charWidth(this.display) },
+
+      getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
+
+      addWidget: function(pos, node, scroll, vert, horiz) {
+        var display = this.display;
+        pos = cursorCoords(this, clipPos(this.doc, pos));
+        var top = pos.bottom, left = pos.left;
+        node.style.position = "absolute";
+        node.setAttribute("cm-ignore-events", "true");
+        this.display.input.setUneditable(node);
+        display.sizer.appendChild(node);
+        if (vert == "over") {
+          top = pos.top;
+        } else if (vert == "above" || vert == "near") {
+          var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
+          hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
+          // Default to positioning above (if specified and possible); otherwise default to positioning below
+          if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
+            { top = pos.top - node.offsetHeight; }
+          else if (pos.bottom + node.offsetHeight <= vspace)
+            { top = pos.bottom; }
+          if (left + node.offsetWidth > hspace)
+            { left = hspace - node.offsetWidth; }
+        }
+        node.style.top = top + "px";
+        node.style.left = node.style.right = "";
+        if (horiz == "right") {
+          left = display.sizer.clientWidth - node.offsetWidth;
+          node.style.right = "0px";
+        } else {
+          if (horiz == "left") { left = 0; }
+          else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
+          node.style.left = left + "px";
+        }
+        if (scroll)
+          { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
+      },
+
+      triggerOnKeyDown: methodOp(onKeyDown),
+      triggerOnKeyPress: methodOp(onKeyPress),
+      triggerOnKeyUp: onKeyUp,
+      triggerOnMouseDown: methodOp(onMouseDown),
+
+      execCommand: function(cmd) {
+        if (commands.hasOwnProperty(cmd))
+          { return commands[cmd].call(null, this) }
+      },
+
+      triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
+
+      findPosH: function(from, amount, unit, visually) {
+        var dir = 1;
+        if (amount < 0) { dir = -1; amount = -amount; }
+        var cur = clipPos(this.doc, from);
+        for (var i = 0; i < amount; ++i) {
+          cur = findPosH(this.doc, cur, dir, unit, visually);
+          if (cur.hitSide) { break }
+        }
+        return cur
+      },
+
+      moveH: methodOp(function(dir, unit) {
+        var this$1 = this;
+
+        this.extendSelectionsBy(function (range) {
+          if (this$1.display.shift || this$1.doc.extend || range.empty())
+            { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
+          else
+            { return dir < 0 ? range.from() : range.to() }
+        }, sel_move);
+      }),
+
+      deleteH: methodOp(function(dir, unit) {
+        var sel = this.doc.sel, doc = this.doc;
+        if (sel.somethingSelected())
+          { doc.replaceSelection("", null, "+delete"); }
+        else
+          { deleteNearSelection(this, function (range) {
+            var other = findPosH(doc, range.head, dir, unit, false);
+            return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
+          }); }
+      }),
+
+      findPosV: function(from, amount, unit, goalColumn) {
+        var dir = 1, x = goalColumn;
+        if (amount < 0) { dir = -1; amount = -amount; }
+        var cur = clipPos(this.doc, from);
+        for (var i = 0; i < amount; ++i) {
+          var coords = cursorCoords(this, cur, "div");
+          if (x == null) { x = coords.left; }
+          else { coords.left = x; }
+          cur = findPosV(this, coords, dir, unit);
+          if (cur.hitSide) { break }
+        }
+        return cur
+      },
+
+      moveV: methodOp(function(dir, unit) {
+        var this$1 = this;
+
+        var doc = this.doc, goals = [];
+        var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
+        doc.extendSelectionsBy(function (range) {
+          if (collapse)
+            { return dir < 0 ? range.from() : range.to() }
+          var headPos = cursorCoords(this$1, range.head, "div");
+          if (range.goalColumn != null) { headPos.left = range.goalColumn; }
+          goals.push(headPos.left);
+          var pos = findPosV(this$1, headPos, dir, unit);
+          if (unit == "page" && range == doc.sel.primary())
+            { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
+          return pos
+        }, sel_move);
+        if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
+          { doc.sel.ranges[i].goalColumn = goals[i]; } }
+      }),
+
+      // Find the word at the given position (as returned by coordsChar).
+      findWordAt: function(pos) {
+        var doc = this.doc, line = getLine(doc, pos.line).text;
+        var start = pos.ch, end = pos.ch;
+        if (line) {
+          var helper = this.getHelper(pos, "wordChars");
+          if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
+          var startChar = line.charAt(start);
+          var check = isWordChar(startChar, helper)
+            ? function (ch) { return isWordChar(ch, helper); }
+            : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
+            : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
+          while (start > 0 && check(line.charAt(start - 1))) { --start; }
+          while (end < line.length && check(line.charAt(end))) { ++end; }
+        }
+        return new Range(Pos(pos.line, start), Pos(pos.line, end))
+      },
+
+      toggleOverwrite: function(value) {
+        if (value != null && value == this.state.overwrite) { return }
+        if (this.state.overwrite = !this.state.overwrite)
+          { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
+        else
+          { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
+
+        signal(this, "overwriteToggle", this, this.state.overwrite);
+      },
+      hasFocus: function() { return this.display.input.getField() == activeElt(root(this)) },
+      isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
+
+      scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
+      getScrollInfo: function() {
+        var scroller = this.display.scroller;
+        return {left: scroller.scrollLeft, top: scroller.scrollTop,
+                height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
+                width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
+                clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
+      },
+
+      scrollIntoView: methodOp(function(range, margin) {
+        if (range == null) {
+          range = {from: this.doc.sel.primary().head, to: null};
+          if (margin == null) { margin = this.options.cursorScrollMargin; }
+        } else if (typeof range == "number") {
+          range = {from: Pos(range, 0), to: null};
+        } else if (range.from == null) {
+          range = {from: range, to: null};
+        }
+        if (!range.to) { range.to = range.from; }
+        range.margin = margin || 0;
+
+        if (range.from.line != null) {
+          scrollToRange(this, range);
+        } else {
+          scrollToCoordsRange(this, range.from, range.to, range.margin);
+        }
+      }),
+
+      setSize: methodOp(function(width, height) {
+        var this$1 = this;
+
+        var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
+        if (width != null) { this.display.wrapper.style.width = interpret(width); }
+        if (height != null) { this.display.wrapper.style.height = interpret(height); }
+        if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
+        var lineNo = this.display.viewFrom;
+        this.doc.iter(lineNo, this.display.viewTo, function (line) {
+          if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
+            { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
+          ++lineNo;
+        });
+        this.curOp.forceUpdate = true;
+        signal(this, "refresh", this);
+      }),
+
+      operation: function(f){return runInOp(this, f)},
+      startOperation: function(){return startOperation(this)},
+      endOperation: function(){return endOperation(this)},
+
+      refresh: methodOp(function() {
+        var oldHeight = this.display.cachedTextHeight;
+        regChange(this);
+        this.curOp.forceUpdate = true;
+        clearCaches(this);
+        scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);
+        updateGutterSpace(this.display);
+        if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)
+          { estimateLineHeights(this); }
+        signal(this, "refresh", this);
+      }),
+
+      swapDoc: methodOp(function(doc) {
+        var old = this.doc;
+        old.cm = null;
+        // Cancel the current text selection if any (#5821)
+        if (this.state.selectingText) { this.state.selectingText(); }
+        attachDoc(this, doc);
+        clearCaches(this);
+        this.display.input.reset();
+        scrollToCoords(this, doc.scrollLeft, doc.scrollTop);
+        this.curOp.forceScroll = true;
+        signalLater(this, "swapDoc", this, old);
+        return old
+      }),
+
+      phrase: function(phraseText) {
+        var phrases = this.options.phrases;
+        return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
+      },
+
+      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}
+    };
+    eventMixin(CodeMirror);
+
+    CodeMirror.registerHelper = function(type, name, value) {
+      if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
+      helpers[type][name] = value;
+    };
+    CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
+      CodeMirror.registerHelper(type, name, value);
+      helpers[type]._global.push({pred: predicate, val: value});
+    };
+  }
+
+  // Used for horizontal relative motion. Dir is -1 or 1 (left or
+  // right), unit can be "codepoint", "char", "column" (like char, but
+  // doesn't cross line boundaries), "word" (across next word), or
+  // "group" (to the start of next group of word or
+  // non-word-non-whitespace chars). The visually param controls
+  // whether, in right-to-left text, direction 1 means to move towards
+  // the next index in the string, or towards the character to the right
+  // of the current position. The resulting position will have a
+  // hitSide=true property if it reached the end of the document.
+  function findPosH(doc, pos, dir, unit, visually) {
+    var oldPos = pos;
+    var origDir = dir;
+    var lineObj = getLine(doc, pos.line);
+    var lineDir = visually && doc.direction == "rtl" ? -dir : dir;
+    function findNextLine() {
+      var l = pos.line + lineDir;
+      if (l < doc.first || l >= doc.first + doc.size) { return false }
+      pos = new Pos(l, pos.ch, pos.sticky);
+      return lineObj = getLine(doc, l)
+    }
+    function moveOnce(boundToLine) {
+      var next;
+      if (unit == "codepoint") {
+        var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));
+        if (isNaN(ch)) {
+          next = null;
+        } else {
+          var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;
+          next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);
+        }
+      } else if (visually) {
+        next = moveVisually(doc.cm, lineObj, pos, dir);
+      } else {
+        next = moveLogically(lineObj, pos, dir);
+      }
+      if (next == null) {
+        if (!boundToLine && findNextLine())
+          { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }
+        else
+          { return false }
+      } else {
+        pos = next;
+      }
+      return true
+    }
+
+    if (unit == "char" || unit == "codepoint") {
+      moveOnce();
+    } else if (unit == "column") {
+      moveOnce(true);
+    } else if (unit == "word" || unit == "group") {
+      var sawType = null, group = unit == "group";
+      var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
+      for (var first = true;; first = false) {
+        if (dir < 0 && !moveOnce(!first)) { break }
+        var cur = lineObj.text.charAt(pos.ch) || "\n";
+        var type = isWordChar(cur, helper) ? "w"
+          : group && cur == "\n" ? "n"
+          : !group || /\s/.test(cur) ? null
+          : "p";
+        if (group && !first && !type) { type = "s"; }
+        if (sawType && sawType != type) {
+          if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
+          break
+        }
+
+        if (type) { sawType = type; }
+        if (dir > 0 && !moveOnce(!first)) { break }
+      }
+    }
+    var result = skipAtomic(doc, pos, oldPos, origDir, true);
+    if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
+    return result
+  }
+
+  // For relative vertical movement. Dir may be -1 or 1. Unit can be
+  // "page" or "line". The resulting position will have a hitSide=true
+  // property if it reached the end of the document.
+  function findPosV(cm, pos, dir, unit) {
+    var doc = cm.doc, x = pos.left, y;
+    if (unit == "page") {
+      var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);
+      var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
+      y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
+
+    } else if (unit == "line") {
+      y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
+    }
+    var target;
+    for (;;) {
+      target = coordsChar(cm, x, y);
+      if (!target.outside) { break }
+      if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
+      y += dir * 5;
+    }
+    return target
+  }
+
+  // CONTENTEDITABLE INPUT STYLE
+
+  var ContentEditableInput = function(cm) {
+    this.cm = cm;
+    this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
+    this.polling = new Delayed();
+    this.composing = null;
+    this.gracePeriod = false;
+    this.readDOMTimeout = null;
+  };
+
+  ContentEditableInput.prototype.init = function (display) {
+      var this$1 = this;
+
+    var input = this, cm = input.cm;
+    var div = input.div = display.lineDiv;
+    div.contentEditable = true;
+    disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);
+
+    function belongsToInput(e) {
+      for (var t = e.target; t; t = t.parentNode) {
+        if (t == div) { return true }
+        if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) { break }
+      }
+      return false
+    }
+
+    on(div, "paste", function (e) {
+      if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
+      // IE doesn't fire input events, so we schedule a read for the pasted content in this way
+      if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
+    });
+
+    on(div, "compositionstart", function (e) {
+      this$1.composing = {data: e.data, done: false};
+    });
+    on(div, "compositionupdate", function (e) {
+      if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
+    });
+    on(div, "compositionend", function (e) {
+      if (this$1.composing) {
+        if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
+        this$1.composing.done = true;
+      }
+    });
+
+    on(div, "touchstart", function () { return input.forceCompositionEnd(); });
+
+    on(div, "input", function () {
+      if (!this$1.composing) { this$1.readFromDOMSoon(); }
+    });
+
+    function onCopyCut(e) {
+      if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }
+      if (cm.somethingSelected()) {
+        setLastCopied({lineWise: false, text: cm.getSelections()});
+        if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
+      } else if (!cm.options.lineWiseCopyCut) {
+        return
+      } else {
+        var ranges = copyableRanges(cm);
+        setLastCopied({lineWise: true, text: ranges.text});
+        if (e.type == "cut") {
+          cm.operation(function () {
+            cm.setSelections(ranges.ranges, 0, sel_dontScroll);
+            cm.replaceSelection("", null, "cut");
+          });
+        }
+      }
+      if (e.clipboardData) {
+        e.clipboardData.clearData();
+        var content = lastCopied.text.join("\n");
+        // iOS exposes the clipboard API, but seems to discard content inserted into it
+        e.clipboardData.setData("Text", content);
+        if (e.clipboardData.getData("Text") == content) {
+          e.preventDefault();
+          return
+        }
+      }
+      // Old-fashioned briefly-focus-a-textarea hack
+      var kludge = hiddenTextarea(), te = kludge.firstChild;
+      disableBrowserMagic(te);
+      cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
+      te.value = lastCopied.text.join("\n");
+      var hadFocus = activeElt(rootNode(div));
+      selectInput(te);
+      setTimeout(function () {
+        cm.display.lineSpace.removeChild(kludge);
+        hadFocus.focus();
+        if (hadFocus == div) { input.showPrimarySelection(); }
+      }, 50);
+    }
+    on(div, "copy", onCopyCut);
+    on(div, "cut", onCopyCut);
+  };
+
+  ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {
+    // Label for screenreaders, accessibility
+    if(label) {
+      this.div.setAttribute('aria-label', label);
+    } else {
+      this.div.removeAttribute('aria-label');
+    }
+  };
+
+  ContentEditableInput.prototype.prepareSelection = function () {
+    var result = prepareSelection(this.cm, false);
+    result.focus = activeElt(rootNode(this.div)) == this.div;
+    return result
+  };
+
+  ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
+    if (!info || !this.cm.display.view.length) { return }
+    if (info.focus || takeFocus) { this.showPrimarySelection(); }
+    this.showMultipleSelections(info);
+  };
+
+  ContentEditableInput.prototype.getSelection = function () {
+    return this.cm.display.wrapper.ownerDocument.getSelection()
+  };
+
+  ContentEditableInput.prototype.showPrimarySelection = function () {
+    var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();
+    var from = prim.from(), to = prim.to();
+
+    if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
+      sel.removeAllRanges();
+      return
+    }
+
+    var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
+    var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);
+    if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
+        cmp(minPos(curAnchor, curFocus), from) == 0 &&
+        cmp(maxPos(curAnchor, curFocus), to) == 0)
+      { return }
+
+    var view = cm.display.view;
+    var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
+        {node: view[0].measure.map[2], offset: 0};
+    var end = to.line < cm.display.viewTo && posToDOM(cm, to);
+    if (!end) {
+      var measure = view[view.length - 1].measure;
+      var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
+      end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
+    }
+
+    if (!start || !end) {
+      sel.removeAllRanges();
+      return
+    }
+
+    var old = sel.rangeCount && sel.getRangeAt(0), rng;
+    try { rng = range(start.node, start.offset, end.offset, end.node); }
+    catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
+    if (rng) {
+      if (!gecko && cm.state.focused) {
+        sel.collapse(start.node, start.offset);
+        if (!rng.collapsed) {
+          sel.removeAllRanges();
+          sel.addRange(rng);
+        }
+      } else {
+        sel.removeAllRanges();
+        sel.addRange(rng);
+      }
+      if (old && sel.anchorNode == null) { sel.addRange(old); }
+      else if (gecko) { this.startGracePeriod(); }
+    }
+    this.rememberSelection();
+  };
+
+  ContentEditableInput.prototype.startGracePeriod = function () {
+      var this$1 = this;
+
+    clearTimeout(this.gracePeriod);
+    this.gracePeriod = setTimeout(function () {
+      this$1.gracePeriod = false;
+      if (this$1.selectionChanged())
+        { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
+    }, 20);
+  };
+
+  ContentEditableInput.prototype.showMultipleSelections = function (info) {
+    removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
+    removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
+  };
+
+  ContentEditableInput.prototype.rememberSelection = function () {
+    var sel = this.getSelection();
+    this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
+    this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
+  };
+
+  ContentEditableInput.prototype.selectionInEditor = function () {
+    var sel = this.getSelection();
+    if (!sel.rangeCount) { return false }
+    var node = sel.getRangeAt(0).commonAncestorContainer;
+    return contains(this.div, node)
+  };
+
+  ContentEditableInput.prototype.focus = function () {
+    if (this.cm.options.readOnly != "nocursor") {
+      if (!this.selectionInEditor() || activeElt(rootNode(this.div)) != this.div)
+        { this.showSelection(this.prepareSelection(), true); }
+      this.div.focus();
+    }
+  };
+  ContentEditableInput.prototype.blur = function () { this.div.blur(); };
+  ContentEditableInput.prototype.getField = function () { return this.div };
+
+  ContentEditableInput.prototype.supportsTouch = function () { return true };
+
+  ContentEditableInput.prototype.receivedFocus = function () {
+      var this$1 = this;
+
+    var input = this;
+    if (this.selectionInEditor())
+      { setTimeout(function () { return this$1.pollSelection(); }, 20); }
+    else
+      { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
+
+    function poll() {
+      if (input.cm.state.focused) {
+        input.pollSelection();
+        input.polling.set(input.cm.options.pollInterval, poll);
+      }
+    }
+    this.polling.set(this.cm.options.pollInterval, poll);
+  };
+
+  ContentEditableInput.prototype.selectionChanged = function () {
+    var sel = this.getSelection();
+    return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
+      sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
+  };
+
+  ContentEditableInput.prototype.pollSelection = function () {
+    if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
+    var sel = this.getSelection(), cm = this.cm;
+    // On Android Chrome (version 56, at least), backspacing into an
+    // uneditable block element will put the cursor in that element,
+    // and then, because it's not editable, hide the virtual keyboard.
+    // Because Android doesn't allow us to actually detect backspace
+    // presses in a sane way, this code checks for when that happens
+    // and simulates a backspace press in this case.
+    if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {
+      this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
+      this.blur();
+      this.focus();
+      return
+    }
+    if (this.composing) { return }
+    this.rememberSelection();
+    var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
+    var head = domToPos(cm, sel.focusNode, sel.focusOffset);
+    if (anchor && head) { runInOp(cm, function () {
+      setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
+      if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
+    }); }
+  };
+
+  ContentEditableInput.prototype.pollContent = function () {
+    if (this.readDOMTimeout != null) {
+      clearTimeout(this.readDOMTimeout);
+      this.readDOMTimeout = null;
+    }
+
+    var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
+    var from = sel.from(), to = sel.to();
+    if (from.ch == 0 && from.line > cm.firstLine())
+      { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
+    if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
+      { to = Pos(to.line + 1, 0); }
+    if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
+
+    var fromIndex, fromLine, fromNode;
+    if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
+      fromLine = lineNo(display.view[0].line);
+      fromNode = display.view[0].node;
+    } else {
+      fromLine = lineNo(display.view[fromIndex].line);
+      fromNode = display.view[fromIndex - 1].node.nextSibling;
+    }
+    var toIndex = findViewIndex(cm, to.line);
+    var toLine, toNode;
+    if (toIndex == display.view.length - 1) {
+      toLine = display.viewTo - 1;
+      toNode = display.lineDiv.lastChild;
+    } else {
+      toLine = lineNo(display.view[toIndex + 1].line) - 1;
+      toNode = display.view[toIndex + 1].node.previousSibling;
+    }
+
+    if (!fromNode) { return false }
+    var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
+    var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
+    while (newText.length > 1 && oldText.length > 1) {
+      if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
+      else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
+      else { break }
+    }
+
+    var cutFront = 0, cutEnd = 0;
+    var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
+    while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
+      { ++cutFront; }
+    var newBot = lst(newText), oldBot = lst(oldText);
+    var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
+                             oldBot.length - (oldText.length == 1 ? cutFront : 0));
+    while (cutEnd < maxCutEnd &&
+           newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
+      { ++cutEnd; }
+    // Try to move start of change to start of selection if ambiguous
+    if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
+      while (cutFront && cutFront > from.ch &&
+             newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
+        cutFront--;
+        cutEnd++;
+      }
+    }
+
+    newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
+    newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
+
+    var chFrom = Pos(fromLine, cutFront);
+    var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
+    if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
+      replaceRange(cm.doc, newText, chFrom, chTo, "+input");
+      return true
+    }
+  };
+
+  ContentEditableInput.prototype.ensurePolled = function () {
+    this.forceCompositionEnd();
+  };
+  ContentEditableInput.prototype.reset = function () {
+    this.forceCompositionEnd();
+  };
+  ContentEditableInput.prototype.forceCompositionEnd = function () {
+    if (!this.composing) { return }
+    clearTimeout(this.readDOMTimeout);
+    this.composing = null;
+    this.updateFromDOM();
+    this.div.blur();
+    this.div.focus();
+  };
+  ContentEditableInput.prototype.readFromDOMSoon = function () {
+      var this$1 = this;
+
+    if (this.readDOMTimeout != null) { return }
+    this.readDOMTimeout = setTimeout(function () {
+      this$1.readDOMTimeout = null;
+      if (this$1.composing) {
+        if (this$1.composing.done) { this$1.composing = null; }
+        else { return }
+      }
+      this$1.updateFromDOM();
+    }, 80);
+  };
+
+  ContentEditableInput.prototype.updateFromDOM = function () {
+      var this$1 = this;
+
+    if (this.cm.isReadOnly() || !this.pollContent())
+      { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
+  };
+
+  ContentEditableInput.prototype.setUneditable = function (node) {
+    node.contentEditable = "false";
+  };
+
+  ContentEditableInput.prototype.onKeyPress = function (e) {
+    if (e.charCode == 0 || this.composing) { return }
+    e.preventDefault();
+    if (!this.cm.isReadOnly())
+      { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
+  };
+
+  ContentEditableInput.prototype.readOnlyChanged = function (val) {
+    this.div.contentEditable = String(val != "nocursor");
+  };
+
+  ContentEditableInput.prototype.onContextMenu = function () {};
+  ContentEditableInput.prototype.resetPosition = function () {};
+
+  ContentEditableInput.prototype.needsContentAttribute = true;
+
+  function posToDOM(cm, pos) {
+    var view = findViewForLine(cm, pos.line);
+    if (!view || view.hidden) { return null }
+    var line = getLine(cm.doc, pos.line);
+    var info = mapFromLineView(view, line, pos.line);
+
+    var order = getOrder(line, cm.doc.direction), side = "left";
+    if (order) {
+      var partPos = getBidiPartAt(order, pos.ch);
+      side = partPos % 2 ? "right" : "left";
+    }
+    var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
+    result.offset = result.collapse == "right" ? result.end : result.start;
+    return result
+  }
+
+  function isInGutter(node) {
+    for (var scan = node; scan; scan = scan.parentNode)
+      { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
+    return false
+  }
+
+  function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
+
+  function domTextBetween(cm, from, to, fromLine, toLine) {
+    var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
+    function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
+    function close() {
+      if (closing) {
+        text += lineSep;
+        if (extraLinebreak) { text += lineSep; }
+        closing = extraLinebreak = false;
+      }
+    }
+    function addText(str) {
+      if (str) {
+        close();
+        text += str;
+      }
+    }
+    function walk(node) {
+      if (node.nodeType == 1) {
+        var cmText = node.getAttribute("cm-text");
+        if (cmText) {
+          addText(cmText);
+          return
+        }
+        var markerID = node.getAttribute("cm-marker"), range;
+        if (markerID) {
+          var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
+          if (found.length && (range = found[0].find(0)))
+            { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }
+          return
+        }
+        if (node.getAttribute("contenteditable") == "false") { return }
+        var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);
+        if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }
+
+        if (isBlock) { close(); }
+        for (var i = 0; i < node.childNodes.length; i++)
+          { walk(node.childNodes[i]); }
+
+        if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }
+        if (isBlock) { closing = true; }
+      } else if (node.nodeType == 3) {
+        addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "));
+      }
+    }
+    for (;;) {
+      walk(from);
+      if (from == to) { break }
+      from = from.nextSibling;
+      extraLinebreak = false;
+    }
+    return text
+  }
+
+  function domToPos(cm, node, offset) {
+    var lineNode;
+    if (node == cm.display.lineDiv) {
+      lineNode = cm.display.lineDiv.childNodes[offset];
+      if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
+      node = null; offset = 0;
+    } else {
+      for (lineNode = node;; lineNode = lineNode.parentNode) {
+        if (!lineNode || lineNode == cm.display.lineDiv) { return null }
+        if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
+      }
+    }
+    for (var i = 0; i < cm.display.view.length; i++) {
+      var lineView = cm.display.view[i];
+      if (lineView.node == lineNode)
+        { return locateNodeInLineView(lineView, node, offset) }
+    }
+  }
+
+  function locateNodeInLineView(lineView, node, offset) {
+    var wrapper = lineView.text.firstChild, bad = false;
+    if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
+    if (node == wrapper) {
+      bad = true;
+      node = wrapper.childNodes[offset];
+      offset = 0;
+      if (!node) {
+        var line = lineView.rest ? lst(lineView.rest) : lineView.line;
+        return badPos(Pos(lineNo(line), line.text.length), bad)
+      }
+    }
+
+    var textNode = node.nodeType == 3 ? node : null, topNode = node;
+    if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
+      textNode = node.firstChild;
+      if (offset) { offset = textNode.nodeValue.length; }
+    }
+    while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
+    var measure = lineView.measure, maps = measure.maps;
+
+    function find(textNode, topNode, offset) {
+      for (var i = -1; i < (maps ? maps.length : 0); i++) {
+        var map = i < 0 ? measure.map : maps[i];
+        for (var j = 0; j < map.length; j += 3) {
+          var curNode = map[j + 2];
+          if (curNode == textNode || curNode == topNode) {
+            var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
+            var ch = map[j] + offset;
+            if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }
+            return Pos(line, ch)
+          }
+        }
+      }
+    }
+    var found = find(textNode, topNode, offset);
+    if (found) { return badPos(found, bad) }
+
+    // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
+    for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
+      found = find(after, after.firstChild, 0);
+      if (found)
+        { return badPos(Pos(found.line, found.ch - dist), bad) }
+      else
+        { dist += after.textContent.length; }
+    }
+    for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
+      found = find(before, before.firstChild, -1);
+      if (found)
+        { return badPos(Pos(found.line, found.ch + dist$1), bad) }
+      else
+        { dist$1 += before.textContent.length; }
+    }
+  }
+
+  // TEXTAREA INPUT STYLE
+
+  var TextareaInput = function(cm) {
+    this.cm = cm;
+    // See input.poll and input.reset
+    this.prevInput = "";
+
+    // Flag that indicates whether we expect input to appear real soon
+    // now (after some event like 'keypress' or 'input') and are
+    // polling intensively.
+    this.pollingFast = false;
+    // Self-resetting timeout for the poller
+    this.polling = new Delayed();
+    // Used to work around IE issue with selection being forgotten when focus moves away from textarea
+    this.hasSelection = false;
+    this.composing = null;
+    this.resetting = false;
+  };
+
+  TextareaInput.prototype.init = function (display) {
+      var this$1 = this;
+
+    var input = this, cm = this.cm;
+    this.createField(display);
+    var te = this.textarea;
+
+    display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);
+
+    // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
+    if (ios) { te.style.width = "0px"; }
+
+    on(te, "input", function () {
+      if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
+      input.poll();
+    });
+
+    on(te, "paste", function (e) {
+      if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
+
+      cm.state.pasteIncoming = +new Date;
+      input.fastPoll();
+    });
+
+    function prepareCopyCut(e) {
+      if (signalDOMEvent(cm, e)) { return }
+      if (cm.somethingSelected()) {
+        setLastCopied({lineWise: false, text: cm.getSelections()});
+      } else if (!cm.options.lineWiseCopyCut) {
+        return
+      } else {
+        var ranges = copyableRanges(cm);
+        setLastCopied({lineWise: true, text: ranges.text});
+        if (e.type == "cut") {
+          cm.setSelections(ranges.ranges, null, sel_dontScroll);
+        } else {
+          input.prevInput = "";
+          te.value = ranges.text.join("\n");
+          selectInput(te);
+        }
+      }
+      if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
+    }
+    on(te, "cut", prepareCopyCut);
+    on(te, "copy", prepareCopyCut);
+
+    on(display.scroller, "paste", function (e) {
+      if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
+      if (!te.dispatchEvent) {
+        cm.state.pasteIncoming = +new Date;
+        input.focus();
+        return
+      }
+
+      // Pass the `paste` event to the textarea so it's handled by its event listener.
+      var event = new Event("paste");
+      event.clipboardData = e.clipboardData;
+      te.dispatchEvent(event);
+    });
+
+    // Prevent normal selection in the editor (we handle our own)
+    on(display.lineSpace, "selectstart", function (e) {
+      if (!eventInWidget(display, e)) { e_preventDefault(e); }
+    });
+
+    on(te, "compositionstart", function () {
+      var start = cm.getCursor("from");
+      if (input.composing) { input.composing.range.clear(); }
+      input.composing = {
+        start: start,
+        range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
+      };
+    });
+    on(te, "compositionend", function () {
+      if (input.composing) {
+        input.poll();
+        input.composing.range.clear();
+        input.composing = null;
+      }
+    });
+  };
+
+  TextareaInput.prototype.createField = function (_display) {
+    // Wraps and hides input textarea
+    this.wrapper = hiddenTextarea();
+    // The semihidden textarea that is focused when the editor is
+    // focused, and receives input.
+    this.textarea = this.wrapper.firstChild;
+    var opts = this.cm.options;
+    disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize);
+  };
+
+  TextareaInput.prototype.screenReaderLabelChanged = function (label) {
+    // Label for screenreaders, accessibility
+    if(label) {
+      this.textarea.setAttribute('aria-label', label);
+    } else {
+      this.textarea.removeAttribute('aria-label');
+    }
+  };
+
+  TextareaInput.prototype.prepareSelection = function () {
+    // Redraw the selection and/or cursor
+    var cm = this.cm, display = cm.display, doc = cm.doc;
+    var result = prepareSelection(cm);
+
+    // Move the hidden textarea near the cursor to prevent scrolling artifacts
+    if (cm.options.moveInputWithCursor) {
+      var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
+      var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
+      result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
+                                          headPos.top + lineOff.top - wrapOff.top));
+      result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
+                                           headPos.left + lineOff.left - wrapOff.left));
+    }
+
+    return result
+  };
+
+  TextareaInput.prototype.showSelection = function (drawn) {
+    var cm = this.cm, display = cm.display;
+    removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
+    removeChildrenAndAdd(display.selectionDiv, drawn.selection);
+    if (drawn.teTop != null) {
+      this.wrapper.style.top = drawn.teTop + "px";
+      this.wrapper.style.left = drawn.teLeft + "px";
+    }
+  };
+
+  // Reset the input to correspond to the selection (or to be empty,
+  // when not typing and nothing is selected)
+  TextareaInput.prototype.reset = function (typing) {
+    if (this.contextMenuPending || this.composing && typing) { return }
+    var cm = this.cm;
+    this.resetting = true;
+    if (cm.somethingSelected()) {
+      this.prevInput = "";
+      var content = cm.getSelection();
+      this.textarea.value = content;
+      if (cm.state.focused) { selectInput(this.textarea); }
+      if (ie && ie_version >= 9) { this.hasSelection = content; }
+    } else if (!typing) {
+      this.prevInput = this.textarea.value = "";
+      if (ie && ie_version >= 9) { this.hasSelection = null; }
+    }
+    this.resetting = false;
+  };
+
+  TextareaInput.prototype.getField = function () { return this.textarea };
+
+  TextareaInput.prototype.supportsTouch = function () { return false };
+
+  TextareaInput.prototype.focus = function () {
+    if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(rootNode(this.textarea)) != this.textarea)) {
+      try { this.textarea.focus(); }
+      catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
+    }
+  };
+
+  TextareaInput.prototype.blur = function () { this.textarea.blur(); };
+
+  TextareaInput.prototype.resetPosition = function () {
+    this.wrapper.style.top = this.wrapper.style.left = 0;
+  };
+
+  TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
+
+  // Poll for input changes, using the normal rate of polling. This
+  // runs as long as the editor is focused.
+  TextareaInput.prototype.slowPoll = function () {
+      var this$1 = this;
+
+    if (this.pollingFast) { return }
+    this.polling.set(this.cm.options.pollInterval, function () {
+      this$1.poll();
+      if (this$1.cm.state.focused) { this$1.slowPoll(); }
+    });
+  };
+
+  // When an event has just come in that is likely to add or change
+  // something in the input textarea, we poll faster, to ensure that
+  // the change appears on the screen quickly.
+  TextareaInput.prototype.fastPoll = function () {
+    var missed = false, input = this;
+    input.pollingFast = true;
+    function p() {
+      var changed = input.poll();
+      if (!changed && !missed) {missed = true; input.polling.set(60, p);}
+      else {input.pollingFast = false; input.slowPoll();}
+    }
+    input.polling.set(20, p);
+  };
+
+  // Read input from the textarea, and update the document to match.
+  // When something is selected, it is present in the textarea, and
+  // selected (unless it is huge, in which case a placeholder is
+  // used). When nothing is selected, the cursor sits after previously
+  // seen text (can be empty), which is stored in prevInput (we must
+  // not reset the textarea when typing, because that breaks IME).
+  TextareaInput.prototype.poll = function () {
+      var this$1 = this;
+
+    var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
+    // Since this is called a *lot*, try to bail out as cheaply as
+    // possible when it is clear that nothing happened. hasSelection
+    // will be the case when there is a lot of text in the textarea,
+    // in which case reading its value would be expensive.
+    if (this.contextMenuPending || this.resetting || !cm.state.focused ||
+        (hasSelection(input) && !prevInput && !this.composing) ||
+        cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
+      { return false }
+
+    var text = input.value;
+    // If nothing changed, bail.
+    if (text == prevInput && !cm.somethingSelected()) { return false }
+    // Work around nonsensical selection resetting in IE9/10, and
+    // inexplicable appearance of private area unicode characters on
+    // some key combos in Mac (#2689).
+    if (ie && ie_version >= 9 && this.hasSelection === text ||
+        mac && /[\uf700-\uf7ff]/.test(text)) {
+      cm.display.input.reset();
+      return false
+    }
+
+    if (cm.doc.sel == cm.display.selForContextMenu) {
+      var first = text.charCodeAt(0);
+      if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
+      if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
+    }
+    // Find the part of the input that is actually new
+    var same = 0, l = Math.min(prevInput.length, text.length);
+    while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
+
+    runInOp(cm, function () {
+      applyTextInput(cm, text.slice(same), prevInput.length - same,
+                     null, this$1.composing ? "*compose" : null);
+
+      // Don't leave long text in the textarea, since it makes further polling slow
+      if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
+      else { this$1.prevInput = text; }
+
+      if (this$1.composing) {
+        this$1.composing.range.clear();
+        this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
+                                           {className: "CodeMirror-composing"});
+      }
+    });
+    return true
+  };
+
+  TextareaInput.prototype.ensurePolled = function () {
+    if (this.pollingFast && this.poll()) { this.pollingFast = false; }
+  };
+
+  TextareaInput.prototype.onKeyPress = function () {
+    if (ie && ie_version >= 9) { this.hasSelection = null; }
+    this.fastPoll();
+  };
+
+  TextareaInput.prototype.onContextMenu = function (e) {
+    var input = this, cm = input.cm, display = cm.display, te = input.textarea;
+    if (input.contextMenuPending) { input.contextMenuPending(); }
+    var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
+    if (!pos || presto) { return } // Opera is difficult.
+
+    // Reset the current text selection only if the click is done outside of the selection
+    // and 'resetSelectionOnContextMenu' option is true.
+    var reset = cm.options.resetSelectionOnContextMenu;
+    if (reset && cm.doc.sel.contains(pos) == -1)
+      { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
+
+    var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
+    var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();
+    input.wrapper.style.cssText = "position: static";
+    te.style.cssText = "position: absolute; width: 30px; height: 30px;\n      top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n      z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
+    var oldScrollY;
+    if (webkit) { oldScrollY = te.ownerDocument.defaultView.scrollY; } // Work around Chrome issue (#2712)
+    display.input.focus();
+    if (webkit) { te.ownerDocument.defaultView.scrollTo(null, oldScrollY); }
+    display.input.reset();
+    // Adds "Select all" to context menu in FF
+    if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
+    input.contextMenuPending = rehide;
+    display.selForContextMenu = cm.doc.sel;
+    clearTimeout(display.detectingSelectAll);
+
+    // Select-all will be greyed out if there's nothing to select, so
+    // this adds a zero-width space so that we can later check whether
+    // it got selected.
+    function prepareSelectAllHack() {
+      if (te.selectionStart != null) {
+        var selected = cm.somethingSelected();
+        var extval = "\u200b" + (selected ? te.value : "");
+        te.value = "\u21da"; // Used to catch context-menu undo
+        te.value = extval;
+        input.prevInput = selected ? "" : "\u200b";
+        te.selectionStart = 1; te.selectionEnd = extval.length;
+        // Re-set this, in case some other handler touched the
+        // selection in the meantime.
+        display.selForContextMenu = cm.doc.sel;
+      }
+    }
+    function rehide() {
+      if (input.contextMenuPending != rehide) { return }
+      input.contextMenuPending = false;
+      input.wrapper.style.cssText = oldWrapperCSS;
+      te.style.cssText = oldCSS;
+      if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
+
+      // Try to detect the user choosing select-all
+      if (te.selectionStart != null) {
+        if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
+        var i = 0, poll = function () {
+          if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
+              te.selectionEnd > 0 && input.prevInput == "\u200b") {
+            operation(cm, selectAll)(cm);
+          } else if (i++ < 10) {
+            display.detectingSelectAll = setTimeout(poll, 500);
+          } else {
+            display.selForContextMenu = null;
+            display.input.reset();
+          }
+        };
+        display.detectingSelectAll = setTimeout(poll, 200);
+      }
+    }
+
+    if (ie && ie_version >= 9) { prepareSelectAllHack(); }
+    if (captureRightClick) {
+      e_stop(e);
+      var mouseup = function () {
+        off(window, "mouseup", mouseup);
+        setTimeout(rehide, 20);
+      };
+      on(window, "mouseup", mouseup);
+    } else {
+      setTimeout(rehide, 50);
+    }
+  };
+
+  TextareaInput.prototype.readOnlyChanged = function (val) {
+    if (!val) { this.reset(); }
+    this.textarea.disabled = val == "nocursor";
+    this.textarea.readOnly = !!val;
+  };
+
+  TextareaInput.prototype.setUneditable = function () {};
+
+  TextareaInput.prototype.needsContentAttribute = false;
+
+  function fromTextArea(textarea, options) {
+    options = options ? copyObj(options) : {};
+    options.value = textarea.value;
+    if (!options.tabindex && textarea.tabIndex)
+      { options.tabindex = textarea.tabIndex; }
+    if (!options.placeholder && textarea.placeholder)
+      { options.placeholder = textarea.placeholder; }
+    // Set autofocus to true if this textarea is focused, or if it has
+    // autofocus and no other element is focused.
+    if (options.autofocus == null) {
+      var hasFocus = activeElt(rootNode(textarea));
+      options.autofocus = hasFocus == textarea ||
+        textarea.getAttribute("autofocus") != null && hasFocus == document.body;
+    }
+
+    function save() {textarea.value = cm.getValue();}
+
+    var realSubmit;
+    if (textarea.form) {
+      on(textarea.form, "submit", save);
+      // Deplorable hack to make the submit method do the right thing.
+      if (!options.leaveSubmitMethodAlone) {
+        var form = textarea.form;
+        realSubmit = form.submit;
+        try {
+          var wrappedSubmit = form.submit = function () {
+            save();
+            form.submit = realSubmit;
+            form.submit();
+            form.submit = wrappedSubmit;
+          };
+        } catch(e) {}
+      }
+    }
+
+    options.finishInit = function (cm) {
+      cm.save = save;
+      cm.getTextArea = function () { return textarea; };
+      cm.toTextArea = function () {
+        cm.toTextArea = isNaN; // Prevent this from being ran twice
+        save();
+        textarea.parentNode.removeChild(cm.getWrapperElement());
+        textarea.style.display = "";
+        if (textarea.form) {
+          off(textarea.form, "submit", save);
+          if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
+            { textarea.form.submit = realSubmit; }
+        }
+      };
+    };
+
+    textarea.style.display = "none";
+    var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
+      options);
+    return cm
+  }
+
+  function addLegacyProps(CodeMirror) {
+    CodeMirror.off = off;
+    CodeMirror.on = on;
+    CodeMirror.wheelEventPixels = wheelEventPixels;
+    CodeMirror.Doc = Doc;
+    CodeMirror.splitLines = splitLinesAuto;
+    CodeMirror.countColumn = countColumn;
+    CodeMirror.findColumn = findColumn;
+    CodeMirror.isWordChar = isWordCharBasic;
+    CodeMirror.Pass = Pass;
+    CodeMirror.signal = signal;
+    CodeMirror.Line = Line;
+    CodeMirror.changeEnd = changeEnd;
+    CodeMirror.scrollbarModel = scrollbarModel;
+    CodeMirror.Pos = Pos;
+    CodeMirror.cmpPos = cmp;
+    CodeMirror.modes = modes;
+    CodeMirror.mimeModes = mimeModes;
+    CodeMirror.resolveMode = resolveMode;
+    CodeMirror.getMode = getMode;
+    CodeMirror.modeExtensions = modeExtensions;
+    CodeMirror.extendMode = extendMode;
+    CodeMirror.copyState = copyState;
+    CodeMirror.startState = startState;
+    CodeMirror.innerMode = innerMode;
+    CodeMirror.commands = commands;
+    CodeMirror.keyMap = keyMap;
+    CodeMirror.keyName = keyName;
+    CodeMirror.isModifierKey = isModifierKey;
+    CodeMirror.lookupKey = lookupKey;
+    CodeMirror.normalizeKeyMap = normalizeKeyMap;
+    CodeMirror.StringStream = StringStream;
+    CodeMirror.SharedTextMarker = SharedTextMarker;
+    CodeMirror.TextMarker = TextMarker;
+    CodeMirror.LineWidget = LineWidget;
+    CodeMirror.e_preventDefault = e_preventDefault;
+    CodeMirror.e_stopPropagation = e_stopPropagation;
+    CodeMirror.e_stop = e_stop;
+    CodeMirror.addClass = addClass;
+    CodeMirror.contains = contains;
+    CodeMirror.rmClass = rmClass;
+    CodeMirror.keyNames = keyNames;
+  }
+
+  // EDITOR CONSTRUCTOR
+
+  defineOptions(CodeMirror);
+
+  addEditorMethods(CodeMirror);
+
+  // Set up methods on CodeMirror's prototype to redirect to the editor's document.
+  var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
+  for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
+    { CodeMirror.prototype[prop] = (function(method) {
+      return function() {return method.apply(this.doc, arguments)}
+    })(Doc.prototype[prop]); } }
+
+  eventMixin(Doc);
+  CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
+
+  // Extra arguments are stored as the mode's dependencies, which is
+  // used by (legacy) mechanisms like loadmode.js to automatically
+  // load a mode. (Preferred mechanism is the require/define calls.)
+  CodeMirror.defineMode = function(name/*, mode, …*/) {
+    if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
+    defineMode.apply(this, arguments);
+  };
+
+  CodeMirror.defineMIME = defineMIME;
+
+  // Minimal default mode.
+  CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
+  CodeMirror.defineMIME("text/plain", "null");
+
+  // EXTENSIONS
+
+  CodeMirror.defineExtension = function (name, func) {
+    CodeMirror.prototype[name] = func;
+  };
+  CodeMirror.defineDocExtension = function (name, func) {
+    Doc.prototype[name] = func;
+  };
+
+  CodeMirror.fromTextArea = fromTextArea;
+
+  addLegacyProps(CodeMirror);
+
+  CodeMirror.version = "5.65.18";
+
+  return CodeMirror;
+
+})));
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/apl/apl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,174 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("apl", function() {
+  var builtInOps = {
+    ".": "innerProduct",
+    "\\": "scan",
+    "/": "reduce",
+    "⌿": "reduce1Axis",
+    "⍀": "scan1Axis",
+    "¨": "each",
+    "⍣": "power"
+  };
+  var builtInFuncs = {
+    "+": ["conjugate", "add"],
+    "−": ["negate", "subtract"],
+    "×": ["signOf", "multiply"],
+    "÷": ["reciprocal", "divide"],
+    "⌈": ["ceiling", "greaterOf"],
+    "⌊": ["floor", "lesserOf"],
+    "∣": ["absolute", "residue"],
+    "⍳": ["indexGenerate", "indexOf"],
+    "?": ["roll", "deal"],
+    "⋆": ["exponentiate", "toThePowerOf"],
+    "⍟": ["naturalLog", "logToTheBase"],
+    "○": ["piTimes", "circularFuncs"],
+    "!": ["factorial", "binomial"],
+    "⌹": ["matrixInverse", "matrixDivide"],
+    "<": [null, "lessThan"],
+    "≤": [null, "lessThanOrEqual"],
+    "=": [null, "equals"],
+    ">": [null, "greaterThan"],
+    "≥": [null, "greaterThanOrEqual"],
+    "≠": [null, "notEqual"],
+    "≡": ["depth", "match"],
+    "≢": [null, "notMatch"],
+    "∈": ["enlist", "membership"],
+    "⍷": [null, "find"],
+    "∪": ["unique", "union"],
+    "∩": [null, "intersection"],
+    "∼": ["not", "without"],
+    "∨": [null, "or"],
+    "∧": [null, "and"],
+    "⍱": [null, "nor"],
+    "⍲": [null, "nand"],
+    "⍴": ["shapeOf", "reshape"],
+    ",": ["ravel", "catenate"],
+    "⍪": [null, "firstAxisCatenate"],
+    "⌽": ["reverse", "rotate"],
+    "⊖": ["axis1Reverse", "axis1Rotate"],
+    "⍉": ["transpose", null],
+    "↑": ["first", "take"],
+    "↓": [null, "drop"],
+    "⊂": ["enclose", "partitionWithAxis"],
+    "⊃": ["diclose", "pick"],
+    "⌷": [null, "index"],
+    "⍋": ["gradeUp", null],
+    "⍒": ["gradeDown", null],
+    "⊤": ["encode", null],
+    "⊥": ["decode", null],
+    "⍕": ["format", "formatByExample"],
+    "⍎": ["execute", null],
+    "⊣": ["stop", "left"],
+    "⊢": ["pass", "right"]
+  };
+
+  var isOperator = /[\.\/⌿⍀¨⍣]/;
+  var isNiladic = /⍬/;
+  var isFunction = /[\+−×÷⌈⌊∣⍳\?⋆⍟○!⌹<≤=>≥≠≡≢∈⍷∪∩∼∨∧⍱⍲⍴,⍪⌽⊖⍉↑↓⊂⊃⌷⍋⍒⊤⊥⍕⍎⊣⊢]/;
+  var isArrow = /←/;
+  var isComment = /[⍝#].*$/;
+
+  var stringEater = function(type) {
+    var prev;
+    prev = false;
+    return function(c) {
+      prev = c;
+      if (c === type) {
+        return prev === "\\";
+      }
+      return true;
+    };
+  };
+  return {
+    startState: function() {
+      return {
+        prev: false,
+        func: false,
+        op: false,
+        string: false,
+        escape: false
+      };
+    },
+    token: function(stream, state) {
+      var ch, funcName;
+      if (stream.eatSpace()) {
+        return null;
+      }
+      ch = stream.next();
+      if (ch === '"' || ch === "'") {
+        stream.eatWhile(stringEater(ch));
+        stream.next();
+        state.prev = true;
+        return "string";
+      }
+      if (/[\[{\(]/.test(ch)) {
+        state.prev = false;
+        return null;
+      }
+      if (/[\]}\)]/.test(ch)) {
+        state.prev = true;
+        return null;
+      }
+      if (isNiladic.test(ch)) {
+        state.prev = false;
+        return "niladic";
+      }
+      if (/[¯\d]/.test(ch)) {
+        if (state.func) {
+          state.func = false;
+          state.prev = false;
+        } else {
+          state.prev = true;
+        }
+        stream.eatWhile(/[\w\.]/);
+        return "number";
+      }
+      if (isOperator.test(ch)) {
+        return "operator apl-" + builtInOps[ch];
+      }
+      if (isArrow.test(ch)) {
+        return "apl-arrow";
+      }
+      if (isFunction.test(ch)) {
+        funcName = "apl-";
+        if (builtInFuncs[ch] != null) {
+          if (state.prev) {
+            funcName += builtInFuncs[ch][1];
+          } else {
+            funcName += builtInFuncs[ch][0];
+          }
+        }
+        state.func = true;
+        state.prev = false;
+        return "function " + funcName;
+      }
+      if (isComment.test(ch)) {
+        stream.skipToEnd();
+        return "comment";
+      }
+      if (ch === "∘" && stream.peek() === ".") {
+        stream.next();
+        return "function jot-dot";
+      }
+      stream.eatWhile(/[\w\$_]/);
+      state.prev = true;
+      return "keyword";
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/apl", "apl");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/apl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+<!doctype html>
+
+<title>CodeMirror: APL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="./apl.js"></script>
+<style>
+	.CodeMirror { border: 2px inset #dee; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">APL</a>
+  </ul>
+</div>
+
+<article>
+<h2>APL mode</h2>
+<form><textarea id="code" name="code">
+⍝ Conway's game of life
+
+⍝ This example was inspired by the impressive demo at
+⍝ http://www.youtube.com/watch?v=a9xAKttWgP4
+
+⍝ Create a matrix:
+⍝     0 1 1
+⍝     1 1 0
+⍝     0 1 0
+creature ← (3 3 ⍴ ⍳ 9) ∈ 1 2 3 4 7   ⍝ Original creature from demo
+creature ← (3 3 ⍴ ⍳ 9) ∈ 1 3 6 7 8   ⍝ Glider
+
+⍝ Place the creature on a larger board, near the centre
+board ← ¯1 ⊖ ¯2 ⌽ 5 7 ↑ creature
+
+⍝ A function to move from one generation to the next
+life ← {∨/ 1 ⍵ ∧ 3 4 = ⊂+/ +⌿ 1 0 ¯1 ∘.⊖ 1 0 ¯1 ⌽¨ ⊂⍵}
+
+⍝ Compute n-th generation and format it as a
+⍝ character matrix
+gen ← {' #'[(life ⍣ ⍵) board]}
+
+⍝ Show first three generations
+(gen 1) (gen 2) (gen 3)
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/apl"
+      });
+    </script>
+
+    <p>Simple mode that tries to handle APL as well as it can.</p>
+    <p>It attempts to label functions/operators based upon
+    monadic/dyadic usage (but this is far from fully fleshed out).
+    This means there are meaningful classnames so hover states can
+    have popups etc.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/apl</code> (APL code)</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/asciiarmor/asciiarmor.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,74 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  function errorIfNotEmpty(stream) {
+    var nonWS = stream.match(/^\s*\S/);
+    stream.skipToEnd();
+    return nonWS ? "error" : null;
+  }
+
+  CodeMirror.defineMode("asciiarmor", function() {
+    return {
+      token: function(stream, state) {
+        var m;
+        if (state.state == "top") {
+          if (stream.sol() && (m = stream.match(/^-----BEGIN (.*)?-----\s*$/))) {
+            state.state = "headers";
+            state.type = m[1];
+            return "tag";
+          }
+          return errorIfNotEmpty(stream);
+        } else if (state.state == "headers") {
+          if (stream.sol() && stream.match(/^\w+:/)) {
+            state.state = "header";
+            return "atom";
+          } else {
+            var result = errorIfNotEmpty(stream);
+            if (result) state.state = "body";
+            return result;
+          }
+        } else if (state.state == "header") {
+          stream.skipToEnd();
+          state.state = "headers";
+          return "string";
+        } else if (state.state == "body") {
+          if (stream.sol() && (m = stream.match(/^-----END (.*)?-----\s*$/))) {
+            if (m[1] != state.type) return "error";
+            state.state = "end";
+            return "tag";
+          } else {
+            if (stream.eatWhile(/[A-Za-z0-9+\/=]/)) {
+              return null;
+            } else {
+              stream.next();
+              return "error";
+            }
+          }
+        } else if (state.state == "end") {
+          return errorIfNotEmpty(stream);
+        }
+      },
+      blankLine: function(state) {
+        if (state.state == "headers") state.state = "body";
+      },
+      startState: function() {
+        return {state: "top", type: null};
+      }
+    };
+  });
+
+  CodeMirror.defineMIME("application/pgp", "asciiarmor");
+  CodeMirror.defineMIME("application/pgp-encrypted", "asciiarmor");
+  CodeMirror.defineMIME("application/pgp-keys", "asciiarmor");
+  CodeMirror.defineMIME("application/pgp-signature", "asciiarmor");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/asciiarmor/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,46 @@
+<!doctype html>
+
+<title>CodeMirror: ASCII Armor (PGP) mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="asciiarmor.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">ASCII Armor</a>
+  </ul>
+</div>
+
+<article>
+<h2>ASCII Armor (PGP) mode</h2>
+<form><textarea id="code" name="code">
+-----BEGIN PGP MESSAGE-----
+Version: OpenPrivacy 0.99
+
+yDgBO22WxBHv7O8X7O/jygAEzol56iUKiXmV+XmpCtmpqQUKiQrFqclFqUDBovzS
+vBSFjNSiVHsuAA==
+=njUN
+-----END PGP MESSAGE-----
+</textarea></form>
+
+<script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true
+});
+</script>
+
+<p><strong>MIME types
+defined:</strong> <code>application/pgp</code>, <code>application/pgp-encrypted</code>, <code>application/pgp-keys</code>, <code>application/pgp-signature</code></p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/asn.1/asn.1.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,204 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("asn.1", function(config, parserConfig) {
+    var indentUnit = config.indentUnit,
+        keywords = parserConfig.keywords || {},
+        cmipVerbs = parserConfig.cmipVerbs || {},
+        compareTypes = parserConfig.compareTypes || {},
+        status = parserConfig.status || {},
+        tags = parserConfig.tags || {},
+        storage = parserConfig.storage || {},
+        modifier = parserConfig.modifier || {},
+        accessTypes = parserConfig.accessTypes|| {},
+        multiLineStrings = parserConfig.multiLineStrings,
+        indentStatements = parserConfig.indentStatements !== false;
+    var isOperatorChar = /[\|\^]/;
+    var curPunc;
+
+    function tokenBase(stream, state) {
+      var ch = stream.next();
+      if (ch == '"' || ch == "'") {
+        state.tokenize = tokenString(ch);
+        return state.tokenize(stream, state);
+      }
+      if (/[\[\]\(\){}:=,;]/.test(ch)) {
+        curPunc = ch;
+        return "punctuation";
+      }
+      if (ch == "-"){
+        if (stream.eat("-")) {
+          stream.skipToEnd();
+          return "comment";
+        }
+      }
+      if (/\d/.test(ch)) {
+        stream.eatWhile(/[\w\.]/);
+        return "number";
+      }
+      if (isOperatorChar.test(ch)) {
+        stream.eatWhile(isOperatorChar);
+        return "operator";
+      }
+
+      stream.eatWhile(/[\w\-]/);
+      var cur = stream.current();
+      if (keywords.propertyIsEnumerable(cur)) return "keyword";
+      if (cmipVerbs.propertyIsEnumerable(cur)) return "variable cmipVerbs";
+      if (compareTypes.propertyIsEnumerable(cur)) return "atom compareTypes";
+      if (status.propertyIsEnumerable(cur)) return "comment status";
+      if (tags.propertyIsEnumerable(cur)) return "variable-3 tags";
+      if (storage.propertyIsEnumerable(cur)) return "builtin storage";
+      if (modifier.propertyIsEnumerable(cur)) return "string-2 modifier";
+      if (accessTypes.propertyIsEnumerable(cur)) return "atom accessTypes";
+
+      return "variable";
+    }
+
+    function tokenString(quote) {
+      return function(stream, state) {
+        var escaped = false, next, end = false;
+        while ((next = stream.next()) != null) {
+          if (next == quote && !escaped){
+            var afterNext = stream.peek();
+            //look if the character if the quote is like the B in '10100010'B
+            if (afterNext){
+              afterNext = afterNext.toLowerCase();
+              if(afterNext == "b" || afterNext == "h" || afterNext == "o")
+                stream.next();
+            }
+            end = true; break;
+          }
+          escaped = !escaped && next == "\\";
+        }
+        if (end || !(escaped || multiLineStrings))
+          state.tokenize = null;
+        return "string";
+      };
+    }
+
+    function Context(indented, column, type, align, prev) {
+      this.indented = indented;
+      this.column = column;
+      this.type = type;
+      this.align = align;
+      this.prev = prev;
+    }
+    function pushContext(state, col, type) {
+      var indent = state.indented;
+      if (state.context && state.context.type == "statement")
+        indent = state.context.indented;
+      return state.context = new Context(indent, col, type, null, state.context);
+    }
+    function popContext(state) {
+      var t = state.context.type;
+      if (t == ")" || t == "]" || t == "}")
+        state.indented = state.context.indented;
+      return state.context = state.context.prev;
+    }
+
+    //Interface
+    return {
+      startState: function(basecolumn) {
+        return {
+          tokenize: null,
+          context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+          indented: 0,
+          startOfLine: true
+        };
+      },
+
+      token: function(stream, state) {
+        var ctx = state.context;
+        if (stream.sol()) {
+          if (ctx.align == null) ctx.align = false;
+          state.indented = stream.indentation();
+          state.startOfLine = true;
+        }
+        if (stream.eatSpace()) return null;
+        curPunc = null;
+        var style = (state.tokenize || tokenBase)(stream, state);
+        if (style == "comment") return style;
+        if (ctx.align == null) ctx.align = true;
+
+        if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
+            && ctx.type == "statement"){
+          popContext(state);
+        }
+        else if (curPunc == "{") pushContext(state, stream.column(), "}");
+        else if (curPunc == "[") pushContext(state, stream.column(), "]");
+        else if (curPunc == "(") pushContext(state, stream.column(), ")");
+        else if (curPunc == "}") {
+          while (ctx.type == "statement") ctx = popContext(state);
+          if (ctx.type == "}") ctx = popContext(state);
+          while (ctx.type == "statement") ctx = popContext(state);
+        }
+        else if (curPunc == ctx.type) popContext(state);
+        else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
+            && curPunc != ';') || (ctx.type == "statement"
+            && curPunc == "newstatement")))
+          pushContext(state, stream.column(), "statement");
+
+        state.startOfLine = false;
+        return style;
+      },
+
+      electricChars: "{}",
+      lineComment: "--",
+      fold: "brace"
+    };
+  });
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  CodeMirror.defineMIME("text/x-ttcn-asn", {
+    name: "asn.1",
+    keywords: words("DEFINITIONS OBJECTS IF DERIVED INFORMATION ACTION" +
+    " REPLY ANY NAMED CHARACTERIZED BEHAVIOUR REGISTERED" +
+    " WITH AS IDENTIFIED CONSTRAINED BY PRESENT BEGIN" +
+    " IMPORTS FROM UNITS SYNTAX MIN-ACCESS MAX-ACCESS" +
+    " MINACCESS MAXACCESS REVISION STATUS DESCRIPTION" +
+    " SEQUENCE SET COMPONENTS OF CHOICE DistinguishedName" +
+    " ENUMERATED SIZE MODULE END INDEX AUGMENTS EXTENSIBILITY" +
+    " IMPLIED EXPORTS"),
+    cmipVerbs: words("ACTIONS ADD GET NOTIFICATIONS REPLACE REMOVE"),
+    compareTypes: words("OPTIONAL DEFAULT MANAGED MODULE-TYPE MODULE_IDENTITY" +
+    " MODULE-COMPLIANCE OBJECT-TYPE OBJECT-IDENTITY" +
+    " OBJECT-COMPLIANCE MODE CONFIRMED CONDITIONAL" +
+    " SUBORDINATE SUPERIOR CLASS TRUE FALSE NULL" +
+    " TEXTUAL-CONVENTION"),
+    status: words("current deprecated mandatory obsolete"),
+    tags: words("APPLICATION AUTOMATIC EXPLICIT IMPLICIT PRIVATE TAGS" +
+    " UNIVERSAL"),
+    storage: words("BOOLEAN INTEGER OBJECT IDENTIFIER BIT OCTET STRING" +
+    " UTCTime InterfaceIndex IANAifType CMIP-Attribute" +
+    " REAL PACKAGE PACKAGES IpAddress PhysAddress" +
+    " NetworkAddress BITS BMPString TimeStamp TimeTicks" +
+    " TruthValue RowStatus DisplayString GeneralString" +
+    " GraphicString IA5String NumericString" +
+    " PrintableString SnmpAdminString TeletexString" +
+    " UTF8String VideotexString VisibleString StringStore" +
+    " ISO646String T61String UniversalString Unsigned32" +
+    " Integer32 Gauge Gauge32 Counter Counter32 Counter64"),
+    modifier: words("ATTRIBUTE ATTRIBUTES MANDATORY-GROUP MANDATORY-GROUPS" +
+    " GROUP GROUPS ELEMENTS EQUALITY ORDERING SUBSTRINGS" +
+    " DEFINED"),
+    accessTypes: words("not-accessible accessible-for-notify read-only" +
+    " read-create read-write"),
+    multiLineStrings: true
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/asn.1/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,78 @@
+<!doctype html>
+
+<title>CodeMirror: ASN.1 mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="asn.1.js"></script>
+<style>
+    .CodeMirror {
+        border-top: 1px solid black;
+        border-bottom: 1px solid black;
+    }
+</style>
+<div id=nav>
+    <a href="https://codemirror.net/5"><h1>CodeMirror</h1>
+        <img id=logo src="../../doc/logo.png" alt="">
+    </a>
+
+    <ul>
+        <li><a href="../../index.html">Home</a>
+        <li><a href="../../doc/manual.html">Manual</a>
+        <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+    </ul>
+    <ul>
+        <li><a href="../index.html">Language modes</a>
+        <li><a class=active href="http://en.wikipedia.org/wiki/Abstract_Syntax_Notation_One">ASN.1</a>
+    </ul>
+</div>
+<article>
+    <h2>ASN.1 example</h2>
+    <div>
+        <textarea id="ttcn-asn-code">
+ --
+ -- Sample ASN.1 Code
+ --
+ MyModule DEFINITIONS ::=
+ BEGIN
+
+ MyTypes ::= SEQUENCE {
+     myObjectId   OBJECT IDENTIFIER,
+     mySeqOf      SEQUENCE OF MyInt,
+     myBitString  BIT STRING {
+                         muxToken(0),
+                         modemToken(1)
+                  }
+ }
+
+ MyInt ::= INTEGER (0..65535)
+
+ END
+        </textarea>
+    </div>
+
+    <script>
+        var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-asn-code"), {
+            lineNumbers: true,
+            matchBrackets: true,
+            mode: "text/x-ttcn-asn"
+        });
+        ttcnEditor.setSize(400, 400);
+        var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+        CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+    </script>
+    <br/>
+    <p><strong>Language:</strong> Abstract Syntax Notation One
+        (<a href="http://www.itu.int/en/ITU-T/asn1/Pages/introduction.aspx">ASN.1</a>)
+    </p>
+    <p><strong>MIME types defined:</strong> <code>text/x-ttcn-asn</code></p>
+
+    <br/>
+    <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
+    </a>.</p>
+    <p>Coded by Asmelash Tsegay Gebretsadkan </p>
+</article>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/asterisk/asterisk.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,220 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+ * =====================================================================================
+ *
+ *       Filename:  mode/asterisk/asterisk.js
+ *
+ *    Description:  CodeMirror mode for Asterisk dialplan
+ *
+ *        Created:  05/17/2012 09:20:25 PM
+ *       Revision:  08/05/2019 AstLinux Project: Support block-comments
+ *
+ *         Author:  Stas Kobzar (stas@modulis.ca),
+ *        Company:  Modulis.ca Inc.
+ *
+ * =====================================================================================
+ */
+
+(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.defineMode("asterisk", function() {
+  var atoms    = ["exten", "same", "include","ignorepat","switch"],
+      dpcmd    = ["#include","#exec"],
+      apps     = [
+                  "addqueuemember","adsiprog","aelsub","agentlogin","agentmonitoroutgoing","agi",
+                  "alarmreceiver","amd","answer","authenticate","background","backgrounddetect",
+                  "bridge","busy","callcompletioncancel","callcompletionrequest","celgenuserevent",
+                  "changemonitor","chanisavail","channelredirect","chanspy","clearhash","confbridge",
+                  "congestion","continuewhile","controlplayback","dahdiacceptr2call","dahdibarge",
+                  "dahdiras","dahdiscan","dahdisendcallreroutingfacility","dahdisendkeypadfacility",
+                  "datetime","dbdel","dbdeltree","deadagi","dial","dictate","directory","disa",
+                  "dumpchan","eagi","echo","endwhile","exec","execif","execiftime","exitwhile","extenspy",
+                  "externalivr","festival","flash","followme","forkcdr","getcpeid","gosub","gosubif",
+                  "goto","gotoif","gotoiftime","hangup","iax2provision","ices","importvar","incomplete",
+                  "ivrdemo","jabberjoin","jabberleave","jabbersend","jabbersendgroup","jabberstatus",
+                  "jack","log","macro","macroexclusive","macroexit","macroif","mailboxexists","meetme",
+                  "meetmeadmin","meetmechanneladmin","meetmecount","milliwatt","minivmaccmess","minivmdelete",
+                  "minivmgreet","minivmmwi","minivmnotify","minivmrecord","mixmonitor","monitor","morsecode",
+                  "mp3player","mset","musiconhold","nbscat","nocdr","noop","odbc","odbc","odbcfinish",
+                  "originate","ospauth","ospfinish","osplookup","ospnext","page","park","parkandannounce",
+                  "parkedcall","pausemonitor","pausequeuemember","pickup","pickupchan","playback","playtones",
+                  "privacymanager","proceeding","progress","queue","queuelog","raiseexception","read","readexten",
+                  "readfile","receivefax","receivefax","receivefax","record","removequeuemember",
+                  "resetcdr","retrydial","return","ringing","sayalpha","saycountedadj","saycountednoun",
+                  "saycountpl","saydigits","saynumber","sayphonetic","sayunixtime","senddtmf","sendfax",
+                  "sendfax","sendfax","sendimage","sendtext","sendurl","set","setamaflags",
+                  "setcallerpres","setmusiconhold","sipaddheader","sipdtmfmode","sipremoveheader","skel",
+                  "slastation","slatrunk","sms","softhangup","speechactivategrammar","speechbackground",
+                  "speechcreate","speechdeactivategrammar","speechdestroy","speechloadgrammar","speechprocessingsound",
+                  "speechstart","speechunloadgrammar","stackpop","startmusiconhold","stopmixmonitor","stopmonitor",
+                  "stopmusiconhold","stopplaytones","system","testclient","testserver","transfer","tryexec",
+                  "trysystem","unpausemonitor","unpausequeuemember","userevent","verbose","vmauthenticate",
+                  "vmsayname","voicemail","voicemailmain","wait","waitexten","waitfornoise","waitforring",
+                  "waitforsilence","waitmusiconhold","waituntil","while","zapateller"
+                 ];
+
+  function basicToken(stream,state){
+    var cur = '';
+    var ch = stream.next();
+    // comment
+    if (state.blockComment) {
+      if (ch == "-" && stream.match("-;", true)) {
+        state.blockComment = false;
+      } else if (stream.skipTo("--;")) {
+        stream.next();
+        stream.next();
+        stream.next();
+        state.blockComment = false;
+      } else {
+        stream.skipToEnd();
+      }
+      return "comment";
+    }
+    if(ch == ";") {
+      if (stream.match("--", true)) {
+        if (!stream.match("-", false)) {  // Except ;--- is not a block comment
+          state.blockComment = true;
+          return "comment";
+        }
+      }
+      stream.skipToEnd();
+      return "comment";
+    }
+    // context
+    if(ch == '[') {
+      stream.skipTo(']');
+      stream.eat(']');
+      return "header";
+    }
+    // string
+    if(ch == '"') {
+      stream.skipTo('"');
+      return "string";
+    }
+    if(ch == "'") {
+      stream.skipTo("'");
+      return "string-2";
+    }
+    // dialplan commands
+    if(ch == '#') {
+      stream.eatWhile(/\w/);
+      cur = stream.current();
+      if(dpcmd.indexOf(cur) !== -1) {
+        stream.skipToEnd();
+        return "strong";
+      }
+    }
+    // application args
+    if(ch == '$'){
+      var ch1 = stream.peek();
+      if(ch1 == '{'){
+        stream.skipTo('}');
+        stream.eat('}');
+        return "variable-3";
+      }
+    }
+    // extension
+    stream.eatWhile(/\w/);
+    cur = stream.current();
+    if(atoms.indexOf(cur) !== -1) {
+      state.extenStart = true;
+      switch(cur) {
+        case 'same': state.extenSame = true; break;
+        case 'include':
+        case 'switch':
+        case 'ignorepat':
+          state.extenInclude = true;break;
+        default:break;
+      }
+      return "atom";
+    }
+  }
+
+  return {
+    startState: function() {
+      return {
+        blockComment: false,
+        extenStart: false,
+        extenSame:  false,
+        extenInclude: false,
+        extenExten: false,
+        extenPriority: false,
+        extenApplication: false
+      };
+    },
+    token: function(stream, state) {
+
+      var cur = '';
+      if(stream.eatSpace()) return null;
+      // extension started
+      if(state.extenStart){
+        stream.eatWhile(/[^\s]/);
+        cur = stream.current();
+        if(/^=>?$/.test(cur)){
+          state.extenExten = true;
+          state.extenStart = false;
+          return "strong";
+        } else {
+          state.extenStart = false;
+          stream.skipToEnd();
+          return "error";
+        }
+      } else if(state.extenExten) {
+        // set exten and priority
+        state.extenExten = false;
+        state.extenPriority = true;
+        stream.eatWhile(/[^,]/);
+        if(state.extenInclude) {
+          stream.skipToEnd();
+          state.extenPriority = false;
+          state.extenInclude = false;
+        }
+        if(state.extenSame) {
+          state.extenPriority = false;
+          state.extenSame = false;
+          state.extenApplication = true;
+        }
+        return "tag";
+      } else if(state.extenPriority) {
+        state.extenPriority = false;
+        state.extenApplication = true;
+        stream.next(); // get comma
+        if(state.extenSame) return null;
+        stream.eatWhile(/[^,]/);
+        return "number";
+      } else if(state.extenApplication) {
+        stream.eatWhile(/,/);
+        cur = stream.current();
+        if(cur === ',') return null;
+        stream.eatWhile(/\w/);
+        cur = stream.current().toLowerCase();
+        state.extenApplication = false;
+        if(apps.indexOf(cur) !== -1){
+          return "def strong";
+        }
+      } else{
+        return basicToken(stream,state);
+      }
+
+      return null;
+    },
+
+    blockCommentStart: ";--",
+    blockCommentEnd: "--;",
+    lineComment: ";"
+  };
+});
+
+CodeMirror.defineMIME("text/x-asterisk", "asterisk");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/asterisk/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,155 @@
+<!doctype html>
+
+<title>CodeMirror: Asterisk dialplan mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="asterisk.js"></script>
+<style>
+      .CodeMirror {border: 1px solid #999;}
+      .cm-s-default span.cm-arrow { color: red; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Asterisk dialplan</a>
+  </ul>
+</div>
+
+<article>
+<h2>Asterisk dialplan mode</h2>
+<form><textarea id="code" name="code">
+; extensions.conf - the Asterisk dial plan
+;
+
+[general]
+;
+; If static is set to no, or omitted, then the pbx_config will rewrite
+; this file when extensions are modified.  Remember that all comments
+; made in the file will be lost when that happens.
+static=yes
+
+#include "/etc/asterisk/additional_general.conf
+
+[iaxprovider]
+switch => IAX2/user:[key]@myserver/mycontext
+
+[dynamic]
+#exec /usr/bin/dynamic-peers.pl
+
+[trunkint]
+;
+; International long distance through trunk
+;
+exten => _9011.,1,Macro(dundi-e164,${EXTEN:4})
+exten => _9011.,n,Dial(${GLOBAL(TRUNK)}/${FILTER(0-9,${EXTEN:${GLOBAL(TRUNKMSD)}})})
+
+[local]
+;
+; Master context for local, toll-free, and iaxtel calls only
+;
+ignorepat => 9
+include => default
+
+[demo]
+include => stdexten
+;
+; We start with what to do when a call first comes in.
+;
+exten => s,1,Wait(1)			; Wait a second, just for fun
+same  => n,Answer			; Answer the line
+same  => n,Set(TIMEOUT(digit)=5)	; Set Digit Timeout to 5 seconds
+same  => n,Set(TIMEOUT(response)=10)	; Set Response Timeout to 10 seconds
+same  => n(restart),BackGround(demo-congrats)	; Play a congratulatory message
+same  => n(instruct),BackGround(demo-instruct)	; Play some instructions
+same  => n,WaitExten			; Wait for an extension to be dialed.
+
+exten => 2,1,BackGround(demo-moreinfo)	; Give some more information.
+exten => 2,n,Goto(s,instruct)
+
+exten => 3,1,Set(LANGUAGE()=fr)		; Set language to french
+exten => 3,n,Goto(s,restart)		; Start with the congratulations
+
+exten => 1000,1,Goto(default,s,1)
+;
+; We also create an example user, 1234, who is on the console and has
+; voicemail, etc.
+;
+exten => 1234,1,Playback(transfer,skip)		; "Please hold while..."
+					; (but skip if channel is not up)
+exten => 1234,n,Gosub(${EXTEN},stdexten(${GLOBAL(CONSOLE)}))
+exten => 1234,n,Goto(default,s,1)		; exited Voicemail
+
+exten => 1235,1,Voicemail(1234,u)		; Right to voicemail
+
+exten => 1236,1,Dial(Console/dsp)		; Ring forever
+exten => 1236,n,Voicemail(1234,b)		; Unless busy
+
+;
+; # for when they're done with the demo
+;
+exten => #,1,Playback(demo-thanks)	; "Thanks for trying the demo"
+exten => #,n,Hangup			; Hang them up.
+
+;
+; A timeout and "invalid extension rule"
+;
+exten => t,1,Goto(#,1)			; If they take too long, give up
+exten => i,1,Playback(invalid)		; "That's not valid, try again"
+
+;
+; Create an extension, 500, for dialing the
+; Asterisk demo.
+;
+exten => 500,1,Playback(demo-abouttotry); Let them know what's going on
+exten => 500,n,Dial(IAX2/guest@pbx.digium.com/s@default)	; Call the Asterisk demo
+exten => 500,n,Playback(demo-nogo)	; Couldn't connect to the demo site
+exten => 500,n,Goto(s,6)		; Return to the start over message.
+
+;
+; Create an extension, 600, for evaluating echo latency.
+;
+exten => 600,1,Playback(demo-echotest)	; Let them know what's going on
+exten => 600,n,Echo			; Do the echo test
+exten => 600,n,Playback(demo-echodone)	; Let them know it's over
+exten => 600,n,Goto(s,6)		; Start over
+
+;
+;	You can use the Macro Page to intercom a individual user
+exten => 76245,1,Macro(page,SIP/Grandstream1)
+; or if your peernames are the same as extensions
+exten => _7XXX,1,Macro(page,SIP/${EXTEN})
+;
+;
+; System Wide Page at extension 7999
+;
+exten => 7999,1,Set(TIMEOUT(absolute)=60)
+exten => 7999,2,Page(Local/Grandstream1@page&Local/Xlite1@page&Local/1234@page/n,d)
+
+; Give voicemail at extension 8500
+;
+exten => 8500,1,VoicemailMain
+exten => 8500,n,Goto(s,6)
+
+    </textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/x-asterisk",
+        matchBrackets: true,
+        lineNumbers: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-asterisk</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/brainfuck/brainfuck.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Brainfuck mode created by Michael Kaminsky https://github.com/mkaminsky11
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object")
+    mod(require("../../lib/codemirror"))
+  else if (typeof define == "function" && define.amd)
+    define(["../../lib/codemirror"], mod)
+  else
+    mod(CodeMirror)
+})(function(CodeMirror) {
+  "use strict"
+  var reserve = "><+-.,[]".split("");
+  /*
+  comments can be either:
+  placed behind lines
+
+        +++    this is a comment
+
+  where reserved characters cannot be used
+  or in a loop
+  [
+    this is ok to use [ ] and stuff
+  ]
+  or preceded by #
+  */
+  CodeMirror.defineMode("brainfuck", function() {
+    return {
+      startState: function() {
+        return {
+          commentLine: false,
+          left: 0,
+          right: 0,
+          commentLoop: false
+        }
+      },
+      token: function(stream, state) {
+        if (stream.eatSpace()) return null
+        if(stream.sol()){
+          state.commentLine = false;
+        }
+        var ch = stream.next().toString();
+        if(reserve.indexOf(ch) !== -1){
+          if(state.commentLine === true){
+            if(stream.eol()){
+              state.commentLine = false;
+            }
+            return "comment";
+          }
+          if(ch === "]" || ch === "["){
+            if(ch === "["){
+              state.left++;
+            }
+            else{
+              state.right++;
+            }
+            return "bracket";
+          }
+          else if(ch === "+" || ch === "-"){
+            return "keyword";
+          }
+          else if(ch === "<" || ch === ">"){
+            return "atom";
+          }
+          else if(ch === "." || ch === ","){
+            return "def";
+          }
+        }
+        else{
+          state.commentLine = true;
+          if(stream.eol()){
+            state.commentLine = false;
+          }
+          return "comment";
+        }
+        if(stream.eol()){
+          state.commentLine = false;
+        }
+      }
+    };
+  });
+CodeMirror.defineMIME("text/x-brainfuck","brainfuck")
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/brainfuck/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: Brainfuck mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="./brainfuck.js"></script>
+<style>
+	.CodeMirror { border: 2px inset #dee; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#"></a>
+  </ul>
+</div>
+
+<article>
+<h2>Brainfuck mode</h2>
+<form><textarea id="code" name="code">
+[ This program prints "Hello World!" and a newline to the screen, its
+  length is 106 active command characters [it is not the shortest.]
+
+  This loop is a "comment loop", it's a simple way of adding a comment
+  to a BF program such that you don't have to worry about any command
+  characters. Any ".", ",", "+", "-", "&lt;" and "&gt;" characters are simply
+  ignored, the "[" and "]" characters just have to be balanced.
+]
++++++ +++               Set Cell #0 to 8
+[
+    &gt;++++               Add 4 to Cell #1; this will always set Cell #1 to 4
+    [                   as the cell will be cleared by the loop
+        &gt;++             Add 2 to Cell #2
+        &gt;+++            Add 3 to Cell #3
+        &gt;+++            Add 3 to Cell #4
+        &gt;+              Add 1 to Cell #5
+        &lt;&lt;&lt;&lt;-           Decrement the loop counter in Cell #1
+    ]                   Loop till Cell #1 is zero; number of iterations is 4
+    &gt;+                  Add 1 to Cell #2
+    &gt;+                  Add 1 to Cell #3
+    &gt;-                  Subtract 1 from Cell #4
+    &gt;&gt;+                 Add 1 to Cell #6
+    [&lt;]                 Move back to the first zero cell you find; this will
+                        be Cell #1 which was cleared by the previous loop
+    &lt;-                  Decrement the loop Counter in Cell #0
+]                       Loop till Cell #0 is zero; number of iterations is 8
+
+The result of this is:
+Cell No :   0   1   2   3   4   5   6
+Contents:   0   0  72 104  88  32   8
+Pointer :   ^
+
+&gt;&gt;.                     Cell #2 has value 72 which is 'H'
+&gt;---.                   Subtract 3 from Cell #3 to get 101 which is 'e'
++++++++..+++.           Likewise for 'llo' from Cell #3
+&gt;&gt;.                     Cell #5 is 32 for the space
+&lt;-.                     Subtract 1 from Cell #4 for 87 to give a 'W'
+&lt;.                      Cell #3 was set to 'o' from the end of 'Hello'
++++.------.--------.    Cell #3 for 'rl' and 'd'
+&gt;&gt;+.                    Add 1 to Cell #5 gives us an exclamation point
+&gt;++.                    And finally a newline from Cell #6
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-brainfuck"
+      });
+    </script>
+
+    <p>A mode for Brainfuck</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-brainfuck</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clike/clike.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,942 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+function Context(indented, column, type, info, align, prev) {
+  this.indented = indented;
+  this.column = column;
+  this.type = type;
+  this.info = info;
+  this.align = align;
+  this.prev = prev;
+}
+function pushContext(state, col, type, info) {
+  var indent = state.indented;
+  if (state.context && state.context.type == "statement" && type != "statement")
+    indent = state.context.indented;
+  return state.context = new Context(indent, col, type, info, null, state.context);
+}
+function popContext(state) {
+  var t = state.context.type;
+  if (t == ")" || t == "]" || t == "}")
+    state.indented = state.context.indented;
+  return state.context = state.context.prev;
+}
+
+function typeBefore(stream, state, pos) {
+  if (state.prevToken == "variable" || state.prevToken == "type") return true;
+  if (/\S(?:[^- ]>|[*\]])\s*$|\*$/.test(stream.string.slice(0, pos))) return true;
+  if (state.typeAtEndOfLine && stream.column() == stream.indentation()) return true;
+}
+
+function isTopScope(context) {
+  for (;;) {
+    if (!context || context.type == "top") return true;
+    if (context.type == "}" && context.prev.info != "namespace") return false;
+    context = context.prev;
+  }
+}
+
+CodeMirror.defineMode("clike", function(config, parserConfig) {
+  var indentUnit = config.indentUnit,
+      statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
+      dontAlignCalls = parserConfig.dontAlignCalls,
+      keywords = parserConfig.keywords || {},
+      types = parserConfig.types || {},
+      builtin = parserConfig.builtin || {},
+      blockKeywords = parserConfig.blockKeywords || {},
+      defKeywords = parserConfig.defKeywords || {},
+      atoms = parserConfig.atoms || {},
+      hooks = parserConfig.hooks || {},
+      multiLineStrings = parserConfig.multiLineStrings,
+      indentStatements = parserConfig.indentStatements !== false,
+      indentSwitch = parserConfig.indentSwitch !== false,
+      namespaceSeparator = parserConfig.namespaceSeparator,
+      isPunctuationChar = parserConfig.isPunctuationChar || /[\[\]{}\(\),;\:\.]/,
+      numberStart = parserConfig.numberStart || /[\d\.]/,
+      number = parserConfig.number || /^(?:0x[a-f\d]+|0b[01]+|(?:\d+\.?\d*|\.\d+)(?:e[-+]?\d+)?)(u|ll?|l|f)?/i,
+      isOperatorChar = parserConfig.isOperatorChar || /[+\-*&%=<>!?|\/]/,
+      isIdentifierChar = parserConfig.isIdentifierChar || /[\w\$_\xa1-\uffff]/,
+      // An optional function that takes a {string} token and returns true if it
+      // should be treated as a builtin.
+      isReservedIdentifier = parserConfig.isReservedIdentifier || false;
+
+  var curPunc, isDefKeyword;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (hooks[ch]) {
+      var result = hooks[ch](stream, state);
+      if (result !== false) return result;
+    }
+    if (ch == '"' || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (numberStart.test(ch)) {
+      stream.backUp(1)
+      if (stream.match(number)) return "number"
+      stream.next()
+    }
+    if (isPunctuationChar.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    if (ch == "/") {
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      while (!stream.match(/^\/[\/*]/, false) && stream.eat(isOperatorChar)) {}
+      return "operator";
+    }
+    stream.eatWhile(isIdentifierChar);
+    if (namespaceSeparator) while (stream.match(namespaceSeparator))
+      stream.eatWhile(isIdentifierChar);
+
+    var cur = stream.current();
+    if (contains(keywords, cur)) {
+      if (contains(blockKeywords, cur)) curPunc = "newstatement";
+      if (contains(defKeywords, cur)) isDefKeyword = true;
+      return "keyword";
+    }
+    if (contains(types, cur)) return "type";
+    if (contains(builtin, cur)
+        || (isReservedIdentifier && isReservedIdentifier(cur))) {
+      if (contains(blockKeywords, cur)) curPunc = "newstatement";
+      return "builtin";
+    }
+    if (contains(atoms, cur)) return "atom";
+    return "variable";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !(escaped || multiLineStrings))
+        state.tokenize = null;
+      return "string";
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = null;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function maybeEOL(stream, state) {
+    if (parserConfig.typeFirstDefinitions && stream.eol() && isTopScope(state.context))
+      state.typeAtEndOfLine = typeBefore(stream, state, stream.pos)
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", null, false),
+        indented: 0,
+        startOfLine: true,
+        prevToken: null
+      };
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+      }
+      if (stream.eatSpace()) { maybeEOL(stream, state); return null; }
+      curPunc = isDefKeyword = null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta") return style;
+      if (ctx.align == null) ctx.align = true;
+
+      if (curPunc == ";" || curPunc == ":" || (curPunc == "," && stream.match(/^\s*(?:\/\/.*)?$/, false)))
+        while (state.context.type == "statement") popContext(state);
+      else if (curPunc == "{") pushContext(state, stream.column(), "}");
+      else if (curPunc == "[") pushContext(state, stream.column(), "]");
+      else if (curPunc == "(") pushContext(state, stream.column(), ")");
+      else if (curPunc == "}") {
+        while (ctx.type == "statement") ctx = popContext(state);
+        if (ctx.type == "}") ctx = popContext(state);
+        while (ctx.type == "statement") ctx = popContext(state);
+      }
+      else if (curPunc == ctx.type) popContext(state);
+      else if (indentStatements &&
+               (((ctx.type == "}" || ctx.type == "top") && curPunc != ";") ||
+                (ctx.type == "statement" && curPunc == "newstatement"))) {
+        pushContext(state, stream.column(), "statement", stream.current());
+      }
+
+      if (style == "variable" &&
+          ((state.prevToken == "def" ||
+            (parserConfig.typeFirstDefinitions && typeBefore(stream, state, stream.start) &&
+             isTopScope(state.context) && stream.match(/^\s*\(/, false)))))
+        style = "def";
+
+      if (hooks.token) {
+        var result = hooks.token(stream, state, style);
+        if (result !== undefined) style = result;
+      }
+
+      if (style == "def" && parserConfig.styleDefs === false) style = "variable";
+
+      state.startOfLine = false;
+      state.prevToken = isDefKeyword ? "def" : style || curPunc;
+      maybeEOL(stream, state);
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null || state.typeAtEndOfLine && isTopScope(state.context))
+        return CodeMirror.Pass;
+      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+      var closing = firstChar == ctx.type;
+      if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
+      if (parserConfig.dontIndentStatements)
+        while (ctx.type == "statement" && parserConfig.dontIndentStatements.test(ctx.info))
+          ctx = ctx.prev
+      if (hooks.indent) {
+        var hook = hooks.indent(state, ctx, textAfter, indentUnit);
+        if (typeof hook == "number") return hook
+      }
+      var switchBlock = ctx.prev && ctx.prev.info == "switch";
+      if (parserConfig.allmanIndentation && /[{(]/.test(firstChar)) {
+        while (ctx.type != "top" && ctx.type != "}") ctx = ctx.prev
+        return ctx.indented
+      }
+      if (ctx.type == "statement")
+        return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
+      if (ctx.align && (!dontAlignCalls || ctx.type != ")"))
+        return ctx.column + (closing ? 0 : 1);
+      if (ctx.type == ")" && !closing)
+        return ctx.indented + statementIndentUnit;
+
+      return ctx.indented + (closing ? 0 : indentUnit) +
+        (!closing && switchBlock && !/^(?:case|default)\b/.test(textAfter) ? indentUnit : 0);
+    },
+
+    electricInput: indentSwitch ? /^\s*(?:case .*?:|default:|\{\}?|\})$/ : /^\s*[{}]$/,
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    blockCommentContinue: " * ",
+    lineComment: "//",
+    fold: "brace"
+  };
+});
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+  function contains(words, word) {
+    if (typeof words === "function") {
+      return words(word);
+    } else {
+      return words.propertyIsEnumerable(word);
+    }
+  }
+  var cKeywords = "auto if break case register continue return default do sizeof " +
+    "static else struct switch extern typedef union for goto while enum const " +
+    "volatile inline restrict asm fortran";
+
+  // Keywords from https://en.cppreference.com/w/cpp/keyword includes C++20.
+  var cppKeywords = "alignas alignof and and_eq audit axiom bitand bitor catch " +
+  "class compl concept constexpr const_cast decltype delete dynamic_cast " +
+  "explicit export final friend import module mutable namespace new noexcept " +
+  "not not_eq operator or or_eq override private protected public " +
+  "reinterpret_cast requires static_assert static_cast template this " +
+  "thread_local throw try typeid typename using virtual xor xor_eq";
+
+  var objCKeywords = "bycopy byref in inout oneway out self super atomic nonatomic retain copy " +
+  "readwrite readonly strong weak assign typeof nullable nonnull null_resettable _cmd " +
+  "@interface @implementation @end @protocol @encode @property @synthesize @dynamic @class " +
+  "@public @package @private @protected @required @optional @try @catch @finally @import " +
+  "@selector @encode @defs @synchronized @autoreleasepool @compatibility_alias @available";
+
+  var objCBuiltins = "FOUNDATION_EXPORT FOUNDATION_EXTERN NS_INLINE NS_FORMAT_FUNCTION " +
+  " NS_RETURNS_RETAINEDNS_ERROR_ENUM NS_RETURNS_NOT_RETAINED NS_RETURNS_INNER_POINTER " +
+  "NS_DESIGNATED_INITIALIZER NS_ENUM NS_OPTIONS NS_REQUIRES_NIL_TERMINATION " +
+  "NS_ASSUME_NONNULL_BEGIN NS_ASSUME_NONNULL_END NS_SWIFT_NAME NS_REFINED_FOR_SWIFT"
+
+  // Do not use this. Use the cTypes function below. This is global just to avoid
+  // excessive calls when cTypes is being called multiple times during a parse.
+  var basicCTypes = words("int long char short double float unsigned signed " +
+    "void bool");
+
+  // Do not use this. Use the objCTypes function below. This is global just to avoid
+  // excessive calls when objCTypes is being called multiple times during a parse.
+  var basicObjCTypes = words("SEL instancetype id Class Protocol BOOL");
+
+  // Returns true if identifier is a "C" type.
+  // C type is defined as those that are reserved by the compiler (basicTypes),
+  // and those that end in _t (Reserved by POSIX for types)
+  // http://www.gnu.org/software/libc/manual/html_node/Reserved-Names.html
+  function cTypes(identifier) {
+    return contains(basicCTypes, identifier) || /.+_t$/.test(identifier);
+  }
+
+  // Returns true if identifier is a "Objective C" type.
+  function objCTypes(identifier) {
+    return cTypes(identifier) || contains(basicObjCTypes, identifier);
+  }
+
+  var cBlockKeywords = "case do else for if switch while struct enum union";
+  var cDefKeywords = "struct enum union";
+
+  function cppHook(stream, state) {
+    if (!state.startOfLine) return false
+    for (var ch, next = null; ch = stream.peek();) {
+      if (ch == "\\" && stream.match(/^.$/)) {
+        next = cppHook
+        break
+      } else if (ch == "/" && stream.match(/^\/[\/\*]/, false)) {
+        break
+      }
+      stream.next()
+    }
+    state.tokenize = next
+    return "meta"
+  }
+
+  function pointerHook(_stream, state) {
+    if (state.prevToken == "type") return "type";
+    return false;
+  }
+
+  // For C and C++ (and ObjC): identifiers starting with __
+  // or _ followed by a capital letter are reserved for the compiler.
+  function cIsReservedIdentifier(token) {
+    if (!token || token.length < 2) return false;
+    if (token[0] != '_') return false;
+    return (token[1] == '_') || (token[1] !== token[1].toLowerCase());
+  }
+
+  function cpp14Literal(stream) {
+    stream.eatWhile(/[\w\.']/);
+    return "number";
+  }
+
+  function cpp11StringHook(stream, state) {
+    stream.backUp(1);
+    // Raw strings.
+    if (stream.match(/^(?:R|u8R|uR|UR|LR)/)) {
+      var match = stream.match(/^"([^\s\\()]{0,16})\(/);
+      if (!match) {
+        return false;
+      }
+      state.cpp11RawStringDelim = match[1];
+      state.tokenize = tokenRawString;
+      return tokenRawString(stream, state);
+    }
+    // Unicode strings/chars.
+    if (stream.match(/^(?:u8|u|U|L)/)) {
+      if (stream.match(/^["']/, /* eat */ false)) {
+        return "string";
+      }
+      return false;
+    }
+    // Ignore this hook.
+    stream.next();
+    return false;
+  }
+
+  function cppLooksLikeConstructor(word) {
+    var lastTwo = /(\w+)::~?(\w+)$/.exec(word);
+    return lastTwo && lastTwo[1] == lastTwo[2];
+  }
+
+  // C#-style strings where "" escapes a quote.
+  function tokenAtString(stream, state) {
+    var next;
+    while ((next = stream.next()) != null) {
+      if (next == '"' && !stream.eat('"')) {
+        state.tokenize = null;
+        break;
+      }
+    }
+    return "string";
+  }
+
+  // C++11 raw string literal is <prefix>"<delim>( anything )<delim>", where
+  // <delim> can be a string up to 16 characters long.
+  function tokenRawString(stream, state) {
+    // Escape characters that have special regex meanings.
+    var delim = state.cpp11RawStringDelim.replace(/[^\w\s]/g, '\\$&');
+    var match = stream.match(new RegExp(".*?\\)" + delim + '"'));
+    if (match)
+      state.tokenize = null;
+    else
+      stream.skipToEnd();
+    return "string";
+  }
+
+  function def(mimes, mode) {
+    if (typeof mimes == "string") mimes = [mimes];
+    var words = [];
+    function add(obj) {
+      if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
+        words.push(prop);
+    }
+    add(mode.keywords);
+    add(mode.types);
+    add(mode.builtin);
+    add(mode.atoms);
+    if (words.length) {
+      mode.helperType = mimes[0];
+      CodeMirror.registerHelper("hintWords", mimes[0], words);
+    }
+
+    for (var i = 0; i < mimes.length; ++i)
+      CodeMirror.defineMIME(mimes[i], mode);
+  }
+
+  def(["text/x-csrc", "text/x-c", "text/x-chdr"], {
+    name: "clike",
+    keywords: words(cKeywords),
+    types: cTypes,
+    blockKeywords: words(cBlockKeywords),
+    defKeywords: words(cDefKeywords),
+    typeFirstDefinitions: true,
+    atoms: words("NULL true false"),
+    isReservedIdentifier: cIsReservedIdentifier,
+    hooks: {
+      "#": cppHook,
+      "*": pointerHook,
+    },
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  def(["text/x-c++src", "text/x-c++hdr"], {
+    name: "clike",
+    keywords: words(cKeywords + " " + cppKeywords),
+    types: cTypes,
+    blockKeywords: words(cBlockKeywords + " class try catch"),
+    defKeywords: words(cDefKeywords + " class namespace"),
+    typeFirstDefinitions: true,
+    atoms: words("true false NULL nullptr"),
+    dontIndentStatements: /^template$/,
+    isIdentifierChar: /[\w\$_~\xa1-\uffff]/,
+    isReservedIdentifier: cIsReservedIdentifier,
+    hooks: {
+      "#": cppHook,
+      "*": pointerHook,
+      "u": cpp11StringHook,
+      "U": cpp11StringHook,
+      "L": cpp11StringHook,
+      "R": cpp11StringHook,
+      "0": cpp14Literal,
+      "1": cpp14Literal,
+      "2": cpp14Literal,
+      "3": cpp14Literal,
+      "4": cpp14Literal,
+      "5": cpp14Literal,
+      "6": cpp14Literal,
+      "7": cpp14Literal,
+      "8": cpp14Literal,
+      "9": cpp14Literal,
+      token: function(stream, state, style) {
+        if (style == "variable" && stream.peek() == "(" &&
+            (state.prevToken == ";" || state.prevToken == null ||
+             state.prevToken == "}") &&
+            cppLooksLikeConstructor(stream.current()))
+          return "def";
+      }
+    },
+    namespaceSeparator: "::",
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  def("text/x-java", {
+    name: "clike",
+    keywords: words("abstract assert break case catch class const continue default " +
+                    "do else enum extends final finally for goto if implements import " +
+                    "instanceof interface native new package private protected public " +
+                    "return static strictfp super switch synchronized this throw throws transient " +
+                    "try volatile while @interface"),
+    types: words("var byte short int long float double boolean char void Boolean Byte Character Double Float " +
+                 "Integer Long Number Object Short String StringBuffer StringBuilder Void"),
+    blockKeywords: words("catch class do else finally for if switch try while"),
+    defKeywords: words("class interface enum @interface"),
+    typeFirstDefinitions: true,
+    atoms: words("true false null"),
+    number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+\.?\d*|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
+    hooks: {
+      "@": function(stream) {
+        // Don't match the @interface keyword.
+        if (stream.match('interface', false)) return false;
+
+        stream.eatWhile(/[\w\$_]/);
+        return "meta";
+      },
+      '"': function(stream, state) {
+        if (!stream.match(/""$/)) return false;
+        state.tokenize = tokenTripleString;
+        return state.tokenize(stream, state);
+      }
+    },
+    modeProps: {fold: ["brace", "import"]}
+  });
+
+  def("text/x-csharp", {
+    name: "clike",
+    keywords: words("abstract as async await base break case catch checked class const continue" +
+                    " default delegate do else enum event explicit extern finally fixed for" +
+                    " foreach goto if implicit in init interface internal is lock namespace new" +
+                    " operator out override params private protected public readonly record ref required return sealed" +
+                    " sizeof stackalloc static struct switch this throw try typeof unchecked" +
+                    " unsafe using virtual void volatile while add alias ascending descending dynamic from get" +
+                    " global group into join let orderby partial remove select set value var yield"),
+    types: words("Action Boolean Byte Char DateTime DateTimeOffset Decimal Double Func" +
+                 " Guid Int16 Int32 Int64 Object SByte Single String Task TimeSpan UInt16 UInt32" +
+                 " UInt64 bool byte char decimal double short int long object"  +
+                 " sbyte float string ushort uint ulong"),
+    blockKeywords: words("catch class do else finally for foreach if struct switch try while"),
+    defKeywords: words("class interface namespace record struct var"),
+    typeFirstDefinitions: true,
+    atoms: words("true false null"),
+    hooks: {
+      "@": function(stream, state) {
+        if (stream.eat('"')) {
+          state.tokenize = tokenAtString;
+          return tokenAtString(stream, state);
+        }
+        stream.eatWhile(/[\w\$_]/);
+        return "meta";
+      }
+    }
+  });
+
+  function tokenTripleString(stream, state) {
+    var escaped = false;
+    while (!stream.eol()) {
+      if (!escaped && stream.match('"""')) {
+        state.tokenize = null;
+        break;
+      }
+      escaped = stream.next() == "\\" && !escaped;
+    }
+    return "string";
+  }
+
+  function tokenNestedComment(depth) {
+    return function (stream, state) {
+      var ch
+      while (ch = stream.next()) {
+        if (ch == "*" && stream.eat("/")) {
+          if (depth == 1) {
+            state.tokenize = null
+            break
+          } else {
+            state.tokenize = tokenNestedComment(depth - 1)
+            return state.tokenize(stream, state)
+          }
+        } else if (ch == "/" && stream.eat("*")) {
+          state.tokenize = tokenNestedComment(depth + 1)
+          return state.tokenize(stream, state)
+        }
+      }
+      return "comment"
+    }
+  }
+
+  def("text/x-scala", {
+    name: "clike",
+    keywords: words(
+      /* scala */
+      "abstract case catch class def do else extends final finally for forSome if " +
+      "implicit import lazy match new null object override package private protected return " +
+      "sealed super this throw trait try type val var while with yield _ " +
+
+      /* package scala */
+      "assert assume require print println printf readLine readBoolean readByte readShort " +
+      "readChar readInt readLong readFloat readDouble"
+    ),
+    types: words(
+      "AnyVal App Application Array BufferedIterator BigDecimal BigInt Char Console Either " +
+      "Enumeration Equiv Error Exception Fractional Function IndexedSeq Int Integral Iterable " +
+      "Iterator List Map Numeric Nil NotNull Option Ordered Ordering PartialFunction PartialOrdering " +
+      "Product Proxy Range Responder Seq Serializable Set Specializable Stream StringBuilder " +
+      "StringContext Symbol Throwable Traversable TraversableOnce Tuple Unit Vector " +
+
+      /* package java.lang */
+      "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
+      "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
+      "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
+      "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void"
+    ),
+    multiLineStrings: true,
+    blockKeywords: words("catch class enum do else finally for forSome if match switch try while"),
+    defKeywords: words("class enum def object package trait type val var"),
+    atoms: words("true false null"),
+    indentStatements: false,
+    indentSwitch: false,
+    isOperatorChar: /[+\-*&%=<>!?|\/#:@]/,
+    hooks: {
+      "@": function(stream) {
+        stream.eatWhile(/[\w\$_]/);
+        return "meta";
+      },
+      '"': function(stream, state) {
+        if (!stream.match('""')) return false;
+        state.tokenize = tokenTripleString;
+        return state.tokenize(stream, state);
+      },
+      "'": function(stream) {
+        if (stream.match(/^(\\[^'\s]+|[^\\'])'/)) return "string-2"
+        stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+        return "atom";
+      },
+      "=": function(stream, state) {
+        var cx = state.context
+        if (cx.type == "}" && cx.align && stream.eat(">")) {
+          state.context = new Context(cx.indented, cx.column, cx.type, cx.info, null, cx.prev)
+          return "operator"
+        } else {
+          return false
+        }
+      },
+
+      "/": function(stream, state) {
+        if (!stream.eat("*")) return false
+        state.tokenize = tokenNestedComment(1)
+        return state.tokenize(stream, state)
+      }
+    },
+    modeProps: {closeBrackets: {pairs: '()[]{}""', triples: '"'}}
+  });
+
+  function tokenKotlinString(tripleString){
+    return function (stream, state) {
+      var escaped = false, next, end = false;
+      while (!stream.eol()) {
+        if (!tripleString && !escaped && stream.match('"') ) {end = true; break;}
+        if (tripleString && stream.match('"""')) {end = true; break;}
+        next = stream.next();
+        if(!escaped && next == "$" && stream.match('{'))
+          stream.skipTo("}");
+        escaped = !escaped && next == "\\" && !tripleString;
+      }
+      if (end || !tripleString)
+        state.tokenize = null;
+      return "string";
+    }
+  }
+
+  def("text/x-kotlin", {
+    name: "clike",
+    keywords: words(
+      /*keywords*/
+      "package as typealias class interface this super val operator " +
+      "var fun for is in This throw return annotation " +
+      "break continue object if else while do try when !in !is as? " +
+
+      /*soft keywords*/
+      "file import where by get set abstract enum open inner override private public internal " +
+      "protected catch finally out final vararg reified dynamic companion constructor init " +
+      "sealed field property receiver param sparam lateinit data inline noinline tailrec " +
+      "external annotation crossinline const operator infix suspend actual expect setparam value"
+    ),
+    types: words(
+      /* package java.lang */
+      "Boolean Byte Character CharSequence Class ClassLoader Cloneable Comparable " +
+      "Compiler Double Exception Float Integer Long Math Number Object Package Pair Process " +
+      "Runtime Runnable SecurityManager Short StackTraceElement StrictMath String " +
+      "StringBuffer System Thread ThreadGroup ThreadLocal Throwable Triple Void Annotation Any BooleanArray " +
+      "ByteArray Char CharArray DeprecationLevel DoubleArray Enum FloatArray Function Int IntArray Lazy " +
+      "LazyThreadSafetyMode LongArray Nothing ShortArray Unit"
+    ),
+    intendSwitch: false,
+    indentStatements: false,
+    multiLineStrings: true,
+    number: /^(?:0x[a-f\d_]+|0b[01_]+|(?:[\d_]+(\.\d+)?|\.\d+)(?:e[-+]?[\d_]+)?)(u|ll?|l|f)?/i,
+    blockKeywords: words("catch class do else finally for if where try while enum"),
+    defKeywords: words("class val var object interface fun"),
+    atoms: words("true false null this"),
+    hooks: {
+      "@": function(stream) {
+        stream.eatWhile(/[\w\$_]/);
+        return "meta";
+      },
+      '*': function(_stream, state) {
+        return state.prevToken == '.' ? 'variable' : 'operator';
+      },
+      '"': function(stream, state) {
+        state.tokenize = tokenKotlinString(stream.match('""'));
+        return state.tokenize(stream, state);
+      },
+      "/": function(stream, state) {
+        if (!stream.eat("*")) return false;
+        state.tokenize = tokenNestedComment(1);
+        return state.tokenize(stream, state)
+      },
+      indent: function(state, ctx, textAfter, indentUnit) {
+        var firstChar = textAfter && textAfter.charAt(0);
+        if ((state.prevToken == "}" || state.prevToken == ")") && textAfter == "")
+          return state.indented;
+        if ((state.prevToken == "operator" && textAfter != "}" && state.context.type != "}") ||
+          state.prevToken == "variable" && firstChar == "." ||
+          (state.prevToken == "}" || state.prevToken == ")") && firstChar == ".")
+          return indentUnit * 2 + ctx.indented;
+        if (ctx.align && ctx.type == "}")
+          return ctx.indented + (state.context.type == (textAfter || "").charAt(0) ? 0 : indentUnit);
+      }
+    },
+    modeProps: {closeBrackets: {triples: '"'}}
+  });
+
+  def(["x-shader/x-vertex", "x-shader/x-fragment"], {
+    name: "clike",
+    keywords: words("sampler1D sampler2D sampler3D samplerCube " +
+                    "sampler1DShadow sampler2DShadow " +
+                    "const attribute uniform varying " +
+                    "break continue discard return " +
+                    "for while do if else struct " +
+                    "in out inout"),
+    types: words("float int bool void " +
+                 "vec2 vec3 vec4 ivec2 ivec3 ivec4 bvec2 bvec3 bvec4 " +
+                 "mat2 mat3 mat4"),
+    blockKeywords: words("for while do if else struct"),
+    builtin: words("radians degrees sin cos tan asin acos atan " +
+                    "pow exp log exp2 sqrt inversesqrt " +
+                    "abs sign floor ceil fract mod min max clamp mix step smoothstep " +
+                    "length distance dot cross normalize ftransform faceforward " +
+                    "reflect refract matrixCompMult " +
+                    "lessThan lessThanEqual greaterThan greaterThanEqual " +
+                    "equal notEqual any all not " +
+                    "texture1D texture1DProj texture1DLod texture1DProjLod " +
+                    "texture2D texture2DProj texture2DLod texture2DProjLod " +
+                    "texture3D texture3DProj texture3DLod texture3DProjLod " +
+                    "textureCube textureCubeLod " +
+                    "shadow1D shadow2D shadow1DProj shadow2DProj " +
+                    "shadow1DLod shadow2DLod shadow1DProjLod shadow2DProjLod " +
+                    "dFdx dFdy fwidth " +
+                    "noise1 noise2 noise3 noise4"),
+    atoms: words("true false " +
+                "gl_FragColor gl_SecondaryColor gl_Normal gl_Vertex " +
+                "gl_MultiTexCoord0 gl_MultiTexCoord1 gl_MultiTexCoord2 gl_MultiTexCoord3 " +
+                "gl_MultiTexCoord4 gl_MultiTexCoord5 gl_MultiTexCoord6 gl_MultiTexCoord7 " +
+                "gl_FogCoord gl_PointCoord " +
+                "gl_Position gl_PointSize gl_ClipVertex " +
+                "gl_FrontColor gl_BackColor gl_FrontSecondaryColor gl_BackSecondaryColor " +
+                "gl_TexCoord gl_FogFragCoord " +
+                "gl_FragCoord gl_FrontFacing " +
+                "gl_FragData gl_FragDepth " +
+                "gl_ModelViewMatrix gl_ProjectionMatrix gl_ModelViewProjectionMatrix " +
+                "gl_TextureMatrix gl_NormalMatrix gl_ModelViewMatrixInverse " +
+                "gl_ProjectionMatrixInverse gl_ModelViewProjectionMatrixInverse " +
+                "gl_TextureMatrixTranspose gl_ModelViewMatrixInverseTranspose " +
+                "gl_ProjectionMatrixInverseTranspose " +
+                "gl_ModelViewProjectionMatrixInverseTranspose " +
+                "gl_TextureMatrixInverseTranspose " +
+                "gl_NormalScale gl_DepthRange gl_ClipPlane " +
+                "gl_Point gl_FrontMaterial gl_BackMaterial gl_LightSource gl_LightModel " +
+                "gl_FrontLightModelProduct gl_BackLightModelProduct " +
+                "gl_TextureColor gl_EyePlaneS gl_EyePlaneT gl_EyePlaneR gl_EyePlaneQ " +
+                "gl_FogParameters " +
+                "gl_MaxLights gl_MaxClipPlanes gl_MaxTextureUnits gl_MaxTextureCoords " +
+                "gl_MaxVertexAttribs gl_MaxVertexUniformComponents gl_MaxVaryingFloats " +
+                "gl_MaxVertexTextureImageUnits gl_MaxTextureImageUnits " +
+                "gl_MaxFragmentUniformComponents gl_MaxCombineTextureImageUnits " +
+                "gl_MaxDrawBuffers"),
+    indentSwitch: false,
+    hooks: {"#": cppHook},
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  def("text/x-nesc", {
+    name: "clike",
+    keywords: words(cKeywords + " as atomic async call command component components configuration event generic " +
+                    "implementation includes interface module new norace nx_struct nx_union post provides " +
+                    "signal task uses abstract extends"),
+    types: cTypes,
+    blockKeywords: words(cBlockKeywords),
+    atoms: words("null true false"),
+    hooks: {"#": cppHook},
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  def("text/x-objectivec", {
+    name: "clike",
+    keywords: words(cKeywords + " " + objCKeywords),
+    types: objCTypes,
+    builtin: words(objCBuiltins),
+    blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized"),
+    defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class"),
+    dontIndentStatements: /^@.*$/,
+    typeFirstDefinitions: true,
+    atoms: words("YES NO NULL Nil nil true false nullptr"),
+    isReservedIdentifier: cIsReservedIdentifier,
+    hooks: {
+      "#": cppHook,
+      "*": pointerHook,
+    },
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  def("text/x-objectivec++", {
+    name: "clike",
+    keywords: words(cKeywords + " " + objCKeywords + " " + cppKeywords),
+    types: objCTypes,
+    builtin: words(objCBuiltins),
+    blockKeywords: words(cBlockKeywords + " @synthesize @try @catch @finally @autoreleasepool @synchronized class try catch"),
+    defKeywords: words(cDefKeywords + " @interface @implementation @protocol @class class namespace"),
+    dontIndentStatements: /^@.*$|^template$/,
+    typeFirstDefinitions: true,
+    atoms: words("YES NO NULL Nil nil true false nullptr"),
+    isReservedIdentifier: cIsReservedIdentifier,
+    hooks: {
+      "#": cppHook,
+      "*": pointerHook,
+      "u": cpp11StringHook,
+      "U": cpp11StringHook,
+      "L": cpp11StringHook,
+      "R": cpp11StringHook,
+      "0": cpp14Literal,
+      "1": cpp14Literal,
+      "2": cpp14Literal,
+      "3": cpp14Literal,
+      "4": cpp14Literal,
+      "5": cpp14Literal,
+      "6": cpp14Literal,
+      "7": cpp14Literal,
+      "8": cpp14Literal,
+      "9": cpp14Literal,
+      token: function(stream, state, style) {
+        if (style == "variable" && stream.peek() == "(" &&
+            (state.prevToken == ";" || state.prevToken == null ||
+             state.prevToken == "}") &&
+            cppLooksLikeConstructor(stream.current()))
+          return "def";
+      }
+    },
+    namespaceSeparator: "::",
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  def("text/x-squirrel", {
+    name: "clike",
+    keywords: words("base break clone continue const default delete enum extends function in class" +
+                    " foreach local resume return this throw typeof yield constructor instanceof static"),
+    types: cTypes,
+    blockKeywords: words("case catch class else for foreach if switch try while"),
+    defKeywords: words("function local class"),
+    typeFirstDefinitions: true,
+    atoms: words("true false null"),
+    hooks: {"#": cppHook},
+    modeProps: {fold: ["brace", "include"]}
+  });
+
+  // Ceylon Strings need to deal with interpolation
+  var stringTokenizer = null;
+  function tokenCeylonString(type) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while (!stream.eol()) {
+        if (!escaped && stream.match('"') &&
+              (type == "single" || stream.match('""'))) {
+          end = true;
+          break;
+        }
+        if (!escaped && stream.match('``')) {
+          stringTokenizer = tokenCeylonString(type);
+          end = true;
+          break;
+        }
+        next = stream.next();
+        escaped = type == "single" && !escaped && next == "\\";
+      }
+      if (end)
+          state.tokenize = null;
+      return "string";
+    }
+  }
+
+  def("text/x-ceylon", {
+    name: "clike",
+    keywords: words("abstracts alias assembly assert assign break case catch class continue dynamic else" +
+                    " exists extends finally for function given if import in interface is let module new" +
+                    " nonempty object of out outer package return satisfies super switch then this throw" +
+                    " try value void while"),
+    types: function(word) {
+        // In Ceylon all identifiers that start with an uppercase are types
+        var first = word.charAt(0);
+        return (first === first.toUpperCase() && first !== first.toLowerCase());
+    },
+    blockKeywords: words("case catch class dynamic else finally for function if interface module new object switch try while"),
+    defKeywords: words("class dynamic function interface module object package value"),
+    builtin: words("abstract actual aliased annotation by default deprecated doc final formal late license" +
+                   " native optional sealed see serializable shared suppressWarnings tagged throws variable"),
+    isPunctuationChar: /[\[\]{}\(\),;\:\.`]/,
+    isOperatorChar: /[+\-*&%=<>!?|^~:\/]/,
+    numberStart: /[\d#$]/,
+    number: /^(?:#[\da-fA-F_]+|\$[01_]+|[\d_]+[kMGTPmunpf]?|[\d_]+\.[\d_]+(?:[eE][-+]?\d+|[kMGTPmunpf]|)|)/i,
+    multiLineStrings: true,
+    typeFirstDefinitions: true,
+    atoms: words("true false null larger smaller equal empty finished"),
+    indentSwitch: false,
+    styleDefs: false,
+    hooks: {
+      "@": function(stream) {
+        stream.eatWhile(/[\w\$_]/);
+        return "meta";
+      },
+      '"': function(stream, state) {
+          state.tokenize = tokenCeylonString(stream.match('""') ? "triple" : "single");
+          return state.tokenize(stream, state);
+        },
+      '`': function(stream, state) {
+          if (!stringTokenizer || !stream.match('`')) return false;
+          state.tokenize = stringTokenizer;
+          stringTokenizer = null;
+          return state.tokenize(stream, state);
+        },
+      "'": function(stream) {
+        stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+        return "atom";
+      },
+      token: function(_stream, state, style) {
+          if ((style == "variable" || style == "type") &&
+              state.prevToken == ".") {
+            return "variable-2";
+          }
+        }
+    },
+    modeProps: {
+        fold: ["brace", "import"],
+        closeBrackets: {triples: '"'}
+    }
+  });
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clike/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,380 @@
+<!doctype html>
+
+<title>CodeMirror: C-like mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<link rel="stylesheet" href="../../addon/hint/show-hint.css">
+<script src="../../addon/hint/show-hint.js"></script>
+<script src="clike.js"></script>
+<style>.CodeMirror {border: 2px inset #dee;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">C-like</a>
+  </ul>
+</div>
+
+<article>
+<h2>C-like mode</h2>
+
+<div><textarea id="c-code">
+/* C demo code */
+
+#include <zmq.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <time.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <malloc.h>
+
+typedef struct {
+  void* arg_socket;
+  zmq_msg_t* arg_msg;
+  char* arg_string;
+  unsigned long arg_len;
+  int arg_int, arg_command;
+
+  int signal_fd;
+  int pad;
+  void* context;
+  sem_t sem;
+} acl_zmq_context;
+
+#define p(X) (context->arg_##X)
+
+void* zmq_thread(void* context_pointer) {
+  acl_zmq_context* context = (acl_zmq_context*)context_pointer;
+  char ok = 'K', err = 'X';
+  int res;
+
+  while (1) {
+    while ((res = sem_wait(&amp;context->sem)) == EINTR);
+    if (res) {write(context->signal_fd, &amp;err, 1); goto cleanup;}
+    switch(p(command)) {
+    case 0: goto cleanup;
+    case 1: p(socket) = zmq_socket(context->context, p(int)); break;
+    case 2: p(int) = zmq_close(p(socket)); break;
+    case 3: p(int) = zmq_bind(p(socket), p(string)); break;
+    case 4: p(int) = zmq_connect(p(socket), p(string)); break;
+    case 5: p(int) = zmq_getsockopt(p(socket), p(int), (void*)p(string), &amp;p(len)); break;
+    case 6: p(int) = zmq_setsockopt(p(socket), p(int), (void*)p(string), p(len)); break;
+    case 7: p(int) = zmq_send(p(socket), p(msg), p(int)); break;
+    case 8: p(int) = zmq_recv(p(socket), p(msg), p(int)); break;
+    case 9: p(int) = zmq_poll(p(socket), p(int), p(len)); break;
+    }
+    p(command) = errno;
+    write(context->signal_fd, &amp;ok, 1);
+  }
+ cleanup:
+  close(context->signal_fd);
+  free(context_pointer);
+  return 0;
+}
+
+void* zmq_thread_init(void* zmq_context, int signal_fd) {
+  acl_zmq_context* context = malloc(sizeof(acl_zmq_context));
+  pthread_t thread;
+
+  context->context = zmq_context;
+  context->signal_fd = signal_fd;
+  sem_init(&amp;context->sem, 1, 0);
+  pthread_create(&amp;thread, 0, &amp;zmq_thread, context);
+  pthread_detach(thread);
+  return context;
+}
+</textarea></div>
+
+<h2>C++ example</h2>
+
+<div><textarea id="cpp-code">
+#include <iostream>
+#include "mystuff/util.h"
+
+namespace {
+enum Enum {
+  VAL1, VAL2, VAL3
+};
+
+char32_t unicode_string = U"\U0010FFFF";
+string raw_string = R"delim(anything
+you
+want)delim";
+
+int Helper(const MyType& param) {
+  return 0;
+}
+} // namespace
+
+class ForwardDec;
+
+template <class T, class V>
+class Class : public BaseClass {
+  const MyType<T, V> member_;
+
+ public:
+  const MyType<T, V>& Method() const {
+    return member_;
+  }
+
+  void Method2(MyType<T, V>* value);
+}
+
+template <class T, class V>
+void Class::Method2(MyType<T, V>* value) {
+  std::out << 1 >> method();
+  value->Method3(member_);
+  member_ = value;
+}
+</textarea></div>
+
+<h2>Objective-C example</h2>
+
+<div><textarea id="objectivec-code">
+/*
+This is a longer comment
+That spans two lines
+*/
+
+#import "MyClass.h"
+#import <AFramework/AFramework.h>
+@import BFrameworkModule;
+
+NS_ENUM(SomeValues) {
+  aValue = 1;
+};
+
+// A Class Extension with some properties
+@interface MyClass ()<AProtocol>
+@property(atomic, readwrite, assign) NSInteger anInt;
+@property(nonatomic, strong, nullable) NSString *aString;
+@end
+
+@implementation YourAppDelegate
+
+- (instancetype)initWithString:(NSString *)aStringVar {
+  if ((self = [super init])) {
+    aString = aStringVar;
+  }
+  return self;
+}
+
+- (BOOL)doSomething:(float)progress {
+  NSString *myString = @"This is a ObjC string %f ";
+  myString = [[NSString stringWithFormat:myString, progress] stringByAppendingString:self.aString];
+  return myString.length > 100 ? NO : YES;
+}
+
+@end
+</textarea></div>
+
+<h2>Java example</h2>
+
+<div><textarea id="java-code">
+import com.demo.util.MyType;
+import com.demo.util.MyInterface;
+
+public enum Enum {
+  VAL1, VAL2, VAL3
+}
+
+public class Class<T, V> implements MyInterface {
+  public static final MyType<T, V> member;
+  
+  private class InnerClass {
+    public int zero() {
+      return 0;
+    }
+  }
+
+  @Override
+  public MyType method() {
+    return member;
+  }
+
+  public void method2(MyType<T, V> value) {
+    method();
+    value.method3();
+    member = value;
+  }
+}
+</textarea></div>
+
+<h2>Scala example</h2>
+
+<div><textarea id="scala-code">
+object FilterTest extends App {
+  def filter(xs: List[Int], threshold: Int) = {
+    def process(ys: List[Int]): List[Int] =
+      if (ys.isEmpty) ys
+      else if (ys.head < threshold) ys.head :: process(ys.tail)
+      else process(ys.tail)
+    process(xs)
+  }
+  println(filter(List(1, 9, 2, 8, 3, 7, 4), 5))
+}
+</textarea></div>
+
+<h2>Kotlin mode</h2>
+
+<div><textarea id="kotlin-code">
+package org.wasabi.http
+
+import java.util.concurrent.Executors
+import java.net.InetSocketAddress
+import org.wasabi.app.AppConfiguration
+import io.netty.bootstrap.ServerBootstrap
+import io.netty.channel.nio.NioEventLoopGroup
+import io.netty.channel.socket.nio.NioServerSocketChannel
+import org.wasabi.app.AppServer
+
+public class HttpServer(private val appServer: AppServer) {
+
+    val bootstrap: ServerBootstrap
+    val primaryGroup: NioEventLoopGroup
+    val workerGroup:  NioEventLoopGroup
+
+    init {
+        // Define worker groups
+        primaryGroup = NioEventLoopGroup()
+        workerGroup = NioEventLoopGroup()
+
+        // Initialize bootstrap of server
+        bootstrap = ServerBootstrap()
+
+        bootstrap.group(primaryGroup, workerGroup)
+        bootstrap.channel(javaClass<NioServerSocketChannel>())
+        bootstrap.childHandler(NettyPipelineInitializer(appServer))
+    }
+
+    public fun start(wait: Boolean = true) {
+        val channel = bootstrap.bind(appServer.configuration.port)?.sync()?.channel()
+
+        if (wait) {
+            channel?.closeFuture()?.sync()
+        }
+    }
+
+    public fun stop() {
+        // Shutdown all event loops
+        primaryGroup.shutdownGracefully()
+        workerGroup.shutdownGracefully()
+
+        // Wait till all threads are terminated
+        primaryGroup.terminationFuture().sync()
+        workerGroup.terminationFuture().sync()
+    }
+}
+</textarea></div>
+
+<h2>Ceylon mode</h2>
+
+<div><textarea id="ceylon-code">
+"Produces the [[stream|Iterable]] that results from repeated
+ application of the given [[function|next]] to the given
+ [[first]] element of the stream, until the function first
+ returns [[finished]]. If the given function never returns 
+ `finished`, the resulting stream is infinite.
+
+ For example:
+
+     loop(0)(2.plus).takeWhile(10.largerThan)
+
+ produces the stream `{ 0, 2, 4, 6, 8 }`."
+tagged("Streams")
+shared {Element+} loop&lt;Element&gt;(
+        "The first element of the resulting stream."
+        Element first)(
+        "The function that produces the next element of the
+         stream, given the current element. The function may
+         return [[finished]] to indicate the end of the 
+         stream."
+        Element|Finished next(Element element))
+    =&gt; let (start = first)
+    object satisfies {Element+} {
+        first =&gt; start;
+        empty =&gt; false;
+        function nextElement(Element element)
+                =&gt; next(element);
+        iterator()
+                =&gt; object satisfies Iterator&lt;Element&gt; {
+            variable Element|Finished current = start;
+            shared actual Element|Finished next() {
+                if (!is Finished result = current) {
+                    current = nextElement(result);
+                    return result;
+                }
+                else {
+                    return finished;
+                }
+            }
+        };
+    };
+</textarea></div>
+
+    <script>
+      var cEditor = CodeMirror.fromTextArea(document.getElementById("c-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-csrc"
+      });
+      var cppEditor = CodeMirror.fromTextArea(document.getElementById("cpp-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-c++src"
+      });
+      var javaEditor = CodeMirror.fromTextArea(document.getElementById("java-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-java"
+      });
+      var objectivecEditor = CodeMirror.fromTextArea(document.getElementById("objectivec-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-objectivec"
+      });
+      var scalaEditor = CodeMirror.fromTextArea(document.getElementById("scala-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-scala"
+      });
+      var kotlinEditor = CodeMirror.fromTextArea(document.getElementById("kotlin-code"), {
+          lineNumbers: true,
+          matchBrackets: true,
+          mode: "text/x-kotlin"
+      });
+      var ceylonEditor = CodeMirror.fromTextArea(document.getElementById("ceylon-code"), {
+          lineNumbers: true,
+          matchBrackets: true,
+          mode: "text/x-ceylon"
+      });
+      var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+      CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+    </script>
+
+    <p>Simple mode that tries to handle C-like languages as well as it
+    can. Takes two configuration parameters: <code>keywords</code>, an
+    object whose property names are the keywords in the language,
+    and <code>useCPP</code>, which determines whether C preprocessor
+    directives are recognized.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-csrc</code>
+    (C), <code>text/x-c++src</code> (C++), <code>text/x-java</code>
+    (Java), <code>text/x-csharp</code> (C#),
+    <code>text/x-objectivec</code> (Objective-C),
+    <code>text/x-scala</code> (Scala), <code>text/x-vertex</code>
+    <code>x-shader/x-fragment</code> (shader programs),
+    <code>text/x-squirrel</code> (Squirrel) and
+    <code>text/x-ceylon</code> (Ceylon)</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clike/scala.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,767 @@
+<!doctype html>
+
+<title>CodeMirror: Scala mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/ambiance.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="clike.js"></script>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Scala</a>
+  </ul>
+</div>
+
+<article>
+<h2>Scala mode</h2>
+<form>
+<textarea id="code" name="code">
+
+  /*                     __                                               *\
+  **     ________ ___   / /  ___     Scala API                            **
+  **    / __/ __// _ | / /  / _ |    (c) 2003-2011, LAMP/EPFL             **
+  **  __\ \/ /__/ __ |/ /__/ __ |    http://scala-lang.org/               **
+  ** /____/\___/_/ |_/____/_/ | |                                         **
+  **                          |/                                          **
+  \*                                                                      */
+
+  package scala.collection
+
+  import generic._
+  import mutable.{ Builder, ListBuffer }
+  import annotation.{tailrec, migration, bridge}
+  import annotation.unchecked.{ uncheckedVariance => uV }
+  import parallel.ParIterable
+
+  /** A template trait for traversable collections of type `Traversable[A]`.
+   *  
+   *  $traversableInfo
+   *  @define mutability
+   *  @define traversableInfo
+   *  This is a base trait of all kinds of $mutability Scala collections. It
+   *  implements the behavior common to all collections, in terms of a method
+   *  `foreach` with signature:
+   * {{{
+   *     def foreach[U](f: Elem => U): Unit
+   * }}}
+   *  Collection classes mixing in this trait provide a concrete 
+   *  `foreach` method which traverses all the
+   *  elements contained in the collection, applying a given function to each.
+   *  They also need to provide a method `newBuilder`
+   *  which creates a builder for collections of the same kind.
+   *  
+   *  A traversable class might or might not have two properties: strictness
+   *  and orderedness. Neither is represented as a type.
+   *  
+   *  The instances of a strict collection class have all their elements
+   *  computed before they can be used as values. By contrast, instances of
+   *  a non-strict collection class may defer computation of some of their
+   *  elements until after the instance is available as a value.
+   *  A typical example of a non-strict collection class is a
+   *  <a href="../immutable/Stream.html" target="ContentFrame">
+   *  `scala.collection.immutable.Stream`</a>.
+   *  A more general class of examples are `TraversableViews`.
+   *  
+   *  If a collection is an instance of an ordered collection class, traversing
+   *  its elements with `foreach` will always visit elements in the
+   *  same order, even for different runs of the program. If the class is not
+   *  ordered, `foreach` can visit elements in different orders for
+   *  different runs (but it will keep the same order in the same run).'
+   * 
+   *  A typical example of a collection class which is not ordered is a
+   *  `HashMap` of objects. The traversal order for hash maps will
+   *  depend on the hash codes of its elements, and these hash codes might
+   *  differ from one run to the next. By contrast, a `LinkedHashMap`
+   *  is ordered because it's `foreach` method visits elements in the
+   *  order they were inserted into the `HashMap`.
+   *
+   *  @author Martin Odersky
+   *  @version 2.8
+   *  @since   2.8
+   *  @tparam A    the element type of the collection
+   *  @tparam Repr the type of the actual collection containing the elements.
+   *
+   *  @define Coll Traversable
+   *  @define coll traversable collection
+   */
+  trait TraversableLike[+A, +Repr] extends HasNewBuilder[A, Repr] 
+                                      with FilterMonadic[A, Repr]
+                                      with TraversableOnce[A]
+                                      with GenTraversableLike[A, Repr]
+                                      with Parallelizable[A, ParIterable[A]]
+  {
+    self =>
+
+    import Traversable.breaks._
+
+    /** The type implementing this traversable */
+    protected type Self = Repr
+
+    /** The collection of type $coll underlying this `TraversableLike` object.
+     *  By default this is implemented as the `TraversableLike` object itself,
+     *  but this can be overridden.
+     */
+    def repr: Repr = this.asInstanceOf[Repr]
+
+    /** The underlying collection seen as an instance of `$Coll`.
+     *  By default this is implemented as the current collection object itself,
+     *  but this can be overridden.
+     */
+    protected[this] def thisCollection: Traversable[A] = this.asInstanceOf[Traversable[A]]
+
+    /** A conversion from collections of type `Repr` to `$Coll` objects.
+     *  By default this is implemented as just a cast, but this can be overridden.
+     */
+    protected[this] def toCollection(repr: Repr): Traversable[A] = repr.asInstanceOf[Traversable[A]]
+
+    /** Creates a new builder for this collection type.
+     */
+    protected[this] def newBuilder: Builder[A, Repr]
+
+    protected[this] def parCombiner = ParIterable.newCombiner[A]
+
+    /** Applies a function `f` to all elements of this $coll.
+     *  
+     *    Note: this method underlies the implementation of most other bulk operations.
+     *    It's important to implement this method in an efficient way.
+     *  
+     *
+     *  @param  f   the function that is applied for its side-effect to every element.
+     *              The result of function `f` is discarded.
+     *              
+     *  @tparam  U  the type parameter describing the result of function `f`. 
+     *              This result will always be ignored. Typically `U` is `Unit`,
+     *              but this is not necessary.
+     *
+     *  @usecase def foreach(f: A => Unit): Unit
+     */
+    def foreach[U](f: A => U): Unit
+
+    /** Tests whether this $coll is empty.
+     *
+     *  @return    `true` if the $coll contain no elements, `false` otherwise.
+     */
+    def isEmpty: Boolean = {
+      var result = true
+      breakable {
+        for (x <- this) {
+          result = false
+          break
+        }
+      }
+      result
+    }
+
+    /** Tests whether this $coll is known to have a finite size.
+     *  All strict collections are known to have finite size. For a non-strict collection
+     *  such as `Stream`, the predicate returns `true` if all elements have been computed.
+     *  It returns `false` if the stream is not yet evaluated to the end.
+     *
+     *  Note: many collection methods will not work on collections of infinite sizes. 
+     *
+     *  @return  `true` if this collection is known to have finite size, `false` otherwise.
+     */
+    def hasDefiniteSize = true
+
+    def ++[B >: A, That](that: GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.seq.size)
+      b ++= thisCollection
+      b ++= that.seq
+      b.result
+    }
+
+    @bridge
+    def ++[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
+      ++(that: GenTraversableOnce[B])(bf)
+
+    /** Concatenates this $coll with the elements of a traversable collection.
+     *  It differs from ++ in that the right operand determines the type of the
+     *  resulting collection rather than the left one.
+     * 
+     *  @param that   the traversable to append.
+     *  @tparam B     the element type of the returned collection. 
+     *  @tparam That  $thatinfo
+     *  @param bf     $bfinfo
+     *  @return       a new collection of type `That` which contains all elements
+     *                of this $coll followed by all elements of `that`.
+     * 
+     *  @usecase def ++:[B](that: TraversableOnce[B]): $Coll[B]
+     *  
+     *  @return       a new $coll which contains all elements of this $coll
+     *                followed by all elements of `that`.
+     */
+    def ++:[B >: A, That](that: TraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      if (that.isInstanceOf[IndexedSeqLike[_, _]]) b.sizeHint(this, that.size)
+      b ++= that
+      b ++= thisCollection
+      b.result
+    }
+
+    /** This overload exists because: for the implementation of ++: we should reuse
+     *  that of ++ because many collections override it with more efficient versions.
+     *  Since TraversableOnce has no '++' method, we have to implement that directly,
+     *  but Traversable and down can use the overload.
+     */
+    def ++:[B >: A, That](that: Traversable[B])(implicit bf: CanBuildFrom[Repr, B, That]): That =
+      (that ++ seq)(breakOut)
+
+    def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      b.sizeHint(this) 
+      for (x <- this) b += f(x)
+      b.result
+    }
+
+    def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      for (x <- this) b ++= f(x).seq
+      b.result
+    }
+
+    /** Selects all elements of this $coll which satisfy a predicate.
+     *
+     *  @param p     the predicate used to test elements.
+     *  @return      a new $coll consisting of all elements of this $coll that satisfy the given
+     *               predicate `p`. The order of the elements is preserved.
+     */
+    def filter(p: A => Boolean): Repr = {
+      val b = newBuilder
+      for (x <- this) 
+        if (p(x)) b += x
+      b.result
+    }
+
+    /** Selects all elements of this $coll which do not satisfy a predicate.
+     *
+     *  @param p     the predicate used to test elements.
+     *  @return      a new $coll consisting of all elements of this $coll that do not satisfy the given
+     *               predicate `p`. The order of the elements is preserved.
+     */
+    def filterNot(p: A => Boolean): Repr = filter(!p(_))
+
+    def collect[B, That](pf: PartialFunction[A, B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      for (x <- this) if (pf.isDefinedAt(x)) b += pf(x)
+      b.result
+    }
+
+    /** Builds a new collection by applying an option-valued function to all
+     *  elements of this $coll on which the function is defined.
+     *
+     *  @param f      the option-valued function which filters and maps the $coll.
+     *  @tparam B     the element type of the returned collection.
+     *  @tparam That  $thatinfo
+     *  @param bf     $bfinfo
+     *  @return       a new collection of type `That` resulting from applying the option-valued function
+     *                `f` to each element and collecting all defined results.
+     *                The order of the elements is preserved.
+     *
+     *  @usecase def filterMap[B](f: A => Option[B]): $Coll[B]
+     *  
+     *  @param pf     the partial function which filters and maps the $coll.
+     *  @return       a new $coll resulting from applying the given option-valued function
+     *                `f` to each element and collecting all defined results.
+     *                The order of the elements is preserved.
+    def filterMap[B, That](f: A => Option[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      for (x <- this) 
+        f(x) match {
+          case Some(y) => b += y
+          case _ =>
+        }
+      b.result
+    }
+     */
+
+    /** Partitions this $coll in two ${coll}s according to a predicate.
+     *
+     *  @param p the predicate on which to partition.
+     *  @return  a pair of ${coll}s: the first $coll consists of all elements that 
+     *           satisfy the predicate `p` and the second $coll consists of all elements
+     *           that don't. The relative order of the elements in the resulting ${coll}s
+     *           is the same as in the original $coll.
+     */
+    def partition(p: A => Boolean): (Repr, Repr) = {
+      val l, r = newBuilder
+      for (x <- this) (if (p(x)) l else r) += x
+      (l.result, r.result)
+    }
+
+    def groupBy[K](f: A => K): immutable.Map[K, Repr] = {
+      val m = mutable.Map.empty[K, Builder[A, Repr]]
+      for (elem <- this) {
+        val key = f(elem)
+        val bldr = m.getOrElseUpdate(key, newBuilder)
+        bldr += elem
+      }
+      val b = immutable.Map.newBuilder[K, Repr]
+      for ((k, v) <- m)
+        b += ((k, v.result))
+
+      b.result
+    }
+
+    /** Tests whether a predicate holds for all elements of this $coll.
+     *
+     *  $mayNotTerminateInf
+     *
+     *  @param   p     the predicate used to test elements.
+     *  @return        `true` if the given predicate `p` holds for all elements
+     *                 of this $coll, otherwise `false`.
+     */
+    def forall(p: A => Boolean): Boolean = {
+      var result = true
+      breakable {
+        for (x <- this)
+          if (!p(x)) { result = false; break }
+      }
+      result
+    }
+
+    /** Tests whether a predicate holds for some of the elements of this $coll.
+     *
+     *  $mayNotTerminateInf
+     *
+     *  @param   p     the predicate used to test elements.
+     *  @return        `true` if the given predicate `p` holds for some of the
+     *                 elements of this $coll, otherwise `false`.
+     */
+    def exists(p: A => Boolean): Boolean = {
+      var result = false
+      breakable {
+        for (x <- this)
+          if (p(x)) { result = true; break }
+      }
+      result
+    }
+
+    /** Finds the first element of the $coll satisfying a predicate, if any.
+     * 
+     *  $mayNotTerminateInf
+     *  $orderDependent
+     *
+     *  @param p    the predicate used to test elements.
+     *  @return     an option value containing the first element in the $coll
+     *              that satisfies `p`, or `None` if none exists.
+     */
+    def find(p: A => Boolean): Option[A] = {
+      var result: Option[A] = None
+      breakable {
+        for (x <- this)
+          if (p(x)) { result = Some(x); break }
+      }
+      result
+    }
+
+    def scan[B >: A, That](z: B)(op: (B, B) => B)(implicit cbf: CanBuildFrom[Repr, B, That]): That = scanLeft(z)(op)
+
+    def scanLeft[B, That](z: B)(op: (B, A) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      val b = bf(repr)
+      b.sizeHint(this, 1)
+      var acc = z
+      b += acc
+      for (x <- this) { acc = op(acc, x); b += acc }
+      b.result
+    }
+
+    @migration(2, 9,
+      "This scanRight definition has changed in 2.9.\n" +
+      "The previous behavior can be reproduced with scanRight.reverse."
+    )
+    def scanRight[B, That](z: B)(op: (A, B) => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+      var scanned = List(z)
+      var acc = z
+      for (x <- reversed) {
+        acc = op(x, acc)
+        scanned ::= acc
+      }
+      val b = bf(repr)
+      for (elem <- scanned) b += elem
+      b.result
+    }
+
+    /** Selects the first element of this $coll.
+     *  $orderDependent
+     *  @return  the first element of this $coll.
+     *  @throws `NoSuchElementException` if the $coll is empty.
+     */
+    def head: A = {
+      var result: () => A = () => throw new NoSuchElementException
+      breakable {
+        for (x <- this) {
+          result = () => x
+          break
+        }
+      }
+      result()
+    }
+
+    /** Optionally selects the first element.
+     *  $orderDependent
+     *  @return  the first element of this $coll if it is nonempty, `None` if it is empty.
+     */
+    def headOption: Option[A] = if (isEmpty) None else Some(head)
+
+    /** Selects all elements except the first.
+     *  $orderDependent
+     *  @return  a $coll consisting of all elements of this $coll
+     *           except the first one.
+     *  @throws `UnsupportedOperationException` if the $coll is empty.
+     */ 
+    override def tail: Repr = {
+      if (isEmpty) throw new UnsupportedOperationException("empty.tail")
+      drop(1)
+    }
+
+    /** Selects the last element.
+      * $orderDependent
+      * @return The last element of this $coll.
+      * @throws NoSuchElementException If the $coll is empty.
+      */
+    def last: A = {
+      var lst = head
+      for (x <- this)
+        lst = x
+      lst
+    }
+
+    /** Optionally selects the last element.
+     *  $orderDependent
+     *  @return  the last element of this $coll$ if it is nonempty, `None` if it is empty.
+     */
+    def lastOption: Option[A] = if (isEmpty) None else Some(last)
+
+    /** Selects all elements except the last.
+     *  $orderDependent
+     *  @return  a $coll consisting of all elements of this $coll
+     *           except the last one.
+     *  @throws `UnsupportedOperationException` if the $coll is empty.
+     */
+    def init: Repr = {
+      if (isEmpty) throw new UnsupportedOperationException("empty.init")
+      var lst = head
+      var follow = false
+      val b = newBuilder
+      b.sizeHint(this, -1)
+      for (x <- this.seq) {
+        if (follow) b += lst
+        else follow = true
+        lst = x
+      }
+      b.result
+    }
+
+    def take(n: Int): Repr = slice(0, n)
+
+    def drop(n: Int): Repr = 
+      if (n <= 0) {
+        val b = newBuilder
+        b.sizeHint(this)
+        b ++= thisCollection result
+      }
+      else sliceWithKnownDelta(n, Int.MaxValue, -n)
+
+    def slice(from: Int, until: Int): Repr = sliceWithKnownBound(math.max(from, 0), until)
+
+    // Precondition: from >= 0, until > 0, builder already configured for building.
+    private[this] def sliceInternal(from: Int, until: Int, b: Builder[A, Repr]): Repr = {
+      var i = 0
+      breakable {
+        for (x <- this.seq) {
+          if (i >= from) b += x
+          i += 1
+          if (i >= until) break
+        }
+      }
+      b.result
+    }
+    // Precondition: from >= 0
+    private[scala] def sliceWithKnownDelta(from: Int, until: Int, delta: Int): Repr = {
+      val b = newBuilder
+      if (until <= from) b.result
+      else {
+        b.sizeHint(this, delta)
+        sliceInternal(from, until, b)
+      }
+    }
+    // Precondition: from >= 0
+    private[scala] def sliceWithKnownBound(from: Int, until: Int): Repr = {
+      val b = newBuilder
+      if (until <= from) b.result
+      else {
+        b.sizeHintBounded(until - from, this)      
+        sliceInternal(from, until, b)
+      }
+    }
+
+    def takeWhile(p: A => Boolean): Repr = {
+      val b = newBuilder
+      breakable {
+        for (x <- this) {
+          if (!p(x)) break
+          b += x
+        }
+      }
+      b.result
+    }
+
+    def dropWhile(p: A => Boolean): Repr = {
+      val b = newBuilder
+      var go = false
+      for (x <- this) {
+        if (!p(x)) go = true
+        if (go) b += x
+      }
+      b.result
+    }
+
+    def span(p: A => Boolean): (Repr, Repr) = {
+      val l, r = newBuilder
+      var toLeft = true
+      for (x <- this) {
+        toLeft = toLeft && p(x)
+        (if (toLeft) l else r) += x
+      }
+      (l.result, r.result)
+    }
+
+    def splitAt(n: Int): (Repr, Repr) = {
+      val l, r = newBuilder
+      l.sizeHintBounded(n, this)
+      if (n >= 0) r.sizeHint(this, -n)
+      var i = 0
+      for (x <- this) {
+        (if (i < n) l else r) += x
+        i += 1
+      }
+      (l.result, r.result)
+    }
+
+    /** Iterates over the tails of this $coll. The first value will be this
+     *  $coll and the final one will be an empty $coll, with the intervening
+     *  values the results of successive applications of `tail`.
+     *
+     *  @return   an iterator over all the tails of this $coll
+     *  @example  `List(1,2,3).tails = Iterator(List(1,2,3), List(2,3), List(3), Nil)`
+     */  
+    def tails: Iterator[Repr] = iterateUntilEmpty(_.tail)
+
+    /** Iterates over the inits of this $coll. The first value will be this
+     *  $coll and the final one will be an empty $coll, with the intervening
+     *  values the results of successive applications of `init`.
+     *
+     *  @return  an iterator over all the inits of this $coll
+     *  @example  `List(1,2,3).inits = Iterator(List(1,2,3), List(1,2), List(1), Nil)`
+     */
+    def inits: Iterator[Repr] = iterateUntilEmpty(_.init)
+
+    /** Copies elements of this $coll to an array.
+     *  Fills the given array `xs` with at most `len` elements of
+     *  this $coll, starting at position `start`.
+     *  Copying will stop once either the end of the current $coll is reached,
+     *  or the end of the array is reached, or `len` elements have been copied.
+     *
+     *  $willNotTerminateInf
+     * 
+     *  @param  xs     the array to fill.
+     *  @param  start  the starting index.
+     *  @param  len    the maximal number of elements to copy.
+     *  @tparam B      the type of the elements of the array. 
+     * 
+     *
+     *  @usecase def copyToArray(xs: Array[A], start: Int, len: Int): Unit
+     */
+    def copyToArray[B >: A](xs: Array[B], start: Int, len: Int) {
+      var i = start
+      val end = (start + len) min xs.length
+      breakable {
+        for (x <- this) {
+          if (i >= end) break
+          xs(i) = x
+          i += 1
+        }
+      }
+    }
+
+    def toTraversable: Traversable[A] = thisCollection
+    def toIterator: Iterator[A] = toStream.iterator
+    def toStream: Stream[A] = toBuffer.toStream
+
+    /** Converts this $coll to a string.
+     *
+     *  @return   a string representation of this collection. By default this
+     *            string consists of the `stringPrefix` of this $coll,
+     *            followed by all elements separated by commas and enclosed in parentheses.
+     */
+    override def toString = mkString(stringPrefix + "(", ", ", ")")
+
+    /** Defines the prefix of this object's `toString` representation.
+     *
+     *  @return  a string representation which starts the result of `toString`
+     *           applied to this $coll. By default the string prefix is the
+     *           simple name of the collection class $coll.
+     */
+    def stringPrefix : String = {
+      var string = repr.asInstanceOf[AnyRef].getClass.getName
+      val idx1 = string.lastIndexOf('.' : Int)
+      if (idx1 != -1) string = string.substring(idx1 + 1)
+      val idx2 = string.indexOf('$')
+      if (idx2 != -1) string = string.substring(0, idx2)
+      string
+    }
+
+    /** Creates a non-strict view of this $coll.
+     * 
+     *  @return a non-strict view of this $coll.
+     */
+    def view = new TraversableView[A, Repr] {
+      protected lazy val underlying = self.repr
+      override def foreach[U](f: A => U) = self foreach f
+    }
+
+    /** Creates a non-strict view of a slice of this $coll.
+     *
+     *  Note: the difference between `view` and `slice` is that `view` produces
+     *        a view of the current $coll, whereas `slice` produces a new $coll.
+     * 
+     *  Note: `view(from, to)` is equivalent to `view.slice(from, to)`
+     *  $orderDependent
+     * 
+     *  @param from   the index of the first element of the view
+     *  @param until  the index of the element following the view
+     *  @return a non-strict view of a slice of this $coll, starting at index `from`
+     *  and extending up to (but not including) index `until`.
+     */
+    def view(from: Int, until: Int): TraversableView[A, Repr] = view.slice(from, until)
+
+    /** Creates a non-strict filter of this $coll.
+     *
+     *  Note: the difference between `c filter p` and `c withFilter p` is that
+     *        the former creates a new collection, whereas the latter only
+     *        restricts the domain of subsequent `map`, `flatMap`, `foreach`,
+     *        and `withFilter` operations.
+     *  $orderDependent
+     * 
+     *  @param p   the predicate used to test elements.
+     *  @return    an object of class `WithFilter`, which supports
+     *             `map`, `flatMap`, `foreach`, and `withFilter` operations.
+     *             All these operations apply to those elements of this $coll which
+     *             satisfy the predicate `p`.
+     */
+    def withFilter(p: A => Boolean): FilterMonadic[A, Repr] = new WithFilter(p)
+
+    /** A class supporting filtered operations. Instances of this class are
+     *  returned by method `withFilter`.
+     */
+    class WithFilter(p: A => Boolean) extends FilterMonadic[A, Repr] {
+
+      /** Builds a new collection by applying a function to all elements of the
+       *  outer $coll containing this `WithFilter` instance that satisfy predicate `p`.
+       *
+       *  @param f      the function to apply to each element.
+       *  @tparam B     the element type of the returned collection.
+       *  @tparam That  $thatinfo
+       *  @param bf     $bfinfo
+       *  @return       a new collection of type `That` resulting from applying
+       *                the given function `f` to each element of the outer $coll
+       *                that satisfies predicate `p` and collecting the results.
+       *
+       *  @usecase def map[B](f: A => B): $Coll[B] 
+       *  
+       *  @return       a new $coll resulting from applying the given function
+       *                `f` to each element of the outer $coll that satisfies
+       *                predicate `p` and collecting the results.
+       */
+      def map[B, That](f: A => B)(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+        val b = bf(repr)
+        for (x <- self) 
+          if (p(x)) b += f(x)
+        b.result
+      }
+
+      /** Builds a new collection by applying a function to all elements of the
+       *  outer $coll containing this `WithFilter` instance that satisfy
+       *  predicate `p` and concatenating the results. 
+       *
+       *  @param f      the function to apply to each element.
+       *  @tparam B     the element type of the returned collection.
+       *  @tparam That  $thatinfo
+       *  @param bf     $bfinfo
+       *  @return       a new collection of type `That` resulting from applying
+       *                the given collection-valued function `f` to each element
+       *                of the outer $coll that satisfies predicate `p` and
+       *                concatenating the results.
+       *
+       *  @usecase def flatMap[B](f: A => TraversableOnce[B]): $Coll[B]
+       * 
+       *  @return       a new $coll resulting from applying the given collection-valued function
+       *                `f` to each element of the outer $coll that satisfies predicate `p` and concatenating the results.
+       */
+      def flatMap[B, That](f: A => GenTraversableOnce[B])(implicit bf: CanBuildFrom[Repr, B, That]): That = {
+        val b = bf(repr)
+        for (x <- self) 
+          if (p(x)) b ++= f(x).seq
+        b.result
+      }
+
+      /** Applies a function `f` to all elements of the outer $coll containing
+       *  this `WithFilter` instance that satisfy predicate `p`.
+       *
+       *  @param  f   the function that is applied for its side-effect to every element.
+       *              The result of function `f` is discarded.
+       *              
+       *  @tparam  U  the type parameter describing the result of function `f`. 
+       *              This result will always be ignored. Typically `U` is `Unit`,
+       *              but this is not necessary.
+       *
+       *  @usecase def foreach(f: A => Unit): Unit
+       */   
+      def foreach[U](f: A => U): Unit = 
+        for (x <- self) 
+          if (p(x)) f(x)
+
+      /** Further refines the filter for this $coll.
+       *
+       *  @param q   the predicate used to test elements.
+       *  @return    an object of class `WithFilter`, which supports
+       *             `map`, `flatMap`, `foreach`, and `withFilter` operations.
+       *             All these operations apply to those elements of this $coll which
+       *             satisfy the predicate `q` in addition to the predicate `p`.
+       */
+      def withFilter(q: A => Boolean): WithFilter = 
+        new WithFilter(x => p(x) && q(x))
+    }
+
+    // A helper for tails and inits.
+    private def iterateUntilEmpty(f: Traversable[A @uV] => Traversable[A @uV]): Iterator[Repr] = {
+      val it = Iterator.iterate(thisCollection)(f) takeWhile (x => !x.isEmpty)
+      it ++ Iterator(Nil) map (newBuilder ++= _ result)
+    }
+  }
+
+
+</textarea>
+</form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        theme: "ambiance",
+        mode: "text/x-scala"
+      });
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clike/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,170 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-c");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("indent",
+     "[type void] [def foo]([type void*] [variable a], [type int] [variable b]) {",
+     "  [type int] [variable c] [operator =] [variable b] [operator +]",
+     "    [number 1];",
+     "  [keyword return] [operator *][variable a];",
+     "}");
+
+  MT("indent_switch",
+     "[keyword switch] ([variable x]) {",
+     "  [keyword case] [number 10]:",
+     "    [keyword return] [number 20];",
+     "  [keyword default]:",
+     "    [variable printf]([string \"foo %c\"], [variable x]);",
+     "}");
+
+  MT("def",
+     "[type void] [def foo]() {}",
+     "[keyword struct] [def bar]{}",
+     "[keyword enum] [def zot]{}",
+     "[keyword union] [def ugh]{}",
+     "[type int] [type *][def baz]() {}");
+
+  MT("def_new_line",
+     "::[variable std]::[variable SomeTerribleType][operator <][variable T][operator >]",
+     "[def SomeLongMethodNameThatDoesntFitIntoOneLine]([keyword const] [variable MyType][operator &] [variable param]) {}")
+
+  MT("double_block",
+     "[keyword for] (;;)",
+     "  [keyword for] (;;)",
+     "    [variable x][operator ++];",
+     "[keyword return];");
+
+  MT("preprocessor",
+     "[meta #define FOO 3]",
+     "[type int] [variable foo];",
+     "[meta #define BAR\\]",
+     "[meta 4]",
+     "[type unsigned] [type int] [variable bar] [operator =] [number 8];",
+     "[meta #include <baz> ][comment // comment]")
+
+  MT("c_underscores",
+     "[builtin __FOO];",
+     "[builtin _Complex];",
+     "[builtin __aName];",
+     "[variable _aName];");
+
+  MT("c_types",
+    "[type int];",
+    "[type long];",
+    "[type char];",
+    "[type short];",
+    "[type double];",
+    "[type float];",
+    "[type unsigned];",
+    "[type signed];",
+    "[type void];",
+    "[type bool];",
+    "[type foo_t];",
+    "[variable foo_T];",
+    "[variable _t];");
+
+  var mode_cpp = CodeMirror.getMode({indentUnit: 2}, "text/x-c++src");
+  function MTCPP(name) { test.mode(name, mode_cpp, Array.prototype.slice.call(arguments, 1)); }
+
+  MTCPP("cpp14_literal",
+    "[number 10'000];",
+    "[number 0b10'000];",
+    "[number 0x10'000];",
+    "[string '100000'];");
+
+  MTCPP("ctor_dtor",
+     "[def Foo::Foo]() {}",
+     "[def Foo::~Foo]() {}");
+
+  MTCPP("cpp_underscores",
+        "[builtin __FOO];",
+        "[builtin _Complex];",
+        "[builtin __aName];",
+        "[variable _aName];");
+
+  var mode_objc = CodeMirror.getMode({indentUnit: 2}, "text/x-objectivec");
+  function MTOBJC(name) { test.mode(name, mode_objc, Array.prototype.slice.call(arguments, 1)); }
+
+  MTOBJC("objc_underscores",
+         "[builtin __FOO];",
+         "[builtin _Complex];",
+         "[builtin __aName];",
+         "[variable _aName];");
+
+  MTOBJC("objc_interface",
+         "[keyword @interface] [def foo] {",
+         "  [type int] [variable bar];",
+         "}",
+         "[keyword @property] ([keyword atomic], [keyword nullable]) [variable NSString][operator *] [variable a];",
+         "[keyword @property] ([keyword nonatomic], [keyword assign]) [type int] [variable b];",
+         "[operator -]([type instancetype])[variable initWithFoo]:([type int])[variable a] " +
+           "[builtin NS_DESIGNATED_INITIALIZER];",
+         "[keyword @end]");
+
+  MTOBJC("objc_implementation",
+         "[keyword @implementation] [def foo] {",
+         "  [type int] [variable bar];",
+         "}",
+         "[keyword @property] ([keyword readwrite]) [type SEL] [variable a];",
+         "[operator -]([type instancetype])[variable initWithFoo]:([type int])[variable a] {",
+         "  [keyword if](([keyword self] [operator =] [[[keyword super] [variable init] ]])) {}",
+         "  [keyword return] [keyword self];",
+         "}",
+         "[keyword @end]");
+
+  MTOBJC("objc_types",
+         "[type int];",
+         "[type foo_t];",
+         "[variable foo_T];",
+         "[type id];",
+         "[type SEL];",
+         "[type instancetype];",
+         "[type Class];",
+         "[type Protocol];",
+         "[type BOOL];"
+         );
+
+  var mode_scala = CodeMirror.getMode({indentUnit: 2}, "text/x-scala");
+  function MTSCALA(name) { test.mode("scala_" + name, mode_scala, Array.prototype.slice.call(arguments, 1)); }
+  MTSCALA("nested_comments",
+     "[comment /*]",
+     "[comment But wait /* this is a nested comment */ for real]",
+     "[comment /**** let * me * show * you ****/]",
+     "[comment ///// let / me / show / you /////]",
+     "[comment */]");
+
+  var mode_java = CodeMirror.getMode({indentUnit: 2}, "text/x-java");
+  function MTJAVA(name) { test.mode("java_" + name, mode_java, Array.prototype.slice.call(arguments, 1)); }
+  MTJAVA("types",
+         "[type byte];",
+         "[type short];",
+         "[type int];",
+         "[type long];",
+         "[type float];",
+         "[type double];",
+         "[type boolean];",
+         "[type char];",
+         "[type void];",
+         "[type Boolean];",
+         "[type Byte];",
+         "[type Character];",
+         "[type Double];",
+         "[type Float];",
+         "[type Integer];",
+         "[type Long];",
+         "[type Number];",
+         "[type Object];",
+         "[type Short];",
+         "[type String];",
+         "[type StringBuffer];",
+         "[type StringBuilder];",
+         "[type Void];");
+
+  MTJAVA("indent",
+         "[keyword public] [keyword class] [def A] [keyword extends] [variable B]",
+         "{",
+         "  [variable c]()")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clojure/clojure.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,293 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("clojure", function (options) {
+  var atoms = ["false", "nil", "true"];
+  var specialForms = [".", "catch", "def", "do", "if", "monitor-enter",
+      "monitor-exit", "new", "quote", "recur", "set!", "throw", "try", "var"];
+  var coreSymbols = ["*", "*'", "*1", "*2", "*3", "*agent*",
+      "*allow-unresolved-vars*", "*assert*", "*clojure-version*",
+      "*command-line-args*", "*compile-files*", "*compile-path*",
+      "*compiler-options*", "*data-readers*", "*default-data-reader-fn*", "*e",
+      "*err*", "*file*", "*flush-on-newline*", "*fn-loader*", "*in*",
+      "*math-context*", "*ns*", "*out*", "*print-dup*", "*print-length*",
+      "*print-level*", "*print-meta*", "*print-namespace-maps*",
+      "*print-readably*", "*read-eval*", "*reader-resolver*", "*source-path*",
+      "*suppress-read*", "*unchecked-math*", "*use-context-classloader*",
+      "*verbose-defrecords*", "*warn-on-reflection*", "+", "+'", "-", "-'",
+      "->", "->>", "->ArrayChunk", "->Eduction", "->Vec", "->VecNode",
+      "->VecSeq", "-cache-protocol-fn", "-reset-methods", "..", "/", "<", "<=",
+      "=", "==", ">", ">=", "EMPTY-NODE", "Inst", "StackTraceElement->vec",
+      "Throwable->map", "accessor", "aclone", "add-classpath", "add-watch",
+      "agent", "agent-error", "agent-errors", "aget", "alength", "alias",
+      "all-ns", "alter", "alter-meta!", "alter-var-root", "amap", "ancestors",
+      "and", "any?", "apply", "areduce", "array-map", "as->", "aset",
+      "aset-boolean", "aset-byte", "aset-char", "aset-double", "aset-float",
+      "aset-int", "aset-long", "aset-short", "assert", "assoc", "assoc!",
+      "assoc-in", "associative?", "atom", "await", "await-for", "await1",
+      "bases", "bean", "bigdec", "bigint", "biginteger", "binding", "bit-and",
+      "bit-and-not", "bit-clear", "bit-flip", "bit-not", "bit-or", "bit-set",
+      "bit-shift-left", "bit-shift-right", "bit-test", "bit-xor", "boolean",
+      "boolean-array", "boolean?", "booleans", "bound-fn", "bound-fn*",
+      "bound?", "bounded-count", "butlast", "byte", "byte-array", "bytes",
+      "bytes?", "case", "cast", "cat", "char", "char-array",
+      "char-escape-string", "char-name-string", "char?", "chars", "chunk",
+      "chunk-append", "chunk-buffer", "chunk-cons", "chunk-first", "chunk-next",
+      "chunk-rest", "chunked-seq?", "class", "class?", "clear-agent-errors",
+      "clojure-version", "coll?", "comment", "commute", "comp", "comparator",
+      "compare", "compare-and-set!", "compile", "complement", "completing",
+      "concat", "cond", "cond->", "cond->>", "condp", "conj", "conj!", "cons",
+      "constantly", "construct-proxy", "contains?", "count", "counted?",
+      "create-ns", "create-struct", "cycle", "dec", "dec'", "decimal?",
+      "declare", "dedupe", "default-data-readers", "definline", "definterface",
+      "defmacro", "defmethod", "defmulti", "defn", "defn-", "defonce",
+      "defprotocol", "defrecord", "defstruct", "deftype", "delay", "delay?",
+      "deliver", "denominator", "deref", "derive", "descendants", "destructure",
+      "disj", "disj!", "dissoc", "dissoc!", "distinct", "distinct?", "doall",
+      "dorun", "doseq", "dosync", "dotimes", "doto", "double", "double-array",
+      "double?", "doubles", "drop", "drop-last", "drop-while", "eduction",
+      "empty", "empty?", "ensure", "ensure-reduced", "enumeration-seq",
+      "error-handler", "error-mode", "eval", "even?", "every-pred", "every?",
+      "ex-data", "ex-info", "extend", "extend-protocol", "extend-type",
+      "extenders", "extends?", "false?", "ffirst", "file-seq", "filter",
+      "filterv", "find", "find-keyword", "find-ns", "find-protocol-impl",
+      "find-protocol-method", "find-var", "first", "flatten", "float",
+      "float-array", "float?", "floats", "flush", "fn", "fn?", "fnext", "fnil",
+      "for", "force", "format", "frequencies", "future", "future-call",
+      "future-cancel", "future-cancelled?", "future-done?", "future?",
+      "gen-class", "gen-interface", "gensym", "get", "get-in", "get-method",
+      "get-proxy-class", "get-thread-bindings", "get-validator", "group-by",
+      "halt-when", "hash", "hash-combine", "hash-map", "hash-ordered-coll",
+      "hash-set", "hash-unordered-coll", "ident?", "identical?", "identity",
+      "if-let", "if-not", "if-some", "ifn?", "import", "in-ns", "inc", "inc'",
+      "indexed?", "init-proxy", "inst-ms", "inst-ms*", "inst?", "instance?",
+      "int", "int-array", "int?", "integer?", "interleave", "intern",
+      "interpose", "into", "into-array", "ints", "io!", "isa?", "iterate",
+      "iterator-seq", "juxt", "keep", "keep-indexed", "key", "keys", "keyword",
+      "keyword?", "last", "lazy-cat", "lazy-seq", "let", "letfn", "line-seq",
+      "list", "list*", "list?", "load", "load-file", "load-reader",
+      "load-string", "loaded-libs", "locking", "long", "long-array", "longs",
+      "loop", "macroexpand", "macroexpand-1", "make-array", "make-hierarchy",
+      "map", "map-entry?", "map-indexed", "map?", "mapcat", "mapv", "max",
+      "max-key", "memfn", "memoize", "merge", "merge-with", "meta",
+      "method-sig", "methods", "min", "min-key", "mix-collection-hash", "mod",
+      "munge", "name", "namespace", "namespace-munge", "nat-int?", "neg-int?",
+      "neg?", "newline", "next", "nfirst", "nil?", "nnext", "not", "not-any?",
+      "not-empty", "not-every?", "not=", "ns", "ns-aliases", "ns-imports",
+      "ns-interns", "ns-map", "ns-name", "ns-publics", "ns-refers",
+      "ns-resolve", "ns-unalias", "ns-unmap", "nth", "nthnext", "nthrest",
+      "num", "number?", "numerator", "object-array", "odd?", "or", "parents",
+      "partial", "partition", "partition-all", "partition-by", "pcalls", "peek",
+      "persistent!", "pmap", "pop", "pop!", "pop-thread-bindings", "pos-int?",
+      "pos?", "pr", "pr-str", "prefer-method", "prefers",
+      "primitives-classnames", "print", "print-ctor", "print-dup",
+      "print-method", "print-simple", "print-str", "printf", "println",
+      "println-str", "prn", "prn-str", "promise", "proxy",
+      "proxy-call-with-super", "proxy-mappings", "proxy-name", "proxy-super",
+      "push-thread-bindings", "pvalues", "qualified-ident?",
+      "qualified-keyword?", "qualified-symbol?", "quot", "rand", "rand-int",
+      "rand-nth", "random-sample", "range", "ratio?", "rational?",
+      "rationalize", "re-find", "re-groups", "re-matcher", "re-matches",
+      "re-pattern", "re-seq", "read", "read-line", "read-string",
+      "reader-conditional", "reader-conditional?", "realized?", "record?",
+      "reduce", "reduce-kv", "reduced", "reduced?", "reductions", "ref",
+      "ref-history-count", "ref-max-history", "ref-min-history", "ref-set",
+      "refer", "refer-clojure", "reify", "release-pending-sends", "rem",
+      "remove", "remove-all-methods", "remove-method", "remove-ns",
+      "remove-watch", "repeat", "repeatedly", "replace", "replicate", "require",
+      "reset!", "reset-meta!", "reset-vals!", "resolve", "rest",
+      "restart-agent", "resultset-seq", "reverse", "reversible?", "rseq",
+      "rsubseq", "run!", "satisfies?", "second", "select-keys", "send",
+      "send-off", "send-via", "seq", "seq?", "seqable?", "seque", "sequence",
+      "sequential?", "set", "set-agent-send-executor!",
+      "set-agent-send-off-executor!", "set-error-handler!", "set-error-mode!",
+      "set-validator!", "set?", "short", "short-array", "shorts", "shuffle",
+      "shutdown-agents", "simple-ident?", "simple-keyword?", "simple-symbol?",
+      "slurp", "some", "some->", "some->>", "some-fn", "some?", "sort",
+      "sort-by", "sorted-map", "sorted-map-by", "sorted-set", "sorted-set-by",
+      "sorted?", "special-symbol?", "spit", "split-at", "split-with", "str",
+      "string?", "struct", "struct-map", "subs", "subseq", "subvec", "supers",
+      "swap!", "swap-vals!", "symbol", "symbol?", "sync", "tagged-literal",
+      "tagged-literal?", "take", "take-last", "take-nth", "take-while", "test",
+      "the-ns", "thread-bound?", "time", "to-array", "to-array-2d",
+      "trampoline", "transduce", "transient", "tree-seq", "true?", "type",
+      "unchecked-add", "unchecked-add-int", "unchecked-byte", "unchecked-char",
+      "unchecked-dec", "unchecked-dec-int", "unchecked-divide-int",
+      "unchecked-double", "unchecked-float", "unchecked-inc",
+      "unchecked-inc-int", "unchecked-int", "unchecked-long",
+      "unchecked-multiply", "unchecked-multiply-int", "unchecked-negate",
+      "unchecked-negate-int", "unchecked-remainder-int", "unchecked-short",
+      "unchecked-subtract", "unchecked-subtract-int", "underive", "unquote",
+      "unquote-splicing", "unreduced", "unsigned-bit-shift-right", "update",
+      "update-in", "update-proxy", "uri?", "use", "uuid?", "val", "vals",
+      "var-get", "var-set", "var?", "vary-meta", "vec", "vector", "vector-of",
+      "vector?", "volatile!", "volatile?", "vreset!", "vswap!", "when",
+      "when-first", "when-let", "when-not", "when-some", "while",
+      "with-bindings", "with-bindings*", "with-in-str", "with-loading-context",
+      "with-local-vars", "with-meta", "with-open", "with-out-str",
+      "with-precision", "with-redefs", "with-redefs-fn", "xml-seq", "zero?",
+      "zipmap"];
+  var haveBodyParameter = [
+      "->", "->>", "as->", "binding", "bound-fn", "case", "catch", "comment",
+      "cond", "cond->", "cond->>", "condp", "def", "definterface", "defmethod",
+      "defn", "defmacro", "defprotocol", "defrecord", "defstruct", "deftype",
+      "do", "doseq", "dotimes", "doto", "extend", "extend-protocol",
+      "extend-type", "fn", "for", "future", "if", "if-let", "if-not", "if-some",
+      "let", "letfn", "locking", "loop", "ns", "proxy", "reify", "struct-map",
+      "some->", "some->>", "try", "when", "when-first", "when-let", "when-not",
+      "when-some", "while", "with-bindings", "with-bindings*", "with-in-str",
+      "with-loading-context", "with-local-vars", "with-meta", "with-open",
+      "with-out-str", "with-precision", "with-redefs", "with-redefs-fn"];
+
+  CodeMirror.registerHelper("hintWords", "clojure",
+    [].concat(atoms, specialForms, coreSymbols));
+
+  var atom = createLookupMap(atoms);
+  var specialForm = createLookupMap(specialForms);
+  var coreSymbol = createLookupMap(coreSymbols);
+  var hasBodyParameter = createLookupMap(haveBodyParameter);
+  var delimiter = /^(?:[\\\[\]\s"(),;@^`{}~]|$)/;
+  var numberLiteral = /^(?:[+\-]?\d+(?:(?:N|(?:[eE][+\-]?\d+))|(?:\.?\d*(?:M|(?:[eE][+\-]?\d+))?)|\/\d+|[xX][0-9a-fA-F]+|r[0-9a-zA-Z]+)?(?=[\\\[\]\s"#'(),;@^`{}~]|$))/;
+  var characterLiteral = /^(?:\\(?:backspace|formfeed|newline|return|space|tab|o[0-7]{3}|u[0-9A-Fa-f]{4}|x[0-9A-Fa-f]{4}|.)?(?=[\\\[\]\s"(),;@^`{}~]|$))/;
+
+  // simple-namespace := /^[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*/
+  // simple-symbol    := /^(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)/
+  // qualified-symbol := (<simple-namespace>(<.><simple-namespace>)*</>)?<simple-symbol>
+  var qualifiedSymbol = /^(?:(?:[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*(?:\.[^\\\/\[\]\d\s"#'(),;@^`{}~.][^\\\[\]\s"(),;@^`{}~.\/]*)*\/)?(?:\/|[^\\\/\[\]\d\s"#'(),;@^`{}~][^\\\[\]\s"(),;@^`{}~]*)*(?=[\\\[\]\s"(),;@^`{}~]|$))/;
+
+  function base(stream, state) {
+    if (stream.eatSpace() || stream.eat(",")) return ["space", null];
+    if (stream.match(numberLiteral)) return [null, "number"];
+    if (stream.match(characterLiteral)) return [null, "string-2"];
+    if (stream.eat(/^"/)) return (state.tokenize = inString)(stream, state);
+    if (stream.eat(/^[(\[{]/)) return ["open", "bracket"];
+    if (stream.eat(/^[)\]}]/)) return ["close", "bracket"];
+    if (stream.eat(/^;/)) {stream.skipToEnd(); return ["space", "comment"];}
+    if (stream.eat(/^[#'@^`~]/)) return [null, "meta"];
+
+    var matches = stream.match(qualifiedSymbol);
+    var symbol = matches && matches[0];
+
+    if (!symbol) {
+      // advance stream by at least one character so we don't get stuck.
+      stream.next();
+      stream.eatWhile(function (c) {return !is(c, delimiter);});
+      return [null, "error"];
+    }
+
+    if (symbol === "comment" && state.lastToken === "(")
+      return (state.tokenize = inComment)(stream, state);
+    if (is(symbol, atom) || symbol.charAt(0) === ":") return ["symbol", "atom"];
+    if (is(symbol, specialForm) || is(symbol, coreSymbol)) return ["symbol", "keyword"];
+    if (state.lastToken === "(") return ["symbol", "builtin"]; // other operator
+
+    return ["symbol", "variable"];
+  }
+
+  function inString(stream, state) {
+    var escaped = false, next;
+
+    while (next = stream.next()) {
+      if (next === "\"" && !escaped) {state.tokenize = base; break;}
+      escaped = !escaped && next === "\\";
+    }
+
+    return [null, "string"];
+  }
+
+  function inComment(stream, state) {
+    var parenthesisCount = 1;
+    var next;
+
+    while (next = stream.next()) {
+      if (next === ")") parenthesisCount--;
+      if (next === "(") parenthesisCount++;
+      if (parenthesisCount === 0) {
+        stream.backUp(1);
+        state.tokenize = base;
+        break;
+      }
+    }
+
+    return ["space", "comment"];
+  }
+
+  function createLookupMap(words) {
+    var obj = {};
+
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+
+    return obj;
+  }
+
+  function is(value, test) {
+    if (test instanceof RegExp) return test.test(value);
+    if (test instanceof Object) return test.propertyIsEnumerable(value);
+  }
+
+  return {
+    startState: function () {
+      return {
+        ctx: {prev: null, start: 0, indentTo: 0},
+        lastToken: null,
+        tokenize: base
+      };
+    },
+
+    token: function (stream, state) {
+      if (stream.sol() && (typeof state.ctx.indentTo !== "number"))
+        state.ctx.indentTo = state.ctx.start + 1;
+
+      var typeStylePair = state.tokenize(stream, state);
+      var type = typeStylePair[0];
+      var style = typeStylePair[1];
+      var current = stream.current();
+
+      if (type !== "space") {
+        if (state.lastToken === "(" && state.ctx.indentTo === null) {
+          if (type === "symbol" && is(current, hasBodyParameter))
+            state.ctx.indentTo = state.ctx.start + options.indentUnit;
+          else state.ctx.indentTo = "next";
+        } else if (state.ctx.indentTo === "next") {
+          state.ctx.indentTo = stream.column();
+        }
+
+        state.lastToken = current;
+      }
+
+      if (type === "open")
+        state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
+      else if (type === "close") state.ctx = state.ctx.prev || state.ctx;
+
+      return style;
+    },
+
+    indent: function (state) {
+      var i = state.ctx.indentTo;
+
+      return (typeof i === "number") ?
+        i :
+        state.ctx.start + 1;
+    },
+
+    closeBrackets: {pairs: "()[]{}\"\""},
+    fold: "brace",
+    lineComment: ";;"
+  };
+});
+
+CodeMirror.defineMIME("text/x-clojure", "clojure");
+CodeMirror.defineMIME("text/x-clojurescript", "clojure");
+CodeMirror.defineMIME("application/edn", "clojure");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clojure/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+<!doctype html>
+
+<title>CodeMirror: Clojure mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/closebrackets.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="clojure.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Clojure</a>
+  </ul>
+</div>
+
+<article>
+<h2>Clojure mode</h2>
+<form><textarea id="code" name="code">
+(ns game-of-life
+  "Conway's Game of Life, based on the work of
+  Christophe Grand (http://clj-me.cgrand.net/2011/08/19/conways-game-of-life)
+  and Laurent Petit (https://gist.github.com/1200343).")
+
+;;; Core game of life's algorithm functions
+
+(defn neighbors
+  "Given a cell's coordinates `[x y]`, returns the coordinates of its
+  neighbors."
+  [[x y]]
+  (for [dx [-1 0 1]
+        dy (if (zero? dx)
+             [-1 1]
+             [-1 0 1])]
+    [(+ dx x) (+ dy y)]))
+
+(defn step
+  "Given a set of living `cells`, computes the new set of living cells."
+  [cells]
+  (set (for [[cell n] (frequencies (mapcat neighbors cells))
+             :when (or (= n 3)
+                       (and (= n 2)
+                            (cells cell)))]
+         cell)))
+
+;;; Utility methods for displaying game on a text terminal
+
+(defn print-grid
+  "Prints a `grid` of `w` columns and `h` rows, on *out*, representing a
+  step in the game."
+  [grid w h]
+  (doseq [x (range (inc w))
+          y (range (inc h))]
+    (when (= y 0) (println))
+    (print (if (grid [x y])
+             "[X]"
+             " . "))))
+
+(defn print-grids
+  "Prints a sequence of `grids` of `w` columns and `h` rows on *out*,
+  representing several steps."
+  [grids w h]
+  (doseq [grid grids]
+    (print-grid grid w h)
+    (println)))
+
+;;; Launches an example grid
+
+(def grid
+  "`grid` represents the initial set of living cells"
+  #{[2 1] [2 2] [2 3]})
+
+(print-grids (take 3 (iterate step grid)) 5 5)</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+          autoCloseBrackets: true,
+          lineNumbers: true,
+          matchBrackets: true,
+          mode: 'text/x-clojure'
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-clojure</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/clojure/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,384 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function () {
+    var mode = CodeMirror.getMode({indentUnit: 2}, "clojure");
+
+    function MT(name) {
+        test.mode(name, mode, Array.prototype.slice.call(arguments, 1));
+    }
+
+    MT("atoms",
+        "[atom false]",
+        "[atom nil]",
+        "[atom true]"
+    );
+
+    MT("keywords",
+        "[atom :foo]",
+        "[atom ::bar]",
+        "[atom :foo/bar]",
+        "[atom :foo.bar/baz]"
+    );
+
+    MT("numbers",
+        "[number 42] [number +42] [number -421]",
+        "[number 42N] [number +42N] [number -42N]",
+        "[number 0.42] [number +0.42] [number -0.42]",
+        "[number 42M] [number +42M] [number -42M]",
+        "[number 42.42M] [number +42.42M] [number -42.42M]",
+        "[number 1/42] [number +1/42] [number -1/42]",
+        "[number 0x42af] [number +0x42af] [number -0x42af]",
+        "[number 0x42AF] [number +0x42AF] [number -0x42AF]",
+        "[number 1e2] [number 1e+2] [number 1e-2]",
+        "[number +1e2] [number +1e+2] [number +1e-2]",
+        "[number -1e2] [number -1e+2] [number -1e-2]",
+        "[number -1.0e2] [number -0.1e+2] [number -1.01e-2]",
+        "[number 1E2] [number 1E+2] [number 1E-2]",
+        "[number +1E2] [number +1E+2] [number +1E-2]",
+        "[number -1E2] [number -1E+2] [number -1E-2]",
+        "[number -1.0E2] [number -0.1E+2] [number -1.01E-2]",
+        "[number 2r101010] [number +2r101010] [number -2r101010]",
+        "[number 2r101010] [number +2r101010] [number -2r101010]",
+        "[number 8r52] [number +8r52] [number -8r52]",
+        "[number 36rhello] [number +36rhello] [number -36rhello]",
+        "[number 36rz] [number +36rz] [number -36rz]",
+        "[number 36rZ] [number +36rZ] [number -36rZ]",
+
+        // invalid numbers
+        "[error 42foo]",
+        "[error 42Nfoo]",
+        "[error 42Mfoo]",
+        "[error 42.42Mfoo]",
+        "[error 42.42M!]",
+        "[error 42!]",
+        "[error 0x42afm]"
+    );
+
+    MT("characters",
+        "[string-2 \\1]",
+        "[string-2 \\a]",
+        "[string-2 \\a\\b\\c]",
+        "[string-2 \\#]",
+        "[string-2 \\\\]",
+        "[string-2 \\\"]",
+        "[string-2 \\(]",
+        "[string-2 \\A]",
+        "[string-2 \\backspace]",
+        "[string-2 \\formfeed]",
+        "[string-2 \\newline]",
+        "[string-2 \\space]",
+        "[string-2 \\return]",
+        "[string-2 \\tab]",
+        "[string-2 \\u1000]",
+        "[string-2 \\uAaAa]",
+        "[string-2 \\u9F9F]",
+        "[string-2 \\o123]",
+        "[string-2 \\符]",
+        "[string-2 \\シ]",
+        "[string-2 \\ۇ]",
+        // FIXME
+        // "[string-2 \\🙂]",
+
+        // invalid character literals
+        "[error \\abc]",
+        "[error \\a123]",
+        "[error \\a!]",
+        "[error \\newlines]",
+        "[error \\NEWLINE]",
+        "[error \\u9F9FF]",
+        "[error \\o1234]"
+    );
+
+    MT("strings",
+        "[string \"I'm a teapot.\"]",
+        "[string \"I'm a \\\"teapot\\\".\"]",
+        "[string \"I'm]",       // this is
+        "[string a]",           // a multi-line
+        "[string teapot.\"]"    // string
+
+        // TODO unterminated (multi-line) strings?
+    );
+
+    MT("comments",
+        "[comment ; this is an in-line comment.]",
+        "[comment ;; this is a line comment.]",
+        "[keyword comment]",
+        "[bracket (][comment comment (foo 1 2 3)][bracket )]"
+    );
+
+    MT("reader macro characters",
+        "[meta #][variable _]",
+        "[meta #][variable -Inf]",
+        "[meta ##][variable Inf]",
+        "[meta ##][variable NaN]",
+        "[meta @][variable x]",
+        "[meta ^][bracket {][atom :tag] [variable String][bracket }]",
+        "[meta `][bracket (][builtin f] [variable x][bracket )]",
+        "[meta ~][variable foo#]",
+        "[meta '][number 1]",
+        "[meta '][atom :foo]",
+        "[meta '][string \"foo\"]",
+        "[meta '][variable x]",
+        "[meta '][bracket (][builtin a] [variable b] [variable c][bracket )]",
+        "[meta '][bracket [[][variable a] [variable b] [variable c][bracket ]]]",
+        "[meta '][bracket {][variable a] [number 1] [atom :foo] [number 2] [variable c] [number 3][bracket }]",
+        "[meta '#][bracket {][variable a] [number 1] [atom :foo][bracket }]"
+    );
+
+    MT("symbols",
+      "[variable foo!]",
+      "[variable foo#]",
+      "[variable foo$]",
+      "[variable foo&]",
+      "[variable foo']",
+      "[variable foo*]",
+      "[variable foo+]",
+      "[variable foo-]",
+      "[variable foo.]",
+      "[variable foo/bar]",
+      "[variable foo:bar]",
+      "[variable foo<]",
+      "[variable foo=]",
+      "[variable foo>]",
+      "[variable foo?]",
+      "[variable foo_]",
+      "[variable foo|]",
+      "[variable foobarBaz]",
+      "[variable foo¡]",
+      "[variable 符号]",
+      "[variable シンボル]",
+      "[variable ئۇيغۇر]",
+      "[variable 🙂❤🇺🇸]",
+
+      // invalid symbols
+      "[error 3foo]",
+      "[error 3+]",
+      "[error 3|]",
+      "[error 3_]"
+    );
+
+    MT("numbers and other forms",
+      "[number 42][bracket (][builtin foo][bracket )]",
+      "[number 42][bracket [[][variable foo][bracket ]]]",
+      "[number 42][meta #][bracket {][variable foo][bracket }]",
+      "[number 42][bracket {][atom :foo] [variable bar][bracket }]",
+      "[number 42][meta `][variable foo]",
+      "[number 42][meta ~][variable foo]",
+      "[number 42][meta #][variable foo]"
+    );
+
+    var specialForms = [".", "catch", "def", "do", "if", "monitor-enter",
+        "monitor-exit", "new", "quote", "recur", "set!", "throw", "try", "var"];
+
+    MT("should highlight special forms as keywords",
+        typeTokenPairs("keyword", specialForms)
+    );
+
+    var coreSymbols1 = [
+        "*", "*'", "*1", "*2", "*3", "*agent*", "*allow-unresolved-vars*", "*assert*",
+        "*clojure-version*", "*command-line-args*", "*compile-files*", "*compile-path*", "*compiler-options*",
+        "*data-readers*", "*default-data-reader-fn*", "*e", "*err*", "*file*", "*flush-on-newline*", "*fn-loader*",
+        "*in*", "*math-context*", "*ns*", "*out*", "*print-dup*", "*print-length*", "*print-level*", "*print-meta*",
+        "*print-namespace-maps*", "*print-readably*", "*read-eval*", "*reader-resolver*", "*source-path*",
+        "*suppress-read*", "*unchecked-math*", "*use-context-classloader*", "*verbose-defrecords*",
+        "*warn-on-reflection*", "+", "+'", "-", "-'", "->", "->>", "->ArrayChunk", "->Eduction", "->Vec", "->VecNode",
+        "->VecSeq", "-cache-protocol-fn", "-reset-methods", "..", "/", "<", "<=", "=", "==", ">", ">=",
+        "EMPTY-NODE", "Inst", "StackTraceElement->vec", "Throwable->map", "accessor", "aclone", "add-classpath",
+        "add-watch", "agent", "agent-error", "agent-errors", "aget", "alength", "alias", "all-ns", "alter",
+        "alter-meta!", "alter-var-root", "amap", "ancestors", "and", "any?", "apply", "areduce", "array-map",
+        "as->", "aset", "aset-boolean", "aset-byte", "aset-char", "aset-double", "aset-float", "aset-int",
+        "aset-long", "aset-short", "assert", "assoc", "assoc!", "assoc-in", "associative?", "atom", "await",
+        "await-for", "await1", "bases", "bean", "bigdec", "bigint", "biginteger", "binding", "bit-and", "bit-and-not",
+        "bit-clear", "bit-flip", "bit-not", "bit-or", "bit-set", "bit-shift-left", "bit-shift-right", "bit-test",
+        "bit-xor", "boolean", "boolean-array", "boolean?", "booleans", "bound-fn", "bound-fn*", "bound?",
+        "bounded-count", "butlast", "byte", "byte-array", "bytes", "bytes?", "case", "cast", "cat", "char",
+        "char-array", "char-escape-string", "char-name-string", "char?", "chars", "chunk", "chunk-append",
+        "chunk-buffer", "chunk-cons", "chunk-first", "chunk-next", "chunk-rest", "chunked-seq?", "class", "class?",
+        "clear-agent-errors", "clojure-version", "coll?", "comment", "commute", "comp", "comparator", "compare",
+        "compare-and-set!", "compile", "complement", "completing", "concat", "cond", "cond->", "cond->>", "condp",
+        "conj", "conj!", "cons", "constantly", "construct-proxy", "contains?", "count", "counted?", "create-ns",
+        "create-struct", "cycle", "dec", "dec'", "decimal?", "declare", "dedupe", "default-data-readers", "definline",
+        "definterface", "defmacro", "defmethod", "defmulti", "defn", "defn-", "defonce", "defprotocol", "defrecord",
+        "defstruct", "deftype", "delay", "delay?", "deliver", "denominator", "deref", "derive", "descendants",
+        "destructure", "disj", "disj!", "dissoc", "dissoc!", "distinct", "distinct?", "doall", "dorun", "doseq",
+        "dosync", "dotimes", "doto", "double", "double-array", "double?", "doubles", "drop", "drop-last", "drop-while",
+        "eduction", "empty", "empty?", "ensure", "ensure-reduced", "enumeration-seq", "error-handler", "error-mode",
+        "eval", "even?", "every-pred", "every?", "ex-data", "ex-info", "extend", "extend-protocol", "extend-type",
+        "extenders", "extends?", "false?", "ffirst", "file-seq", "filter", "filterv", "find", "find-keyword", "find-ns",
+        "find-protocol-impl", "find-protocol-method", "find-var", "first", "flatten", "float", "float-array", "float?",
+        "floats", "flush", "fn", "fn?", "fnext", "fnil", "for", "force", "format", "frequencies", "future", "future-call",
+        "future-cancel", "future-cancelled?", "future-done?", "future?", "gen-class", "gen-interface", "gensym", "get",
+        "get-in", "get-method", "get-proxy-class", "get-thread-bindings", "get-validator", "group-by", "halt-when", "hash",
+        "hash-combine", "hash-map", "hash-ordered-coll", "hash-set", "hash-unordered-coll", "ident?", "identical?",
+        "identity", "if-let", "if-not", "if-some", "ifn?", "import", "in-ns", "inc", "inc'", "indexed?", "init-proxy",
+        "inst-ms", "inst-ms*", "inst?", "instance?", "int", "int-array", "int?", "integer?", "interleave", "intern",
+        "interpose", "into", "into-array", "ints", "io!", "isa?", "iterate", "iterator-seq", "juxt", "keep", "keep-indexed",
+        "key", "keys", "keyword", "keyword?", "last", "lazy-cat", "lazy-seq", "let", "letfn", "line-seq", "list", "list*",
+        "list?", "load", "load-file", "load-reader", "load-string", "loaded-libs", "locking", "long", "long-array", "longs",
+        "loop", "macroexpand", "macroexpand-1", "make-array", "make-hierarchy", "map", "map-entry?", "map-indexed", "map?",
+        "mapcat", "mapv", "max", "max-key", "memfn", "memoize", "merge", "merge-with", "meta", "method-sig", "methods"];
+
+    var coreSymbols2 = [
+        "min", "min-key", "mix-collection-hash", "mod", "munge", "name", "namespace", "namespace-munge", "nat-int?",
+        "neg-int?", "neg?", "newline", "next", "nfirst", "nil?", "nnext", "not", "not-any?", "not-empty", "not-every?",
+        "not=", "ns", "ns-aliases", "ns-imports", "ns-interns", "ns-map", "ns-name", "ns-publics", "ns-refers", "ns-resolve",
+        "ns-unalias", "ns-unmap", "nth", "nthnext", "nthrest", "num", "number?", "numerator", "object-array", "odd?", "or",
+        "parents", "partial", "partition", "partition-all", "partition-by", "pcalls", "peek", "persistent!", "pmap", "pop",
+        "pop!", "pop-thread-bindings", "pos-int?", "pos?", "pr", "pr-str", "prefer-method", "prefers",
+        "primitives-classnames", "print", "print-ctor", "print-dup", "print-method", "print-simple", "print-str", "printf",
+        "println", "println-str", "prn", "prn-str", "promise", "proxy", "proxy-call-with-super", "proxy-mappings",
+        "proxy-name", "proxy-super", "push-thread-bindings", "pvalues", "qualified-ident?", "qualified-keyword?",
+        "qualified-symbol?", "quot", "rand", "rand-int", "rand-nth", "random-sample", "range", "ratio?", "rational?",
+        "rationalize", "re-find", "re-groups", "re-matcher", "re-matches", "re-pattern", "re-seq", "read", "read-line",
+        "read-string", "reader-conditional", "reader-conditional?", "realized?", "record?", "reduce", "reduce-kv", "reduced",
+        "reduced?", "reductions", "ref", "ref-history-count", "ref-max-history", "ref-min-history", "ref-set", "refer",
+        "refer-clojure", "reify", "release-pending-sends", "rem", "remove", "remove-all-methods", "remove-method", "remove-ns",
+        "remove-watch", "repeat", "repeatedly", "replace", "replicate", "require", "reset!", "reset-meta!", "reset-vals!",
+        "resolve", "rest", "restart-agent", "resultset-seq", "reverse", "reversible?", "rseq", "rsubseq", "run!", "satisfies?",
+        "second", "select-keys", "send", "send-off", "send-via", "seq", "seq?", "seqable?", "seque", "sequence", "sequential?",
+        "set", "set-agent-send-executor!", "set-agent-send-off-executor!", "set-error-handler!", "set-error-mode!",
+        "set-validator!", "set?", "short", "short-array", "shorts", "shuffle", "shutdown-agents", "simple-ident?",
+        "simple-keyword?", "simple-symbol?", "slurp", "some", "some->", "some->>", "some-fn", "some?", "sort", "sort-by",
+        "sorted-map", "sorted-map-by", "sorted-set", "sorted-set-by", "sorted?", "special-symbol?", "spit", "split-at",
+        "split-with", "str", "string?", "struct", "struct-map", "subs", "subseq", "subvec", "supers", "swap!", "swap-vals!",
+        "symbol", "symbol?", "sync", "tagged-literal", "tagged-literal?", "take", "take-last", "take-nth", "take-while", "test",
+        "the-ns", "thread-bound?", "time", "to-array", "to-array-2d", "trampoline", "transduce", "transient", "tree-seq",
+        "true?", "type", "unchecked-add", "unchecked-add-int", "unchecked-byte", "unchecked-char", "unchecked-dec",
+        "unchecked-dec-int", "unchecked-divide-int", "unchecked-double", "unchecked-float", "unchecked-inc", "unchecked-inc-int",
+        "unchecked-int", "unchecked-long", "unchecked-multiply", "unchecked-multiply-int", "unchecked-negate",
+        "unchecked-negate-int", "unchecked-remainder-int", "unchecked-short", "unchecked-subtract", "unchecked-subtract-int",
+        "underive", "unquote", "unquote-splicing", "unreduced", "unsigned-bit-shift-right", "update", "update-in",
+        "update-proxy", "uri?", "use", "uuid?", "val", "vals", "var-get", "var-set", "var?", "vary-meta", "vec", "vector",
+        "vector-of", "vector?", "volatile!", "volatile?", "vreset!", "vswap!", "when", "when-first", "when-let", "when-not",
+        "when-some", "while", "with-bindings", "with-bindings*", "with-in-str", "with-loading-context", "with-local-vars",
+        "with-meta", "with-open", "with-out-str", "with-precision", "with-redefs", "with-redefs-fn", "xml-seq", "zero?",
+        "zipmap"
+    ];
+
+    MT("should highlight core symbols as keywords (part 1/2)",
+        typeTokenPairs("keyword", coreSymbols1)
+    );
+
+    MT("should highlight core symbols as keywords (part 2/2)",
+        typeTokenPairs("keyword", coreSymbols2)
+    );
+
+    MT("should properly indent forms in list literals",
+        "[bracket (][builtin foo] [atom :a] [number 1] [atom true] [atom nil][bracket )]",
+        "",
+        "[bracket (][builtin foo] [atom :a]",
+        "     [number 1]",
+        "     [atom true]",
+        "     [atom nil][bracket )]",
+        "",
+        "[bracket (][builtin foo] [atom :a] [number 1]",
+        "     [atom true]",
+        "     [atom nil][bracket )]",
+        "",
+        "[bracket (]",
+        " [builtin foo]",
+        " [atom :a]",
+        " [number 1]",
+        " [atom true]",
+        " [atom nil][bracket )]",
+        "",
+        "[bracket (][builtin foo] [bracket [[][atom :a][bracket ]]]",
+        "     [number 1]",
+        "     [atom true]",
+        "     [atom nil][bracket )]"
+    );
+
+    MT("should properly indent forms in vector literals",
+        "[bracket [[][atom :a] [number 1] [atom true] [atom nil][bracket ]]]",
+        "",
+        "[bracket [[][atom :a]",
+        " [number 1]",
+        " [atom true]",
+        " [atom nil][bracket ]]]",
+        "",
+        "[bracket [[][atom :a] [number 1]",
+        " [atom true]",
+        " [atom nil][bracket ]]]",
+        "",
+        "[bracket [[]",
+        " [variable foo]",
+        " [atom :a]",
+        " [number 1]",
+        " [atom true]",
+        " [atom nil][bracket ]]]"
+    );
+
+    MT("should properly indent forms in map literals",
+        "[bracket {][atom :a] [atom :a] [atom :b] [number 1] [atom :c] [atom true] [atom :d] [atom nil] [bracket }]",
+        "",
+        "[bracket {][atom :a] [atom :a]",
+        " [atom :b] [number 1]",
+        " [atom :c] [atom true]",
+        " [atom :d] [atom nil][bracket }]",
+        "",
+        "[bracket {][atom :a]",
+        " [atom :a]",
+        " [atom :b]",
+        " [number 1]",
+        " [atom :c]",
+        " [atom true]",
+        " [atom :d]",
+        " [atom nil][bracket }]",
+        "",
+        "[bracket {]",
+        " [atom :a] [atom :a]",
+        " [atom :b] [number 1]",
+        " [atom :c] [atom true]",
+        " [atom :d] [atom nil][bracket }]"
+    );
+
+    MT("should properly indent forms in set literals",
+        "[meta #][bracket {][atom :a] [number 1] [atom true] [atom nil] [bracket }]",
+        "",
+        "[meta #][bracket {][atom :a]",
+        "  [number 1]",
+        "  [atom true]",
+        "  [atom nil][bracket }]",
+        "",
+        "[meta #][bracket {]",
+        "  [atom :a]",
+        "  [number 1]",
+        "  [atom true]",
+        "  [atom nil][bracket }]"
+    );
+
+    var haveBodyParameter = [
+        "->", "->>", "as->", "binding", "bound-fn", "case", "catch", "cond",
+        "cond->", "cond->>", "condp", "def", "definterface", "defmethod", "defn",
+        "defmacro", "defprotocol", "defrecord", "defstruct", "deftype", "do",
+        "doseq", "dotimes", "doto", "extend", "extend-protocol", "extend-type",
+        "fn", "for", "future", "if", "if-let", "if-not", "if-some", "let",
+        "letfn", "locking", "loop", "ns", "proxy", "reify", "some->", "some->>",
+        "struct-map", "try", "when", "when-first", "when-let", "when-not",
+        "when-some", "while", "with-bindings", "with-bindings*", "with-in-str",
+        "with-loading-context", "with-local-vars", "with-meta", "with-open",
+        "with-out-str", "with-precision", "with-redefs", "with-redefs-fn"];
+
+    function testFormsThatHaveBodyParameter(forms) {
+        for (var i = 0; i < forms.length; i++) {
+            MT("should indent body argument of `" + forms[i] + "` by `options.indentUnit` spaces",
+                "[bracket (][keyword " + forms[i] + "] [variable foo] [variable bar]",
+                "  [variable baz]",
+                "  [variable qux][bracket )]"
+            );
+        }
+    }
+
+    testFormsThatHaveBodyParameter(haveBodyParameter);
+
+    MT("should indent body argument of `comment` by `options.indentUnit` spaces",
+        "[bracket (][comment comment foo bar]",
+        "[comment  baz]",
+        "[comment  qux][bracket )]"
+    );
+
+    function typeTokenPairs(type, tokens) {
+        return "[" + type + " " + tokens.join("] [" + type + " ") + "]";
+    }
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cmake/cmake.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,97 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object")
+    mod(require("../../lib/codemirror"));
+  else if (typeof define == "function" && define.amd)
+    define(["../../lib/codemirror"], mod);
+  else
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("cmake", function () {
+  var variable_regex = /({)?[a-zA-Z0-9_]+(})?/;
+
+  function tokenString(stream, state) {
+    var current, prev, found_var = false;
+    while (!stream.eol() && (current = stream.next()) != state.pending) {
+      if (current === '$' && prev != '\\' && state.pending == '"') {
+        found_var = true;
+        break;
+      }
+      prev = current;
+    }
+    if (found_var) {
+      stream.backUp(1);
+    }
+    if (current == state.pending) {
+      state.continueString = false;
+    } else {
+      state.continueString = true;
+    }
+    return "string";
+  }
+
+  function tokenize(stream, state) {
+    var ch = stream.next();
+
+    // Have we found a variable?
+    if (ch === '$') {
+      if (stream.match(variable_regex)) {
+        return 'variable-2';
+      }
+      return 'variable';
+    }
+    // Should we still be looking for the end of a string?
+    if (state.continueString) {
+      // If so, go through the loop again
+      stream.backUp(1);
+      return tokenString(stream, state);
+    }
+    // Do we just have a function on our hands?
+    // In 'cmake_minimum_required (VERSION 2.8.8)', 'cmake_minimum_required' is matched
+    if (stream.match(/(\s+)?\w+\(/) || stream.match(/(\s+)?\w+\ \(/)) {
+      stream.backUp(1);
+      return 'def';
+    }
+    if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    // Have we found a string?
+    if (ch == "'" || ch == '"') {
+      // Store the type (single or double)
+      state.pending = ch;
+      // Perform the looping function to find the end
+      return tokenString(stream, state);
+    }
+    if (ch == '(' || ch == ')') {
+      return 'bracket';
+    }
+    if (ch.match(/[0-9]/)) {
+      return 'number';
+    }
+    stream.eatWhile(/[\w-]/);
+    return null;
+  }
+  return {
+    startState: function () {
+      var state = {};
+      state.inDefinition = false;
+      state.inInclude = false;
+      state.continueString = false;
+      state.pending = false;
+      return state;
+    },
+    token: function (stream, state) {
+      if (stream.eatSpace()) return null;
+      return tokenize(stream, state);
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-cmake", "cmake");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cmake/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,129 @@
+<!doctype html>
+
+<title>CodeMirror: CMake mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="cmake.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .cm-s-default span.cm-arrow { color: red; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">CMake</a>
+  </ul>
+</div>
+
+<article>
+<h2>CMake mode</h2>
+<form><textarea id="code" name="code">
+# vim: syntax=cmake
+if(NOT CMAKE_BUILD_TYPE)
+    # default to Release build for GCC builds
+    set(CMAKE_BUILD_TYPE Release CACHE STRING
+        "Choose the type of build, options are: None(CMAKE_CXX_FLAGS or CMAKE_C_FLAGS used) Debug Release RelWithDebInfo MinSizeRel."
+        FORCE)
+endif()
+message(STATUS "cmake version ${CMAKE_VERSION}")
+if(POLICY CMP0025)
+    cmake_policy(SET CMP0025 OLD) # report Apple's Clang as just Clang
+endif()
+if(POLICY CMP0042)
+    cmake_policy(SET CMP0042 NEW) # MACOSX_RPATH
+endif()
+
+project (x265)
+cmake_minimum_required (VERSION 2.8.8) # OBJECT libraries require 2.8.8
+include(CheckIncludeFiles)
+include(CheckFunctionExists)
+include(CheckSymbolExists)
+include(CheckCXXCompilerFlag)
+
+# X265_BUILD must be incremented each time the public API is changed
+set(X265_BUILD 48)
+configure_file("${PROJECT_SOURCE_DIR}/x265.def.in"
+               "${PROJECT_BINARY_DIR}/x265.def")
+configure_file("${PROJECT_SOURCE_DIR}/x265_config.h.in"
+               "${PROJECT_BINARY_DIR}/x265_config.h")
+
+SET(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")
+
+# System architecture detection
+string(TOLOWER "${CMAKE_SYSTEM_PROCESSOR}" SYSPROC)
+set(X86_ALIASES x86 i386 i686 x86_64 amd64)
+list(FIND X86_ALIASES "${SYSPROC}" X86MATCH)
+if("${SYSPROC}" STREQUAL "" OR X86MATCH GREATER "-1")
+    message(STATUS "Detected x86 target processor")
+    set(X86 1)
+    add_definitions(-DX265_ARCH_X86=1)
+    if("${CMAKE_SIZEOF_VOID_P}" MATCHES 8)
+        set(X64 1)
+        add_definitions(-DX86_64=1)
+    endif()
+elseif(${SYSPROC} STREQUAL "armv6l")
+    message(STATUS "Detected ARM target processor")
+    set(ARM 1)
+    add_definitions(-DX265_ARCH_ARM=1 -DHAVE_ARMV6=1)
+else()
+    message(STATUS "CMAKE_SYSTEM_PROCESSOR value `${CMAKE_SYSTEM_PROCESSOR}` is unknown")
+    message(STATUS "Please add this value near ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE}")
+endif()
+
+if(UNIX)
+    list(APPEND PLATFORM_LIBS pthread)
+    find_library(LIBRT rt)
+    if(LIBRT)
+        list(APPEND PLATFORM_LIBS rt)
+    endif()
+    find_package(Numa)
+    if(NUMA_FOUND)
+        list(APPEND CMAKE_REQUIRED_LIBRARIES ${NUMA_LIBRARY})
+        check_symbol_exists(numa_node_of_cpu numa.h NUMA_V2)
+        if(NUMA_V2)
+            add_definitions(-DHAVE_LIBNUMA)
+            message(STATUS "libnuma found, building with support for NUMA nodes")
+            list(APPEND PLATFORM_LIBS ${NUMA_LIBRARY})
+            link_directories(${NUMA_LIBRARY_DIR})
+            include_directories(${NUMA_INCLUDE_DIR})
+        endif()
+    endif()
+    mark_as_advanced(LIBRT NUMA_FOUND)
+endif(UNIX)
+
+if(X64 AND NOT WIN32)
+    option(ENABLE_PIC "Enable Position Independent Code" ON)
+else()
+    option(ENABLE_PIC "Enable Position Independent Code" OFF)
+endif(X64 AND NOT WIN32)
+
+# Compiler detection
+if(CMAKE_GENERATOR STREQUAL "Xcode")
+  set(XCODE 1)
+endif()
+if (APPLE)
+  add_definitions(-DMACOS)
+endif()
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/x-cmake",
+        matchBrackets: true,
+        indentUnit: 4
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-cmake</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cobol/cobol.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,255 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Author: Gautam Mehta
+ * Branched from CodeMirror's Scheme mode
+ */
+(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.defineMode("cobol", function () {
+  var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
+      ATOM = "atom", NUMBER = "number", KEYWORD = "keyword", MODTAG = "header",
+      COBOLLINENUM = "def", PERIOD = "link";
+  function makeKeywords(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+  var atoms = makeKeywords("TRUE FALSE ZEROES ZEROS ZERO SPACES SPACE LOW-VALUE LOW-VALUES ");
+  var keywords = makeKeywords(
+      "ACCEPT ACCESS ACQUIRE ADD ADDRESS " +
+      "ADVANCING AFTER ALIAS ALL ALPHABET " +
+      "ALPHABETIC ALPHABETIC-LOWER ALPHABETIC-UPPER ALPHANUMERIC ALPHANUMERIC-EDITED " +
+      "ALSO ALTER ALTERNATE AND ANY " +
+      "ARE AREA AREAS ARITHMETIC ASCENDING " +
+      "ASSIGN AT ATTRIBUTE AUTHOR AUTO " +
+      "AUTO-SKIP AUTOMATIC B-AND B-EXOR B-LESS " +
+      "B-NOT B-OR BACKGROUND-COLOR BACKGROUND-COLOUR BEEP " +
+      "BEFORE BELL BINARY BIT BITS " +
+      "BLANK BLINK BLOCK BOOLEAN BOTTOM " +
+      "BY CALL CANCEL CD CF " +
+      "CH CHARACTER CHARACTERS CLASS CLOCK-UNITS " +
+      "CLOSE COBOL CODE CODE-SET COL " +
+      "COLLATING COLUMN COMMA COMMIT COMMITMENT " +
+      "COMMON COMMUNICATION COMP COMP-0 COMP-1 " +
+      "COMP-2 COMP-3 COMP-4 COMP-5 COMP-6 " +
+      "COMP-7 COMP-8 COMP-9 COMPUTATIONAL COMPUTATIONAL-0 " +
+      "COMPUTATIONAL-1 COMPUTATIONAL-2 COMPUTATIONAL-3 COMPUTATIONAL-4 COMPUTATIONAL-5 " +
+      "COMPUTATIONAL-6 COMPUTATIONAL-7 COMPUTATIONAL-8 COMPUTATIONAL-9 COMPUTE " +
+      "CONFIGURATION CONNECT CONSOLE CONTAINED CONTAINS " +
+      "CONTENT CONTINUE CONTROL CONTROL-AREA CONTROLS " +
+      "CONVERTING COPY CORR CORRESPONDING COUNT " +
+      "CRT CRT-UNDER CURRENCY CURRENT CURSOR " +
+      "DATA DATE DATE-COMPILED DATE-WRITTEN DAY " +
+      "DAY-OF-WEEK DB DB-ACCESS-CONTROL-KEY DB-DATA-NAME DB-EXCEPTION " +
+      "DB-FORMAT-NAME DB-RECORD-NAME DB-SET-NAME DB-STATUS DBCS " +
+      "DBCS-EDITED DE DEBUG-CONTENTS DEBUG-ITEM DEBUG-LINE " +
+      "DEBUG-NAME DEBUG-SUB-1 DEBUG-SUB-2 DEBUG-SUB-3 DEBUGGING " +
+      "DECIMAL-POINT DECLARATIVES DEFAULT DELETE DELIMITED " +
+      "DELIMITER DEPENDING DESCENDING DESCRIBED DESTINATION " +
+      "DETAIL DISABLE DISCONNECT DISPLAY DISPLAY-1 " +
+      "DISPLAY-2 DISPLAY-3 DISPLAY-4 DISPLAY-5 DISPLAY-6 " +
+      "DISPLAY-7 DISPLAY-8 DISPLAY-9 DIVIDE DIVISION " +
+      "DOWN DROP DUPLICATE DUPLICATES DYNAMIC " +
+      "EBCDIC EGI EJECT ELSE EMI " +
+      "EMPTY EMPTY-CHECK ENABLE END END. END-ACCEPT END-ACCEPT. " +
+      "END-ADD END-CALL END-COMPUTE END-DELETE END-DISPLAY " +
+      "END-DIVIDE END-EVALUATE END-IF END-INVOKE END-MULTIPLY " +
+      "END-OF-PAGE END-PERFORM END-READ END-RECEIVE END-RETURN " +
+      "END-REWRITE END-SEARCH END-START END-STRING END-SUBTRACT " +
+      "END-UNSTRING END-WRITE END-XML ENTER ENTRY " +
+      "ENVIRONMENT EOP EQUAL EQUALS ERASE " +
+      "ERROR ESI EVALUATE EVERY EXCEEDS " +
+      "EXCEPTION EXCLUSIVE EXIT EXTEND EXTERNAL " +
+      "EXTERNALLY-DESCRIBED-KEY FD FETCH FILE FILE-CONTROL " +
+      "FILE-STREAM FILES FILLER FINAL FIND " +
+      "FINISH FIRST FOOTING FOR FOREGROUND-COLOR " +
+      "FOREGROUND-COLOUR FORMAT FREE FROM FULL " +
+      "FUNCTION GENERATE GET GIVING GLOBAL " +
+      "GO GOBACK GREATER GROUP HEADING " +
+      "HIGH-VALUE HIGH-VALUES HIGHLIGHT I-O I-O-CONTROL " +
+      "ID IDENTIFICATION IF IN INDEX " +
+      "INDEX-1 INDEX-2 INDEX-3 INDEX-4 INDEX-5 " +
+      "INDEX-6 INDEX-7 INDEX-8 INDEX-9 INDEXED " +
+      "INDIC INDICATE INDICATOR INDICATORS INITIAL " +
+      "INITIALIZE INITIATE INPUT INPUT-OUTPUT INSPECT " +
+      "INSTALLATION INTO INVALID INVOKE IS " +
+      "JUST JUSTIFIED KANJI KEEP KEY " +
+      "LABEL LAST LD LEADING LEFT " +
+      "LEFT-JUSTIFY LENGTH LENGTH-CHECK LESS LIBRARY " +
+      "LIKE LIMIT LIMITS LINAGE LINAGE-COUNTER " +
+      "LINE LINE-COUNTER LINES LINKAGE LOCAL-STORAGE " +
+      "LOCALE LOCALLY LOCK " +
+      "MEMBER MEMORY MERGE MESSAGE METACLASS " +
+      "MODE MODIFIED MODIFY MODULES MOVE " +
+      "MULTIPLE MULTIPLY NATIONAL NATIVE NEGATIVE " +
+      "NEXT NO NO-ECHO NONE NOT " +
+      "NULL NULL-KEY-MAP NULL-MAP NULLS NUMBER " +
+      "NUMERIC NUMERIC-EDITED OBJECT OBJECT-COMPUTER OCCURS " +
+      "OF OFF OMITTED ON ONLY " +
+      "OPEN OPTIONAL OR ORDER ORGANIZATION " +
+      "OTHER OUTPUT OVERFLOW OWNER PACKED-DECIMAL " +
+      "PADDING PAGE PAGE-COUNTER PARSE PERFORM " +
+      "PF PH PIC PICTURE PLUS " +
+      "POINTER POSITION POSITIVE PREFIX PRESENT " +
+      "PRINTING PRIOR PROCEDURE PROCEDURE-POINTER PROCEDURES " +
+      "PROCEED PROCESS PROCESSING PROGRAM PROGRAM-ID " +
+      "PROMPT PROTECTED PURGE QUEUE QUOTE " +
+      "QUOTES RANDOM RD READ READY " +
+      "REALM RECEIVE RECONNECT RECORD RECORD-NAME " +
+      "RECORDS RECURSIVE REDEFINES REEL REFERENCE " +
+      "REFERENCE-MONITOR REFERENCES RELATION RELATIVE RELEASE " +
+      "REMAINDER REMOVAL RENAMES REPEATED REPLACE " +
+      "REPLACING REPORT REPORTING REPORTS REPOSITORY " +
+      "REQUIRED RERUN RESERVE RESET RETAINING " +
+      "RETRIEVAL RETURN RETURN-CODE RETURNING REVERSE-VIDEO " +
+      "REVERSED REWIND REWRITE RF RH " +
+      "RIGHT RIGHT-JUSTIFY ROLLBACK ROLLING ROUNDED " +
+      "RUN SAME SCREEN SD SEARCH " +
+      "SECTION SECURE SECURITY SEGMENT SEGMENT-LIMIT " +
+      "SELECT SEND SENTENCE SEPARATE SEQUENCE " +
+      "SEQUENTIAL SET SHARED SIGN SIZE " +
+      "SKIP1 SKIP2 SKIP3 SORT SORT-MERGE " +
+      "SORT-RETURN SOURCE SOURCE-COMPUTER SPACE-FILL " +
+      "SPECIAL-NAMES STANDARD STANDARD-1 STANDARD-2 " +
+      "START STARTING STATUS STOP STORE " +
+      "STRING SUB-QUEUE-1 SUB-QUEUE-2 SUB-QUEUE-3 SUB-SCHEMA " +
+      "SUBFILE SUBSTITUTE SUBTRACT SUM SUPPRESS " +
+      "SYMBOLIC SYNC SYNCHRONIZED SYSIN SYSOUT " +
+      "TABLE TALLYING TAPE TENANT TERMINAL " +
+      "TERMINATE TEST TEXT THAN THEN " +
+      "THROUGH THRU TIME TIMES TITLE " +
+      "TO TOP TRAILING TRAILING-SIGN TRANSACTION " +
+      "TYPE TYPEDEF UNDERLINE UNEQUAL UNIT " +
+      "UNSTRING UNTIL UP UPDATE UPON " +
+      "USAGE USAGE-MODE USE USING VALID " +
+      "VALIDATE VALUE VALUES VARYING VLR " +
+      "WAIT WHEN WHEN-COMPILED WITH WITHIN " +
+      "WORDS WORKING-STORAGE WRITE XML XML-CODE " +
+      "XML-EVENT XML-NTEXT XML-TEXT ZERO ZERO-FILL " );
+
+  var builtins = makeKeywords("- * ** / + < <= = > >= ");
+  var tests = {
+    digit: /\d/,
+    digit_or_colon: /[\d:]/,
+    hex: /[0-9a-f]/i,
+    sign: /[+-]/,
+    exponent: /e/i,
+    keyword_char: /[^\s\(\[\;\)\]]/,
+    symbol: /[\w*+\-]/
+  };
+  function isNumber(ch, stream){
+    // hex
+    if ( ch === '0' && stream.eat(/x/i) ) {
+      stream.eatWhile(tests.hex);
+      return true;
+    }
+    // leading sign
+    if ( ( ch == '+' || ch == '-' ) && ( tests.digit.test(stream.peek()) ) ) {
+      stream.eat(tests.sign);
+      ch = stream.next();
+    }
+    if ( tests.digit.test(ch) ) {
+      stream.eat(ch);
+      stream.eatWhile(tests.digit);
+      if ( '.' == stream.peek()) {
+        stream.eat('.');
+        stream.eatWhile(tests.digit);
+      }
+      if ( stream.eat(tests.exponent) ) {
+        stream.eat(tests.sign);
+        stream.eatWhile(tests.digit);
+      }
+      return true;
+    }
+    return false;
+  }
+  return {
+    startState: function () {
+      return {
+        indentStack: null,
+        indentation: 0,
+        mode: false
+      };
+    },
+    token: function (stream, state) {
+      if (state.indentStack == null && stream.sol()) {
+        // update indentation, but only if indentStack is empty
+        state.indentation = 6 ; //stream.indentation();
+      }
+      // skip spaces
+      if (stream.eatSpace()) {
+        return null;
+      }
+      var returnType = null;
+      switch(state.mode){
+      case "string": // multi-line string parsing mode
+        var next = false;
+        while ((next = stream.next()) != null) {
+          if ((next == "\"" || next == "\'") && !stream.match(/['"]/, false)) {
+            state.mode = false;
+            break;
+          }
+        }
+        returnType = STRING; // continue on in string mode
+        break;
+      default: // default parsing mode
+        var ch = stream.next();
+        var col = stream.column();
+        if (col >= 0 && col <= 5) {
+          returnType = COBOLLINENUM;
+        } else if (col >= 72 && col <= 79) {
+          stream.skipToEnd();
+          returnType = MODTAG;
+        } else if (ch == "*" && col == 6) { // comment
+          stream.skipToEnd(); // rest of the line is a comment
+          returnType = COMMENT;
+        } else if (ch == "\"" || ch == "\'") {
+          state.mode = "string";
+          returnType = STRING;
+        } else if (ch == "'" && !( tests.digit_or_colon.test(stream.peek()) )) {
+          returnType = ATOM;
+        } else if (ch == ".") {
+          returnType = PERIOD;
+        } else if (isNumber(ch,stream)){
+          returnType = NUMBER;
+        } else {
+          if (stream.current().match(tests.symbol)) {
+            while (col < 71) {
+              if (stream.eat(tests.symbol) === undefined) {
+                break;
+              } else {
+                col++;
+              }
+            }
+          }
+          if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
+            returnType = KEYWORD;
+          } else if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase())) {
+            returnType = BUILTIN;
+          } else if (atoms && atoms.propertyIsEnumerable(stream.current().toUpperCase())) {
+            returnType = ATOM;
+          } else returnType = null;
+        }
+      }
+      return returnType;
+    },
+    indent: function (state) {
+      if (state.indentStack == null) return state.indentation;
+      return state.indentStack.indent;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-cobol", "cobol");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cobol/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,210 @@
+<!doctype html>
+
+<title>CodeMirror: COBOL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/neat.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<link rel="stylesheet" href="../../theme/erlang-dark.css">
+<link rel="stylesheet" href="../../theme/night.css">
+<link rel="stylesheet" href="../../theme/monokai.css">
+<link rel="stylesheet" href="../../theme/cobalt.css">
+<link rel="stylesheet" href="../../theme/eclipse.css">
+<link rel="stylesheet" href="../../theme/rubyblue.css">
+<link rel="stylesheet" href="../../theme/lesser-dark.css">
+<link rel="stylesheet" href="../../theme/xq-dark.css">
+<link rel="stylesheet" href="../../theme/xq-light.css">
+<link rel="stylesheet" href="../../theme/ambiance.css">
+<link rel="stylesheet" href="../../theme/blackboard.css">
+<link rel="stylesheet" href="../../theme/vibrant-ink.css">
+<link rel="stylesheet" href="../../theme/solarized.css">
+<link rel="stylesheet" href="../../theme/twilight.css">
+<link rel="stylesheet" href="../../theme/midnight.css">
+<link rel="stylesheet" href="../../addon/dialog/dialog.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="cobol.js"></script>
+<script src="../../addon/selection/active-line.js"></script>
+<script src="../../addon/search/search.js"></script>
+<script src="../../addon/dialog/dialog.js"></script>
+<script src="../../addon/search/searchcursor.js"></script>
+<style>
+        .CodeMirror {
+          border: 1px solid #eee;
+          font-size : 20px;
+          height : auto !important;
+        }
+        .CodeMirror-activeline-background {background: #555555 !important;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">COBOL</a>
+  </ul>
+</div>
+
+<article>
+<h2>COBOL mode</h2>
+
+    <p> Select Theme <select onchange="selectTheme()" id="selectTheme">
+        <option>default</option>
+        <option>ambiance</option>
+        <option>blackboard</option>
+        <option>cobalt</option>
+        <option>eclipse</option>
+        <option>elegant</option>
+        <option>erlang-dark</option>
+        <option>lesser-dark</option>
+        <option>midnight</option>
+        <option>monokai</option>
+        <option>neat</option>
+        <option>night</option>
+        <option>rubyblue</option>
+        <option>solarized dark</option>
+        <option>solarized light</option>
+        <option selected>twilight</option>
+        <option>vibrant-ink</option>
+        <option>xq-dark</option>
+        <option>xq-light</option>
+    </select>    Select Font Size <select onchange="selectFontsize()" id="selectFontSize">
+          <option value="13px">13px</option>
+          <option value="14px">14px</option>
+          <option value="16px">16px</option>
+          <option value="18px">18px</option>
+          <option value="20px" selected="selected">20px</option>
+          <option value="24px">24px</option>
+          <option value="26px">26px</option>
+          <option value="28px">28px</option>
+          <option value="30px">30px</option>
+          <option value="32px">32px</option>
+          <option value="34px">34px</option>
+          <option value="36px">36px</option>
+        </select>
+<label for="checkBoxReadOnly">Read-only</label>
+<input type="checkbox" id="checkBoxReadOnly" onchange="selectReadOnly()">
+<label for="id_tabToIndentSpace">Insert Spaces on Tab</label>
+<input type="checkbox" id="id_tabToIndentSpace" onchange="tabToIndentSpace()">
+</p>
+<textarea id="code" name="code">
+---------1---------2---------3---------4---------5---------6---------7---------8
+12345678911234567892123456789312345678941234567895123456789612345678971234567898
+000010 IDENTIFICATION DIVISION.                                        MODTGHERE
+000020 PROGRAM-ID.       SAMPLE.
+000030 AUTHOR.           TEST SAM. 
+000040 DATE-WRITTEN.     5 February 2013
+000041
+000042* A sample program just to show the form.
+000043* The program copies its input to the output,
+000044* and counts the number of records.
+000045* At the end this number is printed.
+000046
+000050 ENVIRONMENT DIVISION.
+000060 INPUT-OUTPUT SECTION.
+000070 FILE-CONTROL.
+000080     SELECT STUDENT-FILE     ASSIGN TO SYSIN
+000090         ORGANIZATION IS LINE SEQUENTIAL.
+000100     SELECT PRINT-FILE       ASSIGN TO SYSOUT
+000110         ORGANIZATION IS LINE SEQUENTIAL.
+000120
+000130 DATA DIVISION.
+000140 FILE SECTION.
+000150 FD  STUDENT-FILE
+000160     RECORD CONTAINS 43 CHARACTERS
+000170     DATA RECORD IS STUDENT-IN.
+000180 01  STUDENT-IN              PIC X(43).
+000190
+000200 FD  PRINT-FILE
+000210     RECORD CONTAINS 80 CHARACTERS
+000220     DATA RECORD IS PRINT-LINE.
+000230 01  PRINT-LINE              PIC X(80).
+000240
+000250 WORKING-STORAGE SECTION.
+000260 01  DATA-REMAINS-SWITCH     PIC X(2)      VALUE SPACES.
+000261 01  RECORDS-WRITTEN         PIC 99.
+000270
+000280 01  DETAIL-LINE.
+000290     05  FILLER              PIC X(7)      VALUE SPACES.
+000300     05  RECORD-IMAGE        PIC X(43).
+000310     05  FILLER              PIC X(30)     VALUE SPACES.
+000311 
+000312 01  SUMMARY-LINE.
+000313     05  FILLER              PIC X(7)      VALUE SPACES.
+000314     05  TOTAL-READ          PIC 99.
+000315     05  FILLER              PIC X         VALUE SPACE.
+000316     05  FILLER              PIC X(17)     
+000317                 VALUE  'Records were read'.
+000318     05  FILLER              PIC X(53)     VALUE SPACES.
+000319
+000320 PROCEDURE DIVISION.
+000321
+000330 PREPARE-SENIOR-REPORT.
+000340     OPEN INPUT  STUDENT-FILE
+000350          OUTPUT PRINT-FILE.
+000351     MOVE ZERO TO RECORDS-WRITTEN.
+000360     READ STUDENT-FILE
+000370         AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
+000380     END-READ.
+000390     PERFORM PROCESS-RECORDS
+000410         UNTIL DATA-REMAINS-SWITCH = 'NO'.
+000411     PERFORM PRINT-SUMMARY.
+000420     CLOSE STUDENT-FILE
+000430           PRINT-FILE.
+000440     STOP RUN.
+000450
+000460 PROCESS-RECORDS.
+000470     MOVE STUDENT-IN TO RECORD-IMAGE.
+000480     MOVE DETAIL-LINE TO PRINT-LINE.
+000490     WRITE PRINT-LINE.
+000500     ADD 1 TO RECORDS-WRITTEN.
+000510     READ STUDENT-FILE
+000520         AT END MOVE 'NO' TO DATA-REMAINS-SWITCH
+000530     END-READ. 
+000540
+000550 PRINT-SUMMARY.
+000560     MOVE RECORDS-WRITTEN TO TOTAL-READ.
+000570     MOVE SUMMARY-LINE TO PRINT-LINE.
+000571     WRITE PRINT-LINE. 
+000572
+000580
+</textarea>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-cobol",
+        theme : "twilight",
+        styleActiveLine: true,
+        showCursorWhenSelecting : true,  
+      });
+      function selectTheme() {
+        var themeInput = document.getElementById("selectTheme");
+        var theme = themeInput.options[themeInput.selectedIndex].innerHTML;
+        editor.setOption("theme", theme);
+      }
+      function selectFontsize() {
+        var fontSizeInput = document.getElementById("selectFontSize");
+        var fontSize = fontSizeInput.options[fontSizeInput.selectedIndex].innerHTML;
+        editor.getWrapperElement().style.fontSize = fontSize;
+        editor.refresh();
+      }
+      function selectReadOnly() {
+        editor.setOption("readOnly", document.getElementById("checkBoxReadOnly").checked);
+      }
+      function tabToIndentSpace() {
+        if (document.getElementById("id_tabToIndentSpace").checked) {
+            editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection("    ", "end"); }});
+        } else {
+            editor.setOption("extraKeys", {Tab: function(cm) { cm.replaceSelection("    ", "end"); }});
+        }
+      }
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/coffeescript/coffeescript.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,359 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Link to the project's GitHub page:
+ * https://github.com/pickhardt/coffeescript-codemirror-mode
+ */
+(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.defineMode("coffeescript", function(conf, parserConf) {
+  var ERRORCLASS = "error";
+
+  function wordRegexp(words) {
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
+  }
+
+  var operators = /^(?:->|=>|\+[+=]?|-[\-=]?|\*[\*=]?|\/[\/=]?|[=!]=|<[><]?=?|>>?=?|%=?|&=?|\|=?|\^=?|\~|!|\?|(or|and|\|\||&&|\?)=)/;
+  var delimiters = /^(?:[()\[\]{},:`=;]|\.\.?\.?)/;
+  var identifiers = /^[_A-Za-z$][_A-Za-z$0-9]*/;
+  var atProp = /^@[_A-Za-z$][_A-Za-z$0-9]*/;
+
+  var wordOperators = wordRegexp(["and", "or", "not",
+                                  "is", "isnt", "in",
+                                  "instanceof", "typeof"]);
+  var indentKeywords = ["for", "while", "loop", "if", "unless", "else",
+                        "switch", "try", "catch", "finally", "class"];
+  var commonKeywords = ["break", "by", "continue", "debugger", "delete",
+                        "do", "in", "of", "new", "return", "then",
+                        "this", "@", "throw", "when", "until", "extends"];
+
+  var keywords = wordRegexp(indentKeywords.concat(commonKeywords));
+
+  indentKeywords = wordRegexp(indentKeywords);
+
+
+  var stringPrefixes = /^('{3}|\"{3}|['\"])/;
+  var regexPrefixes = /^(\/{3}|\/)/;
+  var commonConstants = ["Infinity", "NaN", "undefined", "null", "true", "false", "on", "off", "yes", "no"];
+  var constants = wordRegexp(commonConstants);
+
+  // Tokenizers
+  function tokenBase(stream, state) {
+    // Handle scope changes
+    if (stream.sol()) {
+      if (state.scope.align === null) state.scope.align = false;
+      var scopeOffset = state.scope.offset;
+      if (stream.eatSpace()) {
+        var lineOffset = stream.indentation();
+        if (lineOffset > scopeOffset && state.scope.type == "coffee") {
+          return "indent";
+        } else if (lineOffset < scopeOffset) {
+          return "dedent";
+        }
+        return null;
+      } else {
+        if (scopeOffset > 0) {
+          dedent(stream, state);
+        }
+      }
+    }
+    if (stream.eatSpace()) {
+      return null;
+    }
+
+    var ch = stream.peek();
+
+    // Handle docco title comment (single line)
+    if (stream.match("####")) {
+      stream.skipToEnd();
+      return "comment";
+    }
+
+    // Handle multi line comments
+    if (stream.match("###")) {
+      state.tokenize = longComment;
+      return state.tokenize(stream, state);
+    }
+
+    // Single line comment
+    if (ch === "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+
+    // Handle number literals
+    if (stream.match(/^-?[0-9\.]/, false)) {
+      var floatLiteral = false;
+      // Floats
+      if (stream.match(/^-?\d*\.\d+(e[\+\-]?\d+)?/i)) {
+        floatLiteral = true;
+      }
+      if (stream.match(/^-?\d+\.\d*/)) {
+        floatLiteral = true;
+      }
+      if (stream.match(/^-?\.\d+/)) {
+        floatLiteral = true;
+      }
+
+      if (floatLiteral) {
+        // prevent from getting extra . on 1..
+        if (stream.peek() == "."){
+          stream.backUp(1);
+        }
+        return "number";
+      }
+      // Integers
+      var intLiteral = false;
+      // Hex
+      if (stream.match(/^-?0x[0-9a-f]+/i)) {
+        intLiteral = true;
+      }
+      // Decimal
+      if (stream.match(/^-?[1-9]\d*(e[\+\-]?\d+)?/)) {
+        intLiteral = true;
+      }
+      // Zero by itself with no other piece of number.
+      if (stream.match(/^-?0(?![\dx])/i)) {
+        intLiteral = true;
+      }
+      if (intLiteral) {
+        return "number";
+      }
+    }
+
+    // Handle strings
+    if (stream.match(stringPrefixes)) {
+      state.tokenize = tokenFactory(stream.current(), false, "string");
+      return state.tokenize(stream, state);
+    }
+    // Handle regex literals
+    if (stream.match(regexPrefixes)) {
+      if (stream.current() != "/" || stream.match(/^.*\//, false)) { // prevent highlight of division
+        state.tokenize = tokenFactory(stream.current(), true, "string-2");
+        return state.tokenize(stream, state);
+      } else {
+        stream.backUp(1);
+      }
+    }
+
+
+
+    // Handle operators and delimiters
+    if (stream.match(operators) || stream.match(wordOperators)) {
+      return "operator";
+    }
+    if (stream.match(delimiters)) {
+      return "punctuation";
+    }
+
+    if (stream.match(constants)) {
+      return "atom";
+    }
+
+    if (stream.match(atProp) || state.prop && stream.match(identifiers)) {
+      return "property";
+    }
+
+    if (stream.match(keywords)) {
+      return "keyword";
+    }
+
+    if (stream.match(identifiers)) {
+      return "variable";
+    }
+
+    // Handle non-detected items
+    stream.next();
+    return ERRORCLASS;
+  }
+
+  function tokenFactory(delimiter, singleline, outclass) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        stream.eatWhile(/[^'"\/\\]/);
+        if (stream.eat("\\")) {
+          stream.next();
+          if (singleline && stream.eol()) {
+            return outclass;
+          }
+        } else if (stream.match(delimiter)) {
+          state.tokenize = tokenBase;
+          return outclass;
+        } else {
+          stream.eat(/['"\/]/);
+        }
+      }
+      if (singleline) {
+        if (parserConf.singleLineStringErrors) {
+          outclass = ERRORCLASS;
+        } else {
+          state.tokenize = tokenBase;
+        }
+      }
+      return outclass;
+    };
+  }
+
+  function longComment(stream, state) {
+    while (!stream.eol()) {
+      stream.eatWhile(/[^#]/);
+      if (stream.match("###")) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      stream.eatWhile("#");
+    }
+    return "comment";
+  }
+
+  function indent(stream, state, type) {
+    type = type || "coffee";
+    var offset = 0, align = false, alignOffset = null;
+    for (var scope = state.scope; scope; scope = scope.prev) {
+      if (scope.type === "coffee" || scope.type == "}") {
+        offset = scope.offset + conf.indentUnit;
+        break;
+      }
+    }
+    if (type !== "coffee") {
+      align = null;
+      alignOffset = stream.column() + stream.current().length;
+    } else if (state.scope.align) {
+      state.scope.align = false;
+    }
+    state.scope = {
+      offset: offset,
+      type: type,
+      prev: state.scope,
+      align: align,
+      alignOffset: alignOffset
+    };
+  }
+
+  function dedent(stream, state) {
+    if (!state.scope.prev) return;
+    if (state.scope.type === "coffee") {
+      var _indent = stream.indentation();
+      var matched = false;
+      for (var scope = state.scope; scope; scope = scope.prev) {
+        if (_indent === scope.offset) {
+          matched = true;
+          break;
+        }
+      }
+      if (!matched) {
+        return true;
+      }
+      while (state.scope.prev && state.scope.offset !== _indent) {
+        state.scope = state.scope.prev;
+      }
+      return false;
+    } else {
+      state.scope = state.scope.prev;
+      return false;
+    }
+  }
+
+  function tokenLexer(stream, state) {
+    var style = state.tokenize(stream, state);
+    var current = stream.current();
+
+    // Handle scope changes.
+    if (current === "return") {
+      state.dedent = true;
+    }
+    if (((current === "->" || current === "=>") && stream.eol())
+        || style === "indent") {
+      indent(stream, state);
+    }
+    var delimiter_index = "[({".indexOf(current);
+    if (delimiter_index !== -1) {
+      indent(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
+    }
+    if (indentKeywords.exec(current)){
+      indent(stream, state);
+    }
+    if (current == "then"){
+      dedent(stream, state);
+    }
+
+
+    if (style === "dedent") {
+      if (dedent(stream, state)) {
+        return ERRORCLASS;
+      }
+    }
+    delimiter_index = "])}".indexOf(current);
+    if (delimiter_index !== -1) {
+      while (state.scope.type == "coffee" && state.scope.prev)
+        state.scope = state.scope.prev;
+      if (state.scope.type == current)
+        state.scope = state.scope.prev;
+    }
+    if (state.dedent && stream.eol()) {
+      if (state.scope.type == "coffee" && state.scope.prev)
+        state.scope = state.scope.prev;
+      state.dedent = false;
+    }
+
+    return style;
+  }
+
+  var external = {
+    startState: function(basecolumn) {
+      return {
+        tokenize: tokenBase,
+        scope: {offset:basecolumn || 0, type:"coffee", prev: null, align: false},
+        prop: false,
+        dedent: 0
+      };
+    },
+
+    token: function(stream, state) {
+      var fillAlign = state.scope.align === null && state.scope;
+      if (fillAlign && stream.sol()) fillAlign.align = false;
+
+      var style = tokenLexer(stream, state);
+      if (style && style != "comment") {
+        if (fillAlign) fillAlign.align = true;
+        state.prop = style == "punctuation" && stream.current() == "."
+      }
+
+      return style;
+    },
+
+    indent: function(state, text) {
+      if (state.tokenize != tokenBase) return 0;
+      var scope = state.scope;
+      var closer = text && "])}".indexOf(text.charAt(0)) > -1;
+      if (closer) while (scope.type == "coffee" && scope.prev) scope = scope.prev;
+      var closes = closer && scope.type === text.charAt(0);
+      if (scope.align)
+        return scope.alignOffset - (closes ? 1 : 0);
+      else
+        return (closes ? scope.prev : scope).offset;
+    },
+
+    lineComment: "#",
+    fold: "indent"
+  };
+  return external;
+});
+
+// IANA registered media type
+// https://www.iana.org/assignments/media-types/
+CodeMirror.defineMIME("application/vnd.coffeescript", "coffeescript");
+
+CodeMirror.defineMIME("text/x-coffeescript", "coffeescript");
+CodeMirror.defineMIME("text/coffeescript", "coffeescript");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/coffeescript/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,740 @@
+<!doctype html>
+
+<title>CodeMirror: CoffeeScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="coffeescript.js"></script>
+<style>.CodeMirror {border-top: 1px solid silver; border-bottom: 1px solid silver;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">CoffeeScript</a>
+  </ul>
+</div>
+
+<article>
+<h2>CoffeeScript mode</h2>
+<form><textarea id="code" name="code">
+# CoffeeScript mode for CodeMirror
+# Copyright (c) 2011 Jeff Pickhardt, released under
+# the MIT License.
+#
+# Modified from the Python CodeMirror mode, which also is 
+# under the MIT License Copyright (c) 2010 Timothy Farrell.
+#
+# The following script, Underscore.coffee, is used to 
+# demonstrate CoffeeScript mode for CodeMirror.
+#
+# To download CoffeeScript mode for CodeMirror, go to:
+# https://github.com/pickhardt/coffeescript-codemirror-mode
+
+# **Underscore.coffee
+# (c) 2011 Jeremy Ashkenas, DocumentCloud Inc.**
+# Underscore is freely distributable under the terms of the
+# [MIT license](http://en.wikipedia.org/wiki/MIT_License).
+# Portions of Underscore are inspired by or borrowed from
+# [Prototype.js](http://prototypejs.org/api), Oliver Steele's
+# [Functional](http://osteele.com), and John Resig's
+# [Micro-Templating](http://ejohn.org).
+# For all details and documentation:
+# http://documentcloud.github.com/underscore/
+
+
+# Baseline setup
+# --------------
+
+# Establish the root object, `window` in the browser, or `global` on the server.
+root = this
+
+
+# Save the previous value of the `_` variable.
+previousUnderscore = root._
+
+### Multiline
+    comment
+###
+
+# Establish the object that gets thrown to break out of a loop iteration.
+# `StopIteration` is SOP on Mozilla.
+breaker = if typeof(StopIteration) is 'undefined' then '__break__' else StopIteration
+
+
+#### Docco style single line comment (title)
+
+
+# Helper function to escape **RegExp** contents, because JS doesn't have one.
+escapeRegExp = (string) -> string.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1')
+
+
+# Save bytes in the minified (but not gzipped) version:
+ArrayProto = Array.prototype
+ObjProto = Object.prototype
+
+
+# Create quick reference variables for speed access to core prototypes.
+slice = ArrayProto.slice
+unshift = ArrayProto.unshift
+toString = ObjProto.toString
+hasOwnProperty = ObjProto.hasOwnProperty
+propertyIsEnumerable = ObjProto.propertyIsEnumerable
+
+
+# All **ECMA5** native implementations we hope to use are declared here.
+nativeForEach = ArrayProto.forEach
+nativeMap = ArrayProto.map
+nativeReduce = ArrayProto.reduce
+nativeReduceRight = ArrayProto.reduceRight
+nativeFilter = ArrayProto.filter
+nativeEvery = ArrayProto.every
+nativeSome = ArrayProto.some
+nativeIndexOf = ArrayProto.indexOf
+nativeLastIndexOf = ArrayProto.lastIndexOf
+nativeIsArray = Array.isArray
+nativeKeys = Object.keys
+
+
+# Create a safe reference to the Underscore object for use below.
+_ = (obj) -> new wrapper(obj)
+
+
+# Export the Underscore object for **CommonJS**.
+if typeof(exports) != 'undefined' then exports._ = _
+
+
+# Export Underscore to global scope.
+root._ = _
+
+
+# Current version.
+_.VERSION = '1.1.0'
+
+
+# Collection Functions
+# --------------------
+
+# The cornerstone, an **each** implementation.
+# Handles objects implementing **forEach**, arrays, and raw objects.
+_.each = (obj, iterator, context) ->
+  try
+    if nativeForEach and obj.forEach is nativeForEach
+      obj.forEach iterator, context
+    else if _.isNumber obj.length
+      iterator.call context, obj[i], i, obj for i in [0...obj.length]
+    else
+      iterator.call context, val, key, obj for own key, val of obj
+  catch e
+    throw e if e isnt breaker
+  obj
+
+
+# Return the results of applying the iterator to each element. Use JavaScript
+# 1.6's version of **map**, if possible.
+_.map = (obj, iterator, context) ->
+  return obj.map(iterator, context) if nativeMap and obj.map is nativeMap
+  results = []
+  _.each obj, (value, index, list) ->
+    results.push iterator.call context, value, index, list
+  results
+
+
+# **Reduce** builds up a single result from a list of values. Also known as
+# **inject**, or **foldl**. Uses JavaScript 1.8's version of **reduce**, if possible.
+_.reduce = (obj, iterator, memo, context) ->
+  if nativeReduce and obj.reduce is nativeReduce
+    iterator = _.bind iterator, context if context
+    return obj.reduce iterator, memo
+  _.each obj, (value, index, list) ->
+    memo = iterator.call context, memo, value, index, list
+  memo
+
+
+# The right-associative version of **reduce**, also known as **foldr**. Uses
+# JavaScript 1.8's version of **reduceRight**, if available.
+_.reduceRight = (obj, iterator, memo, context) ->
+  if nativeReduceRight and obj.reduceRight is nativeReduceRight
+    iterator = _.bind iterator, context if context
+    return obj.reduceRight iterator, memo
+  reversed = _.clone(_.toArray(obj)).reverse()
+  _.reduce reversed, iterator, memo, context
+
+
+# Return the first value which passes a truth test.
+_.detect = (obj, iterator, context) ->
+  result = null
+  _.each obj, (value, index, list) ->
+    if iterator.call context, value, index, list
+      result = value
+      _.breakLoop()
+  result
+
+
+# Return all the elements that pass a truth test. Use JavaScript 1.6's
+# **filter**, if it exists.
+_.filter = (obj, iterator, context) ->
+  return obj.filter iterator, context if nativeFilter and obj.filter is nativeFilter
+  results = []
+  _.each obj, (value, index, list) ->
+    results.push value if iterator.call context, value, index, list
+  results
+
+
+# Return all the elements for which a truth test fails.
+_.reject = (obj, iterator, context) ->
+  results = []
+  _.each obj, (value, index, list) ->
+    results.push value if not iterator.call context, value, index, list
+  results
+
+
+# Determine whether all of the elements match a truth test. Delegate to
+# JavaScript 1.6's **every**, if it is present.
+_.every = (obj, iterator, context) ->
+  iterator ||= _.identity
+  return obj.every iterator, context if nativeEvery and obj.every is nativeEvery
+  result = true
+  _.each obj, (value, index, list) ->
+    _.breakLoop() unless (result = result and iterator.call(context, value, index, list))
+  result
+
+
+# Determine if at least one element in the object matches a truth test. Use
+# JavaScript 1.6's **some**, if it exists.
+_.some = (obj, iterator, context) ->
+  iterator ||= _.identity
+  return obj.some iterator, context if nativeSome and obj.some is nativeSome
+  result = false
+  _.each obj, (value, index, list) ->
+    _.breakLoop() if (result = iterator.call(context, value, index, list))
+  result
+
+
+# Determine if a given value is included in the array or object,
+# based on `===`.
+_.include = (obj, target) ->
+  return _.indexOf(obj, target) isnt -1 if nativeIndexOf and obj.indexOf is nativeIndexOf
+  return true for own key, val of obj when val is target
+  false
+
+
+# Invoke a method with arguments on every item in a collection.
+_.invoke = (obj, method) ->
+  args = _.rest arguments, 2
+  (if method then val[method] else val).apply(val, args) for val in obj
+
+
+# Convenience version of a common use case of **map**: fetching a property.
+_.pluck = (obj, key) ->
+  _.map(obj, (val) -> val[key])
+
+
+# Return the maximum item or (item-based computation).
+_.max = (obj, iterator, context) ->
+  return Math.max.apply(Math, obj) if not iterator and _.isArray(obj)
+  result = computed: -Infinity
+  _.each obj, (value, index, list) ->
+    computed = if iterator then iterator.call(context, value, index, list) else value
+    computed >= result.computed and (result = {value: value, computed: computed})
+  result.value
+
+
+# Return the minimum element (or element-based computation).
+_.min = (obj, iterator, context) ->
+  return Math.min.apply(Math, obj) if not iterator and _.isArray(obj)
+  result = computed: Infinity
+  _.each obj, (value, index, list) ->
+    computed = if iterator then iterator.call(context, value, index, list) else value
+    computed < result.computed and (result = {value: value, computed: computed})
+  result.value
+
+
+# Sort the object's values by a criterion produced by an iterator.
+_.sortBy = (obj, iterator, context) ->
+  _.pluck(((_.map obj, (value, index, list) ->
+    {value: value, criteria: iterator.call(context, value, index, list)}
+  ).sort((left, right) ->
+    a = left.criteria; b = right.criteria
+    if a < b then -1 else if a > b then 1 else 0
+  )), 'value')
+
+
+# Use a comparator function to figure out at what index an object should
+# be inserted so as to maintain order. Uses binary search.
+_.sortedIndex = (array, obj, iterator) ->
+  iterator ||= _.identity
+  low = 0
+  high = array.length
+  while low < high
+    mid = (low + high) >> 1
+    if iterator(array[mid]) < iterator(obj) then low = mid + 1 else high = mid
+  low
+
+
+# Convert anything iterable into a real, live array.
+_.toArray = (iterable) ->
+  return [] if (!iterable)
+  return iterable.toArray() if (iterable.toArray)
+  return iterable if (_.isArray(iterable))
+  return slice.call(iterable) if (_.isArguments(iterable))
+  _.values(iterable)
+
+
+# Return the number of elements in an object.
+_.size = (obj) -> _.toArray(obj).length
+
+
+# Array Functions
+# ---------------
+
+# Get the first element of an array. Passing `n` will return the first N
+# values in the array. Aliased as **head**. The `guard` check allows it to work
+# with **map**.
+_.first = (array, n, guard) ->
+  if n and not guard then slice.call(array, 0, n) else array[0]
+
+
+# Returns everything but the first entry of the array. Aliased as **tail**.
+# Especially useful on the arguments object. Passing an `index` will return
+# the rest of the values in the array from that index onward. The `guard`
+# check allows it to work with **map**.
+_.rest = (array, index, guard) ->
+  slice.call(array, if _.isUndefined(index) or guard then 1 else index)
+
+
+# Get the last element of an array.
+_.last = (array) -> array[array.length - 1]
+
+
+# Trim out all falsy values from an array.
+_.compact = (array) -> item for item in array when item
+
+
+# Return a completely flattened version of an array.
+_.flatten = (array) ->
+  _.reduce array, (memo, value) ->
+    return memo.concat(_.flatten(value)) if _.isArray value
+    memo.push value
+    memo
+  , []
+
+
+# Return a version of the array that does not contain the specified value(s).
+_.without = (array) ->
+  values = _.rest arguments
+  val for val in _.toArray(array) when not _.include values, val
+
+
+# Produce a duplicate-free version of the array. If the array has already
+# been sorted, you have the option of using a faster algorithm.
+_.uniq = (array, isSorted) ->
+  memo = []
+  for el, i in _.toArray array
+    memo.push el if i is 0 || (if isSorted is true then _.last(memo) isnt el else not _.include(memo, el))
+  memo
+
+
+# Produce an array that contains every item shared between all the
+# passed-in arrays.
+_.intersect = (array) ->
+  rest = _.rest arguments
+  _.select _.uniq(array), (item) ->
+    _.all rest, (other) ->
+      _.indexOf(other, item) >= 0
+
+
+# Zip together multiple lists into a single array -- elements that share
+# an index go together.
+_.zip = ->
+  length = _.max _.pluck arguments, 'length'
+  results = new Array length
+  for i in [0...length]
+    results[i] = _.pluck arguments, String i
+  results
+
+
+# If the browser doesn't supply us with **indexOf** (I'm looking at you, MSIE),
+# we need this function. Return the position of the first occurrence of an
+# item in an array, or -1 if the item is not included in the array.
+_.indexOf = (array, item) ->
+  return array.indexOf item if nativeIndexOf and array.indexOf is nativeIndexOf
+  i = 0; l = array.length
+  while l - i
+    if array[i] is item then return i else i++
+  -1
+
+
+# Provide JavaScript 1.6's **lastIndexOf**, delegating to the native function,
+# if possible.
+_.lastIndexOf = (array, item) ->
+  return array.lastIndexOf(item) if nativeLastIndexOf and array.lastIndexOf is nativeLastIndexOf
+  i = array.length
+  while i
+    if array[i] is item then return i else i--
+  -1
+
+
+# Generate an integer Array containing an arithmetic progression. A port of
+# [the native Python **range** function](http://docs.python.org/library/functions.html#range).
+_.range = (start, stop, step) ->
+  a = arguments
+  solo = a.length <= 1
+  i = start = if solo then 0 else a[0]
+  stop = if solo then a[0] else a[1]
+  step = a[2] or 1
+  len = Math.ceil((stop - start) / step)
+  return [] if len <= 0
+  range = new Array len
+  idx = 0
+  loop
+    return range if (if step > 0 then i - stop else stop - i) >= 0
+    range[idx] = i
+    idx++
+    i+= step
+
+
+# Function Functions
+# ------------------
+
+# Create a function bound to a given object (assigning `this`, and arguments,
+# optionally). Binding with arguments is also known as **curry**.
+_.bind = (func, obj) ->
+  args = _.rest arguments, 2
+  -> func.apply obj or root, args.concat arguments
+
+
+# Bind all of an object's methods to that object. Useful for ensuring that
+# all callbacks defined on an object belong to it.
+_.bindAll = (obj) ->
+  funcs = if arguments.length > 1 then _.rest(arguments) else _.functions(obj)
+  _.each funcs, (f) -> obj[f] = _.bind obj[f], obj
+  obj
+
+
+# Delays a function for the given number of milliseconds, and then calls
+# it with the arguments supplied.
+_.delay = (func, wait) ->
+  args = _.rest arguments, 2
+  setTimeout((-> func.apply(func, args)), wait)
+
+
+# Memoize an expensive function by storing its results.
+_.memoize = (func, hasher) ->
+  memo = {}
+  hasher or= _.identity
+  ->
+    key = hasher.apply this, arguments
+    return memo[key] if key of memo
+    memo[key] = func.apply this, arguments
+
+
+# Defers a function, scheduling it to run after the current call stack has
+# cleared.
+_.defer = (func) ->
+  _.delay.apply _, [func, 1].concat _.rest arguments
+
+
+# Returns the first function passed as an argument to the second,
+# allowing you to adjust arguments, run code before and after, and
+# conditionally execute the original function.
+_.wrap = (func, wrapper) ->
+  -> wrapper.apply wrapper, [func].concat arguments
+
+
+# Returns a function that is the composition of a list of functions, each
+# consuming the return value of the function that follows.
+_.compose = ->
+  funcs = arguments
+  ->
+    args = arguments
+    for i in [funcs.length - 1..0] by -1
+      args = [funcs[i].apply(this, args)]
+    args[0]
+
+
+# Object Functions
+# ----------------
+
+# Retrieve the names of an object's properties.
+_.keys = nativeKeys or (obj) ->
+  return _.range 0, obj.length if _.isArray(obj)
+  key for key, val of obj
+
+
+# Retrieve the values of an object's properties.
+_.values = (obj) ->
+  _.map obj, _.identity
+
+
+# Return a sorted list of the function names available in Underscore.
+_.functions = (obj) ->
+  _.filter(_.keys(obj), (key) -> _.isFunction(obj[key])).sort()
+
+
+# Extend a given object with all of the properties in a source object.
+_.extend = (obj) ->
+  for source in _.rest(arguments)
+    obj[key] = val for key, val of source
+  obj
+
+
+# Create a (shallow-cloned) duplicate of an object.
+_.clone = (obj) ->
+  return obj.slice 0 if _.isArray obj
+  _.extend {}, obj
+
+
+# Invokes interceptor with the obj, and then returns obj.
+# The primary purpose of this method is to "tap into" a method chain,
+# in order to perform operations on intermediate results within
+ the chain.
+_.tap = (obj, interceptor) ->
+  interceptor obj
+  obj
+
+
+# Perform a deep comparison to check if two objects are equal.
+_.isEqual = (a, b) ->
+  # Check object identity.
+  return true if a is b
+  # Different types?
+  atype = typeof(a); btype = typeof(b)
+  return false if atype isnt btype
+  # Basic equality test (watch out for coercions).
+  return true if `a == b`
+  # One is falsy and the other truthy.
+  return false if (!a and b) or (a and !b)
+  # One of them implements an `isEqual()`?
+  return a.isEqual(b) if a.isEqual
+  # Check dates' integer values.
+  return a.getTime() is b.getTime() if _.isDate(a) and _.isDate(b)
+  # Both are NaN?
+  return false if _.isNaN(a) and _.isNaN(b)
+  # Compare regular expressions.
+  if _.isRegExp(a) and _.isRegExp(b)
+    return a.source is b.source and
+           a.global is b.global and
+           a.ignoreCase is b.ignoreCase and
+           a.multiline is b.multiline
+  # If a is not an object by this point, we can't handle it.
+  return false if atype isnt 'object'
+  # Check for different array lengths before comparing contents.
+  return false if a.length and (a.length isnt b.length)
+  # Nothing else worked, deep compare the contents.
+  aKeys = _.keys(a); bKeys = _.keys(b)
+  # Different object sizes?
+  return false if aKeys.length isnt bKeys.length
+  # Recursive comparison of contents.
+  return false for key, val of a when !(key of b) or !_.isEqual(val, b[key])
+  true
+
+
+# Is a given array or object empty?
+_.isEmpty = (obj) ->
+  return obj.length is 0 if _.isArray(obj) or _.isString(obj)
+  return false for own key of obj
+  true
+
+
+# Is a given value a DOM element?
+_.isElement = (obj) -> obj and obj.nodeType is 1
+
+
+# Is a given value an array?
+_.isArray = nativeIsArray or (obj) -> !!(obj and obj.concat and obj.unshift and not obj.callee)
+
+
+# Is a given variable an arguments object?
+_.isArguments = (obj) -> obj and obj.callee
+
+
+# Is the given value a function?
+_.isFunction = (obj) -> !!(obj and obj.constructor and obj.call and obj.apply)
+
+
+# Is the given value a string?
+_.isString = (obj) -> !!(obj is '' or (obj and obj.charCodeAt and obj.substr))
+
+
+# Is a given value a number?
+_.isNumber = (obj) -> (obj is +obj) or toString.call(obj) is '[object Number]'
+
+
+# Is a given value a boolean?
+_.isBoolean = (obj) -> obj is true or obj is false
+
+
+# Is a given value a Date?
+_.isDate = (obj) -> !!(obj and obj.getTimezoneOffset and obj.setUTCFullYear)
+
+
+# Is the given value a regular expression?
+_.isRegExp = (obj) -> !!(obj and obj.exec and (obj.ignoreCase or obj.ignoreCase is false))
+
+
+# Is the given value NaN -- this one is interesting. `NaN != NaN`, and
+# `isNaN(undefined) == true`, so we make sure it's a number first.
+_.isNaN = (obj) -> _.isNumber(obj) and window.isNaN(obj)
+
+
+# Is a given value equal to null?
+_.isNull = (obj) -> obj is null
+
+
+# Is a given variable undefined?
+_.isUndefined = (obj) -> typeof obj is 'undefined'
+
+
+# Utility Functions
+# -----------------
+
+# Run Underscore.js in noConflict mode, returning the `_` variable to its
+# previous owner. Returns a reference to the Underscore object.
+_.noConflict = ->
+  root._ = previousUnderscore
+  this
+
+
+# Keep the identity function around for default iterators.
+_.identity = (value) -> value
+
+
+# Run a function `n` times.
+_.times = (n, iterator, context) ->
+  iterator.call context, i for i in [0...n]
+
+
+# Break out of the middle of an iteration.
+_.breakLoop = -> throw breaker
+
+
+# Add your own custom functions to the Underscore object, ensuring that
+# they're correctly added to the OOP wrapper as well.
+_.mixin = (obj) ->
+  for name in _.functions(obj)
+    addToWrapper name, _[name] = obj[name]
+
+
+# Generate a unique integer id (unique within the entire client session).
+# Useful for temporary DOM ids.
+idCounter = 0
+_.uniqueId = (prefix) ->
+  (prefix or '') + idCounter++
+
+
+# By default, Underscore uses **ERB**-style template delimiters, change the
+# following template settings to use alternative delimiters.
+_.templateSettings = {
+  start: '<%'
+  end: '%>'
+  interpolate: /<%=(.+?)%>/g
+}
+
+
+# JavaScript templating a-la **ERB**, pilfered from John Resig's
+# *Secrets of the JavaScript Ninja*, page 83.
+# Single-quote fix from Rick Strahl.
+# With alterations for arbitrary delimiters, and to preserve whitespace.
+_.template = (str, data) ->
+  c = _.templateSettings
+  endMatch = new RegExp("'(?=[^"+c.end.substr(0, 1)+"]*"+escapeRegExp(c.end)+")","g")
+  fn = new Function 'obj',
+    'var p=[],print=function(){p.push.apply(p,arguments);};' +
+    'with(obj||{}){p.push(\'' +
+    str.replace(/\r/g, '\\r')
+       .replace(/\n/g, '\\n')
+       .replace(/\t/g, '\\t')
+       .replace(endMatch,"���")
+       .split("'").join("\\'")
+       .split("���").join("'")
+       .replace(c.interpolate, "',$1,'")
+       .split(c.start).join("');")
+       .split(c.end).join("p.push('") +
+       "');}return p.join('');"
+  if data then fn(data) else fn
+
+
+# Aliases
+# -------
+
+_.forEach = _.each
+_.foldl = _.inject = _.reduce
+_.foldr = _.reduceRight
+_.select = _.filter
+_.all = _.every
+_.any = _.some
+_.contains = _.include
+_.head = _.first
+_.tail = _.rest
+_.methods = _.functions
+
+
+# Setup the OOP Wrapper
+# ---------------------
+
+# If Underscore is called as a function, it returns a wrapped object that
+# can be used OO-style. This wrapper holds altered versions of all the
+# underscore functions. Wrapped objects may be chained.
+wrapper = (obj) ->
+  this._wrapped = obj
+  this
+
+
+# Helper function to continue chaining intermediate results.
+result = (obj, chain) ->
+  if chain then _(obj).chain() else obj
+
+
+# A method to easily add functions to the OOP wrapper.
+addToWrapper = (name, func) ->
+  wrapper.prototype[name] = ->
+    args = _.toArray arguments
+    unshift.call args, this._wrapped
+    result func.apply(_, args), this._chain
+
+
+# Add all ofthe Underscore functions to the wrapper object.
+_.mixin _
+
+
+# Add all mutator Array functions to the wrapper.
+_.each ['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], (name) ->
+  method = Array.prototype[name]
+  wrapper.prototype[name] = ->
+    method.apply(this._wrapped, arguments)
+    result(this._wrapped, this._chain)
+
+
+# Add all accessor Array functions to the wrapper.
+_.each ['concat', 'join', 'slice'], (name) ->
+  method = Array.prototype[name]
+  wrapper.prototype[name] = ->
+    result(method.apply(this._wrapped, arguments), this._chain)
+
+
+# Start chaining a wrapped Underscore object.
+wrapper::chain = ->
+  this._chain = true
+  this
+
+
+# Extracts the result from a wrapped and chained object.
+wrapper::value = -> this._wrapped
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>application/vnd.coffeescript</code>, <code>text/coffeescript</code>, <code>text/x-coffeescript</code>.</p>
+
+    <p>The CoffeeScript mode was written by Jeff Pickhardt.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/commonlisp/commonlisp.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,125 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("commonlisp", function (config) {
+  var specialForm = /^(block|let*|return-from|catch|load-time-value|setq|eval-when|locally|symbol-macrolet|flet|macrolet|tagbody|function|multiple-value-call|the|go|multiple-value-prog1|throw|if|progn|unwind-protect|labels|progv|let|quote)$/;
+  var assumeBody = /^with|^def|^do|^prog|case$|^cond$|bind$|when$|unless$/;
+  var numLiteral = /^(?:[+\-]?(?:\d+|\d*\.\d+)(?:[efd][+\-]?\d+)?|[+\-]?\d+(?:\/[+\-]?\d+)?|#b[+\-]?[01]+|#o[+\-]?[0-7]+|#x[+\-]?[\da-f]+)/;
+  var symbol = /[^\s'`,@()\[\]";]/;
+  var type;
+
+  function readSym(stream) {
+    var ch;
+    while (ch = stream.next()) {
+      if (ch == "\\") stream.next();
+      else if (!symbol.test(ch)) { stream.backUp(1); break; }
+    }
+    return stream.current();
+  }
+
+  function base(stream, state) {
+    if (stream.eatSpace()) {type = "ws"; return null;}
+    if (stream.match(numLiteral)) return "number";
+    var ch = stream.next();
+    if (ch == "\\") ch = stream.next();
+
+    if (ch == '"') return (state.tokenize = inString)(stream, state);
+    else if (ch == "(") { type = "open"; return "bracket"; }
+    else if (ch == ")" || ch == "]") { type = "close"; return "bracket"; }
+    else if (ch == ";") { stream.skipToEnd(); type = "ws"; return "comment"; }
+    else if (/['`,@]/.test(ch)) return null;
+    else if (ch == "|") {
+      if (stream.skipTo("|")) { stream.next(); return "symbol"; }
+      else { stream.skipToEnd(); return "error"; }
+    } else if (ch == "#") {
+      var ch = stream.next();
+      if (ch == "(") { type = "open"; return "bracket"; }
+      else if (/[+\-=\.']/.test(ch)) return null;
+      else if (/\d/.test(ch) && stream.match(/^\d*#/)) return null;
+      else if (ch == "|") return (state.tokenize = inComment)(stream, state);
+      else if (ch == ":") { readSym(stream); return "meta"; }
+      else if (ch == "\\") { stream.next(); readSym(stream); return "string-2" }
+      else return "error";
+    } else {
+      var name = readSym(stream);
+      if (name == ".") return null;
+      type = "symbol";
+      if (name == "nil" || name == "t" || name.charAt(0) == ":") return "atom";
+      if (state.lastType == "open" && (specialForm.test(name) || assumeBody.test(name))) return "keyword";
+      if (name.charAt(0) == "&") return "variable-2";
+      return "variable";
+    }
+  }
+
+  function inString(stream, state) {
+    var escaped = false, next;
+    while (next = stream.next()) {
+      if (next == '"' && !escaped) { state.tokenize = base; break; }
+      escaped = !escaped && next == "\\";
+    }
+    return "string";
+  }
+
+  function inComment(stream, state) {
+    var next, last;
+    while (next = stream.next()) {
+      if (next == "#" && last == "|") { state.tokenize = base; break; }
+      last = next;
+    }
+    type = "ws";
+    return "comment";
+  }
+
+  return {
+    startState: function () {
+      return {ctx: {prev: null, start: 0, indentTo: 0}, lastType: null, tokenize: base};
+    },
+
+    token: function (stream, state) {
+      if (stream.sol() && typeof state.ctx.indentTo != "number")
+        state.ctx.indentTo = state.ctx.start + 1;
+
+      type = null;
+      var style = state.tokenize(stream, state);
+      if (type != "ws") {
+        if (state.ctx.indentTo == null) {
+          if (type == "symbol" && assumeBody.test(stream.current()))
+            state.ctx.indentTo = state.ctx.start + config.indentUnit;
+          else
+            state.ctx.indentTo = "next";
+        } else if (state.ctx.indentTo == "next") {
+          state.ctx.indentTo = stream.column();
+        }
+        state.lastType = type;
+      }
+      if (type == "open") state.ctx = {prev: state.ctx, start: stream.column(), indentTo: null};
+      else if (type == "close") state.ctx = state.ctx.prev || state.ctx;
+      return style;
+    },
+
+    indent: function (state, _textAfter) {
+      var i = state.ctx.indentTo;
+      return typeof i == "number" ? i : state.ctx.start + 1;
+    },
+
+    closeBrackets: {pairs: "()[]{}\"\""},
+    lineComment: ";;",
+    fold: "brace-paren",
+    blockCommentStart: "#|",
+    blockCommentEnd: "|#"
+  };
+});
+
+CodeMirror.defineMIME("text/x-common-lisp", "commonlisp");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/commonlisp/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,177 @@
+<!doctype html>
+
+<title>CodeMirror: Common Lisp mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="commonlisp.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Common Lisp</a>
+  </ul>
+</div>
+
+<article>
+<h2>Common Lisp mode</h2>
+<form><textarea id="code" name="code">(in-package :cl-postgres)
+
+;; These are used to synthesize reader and writer names for integer
+;; reading/writing functions when the amount of bytes and the
+;; signedness is known. Both the macro that creates the functions and
+;; some macros that use them create names this way.
+(eval-when (:compile-toplevel :load-toplevel :execute)
+  (defun integer-reader-name (bytes signed)
+    (intern (with-standard-io-syntax
+              (format nil "~a~a~a~a" '#:read- (if signed "" '#:u) '#:int bytes))))
+  (defun integer-writer-name (bytes signed)
+    (intern (with-standard-io-syntax
+              (format nil "~a~a~a~a" '#:write- (if signed "" '#:u) '#:int bytes)))))
+
+(defmacro integer-reader (bytes)
+  "Create a function to read integers from a binary stream."
+  (let ((bits (* bytes 8)))
+    (labels ((return-form (signed)
+               (if signed
+                   `(if (logbitp ,(1- bits) result)
+                        (dpb result (byte ,(1- bits) 0) -1)
+                        result)
+                   `result))
+             (generate-reader (signed)
+               `(defun ,(integer-reader-name bytes signed) (socket)
+                  (declare (type stream socket)
+                           #.*optimize*)
+                  ,(if (= bytes 1)
+                       `(let ((result (the (unsigned-byte 8) (read-byte socket))))
+                          (declare (type (unsigned-byte 8) result))
+                          ,(return-form signed))
+                       `(let ((result 0))
+                          (declare (type (unsigned-byte ,bits) result))
+                          ,@(loop :for byte :from (1- bytes) :downto 0
+                                   :collect `(setf (ldb (byte 8 ,(* 8 byte)) result)
+                                                   (the (unsigned-byte 8) (read-byte socket))))
+                          ,(return-form signed))))))
+      `(progn
+;; This causes weird errors on SBCL in some circumstances. Disabled for now.
+;;         (declaim (inline ,(integer-reader-name bytes t)
+;;                          ,(integer-reader-name bytes nil)))
+         (declaim (ftype (function (t) (signed-byte ,bits))
+                         ,(integer-reader-name bytes t)))
+         ,(generate-reader t)
+         (declaim (ftype (function (t) (unsigned-byte ,bits))
+                         ,(integer-reader-name bytes nil)))
+         ,(generate-reader nil)))))
+
+(defmacro integer-writer (bytes)
+  "Create a function to write integers to a binary stream."
+  (let ((bits (* 8 bytes)))
+    `(progn
+      (declaim (inline ,(integer-writer-name bytes t)
+                       ,(integer-writer-name bytes nil)))
+      (defun ,(integer-writer-name bytes nil) (socket value)
+        (declare (type stream socket)
+                 (type (unsigned-byte ,bits) value)
+                 #.*optimize*)
+        ,@(if (= bytes 1)
+              `((write-byte value socket))
+              (loop :for byte :from (1- bytes) :downto 0
+                    :collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
+                               socket)))
+        (values))
+      (defun ,(integer-writer-name bytes t) (socket value)
+        (declare (type stream socket)
+                 (type (signed-byte ,bits) value)
+                 #.*optimize*)
+        ,@(if (= bytes 1)
+              `((write-byte (ldb (byte 8 0) value) socket))
+              (loop :for byte :from (1- bytes) :downto 0
+                    :collect `(write-byte (ldb (byte 8 ,(* byte 8)) value)
+                               socket)))
+        (values)))))
+
+;; All the instances of the above that we need.
+
+(integer-reader 1)
+(integer-reader 2)
+(integer-reader 4)
+(integer-reader 8)
+
+(integer-writer 1)
+(integer-writer 2)
+(integer-writer 4)
+
+(defun write-bytes (socket bytes)
+  "Write a byte-array to a stream."
+  (declare (type stream socket)
+           (type (simple-array (unsigned-byte 8)) bytes)
+           #.*optimize*)
+  (write-sequence bytes socket))
+
+(defun write-str (socket string)
+  "Write a null-terminated string to a stream \(encoding it when UTF-8
+support is enabled.)."
+  (declare (type stream socket)
+           (type string string)
+           #.*optimize*)
+  (enc-write-string string socket)
+  (write-uint1 socket 0))
+
+(declaim (ftype (function (t unsigned-byte)
+                          (simple-array (unsigned-byte 8) (*)))
+                read-bytes))
+(defun read-bytes (socket length)
+  "Read a byte array of the given length from a stream."
+  (declare (type stream socket)
+           (type fixnum length)
+           #.*optimize*)
+  (let ((result (make-array length :element-type '(unsigned-byte 8))))
+    (read-sequence result socket)
+    result))
+
+(declaim (ftype (function (t) string) read-str))
+(defun read-str (socket)
+  "Read a null-terminated string from a stream. Takes care of encoding
+when UTF-8 support is enabled."
+  (declare (type stream socket)
+           #.*optimize*)
+  (enc-read-string socket :null-terminated t))
+
+(defun skip-bytes (socket length)
+  "Skip a given number of bytes in a binary stream."
+  (declare (type stream socket)
+           (type (unsigned-byte 32) length)
+           #.*optimize*)
+  (dotimes (i length)
+    (read-byte socket)))
+
+(defun skip-str (socket)
+  "Skip a null-terminated string."
+  (declare (type stream socket)
+           #.*optimize*)
+  (loop :for char :of-type fixnum = (read-byte socket)
+        :until (zerop char)))
+
+(defun ensure-socket-is-closed (socket &amp;key abort)
+  (when (open-stream-p socket)
+    (handler-case
+        (close socket :abort abort)
+      (error (error)
+        (warn "Ignoring the error which happened while trying to close PostgreSQL socket: ~A" error)))))
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {lineNumbers: true});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-common-lisp</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/crystal/crystal.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,433 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("crystal", function(config) {
+    function wordRegExp(words, end) {
+      return new RegExp((end ? "" : "^") + "(?:" + words.join("|") + ")" + (end ? "$" : "\\b"));
+    }
+
+    function chain(tokenize, stream, state) {
+      state.tokenize.push(tokenize);
+      return tokenize(stream, state);
+    }
+
+    var operators = /^(?:[-+/%|&^]|\*\*?|[<>]{2})/;
+    var conditionalOperators = /^(?:[=!]~|===|<=>|[<>=!]=?|[|&]{2}|~)/;
+    var indexingOperators = /^(?:\[\][?=]?)/;
+    var anotherOperators = /^(?:\.(?:\.{2})?|->|[?:])/;
+    var idents = /^[a-z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
+    var types = /^[A-Z_\u009F-\uFFFF][a-zA-Z0-9_\u009F-\uFFFF]*/;
+    var keywords = wordRegExp([
+      "abstract", "alias", "as", "asm", "begin", "break", "case", "class", "def", "do",
+      "else", "elsif", "end", "ensure", "enum", "extend", "for", "fun", "if",
+      "include", "instance_sizeof", "lib", "macro", "module", "next", "of", "out", "pointerof",
+      "private", "protected", "rescue", "return", "require", "select", "sizeof", "struct",
+      "super", "then", "type", "typeof", "uninitialized", "union", "unless", "until", "when", "while", "with",
+      "yield", "__DIR__", "__END_LINE__", "__FILE__", "__LINE__"
+    ]);
+    var atomWords = wordRegExp(["true", "false", "nil", "self"]);
+    var indentKeywordsArray = [
+      "def", "fun", "macro",
+      "class", "module", "struct", "lib", "enum", "union",
+      "do", "for"
+    ];
+    var indentKeywords = wordRegExp(indentKeywordsArray);
+    var indentExpressionKeywordsArray = ["if", "unless", "case", "while", "until", "begin", "then"];
+    var indentExpressionKeywords = wordRegExp(indentExpressionKeywordsArray);
+    var dedentKeywordsArray = ["end", "else", "elsif", "rescue", "ensure"];
+    var dedentKeywords = wordRegExp(dedentKeywordsArray);
+    var dedentPunctualsArray = ["\\)", "\\}", "\\]"];
+    var dedentPunctuals = new RegExp("^(?:" + dedentPunctualsArray.join("|") + ")$");
+    var nextTokenizer = {
+      "def": tokenFollowIdent, "fun": tokenFollowIdent, "macro": tokenMacroDef,
+      "class": tokenFollowType, "module": tokenFollowType, "struct": tokenFollowType,
+      "lib": tokenFollowType, "enum": tokenFollowType, "union": tokenFollowType
+    };
+    var matching = {"[": "]", "{": "}", "(": ")", "<": ">"};
+
+    function tokenBase(stream, state) {
+      if (stream.eatSpace()) {
+        return null;
+      }
+
+      // Macros
+      if (state.lastToken != "\\" && stream.match("{%", false)) {
+        return chain(tokenMacro("%", "%"), stream, state);
+      }
+
+      if (state.lastToken != "\\" && stream.match("{{", false)) {
+        return chain(tokenMacro("{", "}"), stream, state);
+      }
+
+      // Comments
+      if (stream.peek() == "#") {
+        stream.skipToEnd();
+        return "comment";
+      }
+
+      // Variables and keywords
+      var matched;
+      if (stream.match(idents)) {
+        stream.eat(/[?!]/);
+
+        matched = stream.current();
+        if (stream.eat(":")) {
+          return "atom";
+        } else if (state.lastToken == ".") {
+          return "property";
+        } else if (keywords.test(matched)) {
+          if (indentKeywords.test(matched)) {
+            if (!(matched == "fun" && state.blocks.indexOf("lib") >= 0) && !(matched == "def" && state.lastToken == "abstract")) {
+              state.blocks.push(matched);
+              state.currentIndent += 1;
+            }
+          } else if ((state.lastStyle == "operator" || !state.lastStyle) && indentExpressionKeywords.test(matched)) {
+            state.blocks.push(matched);
+            state.currentIndent += 1;
+          } else if (matched == "end") {
+            state.blocks.pop();
+            state.currentIndent -= 1;
+          }
+
+          if (nextTokenizer.hasOwnProperty(matched)) {
+            state.tokenize.push(nextTokenizer[matched]);
+          }
+
+          return "keyword";
+        } else if (atomWords.test(matched)) {
+          return "atom";
+        }
+
+        return "variable";
+      }
+
+      // Class variables and instance variables
+      // or attributes
+      if (stream.eat("@")) {
+        if (stream.peek() == "[") {
+          return chain(tokenNest("[", "]", "meta"), stream, state);
+        }
+
+        stream.eat("@");
+        stream.match(idents) || stream.match(types);
+        return "variable-2";
+      }
+
+      // Constants and types
+      if (stream.match(types)) {
+        return "tag";
+      }
+
+      // Symbols or ':' operator
+      if (stream.eat(":")) {
+        if (stream.eat("\"")) {
+          return chain(tokenQuote("\"", "atom", false), stream, state);
+        } else if (stream.match(idents) || stream.match(types) ||
+                   stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators)) {
+          return "atom";
+        }
+        stream.eat(":");
+        return "operator";
+      }
+
+      // Strings
+      if (stream.eat("\"")) {
+        return chain(tokenQuote("\"", "string", true), stream, state);
+      }
+
+      // Strings or regexps or macro variables or '%' operator
+      if (stream.peek() == "%") {
+        var style = "string";
+        var embed = true;
+        var delim;
+
+        if (stream.match("%r")) {
+          // Regexps
+          style = "string-2";
+          delim = stream.next();
+        } else if (stream.match("%w")) {
+          embed = false;
+          delim = stream.next();
+        } else if (stream.match("%q")) {
+          embed = false;
+          delim = stream.next();
+        } else {
+          if(delim = stream.match(/^%([^\w\s=])/)) {
+            delim = delim[1];
+          } else if (stream.match(/^%[a-zA-Z_\u009F-\uFFFF][\w\u009F-\uFFFF]*/)) {
+            // Macro variables
+            return "meta";
+          } else if (stream.eat('%')) {
+            // '%' operator
+            return "operator";
+          }
+        }
+
+        if (matching.hasOwnProperty(delim)) {
+          delim = matching[delim];
+        }
+        return chain(tokenQuote(delim, style, embed), stream, state);
+      }
+
+      // Here Docs
+      if (matched = stream.match(/^<<-('?)([A-Z]\w*)\1/)) {
+        return chain(tokenHereDoc(matched[2], !matched[1]), stream, state)
+      }
+
+      // Characters
+      if (stream.eat("'")) {
+        stream.match(/^(?:[^']|\\(?:[befnrtv0'"]|[0-7]{3}|u(?:[0-9a-fA-F]{4}|\{[0-9a-fA-F]{1,6}\})))/);
+        stream.eat("'");
+        return "atom";
+      }
+
+      // Numbers
+      if (stream.eat("0")) {
+        if (stream.eat("x")) {
+          stream.match(/^[0-9a-fA-F_]+/);
+        } else if (stream.eat("o")) {
+          stream.match(/^[0-7_]+/);
+        } else if (stream.eat("b")) {
+          stream.match(/^[01_]+/);
+        }
+        return "number";
+      }
+
+      if (stream.eat(/^\d/)) {
+        stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+-]?\d+)?/);
+        return "number";
+      }
+
+      // Operators
+      if (stream.match(operators)) {
+        stream.eat("="); // Operators can follow assign symbol.
+        return "operator";
+      }
+
+      if (stream.match(conditionalOperators) || stream.match(anotherOperators)) {
+        return "operator";
+      }
+
+      // Parens and braces
+      if (matched = stream.match(/[({[]/, false)) {
+        matched = matched[0];
+        return chain(tokenNest(matched, matching[matched], null), stream, state);
+      }
+
+      // Escapes
+      if (stream.eat("\\")) {
+        stream.next();
+        return "meta";
+      }
+
+      stream.next();
+      return null;
+    }
+
+    function tokenNest(begin, end, style, started) {
+      return function (stream, state) {
+        if (!started && stream.match(begin)) {
+          state.tokenize[state.tokenize.length - 1] = tokenNest(begin, end, style, true);
+          state.currentIndent += 1;
+          return style;
+        }
+
+        var nextStyle = tokenBase(stream, state);
+        if (stream.current() === end) {
+          state.tokenize.pop();
+          state.currentIndent -= 1;
+          nextStyle = style;
+        }
+
+        return nextStyle;
+      };
+    }
+
+    function tokenMacro(begin, end, started) {
+      return function (stream, state) {
+        if (!started && stream.match("{" + begin)) {
+          state.currentIndent += 1;
+          state.tokenize[state.tokenize.length - 1] = tokenMacro(begin, end, true);
+          return "meta";
+        }
+
+        if (stream.match(end + "}")) {
+          state.currentIndent -= 1;
+          state.tokenize.pop();
+          return "meta";
+        }
+
+        return tokenBase(stream, state);
+      };
+    }
+
+    function tokenMacroDef(stream, state) {
+      if (stream.eatSpace()) {
+        return null;
+      }
+
+      var matched;
+      if (matched = stream.match(idents)) {
+        if (matched == "def") {
+          return "keyword";
+        }
+        stream.eat(/[?!]/);
+      }
+
+      state.tokenize.pop();
+      return "def";
+    }
+
+    function tokenFollowIdent(stream, state) {
+      if (stream.eatSpace()) {
+        return null;
+      }
+
+      if (stream.match(idents)) {
+        stream.eat(/[!?]/);
+      } else {
+        stream.match(operators) || stream.match(conditionalOperators) || stream.match(indexingOperators);
+      }
+      state.tokenize.pop();
+      return "def";
+    }
+
+    function tokenFollowType(stream, state) {
+      if (stream.eatSpace()) {
+        return null;
+      }
+
+      stream.match(types);
+      state.tokenize.pop();
+      return "def";
+    }
+
+    function tokenQuote(end, style, embed) {
+      return function (stream, state) {
+        var escaped = false;
+
+        while (stream.peek()) {
+          if (!escaped) {
+            if (stream.match("{%", false)) {
+              state.tokenize.push(tokenMacro("%", "%"));
+              return style;
+            }
+
+            if (stream.match("{{", false)) {
+              state.tokenize.push(tokenMacro("{", "}"));
+              return style;
+            }
+
+            if (embed && stream.match("#{", false)) {
+              state.tokenize.push(tokenNest("#{", "}", "meta"));
+              return style;
+            }
+
+            var ch = stream.next();
+
+            if (ch == end) {
+              state.tokenize.pop();
+              return style;
+            }
+
+            escaped = embed && ch == "\\";
+          } else {
+            stream.next();
+            escaped = false;
+          }
+        }
+
+        return style;
+      };
+    }
+
+    function tokenHereDoc(phrase, embed) {
+      return function (stream, state) {
+        if (stream.sol()) {
+          stream.eatSpace()
+          if (stream.match(phrase)) {
+            state.tokenize.pop();
+            return "string";
+          }
+        }
+
+        var escaped = false;
+        while (stream.peek()) {
+          if (!escaped) {
+            if (stream.match("{%", false)) {
+              state.tokenize.push(tokenMacro("%", "%"));
+              return "string";
+            }
+
+            if (stream.match("{{", false)) {
+              state.tokenize.push(tokenMacro("{", "}"));
+              return "string";
+            }
+
+            if (embed && stream.match("#{", false)) {
+              state.tokenize.push(tokenNest("#{", "}", "meta"));
+              return "string";
+            }
+
+            escaped = stream.next() == "\\" && embed;
+          } else {
+            stream.next();
+            escaped = false;
+          }
+        }
+
+        return "string";
+      }
+    }
+
+    return {
+      startState: function () {
+        return {
+          tokenize: [tokenBase],
+          currentIndent: 0,
+          lastToken: null,
+          lastStyle: null,
+          blocks: []
+        };
+      },
+
+      token: function (stream, state) {
+        var style = state.tokenize[state.tokenize.length - 1](stream, state);
+        var token = stream.current();
+
+        if (style && style != "comment") {
+          state.lastToken = token;
+          state.lastStyle = style;
+        }
+
+        return style;
+      },
+
+      indent: function (state, textAfter) {
+        textAfter = textAfter.replace(/^\s*(?:\{%)?\s*|\s*(?:%\})?\s*$/g, "");
+
+        if (dedentKeywords.test(textAfter) || dedentPunctuals.test(textAfter)) {
+          return config.indentUnit * (state.currentIndent - 1);
+        }
+
+        return config.indentUnit * state.currentIndent;
+      },
+
+      fold: "indent",
+      electricInput: wordRegExp(dedentPunctualsArray.concat(dedentKeywordsArray), true),
+      lineComment: '#'
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-crystal", "crystal");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/crystal/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,116 @@
+<!doctype html>
+
+<title>CodeMirror: Crystal mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="crystal.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+  .cm-s-default span.cm-arrow { color: red; }
+</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Crystal</a>
+  </ul>
+</div>
+
+<article>
+<h2>Crystal mode</h2>
+<form><textarea id="code" name="code">
+# Features of Crystal
+# - Ruby-inspired syntax.
+# - Statically type-checked but without having to specify the type of variables or method arguments.
+# - Be able to call C code by writing bindings to it in Crystal.
+# - Have compile-time evaluation and generation of code, to avoid boilerplate code.
+# - Compile to efficient native code.
+
+# A very basic HTTP server
+require "http/server"
+
+server = HTTP::Server.new(8080) do |request|
+  HTTP::Response.ok "text/plain", "Hello world, got #{request.path}!"
+end
+
+puts "Listening on http://0.0.0.0:8080"
+server.listen
+
+module Foo
+  abstract def abstract_method : String
+
+  @[AlwaysInline]
+  def with_foofoo
+    with Foo.new(self) yield
+  end
+
+  struct Foo
+    def initialize(@foo : ::Foo)
+    end
+
+    def hello_world
+      @foo.abstract_method
+    end
+  end
+end
+
+class Bar
+  include Foo
+
+  @@foobar = 12345
+
+  def initialize(@bar : Int32)
+  end
+
+  macro alias_method(name, method)
+    def {{ name }}(*args)
+      {{ method }}(*args)
+    end
+  end
+
+  def a_method
+    "Hello, World"
+  end
+
+  alias_method abstract_method, a_method
+
+  def show_instance_vars : Nil
+    {% for var in @type.instance_vars %}
+      puts "@{{ var }} = #{ @{{ var }} }"
+    {% end %}
+  end
+end
+
+class Baz &lt; Bar; end
+
+lib LibC
+  fun c_puts = "puts"(str : Char*) : Int
+end
+
+baz = Baz.new(100)
+baz.show_instance_vars
+baz.with_foofoo do
+  LibC.c_puts hello_world
+end
+</textarea></form>
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    mode: "text/x-crystal",
+    matchBrackets: true,
+    indentUnit: 2
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-crystal</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/css.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,862 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("css", function(config, parserConfig) {
+  var inline = parserConfig.inline
+  if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode("text/css");
+
+  var indentUnit = config.indentUnit,
+      tokenHooks = parserConfig.tokenHooks,
+      documentTypes = parserConfig.documentTypes || {},
+      mediaTypes = parserConfig.mediaTypes || {},
+      mediaFeatures = parserConfig.mediaFeatures || {},
+      mediaValueKeywords = parserConfig.mediaValueKeywords || {},
+      propertyKeywords = parserConfig.propertyKeywords || {},
+      nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},
+      fontProperties = parserConfig.fontProperties || {},
+      counterDescriptors = parserConfig.counterDescriptors || {},
+      colorKeywords = parserConfig.colorKeywords || {},
+      valueKeywords = parserConfig.valueKeywords || {},
+      allowNested = parserConfig.allowNested,
+      lineComment = parserConfig.lineComment,
+      supportsAtComponent = parserConfig.supportsAtComponent === true,
+      highlightNonStandardPropertyKeywords = config.highlightNonStandardPropertyKeywords !== false;
+
+  var type, override;
+  function ret(style, tp) { type = tp; return style; }
+
+  // Tokenizers
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (tokenHooks[ch]) {
+      var result = tokenHooks[ch](stream, state);
+      if (result !== false) return result;
+    }
+    if (ch == "@") {
+      stream.eatWhile(/[\w\\\-]/);
+      return ret("def", stream.current());
+    } else if (ch == "=" || (ch == "~" || ch == "|") && stream.eat("=")) {
+      return ret(null, "compare");
+    } else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    } else if (ch == "#") {
+      stream.eatWhile(/[\w\\\-]/);
+      return ret("atom", "hash");
+    } else if (ch == "!") {
+      stream.match(/^\s*\w*/);
+      return ret("keyword", "important");
+    } else if (/\d/.test(ch) || ch == "." && stream.eat(/\d/)) {
+      stream.eatWhile(/[\w.%]/);
+      return ret("number", "unit");
+    } else if (ch === "-") {
+      if (/[\d.]/.test(stream.peek())) {
+        stream.eatWhile(/[\w.%]/);
+        return ret("number", "unit");
+      } else if (stream.match(/^-[\w\\\-]*/)) {
+        stream.eatWhile(/[\w\\\-]/);
+        if (stream.match(/^\s*:/, false))
+          return ret("variable-2", "variable-definition");
+        return ret("variable-2", "variable");
+      } else if (stream.match(/^\w+-/)) {
+        return ret("meta", "meta");
+      }
+    } else if (/[,+>*\/]/.test(ch)) {
+      return ret(null, "select-op");
+    } else if (ch == "." && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {
+      return ret("qualifier", "qualifier");
+    } else if (/[:;{}\[\]\(\)]/.test(ch)) {
+      return ret(null, ch);
+    } else if (stream.match(/^[\w-.]+(?=\()/)) {
+      if (/^(url(-prefix)?|domain|regexp)$/i.test(stream.current())) {
+        state.tokenize = tokenParenthesized;
+      }
+      return ret("variable callee", "variable");
+    } else if (/[\w\\\-]/.test(ch)) {
+      stream.eatWhile(/[\w\\\-]/);
+      return ret("property", "word");
+    } else {
+      return ret(null, null);
+    }
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          if (quote == ")") stream.backUp(1);
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      if (ch == quote || !escaped && quote != ")") state.tokenize = null;
+      return ret("string", "string");
+    };
+  }
+
+  function tokenParenthesized(stream, state) {
+    stream.next(); // Must be '('
+    if (!stream.match(/^\s*[\"\')]/, false))
+      state.tokenize = tokenString(")");
+    else
+      state.tokenize = null;
+    return ret(null, "(");
+  }
+
+  // Context management
+
+  function Context(type, indent, prev) {
+    this.type = type;
+    this.indent = indent;
+    this.prev = prev;
+  }
+
+  function pushContext(state, stream, type, indent) {
+    state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);
+    return type;
+  }
+
+  function popContext(state) {
+    if (state.context.prev)
+      state.context = state.context.prev;
+    return state.context.type;
+  }
+
+  function pass(type, stream, state) {
+    return states[state.context.type](type, stream, state);
+  }
+  function popAndPass(type, stream, state, n) {
+    for (var i = n || 1; i > 0; i--)
+      state.context = state.context.prev;
+    return pass(type, stream, state);
+  }
+
+  // Parser
+
+  function wordAsValue(stream) {
+    var word = stream.current().toLowerCase();
+    if (valueKeywords.hasOwnProperty(word))
+      override = "atom";
+    else if (colorKeywords.hasOwnProperty(word))
+      override = "keyword";
+    else
+      override = "variable";
+  }
+
+  var states = {};
+
+  states.top = function(type, stream, state) {
+    if (type == "{") {
+      return pushContext(state, stream, "block");
+    } else if (type == "}" && state.context.prev) {
+      return popContext(state);
+    } else if (supportsAtComponent && /@component/i.test(type)) {
+      return pushContext(state, stream, "atComponentBlock");
+    } else if (/^@(-moz-)?document$/i.test(type)) {
+      return pushContext(state, stream, "documentTypes");
+    } else if (/^@(media|supports|(-moz-)?document|import)$/i.test(type)) {
+      return pushContext(state, stream, "atBlock");
+    } else if (/^@(font-face|counter-style)/i.test(type)) {
+      state.stateArg = type;
+      return "restricted_atBlock_before";
+    } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/i.test(type)) {
+      return "keyframes";
+    } else if (type && type.charAt(0) == "@") {
+      return pushContext(state, stream, "at");
+    } else if (type == "hash") {
+      override = "builtin";
+    } else if (type == "word") {
+      override = "tag";
+    } else if (type == "variable-definition") {
+      return "maybeprop";
+    } else if (type == "interpolation") {
+      return pushContext(state, stream, "interpolation");
+    } else if (type == ":") {
+      return "pseudo";
+    } else if (allowNested && type == "(") {
+      return pushContext(state, stream, "parens");
+    }
+    return state.context.type;
+  };
+
+  states.block = function(type, stream, state) {
+    if (type == "word") {
+      var word = stream.current().toLowerCase();
+      if (propertyKeywords.hasOwnProperty(word)) {
+        override = "property";
+        return "maybeprop";
+      } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {
+        override = highlightNonStandardPropertyKeywords ? "string-2" : "property";
+        return "maybeprop";
+      } else if (allowNested) {
+        override = stream.match(/^\s*:(?:\s|$)/, false) ? "property" : "tag";
+        return "block";
+      } else {
+        override += " error";
+        return "maybeprop";
+      }
+    } else if (type == "meta") {
+      return "block";
+    } else if (!allowNested && (type == "hash" || type == "qualifier")) {
+      override = "error";
+      return "block";
+    } else {
+      return states.top(type, stream, state);
+    }
+  };
+
+  states.maybeprop = function(type, stream, state) {
+    if (type == ":") return pushContext(state, stream, "prop");
+    return pass(type, stream, state);
+  };
+
+  states.prop = function(type, stream, state) {
+    if (type == ";") return popContext(state);
+    if (type == "{" && allowNested) return pushContext(state, stream, "propBlock");
+    if (type == "}" || type == "{") return popAndPass(type, stream, state);
+    if (type == "(") return pushContext(state, stream, "parens");
+
+    if (type == "hash" && !/^#([0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(stream.current())) {
+      override += " error";
+    } else if (type == "word") {
+      wordAsValue(stream);
+    } else if (type == "interpolation") {
+      return pushContext(state, stream, "interpolation");
+    }
+    return "prop";
+  };
+
+  states.propBlock = function(type, _stream, state) {
+    if (type == "}") return popContext(state);
+    if (type == "word") { override = "property"; return "maybeprop"; }
+    return state.context.type;
+  };
+
+  states.parens = function(type, stream, state) {
+    if (type == "{" || type == "}") return popAndPass(type, stream, state);
+    if (type == ")") return popContext(state);
+    if (type == "(") return pushContext(state, stream, "parens");
+    if (type == "interpolation") return pushContext(state, stream, "interpolation");
+    if (type == "word") wordAsValue(stream);
+    return "parens";
+  };
+
+  states.pseudo = function(type, stream, state) {
+    if (type == "meta") return "pseudo";
+
+    if (type == "word") {
+      override = "variable-3";
+      return state.context.type;
+    }
+    return pass(type, stream, state);
+  };
+
+  states.documentTypes = function(type, stream, state) {
+    if (type == "word" && documentTypes.hasOwnProperty(stream.current())) {
+      override = "tag";
+      return state.context.type;
+    } else {
+      return states.atBlock(type, stream, state);
+    }
+  };
+
+  states.atBlock = function(type, stream, state) {
+    if (type == "(") return pushContext(state, stream, "atBlock_parens");
+    if (type == "}" || type == ";") return popAndPass(type, stream, state);
+    if (type == "{") return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top");
+
+    if (type == "interpolation") return pushContext(state, stream, "interpolation");
+
+    if (type == "word") {
+      var word = stream.current().toLowerCase();
+      if (word == "only" || word == "not" || word == "and" || word == "or")
+        override = "keyword";
+      else if (mediaTypes.hasOwnProperty(word))
+        override = "attribute";
+      else if (mediaFeatures.hasOwnProperty(word))
+        override = "property";
+      else if (mediaValueKeywords.hasOwnProperty(word))
+        override = "keyword";
+      else if (propertyKeywords.hasOwnProperty(word))
+        override = "property";
+      else if (nonStandardPropertyKeywords.hasOwnProperty(word))
+        override = highlightNonStandardPropertyKeywords ? "string-2" : "property";
+      else if (valueKeywords.hasOwnProperty(word))
+        override = "atom";
+      else if (colorKeywords.hasOwnProperty(word))
+        override = "keyword";
+      else
+        override = "error";
+    }
+    return state.context.type;
+  };
+
+  states.atComponentBlock = function(type, stream, state) {
+    if (type == "}")
+      return popAndPass(type, stream, state);
+    if (type == "{")
+      return popContext(state) && pushContext(state, stream, allowNested ? "block" : "top", false);
+    if (type == "word")
+      override = "error";
+    return state.context.type;
+  };
+
+  states.atBlock_parens = function(type, stream, state) {
+    if (type == ")") return popContext(state);
+    if (type == "{" || type == "}") return popAndPass(type, stream, state, 2);
+    return states.atBlock(type, stream, state);
+  };
+
+  states.restricted_atBlock_before = function(type, stream, state) {
+    if (type == "{")
+      return pushContext(state, stream, "restricted_atBlock");
+    if (type == "word" && state.stateArg == "@counter-style") {
+      override = "variable";
+      return "restricted_atBlock_before";
+    }
+    return pass(type, stream, state);
+  };
+
+  states.restricted_atBlock = function(type, stream, state) {
+    if (type == "}") {
+      state.stateArg = null;
+      return popContext(state);
+    }
+    if (type == "word") {
+      if ((state.stateArg == "@font-face" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||
+          (state.stateArg == "@counter-style" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))
+        override = "error";
+      else
+        override = "property";
+      return "maybeprop";
+    }
+    return "restricted_atBlock";
+  };
+
+  states.keyframes = function(type, stream, state) {
+    if (type == "word") { override = "variable"; return "keyframes"; }
+    if (type == "{") return pushContext(state, stream, "top");
+    return pass(type, stream, state);
+  };
+
+  states.at = function(type, stream, state) {
+    if (type == ";") return popContext(state);
+    if (type == "{" || type == "}") return popAndPass(type, stream, state);
+    if (type == "word") override = "tag";
+    else if (type == "hash") override = "builtin";
+    return "at";
+  };
+
+  states.interpolation = function(type, stream, state) {
+    if (type == "}") return popContext(state);
+    if (type == "{" || type == ";") return popAndPass(type, stream, state);
+    if (type == "word") override = "variable";
+    else if (type != "variable" && type != "(" && type != ")") override = "error";
+    return "interpolation";
+  };
+
+  return {
+    startState: function(base) {
+      return {tokenize: null,
+              state: inline ? "block" : "top",
+              stateArg: null,
+              context: new Context(inline ? "block" : "top", base || 0, null)};
+    },
+
+    token: function(stream, state) {
+      if (!state.tokenize && stream.eatSpace()) return null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style && typeof style == "object") {
+        type = style[1];
+        style = style[0];
+      }
+      override = style;
+      if (type != "comment")
+        state.state = states[state.state](type, stream, state);
+      return override;
+    },
+
+    indent: function(state, textAfter) {
+      var cx = state.context, ch = textAfter && textAfter.charAt(0);
+      var indent = cx.indent;
+      if (cx.type == "prop" && (ch == "}" || ch == ")")) cx = cx.prev;
+      if (cx.prev) {
+        if (ch == "}" && (cx.type == "block" || cx.type == "top" ||
+                          cx.type == "interpolation" || cx.type == "restricted_atBlock")) {
+          // Resume indentation from parent context.
+          cx = cx.prev;
+          indent = cx.indent;
+        } else if (ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
+            ch == "{" && (cx.type == "at" || cx.type == "atBlock")) {
+          // Dedent relative to current context.
+          indent = Math.max(0, cx.indent - indentUnit);
+        }
+      }
+      return indent;
+    },
+
+    electricChars: "}",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    blockCommentContinue: " * ",
+    lineComment: lineComment,
+    fold: "brace"
+  };
+});
+
+  function keySet(array) {
+    var keys = {};
+    for (var i = 0; i < array.length; ++i) {
+      keys[array[i].toLowerCase()] = true;
+    }
+    return keys;
+  }
+
+  var documentTypes_ = [
+    "domain", "regexp", "url", "url-prefix"
+  ], documentTypes = keySet(documentTypes_);
+
+  var mediaTypes_ = [
+    "all", "aural", "braille", "handheld", "print", "projection", "screen",
+    "tty", "tv", "embossed"
+  ], mediaTypes = keySet(mediaTypes_);
+
+  var mediaFeatures_ = [
+    "width", "min-width", "max-width", "height", "min-height", "max-height",
+    "device-width", "min-device-width", "max-device-width", "device-height",
+    "min-device-height", "max-device-height", "aspect-ratio",
+    "min-aspect-ratio", "max-aspect-ratio", "device-aspect-ratio",
+    "min-device-aspect-ratio", "max-device-aspect-ratio", "color", "min-color",
+    "max-color", "color-index", "min-color-index", "max-color-index",
+    "monochrome", "min-monochrome", "max-monochrome", "resolution",
+    "min-resolution", "max-resolution", "scan", "grid", "orientation",
+    "device-pixel-ratio", "min-device-pixel-ratio", "max-device-pixel-ratio",
+    "pointer", "any-pointer", "hover", "any-hover", "prefers-color-scheme",
+    "dynamic-range", "video-dynamic-range"
+  ], mediaFeatures = keySet(mediaFeatures_);
+
+  var mediaValueKeywords_ = [
+    "landscape", "portrait", "none", "coarse", "fine", "on-demand", "hover",
+    "interlace", "progressive",
+    "dark", "light",
+    "standard", "high"
+  ], mediaValueKeywords = keySet(mediaValueKeywords_);
+
+  var propertyKeywords_ = [
+    "align-content", "align-items", "align-self", "alignment-adjust",
+    "alignment-baseline", "all", "anchor-point", "animation", "animation-delay",
+    "animation-direction", "animation-duration", "animation-fill-mode",
+    "animation-iteration-count", "animation-name", "animation-play-state",
+    "animation-timing-function", "appearance", "azimuth", "backdrop-filter",
+    "backface-visibility", "background", "background-attachment",
+    "background-blend-mode", "background-clip", "background-color",
+    "background-image", "background-origin", "background-position",
+    "background-position-x", "background-position-y", "background-repeat",
+    "background-size", "baseline-shift", "binding", "bleed", "block-size",
+    "bookmark-label", "bookmark-level", "bookmark-state", "bookmark-target",
+    "border", "border-bottom", "border-bottom-color", "border-bottom-left-radius",
+    "border-bottom-right-radius", "border-bottom-style", "border-bottom-width",
+    "border-collapse", "border-color", "border-image", "border-image-outset",
+    "border-image-repeat", "border-image-slice", "border-image-source",
+    "border-image-width", "border-left", "border-left-color", "border-left-style",
+    "border-left-width", "border-radius", "border-right", "border-right-color",
+    "border-right-style", "border-right-width", "border-spacing", "border-style",
+    "border-top", "border-top-color", "border-top-left-radius",
+    "border-top-right-radius", "border-top-style", "border-top-width",
+    "border-width", "bottom", "box-decoration-break", "box-shadow", "box-sizing",
+    "break-after", "break-before", "break-inside", "caption-side", "caret-color",
+    "clear", "clip", "color", "color-profile", "column-count", "column-fill",
+    "column-gap", "column-rule", "column-rule-color", "column-rule-style",
+    "column-rule-width", "column-span", "column-width", "columns", "contain",
+    "content", "counter-increment", "counter-reset", "crop", "cue", "cue-after",
+    "cue-before", "cursor", "direction", "display", "dominant-baseline",
+    "drop-initial-after-adjust", "drop-initial-after-align",
+    "drop-initial-before-adjust", "drop-initial-before-align", "drop-initial-size",
+    "drop-initial-value", "elevation", "empty-cells", "fit", "fit-content", "fit-position",
+    "flex", "flex-basis", "flex-direction", "flex-flow", "flex-grow",
+    "flex-shrink", "flex-wrap", "float", "float-offset", "flow-from", "flow-into",
+    "font", "font-family", "font-feature-settings", "font-kerning",
+    "font-language-override", "font-optical-sizing", "font-size",
+    "font-size-adjust", "font-stretch", "font-style", "font-synthesis",
+    "font-variant", "font-variant-alternates", "font-variant-caps",
+    "font-variant-east-asian", "font-variant-ligatures", "font-variant-numeric",
+    "font-variant-position", "font-variation-settings", "font-weight", "gap",
+    "grid", "grid-area", "grid-auto-columns", "grid-auto-flow", "grid-auto-rows",
+    "grid-column", "grid-column-end", "grid-column-gap", "grid-column-start",
+    "grid-gap", "grid-row", "grid-row-end", "grid-row-gap", "grid-row-start",
+    "grid-template", "grid-template-areas", "grid-template-columns",
+    "grid-template-rows", "hanging-punctuation", "height", "hyphens", "icon",
+    "image-orientation", "image-rendering", "image-resolution", "inline-box-align",
+    "inset", "inset-block", "inset-block-end", "inset-block-start", "inset-inline",
+    "inset-inline-end", "inset-inline-start", "isolation", "justify-content",
+    "justify-items", "justify-self", "left", "letter-spacing", "line-break",
+    "line-height", "line-height-step", "line-stacking", "line-stacking-ruby",
+    "line-stacking-shift", "line-stacking-strategy", "list-style",
+    "list-style-image", "list-style-position", "list-style-type", "margin",
+    "margin-bottom", "margin-left", "margin-right", "margin-top", "marks",
+    "marquee-direction", "marquee-loop", "marquee-play-count", "marquee-speed",
+    "marquee-style", "mask-clip", "mask-composite", "mask-image", "mask-mode",
+    "mask-origin", "mask-position", "mask-repeat", "mask-size","mask-type",
+    "max-block-size", "max-height", "max-inline-size",
+    "max-width", "min-block-size", "min-height", "min-inline-size", "min-width",
+    "mix-blend-mode", "move-to", "nav-down", "nav-index", "nav-left", "nav-right",
+    "nav-up", "object-fit", "object-position", "offset", "offset-anchor",
+    "offset-distance", "offset-path", "offset-position", "offset-rotate",
+    "opacity", "order", "orphans", "outline", "outline-color", "outline-offset",
+    "outline-style", "outline-width", "overflow", "overflow-style",
+    "overflow-wrap", "overflow-x", "overflow-y", "padding", "padding-bottom",
+    "padding-left", "padding-right", "padding-top", "page", "page-break-after",
+    "page-break-before", "page-break-inside", "page-policy", "pause",
+    "pause-after", "pause-before", "perspective", "perspective-origin", "pitch",
+    "pitch-range", "place-content", "place-items", "place-self", "play-during",
+    "position", "presentation-level", "punctuation-trim", "quotes",
+    "region-break-after", "region-break-before", "region-break-inside",
+    "region-fragment", "rendering-intent", "resize", "rest", "rest-after",
+    "rest-before", "richness", "right", "rotate", "rotation", "rotation-point",
+    "row-gap", "ruby-align", "ruby-overhang", "ruby-position", "ruby-span",
+    "scale", "scroll-behavior", "scroll-margin", "scroll-margin-block",
+    "scroll-margin-block-end", "scroll-margin-block-start", "scroll-margin-bottom",
+    "scroll-margin-inline", "scroll-margin-inline-end",
+    "scroll-margin-inline-start", "scroll-margin-left", "scroll-margin-right",
+    "scroll-margin-top", "scroll-padding", "scroll-padding-block",
+    "scroll-padding-block-end", "scroll-padding-block-start",
+    "scroll-padding-bottom", "scroll-padding-inline", "scroll-padding-inline-end",
+    "scroll-padding-inline-start", "scroll-padding-left", "scroll-padding-right",
+    "scroll-padding-top", "scroll-snap-align", "scroll-snap-type",
+    "shape-image-threshold", "shape-inside", "shape-margin", "shape-outside",
+    "size", "speak", "speak-as", "speak-header", "speak-numeral",
+    "speak-punctuation", "speech-rate", "stress", "string-set", "tab-size",
+    "table-layout", "target", "target-name", "target-new", "target-position",
+    "text-align", "text-align-last", "text-combine-upright", "text-decoration",
+    "text-decoration-color", "text-decoration-line", "text-decoration-skip",
+    "text-decoration-skip-ink", "text-decoration-style", "text-emphasis",
+    "text-emphasis-color", "text-emphasis-position", "text-emphasis-style",
+    "text-height", "text-indent", "text-justify", "text-orientation",
+    "text-outline", "text-overflow", "text-rendering", "text-shadow",
+    "text-size-adjust", "text-space-collapse", "text-transform",
+    "text-underline-position", "text-wrap", "top", "touch-action", "transform", "transform-origin",
+    "transform-style", "transition", "transition-delay", "transition-duration",
+    "transition-property", "transition-timing-function", "translate",
+    "unicode-bidi", "user-select", "vertical-align", "visibility", "voice-balance",
+    "voice-duration", "voice-family", "voice-pitch", "voice-range", "voice-rate",
+    "voice-stress", "voice-volume", "volume", "white-space", "widows", "width",
+    "will-change", "word-break", "word-spacing", "word-wrap", "writing-mode", "z-index",
+    // SVG-specific
+    "clip-path", "clip-rule", "mask", "enable-background", "filter", "flood-color",
+    "flood-opacity", "lighting-color", "stop-color", "stop-opacity", "pointer-events",
+    "color-interpolation", "color-interpolation-filters",
+    "color-rendering", "fill", "fill-opacity", "fill-rule", "image-rendering",
+    "marker", "marker-end", "marker-mid", "marker-start", "paint-order", "shape-rendering", "stroke",
+    "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin",
+    "stroke-miterlimit", "stroke-opacity", "stroke-width", "text-rendering",
+    "baseline-shift", "dominant-baseline", "glyph-orientation-horizontal",
+    "glyph-orientation-vertical", "text-anchor", "writing-mode",
+  ], propertyKeywords = keySet(propertyKeywords_);
+
+  var nonStandardPropertyKeywords_ = [
+    "accent-color", "aspect-ratio", "border-block", "border-block-color", "border-block-end",
+    "border-block-end-color", "border-block-end-style", "border-block-end-width",
+    "border-block-start", "border-block-start-color", "border-block-start-style",
+    "border-block-start-width", "border-block-style", "border-block-width",
+    "border-inline", "border-inline-color", "border-inline-end",
+    "border-inline-end-color", "border-inline-end-style",
+    "border-inline-end-width", "border-inline-start", "border-inline-start-color",
+    "border-inline-start-style", "border-inline-start-width",
+    "border-inline-style", "border-inline-width", "content-visibility", "margin-block",
+    "margin-block-end", "margin-block-start", "margin-inline", "margin-inline-end",
+    "margin-inline-start", "overflow-anchor", "overscroll-behavior", "padding-block", "padding-block-end",
+    "padding-block-start", "padding-inline", "padding-inline-end",
+    "padding-inline-start", "scroll-snap-stop", "scrollbar-3d-light-color",
+    "scrollbar-arrow-color", "scrollbar-base-color", "scrollbar-dark-shadow-color",
+    "scrollbar-face-color", "scrollbar-highlight-color", "scrollbar-shadow-color",
+    "scrollbar-track-color", "searchfield-cancel-button", "searchfield-decoration",
+    "searchfield-results-button", "searchfield-results-decoration", "shape-inside", "zoom"
+  ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);
+
+  var fontProperties_ = [
+    "font-display", "font-family", "src", "unicode-range", "font-variant",
+     "font-feature-settings", "font-stretch", "font-weight", "font-style"
+  ], fontProperties = keySet(fontProperties_);
+
+  var counterDescriptors_ = [
+    "additive-symbols", "fallback", "negative", "pad", "prefix", "range",
+    "speak-as", "suffix", "symbols", "system"
+  ], counterDescriptors = keySet(counterDescriptors_);
+
+  var colorKeywords_ = [
+    "aliceblue", "antiquewhite", "aqua", "aquamarine", "azure", "beige",
+    "bisque", "black", "blanchedalmond", "blue", "blueviolet", "brown",
+    "burlywood", "cadetblue", "chartreuse", "chocolate", "coral", "cornflowerblue",
+    "cornsilk", "crimson", "cyan", "darkblue", "darkcyan", "darkgoldenrod",
+    "darkgray", "darkgreen", "darkgrey", "darkkhaki", "darkmagenta", "darkolivegreen",
+    "darkorange", "darkorchid", "darkred", "darksalmon", "darkseagreen",
+    "darkslateblue", "darkslategray", "darkslategrey", "darkturquoise", "darkviolet",
+    "deeppink", "deepskyblue", "dimgray", "dimgrey", "dodgerblue", "firebrick",
+    "floralwhite", "forestgreen", "fuchsia", "gainsboro", "ghostwhite",
+    "gold", "goldenrod", "gray", "grey", "green", "greenyellow", "honeydew",
+    "hotpink", "indianred", "indigo", "ivory", "khaki", "lavender",
+    "lavenderblush", "lawngreen", "lemonchiffon", "lightblue", "lightcoral",
+    "lightcyan", "lightgoldenrodyellow", "lightgray", "lightgreen", "lightgrey", "lightpink",
+    "lightsalmon", "lightseagreen", "lightskyblue", "lightslategray", "lightslategrey",
+    "lightsteelblue", "lightyellow", "lime", "limegreen", "linen", "magenta",
+    "maroon", "mediumaquamarine", "mediumblue", "mediumorchid", "mediumpurple",
+    "mediumseagreen", "mediumslateblue", "mediumspringgreen", "mediumturquoise",
+    "mediumvioletred", "midnightblue", "mintcream", "mistyrose", "moccasin",
+    "navajowhite", "navy", "oldlace", "olive", "olivedrab", "orange", "orangered",
+    "orchid", "palegoldenrod", "palegreen", "paleturquoise", "palevioletred",
+    "papayawhip", "peachpuff", "peru", "pink", "plum", "powderblue",
+    "purple", "rebeccapurple", "red", "rosybrown", "royalblue", "saddlebrown",
+    "salmon", "sandybrown", "seagreen", "seashell", "sienna", "silver", "skyblue",
+    "slateblue", "slategray", "slategrey", "snow", "springgreen", "steelblue", "tan",
+    "teal", "thistle", "tomato", "turquoise", "violet", "wheat", "white",
+    "whitesmoke", "yellow", "yellowgreen"
+  ], colorKeywords = keySet(colorKeywords_);
+
+  var valueKeywords_ = [
+    "above", "absolute", "activeborder", "additive", "activecaption", "afar",
+    "after-white-space", "ahead", "alias", "all", "all-scroll", "alphabetic", "alternate",
+    "always", "amharic", "amharic-abegede", "antialiased", "appworkspace",
+    "arabic-indic", "armenian", "asterisks", "attr", "auto", "auto-flow", "avoid", "avoid-column", "avoid-page",
+    "avoid-region", "axis-pan", "background", "backwards", "baseline", "below", "bidi-override", "binary",
+    "bengali", "blink", "block", "block-axis", "blur", "bold", "bolder", "border", "border-box",
+    "both", "bottom", "break", "break-all", "break-word", "brightness", "bullets", "button",
+    "buttonface", "buttonhighlight", "buttonshadow", "buttontext", "calc", "cambodian",
+    "capitalize", "caps-lock-indicator", "caption", "captiontext", "caret",
+    "cell", "center", "checkbox", "circle", "cjk-decimal", "cjk-earthly-branch",
+    "cjk-heavenly-stem", "cjk-ideographic", "clear", "clip", "close-quote",
+    "col-resize", "collapse", "color", "color-burn", "color-dodge", "column", "column-reverse",
+    "compact", "condensed", "conic-gradient", "contain", "content", "contents",
+    "content-box", "context-menu", "continuous", "contrast", "copy", "counter", "counters", "cover", "crop",
+    "cross", "crosshair", "cubic-bezier", "currentcolor", "cursive", "cyclic", "darken", "dashed", "decimal",
+    "decimal-leading-zero", "default", "default-button", "dense", "destination-atop",
+    "destination-in", "destination-out", "destination-over", "devanagari", "difference",
+    "disc", "discard", "disclosure-closed", "disclosure-open", "document",
+    "dot-dash", "dot-dot-dash",
+    "dotted", "double", "down", "drop-shadow", "e-resize", "ease", "ease-in", "ease-in-out", "ease-out",
+    "element", "ellipse", "ellipsis", "embed", "end", "ethiopic", "ethiopic-abegede",
+    "ethiopic-abegede-am-et", "ethiopic-abegede-gez", "ethiopic-abegede-ti-er",
+    "ethiopic-abegede-ti-et", "ethiopic-halehame-aa-er",
+    "ethiopic-halehame-aa-et", "ethiopic-halehame-am-et",
+    "ethiopic-halehame-gez", "ethiopic-halehame-om-et",
+    "ethiopic-halehame-sid-et", "ethiopic-halehame-so-et",
+    "ethiopic-halehame-ti-er", "ethiopic-halehame-ti-et", "ethiopic-halehame-tig",
+    "ethiopic-numeric", "ew-resize", "exclusion", "expanded", "extends", "extra-condensed",
+    "extra-expanded", "fantasy", "fast", "fill", "fill-box", "fixed", "flat", "flex", "flex-end", "flex-start", "footnotes",
+    "forwards", "from", "geometricPrecision", "georgian", "grayscale", "graytext", "grid", "groove",
+    "gujarati", "gurmukhi", "hand", "hangul", "hangul-consonant", "hard-light", "hebrew",
+    "help", "hidden", "hide", "higher", "highlight", "highlighttext",
+    "hiragana", "hiragana-iroha", "horizontal", "hsl", "hsla", "hue", "hue-rotate", "icon", "ignore",
+    "inactiveborder", "inactivecaption", "inactivecaptiontext", "infinite",
+    "infobackground", "infotext", "inherit", "initial", "inline", "inline-axis",
+    "inline-block", "inline-flex", "inline-grid", "inline-table", "inset", "inside", "intrinsic", "invert",
+    "italic", "japanese-formal", "japanese-informal", "justify", "kannada",
+    "katakana", "katakana-iroha", "keep-all", "khmer",
+    "korean-hangul-formal", "korean-hanja-formal", "korean-hanja-informal",
+    "landscape", "lao", "large", "larger", "left", "level", "lighter", "lighten",
+    "line-through", "linear", "linear-gradient", "lines", "list-item", "listbox", "listitem",
+    "local", "logical", "loud", "lower", "lower-alpha", "lower-armenian",
+    "lower-greek", "lower-hexadecimal", "lower-latin", "lower-norwegian",
+    "lower-roman", "lowercase", "ltr", "luminosity", "malayalam", "manipulation", "match", "matrix", "matrix3d",
+    "media-play-button", "media-slider", "media-sliderthumb",
+    "media-volume-slider", "media-volume-sliderthumb", "medium",
+    "menu", "menulist", "menulist-button",
+    "menutext", "message-box", "middle", "min-intrinsic",
+    "mix", "mongolian", "monospace", "move", "multiple", "multiple_mask_images", "multiply", "myanmar", "n-resize",
+    "narrower", "ne-resize", "nesw-resize", "no-close-quote", "no-drop",
+    "no-open-quote", "no-repeat", "none", "normal", "not-allowed", "nowrap",
+    "ns-resize", "numbers", "numeric", "nw-resize", "nwse-resize", "oblique", "octal", "opacity", "open-quote",
+    "optimizeLegibility", "optimizeSpeed", "oriya", "oromo", "outset",
+    "outside", "outside-shape", "overlay", "overline", "padding", "padding-box",
+    "painted", "page", "paused", "persian", "perspective", "pinch-zoom", "plus-darker", "plus-lighter",
+    "pointer", "polygon", "portrait", "pre", "pre-line", "pre-wrap", "preserve-3d",
+    "progress", "push-button", "radial-gradient", "radio", "read-only",
+    "read-write", "read-write-plaintext-only", "rectangle", "region",
+    "relative", "repeat", "repeating-linear-gradient", "repeating-radial-gradient",
+    "repeating-conic-gradient", "repeat-x", "repeat-y", "reset", "reverse",
+    "rgb", "rgba", "ridge", "right", "rotate", "rotate3d", "rotateX", "rotateY",
+    "rotateZ", "round", "row", "row-resize", "row-reverse", "rtl", "run-in", "running",
+    "s-resize", "sans-serif", "saturate", "saturation", "scale", "scale3d", "scaleX", "scaleY", "scaleZ", "screen",
+    "scroll", "scrollbar", "scroll-position", "se-resize", "searchfield",
+    "searchfield-cancel-button", "searchfield-decoration",
+    "searchfield-results-button", "searchfield-results-decoration", "self-start", "self-end",
+    "semi-condensed", "semi-expanded", "separate", "sepia", "serif", "show", "sidama",
+    "simp-chinese-formal", "simp-chinese-informal", "single",
+    "skew", "skewX", "skewY", "skip-white-space", "slide", "slider-horizontal",
+    "slider-vertical", "sliderthumb-horizontal", "sliderthumb-vertical", "slow",
+    "small", "small-caps", "small-caption", "smaller", "soft-light", "solid", "somali",
+    "source-atop", "source-in", "source-out", "source-over", "space", "space-around", "space-between", "space-evenly", "spell-out", "square",
+    "square-button", "start", "static", "status-bar", "stretch", "stroke", "stroke-box", "sub",
+    "subpixel-antialiased", "svg_masks", "super", "sw-resize", "symbolic", "symbols", "system-ui", "table",
+    "table-caption", "table-cell", "table-column", "table-column-group",
+    "table-footer-group", "table-header-group", "table-row", "table-row-group",
+    "tamil",
+    "telugu", "text", "text-bottom", "text-top", "textarea", "textfield", "thai",
+    "thick", "thin", "threeddarkshadow", "threedface", "threedhighlight",
+    "threedlightshadow", "threedshadow", "tibetan", "tigre", "tigrinya-er",
+    "tigrinya-er-abegede", "tigrinya-et", "tigrinya-et-abegede", "to", "top",
+    "trad-chinese-formal", "trad-chinese-informal", "transform",
+    "translate", "translate3d", "translateX", "translateY", "translateZ",
+    "transparent", "ultra-condensed", "ultra-expanded", "underline", "unidirectional-pan", "unset", "up",
+    "upper-alpha", "upper-armenian", "upper-greek", "upper-hexadecimal",
+    "upper-latin", "upper-norwegian", "upper-roman", "uppercase", "urdu", "url",
+    "var", "vertical", "vertical-text", "view-box", "visible", "visibleFill", "visiblePainted",
+    "visibleStroke", "visual", "w-resize", "wait", "wave", "wider",
+    "window", "windowframe", "windowtext", "words", "wrap", "wrap-reverse", "x-large", "x-small", "xor",
+    "xx-large", "xx-small"
+  ], valueKeywords = keySet(valueKeywords_);
+
+  var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)
+    .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)
+    .concat(valueKeywords_);
+  CodeMirror.registerHelper("hintWords", "css", allWords);
+
+  function tokenCComment(stream, state) {
+    var maybeEnd = false, ch;
+    while ((ch = stream.next()) != null) {
+      if (maybeEnd && ch == "/") {
+        state.tokenize = null;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return ["comment", "comment"];
+  }
+
+  CodeMirror.defineMIME("text/css", {
+    documentTypes: documentTypes,
+    mediaTypes: mediaTypes,
+    mediaFeatures: mediaFeatures,
+    mediaValueKeywords: mediaValueKeywords,
+    propertyKeywords: propertyKeywords,
+    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+    fontProperties: fontProperties,
+    counterDescriptors: counterDescriptors,
+    colorKeywords: colorKeywords,
+    valueKeywords: valueKeywords,
+    tokenHooks: {
+      "/": function(stream, state) {
+        if (!stream.eat("*")) return false;
+        state.tokenize = tokenCComment;
+        return tokenCComment(stream, state);
+      }
+    },
+    name: "css"
+  });
+
+  CodeMirror.defineMIME("text/x-scss", {
+    mediaTypes: mediaTypes,
+    mediaFeatures: mediaFeatures,
+    mediaValueKeywords: mediaValueKeywords,
+    propertyKeywords: propertyKeywords,
+    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+    colorKeywords: colorKeywords,
+    valueKeywords: valueKeywords,
+    fontProperties: fontProperties,
+    allowNested: true,
+    lineComment: "//",
+    tokenHooks: {
+      "/": function(stream, state) {
+        if (stream.eat("/")) {
+          stream.skipToEnd();
+          return ["comment", "comment"];
+        } else if (stream.eat("*")) {
+          state.tokenize = tokenCComment;
+          return tokenCComment(stream, state);
+        } else {
+          return ["operator", "operator"];
+        }
+      },
+      ":": function(stream) {
+        if (stream.match(/^\s*\{/, false))
+          return [null, null]
+        return false;
+      },
+      "$": function(stream) {
+        stream.match(/^[\w-]+/);
+        if (stream.match(/^\s*:/, false))
+          return ["variable-2", "variable-definition"];
+        return ["variable-2", "variable"];
+      },
+      "#": function(stream) {
+        if (!stream.eat("{")) return false;
+        return [null, "interpolation"];
+      }
+    },
+    name: "css",
+    helperType: "scss"
+  });
+
+  CodeMirror.defineMIME("text/x-less", {
+    mediaTypes: mediaTypes,
+    mediaFeatures: mediaFeatures,
+    mediaValueKeywords: mediaValueKeywords,
+    propertyKeywords: propertyKeywords,
+    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+    colorKeywords: colorKeywords,
+    valueKeywords: valueKeywords,
+    fontProperties: fontProperties,
+    allowNested: true,
+    lineComment: "//",
+    tokenHooks: {
+      "/": function(stream, state) {
+        if (stream.eat("/")) {
+          stream.skipToEnd();
+          return ["comment", "comment"];
+        } else if (stream.eat("*")) {
+          state.tokenize = tokenCComment;
+          return tokenCComment(stream, state);
+        } else {
+          return ["operator", "operator"];
+        }
+      },
+      "@": function(stream) {
+        if (stream.eat("{")) return [null, "interpolation"];
+        if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\b/i, false)) return false;
+        stream.eatWhile(/[\w\\\-]/);
+        if (stream.match(/^\s*:/, false))
+          return ["variable-2", "variable-definition"];
+        return ["variable-2", "variable"];
+      },
+      "&": function() {
+        return ["atom", "atom"];
+      }
+    },
+    name: "css",
+    helperType: "less"
+  });
+
+  CodeMirror.defineMIME("text/x-gss", {
+    documentTypes: documentTypes,
+    mediaTypes: mediaTypes,
+    mediaFeatures: mediaFeatures,
+    propertyKeywords: propertyKeywords,
+    nonStandardPropertyKeywords: nonStandardPropertyKeywords,
+    fontProperties: fontProperties,
+    counterDescriptors: counterDescriptors,
+    colorKeywords: colorKeywords,
+    valueKeywords: valueKeywords,
+    supportsAtComponent: true,
+    tokenHooks: {
+      "/": function(stream, state) {
+        if (!stream.eat("*")) return false;
+        state.tokenize = tokenCComment;
+        return tokenCComment(stream, state);
+      }
+    },
+    name: "css",
+    helperType: "gss"
+  });
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/gss.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,104 @@
+<!doctype html>
+
+<title>CodeMirror: Closure Stylesheets (GSS) mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../addon/hint/show-hint.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="css.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../../addon/hint/show-hint.js"></script>
+<script src="../../addon/hint/css-hint.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Closure Stylesheets (GSS)</a>
+  </ul>
+</div>
+
+<article>
+<h2>Closure Stylesheets (GSS) mode</h2>
+<form><textarea id="code" name="code">
+/* Some example Closure Stylesheets */
+
+@provide 'some.styles';
+
+@require 'other.styles';
+
+@component {
+
+@def FONT_FAMILY           "Times New Roman", Georgia, Serif;
+@def FONT_SIZE_NORMAL      15px;
+@def FONT_NORMAL           normal FONT_SIZE_NORMAL FONT_FAMILY;
+
+@def BG_COLOR              rgb(235, 239, 249);
+
+@def DIALOG_BORDER_COLOR   rgb(107, 144, 218);
+@def DIALOG_BG_COLOR       BG_COLOR;
+
+@def LEFT_HAND_NAV_WIDTH    180px;
+@def LEFT_HAND_NAV_PADDING  3px;
+
+@defmixin size(WIDTH, HEIGHT) {
+  width: WIDTH;
+  height: HEIGHT;
+}
+
+body {
+  background-color: BG_COLOR;
+  margin: 0;
+  padding: 3em 6em;
+  font: FONT_NORMAL;
+  color: #000;
+}
+
+#navigation a {
+  font-weight: bold;
+  text-decoration: none !important;
+}
+
+.dialog {
+  background-color: DIALOG_BG_COLOR;
+  border: 1px solid DIALOG_BORDER_COLOR;
+}
+
+.content {
+  position: absolute;
+  margin-left: add(LEFT_HAND_NAV_PADDING,  /* padding left */
+                   LEFT_HAND_NAV_WIDTH,
+                   LEFT_HAND_NAV_PADDING); /* padding right */
+
+}
+
+.logo {
+  @mixin size(150px, 55px);
+  background-image: url('http://www.google.com/images/logo_sm.gif');
+}
+
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        extraKeys: {"Ctrl-Space": "autocomplete"},
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-gss"
+      });
+    </script>
+
+    <p>A mode for <a href="https://github.com/google/closure-stylesheets">Closure Stylesheets</a> (GSS).</p>
+    <p><strong>MIME type defined:</strong> <code>text/x-gss</code>.</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#gss_*">normal</a>,  <a href="../../test/index.html#verbose,gss_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/gss_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,17 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  "use strict";
+
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-gss");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "gss"); }
+
+  MT("atComponent",
+     "[def @component] {",
+     "[tag foo] {",
+     "  [property color]: [keyword black];",
+     "}",
+     "}");
+
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,81 @@
+<!doctype html>
+
+<title>CodeMirror: CSS mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../addon/hint/show-hint.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="css.js"></script>
+<script src="../../addon/hint/show-hint.js"></script>
+<script src="../../addon/hint/css-hint.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">CSS</a>
+  </ul>
+</div>
+
+<article>
+<h2>CSS mode</h2>
+<form><textarea id="code" name="code">
+/* Some example CSS */
+
+@import url("something.css");
+
+body {
+  margin: 0;
+  padding: 3em 6em;
+  font-family: tahoma, arial, sans-serif;
+  color: #000;
+}
+
+#navigation a {
+  font-weight: bold;
+  text-decoration: none !important;
+}
+
+h1 {
+  font-size: 2.5em;
+}
+
+h2 {
+  font-size: 1.7em;
+}
+
+h1:before, h2:before {
+  content: "::";
+}
+
+code {
+  font-family: courier, monospace;
+  font-size: 80%;
+  color: #418A8A;
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        extraKeys: {"Ctrl-Space": "autocomplete"}
+      });
+    </script>
+
+  <p>CSS mode supports this option:</p>
+  <d1>
+    <dt><code><strong>highlightNonStandardPropertyKeywords</strong>: boolean</code></dt>
+    <dd>Whether to highlight non-standard CSS property keywords such as <code>margin-inline</code> or <code>zoom</code> (default: <code>true</code>).</dd>
+  </d1>
+
+    <p><strong>MIME types defined:</strong> <code>text/css</code>, <code>text/x-scss</code> (<a href="scss.html">demo</a>), <code>text/x-less</code> (<a href="less.html">demo</a>).</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#css_*">normal</a>,  <a href="../../test/index.html#verbose,css_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/less.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,152 @@
+<!doctype html>
+
+<title>CodeMirror: LESS mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="css.js"></script>
+<style>.CodeMirror {border: 1px solid #ddd; line-height: 1.2;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">LESS</a>
+  </ul>
+</div>
+
+<article>
+<h2>LESS mode</h2>
+<form><textarea id="code" name="code">@media screen and (device-aspect-ratio: 16/9) { … }
+@media screen and (device-aspect-ratio: 1280/720) { … }
+@media screen and (device-aspect-ratio: 2560/1440) { … }
+
+html:lang(fr-be)
+
+tr:nth-child(2n+1) /* represents every odd row of an HTML table */
+
+img:nth-of-type(2n+1) { float: right; }
+img:nth-of-type(2n) { float: left; }
+
+body > h2:not(:first-of-type):not(:last-of-type)
+
+html|*:not(:link):not(:visited)
+*|*:not(:hover)
+p::first-line { text-transform: uppercase }
+
+@namespace foo url(http://www.example.com);
+foo|h1 { color: blue }  /* first rule */
+
+span[hello="Ocean"][goodbye="Land"]
+
+E[foo]{
+  padding:65px;
+}
+
+input[type="search"]::-webkit-search-decoration,
+input[type="search"]::-webkit-search-cancel-button {
+  -webkit-appearance: none; // Inner-padding issues in Chrome OSX, Safari 5
+}
+button::-moz-focus-inner,
+input::-moz-focus-inner { // Inner padding and border oddities in FF3/4
+  padding: 0;
+  border: 0;
+}
+.btn {
+  // reset here as of 2.0.3 due to Recess property order
+  border-color: #ccc;
+  border-color: rgba(0,0,0,.1) rgba(0,0,0,.1) rgba(0,0,0,.25);
+}
+fieldset span button, fieldset span input[type="file"] {
+  font-size:12px;
+	font-family:Arial, Helvetica, sans-serif;
+}
+
+.rounded-corners (@radius: 5px) {
+  border-radius: @radius;
+  -webkit-border-radius: @radius;
+  -moz-border-radius: @radius;
+}
+
+@import url("something.css");
+
+@light-blue:   hsl(190, 50%, 65%);
+
+#menu {
+  position: absolute;
+  width: 100%;
+  z-index: 3;
+  clear: both;
+  display: block;
+  background-color: @blue;
+  height: 42px;
+  border-top: 2px solid lighten(@alpha-blue, 20%);
+  border-bottom: 2px solid darken(@alpha-blue, 25%);
+  .box-shadow(0, 1px, 8px, 0.6);
+  -moz-box-shadow: 0 0 0 #000; // Because firefox sucks.
+
+  &.docked {
+    background-color: hsla(210, 60%, 40%, 0.4);
+  }
+  &:hover {
+    background-color: @blue;
+  }
+
+  #dropdown {
+    margin: 0 0 0 117px;
+    padding: 0;
+    padding-top: 5px;
+    display: none;
+    width: 190px;
+    border-top: 2px solid @medium;
+    color: @highlight;
+    border: 2px solid darken(@medium, 25%);
+    border-left-color: darken(@medium, 15%);
+    border-right-color: darken(@medium, 15%);
+    border-top-width: 0;
+    background-color: darken(@medium, 10%);
+    ul {
+      padding: 0px;  
+    }
+    li {
+      font-size: 14px;
+      display: block;
+      text-align: left;
+      padding: 0;
+      border: 0;
+      a {
+        display: block;
+        padding: 0px 15px;  
+        text-decoration: none;
+        color: white;  
+        &:hover {
+          background-color: darken(@medium, 15%);
+          text-decoration: none;
+        }
+      }
+    }
+    .border-radius(5px, bottom);
+    .box-shadow(0, 6px, 8px, 0.5);
+  }
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-less"
+      });
+    </script>
+
+    <p>The LESS mode is a sub-mode of the <a href="index.html">CSS mode</a> (defined in <code>css.js</code>).</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#less_*">normal</a>,  <a href="../../test/index.html#verbose,less_*">verbose</a>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/less_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,54 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  "use strict";
+
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-less");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "less"); }
+
+  MT("variable",
+     "[variable-2 @base]: [atom #f04615];",
+     "[qualifier .class] {",
+     "  [property width]: [variable&callee percentage]([number 0.5]); [comment // returns `50%`]",
+     "  [property color]: [variable&callee saturate]([variable-2 @base], [number 5%]);",
+     "}");
+
+  MT("amp",
+     "[qualifier .child], [qualifier .sibling] {",
+     "  [qualifier .parent] [atom &] {",
+     "    [property color]: [keyword black];",
+     "  }",
+     "  [atom &] + [atom &] {",
+     "    [property color]: [keyword red];",
+     "  }",
+     "}");
+
+  MT("mixin",
+     "[qualifier .mixin] ([variable dark]; [variable-2 @color]) {",
+     "  [property color]: [variable&callee darken]([variable-2 @color], [number 10%]);",
+     "}",
+     "[qualifier .mixin] ([variable light]; [variable-2 @color]) {",
+     "  [property color]: [variable&callee lighten]([variable-2 @color], [number 10%]);",
+     "}",
+     "[qualifier .mixin] ([variable-2 @_]; [variable-2 @color]) {",
+     "  [property display]: [atom block];",
+     "}",
+     "[variable-2 @switch]: [variable light];",
+     "[qualifier .class] {",
+     "  [qualifier .mixin]([variable-2 @switch]; [atom #888]);",
+     "}");
+
+  MT("nest",
+     "[qualifier .one] {",
+     "  [def @media] ([property width]: [number 400px]) {",
+     "    [property font-size]: [number 1.2em];",
+     "    [def @media] [attribute print] [keyword and] [property color] {",
+     "      [property color]: [keyword blue];",
+     "    }",
+     "  }",
+     "}");
+
+
+  MT("interpolation", ".@{[variable foo]} { [property font-weight]: [atom bold]; }");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/scss.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,158 @@
+<!doctype html>
+
+<title>CodeMirror: SCSS mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="css.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">SCSS</a>
+  </ul>
+</div>
+
+<article>
+<h2>SCSS mode</h2>
+<form><textarea id="code" name="code">
+/* Some example SCSS */
+
+@import "compass/css3";
+$variable: #333;
+
+$blue: #3bbfce;
+$margin: 16px;
+
+.content-navigation {
+  #nested {
+    background-color: black;
+  }
+  border-color: $blue;
+  color:
+    darken($blue, 9%);
+}
+
+.border {
+  padding: $margin / 2;
+  margin: $margin / 2;
+  border-color: $blue;
+}
+
+@mixin table-base {
+  th {
+    text-align: center;
+    font-weight: bold;
+  }
+  td, th {padding: 2px}
+}
+
+table.hl {
+  margin: 2em 0;
+  td.ln {
+    text-align: right;
+  }
+}
+
+li {
+  font: {
+    family: serif;
+    weight: bold;
+    size: 1.2em;
+  }
+}
+
+@mixin left($dist) {
+  float: left;
+  margin-left: $dist;
+}
+
+#data {
+  @include left(10px);
+  @include table-base;
+}
+
+.source {
+  @include flow-into(target);
+  border: 10px solid green;
+  margin: 20px;
+  width: 200px; }
+
+.new-container {
+  @include flow-from(target);
+  border: 10px solid red;
+  margin: 20px;
+  width: 200px; }
+
+body {
+  margin: 0;
+  padding: 3em 6em;
+  font-family: tahoma, arial, sans-serif;
+  color: #000;
+}
+
+@mixin yellow() {
+  background: yellow;
+}
+
+.big {
+  font-size: 14px;
+}
+
+.nested {
+  @include border-radius(3px);
+  @extend .big;
+  p {
+    background: whitesmoke;
+    a {
+      color: red;
+    }
+  }
+}
+
+#navigation a {
+  font-weight: bold;
+  text-decoration: none !important;
+}
+
+h1 {
+  font-size: 2.5em;
+}
+
+h2 {
+  font-size: 1.7em;
+}
+
+h1:before, h2:before {
+  content: "::";
+}
+
+code {
+  font-family: courier, monospace;
+  font-size: 80%;
+  color: #418A8A;
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-scss"
+      });
+    </script>
+
+    <p>The SCSS mode is a sub-mode of the <a href="index.html">CSS mode</a> (defined in <code>css.js</code>).</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#scss_*">normal</a>,  <a href="../../test/index.html#verbose,scss_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/scss_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,110 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-scss");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "scss"); }
+
+  MT('url_with_quotation',
+    "[tag foo] { [property background]:[variable&callee url]([string test.jpg]) }");
+
+  MT('url_with_double_quotes',
+    "[tag foo] { [property background]:[variable&callee url]([string \"test.jpg\"]) }");
+
+  MT('url_with_single_quotes',
+    "[tag foo] { [property background]:[variable&callee url]([string \'test.jpg\']) }");
+
+  MT('string',
+    "[def @import] [string \"compass/css3\"]");
+
+  MT('important_keyword',
+    "[tag foo] { [property background]:[variable&callee url]([string \'test.jpg\']) [keyword !important] }");
+
+  MT('variable',
+    "[variable-2 $blue]:[atom #333]");
+
+  MT('variable_as_attribute',
+    "[tag foo] { [property color]:[variable-2 $blue] }");
+
+  MT('numbers',
+    "[tag foo] { [property padding]:[number 10px] [number 10] [number 10em] [number 8in] }");
+
+  MT('number_percentage',
+    "[tag foo] { [property width]:[number 80%] }");
+
+  MT('selector',
+    "[builtin #hello][qualifier .world]{}");
+
+  MT('singleline_comment',
+    "[comment // this is a comment]");
+
+  MT('multiline_comment',
+    "[comment /*foobar*/]");
+
+  MT('attribute_with_hyphen',
+    "[tag foo] { [property font-size]:[number 10px] }");
+
+  MT('string_after_attribute',
+    "[tag foo] { [property content]:[string \"::\"] }");
+
+  MT('directives',
+    "[def @include] [qualifier .mixin]");
+
+  MT('basic_structure',
+    "[tag p] { [property background]:[keyword red]; }");
+
+  MT('nested_structure',
+    "[tag p] { [tag a] { [property color]:[keyword red]; } }");
+
+  MT('mixin',
+    "[def @mixin] [tag table-base] {}");
+
+  MT('number_without_semicolon',
+    "[tag p] {[property width]:[number 12]}",
+    "[tag a] {[property color]:[keyword red];}");
+
+  MT('atom_in_nested_block',
+    "[tag p] { [tag a] { [property color]:[atom #000]; } }");
+
+  MT('interpolation_in_property',
+    "[tag foo] { #{[variable-2 $hello]}:[number 2]; }");
+
+  MT('interpolation_in_selector',
+    "[tag foo]#{[variable-2 $hello]} { [property color]:[atom #000]; }");
+
+  MT('interpolation_error',
+    "[tag foo]#{[variable foo]} { [property color]:[atom #000]; }");
+
+  MT("divide_operator",
+    "[tag foo] { [property width]:[number 4] [operator /] [number 2] }");
+
+  MT('nested_structure_with_id_selector',
+    "[tag p] { [builtin #hello] { [property color]:[keyword red]; } }");
+
+  MT('indent_mixin',
+     "[def @mixin] [tag container] (",
+     "  [variable-2 $a]: [number 10],",
+     "  [variable-2 $b]: [number 10])",
+     "{}");
+
+  MT('indent_nested',
+     "[tag foo] {",
+     "  [tag bar] {",
+     "  }",
+     "}");
+
+  MT('indent_parentheses',
+     "[tag foo] {",
+     "  [property color]: [variable&callee darken]([variable-2 $blue],",
+     "    [number 9%]);",
+     "}");
+
+  MT('indent_vardef',
+     "[variable-2 $name]:",
+     "  [string 'val'];",
+     "[tag tag] {",
+     "  [tag inner] {",
+     "    [property margin]: [number 3px];",
+     "  }",
+     "}");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/css/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,217 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "css");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  // Error, because "foobarhello" is neither a known type or property, but
+  // property was expected (after "and"), and it should be in parentheses.
+  MT("atMediaUnknownType",
+     "[def @media] [attribute screen] [keyword and] [error foobarhello] { }");
+
+  // Soft error, because "foobarhello" is not a known property or type.
+  MT("atMediaUnknownProperty",
+     "[def @media] [attribute screen] [keyword and] ([error foobarhello]) { }");
+
+  // Make sure nesting works with media queries
+  MT("atMediaMaxWidthNested",
+     "[def @media] [attribute screen] [keyword and] ([property max-width]: [number 25px]) { [tag foo] { } }");
+
+  MT("atMediaFeatureValueKeyword",
+     "[def @media] ([property orientation]: [keyword landscape]) { }");
+
+  MT("atMediaUnknownFeatureValueKeyword",
+     "[def @media] ([property orientation]: [error upsidedown]) { }");
+
+  MT("atMediaUppercase",
+     "[def @MEDIA] ([property orienTAtion]: [keyword landScape]) { }");
+
+  MT("tagSelector",
+     "[tag foo] { }");
+
+  MT("classSelector",
+     "[qualifier .foo-bar_hello] { }");
+
+  MT("idSelector",
+     "[builtin #foo] { [error #foo] }");
+
+  MT("tagSelectorUnclosed",
+     "[tag foo] { [property margin]: [number 0] } [tag bar] { }");
+
+  MT("tagStringNoQuotes",
+     "[tag foo] { [property font-family]: [variable hello] [variable world]; }");
+
+  MT("tagStringDouble",
+     "[tag foo] { [property font-family]: [string \"hello world\"]; }");
+
+  MT("tagStringSingle",
+     "[tag foo] { [property font-family]: [string 'hello world']; }");
+
+  MT("tagColorKeyword",
+     "[tag foo] {",
+     "  [property color]: [keyword black];",
+     "  [property color]: [keyword navy];",
+     "  [property color]: [keyword yellow];",
+     "}");
+
+  MT("tagColorHex3",
+     "[tag foo] { [property background]: [atom #fff]; }");
+
+  MT("tagColorHex4",
+     "[tag foo] { [property background]: [atom #ffff]; }");
+
+  MT("tagColorHex6",
+     "[tag foo] { [property background]: [atom #ffffff]; }");
+
+  MT("tagColorHex8",
+     "[tag foo] { [property background]: [atom #ffffffff]; }");
+
+  MT("tagColorHex5Invalid",
+     "[tag foo] { [property background]: [atom&error #fffff]; }");
+
+  MT("tagColorHexInvalid",
+     "[tag foo] { [property background]: [atom&error #ffg]; }");
+
+  MT("tagNegativeNumber",
+     "[tag foo] { [property margin]: [number -5px]; }");
+
+  MT("tagPositiveNumber",
+     "[tag foo] { [property padding]: [number 5px]; }");
+
+  MT("tagVendor",
+     "[tag foo] { [meta -foo-][property box-sizing]: [meta -foo-][atom border-box]; }");
+
+  MT("tagBogusProperty",
+     "[tag foo] { [property&error barhelloworld]: [number 0]; }");
+
+  MT("tagTwoProperties",
+     "[tag foo] { [property margin]: [number 0]; [property padding]: [number 0]; }");
+
+  MT("tagTwoPropertiesURL",
+     "[tag foo] { [property background]: [variable&callee url]([string //example.com/foo.png]); [property padding]: [number 0]; }");
+
+  MT("indent_tagSelector",
+     "[tag strong], [tag em] {",
+     "  [property background]: [variable&callee rgba](",
+     "    [number 255], [number 255], [number 0], [number .2]",
+     "  );",
+     "}");
+
+  MT("indent_atMedia",
+     "[def @media] {",
+     "  [tag foo] {",
+     "    [property color]:",
+     "      [keyword yellow];",
+     "  }",
+     "}");
+
+  MT("indent_comma",
+     "[tag foo] {",
+     "  [property font-family]: [variable verdana],",
+     "    [atom sans-serif];",
+     "}");
+
+  MT("indent_parentheses",
+     "[tag foo]:[variable-3 before] {",
+     "  [property background]: [variable&callee url](",
+     "[string     blahblah]",
+     "[string     etc]",
+     "[string   ]) [keyword !important];",
+     "}");
+
+  MT("font_face",
+     "[def @font-face] {",
+     "  [property font-family]: [string 'myfont'];",
+     "  [error nonsense]: [string 'abc'];",
+     "  [property src]: [variable&callee url]([string http://blah]),",
+     "    [variable&callee url]([string http://foo]);",
+     "}");
+
+  MT("empty_url",
+     "[def @import] [variable&callee url]() [attribute screen];");
+
+  MT("parens",
+     "[qualifier .foo] {",
+     "  [property background-image]: [variable&callee fade]([atom #000], [number 20%]);",
+     "  [property border-image]: [variable&callee linear-gradient](",
+     "    [atom to] [atom bottom],",
+     "    [variable&callee fade]([atom #000], [number 20%]) [number 0%],",
+     "    [variable&callee fade]([atom #000], [number 20%]) [number 100%]",
+     "  );",
+     "}");
+
+  MT("css_variable",
+     ":[variable-3 root] {",
+     "  [variable-2 --main-color]: [atom #06c];",
+     "}",
+     "[tag h1][builtin #foo] {",
+     "  [property color]: [variable&callee var]([variable-2 --main-color]);",
+     "}");
+
+  MT("blank_css_variable",
+     ":[variable-3 root] {",
+     "  [variable-2 --]: [atom #06c];",
+     "}",
+     "[tag h1][builtin #foo] {",
+     "  [property color]: [variable&callee var]([variable-2 --]);",
+     "}");
+
+  MT("supports",
+     "[def @supports] ([keyword not] (([property text-align-last]: [atom justify]) [keyword or] ([meta -moz-][property text-align-last]: [atom justify])) {",
+     "  [property text-align-last]: [atom justify];",
+     "}");
+
+   MT("document",
+      "[def @document] [variable&callee url]([string http://blah]),",
+      "  [variable&callee url-prefix]([string https://]),",
+      "  [variable&callee domain]([string blah.com]),",
+      "  [variable&callee regexp]([string \".*blah.+\"]) {",
+      "    [builtin #id] {",
+      "      [property background-color]: [keyword white];",
+      "    }",
+      "    [tag foo] {",
+      "      [property font-family]: [variable Verdana], [atom sans-serif];",
+      "    }",
+      "}");
+
+   MT("document_url",
+      "[def @document] [variable&callee url]([string http://blah]) { [qualifier .class] { } }");
+
+   MT("document_urlPrefix",
+      "[def @document] [variable&callee url-prefix]([string https://]) { [builtin #id] { } }");
+
+   MT("document_domain",
+      "[def @document] [variable&callee domain]([string blah.com]) { [tag foo] { } }");
+
+   MT("document_regexp",
+      "[def @document] [variable&callee regexp]([string \".*blah.+\"]) { [builtin #id] { } }");
+
+   MT("counter-style",
+      "[def @counter-style] [variable binary] {",
+      "  [property system]: [atom numeric];",
+      "  [property symbols]: [number 0] [number 1];",
+      "  [property suffix]: [string \".\"];",
+      "  [property range]: [atom infinite];",
+      "  [property speak-as]: [atom numeric];",
+      "}");
+
+   MT("counter-style-additive-symbols",
+      "[def @counter-style] [variable simple-roman] {",
+      "  [property system]: [atom additive];",
+      "  [property additive-symbols]: [number 10] [variable X], [number 5] [variable V], [number 1] [variable I];",
+      "  [property range]: [number 1] [number 49];",
+      "}");
+
+   MT("counter-style-use",
+      "[tag ol][qualifier .roman] { [property list-style]: [variable simple-roman]; }");
+
+   MT("counter-style-symbols",
+      "[tag ol] { [property list-style]: [variable&callee symbols]([atom cyclic] [string \"*\"] [string \"\\2020\"] [string \"\\2021\"] [string \"\\A7\"]); }");
+
+  MT("comment-does-not-disrupt",
+     "[def @font-face] [comment /* foo */] {",
+     "  [property src]: [variable&callee url]([string x]);",
+     "  [property font-family]: [variable One];",
+     "}")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cypher/cypher.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,152 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// By the Neo4j Team and contributors.
+// https://github.com/neo4j-contrib/CodeMirror
+
+(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";
+  var wordRegexp = function(words) {
+    return new RegExp("^(?:" + words.join("|") + ")$", "i");
+  };
+
+  CodeMirror.defineMode("cypher", function(config) {
+    var tokenBase = function(stream/*, state*/) {
+      curPunc = null
+      var ch = stream.next();
+      if (ch ==='"') {
+        stream.match(/^[^"]*"/);
+        return "string";
+      }
+      if (ch === "'") {
+        stream.match(/^[^']*'/);
+        return "string";
+      }
+      if (/[{}\(\),\.;\[\]]/.test(ch)) {
+        curPunc = ch;
+        return "node";
+      } else if (ch === "/" && stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      } else if (operatorChars.test(ch)) {
+        stream.eatWhile(operatorChars);
+        return null;
+      } else {
+        stream.eatWhile(/[_\w\d]/);
+        if (stream.eat(":")) {
+          stream.eatWhile(/[\w\d_\-]/);
+          return "atom";
+        }
+        var word = stream.current();
+        if (funcs.test(word)) return "builtin";
+        if (preds.test(word)) return "def";
+        if (keywords.test(word) || systemKeywords.test(word)) return "keyword";
+        return "variable";
+      }
+    };
+    var pushContext = function(state, type, col) {
+      return state.context = {
+        prev: state.context,
+        indent: state.indent,
+        col: col,
+        type: type
+      };
+    };
+    var popContext = function(state) {
+      state.indent = state.context.indent;
+      return state.context = state.context.prev;
+    };
+    var indentUnit = config.indentUnit;
+    var curPunc;
+    var funcs = wordRegexp(["abs", "acos", "allShortestPaths", "asin", "atan", "atan2", "avg", "ceil", "coalesce", "collect", "cos", "cot", "count", "degrees", "e", "endnode", "exp", "extract", "filter", "floor", "haversin", "head", "id", "keys", "labels", "last", "left", "length", "log", "log10", "lower", "ltrim", "max", "min", "node", "nodes", "percentileCont", "percentileDisc", "pi", "radians", "rand", "range", "reduce", "rel", "relationship", "relationships", "replace", "reverse", "right", "round", "rtrim", "shortestPath", "sign", "sin", "size", "split", "sqrt", "startnode", "stdev", "stdevp", "str", "substring", "sum", "tail", "tan", "timestamp", "toFloat", "toInt", "toString", "trim", "type", "upper"]);
+    var preds = wordRegexp(["all", "and", "any", "contains", "exists", "has", "in", "none", "not", "or", "single", "xor"]);
+    var keywords = wordRegexp(["as", "asc", "ascending", "assert", "by", "case", "commit", "constraint", "create", "csv", "cypher", "delete", "desc", "descending", "detach", "distinct", "drop", "else", "end", "ends", "explain", "false", "fieldterminator", "foreach", "from", "headers", "in", "index", "is", "join", "limit", "load", "match", "merge", "null", "on", "optional", "order", "periodic", "profile", "remove", "return", "scan", "set", "skip", "start", "starts", "then", "true", "union", "unique", "unwind", "using", "when", "where", "with", "call", "yield"]);
+    var systemKeywords = wordRegexp(["access", "active", "assign", "all", "alter", "as", "catalog", "change", "copy", "create", "constraint", "constraints", "current", "database", "databases", "dbms", "default", "deny", "drop", "element", "elements", "exists", "from", "grant", "graph", "graphs", "if", "index", "indexes", "label", "labels", "management", "match", "name", "names", "new", "node", "nodes", "not", "of", "on", "or", "password", "populated", "privileges", "property", "read", "relationship", "relationships", "remove", "replace", "required", "revoke", "role", "roles", "set", "show", "start", "status", "stop", "suspended", "to", "traverse", "type", "types", "user", "users", "with", "write"]);
+    var operatorChars = /[*+\-<>=&|~%^]/;
+
+    return {
+      startState: function(/*base*/) {
+        return {
+          tokenize: tokenBase,
+          context: null,
+          indent: 0,
+          col: 0
+        };
+      },
+      token: function(stream, state) {
+        if (stream.sol()) {
+          if (state.context && (state.context.align == null)) {
+            state.context.align = false;
+          }
+          state.indent = stream.indentation();
+        }
+        if (stream.eatSpace()) {
+          return null;
+        }
+        var style = state.tokenize(stream, state);
+        if (style !== "comment" && state.context && (state.context.align == null) && state.context.type !== "pattern") {
+          state.context.align = true;
+        }
+        if (curPunc === "(") {
+          pushContext(state, ")", stream.column());
+        } else if (curPunc === "[") {
+          pushContext(state, "]", stream.column());
+        } else if (curPunc === "{") {
+          pushContext(state, "}", stream.column());
+        } else if (/[\]\}\)]/.test(curPunc)) {
+          while (state.context && state.context.type === "pattern") {
+            popContext(state);
+          }
+          if (state.context && curPunc === state.context.type) {
+            popContext(state);
+          }
+        } else if (curPunc === "." && state.context && state.context.type === "pattern") {
+          popContext(state);
+        } else if (/atom|string|variable/.test(style) && state.context) {
+          if (/[\}\]]/.test(state.context.type)) {
+            pushContext(state, "pattern", stream.column());
+          } else if (state.context.type === "pattern" && !state.context.align) {
+            state.context.align = true;
+            state.context.col = stream.column();
+          }
+        }
+        return style;
+      },
+      indent: function(state, textAfter) {
+        var firstChar = textAfter && textAfter.charAt(0);
+        var context = state.context;
+        if (/[\]\}]/.test(firstChar)) {
+          while (context && context.type === "pattern") {
+            context = context.prev;
+          }
+        }
+        var closing = context && firstChar === context.type;
+        if (!context) return 0;
+        if (context.type === "keywords") return CodeMirror.commands.newlineAndIndent;
+        if (context.align) return context.col + (closing ? 0 : 1);
+        return context.indent + (closing ? 0 : indentUnit);
+      }
+    };
+  });
+
+  CodeMirror.modeExtensions["cypher"] = {
+    autoFormatLineBreaks: function(text) {
+      var i, lines, reProcessedPortion;
+      var lines = text.split("\n");
+      var reProcessedPortion = /\s+\b(return|where|order by|match|with|skip|limit|create|delete|set)\b\s/g;
+      for (var i = 0; i < lines.length; i++)
+        lines[i] = lines[i].replace(reProcessedPortion, " \n$1 ").trim();
+      return lines.join("\n");
+    }
+  };
+
+  CodeMirror.defineMIME("application/x-cypher-query", "cypher");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cypher/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,64 @@
+<!doctype html>
+
+<title>CodeMirror: Cypher Mode for CodeMirror</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css" />
+<link rel="stylesheet" href="../../theme/neo.css" />
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="cypher.js"></script>
+<style>
+.CodeMirror {
+    border-top: 1px solid black;
+    border-bottom: 1px solid black;
+}
+        </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Cypher Mode for CodeMirror</a>
+  </ul>
+</div>
+
+<article>
+<h2>Cypher Mode for CodeMirror</h2>
+<form>
+            <textarea id="code" name="code">// Cypher Mode for CodeMirror, using the neo theme
+MATCH (joe { name: 'Joe' })-[:knows*2..2]-(friend_of_friend)
+WHERE NOT (joe)-[:knows]-(friend_of_friend)
+RETURN friend_of_friend.name, COUNT(*)
+ORDER BY COUNT(*) DESC , friend_of_friend.name
+</textarea>
+            </form>
+            <p><strong>MIME types defined:</strong> 
+            <code><a href="?mime=application/x-cypher-query">application/x-cypher-query</a></code>
+        </p>
+<script>
+window.onload = function() {
+  var mime = 'application/x-cypher-query';
+  // get mime type
+  if (window.location.href.indexOf('mime=') > -1) {
+    mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
+  }
+  window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+    mode: mime,
+    indentWithTabs: true,
+    smartIndent: true,
+    lineNumbers: true,
+    matchBrackets: true,
+    autofocus: true,
+    theme: 'neo'
+  });
+};
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/cypher/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,37 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "cypher");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("unbalancedDoubledQuotedString",
+      "[string \"a'b\"][variable c]");
+
+  MT("unbalancedSingleQuotedString",
+      "[string 'a\"b'][variable c]");
+
+  MT("doubleQuotedString",
+      "[string \"a\"][variable b]");
+
+  MT("singleQuotedString",
+      "[string 'a'][variable b]");
+
+  MT("single attribute (with content)",
+      "[node {][atom a:][string 'a'][node }]");
+
+  MT("multiple attribute, singleQuotedString (with content)",
+      "[node {][atom a:][string 'a'][node ,][atom b:][string 'b'][node }]");
+
+  MT("multiple attribute, doubleQuotedString (with content)",
+      "[node {][atom a:][string \"a\"][node ,][atom b:][string \"b\"][node }]");
+
+  MT("single attribute (without content)",
+      "[node {][atom a:][string 'a'][node }]");
+
+  MT("multiple attribute, singleQuotedString (without content)",
+      "[node {][atom a:][string ''][node ,][atom b:][string ''][node }]");
+
+  MT("multiple attribute, doubleQuotedString (without content)",
+      "[node {][atom a:][string \"\"][node ,][atom b:][string \"\"][node }]");
+ })();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/d/d.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,223 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("d", function(config, parserConfig) {
+  var indentUnit = config.indentUnit,
+      statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
+      keywords = parserConfig.keywords || {},
+      builtin = parserConfig.builtin || {},
+      blockKeywords = parserConfig.blockKeywords || {},
+      atoms = parserConfig.atoms || {},
+      hooks = parserConfig.hooks || {},
+      multiLineStrings = parserConfig.multiLineStrings;
+  var isOperatorChar = /[+\-*&%=<>!?|\/]/;
+
+  var curPunc;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (hooks[ch]) {
+      var result = hooks[ch](stream, state);
+      if (result !== false) return result;
+    }
+    if (ch == '"' || ch == "'" || ch == "`") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      return "number";
+    }
+    if (ch == "/") {
+      if (stream.eat("+")) {
+        state.tokenize = tokenNestedComment;
+        return tokenNestedComment(stream, state);
+      }
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+    var cur = stream.current();
+    if (keywords.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "keyword";
+    }
+    if (builtin.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "builtin";
+    }
+    if (atoms.propertyIsEnumerable(cur)) return "atom";
+    return "variable";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !(escaped || multiLineStrings))
+        state.tokenize = null;
+      return "string";
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = null;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function tokenNestedComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = null;
+        break;
+      }
+      maybeEnd = (ch == "+");
+    }
+    return "comment";
+  }
+
+  function Context(indented, column, type, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.align = align;
+    this.prev = prev;
+  }
+  function pushContext(state, col, type) {
+    var indent = state.indented;
+    if (state.context && state.context.type == "statement")
+      indent = state.context.indented;
+    return state.context = new Context(indent, col, type, null, state.context);
+  }
+  function popContext(state) {
+    var t = state.context.type;
+    if (t == ")" || t == "]" || t == "}")
+      state.indented = state.context.indented;
+    return state.context = state.context.prev;
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+        indented: 0,
+        startOfLine: true
+      };
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+      }
+      if (stream.eatSpace()) return null;
+      curPunc = null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta") return style;
+      if (ctx.align == null) ctx.align = true;
+
+      if ((curPunc == ";" || curPunc == ":" || curPunc == ",") && ctx.type == "statement") popContext(state);
+      else if (curPunc == "{") pushContext(state, stream.column(), "}");
+      else if (curPunc == "[") pushContext(state, stream.column(), "]");
+      else if (curPunc == "(") pushContext(state, stream.column(), ")");
+      else if (curPunc == "}") {
+        while (ctx.type == "statement") ctx = popContext(state);
+        if (ctx.type == "}") ctx = popContext(state);
+        while (ctx.type == "statement") ctx = popContext(state);
+      }
+      else if (curPunc == ctx.type) popContext(state);
+      else if (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') || (ctx.type == "statement" && curPunc == "newstatement"))
+        pushContext(state, stream.column(), "statement");
+      state.startOfLine = false;
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
+      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+      if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
+      var closing = firstChar == ctx.type;
+      if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
+      else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: "{}",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    blockCommentContinue: " * ",
+    lineComment: "//",
+    fold: "brace"
+  };
+});
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  var blockKeywords = "body catch class do else enum for foreach foreach_reverse if in interface mixin " +
+                      "out scope struct switch try union unittest version while with";
+
+  CodeMirror.defineMIME("text/x-d", {
+    name: "d",
+    keywords: words("abstract alias align asm assert auto break case cast cdouble cent cfloat const continue " +
+                    "debug default delegate delete deprecated export extern final finally function goto immutable " +
+                    "import inout invariant is lazy macro module new nothrow override package pragma private " +
+                    "protected public pure ref return shared short static super synchronized template this " +
+                    "throw typedef typeid typeof volatile __FILE__ __LINE__ __gshared __traits __vector __parameters " +
+                    blockKeywords),
+    blockKeywords: words(blockKeywords),
+    builtin: words("bool byte char creal dchar double float idouble ifloat int ireal long real short ubyte " +
+                   "ucent uint ulong ushort wchar wstring void size_t sizediff_t"),
+    atoms: words("exit failure success true false null"),
+    hooks: {
+      "@": function(stream, _state) {
+        stream.eatWhile(/[\w\$_]/);
+        return "meta";
+      }
+    }
+  });
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/d/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,273 @@
+<!doctype html>
+
+<title>CodeMirror: D mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="d.js"></script>
+<style>.CodeMirror {border: 2px inset #dee;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">D</a>
+  </ul>
+</div>
+
+<article>
+<h2>D mode</h2>
+<form><textarea id="code" name="code">
+/* D demo code // copied from phobos/sd/metastrings.d */
+// Written in the D programming language.
+
+/**
+Templates with which to do compile-time manipulation of strings.
+
+Macros:
+ WIKI = Phobos/StdMetastrings
+
+Copyright: Copyright Digital Mars 2007 - 2009.
+License:   <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
+Authors:   $(WEB digitalmars.com, Walter Bright),
+           Don Clugston
+Source:    $(PHOBOSSRC std/_metastrings.d)
+*/
+/*
+         Copyright Digital Mars 2007 - 2009.
+Distributed under the Boost Software License, Version 1.0.
+   (See accompanying file LICENSE_1_0.txt or copy at
+         http://www.boost.org/LICENSE_1_0.txt)
+ */
+module std.metastrings;
+
+/**
+Formats constants into a string at compile time.  Analogous to $(XREF
+string,format).
+
+Parameters:
+
+A = tuple of constants, which can be strings, characters, or integral
+    values.
+
+Formats:
+ *    The formats supported are %s for strings, and %%
+ *    for the % character.
+Example:
+---
+import std.metastrings;
+import std.stdio;
+
+void main()
+{
+  string s = Format!("Arg %s = %s", "foo", 27);
+  writefln(s); // "Arg foo = 27"
+}
+ * ---
+ */
+
+template Format(A...)
+{
+    static if (A.length == 0)
+        enum Format = "";
+    else static if (is(typeof(A[0]) : const(char)[]))
+        enum Format = FormatString!(A[0], A[1..$]);
+    else
+        enum Format = toStringNow!(A[0]) ~ Format!(A[1..$]);
+}
+
+template FormatString(const(char)[] F, A...)
+{
+    static if (F.length == 0)
+        enum FormatString = Format!(A);
+    else static if (F.length == 1)
+        enum FormatString = F[0] ~ Format!(A);
+    else static if (F[0..2] == "%s")
+        enum FormatString
+            = toStringNow!(A[0]) ~ FormatString!(F[2..$],A[1..$]);
+    else static if (F[0..2] == "%%")
+        enum FormatString = "%" ~ FormatString!(F[2..$],A);
+    else
+    {
+        static assert(F[0] != '%', "unrecognized format %" ~ F[1]);
+        enum FormatString = F[0] ~ FormatString!(F[1..$],A);
+    }
+}
+
+unittest
+{
+    auto s = Format!("hel%slo", "world", -138, 'c', true);
+    assert(s == "helworldlo-138ctrue", "[" ~ s ~ "]");
+}
+
+/**
+ * Convert constant argument to a string.
+ */
+
+template toStringNow(ulong v)
+{
+    static if (v < 10)
+        enum toStringNow = "" ~ cast(char)(v + '0');
+    else
+        enum toStringNow = toStringNow!(v / 10) ~ toStringNow!(v % 10);
+}
+
+unittest
+{
+    static assert(toStringNow!(1uL << 62) == "4611686018427387904");
+}
+
+/// ditto
+template toStringNow(long v)
+{
+    static if (v < 0)
+        enum toStringNow = "-" ~ toStringNow!(cast(ulong) -v);
+    else
+        enum toStringNow = toStringNow!(cast(ulong) v);
+}
+
+unittest
+{
+    static assert(toStringNow!(0x100000000) == "4294967296");
+    static assert(toStringNow!(-138L) == "-138");
+}
+
+/// ditto
+template toStringNow(uint U)
+{
+    enum toStringNow = toStringNow!(cast(ulong)U);
+}
+
+/// ditto
+template toStringNow(int I)
+{
+    enum toStringNow = toStringNow!(cast(long)I);
+}
+
+/// ditto
+template toStringNow(bool B)
+{
+    enum toStringNow = B ? "true" : "false";
+}
+
+/// ditto
+template toStringNow(string S)
+{
+    enum toStringNow = S;
+}
+
+/// ditto
+template toStringNow(char C)
+{
+    enum toStringNow = "" ~ C;
+}
+
+
+/********
+ * Parse unsigned integer literal from the start of string s.
+ * returns:
+ *    .value = the integer literal as a string,
+ *    .rest = the string following the integer literal
+ * Otherwise:
+ *    .value = null,
+ *    .rest = s
+ */
+
+template parseUinteger(const(char)[] s)
+{
+    static if (s.length == 0)
+    {
+        enum value = "";
+        enum rest = "";
+    }
+    else static if (s[0] >= '0' && s[0] <= '9')
+    {
+        enum value = s[0] ~ parseUinteger!(s[1..$]).value;
+        enum rest = parseUinteger!(s[1..$]).rest;
+    }
+    else
+    {
+        enum value = "";
+        enum rest = s;
+    }
+}
+
+/********
+Parse integer literal optionally preceded by $(D '-') from the start
+of string $(D s).
+
+Returns:
+   .value = the integer literal as a string,
+   .rest = the string following the integer literal
+
+Otherwise:
+   .value = null,
+   .rest = s
+*/
+
+template parseInteger(const(char)[] s)
+{
+    static if (s.length == 0)
+    {
+        enum value = "";
+        enum rest = "";
+    }
+    else static if (s[0] >= '0' && s[0] <= '9')
+    {
+        enum value = s[0] ~ parseUinteger!(s[1..$]).value;
+        enum rest = parseUinteger!(s[1..$]).rest;
+    }
+    else static if (s.length >= 2 &&
+            s[0] == '-' && s[1] >= '0' && s[1] <= '9')
+    {
+        enum value = s[0..2] ~ parseUinteger!(s[2..$]).value;
+        enum rest = parseUinteger!(s[2..$]).rest;
+    }
+    else
+    {
+        enum value = "";
+        enum rest = s;
+    }
+}
+
+unittest
+{
+    assert(parseUinteger!("1234abc").value == "1234");
+    assert(parseUinteger!("1234abc").rest == "abc");
+    assert(parseInteger!("-1234abc").value == "-1234");
+    assert(parseInteger!("-1234abc").rest == "abc");
+}
+
+/**
+Deprecated aliases held for backward compatibility.
+*/
+deprecated alias toStringNow ToString;
+/// Ditto
+deprecated alias parseUinteger ParseUinteger;
+/// Ditto
+deprecated alias parseUinteger ParseInteger;
+
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        indentUnit: 4,
+        mode: "text/x-d"
+      });
+    </script>
+
+    <p>Simple mode that handle D-Syntax (<a href="http://www.dlang.org">DLang Homepage</a>).</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-d</code>
+    .</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/d/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,11 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "d");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("nested_comments",
+     "[comment /+]","[comment comment]","[comment +/]","[variable void] [variable main](){}");
+
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dart/dart.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,168 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../clike/clike"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../clike/clike"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var keywords = ("this super static final const abstract class extends external factory " +
+    "implements mixin get native set typedef with enum throw rethrow assert break case " +
+    "continue default in return new deferred async await covariant try catch finally " +
+    "do else for if switch while import library export part of show hide is as extension " +
+    "on yield late required sealed base interface when").split(" ");
+  var blockKeywords = "try catch finally do else for if switch while".split(" ");
+  var atoms = "true false null".split(" ");
+  var builtins = "void bool num int double dynamic var String Null Never".split(" ");
+
+  function set(words) {
+    var obj = {};
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  function pushInterpolationStack(state) {
+    (state.interpolationStack || (state.interpolationStack = [])).push(state.tokenize);
+  }
+
+  function popInterpolationStack(state) {
+    return (state.interpolationStack || (state.interpolationStack = [])).pop();
+  }
+
+  function sizeInterpolationStack(state) {
+    return state.interpolationStack ? state.interpolationStack.length : 0;
+  }
+
+  CodeMirror.defineMIME("application/dart", {
+    name: "clike",
+    keywords: set(keywords),
+    blockKeywords: set(blockKeywords),
+    builtin: set(builtins),
+    atoms: set(atoms),
+    // clike numbers without the suffixes, and with '_' separators.
+    number: /^(?:0x[a-f\d_]+|(?:[\d_]+\.?[\d_]*|\.[\d_]+)(?:e[-+]?[\d_]+)?)/i,
+    hooks: {
+      "@": function(stream) {
+        stream.eatWhile(/[\w\$_\.]/);
+        return "meta";
+      },
+
+      // custom string handling to deal with triple-quoted strings and string interpolation
+      "'": function(stream, state) {
+        return tokenString("'", stream, state, false);
+      },
+      "\"": function(stream, state) {
+        return tokenString("\"", stream, state, false);
+      },
+      "r": function(stream, state) {
+        var peek = stream.peek();
+        if (peek == "'" || peek == "\"") {
+          return tokenString(stream.next(), stream, state, true);
+        }
+        return false;
+      },
+
+      "}": function(_stream, state) {
+        // "}" is end of interpolation, if interpolation stack is non-empty
+        if (sizeInterpolationStack(state) > 0) {
+          state.tokenize = popInterpolationStack(state);
+          return null;
+        }
+        return false;
+      },
+
+      "/": function(stream, state) {
+        if (!stream.eat("*")) return false
+        state.tokenize = tokenNestedComment(1)
+        return state.tokenize(stream, state)
+      },
+      token: function(stream, _, style) {
+        if (style == "variable") {
+          // Assume uppercase symbols are classes using variable-2
+          var isUpper = RegExp('^[_$]*[A-Z][a-zA-Z0-9_$]*$','g');
+          if (isUpper.test(stream.current())) {
+            return 'variable-2';
+          }
+        }
+      }
+    }
+  });
+
+  function tokenString(quote, stream, state, raw) {
+    var tripleQuoted = false;
+    if (stream.eat(quote)) {
+      if (stream.eat(quote)) tripleQuoted = true;
+      else return "string"; //empty string
+    }
+    function tokenStringHelper(stream, state) {
+      var escaped = false;
+      while (!stream.eol()) {
+        if (!raw && !escaped && stream.peek() == "$") {
+          pushInterpolationStack(state);
+          state.tokenize = tokenInterpolation;
+          return "string";
+        }
+        var next = stream.next();
+        if (next == quote && !escaped && (!tripleQuoted || stream.match(quote + quote))) {
+          state.tokenize = null;
+          break;
+        }
+        escaped = !raw && !escaped && next == "\\";
+      }
+      return "string";
+    }
+    state.tokenize = tokenStringHelper;
+    return tokenStringHelper(stream, state);
+  }
+
+  function tokenInterpolation(stream, state) {
+    stream.eat("$");
+    if (stream.eat("{")) {
+      // let clike handle the content of ${...},
+      // we take over again when "}" appears (see hooks).
+      state.tokenize = null;
+    } else {
+      state.tokenize = tokenInterpolationIdentifier;
+    }
+    return null;
+  }
+
+  function tokenInterpolationIdentifier(stream, state) {
+    stream.eatWhile(/[\w_]/);
+    state.tokenize = popInterpolationStack(state);
+    return "variable";
+  }
+
+  function tokenNestedComment(depth) {
+    return function (stream, state) {
+      var ch
+      while (ch = stream.next()) {
+        if (ch == "*" && stream.eat("/")) {
+          if (depth == 1) {
+            state.tokenize = null
+            break
+          } else {
+            state.tokenize = tokenNestedComment(depth - 1)
+            return state.tokenize(stream, state)
+          }
+        } else if (ch == "/" && stream.eat("*")) {
+          state.tokenize = tokenNestedComment(depth + 1)
+          return state.tokenize(stream, state)
+        }
+      }
+      return "comment"
+    }
+  }
+
+  CodeMirror.registerHelper("hintWords", "application/dart", keywords.concat(atoms).concat(builtins));
+
+  // This is needed to make loading through meta.js work.
+  CodeMirror.defineMode("dart", function(conf) {
+    return CodeMirror.getMode(conf, "application/dart");
+  }, "clike");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dart/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,71 @@
+<!doctype html>
+
+<title>CodeMirror: Dart mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../clike/clike.js"></script>
+<script src="dart.js"></script>
+<style>.CodeMirror {border: 1px solid #dee;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Dart</a>
+  </ul>
+</div>
+
+<article>
+<h2>Dart mode</h2>
+<form>
+<textarea id="code" name="code">
+import 'dart:math' show Random;
+
+void main() {
+  print(Die(n: 12).roll());
+}
+
+// Define a class.
+class Die {
+  // Define a class variable.
+  static final Random shaker = Random();
+
+  // Define instance variables.
+  final int sides;
+  int? lastRoll;
+
+  // Define a constructor.
+  Die({int n = 6}) : sides = n {
+    if (4 > n || n > 20) {
+      // Support for errors and exceptions.
+      throw ArgumentError(/* */);
+    }
+  }
+
+  // Define a method using shorthand syntax.
+  @override
+  String toString() => '$lastRoll';
+
+  // Define an instance method.
+  int roll() {
+    return lastRoll = shaker.nextInt(sides) + 1;
+  }
+}
+</textarea>
+</form>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    mode: "application/dart"
+  });
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/diff/diff.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,47 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("diff", function() {
+
+  var TOKEN_NAMES = {
+    '+': 'positive',
+    '-': 'negative',
+    '@': 'meta'
+  };
+
+  return {
+    token: function(stream) {
+      var tw_pos = stream.string.search(/[\t ]+?$/);
+
+      if (!stream.sol() || tw_pos === 0) {
+        stream.skipToEnd();
+        return ("error " + (
+          TOKEN_NAMES[stream.string.charAt(0)] || '')).replace(/ $/, '');
+      }
+
+      var token_name = TOKEN_NAMES[stream.peek()] || stream.skipToEnd();
+
+      if (tw_pos === -1) {
+        stream.skipToEnd();
+      } else {
+        stream.pos = tw_pos;
+      }
+
+      return token_name;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-diff", "diff");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/diff/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,117 @@
+<!doctype html>
+
+<title>CodeMirror: Diff mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="diff.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}
+      span.cm-meta {color: #a0b !important;}
+      span.cm-error { background-color: black; opacity: 0.4;}
+      span.cm-error.cm-string { background-color: red; }
+      span.cm-error.cm-tag { background-color: #2b2; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Diff</a>
+  </ul>
+</div>
+
+<article>
+<h2>Diff mode</h2>
+<form><textarea id="code" name="code">
+diff --git a/index.html b/index.html
+index c1d9156..7764744 100644
+--- a/index.html
++++ b/index.html
+@@ -95,7 +95,8 @@ StringStream.prototype = {
+     <script>
+       var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+         lineNumbers: true,
+-        autoMatchBrackets: true
++        autoMatchBrackets: true,
++      onGutterClick: function(x){console.log(x);}
+       });
+     </script>
+   </body>
+diff --git a/lib/codemirror.js b/lib/codemirror.js
+index 04646a9..9a39cc7 100644
+--- a/lib/codemirror.js
++++ b/lib/codemirror.js
+@@ -399,10 +399,16 @@ var CodeMirror = (function() {
+     }
+ 
+     function onMouseDown(e) {
+-      var start = posFromMouse(e), last = start;    
++      var start = posFromMouse(e), last = start, target = e.target();
+       if (!start) return;
+       setCursor(start.line, start.ch, false);
+       if (e.button() != 1) return;
++      if (target.parentNode == gutter) {    
++        if (options.onGutterClick)
++          options.onGutterClick(indexOf(gutter.childNodes, target) + showingFrom);
++        return;
++      }
++
+       if (!focused) onFocus();
+ 
+       e.stop();
+@@ -808,7 +814,7 @@ var CodeMirror = (function() {
+       for (var i = showingFrom; i < showingTo; ++i) {
+         var marker = lines[i].gutterMarker;
+         if (marker) html.push('<div class="' + marker.style + '">' + htmlEscape(marker.text) + '</div>');
+-        else html.push("<div>" + (options.lineNumbers ? i + 1 : "\u00a0") + "</div>");
++        else html.push("<div>" + (options.lineNumbers ? i + options.firstLineNumber : "\u00a0") + "</div>");
+       }
+       gutter.style.display = "none"; // TODO test whether this actually helps
+       gutter.innerHTML = html.join("");
+@@ -1371,10 +1377,8 @@ var CodeMirror = (function() {
+         if (option == "parser") setParser(value);
+         else if (option === "lineNumbers") setLineNumbers(value);
+         else if (option === "gutter") setGutter(value);
+-        else if (option === "readOnly") options.readOnly = value;
+-        else if (option === "indentUnit") {options.indentUnit = indentUnit = value; setParser(options.parser);}
+-        else if (/^(?:enterMode|tabMode|indentWithTabs|readOnly|autoMatchBrackets|undoDepth)$/.test(option)) options[option] = value;
+-        else throw new Error("Can't set option " + option);
++        else if (option === "indentUnit") {options.indentUnit = value; setParser(options.parser);}
++        else options[option] = value;
+       },
+       cursorCoords: cursorCoords,
+       undo: operation(undo),
+@@ -1402,7 +1406,8 @@ var CodeMirror = (function() {
+       replaceRange: operation(replaceRange),
+ 
+       operation: function(f){return operation(f)();},
+-      refresh: function(){updateDisplay([{from: 0, to: lines.length}]);}
++      refresh: function(){updateDisplay([{from: 0, to: lines.length}]);},
++      getInputField: function(){return input;}
+     };
+     return instance;
+   }
+@@ -1420,6 +1425,7 @@ var CodeMirror = (function() {
+     readOnly: false,
+     onChange: null,
+     onCursorActivity: null,
++    onGutterClick: null,
+     autoMatchBrackets: false,
+     workTime: 200,
+     workDelay: 300,
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-diff</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/django/django.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,356 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
+        require("../../addon/mode/overlay"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
+            "../../addon/mode/overlay"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineMode("django:inner", function() {
+    var keywords = ["block", "endblock", "for", "endfor", "true", "false", "filter", "endfilter",
+                    "loop", "none", "self", "super", "if", "elif", "endif", "as", "else", "import",
+                    "with", "endwith", "without", "context", "ifequal", "endifequal", "ifnotequal",
+                    "endifnotequal", "extends", "include", "load", "comment", "endcomment",
+                    "empty", "url", "static", "trans", "blocktrans", "endblocktrans", "now",
+                    "regroup", "lorem", "ifchanged", "endifchanged", "firstof", "debug", "cycle",
+                    "csrf_token", "autoescape", "endautoescape", "spaceless", "endspaceless",
+                    "ssi", "templatetag", "verbatim", "endverbatim", "widthratio"],
+        filters = ["add", "addslashes", "capfirst", "center", "cut", "date",
+                   "default", "default_if_none", "dictsort",
+                   "dictsortreversed", "divisibleby", "escape", "escapejs",
+                   "filesizeformat", "first", "floatformat", "force_escape",
+                   "get_digit", "iriencode", "join", "last", "length",
+                   "length_is", "linebreaks", "linebreaksbr", "linenumbers",
+                   "ljust", "lower", "make_list", "phone2numeric", "pluralize",
+                   "pprint", "random", "removetags", "rjust", "safe",
+                   "safeseq", "slice", "slugify", "stringformat", "striptags",
+                   "time", "timesince", "timeuntil", "title", "truncatechars",
+                   "truncatechars_html", "truncatewords", "truncatewords_html",
+                   "unordered_list", "upper", "urlencode", "urlize",
+                   "urlizetrunc", "wordcount", "wordwrap", "yesno"],
+        operators = ["==", "!=", "<", ">", "<=", ">="],
+        wordOperators = ["in", "not", "or", "and"];
+
+    keywords = new RegExp("^\\b(" + keywords.join("|") + ")\\b");
+    filters = new RegExp("^\\b(" + filters.join("|") + ")\\b");
+    operators = new RegExp("^\\b(" + operators.join("|") + ")\\b");
+    wordOperators = new RegExp("^\\b(" + wordOperators.join("|") + ")\\b");
+
+    // We have to return "null" instead of null, in order to avoid string
+    // styling as the default, when using Django templates inside HTML
+    // element attributes
+    function tokenBase (stream, state) {
+      // Attempt to identify a variable, template or comment tag respectively
+      if (stream.match("{{")) {
+        state.tokenize = inVariable;
+        return "tag";
+      } else if (stream.match("{%")) {
+        state.tokenize = inTag;
+        return "tag";
+      } else if (stream.match("{#")) {
+        state.tokenize = inComment;
+        return "comment";
+      }
+
+      // Ignore completely any stream series that do not match the
+      // Django template opening tags.
+      while (stream.next() != null && !stream.match(/\{[{%#]/, false)) {}
+      return null;
+    }
+
+    // A string can be included in either single or double quotes (this is
+    // the delimiter). Mark everything as a string until the start delimiter
+    // occurs again.
+    function inString (delimiter, previousTokenizer) {
+      return function (stream, state) {
+        if (!state.escapeNext && stream.eat(delimiter)) {
+          state.tokenize = previousTokenizer;
+        } else {
+          if (state.escapeNext) {
+            state.escapeNext = false;
+          }
+
+          var ch = stream.next();
+
+          // Take into account the backslash for escaping characters, such as
+          // the string delimiter.
+          if (ch == "\\") {
+            state.escapeNext = true;
+          }
+        }
+
+        return "string";
+      };
+    }
+
+    // Apply Django template variable syntax highlighting
+    function inVariable (stream, state) {
+      // Attempt to match a dot that precedes a property
+      if (state.waitDot) {
+        state.waitDot = false;
+
+        if (stream.peek() != ".") {
+          return "null";
+        }
+
+        // Dot followed by a non-word character should be considered an error.
+        if (stream.match(/\.\W+/)) {
+          return "error";
+        } else if (stream.eat(".")) {
+          state.waitProperty = true;
+          return "null";
+        } else {
+          throw Error ("Unexpected error while waiting for property.");
+        }
+      }
+
+      // Attempt to match a pipe that precedes a filter
+      if (state.waitPipe) {
+        state.waitPipe = false;
+
+        if (stream.peek() != "|") {
+          return "null";
+        }
+
+        // Pipe followed by a non-word character should be considered an error.
+        if (stream.match(/\.\W+/)) {
+          return "error";
+        } else if (stream.eat("|")) {
+          state.waitFilter = true;
+          return "null";
+        } else {
+          throw Error ("Unexpected error while waiting for filter.");
+        }
+      }
+
+      // Highlight properties
+      if (state.waitProperty) {
+        state.waitProperty = false;
+        if (stream.match(/\b(\w+)\b/)) {
+          state.waitDot = true;  // A property can be followed by another property
+          state.waitPipe = true;  // A property can be followed by a filter
+          return "property";
+        }
+      }
+
+      // Highlight filters
+      if (state.waitFilter) {
+          state.waitFilter = false;
+        if (stream.match(filters)) {
+          return "variable-2";
+        }
+      }
+
+      // Ignore all white spaces
+      if (stream.eatSpace()) {
+        state.waitProperty = false;
+        return "null";
+      }
+
+      // Identify numbers
+      if (stream.match(/\b\d+(\.\d+)?\b/)) {
+        return "number";
+      }
+
+      // Identify strings
+      if (stream.match("'")) {
+        state.tokenize = inString("'", state.tokenize);
+        return "string";
+      } else if (stream.match('"')) {
+        state.tokenize = inString('"', state.tokenize);
+        return "string";
+      }
+
+      // Attempt to find the variable
+      if (stream.match(/\b(\w+)\b/) && !state.foundVariable) {
+        state.waitDot = true;
+        state.waitPipe = true;  // A property can be followed by a filter
+        return "variable";
+      }
+
+      // If found closing tag reset
+      if (stream.match("}}")) {
+        state.waitProperty = null;
+        state.waitFilter = null;
+        state.waitDot = null;
+        state.waitPipe = null;
+        state.tokenize = tokenBase;
+        return "tag";
+      }
+
+      // If nothing was found, advance to the next character
+      stream.next();
+      return "null";
+    }
+
+    function inTag (stream, state) {
+      // Attempt to match a dot that precedes a property
+      if (state.waitDot) {
+        state.waitDot = false;
+
+        if (stream.peek() != ".") {
+          return "null";
+        }
+
+        // Dot followed by a non-word character should be considered an error.
+        if (stream.match(/\.\W+/)) {
+          return "error";
+        } else if (stream.eat(".")) {
+          state.waitProperty = true;
+          return "null";
+        } else {
+          throw Error ("Unexpected error while waiting for property.");
+        }
+      }
+
+      // Attempt to match a pipe that precedes a filter
+      if (state.waitPipe) {
+        state.waitPipe = false;
+
+        if (stream.peek() != "|") {
+          return "null";
+        }
+
+        // Pipe followed by a non-word character should be considered an error.
+        if (stream.match(/\.\W+/)) {
+          return "error";
+        } else if (stream.eat("|")) {
+          state.waitFilter = true;
+          return "null";
+        } else {
+          throw Error ("Unexpected error while waiting for filter.");
+        }
+      }
+
+      // Highlight properties
+      if (state.waitProperty) {
+        state.waitProperty = false;
+        if (stream.match(/\b(\w+)\b/)) {
+          state.waitDot = true;  // A property can be followed by another property
+          state.waitPipe = true;  // A property can be followed by a filter
+          return "property";
+        }
+      }
+
+      // Highlight filters
+      if (state.waitFilter) {
+          state.waitFilter = false;
+        if (stream.match(filters)) {
+          return "variable-2";
+        }
+      }
+
+      // Ignore all white spaces
+      if (stream.eatSpace()) {
+        state.waitProperty = false;
+        return "null";
+      }
+
+      // Identify numbers
+      if (stream.match(/\b\d+(\.\d+)?\b/)) {
+        return "number";
+      }
+
+      // Identify strings
+      if (stream.match("'")) {
+        state.tokenize = inString("'", state.tokenize);
+        return "string";
+      } else if (stream.match('"')) {
+        state.tokenize = inString('"', state.tokenize);
+        return "string";
+      }
+
+      // Attempt to match an operator
+      if (stream.match(operators)) {
+        return "operator";
+      }
+
+      // Attempt to match a word operator
+      if (stream.match(wordOperators)) {
+        return "keyword";
+      }
+
+      // Attempt to match a keyword
+      var keywordMatch = stream.match(keywords);
+      if (keywordMatch) {
+        if (keywordMatch[0] == "comment") {
+          state.blockCommentTag = true;
+        }
+        return "keyword";
+      }
+
+      // Attempt to match a variable
+      if (stream.match(/\b(\w+)\b/)) {
+        state.waitDot = true;
+        state.waitPipe = true;  // A property can be followed by a filter
+        return "variable";
+      }
+
+      // If found closing tag reset
+      if (stream.match("%}")) {
+        state.waitProperty = null;
+        state.waitFilter = null;
+        state.waitDot = null;
+        state.waitPipe = null;
+        // If the tag that closes is a block comment tag, we want to mark the
+        // following code as comment, until the tag closes.
+        if (state.blockCommentTag) {
+          state.blockCommentTag = false;  // Release the "lock"
+          state.tokenize = inBlockComment;
+        } else {
+          state.tokenize = tokenBase;
+        }
+        return "tag";
+      }
+
+      // If nothing was found, advance to the next character
+      stream.next();
+      return "null";
+    }
+
+    // Mark everything as comment inside the tag and the tag itself.
+    function inComment (stream, state) {
+      if (stream.match(/^.*?#\}/)) state.tokenize = tokenBase
+      else stream.skipToEnd()
+      return "comment";
+    }
+
+    // Mark everything as a comment until the `blockcomment` tag closes.
+    function inBlockComment (stream, state) {
+      if (stream.match(/\{%\s*endcomment\s*%\}/, false)) {
+        state.tokenize = inTag;
+        stream.match("{%");
+        return "tag";
+      } else {
+        stream.next();
+        return "comment";
+      }
+    }
+
+    return {
+      startState: function () {
+        return {tokenize: tokenBase};
+      },
+      token: function (stream, state) {
+        return state.tokenize(stream, state);
+      },
+      blockCommentStart: "{% comment %}",
+      blockCommentEnd: "{% endcomment %}"
+    };
+  });
+
+  CodeMirror.defineMode("django", function(config) {
+    var htmlBase = CodeMirror.getMode(config, "text/html");
+    var djangoInner = CodeMirror.getMode(config, "django:inner");
+    return CodeMirror.overlayMode(htmlBase, djangoInner);
+  });
+
+  CodeMirror.defineMIME("text/x-django", "django");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/django/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,73 @@
+<!doctype html>
+
+<title>CodeMirror: Django template mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/mdn-like.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="django.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Django</a>
+  </ul>
+</div>
+
+<article>
+<h2>Django template mode</h2>
+<form><textarea id="code" name="code">
+<!doctype html>
+<html>
+  <head>
+    <title>My Django web application</title>
+  </head>
+  <body>
+    <h1>
+      {{ page.title|capfirst }}
+    </h1>
+    <ul class="my-list">
+      {# traverse a list of items and produce links to their views. #}
+      {% for item in items %}
+      <li>
+        <a href="{% url 'item_view' item.name|slugify %}">
+          {{ item.name }}
+        </a>
+      </li>
+      {% empty %}
+      <li>You have no items in your list.</li>
+      {% endfor %}
+    </ul>
+    {% comment "this is a forgotten footer" %}
+    <footer></footer>
+    {% endcomment %}
+  </body>
+</html>
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "django",
+        indentUnit: 2,
+        indentWithTabs: true,
+        theme: "mdn-like"
+      });
+    </script>
+
+    <p>Mode for HTML with embedded Django template markup.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-django</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dockerfile/dockerfile.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,211 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var from = "from";
+  var fromRegex = new RegExp("^(\\s*)\\b(" + from + ")\\b", "i");
+
+  var shells = ["run", "cmd", "entrypoint", "shell"];
+  var shellsAsArrayRegex = new RegExp("^(\\s*)(" + shells.join('|') + ")(\\s+\\[)", "i");
+
+  var expose = "expose";
+  var exposeRegex = new RegExp("^(\\s*)(" + expose + ")(\\s+)", "i");
+
+  var others = [
+    "arg", "from", "maintainer", "label", "env",
+    "add", "copy", "volume", "user",
+    "workdir", "onbuild", "stopsignal", "healthcheck", "shell"
+  ];
+
+  // Collect all Dockerfile directives
+  var instructions = [from, expose].concat(shells).concat(others),
+      instructionRegex = "(" + instructions.join('|') + ")",
+      instructionOnlyLine = new RegExp("^(\\s*)" + instructionRegex + "(\\s*)(#.*)?$", "i"),
+      instructionWithArguments = new RegExp("^(\\s*)" + instructionRegex + "(\\s+)", "i");
+
+  CodeMirror.defineSimpleMode("dockerfile", {
+    start: [
+      // Block comment: This is a line starting with a comment
+      {
+        regex: /^\s*#.*$/,
+        sol: true,
+        token: "comment"
+      },
+      {
+        regex: fromRegex,
+        token: [null, "keyword"],
+        sol: true,
+        next: "from"
+      },
+      // Highlight an instruction without any arguments (for convenience)
+      {
+        regex: instructionOnlyLine,
+        token: [null, "keyword", null, "error"],
+        sol: true
+      },
+      {
+        regex: shellsAsArrayRegex,
+        token: [null, "keyword", null],
+        sol: true,
+        next: "array"
+      },
+      {
+        regex: exposeRegex,
+        token: [null, "keyword", null],
+        sol: true,
+        next: "expose"
+      },
+      // Highlight an instruction followed by arguments
+      {
+        regex: instructionWithArguments,
+        token: [null, "keyword", null],
+        sol: true,
+        next: "arguments"
+      },
+      {
+        regex: /./,
+        token: null
+      }
+    ],
+    from: [
+      {
+        regex: /\s*$/,
+        token: null,
+        next: "start"
+      },
+      {
+        // Line comment without instruction arguments is an error
+        regex: /(\s*)(#.*)$/,
+        token: [null, "error"],
+        next: "start"
+      },
+      {
+        regex: /(\s*\S+\s+)(as)/i,
+        token: [null, "keyword"],
+        next: "start"
+      },
+      // Fail safe return to start
+      {
+        token: null,
+        next: "start"
+      }
+    ],
+    single: [
+      {
+        regex: /(?:[^\\']|\\.)/,
+        token: "string"
+      },
+      {
+        regex: /'/,
+        token: "string",
+        pop: true
+      }
+    ],
+    double: [
+      {
+        regex: /(?:[^\\"]|\\.)/,
+        token: "string"
+      },
+      {
+        regex: /"/,
+        token: "string",
+        pop: true
+      }
+    ],
+    array: [
+      {
+        regex: /\]/,
+        token: null,
+        next: "start"
+      },
+      {
+        regex: /"(?:[^\\"]|\\.)*"?/,
+        token: "string"
+      }
+    ],
+    expose: [
+      {
+        regex: /\d+$/,
+        token: "number",
+        next: "start"
+      },
+      {
+        regex: /[^\d]+$/,
+        token: null,
+        next: "start"
+      },
+      {
+        regex: /\d+/,
+        token: "number"
+      },
+      {
+        regex: /[^\d]+/,
+        token: null
+      },
+      // Fail safe return to start
+      {
+        token: null,
+        next: "start"
+      }
+    ],
+    arguments: [
+      {
+        regex: /^\s*#.*$/,
+        sol: true,
+        token: "comment"
+      },
+      {
+        regex: /"(?:[^\\"]|\\.)*"?$/,
+        token: "string",
+        next: "start"
+      },
+      {
+        regex: /"/,
+        token: "string",
+        push: "double"
+      },
+      {
+        regex: /'(?:[^\\']|\\.)*'?$/,
+        token: "string",
+        next: "start"
+      },
+      {
+        regex: /'/,
+        token: "string",
+        push: "single"
+      },
+      {
+        regex: /[^#"']+[\\`]$/,
+        token: null
+      },
+      {
+        regex: /[^#"']+$/,
+        token: null,
+        next: "start"
+      },
+      {
+        regex: /[^#"']+/,
+        token: null
+      },
+      // Fail safe return to start
+      {
+        token: null,
+        next: "start"
+      }
+    ],
+    meta: {
+      lineComment: "#"
+    }
+  });
+
+  CodeMirror.defineMIME("text/x-dockerfile", "dockerfile");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dockerfile/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,73 @@
+<!doctype html>
+
+<title>CodeMirror: Dockerfile mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="dockerfile.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Dockerfile</a>
+  </ul>
+</div>
+
+<article>
+<h2>Dockerfile mode</h2>
+<form><textarea id="code" name="code"># Install Ghost blogging platform and run development environment
+#
+# VERSION 1.0.0
+
+FROM ubuntu:12.10
+MAINTAINER Amer Grgic "amer@livebyt.es"
+WORKDIR /data/ghost
+
+# Install dependencies for nginx installation
+RUN apt-get update
+RUN apt-get install -y python g++ make software-properties-common --force-yes
+RUN add-apt-repository ppa:chris-lea/node.js
+RUN apt-get update
+# Install unzip
+RUN apt-get install -y unzip
+# Install curl
+RUN apt-get install -y curl
+# Install nodejs & npm
+RUN apt-get install -y rlwrap
+RUN apt-get install -y nodejs 
+# Download Ghost v0.4.1
+RUN curl -L https://ghost.org/zip/ghost-latest.zip -o /tmp/ghost.zip
+# Unzip Ghost zip to /data/ghost
+RUN unzip -uo /tmp/ghost.zip -d /data/ghost
+# Add custom config js to /data/ghost
+ADD ./config.example.js /data/ghost/config.js
+# Install Ghost with NPM
+RUN cd /data/ghost/ && npm install --production
+# Expose port 2368
+EXPOSE 2368
+# Run Ghost
+CMD ["npm","start"]
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "dockerfile"
+      });
+    </script>
+
+    <p>Dockerfile syntax highlighting for CodeMirror. Depends on
+    the <a href="../../demo/simplemode.html">simplemode</a> addon.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-dockerfile</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dockerfile/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,128 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-dockerfile");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("simple_nodejs_dockerfile",
+     "[keyword FROM] node:carbon",
+     "[comment # Create app directory]",
+     "[keyword WORKDIR] /usr/src/app",
+     "[comment # Install app dependencies]",
+     "[comment # A wildcard is used to ensure both package.json AND package-lock.json are copied]",
+     "[comment # where available (npm@5+)]",
+     "[keyword COPY] package*.json ./",
+     "[keyword RUN] npm install",
+     "[keyword COPY] . .",
+     "[keyword EXPOSE] [number 8080] [number 3000]",
+     "[keyword ENV] NODE_ENV development",
+     "[keyword CMD] [[ [string \"npm\"], [string \"start\"] ]]");
+
+  // Ideally the last space should not be highlighted.
+  MT("instruction_without_args_1",
+     "[keyword CMD] ");
+
+  MT("instruction_without_args_2",
+     "[comment # An instruction without args...]",
+     "[keyword ARG] [error #...is an error]");
+
+  MT("multiline",
+     "[keyword RUN] apt-get update && apt-get install -y \\",
+     "  mercurial \\",
+     "  subversion \\",
+     "  && apt-get clean \\",
+     "  && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*");
+
+  MT("from_comment",
+     "  [keyword FROM] debian:stretch # I tend to use stable as that is more stable",
+     "  [keyword FROM] debian:stretch [keyword AS] stable # I am even more stable",
+     " [keyword FROM] [error # this is an error]");
+
+  MT("from_as",
+     "[keyword FROM] golang:1.9.2-alpine3.6 [keyword AS] build",
+     "[keyword COPY] --from=build /bin/project /bin/project",
+     "[keyword ENTRYPOINT] [[ [string \"/bin/project\"] ]]",
+     "[keyword CMD] [[ [string \"--help\"] ]]");
+
+  MT("arg",
+     "[keyword ARG] VERSION=latest",
+     "[keyword FROM] busybox:$VERSION",
+     "[keyword ARG] VERSION",
+     "[keyword RUN] echo $VERSION > image_version");
+
+  MT("label",
+     "[keyword LABEL] com.example.label-with-value=[string \"foo\"]");
+
+  MT("label_multiline",
+     "[keyword LABEL] description=[string \"This text illustrates ]\\",
+     "[string that label-values can span multiple lines.\"]");
+
+  MT("maintainer",
+     "[keyword MAINTAINER] Foo Bar [string \"foo@bar.com\"] ",
+     "[keyword MAINTAINER] Bar Baz <bar@baz.com>");
+
+  MT("env",
+     "[keyword ENV] BUNDLE_PATH=[string \"$GEM_HOME\"] \\",
+     "  BUNDLE_APP_CONFIG=[string \"$GEM_HOME\"]");
+
+  MT("verify_keyword",
+     "[keyword RUN] add-apt-repository ppa:chris-lea/node.js");
+
+  MT("scripts",
+     "[comment # Set an entrypoint, to automatically install node modules]",
+     "[keyword ENTRYPOINT] [[ [string \"/bin/bash\"], [string \"-c\"], [string \"if [[ ! -d node_modules ]]; then npm install; fi; exec \\\"${@:0}\\\";\"] ]]",
+     "[keyword CMD] npm start",
+     "[keyword RUN] npm run build && \\",
+     "[comment # a comment between the shell commands]",
+     "  npm run test");
+
+  MT("strings_single",
+     "[keyword FROM] buildpack-deps:stretch",
+     "[keyword RUN] { \\",
+     "        echo [string 'install: --no-document']; \\",
+     "        echo [string 'update: --no-document']; \\",
+     "    } >> /usr/local/etc/gemrc");
+
+  MT("strings_single_multiline",
+     "[keyword RUN] set -ex \\",
+     "    \\",
+     "    && buildDeps=[string ' ]\\",
+     "[string        bison ]\\",
+     "[string        dpkg-dev ]\\",
+     "[string        libgdbm-dev ]\\",
+     "[string        ruby ]\\",
+     "[string    '] \\",
+     "    && apt-get update");
+
+  MT("strings_single_multiline_2",
+     "[keyword RUN] echo [string 'say \\' ]\\",
+     "[string   it works'] ");
+
+  MT("strings_double",
+     "[keyword RUN] apt-get install -y --no-install-recommends $buildDeps \\",
+     " \\",
+     " && wget -O ruby.tar.xz [string \"https://cache.ruby-lang.org/pub/ruby/${RUBY_MAJOR%-rc}/ruby-$RUBY_VERSION.tar.xz\"] \\",
+     " && echo [string \"$RUBY_DOWNLOAD_SHA256 *ruby.tar.xz\"] | sha256sum -c - ");
+
+  MT("strings_double_multiline",
+     "[keyword RUN] echo [string \"say \\\" ]\\",
+     "[string   it works\"] ");
+
+  MT("escape",
+     "[comment # escape=`]",
+     "[keyword FROM] microsoft/windowsservercore",
+     "[keyword RUN] powershell.exe -Command `",
+     "    $ErrorActionPreference = [string 'Stop']; `",
+     "    wget https://www.python.org/ftp/python/3.5.1/python-3.5.1.exe -OutFile c:\python-3.5.1.exe ; `",
+     "    Start-Process c:\python-3.5.1.exe -ArgumentList [string '/quiet InstallAllUsers=1 PrependPath=1'] -Wait ; `",
+     "    Remove-Item c:\python-3.5.1.exe -Force)");
+
+  MT("escape_strings",
+     "[comment # escape=`]",
+     "[keyword FROM] python:3.6-windowsservercore [keyword AS] python",
+     "[keyword RUN] $env:PATH = [string 'C:\\Python;C:\\Python\\Scripts;{0}'] -f $env:PATH ; `",
+     // It should not consider \' as escaped.
+     // "  Set-ItemProperty -Path [string 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\'] -Name Path -Value $env:PATH ;");
+     "  Set-ItemProperty -Path [string 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\' -Name Path -Value $env:PATH ;]");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dtd/dtd.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,142 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+  DTD mode
+  Ported to CodeMirror by Peter Kroon <plakroon@gmail.com>
+  Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues
+  GitHub: @peterkroon
+*/
+
+(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.defineMode("dtd", function(config) {
+  var indentUnit = config.indentUnit, type;
+  function ret(style, tp) {type = tp; return style;}
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+
+    if (ch == "<" && stream.eat("!") ) {
+      if (stream.eatWhile(/[\-]/)) {
+        state.tokenize = tokenSGMLComment;
+        return tokenSGMLComment(stream, state);
+      } else if (stream.eatWhile(/[\w]/)) return ret("keyword", "doindent");
+    } else if (ch == "<" && stream.eat("?")) { //xml declaration
+      state.tokenize = inBlock("meta", "?>");
+      return ret("meta", ch);
+    } else if (ch == "#" && stream.eatWhile(/[\w]/)) return ret("atom", "tag");
+    else if (ch == "|") return ret("keyword", "separator");
+    else if (ch.match(/[\(\)\[\]\-\.,\+\?>]/)) return ret(null, ch);//if(ch === ">") return ret(null, "endtag"); else
+    else if (ch.match(/[\[\]]/)) return ret("rule", ch);
+    else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    } else if (stream.eatWhile(/[a-zA-Z\?\+\d]/)) {
+      var sc = stream.current();
+      if( sc.substr(sc.length-1,sc.length).match(/\?|\+/) !== null )stream.backUp(1);
+      return ret("tag", "tag");
+    } else if (ch == "%" || ch == "*" ) return ret("number", "number");
+    else {
+      stream.eatWhile(/[\w\\\-_%.{,]/);
+      return ret(null, null);
+    }
+  }
+
+  function tokenSGMLComment(stream, state) {
+    var dashes = 0, ch;
+    while ((ch = stream.next()) != null) {
+      if (dashes >= 2 && ch == ">") {
+        state.tokenize = tokenBase;
+        break;
+      }
+      dashes = (ch == "-") ? dashes + 1 : 0;
+    }
+    return ret("comment", "comment");
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      return ret("string", "tag");
+    };
+  }
+
+  function inBlock(style, terminator) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.match(terminator)) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        stream.next();
+      }
+      return style;
+    };
+  }
+
+  return {
+    startState: function(base) {
+      return {tokenize: tokenBase,
+              baseIndent: base || 0,
+              stack: []};
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+
+      var context = state.stack[state.stack.length-1];
+      if (stream.current() == "[" || type === "doindent" || type == "[") state.stack.push("rule");
+      else if (type === "endtag") state.stack[state.stack.length-1] = "endtag";
+      else if (stream.current() == "]" || type == "]" || (type == ">" && context == "rule")) state.stack.pop();
+      else if (type == "[") state.stack.push("[");
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var n = state.stack.length;
+
+      if( textAfter.charAt(0) === ']' )n--;
+      else if(textAfter.substr(textAfter.length-1, textAfter.length) === ">"){
+        if(textAfter.substr(0,1) === "<") {}
+        else if( type == "doindent" && textAfter.length > 1 ) {}
+        else if( type == "doindent")n--;
+        else if( type == ">" && textAfter.length > 1) {}
+        else if( type == "tag" && textAfter !== ">") {}
+        else if( type == "tag" && state.stack[state.stack.length-1] == "rule")n--;
+        else if( type == "tag")n++;
+        else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule" && type === ">")n--;
+        else if( textAfter === ">" && state.stack[state.stack.length-1] == "rule") {}
+        else if( textAfter.substr(0,1) !== "<" && textAfter.substr(0,1) === ">" )n=n-1;
+        else if( textAfter === ">") {}
+        else n=n-1;
+        //over rule them all
+        if(type == null || type == "]")n--;
+      }
+
+      return state.baseIndent + n * indentUnit;
+    },
+
+    electricChars: "]>"
+  };
+});
+
+CodeMirror.defineMIME("application/xml-dtd", "dtd");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dtd/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,89 @@
+<!doctype html>
+
+<title>CodeMirror: DTD mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="dtd.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">DTD</a>
+  </ul>
+</div>
+
+<article>
+<h2>DTD mode</h2>
+<form><textarea id="code" name="code"><?xml version="1.0" encoding="UTF-8"?>
+
+<!ATTLIST title
+  xmlns	CDATA	#FIXED	"http://docbook.org/ns/docbook"
+  role	CDATA	#IMPLIED
+  %db.common.attributes;
+  %db.common.linking.attributes;
+>
+
+<!--
+  Try: http://docbook.org/xml/5.0/dtd/docbook.dtd
+-->
+
+<!DOCTYPE xsl:stylesheet
+  [
+    <!ENTITY nbsp   "&amp;#160;">
+    <!ENTITY copy   "&amp;#169;">
+    <!ENTITY reg    "&amp;#174;">
+    <!ENTITY trade  "&amp;#8482;">
+    <!ENTITY mdash  "&amp;#8212;">
+    <!ENTITY ldquo  "&amp;#8220;">
+    <!ENTITY rdquo  "&amp;#8221;">
+    <!ENTITY pound  "&amp;#163;">
+    <!ENTITY yen    "&amp;#165;">
+    <!ENTITY euro   "&amp;#8364;">
+    <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
+  ]
+>
+
+<!ELEMENT title (#PCDATA|inlinemediaobject|remark|superscript|subscript|xref|link|olink|anchor|biblioref|alt|annotation|indexterm|abbrev|acronym|date|emphasis|footnote|footnoteref|foreignphrase|phrase|quote|wordasword|firstterm|glossterm|coref|trademark|productnumber|productname|database|application|hardware|citation|citerefentry|citetitle|citebiblioid|author|person|personname|org|orgname|editor|jobtitle|replaceable|package|parameter|termdef|nonterminal|systemitem|option|optional|property|inlineequation|tag|markup|token|symbol|literal|code|constant|email|uri|guiicon|guibutton|guimenuitem|guimenu|guisubmenu|guilabel|menuchoice|mousebutton|keycombo|keycap|keycode|keysym|shortcut|accel|prompt|envar|filename|command|computeroutput|userinput|function|varname|returnvalue|type|classname|exceptionname|interfacename|methodname|modifier|initializer|ooclass|ooexception|oointerface|errorcode|errortext|errorname|errortype)*>
+
+<!ENTITY % db.common.attributes "
+  xml:id	ID	#IMPLIED
+  version	CDATA	#IMPLIED
+  xml:lang	CDATA	#IMPLIED
+  xml:base	CDATA	#IMPLIED
+  remap	CDATA	#IMPLIED
+  xreflabel	CDATA	#IMPLIED
+  revisionflag	(changed|added|deleted|off)	#IMPLIED
+  dir	(ltr|rtl|lro|rlo)	#IMPLIED
+  arch	CDATA	#IMPLIED
+  audience	CDATA	#IMPLIED
+  condition	CDATA	#IMPLIED
+  conformance	CDATA	#IMPLIED
+  os	CDATA	#IMPLIED
+  revision	CDATA	#IMPLIED
+  security	CDATA	#IMPLIED
+  userlevel	CDATA	#IMPLIED
+  vendor	CDATA	#IMPLIED
+  wordsize	CDATA	#IMPLIED
+  annotations	CDATA	#IMPLIED
+
+"></textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "dtd", alignCDATA: true},
+        lineNumbers: true,
+        lineWrapping: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>application/xml-dtd</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dylan/dylan.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,352 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+function forEach(arr, f) {
+  for (var i = 0; i < arr.length; i++) f(arr[i], i)
+}
+function some(arr, f) {
+  for (var i = 0; i < arr.length; i++) if (f(arr[i], i)) return true
+  return false
+}
+
+CodeMirror.defineMode("dylan", function(_config) {
+  // Words
+  var words = {
+    // Words that introduce unnamed definitions like "define interface"
+    unnamedDefinition: ["interface"],
+
+    // Words that introduce simple named definitions like "define library"
+    namedDefinition: ["module", "library", "macro",
+                      "C-struct", "C-union",
+                      "C-function", "C-callable-wrapper"
+                     ],
+
+    // Words that introduce type definitions like "define class".
+    // These are also parameterized like "define method" and are
+    // appended to otherParameterizedDefinitionWords
+    typeParameterizedDefinition: ["class", "C-subtype", "C-mapped-subtype"],
+
+    // Words that introduce trickier definitions like "define method".
+    // These require special definitions to be added to startExpressions
+    otherParameterizedDefinition: ["method", "function",
+                                   "C-variable", "C-address"
+                                  ],
+
+    // Words that introduce module constant definitions.
+    // These must also be simple definitions and are
+    // appended to otherSimpleDefinitionWords
+    constantSimpleDefinition: ["constant"],
+
+    // Words that introduce module variable definitions.
+    // These must also be simple definitions and are
+    // appended to otherSimpleDefinitionWords
+    variableSimpleDefinition: ["variable"],
+
+    // Other words that introduce simple definitions
+    // (without implicit bodies).
+    otherSimpleDefinition: ["generic", "domain",
+                            "C-pointer-type",
+                            "table"
+                           ],
+
+    // Words that begin statements with implicit bodies.
+    statement: ["if", "block", "begin", "method", "case",
+                "for", "select", "when", "unless", "until",
+                "while", "iterate", "profiling", "dynamic-bind"
+               ],
+
+    // Patterns that act as separators in compound statements.
+    // This may include any general pattern that must be indented
+    // specially.
+    separator: ["finally", "exception", "cleanup", "else",
+                "elseif", "afterwards"
+               ],
+
+    // Keywords that do not require special indentation handling,
+    // but which should be highlighted
+    other: ["above", "below", "by", "from", "handler", "in",
+            "instance", "let", "local", "otherwise", "slot",
+            "subclass", "then", "to", "keyed-by", "virtual"
+           ],
+
+    // Condition signaling function calls
+    signalingCalls: ["signal", "error", "cerror",
+                     "break", "check-type", "abort"
+                    ]
+  };
+
+  words["otherDefinition"] =
+    words["unnamedDefinition"]
+    .concat(words["namedDefinition"])
+    .concat(words["otherParameterizedDefinition"]);
+
+  words["definition"] =
+    words["typeParameterizedDefinition"]
+    .concat(words["otherDefinition"]);
+
+  words["parameterizedDefinition"] =
+    words["typeParameterizedDefinition"]
+    .concat(words["otherParameterizedDefinition"]);
+
+  words["simpleDefinition"] =
+    words["constantSimpleDefinition"]
+    .concat(words["variableSimpleDefinition"])
+    .concat(words["otherSimpleDefinition"]);
+
+  words["keyword"] =
+    words["statement"]
+    .concat(words["separator"])
+    .concat(words["other"]);
+
+  // Patterns
+  var symbolPattern = "[-_a-zA-Z?!*@<>$%]+";
+  var symbol = new RegExp("^" + symbolPattern);
+  var patterns = {
+    // Symbols with special syntax
+    symbolKeyword: symbolPattern + ":",
+    symbolClass: "<" + symbolPattern + ">",
+    symbolGlobal: "\\*" + symbolPattern + "\\*",
+    symbolConstant: "\\$" + symbolPattern
+  };
+  var patternStyles = {
+    symbolKeyword: "atom",
+    symbolClass: "tag",
+    symbolGlobal: "variable-2",
+    symbolConstant: "variable-3"
+  };
+
+  // Compile all patterns to regular expressions
+  for (var patternName in patterns)
+    if (patterns.hasOwnProperty(patternName))
+      patterns[patternName] = new RegExp("^" + patterns[patternName]);
+
+  // Names beginning "with-" and "without-" are commonly
+  // used as statement macro
+  patterns["keyword"] = [/^with(?:out)?-[-_a-zA-Z?!*@<>$%]+/];
+
+  var styles = {};
+  styles["keyword"] = "keyword";
+  styles["definition"] = "def";
+  styles["simpleDefinition"] = "def";
+  styles["signalingCalls"] = "builtin";
+
+  // protected words lookup table
+  var wordLookup = {};
+  var styleLookup = {};
+
+  forEach([
+    "keyword",
+    "definition",
+    "simpleDefinition",
+    "signalingCalls"
+  ], function(type) {
+    forEach(words[type], function(word) {
+      wordLookup[word] = type;
+      styleLookup[word] = styles[type];
+    });
+  });
+
+
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+
+  function tokenBase(stream, state) {
+    // String
+    var ch = stream.peek();
+    if (ch == "'" || ch == '"') {
+      stream.next();
+      return chain(stream, state, tokenString(ch, "string"));
+    }
+    // Comment
+    else if (ch == "/") {
+      stream.next();
+      if (stream.eat("*")) {
+        return chain(stream, state, tokenComment);
+      } else if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+      stream.backUp(1);
+    }
+    // Decimal
+    else if (/[+\-\d\.]/.test(ch)) {
+      if (stream.match(/^[+-]?[0-9]*\.[0-9]*([esdx][+-]?[0-9]+)?/i) ||
+          stream.match(/^[+-]?[0-9]+([esdx][+-]?[0-9]+)/i) ||
+          stream.match(/^[+-]?\d+/)) {
+        return "number";
+      }
+    }
+    // Hash
+    else if (ch == "#") {
+      stream.next();
+      // Symbol with string syntax
+      ch = stream.peek();
+      if (ch == '"') {
+        stream.next();
+        return chain(stream, state, tokenString('"', "string"));
+      }
+      // Binary number
+      else if (ch == "b") {
+        stream.next();
+        stream.eatWhile(/[01]/);
+        return "number";
+      }
+      // Hex number
+      else if (ch == "x") {
+        stream.next();
+        stream.eatWhile(/[\da-f]/i);
+        return "number";
+      }
+      // Octal number
+      else if (ch == "o") {
+        stream.next();
+        stream.eatWhile(/[0-7]/);
+        return "number";
+      }
+      // Token concatenation in macros
+      else if (ch == '#') {
+        stream.next();
+        return "punctuation";
+      }
+      // Sequence literals
+      else if ((ch == '[') || (ch == '(')) {
+        stream.next();
+        return "bracket";
+      // Hash symbol
+      } else if (stream.match(/f|t|all-keys|include|key|next|rest/i)) {
+        return "atom";
+      } else {
+        stream.eatWhile(/[-a-zA-Z]/);
+        return "error";
+      }
+    } else if (ch == "~") {
+      stream.next();
+      ch = stream.peek();
+      if (ch == "=") {
+        stream.next();
+        ch = stream.peek();
+        if (ch == "=") {
+          stream.next();
+          return "operator";
+        }
+        return "operator";
+      }
+      return "operator";
+    } else if (ch == ":") {
+      stream.next();
+      ch = stream.peek();
+      if (ch == "=") {
+        stream.next();
+        return "operator";
+      } else if (ch == ":") {
+        stream.next();
+        return "punctuation";
+      }
+    } else if ("[](){}".indexOf(ch) != -1) {
+      stream.next();
+      return "bracket";
+    } else if (".,".indexOf(ch) != -1) {
+      stream.next();
+      return "punctuation";
+    } else if (stream.match("end")) {
+      return "keyword";
+    }
+    for (var name in patterns) {
+      if (patterns.hasOwnProperty(name)) {
+        var pattern = patterns[name];
+        if ((pattern instanceof Array && some(pattern, function(p) {
+          return stream.match(p);
+        })) || stream.match(pattern))
+          return patternStyles[name];
+      }
+    }
+    if (/[+\-*\/^=<>&|]/.test(ch)) {
+      stream.next();
+      return "operator";
+    }
+    if (stream.match("define")) {
+      return "def";
+    } else {
+      stream.eatWhile(/[\w\-]/);
+      // Keyword
+      if (wordLookup.hasOwnProperty(stream.current())) {
+        return styleLookup[stream.current()];
+      } else if (stream.current().match(symbol)) {
+        return "variable";
+      } else {
+        stream.next();
+        return "variable-2";
+      }
+    }
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
+    while ((ch = stream.next())) {
+      if (ch == "/" && maybeEnd) {
+        if (nestedCount > 0) {
+          nestedCount--;
+        } else {
+          state.tokenize = tokenBase;
+          break;
+        }
+      } else if (ch == "*" && maybeNested) {
+        nestedCount++;
+      }
+      maybeEnd = (ch == "*");
+      maybeNested = (ch == "/");
+    }
+    return "comment";
+  }
+
+  function tokenString(quote, style) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {
+          end = true;
+          break;
+        }
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !escaped) {
+        state.tokenize = tokenBase;
+      }
+      return style;
+    };
+  }
+
+  // Interface
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase,
+        currentIndent: 0
+      };
+    },
+    token: function(stream, state) {
+      if (stream.eatSpace())
+        return null;
+      var style = state.tokenize(stream, state);
+      return style;
+    },
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/"
+  };
+});
+
+CodeMirror.defineMIME("text/x-dylan", "dylan");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dylan/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,407 @@
+<!doctype html>
+
+<title>CodeMirror: Dylan mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../../addon/comment/continuecomment.js"></script>
+<script src="../../addon/comment/comment.js"></script>
+<script src="dylan.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Dylan</a>
+  </ul>
+</div>
+
+<article>
+<h2>Dylan mode</h2>
+
+
+<div><textarea id="code" name="code">
+Module:       locators-internals
+Synopsis:     Abstract modeling of locations
+Author:       Andy Armstrong
+Copyright:    Original Code is Copyright (c) 1995-2004 Functional Objects, Inc.
+              All rights reserved.
+License:      See License.txt in this distribution for details.
+Warranty:     Distributed WITHOUT WARRANTY OF ANY KIND
+
+define open generic locator-server
+    (locator :: <locator>) => (server :: false-or(<server-locator>));
+define open generic locator-host
+    (locator :: <locator>) => (host :: false-or(<string>));
+define open generic locator-volume
+    (locator :: <locator>) => (volume :: false-or(<string>));
+define open generic locator-directory
+    (locator :: <locator>) => (directory :: false-or(<directory-locator>));
+define open generic locator-relative?
+    (locator :: <locator>) => (relative? :: <boolean>);
+define open generic locator-path
+    (locator :: <locator>) => (path :: <sequence>);
+define open generic locator-base
+    (locator :: <locator>) => (base :: false-or(<string>));
+define open generic locator-extension
+    (locator :: <locator>) => (extension :: false-or(<string>));
+
+/// Locator classes
+
+define open abstract class <directory-locator> (<physical-locator>)
+end class <directory-locator>;
+
+define open abstract class <file-locator> (<physical-locator>)
+end class <file-locator>;
+
+define method as
+    (class == <directory-locator>, string :: <string>)
+ => (locator :: <directory-locator>)
+  as(<native-directory-locator>, string)
+end method as;
+
+define method make
+    (class == <directory-locator>,
+     #key server :: false-or(<server-locator>) = #f,
+          path :: <sequence> = #[],
+          relative? :: <boolean> = #f,
+          name :: false-or(<string>) = #f)
+ => (locator :: <directory-locator>)
+  make(<native-directory-locator>,
+       server:    server,
+       path:      path,
+       relative?: relative?,
+       name:      name)
+end method make;
+
+define method as
+    (class == <file-locator>, string :: <string>)
+ => (locator :: <file-locator>)
+  as(<native-file-locator>, string)
+end method as;
+
+define method make
+    (class == <file-locator>,
+     #key directory :: false-or(<directory-locator>) = #f,
+          base :: false-or(<string>) = #f,
+          extension :: false-or(<string>) = #f,
+          name :: false-or(<string>) = #f)
+ => (locator :: <file-locator>)
+  make(<native-file-locator>,
+       directory: directory,
+       base:      base,
+       extension: extension,
+       name:      name)
+end method make;
+
+/// Locator coercion
+
+//---*** andrewa: This caching scheme doesn't work yet, so disable it.
+define constant $cache-locators?        = #f;
+define constant $cache-locator-strings? = #f;
+
+define constant $locator-to-string-cache = make(<object-table>, weak: #"key");
+define constant $string-to-locator-cache = make(<string-table>, weak: #"value");
+
+define open generic locator-as-string
+    (class :: subclass(<string>), locator :: <locator>)
+ => (string :: <string>);
+
+define open generic string-as-locator
+    (class :: subclass(<locator>), string :: <string>)
+ => (locator :: <locator>);
+
+define sealed sideways method as
+    (class :: subclass(<string>), locator :: <locator>)
+ => (string :: <string>)
+  let string = element($locator-to-string-cache, locator, default: #f);
+  if (string)
+    as(class, string)
+  else
+    let string = locator-as-string(class, locator);
+    if ($cache-locator-strings?)
+      element($locator-to-string-cache, locator) := string;
+    else
+      string
+    end
+  end
+end method as;
+
+define sealed sideways method as
+    (class :: subclass(<locator>), string :: <string>)
+ => (locator :: <locator>)
+  let locator = element($string-to-locator-cache, string, default: #f);
+  if (instance?(locator, class))
+    locator
+  else
+    let locator = string-as-locator(class, string);
+    if ($cache-locators?)
+      element($string-to-locator-cache, string) := locator;
+    else
+      locator
+    end
+  end
+end method as;
+
+/// Locator conditions
+
+define class <locator-error> (<format-string-condition>, <error>)
+end class <locator-error>;
+
+define function locator-error
+    (format-string :: <string>, #rest format-arguments)
+  error(make(<locator-error>, 
+             format-string:    format-string,
+             format-arguments: format-arguments))
+end function locator-error;
+
+/// Useful locator protocols
+
+define open generic locator-test
+    (locator :: <directory-locator>) => (test :: <function>);
+
+define method locator-test
+    (locator :: <directory-locator>) => (test :: <function>)
+  \=
+end method locator-test;
+
+define open generic locator-might-have-links?
+    (locator :: <directory-locator>) => (links? :: <boolean>);
+
+define method locator-might-have-links?
+    (locator :: <directory-locator>) => (links? :: singleton(#f))
+  #f
+end method locator-might-have-links?;
+
+define method locator-relative?
+    (locator :: <file-locator>) => (relative? :: <boolean>)
+  let directory = locator.locator-directory;
+  ~directory | directory.locator-relative?
+end method locator-relative?;
+
+define method current-directory-locator?
+    (locator :: <directory-locator>) => (current-directory? :: <boolean>)
+  locator.locator-relative?
+    & locator.locator-path = #[#"self"]
+end method current-directory-locator?;
+
+define method locator-directory
+    (locator :: <directory-locator>) => (parent :: false-or(<directory-locator>))
+  let path = locator.locator-path;
+  unless (empty?(path))
+    make(object-class(locator),
+         server:    locator.locator-server,
+         path:      copy-sequence(path, end: path.size - 1),
+         relative?: locator.locator-relative?)
+  end
+end method locator-directory;
+
+/// Simplify locator
+
+define open generic simplify-locator
+    (locator :: <physical-locator>)
+ => (simplified-locator :: <physical-locator>);
+
+define method simplify-locator
+    (locator :: <directory-locator>)
+ => (simplified-locator :: <directory-locator>)
+  let path = locator.locator-path;
+  let relative? = locator.locator-relative?;
+  let resolve-parent? = ~locator.locator-might-have-links?;
+  let simplified-path
+    = simplify-path(path, 
+                    resolve-parent?: resolve-parent?,
+                    relative?: relative?);
+  if (path ~= simplified-path)
+    make(object-class(locator),
+         server:    locator.locator-server,
+         path:      simplified-path,
+         relative?: locator.locator-relative?)
+  else
+    locator
+  end
+end method simplify-locator;
+
+define method simplify-locator
+    (locator :: <file-locator>) => (simplified-locator :: <file-locator>)
+  let directory = locator.locator-directory;
+  let simplified-directory = directory & simplify-locator(directory);
+  if (directory ~= simplified-directory)
+    make(object-class(locator),
+         directory: simplified-directory,
+         base:      locator.locator-base,
+         extension: locator.locator-extension)
+  else
+    locator
+  end
+end method simplify-locator;
+
+/// Subdirectory locator
+
+define open generic subdirectory-locator
+    (locator :: <directory-locator>, #rest sub-path)
+ => (subdirectory :: <directory-locator>);
+
+define method subdirectory-locator
+    (locator :: <directory-locator>, #rest sub-path)
+ => (subdirectory :: <directory-locator>)
+  let old-path = locator.locator-path;
+  let new-path = concatenate-as(<simple-object-vector>, old-path, sub-path);
+  make(object-class(locator),
+       server:    locator.locator-server,
+       path:      new-path,
+       relative?: locator.locator-relative?)
+end method subdirectory-locator;
+
+/// Relative locator
+
+define open generic relative-locator
+    (locator :: <physical-locator>, from-locator :: <physical-locator>)
+ => (relative-locator :: <physical-locator>);
+
+define method relative-locator
+    (locator :: <directory-locator>, from-locator :: <directory-locator>)
+ => (relative-locator :: <directory-locator>)
+  let path = locator.locator-path;
+  let from-path = from-locator.locator-path;
+  case
+    ~locator.locator-relative? & from-locator.locator-relative? =>
+      locator-error
+        ("Cannot find relative path of absolute locator %= from relative locator %=",
+         locator, from-locator);
+    locator.locator-server ~= from-locator.locator-server =>
+      locator;
+    path = from-path =>
+      make(object-class(locator),
+           path: vector(#"self"),
+           relative?: #t);
+    otherwise =>
+      make(object-class(locator),
+           path: relative-path(path, from-path, test: locator.locator-test),
+           relative?: #t);
+  end
+end method relative-locator;
+
+define method relative-locator
+    (locator :: <file-locator>, from-directory :: <directory-locator>)
+ => (relative-locator :: <file-locator>)
+  let directory = locator.locator-directory;
+  let relative-directory = directory & relative-locator(directory, from-directory);
+  if (relative-directory ~= directory)
+    simplify-locator
+      (make(object-class(locator),
+            directory: relative-directory,
+            base:      locator.locator-base,
+            extension: locator.locator-extension))
+  else
+    locator
+  end
+end method relative-locator;
+
+define method relative-locator
+    (locator :: <physical-locator>, from-locator :: <file-locator>)
+ => (relative-locator :: <physical-locator>)
+  let from-directory = from-locator.locator-directory;
+  case
+    from-directory =>
+      relative-locator(locator, from-directory);
+    ~locator.locator-relative? =>
+      locator-error
+        ("Cannot find relative path of absolute locator %= from relative locator %=",
+         locator, from-locator);
+    otherwise =>
+      locator;
+  end
+end method relative-locator;
+
+/// Merge locators
+
+define open generic merge-locators
+    (locator :: <physical-locator>, from-locator :: <physical-locator>)
+ => (merged-locator :: <physical-locator>);
+
+/// Merge locators
+
+define method merge-locators
+    (locator :: <directory-locator>, from-locator :: <directory-locator>)
+ => (merged-locator :: <directory-locator>)
+  if (locator.locator-relative?)
+    let path = concatenate(from-locator.locator-path, locator.locator-path);
+    simplify-locator
+      (make(object-class(locator),
+            server:    from-locator.locator-server,
+            path:      path,
+            relative?: from-locator.locator-relative?))
+  else
+    locator
+  end
+end method merge-locators;
+
+define method merge-locators
+    (locator :: <file-locator>, from-locator :: <directory-locator>)
+ => (merged-locator :: <file-locator>)
+  let directory = locator.locator-directory;
+  let merged-directory 
+    = if (directory)
+        merge-locators(directory, from-locator)
+      else
+        simplify-locator(from-locator)
+      end;
+  if (merged-directory ~= directory)
+    make(object-class(locator),
+         directory: merged-directory,
+         base:      locator.locator-base,
+         extension: locator.locator-extension)
+  else
+    locator
+  end
+end method merge-locators;
+
+define method merge-locators
+    (locator :: <physical-locator>, from-locator :: <file-locator>)
+ => (merged-locator :: <physical-locator>)
+  let from-directory = from-locator.locator-directory;
+  if (from-directory)
+    merge-locators(locator, from-directory)
+  else
+    locator
+  end
+end method merge-locators;
+
+/// Locator protocols
+
+define sideways method supports-open-locator?
+    (locator :: <file-locator>) => (openable? :: <boolean>)
+  ~locator.locator-relative?
+end method supports-open-locator?;
+
+define sideways method open-locator
+    (locator :: <file-locator>, #rest keywords, #key, #all-keys)
+ => (stream :: <stream>)
+  apply(open-file-stream, locator, keywords)
+end method open-locator;
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/x-dylan",
+        lineNumbers: true,
+        matchBrackets: true,
+        continueComments: "Enter",
+        extraKeys: {"Ctrl-Q": "toggleComment"},
+        tabMode: "indent",
+        indentUnit: 2
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-dylan</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/dylan/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,88 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "dylan");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT('comments',
+     '[comment // This is a line comment]',
+     '[comment /* This is a block comment */]',
+     '[comment /* This is a multi]',
+     '[comment line comment]',
+     '[comment */]',
+     '[comment /* And this is a /*]',
+     '[comment /* nested */ comment */]');
+
+  MT('unary_operators',
+     '[operator -][variable a]',
+     '[operator -] [variable a]',
+     '[operator ~][variable a]',
+     '[operator ~] [variable a]');
+
+  MT('binary_operators',
+     '[variable a] [operator +] [variable b]',
+     '[variable a] [operator -] [variable b]',
+     '[variable a] [operator *] [variable b]',
+     '[variable a] [operator /] [variable b]',
+     '[variable a] [operator ^] [variable b]',
+     '[variable a] [operator =] [variable b]',
+     '[variable a] [operator ==] [variable b]',
+     '[variable a] [operator ~=] [variable b]',
+     '[variable a] [operator ~==] [variable b]',
+     '[variable a] [operator <] [variable b]',
+     '[variable a] [operator <=] [variable b]',
+     '[variable a] [operator >] [variable b]',
+     '[variable a] [operator >=] [variable b]',
+     '[variable a] [operator &] [variable b]',
+     '[variable a] [operator |] [variable b]',
+     '[variable a] [operator :=] [variable b]');
+
+  MT('integers',
+     '[number 1]',
+     '[number 123]',
+     '[number -123]',
+     '[number +456]',
+     '[number #b010]',
+     '[number #o073]',
+     '[number #xabcDEF123]');
+
+  MT('floats',
+     '[number .3]',
+     '[number -1.]',
+     '[number -2.335]',
+     '[number +3.78d1]',
+     '[number 3.78s-1]',
+     '[number -3.32e+5]');
+
+  MT('characters_and_strings',
+     "[string 'a']",
+     "[string '\\\\'']",
+     '[string ""]',
+     '[string "a"]',
+     '[string "abc def"]',
+     '[string "More escaped characters: \\\\\\\\ \\\\a \\\\b \\\\e \\\\f \\\\n \\\\r \\\\t \\\\0 ..."]');
+
+  MT('brackets',
+     '[bracket #[[]]]',
+     '[bracket #()]',
+     '[bracket #(][number 1][bracket )]',
+     '[bracket [[][number 1][punctuation ,] [number 3][bracket ]]]',
+     '[bracket ()]',
+     '[bracket {}]',
+     '[keyword if] [bracket (][variable foo][bracket )]',
+     '[bracket (][number 1][bracket )]',
+     '[bracket [[][number 1][bracket ]]]');
+
+  MT('hash_words',
+     '[punctuation ##]',
+     '[atom #f]', '[atom #F]',
+     '[atom #t]', '[atom #T]',
+     '[atom #all-keys]',
+     '[atom #include]',
+     '[atom #key]',
+     '[atom #next]',
+     '[atom #rest]',
+     '[string #"foo"]',
+     '[error #invalid]');
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ebnf/ebnf.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,195 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("ebnf", function (config) {
+    var commentType = {slash: 0, parenthesis: 1};
+    var stateType = {comment: 0, _string: 1, characterClass: 2};
+    var bracesMode = null;
+
+    if (config.bracesMode)
+      bracesMode = CodeMirror.getMode(config, config.bracesMode);
+
+    return {
+      startState: function () {
+        return {
+          stringType: null,
+          commentType: null,
+          braced: 0,
+          lhs: true,
+          localState: null,
+          stack: [],
+          inDefinition: false
+        };
+      },
+      token: function (stream, state) {
+        if (!stream) return;
+
+        //check for state changes
+        if (state.stack.length === 0) {
+          //strings
+          if ((stream.peek() == '"') || (stream.peek() == "'")) {
+            state.stringType = stream.peek();
+            stream.next(); // Skip quote
+            state.stack.unshift(stateType._string);
+          } else if (stream.match('/*')) { //comments starting with /*
+            state.stack.unshift(stateType.comment);
+            state.commentType = commentType.slash;
+          } else if (stream.match('(*')) { //comments starting with (*
+            state.stack.unshift(stateType.comment);
+            state.commentType = commentType.parenthesis;
+          }
+        }
+
+        //return state
+        //stack has
+        switch (state.stack[0]) {
+        case stateType._string:
+          while (state.stack[0] === stateType._string && !stream.eol()) {
+            if (stream.peek() === state.stringType) {
+              stream.next(); // Skip quote
+              state.stack.shift(); // Clear flag
+            } else if (stream.peek() === "\\") {
+              stream.next();
+              stream.next();
+            } else {
+              stream.match(/^.[^\\\"\']*/);
+            }
+          }
+          return state.lhs ? "property string" : "string"; // Token style
+
+        case stateType.comment:
+          while (state.stack[0] === stateType.comment && !stream.eol()) {
+            if (state.commentType === commentType.slash && stream.match('*/')) {
+              state.stack.shift(); // Clear flag
+              state.commentType = null;
+            } else if (state.commentType === commentType.parenthesis && stream.match('*)')) {
+              state.stack.shift(); // Clear flag
+              state.commentType = null;
+            } else {
+              stream.match(/^.[^\*]*/);
+            }
+          }
+          return "comment";
+
+        case stateType.characterClass:
+          while (state.stack[0] === stateType.characterClass && !stream.eol()) {
+            if (!(stream.match(/^[^\]\\]+/) || stream.match('.'))) {
+              state.stack.shift();
+            }
+          }
+          return "operator";
+        }
+
+        var peek = stream.peek();
+
+        if (bracesMode !== null && (state.braced || peek === "{")) {
+          if (state.localState === null)
+            state.localState = CodeMirror.startState(bracesMode);
+
+          var token = bracesMode.token(stream, state.localState),
+          text = stream.current();
+
+          if (!token) {
+            for (var i = 0; i < text.length; i++) {
+              if (text[i] === "{") {
+                if (state.braced === 0) {
+                  token = "matchingbracket";
+                }
+                state.braced++;
+              } else if (text[i] === "}") {
+                state.braced--;
+                if (state.braced === 0) {
+                  token = "matchingbracket";
+                }
+              }
+            }
+          }
+          return token;
+        }
+
+        //no stack
+        switch (peek) {
+        case "[":
+          stream.next();
+          state.stack.unshift(stateType.characterClass);
+          return "bracket";
+        case ":":
+        case "|":
+        case ";":
+          stream.next();
+          return "operator";
+        case "%":
+          if (stream.match("%%")) {
+            return "header";
+          } else if (stream.match(/[%][A-Za-z]+/)) {
+            return "keyword";
+          } else if (stream.match(/[%][}]/)) {
+            return "matchingbracket";
+          }
+          break;
+        case "/":
+          if (stream.match(/[\/][A-Za-z]+/)) {
+          return "keyword";
+        }
+        case "\\":
+          if (stream.match(/[\][a-z]+/)) {
+            return "string-2";
+          }
+        case ".":
+          if (stream.match(".")) {
+            return "atom";
+          }
+        case "*":
+        case "-":
+        case "+":
+        case "^":
+          if (stream.match(peek)) {
+            return "atom";
+          }
+        case "$":
+          if (stream.match("$$")) {
+            return "builtin";
+          } else if (stream.match(/[$][0-9]+/)) {
+            return "variable-3";
+          }
+        case "<":
+          if (stream.match(/<<[a-zA-Z_]+>>/)) {
+            return "builtin";
+          }
+        }
+
+        if (stream.match('//')) {
+          stream.skipToEnd();
+          return "comment";
+        } else if (stream.match('return')) {
+          return "operator";
+        } else if (stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/)) {
+          if (stream.match(/(?=[\(.])/)) {
+            return "variable";
+          } else if (stream.match(/(?=[\s\n]*[:=])/)) {
+            return "def";
+          }
+          return "variable-2";
+        } else if (["[", "]", "(", ")"].indexOf(stream.peek()) != -1) {
+          stream.next();
+          return "bracket";
+        } else if (!stream.eatSpace()) {
+          stream.next();
+        }
+        return null;
+      }
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-ebnf", "ebnf");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ebnf/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,102 @@
+<!doctype html>
+<html>
+  <head>
+    <title>CodeMirror: EBNF Mode</title>
+    <meta charset="utf-8"/>
+    <link rel=stylesheet href="../../doc/docs.css">
+
+    <link rel="stylesheet" href="../../lib/codemirror.css">
+    <script src="../../lib/codemirror.js"></script>
+    <script src="../javascript/javascript.js"></script>
+    <script src="ebnf.js"></script>
+    <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+  </head>
+  <body>
+    <div id=nav>
+      <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+      <ul>
+        <li><a href="../../index.html">Home</a>
+        <li><a href="../../doc/manual.html">Manual</a>
+        <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+      </ul>
+      <ul>
+        <li><a href="../index.html">Language modes</a>
+        <li><a class=active href="#">EBNF Mode</a>
+      </ul>
+    </div>
+
+    <article>
+      <h2>EBNF Mode (bracesMode setting = "javascript")</h2>
+      <form><textarea id="code" name="code">
+/* description: Parses end executes mathematical expressions. */
+
+/* lexical grammar */
+%lex
+
+%%
+\s+                   /* skip whitespace */
+[0-9]+("."[0-9]+)?\b  return 'NUMBER';
+"*"                   return '*';
+"/"                   return '/';
+"-"                   return '-';
+"+"                   return '+';
+"^"                   return '^';
+"("                   return '(';
+")"                   return ')';
+"PI"                  return 'PI';
+"E"                   return 'E';
+&lt;&lt;EOF&gt;&gt;               return 'EOF';
+
+/lex
+
+/* operator associations and precedence */
+
+%left '+' '-'
+%left '*' '/'
+%left '^'
+%left UMINUS
+
+%start expressions
+
+%% /* language grammar */
+
+expressions
+: e EOF
+{print($1); return $1;}
+;
+
+e
+: e '+' e
+{$$ = $1+$3;}
+| e '-' e
+{$$ = $1-$3;}
+| e '*' e
+{$$ = $1*$3;}
+| e '/' e
+{$$ = $1/$3;}
+| e '^' e
+{$$ = Math.pow($1, $3);}
+| '-' e %prec UMINUS
+{$$ = -$2;}
+| '(' e ')'
+{$$ = $2;}
+| NUMBER
+{$$ = Number(yytext);}
+| E
+{$$ = Math.E;}
+| PI
+{$$ = Math.PI;}
+;</textarea></form>
+      <script>
+        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+          mode: {name: "ebnf"},
+          lineNumbers: true,
+          bracesMode: 'javascript'
+        });
+      </script>
+      <h3>The EBNF Mode</h3>
+      <p> Created by <a href="https://github.com/robertleeplummerjr">Robert Plummer</a></p>
+    </article>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ecl/ecl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,206 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("ecl", function(config) {
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  function metaHook(stream, state) {
+    if (!state.startOfLine) return false;
+    stream.skipToEnd();
+    return "meta";
+  }
+
+  var indentUnit = config.indentUnit;
+  var keyword = words("abs acos allnodes ascii asin asstring atan atan2 ave case choose choosen choosesets clustersize combine correlation cos cosh count covariance cron dataset dedup define denormalize distribute distributed distribution ebcdic enth error evaluate event eventextra eventname exists exp failcode failmessage fetch fromunicode getisvalid global graph group hash hash32 hash64 hashcrc hashmd5 having if index intformat isvalid iterate join keyunicode length library limit ln local log loop map matched matchlength matchposition matchtext matchunicode max merge mergejoin min nolocal nonempty normalize parse pipe power preload process project pull random range rank ranked realformat recordof regexfind regexreplace regroup rejected rollup round roundup row rowdiff sample set sin sinh sizeof soapcall sort sorted sqrt stepped stored sum table tan tanh thisnode topn tounicode transfer trim truncate typeof ungroup unicodeorder variance which workunit xmldecode xmlencode xmltext xmlunicode");
+  var variable = words("apply assert build buildindex evaluate fail keydiff keypatch loadxml nothor notify output parallel sequential soapcall wait");
+  var variable_2 = words("__compressed__ all and any as atmost before beginc++ best between case const counter csv descend encrypt end endc++ endmacro except exclusive expire export extend false few first flat from full function group header heading hole ifblock import in interface joined keep keyed last left limit load local locale lookup macro many maxcount maxlength min skew module named nocase noroot noscan nosort not of only opt or outer overwrite packed partition penalty physicallength pipe quote record relationship repeat return right scan self separator service shared skew skip sql store terminator thor threshold token transform trim true type unicodeorder unsorted validate virtual whole wild within xml xpath");
+  var variable_3 = words("ascii big_endian boolean data decimal ebcdic integer pattern qstring real record rule set of string token udecimal unicode unsigned varstring varunicode");
+  var builtin = words("checkpoint deprecated failcode failmessage failure global independent onwarning persist priority recovery stored success wait when");
+  var blockKeywords = words("catch class do else finally for if switch try while");
+  var atoms = words("true false null");
+  var hooks = {"#": metaHook};
+  var isOperatorChar = /[+\-*&%=<>!?|\/]/;
+
+  var curPunc;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (hooks[ch]) {
+      var result = hooks[ch](stream, state);
+      if (result !== false) return result;
+    }
+    if (ch == '"' || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      return "number";
+    }
+    if (ch == "/") {
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_]/);
+    var cur = stream.current().toLowerCase();
+    if (keyword.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "keyword";
+    } else if (variable.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "variable";
+    } else if (variable_2.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "variable-2";
+    } else if (variable_3.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "variable-3";
+    } else if (builtin.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "builtin";
+    } else { //Data types are of from KEYWORD##
+                var i = cur.length - 1;
+                while(i >= 0 && (!isNaN(cur[i]) || cur[i] == '_'))
+                        --i;
+
+                if (i > 0) {
+                        var cur2 = cur.substr(0, i + 1);
+                if (variable_3.propertyIsEnumerable(cur2)) {
+                        if (blockKeywords.propertyIsEnumerable(cur2)) curPunc = "newstatement";
+                        return "variable-3";
+                }
+            }
+    }
+    if (atoms.propertyIsEnumerable(cur)) return "atom";
+    return null;
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !escaped)
+        state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function Context(indented, column, type, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.align = align;
+    this.prev = prev;
+  }
+  function pushContext(state, col, type) {
+    return state.context = new Context(state.indented, col, type, null, state.context);
+  }
+  function popContext(state) {
+    var t = state.context.type;
+    if (t == ")" || t == "]" || t == "}")
+      state.indented = state.context.indented;
+    return state.context = state.context.prev;
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+        indented: 0,
+        startOfLine: true
+      };
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+      }
+      if (stream.eatSpace()) return null;
+      curPunc = null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta") return style;
+      if (ctx.align == null) ctx.align = true;
+
+      if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
+      else if (curPunc == "{") pushContext(state, stream.column(), "}");
+      else if (curPunc == "[") pushContext(state, stream.column(), "]");
+      else if (curPunc == "(") pushContext(state, stream.column(), ")");
+      else if (curPunc == "}") {
+        while (ctx.type == "statement") ctx = popContext(state);
+        if (ctx.type == "}") ctx = popContext(state);
+        while (ctx.type == "statement") ctx = popContext(state);
+      }
+      else if (curPunc == ctx.type) popContext(state);
+      else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
+        pushContext(state, stream.column(), "statement");
+      state.startOfLine = false;
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null) return 0;
+      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+      if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
+      var closing = firstChar == ctx.type;
+      if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
+      else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: "{}"
+  };
+});
+
+CodeMirror.defineMIME("text/x-ecl", "ecl");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ecl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+<!doctype html>
+
+<title>CodeMirror: ECL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="ecl.js"></script>
+<style>.CodeMirror {border: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">ECL</a>
+  </ul>
+</div>
+
+<article>
+<h2>ECL mode</h2>
+<form><textarea id="code" name="code">
+/*
+sample useless code to demonstrate ecl syntax highlighting
+this is a multiline comment!
+*/
+
+//  this is a singleline comment!
+
+import ut;
+r := 
+  record
+   string22 s1 := '123';
+   integer4 i1 := 123;
+  end;
+#option('tmp', true);
+d := dataset('tmp::qb', r, thor);
+output(d);
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p>Based on CodeMirror's clike mode.  For more information see <a href="http://hpccsystems.com">HPCC Systems</a> web site.</p>
+    <p><strong>MIME types defined:</strong> <code>text/x-ecl</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/eiffel/eiffel.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,160 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("eiffel", function() {
+  function wordObj(words) {
+    var o = {};
+    for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
+    return o;
+  }
+  var keywords = wordObj([
+    'note',
+    'across',
+    'when',
+    'variant',
+    'until',
+    'unique',
+    'undefine',
+    'then',
+    'strip',
+    'select',
+    'retry',
+    'rescue',
+    'require',
+    'rename',
+    'reference',
+    'redefine',
+    'prefix',
+    'once',
+    'old',
+    'obsolete',
+    'loop',
+    'local',
+    'like',
+    'is',
+    'inspect',
+    'infix',
+    'include',
+    'if',
+    'frozen',
+    'from',
+    'external',
+    'export',
+    'ensure',
+    'end',
+    'elseif',
+    'else',
+    'do',
+    'creation',
+    'create',
+    'check',
+    'alias',
+    'agent',
+    'separate',
+    'invariant',
+    'inherit',
+    'indexing',
+    'feature',
+    'expanded',
+    'deferred',
+    'class',
+    'Void',
+    'True',
+    'Result',
+    'Precursor',
+    'False',
+    'Current',
+    'create',
+    'attached',
+    'detachable',
+    'as',
+    'and',
+    'implies',
+    'not',
+    'or'
+  ]);
+  var operators = wordObj([":=", "and then","and", "or","<<",">>"]);
+
+  function chain(newtok, stream, state) {
+    state.tokenize.push(newtok);
+    return newtok(stream, state);
+  }
+
+  function tokenBase(stream, state) {
+    if (stream.eatSpace()) return null;
+    var ch = stream.next();
+    if (ch == '"'||ch == "'") {
+      return chain(readQuoted(ch, "string"), stream, state);
+    } else if (ch == "-"&&stream.eat("-")) {
+      stream.skipToEnd();
+      return "comment";
+    } else if (ch == ":"&&stream.eat("=")) {
+      return "operator";
+    } else if (/[0-9]/.test(ch)) {
+      stream.eatWhile(/[xXbBCc0-9\.]/);
+      stream.eat(/[\?\!]/);
+      return "ident";
+    } else if (/[a-zA-Z_0-9]/.test(ch)) {
+      stream.eatWhile(/[a-zA-Z_0-9]/);
+      stream.eat(/[\?\!]/);
+      return "ident";
+    } else if (/[=+\-\/*^%<>~]/.test(ch)) {
+      stream.eatWhile(/[=+\-\/*^%<>~]/);
+      return "operator";
+    } else {
+      return null;
+    }
+  }
+
+  function readQuoted(quote, style,  unescaped) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && (unescaped || !escaped)) {
+          state.tokenize.pop();
+          break;
+        }
+        escaped = !escaped && ch == "%";
+      }
+      return style;
+    };
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: [tokenBase]};
+    },
+
+    token: function(stream, state) {
+      var style = state.tokenize[state.tokenize.length-1](stream, state);
+      if (style == "ident") {
+        var word = stream.current();
+        style = keywords.propertyIsEnumerable(stream.current()) ? "keyword"
+          : operators.propertyIsEnumerable(stream.current()) ? "operator"
+          : /^[A-Z][A-Z_0-9]*$/g.test(word) ? "tag"
+          : /^0[bB][0-1]+$/g.test(word) ? "number"
+          : /^0[cC][0-7]+$/g.test(word) ? "number"
+          : /^0[xX][a-fA-F0-9]+$/g.test(word) ? "number"
+          : /^([0-9]+\.[0-9]*)|([0-9]*\.[0-9]+)$/g.test(word) ? "number"
+          : /^[0-9]+$/g.test(word) ? "number"
+          : "variable";
+      }
+      return style;
+    },
+    lineComment: "--"
+  };
+});
+
+CodeMirror.defineMIME("text/x-eiffel", "eiffel");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/eiffel/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,429 @@
+<!doctype html>
+
+<title>CodeMirror: Eiffel mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/neat.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="eiffel.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .cm-s-default span.cm-arrow { color: red; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Eiffel</a>
+  </ul>
+</div>
+
+<article>
+<h2>Eiffel mode</h2>
+<form><textarea id="code" name="code">
+note
+    description: "[
+        Project-wide universal properties.
+        This class is an ancestor to all developer-written classes.
+        ANY may be customized for individual projects or teams.
+        ]"
+
+    library: "Free implementation of ELKS library"
+    status: "See notice at end of class."
+    legal: "See notice at end of class."
+    date: "$Date: 2013-01-25 11:49:00 -0800 (Fri, 25 Jan 2013) $"
+    revision: "$Revision: 712 $"
+
+class
+    ANY
+
+feature -- Customization
+
+feature -- Access
+
+    generator: STRING
+            -- Name of current object's generating class
+            -- (base class of the type of which it is a direct instance)
+        external
+            "built_in"
+        ensure
+            generator_not_void: Result /= Void
+            generator_not_empty: not Result.is_empty
+        end
+
+    generating_type: TYPE [detachable like Current]
+            -- Type of current object
+            -- (type of which it is a direct instance)
+        do
+            Result := {detachable like Current}
+        ensure
+            generating_type_not_void: Result /= Void
+        end
+
+feature -- Status report
+
+    conforms_to (other: ANY): BOOLEAN
+            -- Does type of current object conform to type
+            -- of `other' (as per Eiffel: The Language, chapter 13)?
+        require
+            other_not_void: other /= Void
+        external
+            "built_in"
+        end
+
+    same_type (other: ANY): BOOLEAN
+            -- Is type of current object identical to type of `other'?
+        require
+            other_not_void: other /= Void
+        external
+            "built_in"
+        ensure
+            definition: Result = (conforms_to (other) and
+                                        other.conforms_to (Current))
+        end
+
+feature -- Comparison
+
+    is_equal (other: like Current): BOOLEAN
+            -- Is `other' attached to an object considered
+            -- equal to current object?
+        require
+            other_not_void: other /= Void
+        external
+            "built_in"
+        ensure
+            symmetric: Result implies other ~ Current
+            consistent: standard_is_equal (other) implies Result
+        end
+
+    frozen standard_is_equal (other: like Current): BOOLEAN
+            -- Is `other' attached to an object of the same type
+            -- as current object, and field-by-field identical to it?
+        require
+            other_not_void: other /= Void
+        external
+            "built_in"
+        ensure
+            same_type: Result implies same_type (other)
+            symmetric: Result implies other.standard_is_equal (Current)
+        end
+
+    frozen equal (a: detachable ANY; b: like a): BOOLEAN
+            -- Are `a' and `b' either both void or attached
+            -- to objects considered equal?
+        do
+            if a = Void then
+                Result := b = Void
+            else
+                Result := b /= Void and then
+                            a.is_equal (b)
+            end
+        ensure
+            definition: Result = (a = Void and b = Void) or else
+                        ((a /= Void and b /= Void) and then
+                        a.is_equal (b))
+        end
+
+    frozen standard_equal (a: detachable ANY; b: like a): BOOLEAN
+            -- Are `a' and `b' either both void or attached to
+            -- field-by-field identical objects of the same type?
+            -- Always uses default object comparison criterion.
+        do
+            if a = Void then
+                Result := b = Void
+            else
+                Result := b /= Void and then
+                            a.standard_is_equal (b)
+            end
+        ensure
+            definition: Result = (a = Void and b = Void) or else
+                        ((a /= Void and b /= Void) and then
+                        a.standard_is_equal (b))
+        end
+
+    frozen is_deep_equal (other: like Current): BOOLEAN
+            -- Are `Current' and `other' attached to isomorphic object structures?
+        require
+            other_not_void: other /= Void
+        external
+            "built_in"
+        ensure
+            shallow_implies_deep: standard_is_equal (other) implies Result
+            same_type: Result implies same_type (other)
+            symmetric: Result implies other.is_deep_equal (Current)
+        end
+
+    frozen deep_equal (a: detachable ANY; b: like a): BOOLEAN
+            -- Are `a' and `b' either both void
+            -- or attached to isomorphic object structures?
+        do
+            if a = Void then
+                Result := b = Void
+            else
+                Result := b /= Void and then a.is_deep_equal (b)
+            end
+        ensure
+            shallow_implies_deep: standard_equal (a, b) implies Result
+            both_or_none_void: (a = Void) implies (Result = (b = Void))
+            same_type: (Result and (a /= Void)) implies (b /= Void and then a.same_type (b))
+            symmetric: Result implies deep_equal (b, a)
+        end
+
+feature -- Duplication
+
+    frozen twin: like Current
+            -- New object equal to `Current'
+            -- `twin' calls `copy'; to change copying/twinning semantics, redefine `copy'.
+        external
+            "built_in"
+        ensure
+            twin_not_void: Result /= Void
+            is_equal: Result ~ Current
+        end
+
+    copy (other: like Current)
+            -- Update current object using fields of object attached
+            -- to `other', so as to yield equal objects.
+        require
+            other_not_void: other /= Void
+            type_identity: same_type (other)
+        external
+            "built_in"
+        ensure
+            is_equal: Current ~ other
+        end
+
+    frozen standard_copy (other: like Current)
+            -- Copy every field of `other' onto corresponding field
+            -- of current object.
+        require
+            other_not_void: other /= Void
+            type_identity: same_type (other)
+        external
+            "built_in"
+        ensure
+            is_standard_equal: standard_is_equal (other)
+        end
+
+    frozen clone (other: detachable ANY): like other
+            -- Void if `other' is void; otherwise new object
+            -- equal to `other'
+            --
+            -- For non-void `other', `clone' calls `copy';
+            -- to change copying/cloning semantics, redefine `copy'.
+        obsolete
+            "Use `twin' instead."
+        do
+            if other /= Void then
+                Result := other.twin
+            end
+        ensure
+            equal: Result ~ other
+        end
+
+    frozen standard_clone (other: detachable ANY): like other
+            -- Void if `other' is void; otherwise new object
+            -- field-by-field identical to `other'.
+            -- Always uses default copying semantics.
+        obsolete
+            "Use `standard_twin' instead."
+        do
+            if other /= Void then
+                Result := other.standard_twin
+            end
+        ensure
+            equal: standard_equal (Result, other)
+        end
+
+    frozen standard_twin: like Current
+            -- New object field-by-field identical to `other'.
+            -- Always uses default copying semantics.
+        external
+            "built_in"
+        ensure
+            standard_twin_not_void: Result /= Void
+            equal: standard_equal (Result, Current)
+        end
+
+    frozen deep_twin: like Current
+            -- New object structure recursively duplicated from Current.
+        external
+            "built_in"
+        ensure
+            deep_twin_not_void: Result /= Void
+            deep_equal: deep_equal (Current, Result)
+        end
+
+    frozen deep_clone (other: detachable ANY): like other
+            -- Void if `other' is void: otherwise, new object structure
+            -- recursively duplicated from the one attached to `other'
+        obsolete
+            "Use `deep_twin' instead."
+        do
+            if other /= Void then
+                Result := other.deep_twin
+            end
+        ensure
+            deep_equal: deep_equal (other, Result)
+        end
+
+    frozen deep_copy (other: like Current)
+            -- Effect equivalent to that of:
+            --      `copy' (`other' . `deep_twin')
+        require
+            other_not_void: other /= Void
+        do
+            copy (other.deep_twin)
+        ensure
+            deep_equal: deep_equal (Current, other)
+        end
+
+feature {NONE} -- Retrieval
+
+    frozen internal_correct_mismatch
+            -- Called from runtime to perform a proper dynamic dispatch on `correct_mismatch'
+            -- from MISMATCH_CORRECTOR.
+        local
+            l_msg: STRING
+            l_exc: EXCEPTIONS
+        do
+            if attached {MISMATCH_CORRECTOR} Current as l_corrector then
+                l_corrector.correct_mismatch
+            else
+                create l_msg.make_from_string ("Mismatch: ")
+                create l_exc
+                l_msg.append (generating_type.name)
+                l_exc.raise_retrieval_exception (l_msg)
+            end
+        end
+
+feature -- Output
+
+    io: STD_FILES
+            -- Handle to standard file setup
+        once
+            create Result
+            Result.set_output_default
+        ensure
+            io_not_void: Result /= Void
+        end
+
+    out: STRING
+            -- New string containing terse printable representation
+            -- of current object
+        do
+            Result := tagged_out
+        ensure
+            out_not_void: Result /= Void
+        end
+
+    frozen tagged_out: STRING
+            -- New string containing terse printable representation
+            -- of current object
+        external
+            "built_in"
+        ensure
+            tagged_out_not_void: Result /= Void
+        end
+
+    print (o: detachable ANY)
+            -- Write terse external representation of `o'
+            -- on standard output.
+        do
+            if o /= Void then
+                io.put_string (o.out)
+            end
+        end
+
+feature -- Platform
+
+    Operating_environment: OPERATING_ENVIRONMENT
+            -- Objects available from the operating system
+        once
+            create Result
+        ensure
+            operating_environment_not_void: Result /= Void
+        end
+
+feature {NONE} -- Initialization
+
+    default_create
+            -- Process instances of classes with no creation clause.
+            -- (Default: do nothing.)
+        do
+        end
+
+feature -- Basic operations
+
+    default_rescue
+            -- Process exception for routines with no Rescue clause.
+            -- (Default: do nothing.)
+        do
+        end
+
+    frozen do_nothing
+            -- Execute a null action.
+        do
+        end
+
+    frozen default: detachable like Current
+            -- Default value of object's type
+        do
+        end
+
+    frozen default_pointer: POINTER
+            -- Default value of type `POINTER'
+            -- (Avoid the need to write `p'.`default' for
+            -- some `p' of type `POINTER'.)
+        do
+        ensure
+            -- Result = Result.default
+        end
+
+    frozen as_attached: attached like Current
+            -- Attached version of Current
+            -- (Can be used during transitional period to convert
+            -- non-void-safe classes to void-safe ones.)
+        do
+            Result := Current
+        end
+
+invariant
+    reflexive_equality: standard_is_equal (Current)
+    reflexive_conformance: conforms_to (Current)
+
+note
+    copyright: "Copyright (c) 1984-2012, Eiffel Software and others"
+    license:   "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
+    source: "[
+            Eiffel Software
+            5949 Hollister Ave., Goleta, CA 93117 USA
+            Telephone 805-685-1006, Fax 805-685-6869
+            Website http://www.eiffel.com
+            Customer support http://support.eiffel.com
+        ]"
+
+end
+
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/x-eiffel",
+        indentUnit: 4,
+        lineNumbers: true,
+        theme: "neat"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-eiffel</code>.</p>
+ 
+ <p> Created by <a href="https://github.com/ynh">YNH</a>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/elm/elm.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,245 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: http://codemirror.net/5/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.defineMode("elm", function() {
+
+    function switchState(source, setState, f)
+    {
+      setState(f);
+      return f(source, setState);
+    }
+
+    var lowerRE = /[a-z]/;
+    var upperRE = /[A-Z]/;
+    var innerRE = /[a-zA-Z0-9_]/;
+
+    var digitRE = /[0-9]/;
+    var hexRE = /[0-9A-Fa-f]/;
+    var symbolRE = /[-&*+.\\/<>=?^|:]/;
+    var specialRE = /[(),[\]{}]/;
+    var spacesRE = /[ \v\f]/; // newlines are handled in tokenizer
+
+    function normal()
+    {
+      return function(source, setState)
+      {
+        if (source.eatWhile(spacesRE))
+        {
+          return null;
+        }
+
+        var char = source.next();
+
+        if (specialRE.test(char))
+        {
+          return (char === '{' && source.eat('-'))
+            ? switchState(source, setState, chompMultiComment(1))
+            : (char === '[' && source.match('glsl|'))
+                ? switchState(source, setState, chompGlsl)
+                : 'builtin';
+        }
+
+        if (char === '\'')
+        {
+          return switchState(source, setState, chompChar);
+        }
+
+        if (char === '"')
+        {
+          return source.eat('"')
+            ? source.eat('"')
+                ? switchState(source, setState, chompMultiString)
+                : 'string'
+            : switchState(source, setState, chompSingleString);
+        }
+
+        if (upperRE.test(char))
+        {
+          source.eatWhile(innerRE);
+          return 'variable-2';
+        }
+
+        if (lowerRE.test(char))
+        {
+          var isDef = source.pos === 1;
+          source.eatWhile(innerRE);
+          return isDef ? "def" : "variable";
+        }
+
+        if (digitRE.test(char))
+        {
+          if (char === '0')
+          {
+            if (source.eat(/[xX]/))
+            {
+              source.eatWhile(hexRE); // should require at least 1
+              return "number";
+            }
+          }
+          else
+          {
+            source.eatWhile(digitRE);
+          }
+          if (source.eat('.'))
+          {
+            source.eatWhile(digitRE); // should require at least 1
+          }
+          if (source.eat(/[eE]/))
+          {
+            source.eat(/[-+]/);
+            source.eatWhile(digitRE); // should require at least 1
+          }
+          return "number";
+        }
+
+        if (symbolRE.test(char))
+        {
+          if (char === '-' && source.eat('-'))
+          {
+            source.skipToEnd();
+            return "comment";
+          }
+          source.eatWhile(symbolRE);
+          return "keyword";
+        }
+
+        if (char === '_')
+        {
+          return "keyword";
+        }
+
+        return "error";
+      }
+    }
+
+    function chompMultiComment(nest)
+    {
+      if (nest == 0)
+      {
+        return normal();
+      }
+      return function(source, setState)
+      {
+        while (!source.eol())
+        {
+          var char = source.next();
+          if (char == '{' && source.eat('-'))
+          {
+            ++nest;
+          }
+          else if (char == '-' && source.eat('}'))
+          {
+            --nest;
+            if (nest === 0)
+            {
+              setState(normal());
+              return 'comment';
+            }
+          }
+        }
+        setState(chompMultiComment(nest));
+        return 'comment';
+      }
+    }
+
+    function chompMultiString(source, setState)
+    {
+      while (!source.eol())
+      {
+        var char = source.next();
+        if (char === '"' && source.eat('"') && source.eat('"'))
+        {
+          setState(normal());
+          return 'string';
+        }
+      }
+      return 'string';
+    }
+
+    function chompSingleString(source, setState)
+    {
+      while (source.skipTo('\\"')) { source.next(); source.next(); }
+      if (source.skipTo('"'))
+      {
+        source.next();
+        setState(normal());
+        return 'string';
+      }
+      source.skipToEnd();
+      setState(normal());
+      return 'error';
+    }
+
+    function chompChar(source, setState)
+    {
+      while (source.skipTo("\\'")) { source.next(); source.next(); }
+      if (source.skipTo("'"))
+      {
+        source.next();
+        setState(normal());
+        return 'string';
+      }
+      source.skipToEnd();
+      setState(normal());
+      return 'error';
+    }
+
+    function chompGlsl(source, setState)
+    {
+      while (!source.eol())
+      {
+        var char = source.next();
+        if (char === '|' && source.eat(']'))
+        {
+          setState(normal());
+          return 'string';
+        }
+      }
+      return 'string';
+    }
+
+    var wellKnownWords = {
+      case: 1,
+      of: 1,
+      as: 1,
+      if: 1,
+      then: 1,
+      else: 1,
+      let: 1,
+      in: 1,
+      type: 1,
+      alias: 1,
+      module: 1,
+      where: 1,
+      import: 1,
+      exposing: 1,
+      port: 1
+    };
+
+    return {
+      startState: function ()  { return { f: normal() }; },
+      copyState:  function (s) { return { f: s.f }; },
+
+      lineComment: '--',
+
+      token: function(stream, state) {
+        var type = state.f(stream, function(s) { state.f = s; });
+        var word = stream.current();
+        return (wellKnownWords.hasOwnProperty(word)) ? 'keyword' : type;
+      }
+    };
+
+  });
+
+  CodeMirror.defineMIME("text/x-elm", "elm");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/elm/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: Elm mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="elm.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Elm</a>
+  </ul>
+</div>
+
+<article>
+<h2>Elm mode</h2>
+
+<div><textarea id="code" name="code">
+import Color exposing (..)
+import Graphics.Collage exposing (..)
+import Graphics.Element exposing (..)
+import Time exposing (..)
+
+main =
+  Signal.map clock (every second)
+
+clock t =
+  collage 400 400
+    [ filled    lightGrey   (ngon 12 110)
+    , outlined (solid grey) (ngon 12 110)
+    , hand orange   100  t
+    , hand charcoal 100 (t/60)
+    , hand charcoal 60  (t/720)
+    ]
+
+hand clr len time =
+  let angle = degrees (90 - 6 * inSeconds time)
+  in
+      segment (0,0) (fromPolar (len,angle))
+        |> traced (solid clr)
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "text/x-elm"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-elm</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/erlang/erlang.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,619 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*jshint unused:true, eqnull:true, curly:true, bitwise:true */
+/*jshint undef:true, latedef:true, trailing:true */
+/*global CodeMirror:true */
+
+// erlang mode.
+// tokenizer -> token types -> CodeMirror styles
+// tokenizer maintains a parse stack
+// indenter uses the parse stack
+
+// TODO indenter:
+//   bit syntax
+//   old guard/bif/conversion clashes (e.g. "float/1")
+//   type/spec/opaque
+
+(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.defineMIME("text/x-erlang", "erlang");
+
+CodeMirror.defineMode("erlang", function(cmCfg) {
+  "use strict";
+
+/////////////////////////////////////////////////////////////////////////////
+// constants
+
+  var typeWords = [
+    "-type", "-spec", "-export_type", "-opaque"];
+
+  var keywordWords = [
+    "after","begin","catch","case","cond","end","fun","if",
+    "let","of","query","receive","try","when"];
+
+  var separatorRE    = /[\->,;]/;
+  var separatorWords = [
+    "->",";",","];
+
+  var operatorAtomWords = [
+    "and","andalso","band","bnot","bor","bsl","bsr","bxor",
+    "div","not","or","orelse","rem","xor"];
+
+  var operatorSymbolRE    = /[\+\-\*\/<>=\|:!]/;
+  var operatorSymbolWords = [
+    "=","+","-","*","/",">",">=","<","=<","=:=","==","=/=","/=","||","<-","!"];
+
+  var openParenRE    = /[<\(\[\{]/;
+  var openParenWords = [
+    "<<","(","[","{"];
+
+  var closeParenRE    = /[>\)\]\}]/;
+  var closeParenWords = [
+    "}","]",")",">>"];
+
+  var guardWords = [
+    "is_atom","is_binary","is_bitstring","is_boolean","is_float",
+    "is_function","is_integer","is_list","is_number","is_pid",
+    "is_port","is_record","is_reference","is_tuple",
+    "atom","binary","bitstring","boolean","function","integer","list",
+    "number","pid","port","record","reference","tuple"];
+
+  var bifWords = [
+    "abs","adler32","adler32_combine","alive","apply","atom_to_binary",
+    "atom_to_list","binary_to_atom","binary_to_existing_atom",
+    "binary_to_list","binary_to_term","bit_size","bitstring_to_list",
+    "byte_size","check_process_code","contact_binary","crc32",
+    "crc32_combine","date","decode_packet","delete_module",
+    "disconnect_node","element","erase","exit","float","float_to_list",
+    "garbage_collect","get","get_keys","group_leader","halt","hd",
+    "integer_to_list","internal_bif","iolist_size","iolist_to_binary",
+    "is_alive","is_atom","is_binary","is_bitstring","is_boolean",
+    "is_float","is_function","is_integer","is_list","is_number","is_pid",
+    "is_port","is_process_alive","is_record","is_reference","is_tuple",
+    "length","link","list_to_atom","list_to_binary","list_to_bitstring",
+    "list_to_existing_atom","list_to_float","list_to_integer",
+    "list_to_pid","list_to_tuple","load_module","make_ref","module_loaded",
+    "monitor_node","node","node_link","node_unlink","nodes","notalive",
+    "now","open_port","pid_to_list","port_close","port_command",
+    "port_connect","port_control","pre_loaded","process_flag",
+    "process_info","processes","purge_module","put","register",
+    "registered","round","self","setelement","size","spawn","spawn_link",
+    "spawn_monitor","spawn_opt","split_binary","statistics",
+    "term_to_binary","time","throw","tl","trunc","tuple_size",
+    "tuple_to_list","unlink","unregister","whereis"];
+
+// upper case: [A-Z] [Ø-Þ] [À-Ö]
+// lower case: [a-z] [ß-ö] [ø-ÿ]
+  var anumRE       = /[\w@Ø-ÞÀ-Öß-öø-ÿ]/;
+  var escapesRE    =
+    /[0-7]{1,3}|[bdefnrstv\\"']|\^[a-zA-Z]|x[0-9a-zA-Z]{2}|x{[0-9a-zA-Z]+}/;
+
+/////////////////////////////////////////////////////////////////////////////
+// tokenizer
+
+  function tokenizer(stream,state) {
+    // in multi-line string
+    if (state.in_string) {
+      state.in_string = (!doubleQuote(stream));
+      return rval(state,stream,"string");
+    }
+
+    // in multi-line atom
+    if (state.in_atom) {
+      state.in_atom = (!singleQuote(stream));
+      return rval(state,stream,"atom");
+    }
+
+    // whitespace
+    if (stream.eatSpace()) {
+      return rval(state,stream,"whitespace");
+    }
+
+    // attributes and type specs
+    if (!peekToken(state) &&
+        stream.match(/-\s*[a-zß-öø-ÿ][\wØ-ÞÀ-Öß-öø-ÿ]*/)) {
+      if (is_member(stream.current(),typeWords)) {
+        return rval(state,stream,"type");
+      }else{
+        return rval(state,stream,"attribute");
+      }
+    }
+
+    var ch = stream.next();
+
+    // comment
+    if (ch == '%') {
+      stream.skipToEnd();
+      return rval(state,stream,"comment");
+    }
+
+    // colon
+    if (ch == ":") {
+      return rval(state,stream,"colon");
+    }
+
+    // macro
+    if (ch == '?') {
+      stream.eatSpace();
+      stream.eatWhile(anumRE);
+      return rval(state,stream,"macro");
+    }
+
+    // record
+    if (ch == "#") {
+      stream.eatSpace();
+      stream.eatWhile(anumRE);
+      return rval(state,stream,"record");
+    }
+
+    // dollar escape
+    if (ch == "$") {
+      if (stream.next() == "\\" && !stream.match(escapesRE)) {
+        return rval(state,stream,"error");
+      }
+      return rval(state,stream,"number");
+    }
+
+    // dot
+    if (ch == ".") {
+      return rval(state,stream,"dot");
+    }
+
+    // quoted atom
+    if (ch == '\'') {
+      if (!(state.in_atom = (!singleQuote(stream)))) {
+        if (stream.match(/\s*\/\s*[0-9]/,false)) {
+          stream.match(/\s*\/\s*[0-9]/,true);
+          return rval(state,stream,"fun");      // 'f'/0 style fun
+        }
+        if (stream.match(/\s*\(/,false) || stream.match(/\s*:/,false)) {
+          return rval(state,stream,"function");
+        }
+      }
+      return rval(state,stream,"atom");
+    }
+
+    // string
+    if (ch == '"') {
+      state.in_string = (!doubleQuote(stream));
+      return rval(state,stream,"string");
+    }
+
+    // variable
+    if (/[A-Z_Ø-ÞÀ-Ö]/.test(ch)) {
+      stream.eatWhile(anumRE);
+      return rval(state,stream,"variable");
+    }
+
+    // atom/keyword/BIF/function
+    if (/[a-z_ß-öø-ÿ]/.test(ch)) {
+      stream.eatWhile(anumRE);
+
+      if (stream.match(/\s*\/\s*[0-9]/,false)) {
+        stream.match(/\s*\/\s*[0-9]/,true);
+        return rval(state,stream,"fun");      // f/0 style fun
+      }
+
+      var w = stream.current();
+
+      if (is_member(w,keywordWords)) {
+        return rval(state,stream,"keyword");
+      }else if (is_member(w,operatorAtomWords)) {
+        return rval(state,stream,"operator");
+      }else if (stream.match(/\s*\(/,false)) {
+        // 'put' and 'erlang:put' are bifs, 'foo:put' is not
+        if (is_member(w,bifWords) &&
+            ((peekToken(state).token != ":") ||
+             (peekToken(state,2).token == "erlang"))) {
+          return rval(state,stream,"builtin");
+        }else if (is_member(w,guardWords)) {
+          return rval(state,stream,"guard");
+        }else{
+          return rval(state,stream,"function");
+        }
+      }else if (lookahead(stream) == ":") {
+        if (w == "erlang") {
+          return rval(state,stream,"builtin");
+        } else {
+          return rval(state,stream,"function");
+        }
+      }else if (is_member(w,["true","false"])) {
+        return rval(state,stream,"boolean");
+      }else{
+        return rval(state,stream,"atom");
+      }
+    }
+
+    // number
+    var digitRE      = /[0-9]/;
+    var radixRE      = /[0-9a-zA-Z]/;         // 36#zZ style int
+    if (digitRE.test(ch)) {
+      stream.eatWhile(digitRE);
+      if (stream.eat('#')) {                // 36#aZ  style integer
+        if (!stream.eatWhile(radixRE)) {
+          stream.backUp(1);                 //"36#" - syntax error
+        }
+      } else if (stream.eat('.')) {       // float
+        if (!stream.eatWhile(digitRE)) {
+          stream.backUp(1);        // "3." - probably end of function
+        } else {
+          if (stream.eat(/[eE]/)) {        // float with exponent
+            if (stream.eat(/[-+]/)) {
+              if (!stream.eatWhile(digitRE)) {
+                stream.backUp(2);            // "2e-" - syntax error
+              }
+            } else {
+              if (!stream.eatWhile(digitRE)) {
+                stream.backUp(1);            // "2e" - syntax error
+              }
+            }
+          }
+        }
+      }
+      return rval(state,stream,"number");   // normal integer
+    }
+
+    // open parens
+    if (nongreedy(stream,openParenRE,openParenWords)) {
+      return rval(state,stream,"open_paren");
+    }
+
+    // close parens
+    if (nongreedy(stream,closeParenRE,closeParenWords)) {
+      return rval(state,stream,"close_paren");
+    }
+
+    // separators
+    if (greedy(stream,separatorRE,separatorWords)) {
+      return rval(state,stream,"separator");
+    }
+
+    // operators
+    if (greedy(stream,operatorSymbolRE,operatorSymbolWords)) {
+      return rval(state,stream,"operator");
+    }
+
+    return rval(state,stream,null);
+  }
+
+/////////////////////////////////////////////////////////////////////////////
+// utilities
+  function nongreedy(stream,re,words) {
+    if (stream.current().length == 1 && re.test(stream.current())) {
+      stream.backUp(1);
+      while (re.test(stream.peek())) {
+        stream.next();
+        if (is_member(stream.current(),words)) {
+          return true;
+        }
+      }
+      stream.backUp(stream.current().length-1);
+    }
+    return false;
+  }
+
+  function greedy(stream,re,words) {
+    if (stream.current().length == 1 && re.test(stream.current())) {
+      while (re.test(stream.peek())) {
+        stream.next();
+      }
+      while (0 < stream.current().length) {
+        if (is_member(stream.current(),words)) {
+          return true;
+        }else{
+          stream.backUp(1);
+        }
+      }
+      stream.next();
+    }
+    return false;
+  }
+
+  function doubleQuote(stream) {
+    return quote(stream, '"', '\\');
+  }
+
+  function singleQuote(stream) {
+    return quote(stream,'\'','\\');
+  }
+
+  function quote(stream,quoteChar,escapeChar) {
+    while (!stream.eol()) {
+      var ch = stream.next();
+      if (ch == quoteChar) {
+        return true;
+      }else if (ch == escapeChar) {
+        stream.next();
+      }
+    }
+    return false;
+  }
+
+  function lookahead(stream) {
+    var m = stream.match(/^\s*([^\s%])/, false)
+    return m ? m[1] : "";
+  }
+
+  function is_member(element,list) {
+    return (-1 < list.indexOf(element));
+  }
+
+  function rval(state,stream,type) {
+
+    // parse stack
+    pushToken(state,realToken(type,stream));
+
+    // map erlang token type to CodeMirror style class
+    //     erlang             -> CodeMirror tag
+    switch (type) {
+      case "atom":        return "atom";
+      case "attribute":   return "attribute";
+      case "boolean":     return "atom";
+      case "builtin":     return "builtin";
+      case "close_paren": return null;
+      case "colon":       return null;
+      case "comment":     return "comment";
+      case "dot":         return null;
+      case "error":       return "error";
+      case "fun":         return "meta";
+      case "function":    return "tag";
+      case "guard":       return "property";
+      case "keyword":     return "keyword";
+      case "macro":       return "variable-2";
+      case "number":      return "number";
+      case "open_paren":  return null;
+      case "operator":    return "operator";
+      case "record":      return "bracket";
+      case "separator":   return null;
+      case "string":      return "string";
+      case "type":        return "def";
+      case "variable":    return "variable";
+      default:            return null;
+    }
+  }
+
+  function aToken(tok,col,ind,typ) {
+    return {token:  tok,
+            column: col,
+            indent: ind,
+            type:   typ};
+  }
+
+  function realToken(type,stream) {
+    return aToken(stream.current(),
+                 stream.column(),
+                 stream.indentation(),
+                 type);
+  }
+
+  function fakeToken(type) {
+    return aToken(type,0,0,type);
+  }
+
+  function peekToken(state,depth) {
+    var len = state.tokenStack.length;
+    var dep = (depth ? depth : 1);
+
+    if (len < dep) {
+      return false;
+    }else{
+      return state.tokenStack[len-dep];
+    }
+  }
+
+  function pushToken(state,token) {
+
+    if (!(token.type == "comment" || token.type == "whitespace")) {
+      state.tokenStack = maybe_drop_pre(state.tokenStack,token);
+      state.tokenStack = maybe_drop_post(state.tokenStack);
+    }
+  }
+
+  function maybe_drop_pre(s,token) {
+    var last = s.length-1;
+
+    if (0 < last && s[last].type === "record" && token.type === "dot") {
+      s.pop();
+    }else if (0 < last && s[last].type === "group") {
+      s.pop();
+      s.push(token);
+    }else{
+      s.push(token);
+    }
+    return s;
+  }
+
+  function maybe_drop_post(s) {
+    if (!s.length) return s
+    var last = s.length-1;
+
+    if (s[last].type === "dot") {
+      return [];
+    }
+    if (last > 1 && s[last].type === "fun" && s[last-1].token === "fun") {
+      return s.slice(0,last-1);
+    }
+    switch (s[last].token) {
+      case "}":    return d(s,{g:["{"]});
+      case "]":    return d(s,{i:["["]});
+      case ")":    return d(s,{i:["("]});
+      case ">>":   return d(s,{i:["<<"]});
+      case "end":  return d(s,{i:["begin","case","fun","if","receive","try"]});
+      case ",":    return d(s,{e:["begin","try","when","->",
+                                  ",","(","[","{","<<"]});
+      case "->":   return d(s,{r:["when"],
+                               m:["try","if","case","receive"]});
+      case ";":    return d(s,{E:["case","fun","if","receive","try","when"]});
+      case "catch":return d(s,{e:["try"]});
+      case "of":   return d(s,{e:["case"]});
+      case "after":return d(s,{e:["receive","try"]});
+      default:     return s;
+    }
+  }
+
+  function d(stack,tt) {
+    // stack is a stack of Token objects.
+    // tt is an object; {type:tokens}
+    // type is a char, tokens is a list of token strings.
+    // The function returns (possibly truncated) stack.
+    // It will descend the stack, looking for a Token such that Token.token
+    //  is a member of tokens. If it does not find that, it will normally (but
+    //  see "E" below) return stack. If it does find a match, it will remove
+    //  all the Tokens between the top and the matched Token.
+    // If type is "m", that is all it does.
+    // If type is "i", it will also remove the matched Token and the top Token.
+    // If type is "g", like "i", but add a fake "group" token at the top.
+    // If type is "r", it will remove the matched Token, but not the top Token.
+    // If type is "e", it will keep the matched Token but not the top Token.
+    // If type is "E", it behaves as for type "e", except if there is no match,
+    //  in which case it will return an empty stack.
+
+    for (var type in tt) {
+      var len = stack.length-1;
+      var tokens = tt[type];
+      for (var i = len-1; -1 < i ; i--) {
+        if (is_member(stack[i].token,tokens)) {
+          var ss = stack.slice(0,i);
+          switch (type) {
+              case "m": return ss.concat(stack[i]).concat(stack[len]);
+              case "r": return ss.concat(stack[len]);
+              case "i": return ss;
+              case "g": return ss.concat(fakeToken("group"));
+              case "E": return ss.concat(stack[i]);
+              case "e": return ss.concat(stack[i]);
+          }
+        }
+      }
+    }
+    return (type == "E" ? [] : stack);
+  }
+
+/////////////////////////////////////////////////////////////////////////////
+// indenter
+
+  function indenter(state,textAfter) {
+    var t;
+    var unit = cmCfg.indentUnit;
+    var wordAfter = wordafter(textAfter);
+    var currT = peekToken(state,1);
+    var prevT = peekToken(state,2);
+
+    if (state.in_string || state.in_atom) {
+      return CodeMirror.Pass;
+    }else if (!prevT) {
+      return 0;
+    }else if (currT.token == "when") {
+      return currT.column+unit;
+    }else if (wordAfter === "when" && prevT.type === "function") {
+      return prevT.indent+unit;
+    }else if (wordAfter === "(" && currT.token === "fun") {
+      return  currT.column+3;
+    }else if (wordAfter === "catch" && (t = getToken(state,["try"]))) {
+      return t.column;
+    }else if (is_member(wordAfter,["end","after","of"])) {
+      t = getToken(state,["begin","case","fun","if","receive","try"]);
+      return t ? t.column : CodeMirror.Pass;
+    }else if (is_member(wordAfter,closeParenWords)) {
+      t = getToken(state,openParenWords);
+      return t ? t.column : CodeMirror.Pass;
+    }else if (is_member(currT.token,[",","|","||"]) ||
+              is_member(wordAfter,[",","|","||"])) {
+      t = postcommaToken(state);
+      return t ? t.column+t.token.length : unit;
+    }else if (currT.token == "->") {
+      if (is_member(prevT.token, ["receive","case","if","try"])) {
+        return prevT.column+unit+unit;
+      }else{
+        return prevT.column+unit;
+      }
+    }else if (is_member(currT.token,openParenWords)) {
+      return currT.column+currT.token.length;
+    }else{
+      t = defaultToken(state);
+      return truthy(t) ? t.column+unit : 0;
+    }
+  }
+
+  function wordafter(str) {
+    var m = str.match(/,|[a-z]+|\}|\]|\)|>>|\|+|\(/);
+
+    return truthy(m) && (m.index === 0) ? m[0] : "";
+  }
+
+  function postcommaToken(state) {
+    var objs = state.tokenStack.slice(0,-1);
+    var i = getTokenIndex(objs,"type",["open_paren"]);
+
+    return truthy(objs[i]) ? objs[i] : false;
+  }
+
+  function defaultToken(state) {
+    var objs = state.tokenStack;
+    var stop = getTokenIndex(objs,"type",["open_paren","separator","keyword"]);
+    var oper = getTokenIndex(objs,"type",["operator"]);
+
+    if (truthy(stop) && truthy(oper) && stop < oper) {
+      return objs[stop+1];
+    } else if (truthy(stop)) {
+      return objs[stop];
+    } else {
+      return false;
+    }
+  }
+
+  function getToken(state,tokens) {
+    var objs = state.tokenStack;
+    var i = getTokenIndex(objs,"token",tokens);
+
+    return truthy(objs[i]) ? objs[i] : false;
+  }
+
+  function getTokenIndex(objs,propname,propvals) {
+
+    for (var i = objs.length-1; -1 < i ; i--) {
+      if (is_member(objs[i][propname],propvals)) {
+        return i;
+      }
+    }
+    return false;
+  }
+
+  function truthy(x) {
+    return (x !== false) && (x != null);
+  }
+
+/////////////////////////////////////////////////////////////////////////////
+// this object defines the mode
+
+  return {
+    startState:
+      function() {
+        return {tokenStack: [],
+                in_string:  false,
+                in_atom:    false};
+      },
+
+    token:
+      function(stream, state) {
+        return tokenizer(stream, state);
+      },
+
+    indent:
+      function(state, textAfter) {
+        return indenter(state,textAfter);
+      },
+
+    lineComment: "%"
+  };
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/erlang/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,76 @@
+<!doctype html>
+
+<title>CodeMirror: Erlang mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/erlang-dark.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="erlang.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Erlang</a>
+  </ul>
+</div>
+
+<article>
+<h2>Erlang mode</h2>
+<form><textarea id="code" name="code">
+%% -*- mode: erlang; erlang-indent-level: 2 -*-
+%%% Created :  7 May 2012 by mats cronqvist <masse@klarna.com>
+
+%% @doc
+%% Demonstrates how to print a record.
+%% @end
+
+-module('ex').
+-author('mats cronqvist').
+-export([demo/0,
+         rec_info/1]).
+
+-record(demo,{a="One",b="Two",c="Three",d="Four"}).
+
+rec_info(demo) -> record_info(fields,demo).
+
+demo() -> expand_recs(?MODULE,#demo{a="A",b="BB"}).
+
+expand_recs(M,List) when is_list(List) ->
+  [expand_recs(M,L)||L<-List];
+expand_recs(M,Tup) when is_tuple(Tup) ->
+  case tuple_size(Tup) of
+    L when L < 1 -> Tup;
+    L ->
+      try
+        Fields = M:rec_info(element(1,Tup)),
+        L = length(Fields)+1,
+        lists:zip(Fields,expand_recs(M,tl(tuple_to_list(Tup))))
+      catch
+        _:_ -> list_to_tuple(expand_recs(M,tuple_to_list(Tup)))
+      end
+  end;
+expand_recs(_,Term) ->
+  Term.
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        extraKeys: {"Tab":  "indentAuto"},
+        theme: "erlang-dark"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-erlang</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/factor/factor.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Factor syntax highlight - simple mode
+//
+// by Dimage Sapelkin (https://github.com/kerabromsmu)
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineSimpleMode("factor", {
+    // The start state contains the rules that are initially used
+    start: [
+      // comments
+      {regex: /#?!.*/, token: "comment"},
+      // strings """, multiline --> state
+      {regex: /"""/, token: "string", next: "string3"},
+      {regex: /(STRING:)(\s)/, token: ["keyword", null], next: "string2"},
+      {regex: /\S*?"/, token: "string", next: "string"},
+      // numbers: dec, hex, unicode, bin, fractional, complex
+      {regex: /(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\-?\d+.?\d*)(?=\s)/, token: "number"},
+      //{regex: /[+-]?/} //fractional
+      // definition: defining word, defined word, etc
+      {regex: /((?:GENERIC)|\:?\:)(\s+)(\S+)(\s+)(\()/, token: ["keyword", null, "def", null, "bracket"], next: "stack"},
+      // method definition: defining word, type, defined word, etc
+      {regex: /(M\:)(\s+)(\S+)(\s+)(\S+)/, token: ["keyword", null, "def", null, "tag"]},
+      // vocabulary using --> state
+      {regex: /USING\:/, token: "keyword", next: "vocabulary"},
+      // vocabulary definition/use
+      {regex: /(USE\:|IN\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "tag"]},
+      // definition: a defining word, defined word
+      {regex: /(\S+\:)(\s+)(\S+)(?=\s|$)/, token: ["keyword", null, "def"]},
+      // "keywords", incl. ; t f . [ ] { } defining words
+      {regex: /(?:;|\\|t|f|if|loop|while|until|do|PRIVATE>|<PRIVATE|\.|\S*\[|\]|\S*\{|\})(?=\s|$)/, token: "keyword"},
+      // <constructors> and the like
+      {regex: /\S+[\)>\.\*\?]+(?=\s|$)/, token: "builtin"},
+      {regex: /[\)><]+\S+(?=\s|$)/, token: "builtin"},
+      // operators
+      {regex: /(?:[\+\-\=\/\*<>])(?=\s|$)/, token: "keyword"},
+      // any id (?)
+      {regex: /\S+/, token: "variable"},
+      {regex: /\s+|./, token: null}
+    ],
+    vocabulary: [
+      {regex: /;/, token: "keyword", next: "start"},
+      {regex: /\S+/, token: "tag"},
+      {regex: /\s+|./, token: null}
+    ],
+    string: [
+      {regex: /(?:[^\\]|\\.)*?"/, token: "string", next: "start"},
+      {regex: /.*/, token: "string"}
+    ],
+    string2: [
+      {regex: /^;/, token: "keyword", next: "start"},
+      {regex: /.*/, token: "string"}
+    ],
+    string3: [
+      {regex: /(?:[^\\]|\\.)*?"""/, token: "string", next: "start"},
+      {regex: /.*/, token: "string"}
+    ],
+    stack: [
+      {regex: /\)/, token: "bracket", next: "start"},
+      {regex: /--/, token: "bracket"},
+      {regex: /\S+/, token: "meta"},
+      {regex: /\s+|./, token: null}
+    ],
+    // The meta property contains global information about the mode. It
+    // can contain properties like lineComment, which are supported by
+    // all modes, and also directives like dontIndentStates, which are
+    // specific to simple modes.
+    meta: {
+      dontIndentStates: ["start", "vocabulary", "string", "string3", "stack"],
+      lineComment: "!"
+    }
+  });
+
+  CodeMirror.defineMIME("text/x-factor", "factor");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/factor/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,77 @@
+<!doctype html>
+
+<title>CodeMirror: Factor mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="factor.js"></script>
+<style>
+.CodeMirror {
+    font-family: 'Droid Sans Mono', monospace;
+    font-size: 14px;
+}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Factor</a>
+  </ul>
+</div>
+
+<article>
+
+<h2>Factor mode</h2>
+
+<form><textarea id="code" name="code">
+! Copyright (C) 2008 Slava Pestov.
+! See http://factorcode.org/license.txt for BSD license.
+
+! A simple time server
+
+USING: accessors calendar calendar.format io io.encodings.ascii
+io.servers kernel threads ;
+IN: time-server
+
+: handle-time-client ( -- )
+    now timestamp>rfc822 print ;
+
+: <time-server> ( -- threaded-server )
+    ascii <threaded-server>
+        "time-server" >>name
+        1234 >>insecure
+        [ handle-time-client ] >>handler ;
+
+: start-time-server ( -- )
+    <time-server> start-server drop ;
+
+MAIN: start-time-server
+</textarea>
+  </form>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    lineWrapping: true,
+    indentUnit: 2,
+    tabSize: 2,
+    autofocus: true,
+    mode: "text/x-factor"
+  });
+</script>
+<p/>
+<p>Simple mode that handles Factor Syntax (<a href="http://en.wikipedia.org/wiki/Factor_(programming_language)">Factor on Wikipedia</a>).</p>
+
+<p><strong>MIME types defined:</strong> <code>text/x-factor</code>.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/fcl/fcl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,173 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("fcl", function(config) {
+  var indentUnit = config.indentUnit;
+
+  var keywords = {
+      "term": true,
+      "method": true, "accu": true,
+      "rule": true, "then": true, "is": true, "and": true, "or": true,
+      "if": true, "default": true
+  };
+
+  var start_blocks = {
+      "var_input": true,
+      "var_output": true,
+      "fuzzify": true,
+      "defuzzify": true,
+      "function_block": true,
+      "ruleblock": true
+  };
+
+  var end_blocks = {
+      "end_ruleblock": true,
+      "end_defuzzify": true,
+      "end_function_block": true,
+      "end_fuzzify": true,
+      "end_var": true
+  };
+
+  var atoms = {
+      "true": true, "false": true, "nan": true,
+      "real": true, "min": true, "max": true, "cog": true, "cogs": true
+  };
+
+  var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+
+    if (/[\d\.]/.test(ch)) {
+      if (ch == ".") {
+        stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
+      } else if (ch == "0") {
+        stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
+      } else {
+        stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
+      }
+      return "number";
+    }
+
+    if (ch == "/" || ch == "(") {
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+
+    var cur = stream.current().toLowerCase();
+    if (keywords.propertyIsEnumerable(cur) ||
+        start_blocks.propertyIsEnumerable(cur) ||
+        end_blocks.propertyIsEnumerable(cur)) {
+      return "keyword";
+    }
+    if (atoms.propertyIsEnumerable(cur)) return "atom";
+    return "variable";
+  }
+
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if ((ch == "/" || ch == ")") && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function Context(indented, column, type, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.align = align;
+    this.prev = prev;
+  }
+
+  function pushContext(state, col, type) {
+    return state.context = new Context(state.indented, col, type, null, state.context);
+  }
+
+  function popContext(state) {
+    if (!state.context.prev) return;
+    var t = state.context.type;
+    if (t == "end_block")
+      state.indented = state.context.indented;
+    return state.context = state.context.prev;
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+        indented: 0,
+        startOfLine: true
+      };
+    },
+
+    token: function(stream, state) {
+        var ctx = state.context;
+        if (stream.sol()) {
+            if (ctx.align == null) ctx.align = false;
+            state.indented = stream.indentation();
+            state.startOfLine = true;
+        }
+        if (stream.eatSpace()) return null;
+
+        var style = (state.tokenize || tokenBase)(stream, state);
+        if (style == "comment") return style;
+        if (ctx.align == null) ctx.align = true;
+
+        var cur = stream.current().toLowerCase();
+
+        if (start_blocks.propertyIsEnumerable(cur)) pushContext(state, stream.column(), "end_block");
+        else if (end_blocks.propertyIsEnumerable(cur))  popContext(state);
+
+        state.startOfLine = false;
+        return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null) return 0;
+      var ctx = state.context;
+
+      var closing = end_blocks.propertyIsEnumerable(textAfter);
+      if (ctx.align) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: "ryk",
+    fold: "brace",
+    blockCommentStart: "(*",
+    blockCommentEnd: "*)",
+    lineComment: "//"
+  };
+});
+
+CodeMirror.defineMIME("text/x-fcl", "fcl");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/fcl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,108 @@
+<!doctype html>
+
+<title>CodeMirror: FCL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="fcl.js"></script>
+<style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">FCL</a>
+  </ul>
+</div>
+
+<article>
+<h2>FCL mode</h2>
+<form><textarea id="code" name="code">
+  FUNCTION_BLOCK Fuzzy_FB
+      VAR_INPUT
+          TimeDay : REAL; (* RANGE(0 .. 23) *)
+          ApplicateHost: REAL;
+          TimeConfiguration: REAL;
+          TimeRequirements: REAL;
+      END_VAR
+
+      VAR_OUTPUT
+          ProbabilityDistribution: REAL;
+          ProbabilityAccess: REAL;
+      END_VAR
+
+      FUZZIFY TimeDay
+          TERM inside := (0, 0) (8, 1) (22,0);
+          TERM outside := (0, 1) (8, 0) (22, 1);
+      END_FUZZIFY
+
+      FUZZIFY ApplicateHost
+          TERM few := (0, 1) (100, 0) (200, 0);
+          TERM many := (0, 0) (100, 0) (200, 1);
+      END_FUZZIFY
+
+      FUZZIFY TimeConfiguration
+          TERM recently := (0, 1) (30, 1) (120, 0);
+          TERM long := (0, 0) (30, 0) (120, 1);
+      END_FUZZIFY
+
+      FUZZIFY TimeRequirements
+          TERM recently := (0, 1) (30, 1) (365, 0);
+          TERM long := (0, 0) (30, 0) (365, 1);
+      END_FUZZIFY
+
+      DEFUZZIFY ProbabilityAccess
+          TERM height := 1;
+          TERM medium := 0.5;
+          TERM low := 0;
+          ACCU: MAX;
+          METHOD: COGS;
+          DEFAULT := 0;
+      END_DEFUZZIFY
+
+      DEFUZZIFY ProbabilityDistribution
+          TERM height := 1;
+          TERM medium := 0.5;
+          TERM low := 0;
+          ACCU: MAX;
+          METHOD: COGS;
+          DEFAULT := 0;
+      END_DEFUZZIFY
+
+      RULEBLOCK No1
+          AND : MIN;
+          RULE 1 : IF TimeDay IS outside AND ApplicateHost IS few THEN ProbabilityAccess IS height;
+          RULE 2 : IF ApplicateHost IS many THEN ProbabilityAccess IS height;
+          RULE 3 : IF TimeDay IS inside AND ApplicateHost IS few THEN ProbabilityAccess IS low;
+      END_RULEBLOCK
+
+      RULEBLOCK No2
+          AND : MIN;
+          RULE 1 : IF ApplicateHost IS many THEN ProbabilityDistribution IS height;
+      END_RULEBLOCK
+
+  END_FUNCTION_BLOCK
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        theme: "elegant",
+        matchBrackets: true,
+        indentUnit: 8,
+        tabSize: 8,
+        indentWithTabs: true,
+        mode: "text/x-fcl"
+      });
+    </script>
+
+    <p><strong>MIME type:</strong> <code>text/x-fcl</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/forth/forth.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,180 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Author: Aliaksei Chapyzhenka
+
+(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";
+
+  function toWordList(words) {
+    var ret = [];
+    words.split(' ').forEach(function(e){
+      ret.push({name: e});
+    });
+    return ret;
+  }
+
+  var coreWordList = toWordList(
+'INVERT AND OR XOR\
+ 2* 2/ LSHIFT RSHIFT\
+ 0= = 0< < > U< MIN MAX\
+ 2DROP 2DUP 2OVER 2SWAP ?DUP DEPTH DROP DUP OVER ROT SWAP\
+ >R R> R@\
+ + - 1+ 1- ABS NEGATE\
+ S>D * M* UM*\
+ FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD\
+ HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2!\
+ ALIGN ALIGNED +! ALLOT\
+ CHAR [CHAR] [ ] BL\
+ FIND EXECUTE IMMEDIATE COUNT LITERAL STATE\
+ ; DOES> >BODY\
+ EVALUATE\
+ SOURCE >IN\
+ <# # #S #> HOLD SIGN BASE >NUMBER HEX DECIMAL\
+ FILL MOVE\
+ . CR EMIT SPACE SPACES TYPE U. .R U.R\
+ ACCEPT\
+ TRUE FALSE\
+ <> U> 0<> 0>\
+ NIP TUCK ROLL PICK\
+ 2>R 2R@ 2R>\
+ WITHIN UNUSED MARKER\
+ I J\
+ TO\
+ COMPILE, [COMPILE]\
+ SAVE-INPUT RESTORE-INPUT\
+ PAD ERASE\
+ 2LITERAL DNEGATE\
+ D- D+ D0< D0= D2* D2/ D< D= DMAX DMIN D>S DABS\
+ M+ M*/ D. D.R 2ROT DU<\
+ CATCH THROW\
+ FREE RESIZE ALLOCATE\
+ CS-PICK CS-ROLL\
+ GET-CURRENT SET-CURRENT FORTH-WORDLIST GET-ORDER SET-ORDER\
+ PREVIOUS SEARCH-WORDLIST WORDLIST FIND ALSO ONLY FORTH DEFINITIONS ORDER\
+ -TRAILING /STRING SEARCH COMPARE CMOVE CMOVE> BLANK SLITERAL');
+
+  var immediateWordList = toWordList('IF ELSE THEN BEGIN WHILE REPEAT UNTIL RECURSE [IF] [ELSE] [THEN] ?DO DO LOOP +LOOP UNLOOP LEAVE EXIT AGAIN CASE OF ENDOF ENDCASE');
+
+  CodeMirror.defineMode('forth', function() {
+    function searchWordList (wordList, word) {
+      var i;
+      for (i = wordList.length - 1; i >= 0; i--) {
+        if (wordList[i].name === word.toUpperCase()) {
+          return wordList[i];
+        }
+      }
+      return undefined;
+    }
+  return {
+    startState: function() {
+      return {
+        state: '',
+        base: 10,
+        coreWordList: coreWordList,
+        immediateWordList: immediateWordList,
+        wordList: []
+      };
+    },
+    token: function (stream, stt) {
+      var mat;
+      if (stream.eatSpace()) {
+        return null;
+      }
+      if (stt.state === '') { // interpretation
+        if (stream.match(/^(\]|:NONAME)(\s|$)/i)) {
+          stt.state = ' compilation';
+          return 'builtin compilation';
+        }
+        mat = stream.match(/^(\:)\s+(\S+)(\s|$)+/);
+        if (mat) {
+          stt.wordList.push({name: mat[2].toUpperCase()});
+          stt.state = ' compilation';
+          return 'def' + stt.state;
+        }
+        mat = stream.match(/^(VARIABLE|2VARIABLE|CONSTANT|2CONSTANT|CREATE|POSTPONE|VALUE|WORD)\s+(\S+)(\s|$)+/i);
+        if (mat) {
+          stt.wordList.push({name: mat[2].toUpperCase()});
+          return 'def' + stt.state;
+        }
+        mat = stream.match(/^(\'|\[\'\])\s+(\S+)(\s|$)+/);
+        if (mat) {
+          return 'builtin' + stt.state;
+        }
+        } else { // compilation
+        // ; [
+        if (stream.match(/^(\;|\[)(\s)/)) {
+          stt.state = '';
+          stream.backUp(1);
+          return 'builtin compilation';
+        }
+        if (stream.match(/^(\;|\[)($)/)) {
+          stt.state = '';
+          return 'builtin compilation';
+        }
+        if (stream.match(/^(POSTPONE)\s+\S+(\s|$)+/)) {
+          return 'builtin';
+        }
+      }
+
+      // dynamic wordlist
+      mat = stream.match(/^(\S+)(\s+|$)/);
+      if (mat) {
+        if (searchWordList(stt.wordList, mat[1]) !== undefined) {
+          return 'variable' + stt.state;
+        }
+
+        // comments
+        if (mat[1] === '\\') {
+          stream.skipToEnd();
+            return 'comment' + stt.state;
+          }
+
+          // core words
+          if (searchWordList(stt.coreWordList, mat[1]) !== undefined) {
+            return 'builtin' + stt.state;
+          }
+          if (searchWordList(stt.immediateWordList, mat[1]) !== undefined) {
+            return 'keyword' + stt.state;
+          }
+
+          if (mat[1] === '(') {
+            stream.eatWhile(function (s) { return s !== ')'; });
+            stream.eat(')');
+            return 'comment' + stt.state;
+          }
+
+          // // strings
+          if (mat[1] === '.(') {
+            stream.eatWhile(function (s) { return s !== ')'; });
+            stream.eat(')');
+            return 'string' + stt.state;
+          }
+          if (mat[1] === 'S"' || mat[1] === '."' || mat[1] === 'C"') {
+            stream.eatWhile(function (s) { return s !== '"'; });
+            stream.eat('"');
+            return 'string' + stt.state;
+          }
+
+          // numbers
+          if (mat[1] - 0xfffffffff) {
+            return 'number' + stt.state;
+          }
+          // if (mat[1].match(/^[-+]?[0-9]+\.[0-9]*/)) {
+          //     return 'number' + stt.state;
+          // }
+
+          return 'atom' + stt.state;
+        }
+      }
+    };
+  });
+  CodeMirror.defineMIME("text/x-forth", "forth");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/forth/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,75 @@
+<!doctype html>
+
+<title>CodeMirror: Forth mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link href='http://fonts.googleapis.com/css?family=Droid+Sans+Mono' rel='stylesheet' type='text/css'>
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel=stylesheet href="../../theme/colorforth.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="forth.js"></script>
+<style>
+.CodeMirror {
+    font-family: 'Droid Sans Mono', monospace;
+    font-size: 14px;
+}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Forth</a>
+  </ul>
+</div>
+
+<article>
+
+<h2>Forth mode</h2>
+
+<form><textarea id="code" name="code">
+\ Insertion sort
+
+: cell-  1 cells - ;
+
+: insert ( start end -- start )
+  dup @ >r ( r: v )
+  begin
+    2dup <
+  while
+    r@ over cell- @ <
+  while
+    cell-
+    dup @ over cell+ !
+  repeat then
+  r> swap ! ;
+
+: sort ( array len -- )
+  1 ?do
+    dup i cells + insert
+  loop drop ;</textarea>
+  </form>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    lineWrapping: true,
+    indentUnit: 2,
+    tabSize: 2,
+    autofocus: true,
+    theme: "colorforth",
+    mode: "text/x-forth"
+  });
+</script>
+
+<p>Simple mode that handle Forth-Syntax (<a href="http://en.wikipedia.org/wiki/Forth_%28programming_language%29">Forth on Wikipedia</a>).</p>
+
+<p><strong>MIME types defined:</strong> <code>text/x-forth</code>.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/fortran/fortran.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,188 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("fortran", function() {
+  function words(array) {
+    var keys = {};
+    for (var i = 0; i < array.length; ++i) {
+      keys[array[i]] = true;
+    }
+    return keys;
+  }
+
+  var keywords = words([
+                  "abstract", "accept", "allocatable", "allocate",
+                  "array", "assign", "asynchronous", "backspace",
+                  "bind", "block", "byte", "call", "case",
+                  "class", "close", "common", "contains",
+                  "continue", "cycle", "data", "deallocate",
+                  "decode", "deferred", "dimension", "do",
+                  "elemental", "else", "encode", "end",
+                  "endif", "entry", "enumerator", "equivalence",
+                  "exit", "external", "extrinsic", "final",
+                  "forall", "format", "function", "generic",
+                  "go", "goto", "if", "implicit", "import", "include",
+                  "inquire", "intent", "interface", "intrinsic",
+                  "module", "namelist", "non_intrinsic",
+                  "non_overridable", "none", "nopass",
+                  "nullify", "open", "optional", "options",
+                  "parameter", "pass", "pause", "pointer",
+                  "print", "private", "program", "protected",
+                  "public", "pure", "read", "recursive", "result",
+                  "return", "rewind", "save", "select", "sequence",
+                  "stop", "subroutine", "target", "then", "to", "type",
+                  "use", "value", "volatile", "where", "while",
+                  "write"]);
+  var builtins = words(["abort", "abs", "access", "achar", "acos",
+                          "adjustl", "adjustr", "aimag", "aint", "alarm",
+                          "all", "allocated", "alog", "amax", "amin",
+                          "amod", "and", "anint", "any", "asin",
+                          "associated", "atan", "besj", "besjn", "besy",
+                          "besyn", "bit_size", "btest", "cabs", "ccos",
+                          "ceiling", "cexp", "char", "chdir", "chmod",
+                          "clog", "cmplx", "command_argument_count",
+                          "complex", "conjg", "cos", "cosh", "count",
+                          "cpu_time", "cshift", "csin", "csqrt", "ctime",
+                          "c_funloc", "c_loc", "c_associated", "c_null_ptr",
+                          "c_null_funptr", "c_f_pointer", "c_null_char",
+                          "c_alert", "c_backspace", "c_form_feed",
+                          "c_new_line", "c_carriage_return",
+                          "c_horizontal_tab", "c_vertical_tab", "dabs",
+                          "dacos", "dasin", "datan", "date_and_time",
+                          "dbesj", "dbesj", "dbesjn", "dbesy", "dbesy",
+                          "dbesyn", "dble", "dcos", "dcosh", "ddim", "derf",
+                          "derfc", "dexp", "digits", "dim", "dint", "dlog",
+                          "dlog", "dmax", "dmin", "dmod", "dnint",
+                          "dot_product", "dprod", "dsign", "dsinh",
+                          "dsin", "dsqrt", "dtanh", "dtan", "dtime",
+                          "eoshift", "epsilon", "erf", "erfc", "etime",
+                          "exit", "exp", "exponent", "extends_type_of",
+                          "fdate", "fget", "fgetc", "float", "floor",
+                          "flush", "fnum", "fputc", "fput", "fraction",
+                          "fseek", "fstat", "ftell", "gerror", "getarg",
+                          "get_command", "get_command_argument",
+                          "get_environment_variable", "getcwd",
+                          "getenv", "getgid", "getlog", "getpid",
+                          "getuid", "gmtime", "hostnm", "huge", "iabs",
+                          "iachar", "iand", "iargc", "ibclr", "ibits",
+                          "ibset", "ichar", "idate", "idim", "idint",
+                          "idnint", "ieor", "ierrno", "ifix", "imag",
+                          "imagpart", "index", "int", "ior", "irand",
+                          "isatty", "ishft", "ishftc", "isign",
+                          "iso_c_binding", "is_iostat_end", "is_iostat_eor",
+                          "itime", "kill", "kind", "lbound", "len", "len_trim",
+                          "lge", "lgt", "link", "lle", "llt", "lnblnk", "loc",
+                          "log", "logical", "long", "lshift", "lstat", "ltime",
+                          "matmul", "max", "maxexponent", "maxloc", "maxval",
+                          "mclock", "merge", "move_alloc", "min", "minexponent",
+                          "minloc", "minval", "mod", "modulo", "mvbits",
+                          "nearest", "new_line", "nint", "not", "or", "pack",
+                          "perror", "precision", "present", "product", "radix",
+                          "rand", "random_number", "random_seed", "range",
+                          "real", "realpart", "rename", "repeat", "reshape",
+                          "rrspacing", "rshift", "same_type_as", "scale",
+                          "scan", "second", "selected_int_kind",
+                          "selected_real_kind", "set_exponent", "shape",
+                          "short", "sign", "signal", "sinh", "sin", "sleep",
+                          "sngl", "spacing", "spread", "sqrt", "srand", "stat",
+                          "sum", "symlnk", "system", "system_clock", "tan",
+                          "tanh", "time", "tiny", "transfer", "transpose",
+                          "trim", "ttynam", "ubound", "umask", "unlink",
+                          "unpack", "verify", "xor", "zabs", "zcos", "zexp",
+                          "zlog", "zsin", "zsqrt"]);
+
+    var dataTypes =  words(["c_bool", "c_char", "c_double", "c_double_complex",
+                     "c_float", "c_float_complex", "c_funptr", "c_int",
+                     "c_int16_t", "c_int32_t", "c_int64_t", "c_int8_t",
+                     "c_int_fast16_t", "c_int_fast32_t", "c_int_fast64_t",
+                     "c_int_fast8_t", "c_int_least16_t", "c_int_least32_t",
+                     "c_int_least64_t", "c_int_least8_t", "c_intmax_t",
+                     "c_intptr_t", "c_long", "c_long_double",
+                     "c_long_double_complex", "c_long_long", "c_ptr",
+                     "c_short", "c_signed_char", "c_size_t", "character",
+                     "complex", "double", "integer", "logical", "real"]);
+  var isOperatorChar = /[+\-*&=<>\/\:]/;
+  var litOperator = /^\.(and|or|eq|lt|le|gt|ge|ne|not|eqv|neqv)\./i;
+
+  function tokenBase(stream, state) {
+
+    if (stream.match(litOperator)){
+        return 'operator';
+    }
+
+    var ch = stream.next();
+    if (ch == "!") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    if (ch == '"' || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (/[\[\]\(\),]/.test(ch)) {
+      return null;
+    }
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      return "number";
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_]/);
+    var word = stream.current().toLowerCase();
+
+    if (keywords.hasOwnProperty(word)){
+            return 'keyword';
+    }
+    if (builtins.hasOwnProperty(word) || dataTypes.hasOwnProperty(word)) {
+            return 'builtin';
+    }
+    return "variable";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {
+            end = true;
+            break;
+        }
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !escaped) state.tokenize = null;
+      return "string";
+    };
+  }
+
+  // Interface
+
+  return {
+    startState: function() {
+      return {tokenize: null};
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta") return style;
+      return style;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-fortran", "fortran");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/fortran/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,81 @@
+<!doctype html>
+
+<title>CodeMirror: Fortran mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="fortran.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Fortran</a>
+  </ul>
+</div>
+
+<article>
+<h2>Fortran mode</h2>
+
+
+<div><textarea id="code" name="code">
+! Example Fortran code
+  program average
+
+  ! Read in some numbers and take the average
+  ! As written, if there are no data points, an average of zero is returned
+  ! While this may not be desired behavior, it keeps this example simple
+
+  implicit none
+
+  real, dimension(:), allocatable :: points
+  integer                         :: number_of_points
+  real                            :: average_points=0., positive_average=0., negative_average=0.
+
+  write (*,*) "Input number of points to average:"
+  read  (*,*) number_of_points
+
+  allocate (points(number_of_points))
+
+  write (*,*) "Enter the points to average:"
+  read  (*,*) points
+
+  ! Take the average by summing points and dividing by number_of_points
+  if (number_of_points > 0) average_points = sum(points) / number_of_points
+
+  ! Now form average over positive and negative points only
+  if (count(points > 0.) > 0) then
+     positive_average = sum(points, points > 0.) / count(points > 0.)
+  end if
+
+  if (count(points < 0.) > 0) then
+     negative_average = sum(points, points < 0.) / count(points < 0.)
+  end if
+
+  deallocate (points)
+
+  ! Print result to terminal
+  write (*,'(a,g12.4)') 'Average = ', average_points
+  write (*,'(a,g12.4)') 'Average of positive points = ', positive_average
+  write (*,'(a,g12.4)') 'Average of negative points = ', negative_average
+
+  end program average
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "text/x-fortran"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-fortran</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gas/gas.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,353 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("gas", function(_config, parserConfig) {
+  'use strict';
+
+  // If an architecture is specified, its initialization function may
+  // populate this array with custom parsing functions which will be
+  // tried in the event that the standard functions do not find a match.
+  var custom = [];
+
+  // The symbol used to start a line comment changes based on the target
+  // architecture.
+  // If no architecture is pased in "parserConfig" then only multiline
+  // comments will have syntax support.
+  var lineCommentStartSymbol = "";
+
+  // These directives are architecture independent.
+  // Machine specific directives should go in their respective
+  // architecture initialization function.
+  // Reference:
+  // http://sourceware.org/binutils/docs/as/Pseudo-Ops.html#Pseudo-Ops
+  var directives = {
+    ".abort" : "builtin",
+    ".align" : "builtin",
+    ".altmacro" : "builtin",
+    ".ascii" : "builtin",
+    ".asciz" : "builtin",
+    ".balign" : "builtin",
+    ".balignw" : "builtin",
+    ".balignl" : "builtin",
+    ".bundle_align_mode" : "builtin",
+    ".bundle_lock" : "builtin",
+    ".bundle_unlock" : "builtin",
+    ".byte" : "builtin",
+    ".cfi_startproc" : "builtin",
+    ".comm" : "builtin",
+    ".data" : "builtin",
+    ".def" : "builtin",
+    ".desc" : "builtin",
+    ".dim" : "builtin",
+    ".double" : "builtin",
+    ".eject" : "builtin",
+    ".else" : "builtin",
+    ".elseif" : "builtin",
+    ".end" : "builtin",
+    ".endef" : "builtin",
+    ".endfunc" : "builtin",
+    ".endif" : "builtin",
+    ".equ" : "builtin",
+    ".equiv" : "builtin",
+    ".eqv" : "builtin",
+    ".err" : "builtin",
+    ".error" : "builtin",
+    ".exitm" : "builtin",
+    ".extern" : "builtin",
+    ".fail" : "builtin",
+    ".file" : "builtin",
+    ".fill" : "builtin",
+    ".float" : "builtin",
+    ".func" : "builtin",
+    ".global" : "builtin",
+    ".gnu_attribute" : "builtin",
+    ".hidden" : "builtin",
+    ".hword" : "builtin",
+    ".ident" : "builtin",
+    ".if" : "builtin",
+    ".incbin" : "builtin",
+    ".include" : "builtin",
+    ".int" : "builtin",
+    ".internal" : "builtin",
+    ".irp" : "builtin",
+    ".irpc" : "builtin",
+    ".lcomm" : "builtin",
+    ".lflags" : "builtin",
+    ".line" : "builtin",
+    ".linkonce" : "builtin",
+    ".list" : "builtin",
+    ".ln" : "builtin",
+    ".loc" : "builtin",
+    ".loc_mark_labels" : "builtin",
+    ".local" : "builtin",
+    ".long" : "builtin",
+    ".macro" : "builtin",
+    ".mri" : "builtin",
+    ".noaltmacro" : "builtin",
+    ".nolist" : "builtin",
+    ".octa" : "builtin",
+    ".offset" : "builtin",
+    ".org" : "builtin",
+    ".p2align" : "builtin",
+    ".popsection" : "builtin",
+    ".previous" : "builtin",
+    ".print" : "builtin",
+    ".protected" : "builtin",
+    ".psize" : "builtin",
+    ".purgem" : "builtin",
+    ".pushsection" : "builtin",
+    ".quad" : "builtin",
+    ".reloc" : "builtin",
+    ".rept" : "builtin",
+    ".sbttl" : "builtin",
+    ".scl" : "builtin",
+    ".section" : "builtin",
+    ".set" : "builtin",
+    ".short" : "builtin",
+    ".single" : "builtin",
+    ".size" : "builtin",
+    ".skip" : "builtin",
+    ".sleb128" : "builtin",
+    ".space" : "builtin",
+    ".stab" : "builtin",
+    ".string" : "builtin",
+    ".struct" : "builtin",
+    ".subsection" : "builtin",
+    ".symver" : "builtin",
+    ".tag" : "builtin",
+    ".text" : "builtin",
+    ".title" : "builtin",
+    ".type" : "builtin",
+    ".uleb128" : "builtin",
+    ".val" : "builtin",
+    ".version" : "builtin",
+    ".vtable_entry" : "builtin",
+    ".vtable_inherit" : "builtin",
+    ".warning" : "builtin",
+    ".weak" : "builtin",
+    ".weakref" : "builtin",
+    ".word" : "builtin"
+  };
+
+  var registers = {};
+
+  function x86(_parserConfig) {
+    lineCommentStartSymbol = "#";
+
+    registers.al  = "variable";
+    registers.ah  = "variable";
+    registers.ax  = "variable";
+    registers.eax = "variable-2";
+    registers.rax = "variable-3";
+
+    registers.bl  = "variable";
+    registers.bh  = "variable";
+    registers.bx  = "variable";
+    registers.ebx = "variable-2";
+    registers.rbx = "variable-3";
+
+    registers.cl  = "variable";
+    registers.ch  = "variable";
+    registers.cx  = "variable";
+    registers.ecx = "variable-2";
+    registers.rcx = "variable-3";
+
+    registers.dl  = "variable";
+    registers.dh  = "variable";
+    registers.dx  = "variable";
+    registers.edx = "variable-2";
+    registers.rdx = "variable-3";
+
+    registers.si  = "variable";
+    registers.esi = "variable-2";
+    registers.rsi = "variable-3";
+
+    registers.di  = "variable";
+    registers.edi = "variable-2";
+    registers.rdi = "variable-3";
+
+    registers.sp  = "variable";
+    registers.esp = "variable-2";
+    registers.rsp = "variable-3";
+
+    registers.bp  = "variable";
+    registers.ebp = "variable-2";
+    registers.rbp = "variable-3";
+
+    registers.ip  = "variable";
+    registers.eip = "variable-2";
+    registers.rip = "variable-3";
+
+    registers.cs  = "keyword";
+    registers.ds  = "keyword";
+    registers.ss  = "keyword";
+    registers.es  = "keyword";
+    registers.fs  = "keyword";
+    registers.gs  = "keyword";
+  }
+
+  function armv6(_parserConfig) {
+    // Reference:
+    // http://infocenter.arm.com/help/topic/com.arm.doc.qrc0001l/QRC0001_UAL.pdf
+    // http://infocenter.arm.com/help/topic/com.arm.doc.ddi0301h/DDI0301H_arm1176jzfs_r0p7_trm.pdf
+    lineCommentStartSymbol = "@";
+    directives.syntax = "builtin";
+
+    registers.r0  = "variable";
+    registers.r1  = "variable";
+    registers.r2  = "variable";
+    registers.r3  = "variable";
+    registers.r4  = "variable";
+    registers.r5  = "variable";
+    registers.r6  = "variable";
+    registers.r7  = "variable";
+    registers.r8  = "variable";
+    registers.r9  = "variable";
+    registers.r10 = "variable";
+    registers.r11 = "variable";
+    registers.r12 = "variable";
+
+    registers.sp  = "variable-2";
+    registers.lr  = "variable-2";
+    registers.pc  = "variable-2";
+    registers.r13 = registers.sp;
+    registers.r14 = registers.lr;
+    registers.r15 = registers.pc;
+
+    custom.push(function(ch, stream) {
+      if (ch === '#') {
+        stream.eatWhile(/\w/);
+        return "number";
+      }
+    });
+  }
+
+  var arch = (parserConfig.architecture || "x86").toLowerCase();
+  if (arch === "x86") {
+    x86(parserConfig);
+  } else if (arch === "arm" || arch === "armv6") {
+    armv6(parserConfig);
+  }
+
+  function nextUntilUnescaped(stream, end) {
+    var escaped = false, next;
+    while ((next = stream.next()) != null) {
+      if (next === end && !escaped) {
+        return false;
+      }
+      escaped = !escaped && next === "\\";
+    }
+    return escaped;
+  }
+
+  function clikeComment(stream, state) {
+    var maybeEnd = false, ch;
+    while ((ch = stream.next()) != null) {
+      if (ch === "/" && maybeEnd) {
+        state.tokenize = null;
+        break;
+      }
+      maybeEnd = (ch === "*");
+    }
+    return "comment";
+  }
+
+  return {
+    startState: function() {
+      return {
+        tokenize: null
+      };
+    },
+
+    token: function(stream, state) {
+      if (state.tokenize) {
+        return state.tokenize(stream, state);
+      }
+
+      if (stream.eatSpace()) {
+        return null;
+      }
+
+      var style, cur, ch = stream.next();
+
+      if (ch === "/") {
+        if (stream.eat("*")) {
+          state.tokenize = clikeComment;
+          return clikeComment(stream, state);
+        }
+      }
+
+      if (ch === lineCommentStartSymbol) {
+        stream.skipToEnd();
+        return "comment";
+      }
+
+      if (ch === '"') {
+        nextUntilUnescaped(stream, '"');
+        return "string";
+      }
+
+      if (ch === '.') {
+        stream.eatWhile(/\w/);
+        cur = stream.current().toLowerCase();
+        style = directives[cur];
+        return style || null;
+      }
+
+      if (ch === '=') {
+        stream.eatWhile(/\w/);
+        return "tag";
+      }
+
+      if (ch === '{') {
+        return "bracket";
+      }
+
+      if (ch === '}') {
+        return "bracket";
+      }
+
+      if (/\d/.test(ch)) {
+        if (ch === "0" && stream.eat("x")) {
+          stream.eatWhile(/[0-9a-fA-F]/);
+          return "number";
+        }
+        stream.eatWhile(/\d/);
+        return "number";
+      }
+
+      if (/\w/.test(ch)) {
+        stream.eatWhile(/\w/);
+        if (stream.eat(":")) {
+          return 'tag';
+        }
+        cur = stream.current().toLowerCase();
+        style = registers[cur];
+        return style || null;
+      }
+
+      for (var i = 0; i < custom.length; i++) {
+        style = custom[i](ch, stream, state);
+        if (style) {
+          return style;
+        }
+      }
+    },
+
+    lineComment: lineCommentStartSymbol,
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/"
+  };
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gas/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,68 @@
+<!doctype html>
+
+<title>CodeMirror: Gas mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="gas.js"></script>
+<style>.CodeMirror {border: 2px inset #dee;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Gas</a>
+  </ul>
+</div>
+
+<article>
+<h2>Gas mode</h2>
+<form>
+<textarea id="code" name="code">
+.syntax unified
+.global main
+
+/* 
+ *  A
+ *  multi-line
+ *  comment.
+ */
+
+@ A single line comment.
+
+main:
+        push    {sp, lr}
+        ldr     r0, =message
+        bl      puts
+        mov     r0, #0
+        pop     {sp, pc}
+
+message:
+        .asciz "Hello world!<br />"
+</textarea>
+        </form>
+
+        <script>
+            var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+                lineNumbers: true,
+                mode: {name: "gas", architecture: "ARMv6"},
+            });
+        </script>
+
+        <p>Handles AT&amp;T assembler syntax (more specifically this handles
+        the GNU Assembler (gas) syntax.)
+        It takes a single optional configuration parameter:
+        <code>architecture</code>, which can be one of <code>"ARM"</code>,
+        <code>"ARMv6"</code> or <code>"x86"</code>.
+        Including the parameter adds syntax for the registers and special
+        directives for the supplied architecture.
+
+        <p><strong>MIME types defined:</strong> <code>text/x-gas</code></p>
+    </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gfm/gfm.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,129 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../markdown/markdown"), require("../../addon/mode/overlay"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../markdown/markdown", "../../addon/mode/overlay"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i
+
+CodeMirror.defineMode("gfm", function(config, modeConfig) {
+  var codeDepth = 0;
+  function blankLine(state) {
+    state.code = false;
+    return null;
+  }
+  var gfmOverlay = {
+    startState: function() {
+      return {
+        code: false,
+        codeBlock: false,
+        ateSpace: false
+      };
+    },
+    copyState: function(s) {
+      return {
+        code: s.code,
+        codeBlock: s.codeBlock,
+        ateSpace: s.ateSpace
+      };
+    },
+    token: function(stream, state) {
+      state.combineTokens = null;
+
+      // Hack to prevent formatting override inside code blocks (block and inline)
+      if (state.codeBlock) {
+        if (stream.match(/^```+/)) {
+          state.codeBlock = false;
+          return null;
+        }
+        stream.skipToEnd();
+        return null;
+      }
+      if (stream.sol()) {
+        state.code = false;
+      }
+      if (stream.sol() && stream.match(/^```+/)) {
+        stream.skipToEnd();
+        state.codeBlock = true;
+        return null;
+      }
+      // If this block is changed, it may need to be updated in Markdown mode
+      if (stream.peek() === '`') {
+        stream.next();
+        var before = stream.pos;
+        stream.eatWhile('`');
+        var difference = 1 + stream.pos - before;
+        if (!state.code) {
+          codeDepth = difference;
+          state.code = true;
+        } else {
+          if (difference === codeDepth) { // Must be exact
+            state.code = false;
+          }
+        }
+        return null;
+      } else if (state.code) {
+        stream.next();
+        return null;
+      }
+      // Check if space. If so, links can be formatted later on
+      if (stream.eatSpace()) {
+        state.ateSpace = true;
+        return null;
+      }
+      if (stream.sol() || state.ateSpace) {
+        state.ateSpace = false;
+        if (modeConfig.gitHubSpice !== false) {
+          if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/)) {
+            // User/Project@SHA
+            // User@SHA
+            // SHA
+            state.combineTokens = true;
+            return "link";
+          } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
+            // User/Project#Num
+            // User#Num
+            // #Num
+            state.combineTokens = true;
+            return "link";
+          }
+        }
+      }
+      if (stream.match(urlRE) &&
+          stream.string.slice(stream.start - 2, stream.start) != "](" &&
+          (stream.start == 0 || /\W/.test(stream.string.charAt(stream.start - 1)))) {
+        // URLs
+        // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
+        // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
+        // And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL
+        state.combineTokens = true;
+        return "link";
+      }
+      stream.next();
+      return null;
+    },
+    blankLine: blankLine
+  };
+
+  var markdownConfig = {
+    taskLists: true,
+    strikethrough: true,
+    emoji: true
+  };
+  for (var attr in modeConfig) {
+    markdownConfig[attr] = modeConfig[attr];
+  }
+  markdownConfig.name = "markdown";
+  return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);
+
+}, "markdown");
+
+  CodeMirror.defineMIME("text/x-gfm", "gfm");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gfm/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,136 @@
+<!doctype html>
+
+<title>CodeMirror: GFM mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../markdown/markdown.js"></script>
+<script src="gfm.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../clike/clike.js"></script>
+<script src="../meta.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+  .cm-s-default .cm-emoji {color: #009688;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">GFM</a>
+  </ul>
+</div>
+
+<article>
+<h2>GFM mode</h2>
+<form><textarea id="code" name="code">
+GitHub Flavored Markdown
+========================
+
+Everything from markdown plus GFM features:
+
+## URL autolinking
+
+Underscores_are_allowed_between_words.
+
+## Strikethrough text
+
+GFM adds syntax to strikethrough text, which is missing from standard Markdown.
+
+~~Mistaken text.~~
+~~**works with other formatting**~~
+
+~~spans across
+lines~~
+
+## Fenced code blocks (and syntax highlighting)
+
+```javascript
+for (var i = 0; i &lt; items.length; i++) {
+    console.log(items[i], i); // log them
+}
+```
+
+## Task Lists
+
+- [ ] Incomplete task list item
+- [x] **Completed** task list item
+
+## A bit of GitHub spice
+
+See http://github.github.com/github-flavored-markdown/.
+
+(Set `gitHubSpice: false` in mode options to disable):
+
+* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* \#Num: #1
+* User/#Num: mojombo#1
+* User/Project#Num: mojombo/god#1
+
+(Set `emoji: false` in mode options to disable):
+
+* emoji: :smile:
+
+
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {
+          name: "gfm",
+          tokenTypeOverrides: {
+            emoji: "emoji"
+          }
+        },
+        lineNumbers: true,
+        theme: "default"
+      });
+    </script>
+
+    <p>Optionally depends on other modes for properly highlighted code blocks.</p>
+
+    <p>Gfm mode supports these options (apart those from base Markdown mode):</p>
+    <ul>
+      <li>
+        <d1>
+          <dt><code>gitHubSpice: boolean</code></dt>
+          <dd>Hashes, issues... (default: <code>true</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>taskLists: boolean</code></dt>
+          <dd><code>- [ ]</code> syntax (default: <code>true</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>strikethrough: boolean</code></dt>
+          <dd><code>~~foo~~</code> syntax (default: <code>true</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>emoji: boolean</code></dt>
+          <dd><code>:emoji:</code> syntax (default: <code>true</code>).</dd>
+        </d1>
+      </li>
+    </ul>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#gfm_*">normal</a>,  <a href="../../test/index.html#verbose,gfm_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gfm/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,198 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var config = {tabSize: 4, indentUnit: 2}
+  var mode = CodeMirror.getMode(config, "gfm");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+  var modeHighlightFormatting = CodeMirror.getMode(config, {name: "gfm", highlightFormatting: true});
+  function FT(name) { test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); }
+
+  FT("codeBackticks",
+     "[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]");
+
+  FT("doubleBackticks",
+     "[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]");
+
+  FT("taskList",
+     "[variable-2&formatting&formatting-list&formatting-list-ul - ][meta&formatting&formatting-task [ ]]][variable-2  foo]",
+     "[variable-2&formatting&formatting-list&formatting-list-ul - ][property&formatting&formatting-task [x]]][variable-2  foo]");
+
+  FT("formatting_strikethrough",
+     "[strikethrough&formatting&formatting-strikethrough ~~][strikethrough foo][strikethrough&formatting&formatting-strikethrough ~~]");
+
+  FT("formatting_strikethrough",
+     "foo [strikethrough&formatting&formatting-strikethrough ~~][strikethrough bar][strikethrough&formatting&formatting-strikethrough ~~]");
+
+  FT("formatting_emoji",
+     "foo [builtin&formatting&formatting-emoji :smile:] foo");
+
+  MT("emInWordAsterisk",
+     "foo[em *bar*]hello");
+
+  MT("emInWordUnderscore",
+     "foo_bar_hello");
+
+  MT("emStrongUnderscore",
+     "[em&strong ___foo___] bar");
+
+  MT("taskListAsterisk",
+     "[variable-2 * ][link&variable-2 [[]]][variable-2 foo]", // Invalid; must have space or x between []
+     "[variable-2 * ][link&variable-2 [[ ]]][variable-2 bar]", // Invalid; must have space after ]
+     "[variable-2 * ][link&variable-2 [[x]]][variable-2 hello]", // Invalid; must have space after ]
+     "[variable-2 * ][meta [ ]]][variable-2  ][link&variable-2 [[world]]]", // Valid; tests reference style links
+     "    [variable-3 * ][property [x]]][variable-3  foo]"); // Valid; can be nested
+
+  MT("taskListPlus",
+     "[variable-2 + ][link&variable-2 [[]]][variable-2 foo]", // Invalid; must have space or x between []
+     "[variable-2 + ][link&variable-2 [[x]]][variable-2 hello]", // Invalid; must have space after ]
+     "[variable-2 + ][meta [ ]]][variable-2  ][link&variable-2 [[world]]]", // Valid; tests reference style links
+     "    [variable-3 + ][property [x]]][variable-3  foo]"); // Valid; can be nested
+
+  MT("taskListDash",
+     "[variable-2 - ][link&variable-2 [[]]][variable-2 foo]", // Invalid; must have space or x between []
+     "[variable-2 - ][link&variable-2 [[x]]][variable-2 hello]", // Invalid; must have space after ]
+     "[variable-2 - ][meta [ ]]][variable-2  world]", // Valid; tests reference style links
+     "    [variable-3 - ][property [x]]][variable-3  foo]"); // Valid; can be nested
+
+  MT("taskListNumber",
+     "[variable-2 1. ][link&variable-2 [[]]][variable-2 foo]", // Invalid; must have space or x between []
+     "[variable-2 2. ][link&variable-2 [[ ]]][variable-2 bar]", // Invalid; must have space after ]
+     "[variable-2 3. ][meta [ ]]][variable-2  world]", // Valid; tests reference style links
+     "    [variable-3 1. ][property [x]]][variable-3  foo]"); // Valid; can be nested
+
+  MT("SHA",
+     "foo [link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] bar");
+
+  MT("SHAEmphasis",
+     "[em *foo ][em&link be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]");
+
+  MT("shortSHA",
+     "foo [link be6a8cc] bar");
+
+  MT("tooShortSHA",
+     "foo be6a8c bar");
+
+  MT("longSHA",
+     "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd22 bar");
+
+  MT("badSHA",
+     "foo be6a8cc1c1ecfe9489fb51e4869af15a13fc2cg2 bar");
+
+  MT("userSHA",
+     "foo [link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] hello");
+
+  MT("userSHAEmphasis",
+     "[em *foo ][em&link bar@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]");
+
+  MT("userProjectSHA",
+     "foo [link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2] world");
+
+  MT("userProjectSHAEmphasis",
+     "[em *foo ][em&link bar/hello@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2][em *]");
+
+  MT("wordSHA",
+     "ask for feedback")
+
+  MT("num",
+     "foo [link #1] bar");
+
+  MT("numEmphasis",
+     "[em *foo ][em&link #1][em *]");
+
+  MT("badNum",
+     "foo #1bar hello");
+
+  MT("userNum",
+     "foo [link bar#1] hello");
+
+  MT("userNumEmphasis",
+     "[em *foo ][em&link bar#1][em *]");
+
+  MT("userProjectNum",
+     "foo [link bar/hello#1] world");
+
+  MT("userProjectNumEmphasis",
+     "[em *foo ][em&link bar/hello#1][em *]");
+
+  MT("vanillaLink",
+     "foo [link http://www.example.com/] bar");
+
+  MT("vanillaLinkNoScheme",
+     "foo [link www.example.com] bar");
+
+  MT("vanillaLinkHttps",
+     "foo [link https://www.example.com/] bar");
+
+  MT("vanillaLinkDataSchema",
+     "foo [link data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==] bar");
+
+  MT("vanillaLinkPunctuation",
+     "foo [link http://www.example.com/]. bar");
+
+  MT("vanillaLinkExtension",
+     "foo [link http://www.example.com/index.html] bar");
+
+  MT("vanillaLinkEmphasis",
+     "foo [em *][em&link http://www.example.com/index.html][em *] bar");
+
+  MT("notALink",
+     "foo asfd:asdf bar");
+
+  MT("notALink",
+     "[comment ``foo `bar` http://www.example.com/``] hello");
+
+  MT("notALink",
+     "[comment `foo]",
+     "[comment&link http://www.example.com/]",
+     "[comment `] foo",
+     "",
+     "[link http://www.example.com/]");
+
+  MT("strikethrough",
+     "[strikethrough ~~foo~~]");
+
+  MT("strikethroughWithStartingSpace",
+     "~~ foo~~");
+
+  MT("strikethroughUnclosedStrayTildes",
+    "[strikethrough ~~foo~~~]");
+
+  MT("strikethroughUnclosedStrayTildes",
+     "[strikethrough ~~foo ~~]");
+
+  MT("strikethroughUnclosedStrayTildes",
+    "[strikethrough ~~foo ~~ bar]");
+
+  MT("strikethroughUnclosedStrayTildes",
+    "[strikethrough ~~foo ~~ bar~~]hello");
+
+  MT("strikethroughOneLetter",
+     "[strikethrough ~~a~~]");
+
+  MT("strikethroughWrapped",
+     "[strikethrough ~~foo]",
+     "[strikethrough foo~~]");
+
+  MT("strikethroughParagraph",
+     "[strikethrough ~~foo]",
+     "",
+     "foo[strikethrough ~~bar]");
+
+  MT("strikethroughEm",
+     "[strikethrough ~~foo][em&strikethrough *bar*][strikethrough ~~]");
+
+  MT("strikethroughEm",
+     "[em *][em&strikethrough ~~foo~~][em *]");
+
+  MT("strikethroughStrong",
+     "[strikethrough ~~][strong&strikethrough **foo**][strikethrough ~~]");
+
+  MT("strikethroughStrong",
+     "[strong **][strong&strikethrough ~~foo~~][strong **]");
+
+  MT("emoji",
+     "text [builtin :blush:] text [builtin :v:] text [builtin :+1:] text",
+     ":text text: [builtin :smiley_cat:]");
+
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gherkin/gherkin.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,178 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+Gherkin mode - http://www.cukes.info/
+Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues
+*/
+
+// Following Objs from Brackets implementation: https://github.com/tregusti/brackets-gherkin/blob/master/main.js
+//var Quotes = {
+//  SINGLE: 1,
+//  DOUBLE: 2
+//};
+
+//var regex = {
+//  keywords: /(Feature| {2}(Scenario|In order to|As|I)| {4}(Given|When|Then|And))/
+//};
+
+(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.defineMode("gherkin", function () {
+  return {
+    startState: function () {
+      return {
+        lineNumber: 0,
+        tableHeaderLine: false,
+        allowFeature: true,
+        allowBackground: false,
+        allowScenario: false,
+        allowSteps: false,
+        allowPlaceholders: false,
+        allowMultilineArgument: false,
+        inMultilineString: false,
+        inMultilineTable: false,
+        inKeywordLine: false
+      };
+    },
+    token: function (stream, state) {
+      if (stream.sol()) {
+        state.lineNumber++;
+        state.inKeywordLine = false;
+        if (state.inMultilineTable) {
+            state.tableHeaderLine = false;
+            if (!stream.match(/\s*\|/, false)) {
+              state.allowMultilineArgument = false;
+              state.inMultilineTable = false;
+            }
+        }
+      }
+
+      stream.eatSpace();
+
+      if (state.allowMultilineArgument) {
+
+        // STRING
+        if (state.inMultilineString) {
+          if (stream.match('"""')) {
+            state.inMultilineString = false;
+            state.allowMultilineArgument = false;
+          } else {
+            stream.match(/.*/);
+          }
+          return "string";
+        }
+
+        // TABLE
+        if (state.inMultilineTable) {
+          if (stream.match(/\|\s*/)) {
+            return "bracket";
+          } else {
+            stream.match(/[^\|]*/);
+            return state.tableHeaderLine ? "header" : "string";
+          }
+        }
+
+        // DETECT START
+        if (stream.match('"""')) {
+          // String
+          state.inMultilineString = true;
+          return "string";
+        } else if (stream.match("|")) {
+          // Table
+          state.inMultilineTable = true;
+          state.tableHeaderLine = true;
+          return "bracket";
+        }
+
+      }
+
+      // LINE COMMENT
+      if (stream.match(/#.*/)) {
+        return "comment";
+
+      // TAG
+      } else if (!state.inKeywordLine && stream.match(/@\S+/)) {
+        return "tag";
+
+      // FEATURE
+      } else if (!state.inKeywordLine && state.allowFeature && stream.match(/(機能|功能|フィーチャ|기능|โครงหลัก|ความสามารถ|ความต้องการทางธุรกิจ|ಹೆಚ್ಚಳ|గుణము|ਮੁਹਾਂਦਰਾ|ਨਕਸ਼ ਨੁਹਾਰ|ਖਾਸੀਅਤ|रूप लेख|وِیژگی|خاصية|תכונה|Функціонал|Функция|Функционалност|Функционал|Үзенчәлеклелек|Свойство|Особина|Мөмкинлек|Могућност|Λειτουργία|Δυνατότητα|Właściwość|Vlastnosť|Trajto|Tính năng|Savybė|Pretty much|Požiadavka|Požadavek|Potrzeba biznesowa|Özellik|Osobina|Ominaisuus|Omadus|OH HAI|Mogućnost|Mogucnost|Jellemző|Hwæt|Hwaet|Funzionalità|Funktionalitéit|Funktionalität|Funkcja|Funkcionalnost|Funkcionalitāte|Funkcia|Fungsi|Functionaliteit|Funcționalitate|Funcţionalitate|Functionalitate|Funcionalitat|Funcionalidade|Fonctionnalité|Fitur|Fīča|Feature|Eiginleiki|Egenskap|Egenskab|Característica|Caracteristica|Business Need|Aspekt|Arwedd|Ahoy matey!|Ability):/)) {
+        state.allowScenario = true;
+        state.allowBackground = true;
+        state.allowPlaceholders = false;
+        state.allowSteps = false;
+        state.allowMultilineArgument = false;
+        state.inKeywordLine = true;
+        return "keyword";
+
+      // BACKGROUND
+      } else if (!state.inKeywordLine && state.allowBackground && stream.match(/(背景|배경|แนวคิด|ಹಿನ್ನೆಲೆ|నేపథ్యం|ਪਿਛੋਕੜ|पृष्ठभूमि|زمینه|الخلفية|רקע|Тарих|Предыстория|Предистория|Позадина|Передумова|Основа|Контекст|Кереш|Υπόβαθρο|Założenia|Yo\-ho\-ho|Tausta|Taust|Situācija|Rerefons|Pozadina|Pozadie|Pozadí|Osnova|Latar Belakang|Kontext|Konteksts|Kontekstas|Kontekst|Háttér|Hannergrond|Grundlage|Geçmiş|Fundo|Fono|First off|Dis is what went down|Dasar|Contexto|Contexte|Context|Contesto|Cenário de Fundo|Cenario de Fundo|Cefndir|Bối cảnh|Bakgrunnur|Bakgrunn|Bakgrund|Baggrund|Background|B4|Antecedents|Antecedentes|Ær|Aer|Achtergrond):/)) {
+        state.allowPlaceholders = false;
+        state.allowSteps = true;
+        state.allowBackground = false;
+        state.allowMultilineArgument = false;
+        state.inKeywordLine = true;
+        return "keyword";
+
+      // SCENARIO OUTLINE
+      } else if (!state.inKeywordLine && state.allowScenario && stream.match(/(場景大綱|场景大纲|劇本大綱|剧本大纲|テンプレ|シナリオテンプレート|シナリオテンプレ|シナリオアウトライン|시나리오 개요|สรุปเหตุการณ์|โครงสร้างของเหตุการณ์|ವಿವರಣೆ|కథనం|ਪਟਕਥਾ ਰੂਪ ਰੇਖਾ|ਪਟਕਥਾ ਢਾਂਚਾ|परिदृश्य रूपरेखा|سيناريو مخطط|الگوی سناریو|תבנית תרחיש|Сценарийның төзелеше|Сценарий структураси|Структура сценарію|Структура сценария|Структура сценарија|Скица|Рамка на сценарий|Концепт|Περιγραφή Σεναρίου|Wharrimean is|Template Situai|Template Senario|Template Keadaan|Tapausaihio|Szenariogrundriss|Szablon scenariusza|Swa hwær swa|Swa hwaer swa|Struktura scenarija|Structură scenariu|Structura scenariu|Skica|Skenario konsep|Shiver me timbers|Senaryo taslağı|Schema dello scenario|Scenariomall|Scenariomal|Scenario Template|Scenario Outline|Scenario Amlinellol|Scenārijs pēc parauga|Scenarijaus šablonas|Reckon it's like|Raamstsenaarium|Plang vum Szenario|Plan du Scénario|Plan du scénario|Osnova scénáře|Osnova Scenára|Náčrt Scenáru|Náčrt Scénáře|Náčrt Scenára|MISHUN SRSLY|Menggariskan Senario|Lýsing Dæma|Lýsing Atburðarásar|Konturo de la scenaro|Koncept|Khung tình huống|Khung kịch bản|Forgatókönyv vázlat|Esquema do Cenário|Esquema do Cenario|Esquema del escenario|Esquema de l'escenari|Esbozo do escenario|Delineação do Cenário|Delineacao do Cenario|All y'all|Abstrakt Scenario|Abstract Scenario):/)) {
+        state.allowPlaceholders = true;
+        state.allowSteps = true;
+        state.allowMultilineArgument = false;
+        state.inKeywordLine = true;
+        return "keyword";
+
+      // EXAMPLES
+      } else if (state.allowScenario && stream.match(/(例子|例|サンプル|예|ชุดของเหตุการณ์|ชุดของตัวอย่าง|ಉದಾಹರಣೆಗಳು|ఉదాహరణలు|ਉਦਾਹਰਨਾਂ|उदाहरण|نمونه ها|امثلة|דוגמאות|Үрнәкләр|Сценарији|Примеры|Примери|Приклади|Мисоллар|Мисаллар|Σενάρια|Παραδείγματα|You'll wanna|Voorbeelden|Variantai|Tapaukset|Se þe|Se the|Se ðe|Scenarios|Scenariji|Scenarijai|Przykłady|Primjeri|Primeri|Příklady|Príklady|Piemēri|Példák|Pavyzdžiai|Paraugs|Örnekler|Juhtumid|Exemplos|Exemples|Exemple|Exempel|EXAMPLZ|Examples|Esempi|Enghreifftiau|Ekzemploj|Eksempler|Ejemplos|Dữ liệu|Dead men tell no tales|Dæmi|Contoh|Cenários|Cenarios|Beispiller|Beispiele|Atburðarásir):/)) {
+        state.allowPlaceholders = false;
+        state.allowSteps = true;
+        state.allowBackground = false;
+        state.allowMultilineArgument = true;
+        return "keyword";
+
+      // SCENARIO
+      } else if (!state.inKeywordLine && state.allowScenario && stream.match(/(場景|场景|劇本|剧本|シナリオ|시나리오|เหตุการณ์|ಕಥಾಸಾರಾಂಶ|సన్నివేశం|ਪਟਕਥਾ|परिदृश्य|سيناريو|سناریو|תרחיש|Сценарій|Сценарио|Сценарий|Пример|Σενάριο|Tình huống|The thing of it is|Tapaus|Szenario|Swa|Stsenaarium|Skenario|Situai|Senaryo|Senario|Scenaro|Scenariusz|Scenariu|Scénario|Scenario|Scenarijus|Scenārijs|Scenarij|Scenarie|Scénář|Scenár|Primer|MISHUN|Kịch bản|Keadaan|Heave to|Forgatókönyv|Escenario|Escenari|Cenário|Cenario|Awww, look mate|Atburðarás):/)) {
+        state.allowPlaceholders = false;
+        state.allowSteps = true;
+        state.allowBackground = false;
+        state.allowMultilineArgument = false;
+        state.inKeywordLine = true;
+        return "keyword";
+
+      // STEPS
+      } else if (!state.inKeywordLine && state.allowSteps && stream.match(/(那麼|那么|而且|當|当|并且|同時|同时|前提|假设|假設|假定|假如|但是|但し|並且|もし|ならば|ただし|しかし|かつ|하지만|조건|먼저|만일|만약|단|그리고|그러면|และ |เมื่อ |แต่ |ดังนั้น |กำหนดให้ |ಸ್ಥಿತಿಯನ್ನು |ಮತ್ತು |ನೀಡಿದ |ನಂತರ |ಆದರೆ |మరియు |చెప్పబడినది |కాని |ఈ పరిస్థితిలో |అప్పుడు |ਪਰ |ਤਦ |ਜੇਕਰ |ਜਿਵੇਂ ਕਿ |ਜਦੋਂ |ਅਤੇ |यदि |परन्तु |पर |तब |तदा |तथा |जब |चूंकि |किन्तु |कदा |और |अगर |و |هنگامی |متى |لكن |عندما |ثم |بفرض |با فرض |اما |اذاً |آنگاه |כאשר |וגם |בהינתן |אזי |אז |אבל |Якщо |Һәм |Унда |Тоді |Тогда |То |Также |Та |Пусть |Припустимо, що |Припустимо |Онда |Но |Нехай |Нәтиҗәдә |Лекин |Ләкин |Коли |Когда |Когато |Када |Кад |К тому же |І |И |Задато |Задати |Задате |Если |Допустим |Дано |Дадено |Вә |Ва |Бирок |Әмма |Әйтик |Әгәр |Аммо |Али |Але |Агар |А також |А |Τότε |Όταν |Και |Δεδομένου |Αλλά |Þurh |Þegar |Þa þe |Þá |Þa |Zatati |Zakładając |Zadato |Zadate |Zadano |Zadani |Zadan |Za předpokladu |Za predpokladu |Youse know when youse got |Youse know like when |Yna |Yeah nah |Y'know |Y |Wun |Wtedy |When y'all |When |Wenn |WEN |wann |Ve |Và |Und |Un |ugeholl |Too right |Thurh |Thì |Then y'all |Then |Tha the |Tha |Tetapi |Tapi |Tak |Tada |Tad |Stel |Soit |Siis |Și |Şi |Si |Sed |Se |Så |Quando |Quand |Quan |Pryd |Potom |Pokud |Pokiaľ |Però |Pero |Pak |Oraz |Onda |Ond |Oletetaan |Og |Och |O zaman |Niin |Nhưng |När |Når |Mutta |Men |Mas |Maka |Majd |Mając |Mais |Maar |mä |Ma |Lorsque |Lorsqu'|Logo |Let go and haul |Kun |Kuid |Kui |Kiedy |Khi |Ketika |Kemudian |Keď |Když |Kaj |Kai |Kada |Kad |Jeżeli |Jeśli |Ja |It's just unbelievable |Ir |I CAN HAZ |I |Ha |Givun |Givet |Given y'all |Given |Gitt |Gegeven |Gegeben seien |Gegeben sei |Gdy |Gangway! |Fakat |Étant donnés |Etant donnés |Étant données |Etant données |Étant donnée |Etant donnée |Étant donné |Etant donné |Et |És |Entonces |Entón |Então |Entao |En |Eğer ki |Ef |Eeldades |E |Ðurh |Duota |Dun |Donitaĵo |Donat |Donada |Do |Diyelim ki |Diberi |Dengan |Den youse gotta |DEN |De |Dato |Dați fiind |Daţi fiind |Dati fiind |Dati |Date fiind |Date |Data |Dat fiind |Dar |Dann |dann |Dan |Dados |Dado |Dadas |Dada |Ða ðe |Ða |Cuando |Cho |Cando |Când |Cand |Cal |But y'all |But at the end of the day I reckon |BUT |But |Buh |Blimey! |Biết |Bet |Bagi |Aye |awer |Avast! |Atunci |Atesa |Atès |Apabila |Anrhegedig a |Angenommen |And y'all |And |AN |An |an |Amikor |Amennyiben |Ama |Als |Alors |Allora |Ali |Aleshores |Ale |Akkor |Ak |Adott |Ac |Aber |A zároveň |A tiež |A taktiež |A také |A |a |7 |\* )/)) {
+        state.inStep = true;
+        state.allowPlaceholders = true;
+        state.allowMultilineArgument = true;
+        state.inKeywordLine = true;
+        return "keyword";
+
+      // INLINE STRING
+      } else if (stream.match(/"[^"]*"?/)) {
+        return "string";
+
+      // PLACEHOLDER
+      } else if (state.allowPlaceholders && stream.match(/<[^>]*>?/)) {
+        return "variable";
+
+      // Fall through
+      } else {
+        stream.next();
+        stream.eatWhile(/[^@"<#]/);
+        return null;
+      }
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-feature", "gherkin");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/gherkin/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+<!doctype html>
+
+<title>CodeMirror: Gherkin mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="gherkin.js"></script>
+<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Gherkin</a>
+  </ul>
+</div>
+
+<article>
+<h2>Gherkin mode</h2>
+<form><textarea id="code" name="code">
+Feature: Using Google
+  Background: 
+    Something something
+    Something else
+  Scenario: Has a homepage
+    When I navigate to the google home page
+    Then the home page should contain the menu and the search form
+  Scenario: Searching for a term 
+    When I navigate to the google home page
+    When I search for Tofu
+    Then the search results page is displayed
+    Then the search results page contains 10 individual search results
+    Then the search results contain a link to the wikipedia tofu page
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-feature</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/go/go.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,187 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("go", function(config) {
+  var indentUnit = config.indentUnit;
+
+  var keywords = {
+    "break":true, "case":true, "chan":true, "const":true, "continue":true,
+    "default":true, "defer":true, "else":true, "fallthrough":true, "for":true,
+    "func":true, "go":true, "goto":true, "if":true, "import":true,
+    "interface":true, "map":true, "package":true, "range":true, "return":true,
+    "select":true, "struct":true, "switch":true, "type":true, "var":true,
+    "bool":true, "byte":true, "complex64":true, "complex128":true,
+    "float32":true, "float64":true, "int8":true, "int16":true, "int32":true,
+    "int64":true, "string":true, "uint8":true, "uint16":true, "uint32":true,
+    "uint64":true, "int":true, "uint":true, "uintptr":true, "error": true,
+    "rune":true, "any":true, "comparable":true
+  };
+
+  var atoms = {
+    "true":true, "false":true, "iota":true, "nil":true, "append":true,
+    "cap":true, "close":true, "complex":true, "copy":true, "delete":true, "imag":true,
+    "len":true, "make":true, "new":true, "panic":true, "print":true,
+    "println":true, "real":true, "recover":true
+  };
+
+  var isOperatorChar = /[+\-*&^%:=<>!|\/]/;
+
+  var curPunc;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == '"' || ch == "'" || ch == "`") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (/[\d\.]/.test(ch)) {
+      if (ch == ".") {
+        stream.match(/^[0-9_]+([eE][\-+]?[0-9_]+)?/);
+      } else if (ch == "0") {
+        stream.match(/^[xX][0-9a-fA-F_]+/) || stream.match(/^[0-7_]+/);
+      } else {
+        stream.match(/^[0-9_]*\.?[0-9_]*([eE][\-+]?[0-9_]+)?/);
+      }
+      return "number";
+    }
+    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    if (ch == "/") {
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+    var cur = stream.current();
+    if (keywords.propertyIsEnumerable(cur)) {
+      if (cur == "case" || cur == "default") curPunc = "case";
+      return "keyword";
+    }
+    if (atoms.propertyIsEnumerable(cur)) return "atom";
+    return "variable";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && quote != "`" && next == "\\";
+      }
+      if (end || !(escaped || quote == "`"))
+        state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function Context(indented, column, type, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.align = align;
+    this.prev = prev;
+  }
+  function pushContext(state, col, type) {
+    return state.context = new Context(state.indented, col, type, null, state.context);
+  }
+  function popContext(state) {
+    if (!state.context.prev) return;
+    var t = state.context.type;
+    if (t == ")" || t == "]" || t == "}")
+      state.indented = state.context.indented;
+    return state.context = state.context.prev;
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+        indented: 0,
+        startOfLine: true
+      };
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+        if (ctx.type == "case") ctx.type = "}";
+      }
+      if (stream.eatSpace()) return null;
+      curPunc = null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment") return style;
+      if (ctx.align == null) ctx.align = true;
+
+      if (curPunc == "{") pushContext(state, stream.column(), "}");
+      else if (curPunc == "[") pushContext(state, stream.column(), "]");
+      else if (curPunc == "(") pushContext(state, stream.column(), ")");
+      else if (curPunc == "case") ctx.type = "case";
+      else if (curPunc == "}" && ctx.type == "}") popContext(state);
+      else if (curPunc == ctx.type) popContext(state);
+      state.startOfLine = false;
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
+      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+      if (ctx.type == "case" && /^(?:case|default)\b/.test(textAfter)) {
+        state.context.type = "}";
+        return ctx.indented;
+      }
+      var closing = firstChar == ctx.type;
+      if (ctx.align) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: "{}):",
+    closeBrackets: "()[]{}''\"\"``",
+    fold: "brace",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//"
+  };
+});
+
+CodeMirror.defineMIME("text/x-go", "go");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/go/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: Go mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="go.js"></script>
+<style>.CodeMirror {border:1px solid #999; background:#ffc}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Go</a>
+  </ul>
+</div>
+
+<article>
+<h2>Go mode</h2>
+<form><textarea id="code" name="code">
+// Prime Sieve in Go.
+// Taken from the Go specification.
+// Copyright © The Go Authors.
+
+package main
+
+import "fmt"
+
+// Send the sequence 2, 3, 4, ... to channel 'ch'.
+func generate(ch chan&lt;- int) {
+	for i := 2; ; i++ {
+		ch &lt;- i  // Send 'i' to channel 'ch'
+	}
+}
+
+// Copy the values from channel 'src' to channel 'dst',
+// removing those divisible by 'prime'.
+func filter(src &lt;-chan int, dst chan&lt;- int, prime int) {
+	for i := range src {    // Loop over values received from 'src'.
+		if i%prime != 0 {
+			dst &lt;- i  // Send 'i' to channel 'dst'.
+		}
+	}
+}
+
+// The prime sieve: Daisy-chain filter processes together.
+func sieve() {
+	ch := make(chan int)  // Create a new channel.
+	go generate(ch)       // Start generate() as a subprocess.
+	for {
+		prime := &lt;-ch
+		fmt.Print(prime, "\n")
+		ch1 := make(chan int)
+		go filter(ch, ch1, prime)
+		ch = ch1
+	}
+}
+
+func main() {
+	sieve()
+}
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        theme: "elegant",
+        matchBrackets: true,
+        indentUnit: 8,
+        tabSize: 8,
+        indentWithTabs: true,
+        mode: "text/x-go"
+      });
+    </script>
+
+    <p><strong>MIME type:</strong> <code>text/x-go</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/groovy/groovy.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,245 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("groovy", function(config) {
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+  var keywords = words(
+    "abstract as assert boolean break byte case catch char class const continue def default " +
+    "do double else enum extends final finally float for goto if implements import in " +
+    "instanceof int interface long native new package private protected public return " +
+    "short static strictfp super switch synchronized threadsafe throw throws trait transient " +
+    "try void volatile while");
+  var blockKeywords = words("catch class def do else enum finally for if interface switch trait try while");
+  var standaloneKeywords = words("return break continue");
+  var atoms = words("null true false this");
+
+  var curPunc;
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == '"' || ch == "'") {
+      return startString(ch, stream, state);
+    }
+    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      if (stream.eat(/eE/)) { stream.eat(/\+\-/); stream.eatWhile(/\d/); }
+      return "number";
+    }
+    if (ch == "/") {
+      if (stream.eat("*")) {
+        state.tokenize.push(tokenComment);
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+      if (expectExpression(state.lastToken, false)) {
+        return startString(ch, stream, state);
+      }
+    }
+    if (ch == "-" && stream.eat(">")) {
+      curPunc = "->";
+      return null;
+    }
+    if (/[+\-*&%=<>!?|\/~]/.test(ch)) {
+      stream.eatWhile(/[+\-*&%=<>|~]/);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_]/);
+    if (ch == "@") { stream.eatWhile(/[\w\$_\.]/); return "meta"; }
+    if (state.lastToken == ".") return "property";
+    if (stream.eat(":")) { curPunc = "proplabel"; return "property"; }
+    var cur = stream.current();
+    if (atoms.propertyIsEnumerable(cur)) { return "atom"; }
+    if (keywords.propertyIsEnumerable(cur)) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      else if (standaloneKeywords.propertyIsEnumerable(cur)) curPunc = "standalone";
+      return "keyword";
+    }
+    return "variable";
+  }
+  tokenBase.isBase = true;
+
+  function startString(quote, stream, state) {
+    var tripleQuoted = false;
+    if (quote != "/" && stream.eat(quote)) {
+      if (stream.eat(quote)) tripleQuoted = true;
+      else return "string";
+    }
+    function t(stream, state) {
+      var escaped = false, next, end = !tripleQuoted;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {
+          if (!tripleQuoted) { break; }
+          if (stream.match(quote + quote)) { end = true; break; }
+        }
+        if (quote == '"' && next == "$" && !escaped) {
+          if (stream.eat("{")) {
+            state.tokenize.push(tokenBaseUntilBrace());
+            return "string";
+          } else if (stream.match(/^\w/, false)) {
+            state.tokenize.push(tokenVariableDeref);
+            return "string";
+          }
+        }
+        escaped = !escaped && next == "\\";
+      }
+      if (end) state.tokenize.pop();
+      return "string";
+    }
+    state.tokenize.push(t);
+    return t(stream, state);
+  }
+
+  function tokenBaseUntilBrace() {
+    var depth = 1;
+    function t(stream, state) {
+      if (stream.peek() == "}") {
+        depth--;
+        if (depth == 0) {
+          state.tokenize.pop();
+          return state.tokenize[state.tokenize.length-1](stream, state);
+        }
+      } else if (stream.peek() == "{") {
+        depth++;
+      }
+      return tokenBase(stream, state);
+    }
+    t.isBase = true;
+    return t;
+  }
+
+  function tokenVariableDeref(stream, state) {
+    var next = stream.match(/^(\.|[\w\$_]+)/)
+    if (!next || !stream.match(next[0] == "." ? /^[\w$_]/ : /^\./)) state.tokenize.pop()
+    if (!next) return state.tokenize[state.tokenize.length-1](stream, state)
+    return next[0] == "." ? null : "variable"
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize.pop();
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function expectExpression(last, newline) {
+    return !last || last == "operator" || last == "->" || /[\.\[\{\(,;:]/.test(last) ||
+      last == "newstatement" || last == "keyword" || last == "proplabel" ||
+      (last == "standalone" && !newline);
+  }
+
+  function Context(indented, column, type, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.align = align;
+    this.prev = prev;
+  }
+  function pushContext(state, col, type) {
+    return state.context = new Context(state.indented, col, type, null, state.context);
+  }
+  function popContext(state) {
+    var t = state.context.type;
+    if (t == ")" || t == "]" || t == "}")
+      state.indented = state.context.indented;
+    return state.context = state.context.prev;
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: [tokenBase],
+        context: new Context((basecolumn || 0) - config.indentUnit, 0, "top", false),
+        indented: 0,
+        startOfLine: true,
+        lastToken: null
+      };
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+        // Automatic semicolon insertion
+        if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) {
+          popContext(state); ctx = state.context;
+        }
+      }
+      if (stream.eatSpace()) return null;
+      curPunc = null;
+      var style = state.tokenize[state.tokenize.length-1](stream, state);
+      if (style == "comment") return style;
+      if (ctx.align == null) ctx.align = true;
+
+      if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
+      // Handle indentation for {x -> \n ... }
+      else if (curPunc == "->" && ctx.type == "statement" && ctx.prev.type == "}") {
+        popContext(state);
+        state.context.align = false;
+      }
+      else if (curPunc == "{") pushContext(state, stream.column(), "}");
+      else if (curPunc == "[") pushContext(state, stream.column(), "]");
+      else if (curPunc == "(") pushContext(state, stream.column(), ")");
+      else if (curPunc == "}") {
+        while (ctx.type == "statement") ctx = popContext(state);
+        if (ctx.type == "}") ctx = popContext(state);
+        while (ctx.type == "statement") ctx = popContext(state);
+      }
+      else if (curPunc == ctx.type) popContext(state);
+      else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
+        pushContext(state, stream.column(), "statement");
+      state.startOfLine = false;
+      state.lastToken = curPunc || style;
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (!state.tokenize[state.tokenize.length-1].isBase) return CodeMirror.Pass;
+      var firstChar = textAfter && textAfter.charAt(0), ctx = state.context;
+      if (ctx.type == "statement" && !expectExpression(state.lastToken, true)) ctx = ctx.prev;
+      var closing = firstChar == ctx.type;
+      if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : config.indentUnit);
+      else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indented + (closing ? 0 : config.indentUnit);
+    },
+
+    electricChars: "{}",
+    closeBrackets: {triples: "'\""},
+    fold: "brace",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//"
+  };
+});
+
+CodeMirror.defineMIME("text/x-groovy", "groovy");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/groovy/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,84 @@
+<!doctype html>
+
+<title>CodeMirror: Groovy mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="groovy.js"></script>
+<style>.CodeMirror {border-top: 1px solid #500; border-bottom: 1px solid #500;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Groovy</a>
+  </ul>
+</div>
+
+<article>
+<h2>Groovy mode</h2>
+<form><textarea id="code" name="code">
+//Pattern for groovy script
+def p = ~/.*\.groovy/
+new File( 'd:\\scripts' ).eachFileMatch(p) {f ->
+  // imports list
+  def imports = []
+  f.eachLine {
+    // condition to detect an import instruction
+    ln -> if ( ln =~ '^import .*' ) {
+      imports << "${ln - 'import '}"
+    }
+  }
+  // print thmen
+  if ( ! imports.empty ) {
+    println f
+    imports.each{ println "   $it" }
+  }
+}
+
+/* Coin changer demo code from http://groovy.codehaus.org */
+
+enum UsCoin {
+  quarter(25), dime(10), nickel(5), penny(1)
+  UsCoin(v) { value = v }
+  final value
+}
+
+enum OzzieCoin {
+  fifty(50), twenty(20), ten(10), five(5)
+  OzzieCoin(v) { value = v }
+  final value
+}
+
+def plural(word, count) {
+  if (count == 1) return word
+  word[-1] == 'y' ? word[0..-2] + "ies" : word + "s"
+}
+
+def change(currency, amount) {
+  currency.values().inject([]){ list, coin ->
+     int count = amount / coin.value
+     amount = amount % coin.value
+     list += "$count ${plural(coin.toString(), count)}"
+  }
+}
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-groovy"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-groovy</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haml/haml.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,161 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../ruby/ruby"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+  // full haml mode. This handled embedded ruby and html fragments too
+  CodeMirror.defineMode("haml", function(config) {
+    var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
+    var rubyMode = CodeMirror.getMode(config, "ruby");
+
+    function rubyInQuote(endQuote) {
+      return function(stream, state) {
+        var ch = stream.peek();
+        if (ch == endQuote && state.rubyState.tokenize.length == 1) {
+          // step out of ruby context as it seems to complete processing all the braces
+          stream.next();
+          state.tokenize = html;
+          return "closeAttributeTag";
+        } else {
+          return ruby(stream, state);
+        }
+      };
+    }
+
+    function ruby(stream, state) {
+      if (stream.match("-#")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+      return rubyMode.token(stream, state.rubyState);
+    }
+
+    function html(stream, state) {
+      var ch = stream.peek();
+
+      // handle haml declarations. All declarations that cant be handled here
+      // will be passed to html mode
+      if (state.previousToken.style == "comment" ) {
+        if (state.indented > state.previousToken.indented) {
+          stream.skipToEnd();
+          return "commentLine";
+        }
+      }
+
+      if (state.startOfLine) {
+        if (ch == "!" && stream.match("!!")) {
+          stream.skipToEnd();
+          return "tag";
+        } else if (stream.match(/^%[\w:#\.]+=/)) {
+          state.tokenize = ruby;
+          return "hamlTag";
+        } else if (stream.match(/^%[\w:]+/)) {
+          return "hamlTag";
+        } else if (ch == "/" ) {
+          stream.skipToEnd();
+          return "comment";
+        }
+      }
+
+      if (state.startOfLine || state.previousToken.style == "hamlTag") {
+        if ( ch == "#" || ch == ".") {
+          stream.match(/[\w-#\.]*/);
+          return "hamlAttribute";
+        }
+      }
+
+      // do not handle --> as valid ruby, make it HTML close comment instead
+      if (state.startOfLine && !stream.match("-->", false) && (ch == "=" || ch == "-" )) {
+        state.tokenize = ruby;
+        return state.tokenize(stream, state);
+      }
+
+      if (state.previousToken.style == "hamlTag" ||
+          state.previousToken.style == "closeAttributeTag" ||
+          state.previousToken.style == "hamlAttribute") {
+        if (ch == "(") {
+          state.tokenize = rubyInQuote(")");
+          return state.tokenize(stream, state);
+        } else if (ch == "{") {
+          if (!stream.match(/^\{%.*/)) {
+            state.tokenize = rubyInQuote("}");
+            return state.tokenize(stream, state);
+          }
+        }
+      }
+
+      return htmlMode.token(stream, state.htmlState);
+    }
+
+    return {
+      // default to html mode
+      startState: function() {
+        var htmlState = CodeMirror.startState(htmlMode);
+        var rubyState = CodeMirror.startState(rubyMode);
+        return {
+          htmlState: htmlState,
+          rubyState: rubyState,
+          indented: 0,
+          previousToken: { style: null, indented: 0},
+          tokenize: html
+        };
+      },
+
+      copyState: function(state) {
+        return {
+          htmlState : CodeMirror.copyState(htmlMode, state.htmlState),
+          rubyState: CodeMirror.copyState(rubyMode, state.rubyState),
+          indented: state.indented,
+          previousToken: state.previousToken,
+          tokenize: state.tokenize
+        };
+      },
+
+      token: function(stream, state) {
+        if (stream.sol()) {
+          state.indented = stream.indentation();
+          state.startOfLine = true;
+        }
+        if (stream.eatSpace()) return null;
+        var style = state.tokenize(stream, state);
+        state.startOfLine = false;
+        // dont record comment line as we only want to measure comment line with
+        // the opening comment block
+        if (style && style != "commentLine") {
+          state.previousToken = { style: style, indented: state.indented };
+        }
+        // if current state is ruby and the previous token is not `,` reset the
+        // tokenize to html
+        if (stream.eol() && state.tokenize == ruby) {
+          stream.backUp(1);
+          var ch = stream.peek();
+          stream.next();
+          if (ch && ch != ",") {
+            state.tokenize = html;
+          }
+        }
+        // reprocess some of the specific style tag when finish setting previousToken
+        if (style == "hamlTag") {
+          style = "tag";
+        } else if (style == "commentLine") {
+          style = "comment";
+        } else if (style == "hamlAttribute") {
+          style = "attribute";
+        } else if (style == "closeAttributeTag") {
+          style = null;
+        }
+        return style;
+      }
+    };
+  }, "htmlmixed", "ruby");
+
+  CodeMirror.defineMIME("text/x-haml", "haml");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haml/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,79 @@
+<!doctype html>
+
+<title>CodeMirror: HAML mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../ruby/ruby.js"></script>
+<script src="haml.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">HAML</a>
+  </ul>
+</div>
+
+<article>
+<h2>HAML mode</h2>
+<form><textarea id="code" name="code">
+!!!
+#content
+.left.column(title="title"){:href => "/hello", :test => "#{hello}_#{world}"}
+    <!-- This is a comment -->
+    %h2 Welcome to our site!
+    %p= puts "HAML MODE"
+  .right.column
+    = render :partial => "sidebar"
+
+.container
+  .row
+    .span8
+      %h1.title= @page_title
+%p.title= @page_title
+%p
+  /
+    The same as HTML comment
+    Hello multiline comment
+
+  -# haml comment
+      This wont be displayed
+      nor will this
+  Date/Time:
+  - now = DateTime.now
+  %strong= now
+  - if now > DateTime.parse("December 31, 2006")
+    = "Happy new " + "year!"
+
+%title
+  = @title
+  \= @title
+  <h1>Title</h1>
+  <h1 title="HELLO">
+    Title
+  </h1>
+    </textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "text/x-haml"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-haml</code>.</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#haml_*">normal</a>,  <a href="../../test/index.html#verbose,haml_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haml/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,97 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "haml");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  // Requires at least one media query
+  MT("elementName",
+     "[tag %h1] Hey There");
+
+  MT("oneElementPerLine",
+     "[tag %h1] Hey There %h2");
+
+  MT("idSelector",
+     "[tag %h1][attribute #test] Hey There");
+
+  MT("classSelector",
+     "[tag %h1][attribute .hello] Hey There");
+
+  MT("docType",
+     "[tag !!! XML]");
+
+  MT("comment",
+     "[comment / Hello WORLD]");
+
+  MT("notComment",
+     "[tag %h1] This is not a / comment ");
+
+  MT("attributes",
+     "[tag %a]([variable title][operator =][string \"test\"]){[atom :title] [operator =>] [string \"test\"]}");
+
+  MT("htmlCode",
+     "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket </][tag h1][tag&bracket >]");
+
+  MT("rubyBlock",
+     "[operator =][variable-2 @item]");
+
+  MT("selectorRubyBlock",
+     "[tag %a.selector=] [variable-2 @item]");
+
+  MT("nestedRubyBlock",
+      "[tag %a]",
+      "   [operator =][variable puts] [string \"test\"]");
+
+  MT("multilinePlaintext",
+      "[tag %p]",
+      "  Hello,",
+      "  World");
+
+  MT("multilineRuby",
+      "[tag %p]",
+      "  [comment -# this is a comment]",
+      "     [comment and this is a comment too]",
+      "  Date/Time",
+      "  [operator -] [variable now] [operator =] [tag DateTime][operator .][property now]",
+      "  [tag %strong=] [variable now]",
+      "  [operator -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])",
+      "     [operator =][string \"Happy\"]",
+      "     [operator =][string \"Belated\"]",
+      "     [operator =][string \"Birthday\"]");
+
+  MT("multilineComment",
+      "[comment /]",
+      "  [comment Multiline]",
+      "  [comment Comment]");
+
+  MT("hamlComment",
+     "[comment -# this is a comment]");
+
+  MT("multilineHamlComment",
+     "[comment -# this is a comment]",
+     "   [comment and this is a comment too]");
+
+  MT("multilineHTMLComment",
+    "[comment <!--]",
+    "  [comment what a comment]",
+    "  [comment -->]");
+
+  MT("hamlAfterRubyTag",
+    "[attribute .block]",
+    "  [tag %strong=] [variable now]",
+    "  [attribute .test]",
+    "     [operator =][variable now]",
+    "  [attribute .right]");
+
+  MT("stretchedRuby",
+     "[operator =] [variable puts] [string \"Hello\"],",
+     "   [string \"World\"]");
+
+  MT("interpolationInHashAttribute",
+     //"[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test");
+     "[tag %div]{[atom :id] [operator =>] [string \"#{][variable test][string }_#{][variable ting][string }\"]} test");
+
+  MT("interpolationInHTMLAttribute",
+     "[tag %div]([variable title][operator =][string \"#{][variable test][string }_#{][variable ting]()[string }\"]) Test");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/handlebars/handlebars.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,70 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../addon/mode/simple"), require("../../addon/mode/multiplex"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/simple", "../../addon/mode/multiplex"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineSimpleMode("handlebars-tags", {
+    start: [
+      { regex: /\{\{\{/, push: "handlebars_raw", token: "tag" },
+      { regex: /\{\{!--/, push: "dash_comment", token: "comment" },
+      { regex: /\{\{!/,   push: "comment", token: "comment" },
+      { regex: /\{\{/,    push: "handlebars", token: "tag" }
+    ],
+    handlebars_raw: [
+      { regex: /\}\}\}/, pop: true, token: "tag" },
+    ],
+    handlebars: [
+      { regex: /\}\}/, pop: true, token: "tag" },
+
+      // Double and single quotes
+      { regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
+      { regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
+
+      // Handlebars keywords
+      { regex: />|[#\/]([A-Za-z_]\w*)/, token: "keyword" },
+      { regex: /(?:else|this)\b/, token: "keyword" },
+
+      // Numeral
+      { regex: /\d+/i, token: "number" },
+
+      // Atoms like = and .
+      { regex: /=|~|@|true|false/, token: "atom" },
+
+      // Paths
+      { regex: /(?:\.\.\/)*(?:[A-Za-z_][\w\.]*)+/, token: "variable-2" }
+    ],
+    dash_comment: [
+      { regex: /--\}\}/, pop: true, token: "comment" },
+
+      // Commented code
+      { regex: /./, token: "comment"}
+    ],
+    comment: [
+      { regex: /\}\}/, pop: true, token: "comment" },
+      { regex: /./, token: "comment" }
+    ],
+    meta: {
+      blockCommentStart: "{{--",
+      blockCommentEnd: "--}}"
+    }
+  });
+
+  CodeMirror.defineMode("handlebars", function(config, parserConfig) {
+    var handlebars = CodeMirror.getMode(config, "handlebars-tags");
+    if (!parserConfig || !parserConfig.base) return handlebars;
+    return CodeMirror.multiplexingMode(
+      CodeMirror.getMode(config, parserConfig.base),
+      {open: "{{", close: /\}\}\}?/, mode: handlebars, parseDelimiters: true}
+    );
+  });
+
+  CodeMirror.defineMIME("text/x-handlebars-template", "handlebars");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/handlebars/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,82 @@
+<!doctype html>
+
+<title>CodeMirror: Handlebars mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="../../addon/mode/multiplex.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="handlebars.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">HTML mixed</a>
+  </ul>
+</div>
+
+<article>
+<h2>Handlebars</h2>
+<form><textarea id="code" name="code">
+{{> breadcrumbs}}
+
+{{!--
+  You can use the t function to get
+  content translated to the current locale, es:
+  {{t 'article_list'}}
+--}}
+
+<h1>{{t 'article_list'}}</h1>
+
+{{! one line comment }}
+
+{{{propertyContainingRawHtml}}}
+
+{{#each articles}}
+  {{~title}}
+  <p>{{excerpt body size=120 ellipsis=true}}</p>
+
+  {{#with author}}
+    written by {{first_name}} {{last_name}}
+    from category: {{../category.title}}
+    {{#if @../last}}foobar!{{/if}}
+  {{/with~}}
+
+  {{#if promoted.latest}}Read this one! {{else}} This is ok! {{/if}}
+
+  {{#if @last}}<hr>{{/if}}
+{{/each}}
+
+{{#form new_comment}}
+  <input type="text" name="body">
+{{/form}}
+
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: {name: "handlebars", base: "text/html"}
+      });
+    </script>
+    
+    <p>Handlebars syntax highlighting for CodeMirror.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-handlebars-template</code></p>
+
+    <p>Supported options: <code>base</code> to set the mode to
+    wrap. For example, use</p>
+    <pre>mode: {name: "handlebars", base: "text/html"}</pre>
+    <p>to highlight an HTML template.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haskell-literate/haskell-literate.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,43 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function (mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../haskell/haskell"))
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../haskell/haskell"], mod)
+  else // Plain browser env
+    mod(CodeMirror)
+})(function (CodeMirror) {
+  "use strict"
+
+  CodeMirror.defineMode("haskell-literate", function (config, parserConfig) {
+    var baseMode = CodeMirror.getMode(config, (parserConfig && parserConfig.base) || "haskell")
+
+    return {
+      startState: function () {
+        return {
+          inCode: false,
+          baseState: CodeMirror.startState(baseMode)
+        }
+      },
+      token: function (stream, state) {
+        if (stream.sol()) {
+          if (state.inCode = stream.eat(">"))
+            return "meta"
+        }
+        if (state.inCode) {
+          return baseMode.token(stream, state.baseState)
+        } else {
+          stream.skipToEnd()
+          return "comment"
+        }
+      },
+      innerMode: function (state) {
+        return state.inCode ? {state: state.baseState, mode: baseMode} : null
+      }
+    }
+  }, "haskell")
+
+  CodeMirror.defineMIME("text/x-literate-haskell", "haskell-literate")
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haskell-literate/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,282 @@
+<!doctype html>
+
+<title>CodeMirror: Haskell-literate mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="haskell-literate.js"></script>
+<script src="../haskell/haskell.js"></script>
+<style>.CodeMirror {
+  border-top    : 1px solid #DDDDDD;
+  border-bottom : 1px solid #DDDDDD;
+}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo
+                                                          src="../../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Haskell-literate</a>
+  </ul>
+</div>
+
+<article>
+  <h2>Haskell literate mode</h2>
+  <form>
+    <textarea id="code" name="code">
+> {-# LANGUAGE OverloadedStrings #-}
+> {-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
+> import Control.Applicative ((<$>), (<*>))
+> import Data.Maybe (isJust)
+
+> import Data.Text (Text)
+> import Text.Blaze ((!))
+> import qualified Data.Text as T
+> import qualified Happstack.Server as Happstack
+> import qualified Text.Blaze.Html5 as H
+> import qualified Text.Blaze.Html5.Attributes as A
+
+> import Text.Digestive
+> import Text.Digestive.Blaze.Html5
+> import Text.Digestive.Happstack
+> import Text.Digestive.Util
+
+Simple forms and validation
+---------------------------
+
+Let's start by creating a very simple datatype to represent a user:
+
+> data User = User
+>     { userName :: Text
+>     , userMail :: Text
+>     } deriving (Show)
+
+And dive in immediately to create a `Form` for a user. The `Form v m a` type
+has three parameters:
+
+- `v`: the type for messages and errors (usually a `String`-like type, `Text` in
+  this case);
+- `m`: the monad we are operating in, not specified here;
+- `a`: the return type of the `Form`, in this case, this is obviously `User`.
+
+> userForm :: Monad m => Form Text m User
+
+We create forms by using the `Applicative` interface. A few form types are
+provided in the `Text.Digestive.Form` module, such as `text`, `string`,
+`bool`...
+
+In the `digestive-functors` library, the developer is required to label each
+field using the `.:` operator. This might look like a bit of a burden, but it
+allows you to do some really useful stuff, like separating the `Form` from the
+actual HTML layout.
+
+> userForm = User
+>     <$> "name" .: text Nothing
+>     <*> "mail" .: check "Not a valid email address" checkEmail (text Nothing)
+
+The `check` function enables you to validate the result of a form. For example,
+we can validate the email address with a really naive `checkEmail` function.
+
+> checkEmail :: Text -> Bool
+> checkEmail = isJust . T.find (== '@')
+
+More validation
+---------------
+
+For our example, we also want descriptions of Haskell libraries, and in order to
+do that, we need package versions...
+
+> type Version = [Int]
+
+We want to let the user input a version number such as `0.1.0.0`. This means we
+need to validate if the input `Text` is of this form, and then we need to parse
+it to a `Version` type. Fortunately, we can do this in a single function:
+`validate` allows conversion between values, which can optionally fail.
+
+`readMaybe :: Read a => String -> Maybe a` is a utility function imported from
+`Text.Digestive.Util`.
+
+> validateVersion :: Text -> Result Text Version
+> validateVersion = maybe (Error "Cannot parse version") Success .
+>     mapM (readMaybe . T.unpack) . T.split (== '.')
+
+A quick test in GHCi:
+
+    ghci> validateVersion (T.pack "0.3.2.1")
+    Success [0,3,2,1]
+    ghci> validateVersion (T.pack "0.oops")
+    Error "Cannot parse version"
+
+It works! This means we can now easily add a `Package` type and a `Form` for it:
+
+> data Category = Web | Text | Math
+>     deriving (Bounded, Enum, Eq, Show)
+
+> data Package = Package Text Version Category
+>     deriving (Show)
+
+> packageForm :: Monad m => Form Text m Package
+> packageForm = Package
+>     <$> "name"     .: text Nothing
+>     <*> "version"  .: validate validateVersion (text (Just "0.0.0.1"))
+>     <*> "category" .: choice categories Nothing
+>   where
+>     categories = [(x, T.pack (show x)) | x <- [minBound .. maxBound]]
+
+Composing forms
+---------------
+
+A release has an author and a package. Let's use this to illustrate the
+composability of the digestive-functors library: we can reuse the forms we have
+written earlier on.
+
+> data Release = Release User Package
+>     deriving (Show)
+
+> releaseForm :: Monad m => Form Text m Release
+> releaseForm = Release
+>     <$> "author"  .: userForm
+>     <*> "package" .: packageForm
+
+Views
+-----
+
+As mentioned before, one of the advantages of using digestive-functors is
+separation of forms and their actual HTML layout. In order to do this, we have
+another type, `View`.
+
+We can get a `View` from a `Form` by supplying input. A `View` contains more
+information than a `Form`, it has:
+
+- the original form;
+- the input given by the user;
+- any errors that have occurred.
+
+It is this view that we convert to HTML. For this tutorial, we use the
+[blaze-html] library, and some helpers from the `digestive-functors-blaze`
+library.
+
+[blaze-html]: http://jaspervdj.be/blaze/
+
+Let's write a view for the `User` form. As you can see, we here refer to the
+different fields in the `userForm`. The `errorList` will generate a list of
+errors for the `"mail"` field.
+
+> userView :: View H.Html -> H.Html
+> userView view = do
+>     label     "name" view "Name: "
+>     inputText "name" view
+>     H.br
+>
+>     errorList "mail" view
+>     label     "mail" view "Email address: "
+>     inputText "mail" view
+>     H.br
+
+Like forms, views are also composable: let's illustrate that by adding a view
+for the `releaseForm`, in which we reuse `userView`. In order to do this, we
+take only the parts relevant to the author from the view by using `subView`. We
+can then pass the resulting view to our own `userView`.
+We have no special view code for `Package`, so we can just add that to
+`releaseView` as well. `childErrorList` will generate a list of errors for each
+child of the specified form. In this case, this means a list of errors from
+`"package.name"` and `"package.version"`. Note how we use `foo.bar` to refer to
+nested forms.
+
+> releaseView :: View H.Html -> H.Html
+> releaseView view = do
+>     H.h2 "Author"
+>     userView $ subView "author" view
+>
+>     H.h2 "Package"
+>     childErrorList "package" view
+>
+>     label     "package.name" view "Name: "
+>     inputText "package.name" view
+>     H.br
+>
+>     label     "package.version" view "Version: "
+>     inputText "package.version" view
+>     H.br
+>
+>     label       "package.category" view "Category: "
+>     inputSelect "package.category" view
+>     H.br
+
+The attentive reader might have wondered what the type parameter for `View` is:
+it is the `String`-like type used for e.g. error messages.
+But wait! We have
+    releaseForm :: Monad m => Form Text m Release
+    releaseView :: View H.Html -> H.Html
+... doesn't this mean that we need a `View Text` rather than a `View Html`?  The
+answer is yes -- but having `View Html` allows us to write these views more
+easily with the `digestive-functors-blaze` library. Fortunately, we will be able
+to fix this using the `Functor` instance of `View`.
+    fmap :: Monad m => (v -> w) -> View v -> View w
+A backend
+---------
+To finish this tutorial, we need to be able to actually run this code. We need
+an HTTP server for that, and we use [Happstack] for this tutorial. The
+`digestive-functors-happstack` library gives about everything we need for this.
+[Happstack]: http://happstack.com/
+
+> site :: Happstack.ServerPart Happstack.Response
+> site = do
+>     Happstack.decodeBody $ Happstack.defaultBodyPolicy "/tmp" 4096 4096 4096
+>     r <- runForm "test" releaseForm
+>     case r of
+>         (view, Nothing) -> do
+>             let view' = fmap H.toHtml view
+>             Happstack.ok $ Happstack.toResponse $
+>                 template $
+>                     form view' "/" $ do
+>                         releaseView view'
+>                         H.br
+>                         inputSubmit "Submit"
+>         (_, Just release) -> Happstack.ok $ Happstack.toResponse $
+>             template $ do
+>                 css
+>                 H.h1 "Release received"
+>                 H.p $ H.toHtml $ show release
+>
+> main :: IO ()
+> main = Happstack.simpleHTTP Happstack.nullConf site
+
+Utilities
+---------
+
+> template :: H.Html -> H.Html
+> template body = H.docTypeHtml $ do
+>     H.head $ do
+>         H.title "digestive-functors tutorial"
+>         css
+>     H.body body
+> css :: H.Html
+> css = H.style ! A.type_ "text/css" $ do
+>     "label {width: 130px; float: left; clear: both}"
+>     "ul.digestive-functors-error-list {"
+>     "    color: red;"
+>     "    list-style-type: none;"
+>     "    padding-left: 0px;"
+>     "}"
+    </textarea>
+  </form>
+
+  <p><strong>MIME types
+  defined:</strong> <code>text/x-literate-haskell</code>.</p>
+
+  <p>Parser configuration parameters recognized: <code>base</code> to
+  set the base mode (defaults to <code>"haskell"</code>).</p>
+
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "haskell-literate"});
+  </script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haskell/haskell.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,268 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("haskell", function(_config, modeConfig) {
+
+  function switchState(source, setState, f) {
+    setState(f);
+    return f(source, setState);
+  }
+
+  // These should all be Unicode extended, as per the Haskell 2010 report
+  var smallRE = /[a-z_]/;
+  var largeRE = /[A-Z]/;
+  var digitRE = /\d/;
+  var hexitRE = /[0-9A-Fa-f]/;
+  var octitRE = /[0-7]/;
+  var idRE = /[a-z_A-Z0-9'\xa1-\uffff]/;
+  var symbolRE = /[-!#$%&*+.\/<=>?@\\^|~:]/;
+  var specialRE = /[(),;[\]`{}]/;
+  var whiteCharRE = /[ \t\v\f]/; // newlines are handled in tokenizer
+
+  function normal(source, setState) {
+    if (source.eatWhile(whiteCharRE)) {
+      return null;
+    }
+
+    var ch = source.next();
+    if (specialRE.test(ch)) {
+      if (ch == '{' && source.eat('-')) {
+        var t = "comment";
+        if (source.eat('#')) {
+          t = "meta";
+        }
+        return switchState(source, setState, ncomment(t, 1));
+      }
+      return null;
+    }
+
+    if (ch == '\'') {
+      if (source.eat('\\')) {
+        source.next();  // should handle other escapes here
+      }
+      else {
+        source.next();
+      }
+      if (source.eat('\'')) {
+        return "string";
+      }
+      return "string error";
+    }
+
+    if (ch == '"') {
+      return switchState(source, setState, stringLiteral);
+    }
+
+    if (largeRE.test(ch)) {
+      source.eatWhile(idRE);
+      if (source.eat('.')) {
+        return "qualifier";
+      }
+      return "variable-2";
+    }
+
+    if (smallRE.test(ch)) {
+      source.eatWhile(idRE);
+      return "variable";
+    }
+
+    if (digitRE.test(ch)) {
+      if (ch == '0') {
+        if (source.eat(/[xX]/)) {
+          source.eatWhile(hexitRE); // should require at least 1
+          return "integer";
+        }
+        if (source.eat(/[oO]/)) {
+          source.eatWhile(octitRE); // should require at least 1
+          return "number";
+        }
+      }
+      source.eatWhile(digitRE);
+      var t = "number";
+      if (source.match(/^\.\d+/)) {
+        t = "number";
+      }
+      if (source.eat(/[eE]/)) {
+        t = "number";
+        source.eat(/[-+]/);
+        source.eatWhile(digitRE); // should require at least 1
+      }
+      return t;
+    }
+
+    if (ch == "." && source.eat("."))
+      return "keyword";
+
+    if (symbolRE.test(ch)) {
+      if (ch == '-' && source.eat(/-/)) {
+        source.eatWhile(/-/);
+        if (!source.eat(symbolRE)) {
+          source.skipToEnd();
+          return "comment";
+        }
+      }
+      var t = "variable";
+      if (ch == ':') {
+        t = "variable-2";
+      }
+      source.eatWhile(symbolRE);
+      return t;
+    }
+
+    return "error";
+  }
+
+  function ncomment(type, nest) {
+    if (nest == 0) {
+      return normal;
+    }
+    return function(source, setState) {
+      var currNest = nest;
+      while (!source.eol()) {
+        var ch = source.next();
+        if (ch == '{' && source.eat('-')) {
+          ++currNest;
+        }
+        else if (ch == '-' && source.eat('}')) {
+          --currNest;
+          if (currNest == 0) {
+            setState(normal);
+            return type;
+          }
+        }
+      }
+      setState(ncomment(type, currNest));
+      return type;
+    };
+  }
+
+  function stringLiteral(source, setState) {
+    while (!source.eol()) {
+      var ch = source.next();
+      if (ch == '"') {
+        setState(normal);
+        return "string";
+      }
+      if (ch == '\\') {
+        if (source.eol() || source.eat(whiteCharRE)) {
+          setState(stringGap);
+          return "string";
+        }
+        if (source.eat('&')) {
+        }
+        else {
+          source.next(); // should handle other escapes here
+        }
+      }
+    }
+    setState(normal);
+    return "string error";
+  }
+
+  function stringGap(source, setState) {
+    if (source.eat('\\')) {
+      return switchState(source, setState, stringLiteral);
+    }
+    source.next();
+    setState(normal);
+    return "error";
+  }
+
+
+  var wellKnownWords = (function() {
+    var wkw = {};
+    function setType(t) {
+      return function () {
+        for (var i = 0; i < arguments.length; i++)
+          wkw[arguments[i]] = t;
+      };
+    }
+
+    setType("keyword")(
+      "case", "class", "data", "default", "deriving", "do", "else", "foreign",
+      "if", "import", "in", "infix", "infixl", "infixr", "instance", "let",
+      "module", "newtype", "of", "then", "type", "where", "_");
+
+    setType("keyword")(
+      "\.\.", ":", "::", "=", "\\", "<-", "->", "@", "~", "=>");
+
+    setType("builtin")(
+      "!!", "$!", "$", "&&", "+", "++", "-", ".", "/", "/=", "<", "<*", "<=",
+      "<$>", "<*>", "=<<", "==", ">", ">=", ">>", ">>=", "^", "^^", "||", "*",
+      "*>", "**");
+
+    setType("builtin")(
+      "Applicative", "Bool", "Bounded", "Char", "Double", "EQ", "Either", "Enum",
+      "Eq", "False", "FilePath", "Float", "Floating", "Fractional", "Functor",
+      "GT", "IO", "IOError", "Int", "Integer", "Integral", "Just", "LT", "Left",
+      "Maybe", "Monad", "Nothing", "Num", "Ord", "Ordering", "Rational", "Read",
+      "ReadS", "Real", "RealFloat", "RealFrac", "Right", "Show", "ShowS",
+      "String", "True");
+
+    setType("builtin")(
+      "abs", "acos", "acosh", "all", "and", "any", "appendFile", "asTypeOf",
+      "asin", "asinh", "atan", "atan2", "atanh", "break", "catch", "ceiling",
+      "compare", "concat", "concatMap", "const", "cos", "cosh", "curry",
+      "cycle", "decodeFloat", "div", "divMod", "drop", "dropWhile", "either",
+      "elem", "encodeFloat", "enumFrom", "enumFromThen", "enumFromThenTo",
+      "enumFromTo", "error", "even", "exp", "exponent", "fail", "filter",
+      "flip", "floatDigits", "floatRadix", "floatRange", "floor", "fmap",
+      "foldl", "foldl1", "foldr", "foldr1", "fromEnum", "fromInteger",
+      "fromIntegral", "fromRational", "fst", "gcd", "getChar", "getContents",
+      "getLine", "head", "id", "init", "interact", "ioError", "isDenormalized",
+      "isIEEE", "isInfinite", "isNaN", "isNegativeZero", "iterate", "last",
+      "lcm", "length", "lex", "lines", "log", "logBase", "lookup", "map",
+      "mapM", "mapM_", "max", "maxBound", "maximum", "maybe", "min", "minBound",
+      "minimum", "mod", "negate", "not", "notElem", "null", "odd", "or",
+      "otherwise", "pi", "pred", "print", "product", "properFraction", "pure",
+      "putChar", "putStr", "putStrLn", "quot", "quotRem", "read", "readFile",
+      "readIO", "readList", "readLn", "readParen", "reads", "readsPrec",
+      "realToFrac", "recip", "rem", "repeat", "replicate", "return", "reverse",
+      "round", "scaleFloat", "scanl", "scanl1", "scanr", "scanr1", "seq",
+      "sequence", "sequence_", "show", "showChar", "showList", "showParen",
+      "showString", "shows", "showsPrec", "significand", "signum", "sin",
+      "sinh", "snd", "span", "splitAt", "sqrt", "subtract", "succ", "sum",
+      "tail", "take", "takeWhile", "tan", "tanh", "toEnum", "toInteger",
+      "toRational", "truncate", "uncurry", "undefined", "unlines", "until",
+      "unwords", "unzip", "unzip3", "userError", "words", "writeFile", "zip",
+      "zip3", "zipWith", "zipWith3");
+
+    var override = modeConfig.overrideKeywords;
+    if (override) for (var word in override) if (override.hasOwnProperty(word))
+      wkw[word] = override[word];
+
+    return wkw;
+  })();
+
+
+
+  return {
+    startState: function ()  { return { f: normal }; },
+    copyState:  function (s) { return { f: s.f }; },
+
+    token: function(stream, state) {
+      var t = state.f(stream, function(s) { state.f = s; });
+      var w = stream.current();
+      return wellKnownWords.hasOwnProperty(w) ? wellKnownWords[w] : t;
+    },
+
+    blockCommentStart: "{-",
+    blockCommentEnd: "-}",
+    lineComment: "--"
+  };
+
+});
+
+CodeMirror.defineMIME("text/x-haskell", "haskell");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haskell/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,73 @@
+<!doctype html>
+
+<title>CodeMirror: Haskell mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/elegant.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="haskell.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Haskell</a>
+  </ul>
+</div>
+
+<article>
+<h2>Haskell mode</h2>
+<form><textarea id="code" name="code">
+module UniquePerms (
+    uniquePerms
+    )
+where
+
+-- | Find all unique permutations of a list where there might be duplicates.
+uniquePerms :: (Eq a) => [a] -> [[a]]
+uniquePerms = permBag . makeBag
+
+-- | An unordered collection where duplicate values are allowed,
+-- but represented with a single value and a count.
+type Bag a = [(a, Int)]
+
+makeBag :: (Eq a) => [a] -> Bag a
+makeBag [] = []
+makeBag (a:as) = mix a $ makeBag as
+  where
+    mix a []                        = [(a,1)]
+    mix a (bn@(b,n):bs) | a == b    = (b,n+1):bs
+                        | otherwise = bn : mix a bs
+
+permBag :: Bag a -> [[a]]
+permBag [] = [[]]
+permBag bs = concatMap (\(f,cs) -> map (f:) $ permBag cs) . oneOfEach $ bs
+  where
+    oneOfEach [] = []
+    oneOfEach (an@(a,n):bs) =
+        let bs' = if n == 1 then bs else (a,n-1):bs
+        in (a,bs') : mapSnd (an:) (oneOfEach bs)
+    
+    apSnd f (a,b) = (a, f b)
+    mapSnd = map . apSnd
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        theme: "elegant"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-haskell</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haxe/haxe.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,515 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("haxe", function(config, parserConfig) {
+  var indentUnit = config.indentUnit;
+
+  // Tokenizer
+
+  function kw(type) {return {type: type, style: "keyword"};}
+  var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
+  var operator = kw("operator"), atom = {type: "atom", style: "atom"}, attribute = {type:"attribute", style: "attribute"};
+  var type = kw("typedef");
+  var keywords = {
+    "if": A, "while": A, "else": B, "do": B, "try": B,
+    "return": C, "break": C, "continue": C, "new": C, "throw": C,
+    "var": kw("var"), "inline":attribute, "static": attribute, "using":kw("import"),
+    "public": attribute, "private": attribute, "cast": kw("cast"), "import": kw("import"), "macro": kw("macro"),
+    "function": kw("function"), "catch": kw("catch"), "untyped": kw("untyped"), "callback": kw("cb"),
+    "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
+    "in": operator, "never": kw("property_access"), "trace":kw("trace"),
+    "class": type, "abstract":type, "enum":type, "interface":type, "typedef":type, "extends":type, "implements":type, "dynamic":type,
+    "true": atom, "false": atom, "null": atom
+  };
+
+  var isOperatorChar = /[+\-*&%=<>!?|]/;
+
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+
+  function toUnescaped(stream, end) {
+    var escaped = false, next;
+    while ((next = stream.next()) != null) {
+      if (next == end && !escaped)
+        return true;
+      escaped = !escaped && next == "\\";
+    }
+  }
+
+  // Used as scratch variables to communicate multiple values without
+  // consing up tons of objects.
+  var type, content;
+  function ret(tp, style, cont) {
+    type = tp; content = cont;
+    return style;
+  }
+
+  function haxeTokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == '"' || ch == "'") {
+      return chain(stream, state, haxeTokenString(ch));
+    } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      return ret(ch);
+    } else if (ch == "0" && stream.eat(/x/i)) {
+      stream.eatWhile(/[\da-f]/i);
+      return ret("number", "number");
+    } else if (/\d/.test(ch) || ch == "-" && stream.eat(/\d/)) {
+      stream.match(/^\d*(?:\.\d*(?!\.))?(?:[eE][+\-]?\d+)?/);
+      return ret("number", "number");
+    } else if (state.reAllowed && (ch == "~" && stream.eat(/\//))) {
+      toUnescaped(stream, "/");
+      stream.eatWhile(/[gimsu]/);
+      return ret("regexp", "string-2");
+    } else if (ch == "/") {
+      if (stream.eat("*")) {
+        return chain(stream, state, haxeTokenComment);
+      } else if (stream.eat("/")) {
+        stream.skipToEnd();
+        return ret("comment", "comment");
+      } else {
+        stream.eatWhile(isOperatorChar);
+        return ret("operator", null, stream.current());
+      }
+    } else if (ch == "#") {
+        stream.skipToEnd();
+        return ret("conditional", "meta");
+    } else if (ch == "@") {
+      stream.eat(/:/);
+      stream.eatWhile(/[\w_]/);
+      return ret ("metadata", "meta");
+    } else if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return ret("operator", null, stream.current());
+    } else {
+      var word;
+      if(/[A-Z]/.test(ch)) {
+        stream.eatWhile(/[\w_<>]/);
+        word = stream.current();
+        return ret("type", "variable-3", word);
+      } else {
+        stream.eatWhile(/[\w_]/);
+        var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
+        return (known && state.kwAllowed) ? ret(known.type, known.style, word) :
+                       ret("variable", "variable", word);
+      }
+    }
+  }
+
+  function haxeTokenString(quote) {
+    return function(stream, state) {
+      if (toUnescaped(stream, quote))
+        state.tokenize = haxeTokenBase;
+      return ret("string", "string");
+    };
+  }
+
+  function haxeTokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = haxeTokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return ret("comment", "comment");
+  }
+
+  // Parser
+
+  var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true};
+
+  function HaxeLexical(indented, column, type, align, prev, info) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.prev = prev;
+    this.info = info;
+    if (align != null) this.align = align;
+  }
+
+  function inScope(state, varname) {
+    for (var v = state.localVars; v; v = v.next)
+      if (v.name == varname) return true;
+  }
+
+  function parseHaxe(state, style, type, content, stream) {
+    var cc = state.cc;
+    // Communicate our context to the combinators.
+    // (Less wasteful than consing up a hundred closures on every call.)
+    cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
+
+    if (!state.lexical.hasOwnProperty("align"))
+      state.lexical.align = true;
+
+    while(true) {
+      var combinator = cc.length ? cc.pop() : statement;
+      if (combinator(type, content)) {
+        while(cc.length && cc[cc.length - 1].lex)
+          cc.pop()();
+        if (cx.marked) return cx.marked;
+        if (type == "variable" && inScope(state, content)) return "variable-2";
+        if (type == "variable" && imported(state, content)) return "variable-3";
+        return style;
+      }
+    }
+  }
+
+  function imported(state, typename) {
+    if (/[a-z]/.test(typename.charAt(0)))
+      return false;
+    var len = state.importedtypes.length;
+    for (var i = 0; i<len; i++)
+      if(state.importedtypes[i]==typename) return true;
+  }
+
+  function registerimport(importname) {
+    var state = cx.state;
+    for (var t = state.importedtypes; t; t = t.next)
+      if(t.name == importname) return;
+    state.importedtypes = { name: importname, next: state.importedtypes };
+  }
+  // Combinator utils
+
+  var cx = {state: null, column: null, marked: null, cc: null};
+  function pass() {
+    for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
+  }
+  function cont() {
+    pass.apply(null, arguments);
+    return true;
+  }
+  function inList(name, list) {
+    for (var v = list; v; v = v.next)
+      if (v.name == name) return true;
+    return false;
+  }
+  function register(varname) {
+    var state = cx.state;
+    if (state.context) {
+      cx.marked = "def";
+      if (inList(varname, state.localVars)) return;
+      state.localVars = {name: varname, next: state.localVars};
+    } else if (state.globalVars) {
+      if (inList(varname, state.globalVars)) return;
+      state.globalVars = {name: varname, next: state.globalVars};
+    }
+  }
+
+  // Combinators
+
+  var defaultVars = {name: "this", next: null};
+  function pushcontext() {
+    if (!cx.state.context) cx.state.localVars = defaultVars;
+    cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
+  }
+  function popcontext() {
+    cx.state.localVars = cx.state.context.vars;
+    cx.state.context = cx.state.context.prev;
+  }
+  popcontext.lex = true;
+  function pushlex(type, info) {
+    var result = function() {
+      var state = cx.state;
+      state.lexical = new HaxeLexical(state.indented, cx.stream.column(), type, null, state.lexical, info);
+    };
+    result.lex = true;
+    return result;
+  }
+  function poplex() {
+    var state = cx.state;
+    if (state.lexical.prev) {
+      if (state.lexical.type == ")")
+        state.indented = state.lexical.indented;
+      state.lexical = state.lexical.prev;
+    }
+  }
+  poplex.lex = true;
+
+  function expect(wanted) {
+    function f(type) {
+      if (type == wanted) return cont();
+      else if (wanted == ";") return pass();
+      else return cont(f);
+    }
+    return f;
+  }
+
+  function statement(type) {
+    if (type == "@") return cont(metadef);
+    if (type == "var") return cont(pushlex("vardef"), vardef1, expect(";"), poplex);
+    if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
+    if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
+    if (type == "{") return cont(pushlex("}"), pushcontext, block, poplex, popcontext);
+    if (type == ";") return cont();
+    if (type == "attribute") return cont(maybeattribute);
+    if (type == "function") return cont(functiondef);
+    if (type == "for") return cont(pushlex("form"), expect("("), pushlex(")"), forspec1, expect(")"),
+                                   poplex, statement, poplex);
+    if (type == "variable") return cont(pushlex("stat"), maybelabel);
+    if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
+                                      block, poplex, poplex);
+    if (type == "case") return cont(expression, expect(":"));
+    if (type == "default") return cont(expect(":"));
+    if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
+                                     statement, poplex, popcontext);
+    if (type == "import") return cont(importdef, expect(";"));
+    if (type == "typedef") return cont(typedef);
+    return pass(pushlex("stat"), expression, expect(";"), poplex);
+  }
+  function expression(type) {
+    if (atomicTypes.hasOwnProperty(type)) return cont(maybeoperator);
+    if (type == "type" ) return cont(maybeoperator);
+    if (type == "function") return cont(functiondef);
+    if (type == "keyword c") return cont(maybeexpression);
+    if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeoperator);
+    if (type == "operator") return cont(expression);
+    if (type == "[") return cont(pushlex("]"), commasep(maybeexpression, "]"), poplex, maybeoperator);
+    if (type == "{") return cont(pushlex("}"), commasep(objprop, "}"), poplex, maybeoperator);
+    return cont();
+  }
+  function maybeexpression(type) {
+    if (type.match(/[;\}\)\],]/)) return pass();
+    return pass(expression);
+  }
+
+  function maybeoperator(type, value) {
+    if (type == "operator" && /\+\+|--/.test(value)) return cont(maybeoperator);
+    if (type == "operator" || type == ":") return cont(expression);
+    if (type == ";") return;
+    if (type == "(") return cont(pushlex(")"), commasep(expression, ")"), poplex, maybeoperator);
+    if (type == ".") return cont(property, maybeoperator);
+    if (type == "[") return cont(pushlex("]"), expression, expect("]"), poplex, maybeoperator);
+  }
+
+  function maybeattribute(type) {
+    if (type == "attribute") return cont(maybeattribute);
+    if (type == "function") return cont(functiondef);
+    if (type == "var") return cont(vardef1);
+  }
+
+  function metadef(type) {
+    if(type == ":") return cont(metadef);
+    if(type == "variable") return cont(metadef);
+    if(type == "(") return cont(pushlex(")"), commasep(metaargs, ")"), poplex, statement);
+  }
+  function metaargs(type) {
+    if(type == "variable") return cont();
+  }
+
+  function importdef (type, value) {
+    if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
+    else if(type == "variable" || type == "property" || type == "." || value == "*") return cont(importdef);
+  }
+
+  function typedef (type, value)
+  {
+    if(type == "variable" && /[A-Z]/.test(value.charAt(0))) { registerimport(value); return cont(); }
+    else if (type == "type" && /[A-Z]/.test(value.charAt(0))) { return cont(); }
+  }
+
+  function maybelabel(type) {
+    if (type == ":") return cont(poplex, statement);
+    return pass(maybeoperator, expect(";"), poplex);
+  }
+  function property(type) {
+    if (type == "variable") {cx.marked = "property"; return cont();}
+  }
+  function objprop(type) {
+    if (type == "variable") cx.marked = "property";
+    if (atomicTypes.hasOwnProperty(type)) return cont(expect(":"), expression);
+  }
+  function commasep(what, end) {
+    function proceed(type) {
+      if (type == ",") return cont(what, proceed);
+      if (type == end) return cont();
+      return cont(expect(end));
+    }
+    return function(type) {
+      if (type == end) return cont();
+      else return pass(what, proceed);
+    };
+  }
+  function block(type) {
+    if (type == "}") return cont();
+    return pass(statement, block);
+  }
+  function vardef1(type, value) {
+    if (type == "variable"){register(value); return cont(typeuse, vardef2);}
+    return cont();
+  }
+  function vardef2(type, value) {
+    if (value == "=") return cont(expression, vardef2);
+    if (type == ",") return cont(vardef1);
+  }
+  function forspec1(type, value) {
+    if (type == "variable") {
+      register(value);
+      return cont(forin, expression)
+    } else {
+      return pass()
+    }
+  }
+  function forin(_type, value) {
+    if (value == "in") return cont();
+  }
+  function functiondef(type, value) {
+    //function names starting with upper-case letters are recognised as types, so cludging them together here.
+    if (type == "variable" || type == "type") {register(value); return cont(functiondef);}
+    if (value == "new") return cont(functiondef);
+    if (type == "(") return cont(pushlex(")"), pushcontext, commasep(funarg, ")"), poplex, typeuse, statement, popcontext);
+  }
+  function typeuse(type) {
+    if(type == ":") return cont(typestring);
+  }
+  function typestring(type) {
+    if(type == "type") return cont();
+    if(type == "variable") return cont();
+    if(type == "{") return cont(pushlex("}"), commasep(typeprop, "}"), poplex);
+  }
+  function typeprop(type) {
+    if(type == "variable") return cont(typeuse);
+  }
+  function funarg(type, value) {
+    if (type == "variable") {register(value); return cont(typeuse);}
+  }
+
+  // Interface
+  return {
+    startState: function(basecolumn) {
+      var defaulttypes = ["Int", "Float", "String", "Void", "Std", "Bool", "Dynamic", "Array"];
+      var state = {
+        tokenize: haxeTokenBase,
+        reAllowed: true,
+        kwAllowed: true,
+        cc: [],
+        lexical: new HaxeLexical((basecolumn || 0) - indentUnit, 0, "block", false),
+        localVars: parserConfig.localVars,
+        importedtypes: defaulttypes,
+        context: parserConfig.localVars && {vars: parserConfig.localVars},
+        indented: 0
+      };
+      if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
+        state.globalVars = parserConfig.globalVars;
+      return state;
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (!state.lexical.hasOwnProperty("align"))
+          state.lexical.align = false;
+        state.indented = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      if (type == "comment") return style;
+      state.reAllowed = !!(type == "operator" || type == "keyword c" || type.match(/^[\[{}\(,;:]$/));
+      state.kwAllowed = type != '.';
+      return parseHaxe(state, style, type, content, stream);
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != haxeTokenBase) return 0;
+      var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
+      if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
+      var type = lexical.type, closing = firstChar == type;
+      if (type == "vardef") return lexical.indented + 4;
+      else if (type == "form" && firstChar == "{") return lexical.indented;
+      else if (type == "stat" || type == "form") return lexical.indented + indentUnit;
+      else if (lexical.info == "switch" && !closing)
+        return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
+      else if (lexical.align) return lexical.column + (closing ? 0 : 1);
+      else return lexical.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: "{}",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//"
+  };
+});
+
+CodeMirror.defineMIME("text/x-haxe", "haxe");
+
+CodeMirror.defineMode("hxml", function () {
+
+  return {
+    startState: function () {
+      return {
+        define: false,
+        inString: false
+      };
+    },
+    token: function (stream, state) {
+      var ch = stream.peek();
+      var sol = stream.sol();
+
+      ///* comments */
+      if (ch == "#") {
+        stream.skipToEnd();
+        return "comment";
+      }
+      if (sol && ch == "-") {
+        var style = "variable-2";
+
+        stream.eat(/-/);
+
+        if (stream.peek() == "-") {
+          stream.eat(/-/);
+          style = "keyword a";
+        }
+
+        if (stream.peek() == "D") {
+          stream.eat(/[D]/);
+          style = "keyword c";
+          state.define = true;
+        }
+
+        stream.eatWhile(/[A-Z]/i);
+        return style;
+      }
+
+      var ch = stream.peek();
+
+      if (state.inString == false && ch == "'") {
+        state.inString = true;
+        stream.next();
+      }
+
+      if (state.inString == true) {
+        if (stream.skipTo("'")) {
+
+        } else {
+          stream.skipToEnd();
+        }
+
+        if (stream.peek() == "'") {
+          stream.next();
+          state.inString = false;
+        }
+
+        return "string";
+      }
+
+      stream.next();
+      return null;
+    },
+    lineComment: "#"
+  };
+});
+
+CodeMirror.defineMIME("text/x-hxml", "hxml");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/haxe/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,124 @@
+<!doctype html>
+
+<title>CodeMirror: Haxe mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="haxe.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Haxe</a>
+  </ul>
+</div>
+
+<article>
+<h2>Haxe mode</h2>
+
+
+<div><p><textarea id="code-haxe" name="code">
+import one.two.Three;
+
+@attr("test")
+class Foo&lt;T&gt; extends Three
+{
+	public function new()
+	{
+		noFoo = 12;
+	}
+	
+	public static inline function doFoo(obj:{k:Int, l:Float}):Int
+	{
+		for(i in 0...10)
+		{
+			obj.k++;
+			trace(i);
+			var var1 = new Array();
+			if(var1.length > 1)
+				throw "Error";
+		}
+		// The following line should not be colored, the variable is scoped out
+		var1;
+		/* Multi line
+		 * Comment test
+		 */
+		return obj.k;
+	}
+	private function bar():Void
+	{
+		#if flash
+		var t1:String = "1.21";
+		#end
+		try {
+			doFoo({k:3, l:1.2});
+		}
+		catch (e : String) {
+			trace(e);
+		}
+		var t2:Float = cast(3.2);
+		var t3:haxe.Timer = new haxe.Timer();
+		var t4 = {k:Std.int(t2), l:Std.parseFloat(t1)};
+		var t5 = ~/123+.*$/i;
+		doFoo(t4);
+		untyped t1 = 4;
+		bob = new Foo&lt;Int&gt;
+	}
+	public var okFoo(default, never):Float;
+	var noFoo(getFoo, null):Int;
+	function getFoo():Int {
+		return noFoo;
+	}
+	
+	public var three:Int;
+}
+enum Color
+{
+	red;
+	green;
+	blue;
+	grey( v : Int );
+	rgb (r:Int,g:Int,b:Int);
+}
+</textarea></p>
+
+<p>Hxml mode:</p>
+
+<p><textarea id="code-hxml">
+-cp test
+-js path/to/file.js
+#-remap nme:flash
+--next
+-D source-map-content
+-cmd 'test'
+-lib lime
+</textarea></p>
+</div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code-haxe"), {
+      	mode: "haxe",
+        lineNumbers: true,
+        indentUnit: 4,
+        indentWithTabs: true
+      });
+      
+      editor = CodeMirror.fromTextArea(document.getElementById("code-hxml"), {
+      	mode: "hxml",
+        lineNumbers: true,
+        indentUnit: 4,
+        indentWithTabs: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-haxe, text/x-hxml</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/htmlembedded/htmlembedded.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,37 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
+        require("../../addon/mode/multiplex"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
+            "../../addon/mode/multiplex"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineMode("htmlembedded", function(config, parserConfig) {
+    var closeComment = parserConfig.closeComment || "--%>"
+    return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), {
+      open: parserConfig.openComment || "<%--",
+      close: closeComment,
+      delimStyle: "comment",
+      mode: {token: function(stream) {
+        stream.skipTo(closeComment) || stream.skipToEnd()
+        return "comment"
+      }}
+    }, {
+      open: parserConfig.open || parserConfig.scriptStartRegex || "<%",
+      close: parserConfig.close || parserConfig.scriptEndRegex || "%>",
+      mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec)
+    });
+  }, "htmlmixed");
+
+  CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"});
+  CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"});
+  CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"});
+  CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"});
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/htmlembedded/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,60 @@
+<!doctype html>
+
+<title>CodeMirror: Html Embedded Scripts mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../../addon/mode/multiplex.js"></script>
+<script src="htmlembedded.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Html Embedded Scripts</a>
+  </ul>
+</div>
+
+<article>
+<h2>Html Embedded Scripts mode</h2>
+<form><textarea id="code" name="code">
+<%
+function hello(who) {
+	return "Hello " + who;
+}
+%>
+This is an example of EJS (embedded javascript)
+<p>The program says <%= hello("world") %>.</p>
+<script>
+	alert("And here is some normal JS code"); // also colored
+</script>
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "application/x-ejs",
+        indentUnit: 4,
+        indentWithTabs: true
+      });
+    </script>
+
+    <p>Mode for html embedded scripts like JSP and ASP.NET. Depends on multiplex and HtmlMixed which in turn depends on
+    JavaScript, CSS and XML.<br />Other dependencies include those of the scripting language chosen.</p>
+
+    <p><strong>MIME types defined:</strong> <code>application/x-aspx</code> (ASP.NET),
+    <code>application/x-ejs</code> (Embedded JavaScript), <code>application/x-jsp</code> (JavaServer Pages)
+    and <code>application/x-erb</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/htmlmixed/htmlmixed.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,153 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"), require("../css/css"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript", "../css/css"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var defaultTags = {
+    script: [
+      ["lang", /(javascript|babel)/i, "javascript"],
+      ["type", /^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, "javascript"],
+      ["type", /./, "text/plain"],
+      [null, null, "javascript"]
+    ],
+    style:  [
+      ["lang", /^css$/i, "css"],
+      ["type", /^(text\/)?(x-)?(stylesheet|css)$/i, "css"],
+      ["type", /./, "text/plain"],
+      [null, null, "css"]
+    ]
+  };
+
+  function maybeBackup(stream, pat, style) {
+    var cur = stream.current(), close = cur.search(pat);
+    if (close > -1) {
+      stream.backUp(cur.length - close);
+    } else if (cur.match(/<\/?$/)) {
+      stream.backUp(cur.length);
+      if (!stream.match(pat, false)) stream.match(cur);
+    }
+    return style;
+  }
+
+  var attrRegexpCache = {};
+  function getAttrRegexp(attr) {
+    var regexp = attrRegexpCache[attr];
+    if (regexp) return regexp;
+    return attrRegexpCache[attr] = new RegExp("\\s+" + attr + "\\s*=\\s*('|\")?([^'\"]+)('|\")?\\s*");
+  }
+
+  function getAttrValue(text, attr) {
+    var match = text.match(getAttrRegexp(attr))
+    return match ? /^\s*(.*?)\s*$/.exec(match[2])[1] : ""
+  }
+
+  function getTagRegexp(tagName, anchored) {
+    return new RegExp((anchored ? "^" : "") + "<\/\\s*" + tagName + "\\s*>", "i");
+  }
+
+  function addTags(from, to) {
+    for (var tag in from) {
+      var dest = to[tag] || (to[tag] = []);
+      var source = from[tag];
+      for (var i = source.length - 1; i >= 0; i--)
+        dest.unshift(source[i])
+    }
+  }
+
+  function findMatchingMode(tagInfo, tagText) {
+    for (var i = 0; i < tagInfo.length; i++) {
+      var spec = tagInfo[i];
+      if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];
+    }
+  }
+
+  CodeMirror.defineMode("htmlmixed", function (config, parserConfig) {
+    var htmlMode = CodeMirror.getMode(config, {
+      name: "xml",
+      htmlMode: true,
+      multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,
+      multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag,
+      allowMissingTagName: parserConfig.allowMissingTagName,
+    });
+
+    var tags = {};
+    var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;
+    addTags(defaultTags, tags);
+    if (configTags) addTags(configTags, tags);
+    if (configScript) for (var i = configScript.length - 1; i >= 0; i--)
+      tags.script.unshift(["type", configScript[i].matches, configScript[i].mode])
+
+    function html(stream, state) {
+      var style = htmlMode.token(stream, state.htmlState), tag = /\btag\b/.test(style), tagName
+      if (tag && !/[<>\s\/]/.test(stream.current()) &&
+          (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&
+          tags.hasOwnProperty(tagName)) {
+        state.inTag = tagName + " "
+      } else if (state.inTag && tag && />$/.test(stream.current())) {
+        var inTag = /^([\S]+) (.*)/.exec(state.inTag)
+        state.inTag = null
+        var modeSpec = stream.current() == ">" && findMatchingMode(tags[inTag[1]], inTag[2])
+        var mode = CodeMirror.getMode(config, modeSpec)
+        var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);
+        state.token = function (stream, state) {
+          if (stream.match(endTagA, false)) {
+            state.token = html;
+            state.localState = state.localMode = null;
+            return null;
+          }
+          return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));
+        };
+        state.localMode = mode;
+        state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, "", ""));
+      } else if (state.inTag) {
+        state.inTag += stream.current()
+        if (stream.eol()) state.inTag += " "
+      }
+      return style;
+    };
+
+    return {
+      startState: function () {
+        var state = CodeMirror.startState(htmlMode);
+        return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};
+      },
+
+      copyState: function (state) {
+        var local;
+        if (state.localState) {
+          local = CodeMirror.copyState(state.localMode, state.localState);
+        }
+        return {token: state.token, inTag: state.inTag,
+                localMode: state.localMode, localState: local,
+                htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};
+      },
+
+      token: function (stream, state) {
+        return state.token(stream, state);
+      },
+
+      indent: function (state, textAfter, line) {
+        if (!state.localMode || /^\s*<\//.test(textAfter))
+          return htmlMode.indent(state.htmlState, textAfter, line);
+        else if (state.localMode.indent)
+          return state.localMode.indent(state.localState, textAfter, line);
+        else
+          return CodeMirror.Pass;
+      },
+
+      innerMode: function (state) {
+        return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};
+      }
+    };
+  }, "xml", "javascript", "css");
+
+  CodeMirror.defineMIME("text/html", "htmlmixed");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/htmlmixed/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,100 @@
+<!doctype html>
+
+<title>CodeMirror: HTML mixed mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/selection/selection-pointer.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../vbscript/vbscript.js"></script>
+<script src="htmlmixed.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">HTML mixed</a>
+  </ul>
+</div>
+
+<article>
+<h2>HTML mixed mode</h2>
+<form><textarea id="code" name="code">
+<html style="color: green">
+  <!-- this is a comment -->
+  <head>
+    <title>Mixed HTML Example</title>
+    <style>
+      h1 {font-family: comic sans; color: #f0f;}
+      div {background: yellow !important;}
+      body {
+        max-width: 50em;
+        margin: 1em 2em 1em 5em;
+      }
+    </style>
+  </head>
+  <body>
+    <h1>Mixed HTML Example</h1>
+    <script>
+      function jsFunc(arg1, arg2) {
+        if (arg1 && arg2) document.body.innerHTML = "achoo";
+      }
+    </script>
+  </body>
+</html>
+</textarea></form>
+    <script>
+      // Define an extended mixed-mode that understands vbscript and
+      // leaves mustache/handlebars embedded templates in html mode
+      var mixedMode = {
+        name: "htmlmixed",
+        scriptTypes: [{matches: /\/x-handlebars-template|\/x-mustache/i,
+                       mode: null},
+                      {matches: /(text|application)\/(x-)?vb(a|script)/i,
+                       mode: "vbscript"}]
+      };
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: mixedMode,
+        selectionPointer: true
+      });
+    </script>
+
+    <p>The HTML mixed mode depends on the XML, JavaScript, and CSS modes.</p>
+
+    <p>It takes an optional mode configuration
+    option, <code>tags</code>, which can be used to add custom
+    behavior for specific tags. When given, it should be an object
+    mapping tag names (for example <code>script</code>) to arrays or
+    three-element arrays. Those inner arrays indicate [attributeName,
+    valueRegexp, <a href="../../doc/manual.html#option_mode">modeSpec</a>]
+    specifications. For example, you could use <code>["type", /^foo$/,
+    "foo"]</code> to map the attribute <code>type="foo"</code> to
+    the <code>foo</code> mode. When the first two fields are null
+    (<code>[null, null, "mode"]</code>), the given mode is used for
+    any such tag that doesn't match any of the previously given
+    attributes. For example:</p>
+
+    <pre>var myModeSpec = {
+  name: "htmlmixed",
+  tags: {
+    style: [["type", /^text\/(x-)?scss$/, "text/x-scss"],
+            [null, null, "css"]],
+    custom: [[null, null, "customMode"]]
+  }
+}</pre>
+
+    <p><strong>MIME types defined:</strong> <code>text/html</code>
+    (redefined, only takes effect if you load this parser after the
+    XML parser).</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/http/http.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,113 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("http", function() {
+  function failFirstLine(stream, state) {
+    stream.skipToEnd();
+    state.cur = header;
+    return "error";
+  }
+
+  function start(stream, state) {
+    if (stream.match(/^HTTP\/\d\.\d/)) {
+      state.cur = responseStatusCode;
+      return "keyword";
+    } else if (stream.match(/^[A-Z]+/) && /[ \t]/.test(stream.peek())) {
+      state.cur = requestPath;
+      return "keyword";
+    } else {
+      return failFirstLine(stream, state);
+    }
+  }
+
+  function responseStatusCode(stream, state) {
+    var code = stream.match(/^\d+/);
+    if (!code) return failFirstLine(stream, state);
+
+    state.cur = responseStatusText;
+    var status = Number(code[0]);
+    if (status >= 100 && status < 200) {
+      return "positive informational";
+    } else if (status >= 200 && status < 300) {
+      return "positive success";
+    } else if (status >= 300 && status < 400) {
+      return "positive redirect";
+    } else if (status >= 400 && status < 500) {
+      return "negative client-error";
+    } else if (status >= 500 && status < 600) {
+      return "negative server-error";
+    } else {
+      return "error";
+    }
+  }
+
+  function responseStatusText(stream, state) {
+    stream.skipToEnd();
+    state.cur = header;
+    return null;
+  }
+
+  function requestPath(stream, state) {
+    stream.eatWhile(/\S/);
+    state.cur = requestProtocol;
+    return "string-2";
+  }
+
+  function requestProtocol(stream, state) {
+    if (stream.match(/^HTTP\/\d\.\d$/)) {
+      state.cur = header;
+      return "keyword";
+    } else {
+      return failFirstLine(stream, state);
+    }
+  }
+
+  function header(stream) {
+    if (stream.sol() && !stream.eat(/[ \t]/)) {
+      if (stream.match(/^.*?:/)) {
+        return "atom";
+      } else {
+        stream.skipToEnd();
+        return "error";
+      }
+    } else {
+      stream.skipToEnd();
+      return "string";
+    }
+  }
+
+  function body(stream) {
+    stream.skipToEnd();
+    return null;
+  }
+
+  return {
+    token: function(stream, state) {
+      var cur = state.cur;
+      if (cur != header && cur != body && stream.eatSpace()) return null;
+      return cur(stream, state);
+    },
+
+    blankLine: function(state) {
+      state.cur = body;
+    },
+
+    startState: function() {
+      return {cur: start};
+    }
+  };
+});
+
+CodeMirror.defineMIME("message/http", "http");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/http/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,45 @@
+<!doctype html>
+
+<title>CodeMirror: HTTP mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="http.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">HTTP</a>
+  </ul>
+</div>
+
+<article>
+<h2>HTTP mode</h2>
+
+
+<div><textarea id="code" name="code">
+POST /somewhere HTTP/1.1
+Host: example.com
+If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
+Content-Type: application/x-www-form-urlencoded;
+	charset=utf-8
+User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
+
+This is the request body!
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>message/http</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/idl/idl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,290 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  function wordRegexp(words) {
+    return new RegExp('^((' + words.join(')|(') + '))\\b', 'i');
+  };
+
+  var builtinArray = [
+    'a_correlate', 'abs', 'acos', 'adapt_hist_equal', 'alog',
+    'alog2', 'alog10', 'amoeba', 'annotate', 'app_user_dir',
+    'app_user_dir_query', 'arg_present', 'array_equal', 'array_indices',
+    'arrow', 'ascii_template', 'asin', 'assoc', 'atan',
+    'axis', 'axis', 'bandpass_filter', 'bandreject_filter', 'barplot',
+    'bar_plot', 'beseli', 'beselj', 'beselk', 'besely',
+    'beta', 'biginteger', 'bilinear', 'bin_date', 'binary_template',
+    'bindgen', 'binomial', 'bit_ffs', 'bit_population', 'blas_axpy',
+    'blk_con', 'boolarr', 'boolean', 'boxplot', 'box_cursor',
+    'breakpoint', 'broyden', 'bubbleplot', 'butterworth', 'bytarr',
+    'byte', 'byteorder', 'bytscl', 'c_correlate', 'calendar',
+    'caldat', 'call_external', 'call_function', 'call_method',
+    'call_procedure', 'canny', 'catch', 'cd', 'cdf', 'ceil',
+    'chebyshev', 'check_math', 'chisqr_cvf', 'chisqr_pdf', 'choldc',
+    'cholsol', 'cindgen', 'cir_3pnt', 'clipboard', 'close',
+    'clust_wts', 'cluster', 'cluster_tree', 'cmyk_convert', 'code_coverage',
+    'color_convert', 'color_exchange', 'color_quan', 'color_range_map',
+    'colorbar', 'colorize_sample', 'colormap_applicable',
+    'colormap_gradient', 'colormap_rotation', 'colortable',
+    'comfit', 'command_line_args', 'common', 'compile_opt', 'complex',
+    'complexarr', 'complexround', 'compute_mesh_normals', 'cond', 'congrid',
+    'conj', 'constrained_min', 'contour', 'contour', 'convert_coord',
+    'convol', 'convol_fft', 'coord2to3', 'copy_lun', 'correlate',
+    'cos', 'cosh', 'cpu', 'cramer', 'createboxplotdata',
+    'create_cursor', 'create_struct', 'create_view', 'crossp', 'crvlength',
+    'ct_luminance', 'cti_test', 'cursor', 'curvefit', 'cv_coord',
+    'cvttobm', 'cw_animate', 'cw_animate_getp', 'cw_animate_load',
+    'cw_animate_run', 'cw_arcball', 'cw_bgroup', 'cw_clr_index',
+    'cw_colorsel', 'cw_defroi', 'cw_field', 'cw_filesel', 'cw_form',
+    'cw_fslider', 'cw_light_editor', 'cw_light_editor_get',
+    'cw_light_editor_set', 'cw_orient', 'cw_palette_editor',
+    'cw_palette_editor_get', 'cw_palette_editor_set', 'cw_pdmenu',
+    'cw_rgbslider', 'cw_tmpl', 'cw_zoom', 'db_exists',
+    'dblarr', 'dcindgen', 'dcomplex', 'dcomplexarr', 'define_key',
+    'define_msgblk', 'define_msgblk_from_file', 'defroi', 'defsysv',
+    'delvar', 'dendro_plot', 'dendrogram', 'deriv', 'derivsig',
+    'determ', 'device', 'dfpmin', 'diag_matrix', 'dialog_dbconnect',
+    'dialog_message', 'dialog_pickfile', 'dialog_printersetup',
+    'dialog_printjob', 'dialog_read_image',
+    'dialog_write_image', 'dictionary', 'digital_filter', 'dilate', 'dindgen',
+    'dissolve', 'dist', 'distance_measure', 'dlm_load', 'dlm_register',
+    'doc_library', 'double', 'draw_roi', 'edge_dog', 'efont',
+    'eigenql', 'eigenvec', 'ellipse', 'elmhes', 'emboss',
+    'empty', 'enable_sysrtn', 'eof', 'eos', 'erase',
+    'erf', 'erfc', 'erfcx', 'erode', 'errorplot',
+    'errplot', 'estimator_filter', 'execute', 'exit', 'exp',
+    'expand', 'expand_path', 'expint', 'extract', 'extract_slice',
+    'f_cvf', 'f_pdf', 'factorial', 'fft', 'file_basename',
+    'file_chmod', 'file_copy', 'file_delete', 'file_dirname',
+    'file_expand_path', 'file_gunzip', 'file_gzip', 'file_info',
+    'file_lines', 'file_link', 'file_mkdir', 'file_move',
+    'file_poll_input', 'file_readlink', 'file_same',
+    'file_search', 'file_tar', 'file_test', 'file_untar', 'file_unzip',
+    'file_which', 'file_zip', 'filepath', 'findgen', 'finite',
+    'fix', 'flick', 'float', 'floor', 'flow3',
+    'fltarr', 'flush', 'format_axis_values', 'forward_function', 'free_lun',
+    'fstat', 'fulstr', 'funct', 'function', 'fv_test',
+    'fx_root', 'fz_roots', 'gamma', 'gamma_ct', 'gauss_cvf',
+    'gauss_pdf', 'gauss_smooth', 'gauss2dfit', 'gaussfit',
+    'gaussian_function', 'gaussint', 'get_drive_list', 'get_dxf_objects',
+    'get_kbrd', 'get_login_info',
+    'get_lun', 'get_screen_size', 'getenv', 'getwindows', 'greg2jul',
+    'grib', 'grid_input', 'grid_tps', 'grid3', 'griddata',
+    'gs_iter', 'h_eq_ct', 'h_eq_int', 'hanning', 'hash',
+    'hdf', 'hdf5', 'heap_free', 'heap_gc', 'heap_nosave',
+    'heap_refcount', 'heap_save', 'help', 'hilbert', 'hist_2d',
+    'hist_equal', 'histogram', 'hls', 'hough', 'hqr',
+    'hsv', 'i18n_multibytetoutf8',
+    'i18n_multibytetowidechar', 'i18n_utf8tomultibyte',
+    'i18n_widechartomultibyte',
+    'ibeta', 'icontour', 'iconvertcoord', 'idelete', 'identity',
+    'idl_base64', 'idl_container', 'idl_validname',
+    'idlexbr_assistant', 'idlitsys_createtool',
+    'idlunit', 'iellipse', 'igamma', 'igetcurrent', 'igetdata',
+    'igetid', 'igetproperty', 'iimage', 'image', 'image_cont',
+    'image_statistics', 'image_threshold', 'imaginary', 'imap', 'indgen',
+    'int_2d', 'int_3d', 'int_tabulated', 'intarr', 'interpol',
+    'interpolate', 'interval_volume', 'invert', 'ioctl', 'iopen',
+    'ir_filter', 'iplot', 'ipolygon', 'ipolyline', 'iputdata',
+    'iregister', 'ireset', 'iresolve', 'irotate', 'isa',
+    'isave', 'iscale', 'isetcurrent', 'isetproperty', 'ishft',
+    'isocontour', 'isosurface', 'isurface', 'itext', 'itranslate',
+    'ivector', 'ivolume', 'izoom', 'journal', 'json_parse',
+    'json_serialize', 'jul2greg', 'julday', 'keyword_set', 'krig2d',
+    'kurtosis', 'kw_test', 'l64indgen', 'la_choldc', 'la_cholmprove',
+    'la_cholsol', 'la_determ', 'la_eigenproblem', 'la_eigenql', 'la_eigenvec',
+    'la_elmhes', 'la_gm_linear_model', 'la_hqr', 'la_invert',
+    'la_least_square_equality', 'la_least_squares', 'la_linear_equation',
+    'la_ludc', 'la_lumprove', 'la_lusol',
+    'la_svd', 'la_tridc', 'la_trimprove', 'la_triql', 'la_trired',
+    'la_trisol', 'label_date', 'label_region', 'ladfit', 'laguerre',
+    'lambda', 'lambdap', 'lambertw', 'laplacian', 'least_squares_filter',
+    'leefilt', 'legend', 'legendre', 'linbcg', 'lindgen',
+    'linfit', 'linkimage', 'list', 'll_arc_distance', 'lmfit',
+    'lmgr', 'lngamma', 'lnp_test', 'loadct', 'locale_get',
+    'logical_and', 'logical_or', 'logical_true', 'lon64arr', 'lonarr',
+    'long', 'long64', 'lsode', 'lu_complex', 'ludc',
+    'lumprove', 'lusol', 'm_correlate', 'machar', 'make_array',
+    'make_dll', 'make_rt', 'map', 'mapcontinents', 'mapgrid',
+    'map_2points', 'map_continents', 'map_grid', 'map_image', 'map_patch',
+    'map_proj_forward', 'map_proj_image', 'map_proj_info',
+    'map_proj_init', 'map_proj_inverse',
+    'map_set', 'matrix_multiply', 'matrix_power', 'max', 'md_test',
+    'mean', 'meanabsdev', 'mean_filter', 'median', 'memory',
+    'mesh_clip', 'mesh_decimate', 'mesh_issolid',
+    'mesh_merge', 'mesh_numtriangles',
+    'mesh_obj', 'mesh_smooth', 'mesh_surfacearea',
+    'mesh_validate', 'mesh_volume',
+    'message', 'min', 'min_curve_surf', 'mk_html_help', 'modifyct',
+    'moment', 'morph_close', 'morph_distance',
+    'morph_gradient', 'morph_hitormiss',
+    'morph_open', 'morph_thin', 'morph_tophat', 'multi', 'n_elements',
+    'n_params', 'n_tags', 'ncdf', 'newton', 'noise_hurl',
+    'noise_pick', 'noise_scatter', 'noise_slur', 'norm', 'obj_class',
+    'obj_destroy', 'obj_hasmethod', 'obj_isa', 'obj_new', 'obj_valid',
+    'objarr', 'on_error', 'on_ioerror', 'online_help', 'openr',
+    'openu', 'openw', 'oplot', 'oploterr', 'orderedhash',
+    'p_correlate', 'parse_url', 'particle_trace', 'path_cache', 'path_sep',
+    'pcomp', 'plot', 'plot3d', 'plot', 'plot_3dbox',
+    'plot_field', 'ploterr', 'plots', 'polar_contour', 'polar_surface',
+    'polyfill', 'polyshade', 'pnt_line', 'point_lun', 'polarplot',
+    'poly', 'poly_2d', 'poly_area', 'poly_fit', 'polyfillv',
+    'polygon', 'polyline', 'polywarp', 'popd', 'powell',
+    'pref_commit', 'pref_get', 'pref_set', 'prewitt', 'primes',
+    'print', 'printf', 'printd', 'pro', 'product',
+    'profile', 'profiler', 'profiles', 'project_vol', 'ps_show_fonts',
+    'psafm', 'pseudo', 'ptr_free', 'ptr_new', 'ptr_valid',
+    'ptrarr', 'pushd', 'qgrid3', 'qhull', 'qromb',
+    'qromo', 'qsimp', 'query_*', 'query_ascii', 'query_bmp',
+    'query_csv', 'query_dicom', 'query_gif', 'query_image', 'query_jpeg',
+    'query_jpeg2000', 'query_mrsid', 'query_pict', 'query_png', 'query_ppm',
+    'query_srf', 'query_tiff', 'query_video', 'query_wav', 'r_correlate',
+    'r_test', 'radon', 'randomn', 'randomu', 'ranks',
+    'rdpix', 'read', 'readf', 'read_ascii', 'read_binary',
+    'read_bmp', 'read_csv', 'read_dicom', 'read_gif', 'read_image',
+    'read_interfile', 'read_jpeg', 'read_jpeg2000', 'read_mrsid', 'read_pict',
+    'read_png', 'read_ppm', 'read_spr', 'read_srf', 'read_sylk',
+    'read_tiff', 'read_video', 'read_wav', 'read_wave', 'read_x11_bitmap',
+    'read_xwd', 'reads', 'readu', 'real_part', 'rebin',
+    'recall_commands', 'recon3', 'reduce_colors', 'reform', 'region_grow',
+    'register_cursor', 'regress', 'replicate',
+    'replicate_inplace', 'resolve_all',
+    'resolve_routine', 'restore', 'retall', 'return', 'reverse',
+    'rk4', 'roberts', 'rot', 'rotate', 'round',
+    'routine_filepath', 'routine_info', 'rs_test', 's_test', 'save',
+    'savgol', 'scale3', 'scale3d', 'scatterplot', 'scatterplot3d',
+    'scope_level', 'scope_traceback', 'scope_varfetch',
+    'scope_varname', 'search2d',
+    'search3d', 'sem_create', 'sem_delete', 'sem_lock', 'sem_release',
+    'set_plot', 'set_shading', 'setenv', 'sfit', 'shade_surf',
+    'shade_surf_irr', 'shade_volume', 'shift', 'shift_diff', 'shmdebug',
+    'shmmap', 'shmunmap', 'shmvar', 'show3', 'showfont',
+    'signum', 'simplex', 'sin', 'sindgen', 'sinh',
+    'size', 'skewness', 'skip_lun', 'slicer3', 'slide_image',
+    'smooth', 'sobel', 'socket', 'sort', 'spawn',
+    'sph_4pnt', 'sph_scat', 'spher_harm', 'spl_init', 'spl_interp',
+    'spline', 'spline_p', 'sprsab', 'sprsax', 'sprsin',
+    'sprstp', 'sqrt', 'standardize', 'stddev', 'stop',
+    'strarr', 'strcmp', 'strcompress', 'streamline', 'streamline',
+    'stregex', 'stretch', 'string', 'strjoin', 'strlen',
+    'strlowcase', 'strmatch', 'strmessage', 'strmid', 'strpos',
+    'strput', 'strsplit', 'strtrim', 'struct_assign', 'struct_hide',
+    'strupcase', 'surface', 'surface', 'surfr', 'svdc',
+    'svdfit', 'svsol', 'swap_endian', 'swap_endian_inplace', 'symbol',
+    'systime', 't_cvf', 't_pdf', 't3d', 'tag_names',
+    'tan', 'tanh', 'tek_color', 'temporary', 'terminal_size',
+    'tetra_clip', 'tetra_surface', 'tetra_volume', 'text', 'thin',
+    'thread', 'threed', 'tic', 'time_test2', 'timegen',
+    'timer', 'timestamp', 'timestamptovalues', 'tm_test', 'toc',
+    'total', 'trace', 'transpose', 'tri_surf', 'triangulate',
+    'trigrid', 'triql', 'trired', 'trisol', 'truncate_lun',
+    'ts_coef', 'ts_diff', 'ts_fcast', 'ts_smooth', 'tv',
+    'tvcrs', 'tvlct', 'tvrd', 'tvscl', 'typename',
+    'uindgen', 'uint', 'uintarr', 'ul64indgen', 'ulindgen',
+    'ulon64arr', 'ulonarr', 'ulong', 'ulong64', 'uniq',
+    'unsharp_mask', 'usersym', 'value_locate', 'variance', 'vector',
+    'vector_field', 'vel', 'velovect', 'vert_t3d', 'voigt',
+    'volume', 'voronoi', 'voxel_proj', 'wait', 'warp_tri',
+    'watershed', 'wdelete', 'wf_draw', 'where', 'widget_base',
+    'widget_button', 'widget_combobox', 'widget_control',
+    'widget_displaycontextmenu', 'widget_draw',
+    'widget_droplist', 'widget_event', 'widget_info',
+    'widget_label', 'widget_list',
+    'widget_propertysheet', 'widget_slider', 'widget_tab',
+    'widget_table', 'widget_text',
+    'widget_tree', 'widget_tree_move', 'widget_window',
+    'wiener_filter', 'window',
+    'window', 'write_bmp', 'write_csv', 'write_gif', 'write_image',
+    'write_jpeg', 'write_jpeg2000', 'write_nrif', 'write_pict', 'write_png',
+    'write_ppm', 'write_spr', 'write_srf', 'write_sylk', 'write_tiff',
+    'write_video', 'write_wav', 'write_wave', 'writeu', 'wset',
+    'wshow', 'wtn', 'wv_applet', 'wv_cwt', 'wv_cw_wavelet',
+    'wv_denoise', 'wv_dwt', 'wv_fn_coiflet',
+    'wv_fn_daubechies', 'wv_fn_gaussian',
+    'wv_fn_haar', 'wv_fn_morlet', 'wv_fn_paul',
+    'wv_fn_symlet', 'wv_import_data',
+    'wv_import_wavelet', 'wv_plot3d_wps', 'wv_plot_multires',
+    'wv_pwt', 'wv_tool_denoise',
+    'xbm_edit', 'xdisplayfile', 'xdxf', 'xfont', 'xinteranimate',
+    'xloadct', 'xmanager', 'xmng_tmpl', 'xmtool', 'xobjview',
+    'xobjview_rotate', 'xobjview_write_image',
+    'xpalette', 'xpcolor', 'xplot3d',
+    'xregistered', 'xroi', 'xsq_test', 'xsurface', 'xvaredit',
+    'xvolume', 'xvolume_rotate', 'xvolume_write_image',
+    'xyouts', 'zlib_compress', 'zlib_uncompress', 'zoom', 'zoom_24'
+  ];
+  var builtins = wordRegexp(builtinArray);
+
+  var keywordArray = [
+    'begin', 'end', 'endcase', 'endfor',
+    'endwhile', 'endif', 'endrep', 'endforeach',
+    'break', 'case', 'continue', 'for',
+    'foreach', 'goto', 'if', 'then', 'else',
+    'repeat', 'until', 'switch', 'while',
+    'do', 'pro', 'function'
+  ];
+  var keywords = wordRegexp(keywordArray);
+
+  CodeMirror.registerHelper("hintWords", "idl", builtinArray.concat(keywordArray));
+
+  var identifiers = new RegExp('^[_a-z\xa1-\uffff][_a-z0-9\xa1-\uffff]*', 'i');
+
+  var singleOperators = /[+\-*&=<>\/@#~$]/;
+  var boolOperators = new RegExp('(and|or|eq|lt|le|gt|ge|ne|not)', 'i');
+
+  function tokenBase(stream) {
+    // whitespaces
+    if (stream.eatSpace()) return null;
+
+    // Handle one line Comments
+    if (stream.match(';')) {
+      stream.skipToEnd();
+      return 'comment';
+    }
+
+    // Handle Number Literals
+    if (stream.match(/^[0-9\.+-]/, false)) {
+      if (stream.match(/^[+-]?0x[0-9a-fA-F]+/))
+        return 'number';
+      if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/))
+        return 'number';
+      if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/))
+        return 'number';
+    }
+
+    // Handle Strings
+    if (stream.match(/^"([^"]|(""))*"/)) { return 'string'; }
+    if (stream.match(/^'([^']|(''))*'/)) { return 'string'; }
+
+    // Handle words
+    if (stream.match(keywords)) { return 'keyword'; }
+    if (stream.match(builtins)) { return 'builtin'; }
+    if (stream.match(identifiers)) { return 'variable'; }
+
+    if (stream.match(singleOperators) || stream.match(boolOperators)) {
+      return 'operator'; }
+
+    // Handle non-detected items
+    stream.next();
+    return null;
+  };
+
+  CodeMirror.defineMode('idl', function() {
+    return {
+      token: function(stream) {
+        return tokenBase(stream);
+      }
+    };
+  });
+
+  CodeMirror.defineMIME('text/x-idl', 'idl');
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/idl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,65 @@
+<!doctype html>
+
+<title>CodeMirror: IDL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="idl.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">IDL</a>
+  </ul>
+</div>
+
+<article>
+<h2>IDL mode</h2>
+
+    <div><textarea id="code" name="code">
+;; Example IDL code
+FUNCTION mean_and_stddev,array
+  ;; This program reads in an array of numbers
+  ;; and returns a structure containing the
+  ;; average and standard deviation
+
+  ave = 0.0
+  count = 0.0
+
+  for i=0,N_ELEMENTS(array)-1 do begin
+      ave = ave + array[i]
+      count = count + 1
+  endfor
+  
+  ave = ave/count
+
+  std = stddev(array)  
+
+  return, {average:ave,std:std}
+
+END
+
+    </textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "idl",
+               version: 1,
+               singleLineStringErrors: false},
+        lineNumbers: true,
+        indentUnit: 4,
+        matchBrackets: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-idl</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,166 @@
+<!doctype html>
+
+<title>CodeMirror: Language Modes</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../doc/docs.css">
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Language modes</a>
+  </ul>
+</div>
+
+<article>
+
+  <h2>Language modes</h2>
+
+  <p>This is a list of every mode in the distribution. Each mode lives
+in a subdirectory of the <code>mode/</code> directory, and typically
+defines a single JavaScript file that implements the mode. Loading
+such file will make the language available to CodeMirror, through
+the <a href="../doc/manual.html#option_mode"><code>mode</code></a>
+option.</p>
+
+  <div style="-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;">
+    <ul style="margin-top: 0">
+      <li><a href="apl/index.html">APL</a></li>
+      <li><a href="asn.1/index.html">ASN.1</a></li>
+      <li><a href="asterisk/index.html">Asterisk dialplan</a></li>
+      <li><a href="brainfuck/index.html">Brainfuck</a></li>
+      <li><a href="clike/index.html">C, C++, C#</a></li>
+      <li><a href="clike/index.html">Ceylon</a></li>
+      <li><a href="clojure/index.html">Clojure</a></li>
+      <li><a href="css/gss.html">Closure Stylesheets (GSS)</a></li>
+      <li><a href="cmake/index.html">CMake</a></li>
+      <li><a href="cobol/index.html">COBOL</a></li>
+      <li><a href="coffeescript/index.html">CoffeeScript</a></li>
+      <li><a href="commonlisp/index.html">Common Lisp</a></li>
+      <li><a href="crystal/index.html">Crystal</a></li>
+      <li><a href="css/index.html">CSS</a></li>
+      <li><a href="cypher/index.html">Cypher</a></li>
+      <li><a href="python/index.html">Cython</a></li>
+      <li><a href="d/index.html">D</a></li>
+      <li><a href="dart/index.html">Dart</a></li>
+      <li><a href="django/index.html">Django</a> (templating language)</li>
+      <li><a href="dockerfile/index.html">Dockerfile</a></li>
+      <li><a href="diff/index.html">diff</a></li>
+      <li><a href="dtd/index.html">DTD</a></li>
+      <li><a href="dylan/index.html">Dylan</a></li>
+      <li><a href="ebnf/index.html">EBNF</a></li>
+      <li><a href="ecl/index.html">ECL</a></li>
+      <li><a href="eiffel/index.html">Eiffel</a></li>
+      <li><a href="https://github.com/optick/codemirror-mode-elixir">Elixir</a></li>
+      <li><a href="elm/index.html">Elm</a></li>
+      <li><a href="erlang/index.html">Erlang</a></li>
+      <li><a href="factor/index.html">Factor</a></li>
+      <li><a href="fcl/index.html">FCL</a></li>
+      <li><a href="forth/index.html">Forth</a></li>
+      <li><a href="fortran/index.html">Fortran</a></li>
+      <li><a href="mllike/index.html">F#</a></li>
+      <li><a href="gas/index.html">Gas</a> (AT&amp;T-style assembly)</li>
+      <li><a href="gherkin/index.html">Gherkin</a></li>
+      <li><a href="go/index.html">Go</a></li>
+      <li><a href="groovy/index.html">Groovy</a></li>
+      <li><a href="haml/index.html">HAML</a></li>
+      <li><a href="handlebars/index.html">Handlebars</a></li>
+      <li><a href="haskell/index.html">Haskell</a> (<a href="haskell-literate/index.html">Literate</a>)</li>
+      <li><a href="haxe/index.html">Haxe</a></li>
+      <li><a href="htmlembedded/index.html">HTML embedded</a> (JSP, ASP.NET)</li>
+      <li><a href="htmlmixed/index.html">HTML mixed-mode</a></li>
+      <li><a href="http/index.html">HTTP</a></li>
+      <li><a href="idl/index.html">IDL</a></li>
+      <li><a href="clike/index.html">Java</a></li>
+      <li><a href="javascript/index.html">JavaScript</a> (<a href="jsx/index.html">JSX</a>)</li>
+      <li><a href="jinja2/index.html">Jinja2</a></li>
+      <li><a href="julia/index.html">Julia</a></li>
+      <li><a href="clike/index.html">Kotlin</a></li>
+      <li><a href="css/less.html">LESS</a></li>
+      <li><a href="livescript/index.html">LiveScript</a></li>
+      <li><a href="lua/index.html">Lua</a></li>
+      <li><a href="markdown/index.html">Markdown</a> (<a href="gfm/index.html">GitHub-flavour</a>)</li>
+      <li><a href="mathematica/index.html">Mathematica</a></li>
+      <li><a href="mbox/index.html">mbox</a></li>
+      <li><a href="mirc/index.html">mIRC</a></li>
+      <li><a href="modelica/index.html">Modelica</a></li>
+      <li><a href="mscgen/index.html">MscGen</a></li>
+      <li><a href="mumps/index.html">MUMPS</a></li>
+      <li><a href="nginx/index.html">Nginx</a></li>
+      <li><a href="nsis/index.html">NSIS</a></li>
+      <li><a href="ntriples/index.html">N-Triples/N-Quads</a></li>
+      <li><a href="clike/index.html">Objective C</a></li>
+      <li><a href="mllike/index.html">OCaml</a></li>
+      <li><a href="octave/index.html">Octave</a> (MATLAB)</li>
+      <li><a href="oz/index.html">Oz</a></li>
+      <li><a href="pascal/index.html">Pascal</a></li>
+      <li><a href="pegjs/index.html">PEG.js</a></li>
+      <li><a href="perl/index.html">Perl</a></li>
+      <li><a href="asciiarmor/index.html">PGP (ASCII armor)</a></li>
+      <li><a href="php/index.html">PHP</a></li>
+      <li><a href="pig/index.html">Pig Latin</a></li>
+      <li><a href="powershell/index.html">PowerShell</a></li>
+      <li><a href="properties/index.html">Properties files</a></li>
+      <li><a href="protobuf/index.html">ProtoBuf</a></li>
+      <li><a href="pug/index.html">Pug</a></li>
+      <li><a href="puppet/index.html">Puppet</a></li>
+      <li><a href="python/index.html">Python</a></li>
+      <li><a href="q/index.html">Q</a></li>
+      <li><a href="r/index.html">R</a></li>
+      <li><a href="rpm/index.html">RPM</a></li>
+      <li><a href="rst/index.html">reStructuredText</a></li>
+      <li><a href="ruby/index.html">Ruby</a></li>
+      <li><a href="rust/index.html">Rust</a></li>
+      <li><a href="sas/index.html">SAS</a></li>
+      <li><a href="sass/index.html">Sass</a></li>
+      <li><a href="spreadsheet/index.html">Spreadsheet</a></li>
+      <li><a href="clike/scala.html">Scala</a></li>
+      <li><a href="scheme/index.html">Scheme</a></li>
+      <li><a href="css/scss.html">SCSS</a></li>
+      <li><a href="shell/index.html">Shell</a></li>
+      <li><a href="sieve/index.html">Sieve</a></li>
+      <li><a href="slim/index.html">Slim</a></li>
+      <li><a href="smalltalk/index.html">Smalltalk</a></li>
+      <li><a href="smarty/index.html">Smarty</a></li>
+      <li><a href="solr/index.html">Solr</a></li>
+      <li><a href="soy/index.html">Soy</a></li>
+      <li><a href="stylus/index.html">Stylus</a></li>
+      <li><a href="sql/index.html">SQL</a> (several dialects)</li>
+      <li><a href="sparql/index.html">SPARQL</a></li>
+      <li><a href="clike/index.html">Squirrel</a></li>
+      <li><a href="swift/index.html">Swift</a></li>
+      <li><a href="stex/index.html">sTeX, LaTeX</a></li>
+      <li><a href="tcl/index.html">Tcl</a></li>
+      <li><a href="textile/index.html">Textile</a></li>
+      <li><a href="tiddlywiki/index.html">Tiddlywiki</a></li>
+      <li><a href="tiki/index.html">Tiki wiki</a></li>
+      <li><a href="toml/index.html">TOML</a></li>
+      <li><a href="tornado/index.html">Tornado</a> (templating language)</li>
+      <li><a href="troff/index.html">troff</a> (for manpages)</li>
+      <li><a href="ttcn/index.html">TTCN</a></li>
+      <li><a href="ttcn-cfg/index.html">TTCN Configuration</a></li>
+      <li><a href="turtle/index.html">Turtle</a></li>
+      <li><a href="twig/index.html">Twig</a></li>
+      <li><a href="vb/index.html">VB.NET</a></li>
+      <li><a href="vbscript/index.html">VBScript</a></li>
+      <li><a href="velocity/index.html">Velocity</a></li>
+      <li><a href="verilog/index.html">Verilog/SystemVerilog</a></li>
+      <li><a href="vhdl/index.html">VHDL</a></li>
+      <li><a href="vue/index.html">Vue.js app</a></li>
+      <li><a href="webidl/index.html">Web IDL</a></li>
+      <li><a href="wast/index.html">WebAssembly Text Format</a></li>
+      <li><a href="xml/index.html">XML/HTML</a></li>
+      <li><a href="xquery/index.html">XQuery</a></li>
+      <li><a href="yacas/index.html">Yacas</a></li>
+      <li><a href="yaml/index.html">YAML</a></li>
+      <li><a href="yaml-frontmatter/index.html">YAML frontmatter</a></li>
+      <li><a href="z80/index.html">Z80</a></li>
+    </ul>
+  </div>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/javascript/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,118 @@
+<!doctype html>
+
+<title>CodeMirror: JavaScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../../addon/comment/continuecomment.js"></script>
+<script src="../../addon/comment/comment.js"></script>
+<script src="javascript.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">JavaScript</a>
+  </ul>
+</div>
+
+<article>
+<h2>JavaScript mode</h2>
+
+
+<div><textarea id="code" name="code">
+// Demo code (the actual new parser character stream implementation)
+
+function StringStream(string) {
+  this.pos = 0;
+  this.string = string;
+}
+
+StringStream.prototype = {
+  done: function() {return this.pos >= this.string.length;},
+  peek: function() {return this.string.charAt(this.pos);},
+  next: function() {
+    if (this.pos &lt; this.string.length)
+      return this.string.charAt(this.pos++);
+  },
+  eat: function(match) {
+    var ch = this.string.charAt(this.pos);
+    if (typeof match == "string") var ok = ch == match;
+    else var ok = ch &amp;&amp; match.test ? match.test(ch) : match(ch);
+    if (ok) {this.pos++; return ch;}
+  },
+  eatWhile: function(match) {
+    var start = this.pos;
+    while (this.eat(match));
+    if (this.pos > start) return this.string.slice(start, this.pos);
+  },
+  backUp: function(n) {this.pos -= n;},
+  column: function() {return this.pos;},
+  eatSpace: function() {
+    var start = this.pos;
+    while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
+    return this.pos - start;
+  },
+  match: function(pattern, consume, caseInsensitive) {
+    if (typeof pattern == "string") {
+      function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
+      if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
+        if (consume !== false) this.pos += str.length;
+        return true;
+      }
+    }
+    else {
+      var match = this.string.slice(this.pos).match(pattern);
+      if (match &amp;&amp; consume !== false) this.pos += match[0].length;
+      return match;
+    }
+  }
+};
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        continueComments: "Enter",
+        extraKeys: {"Ctrl-Q": "toggleComment"}
+      });
+    </script>
+
+    <p>
+      JavaScript mode supports several configuration options:
+      <ul>
+        <li><code>json</code> which will set the mode to expect JSON
+        data rather than a JavaScript program.</li>
+        <li><code>jsonld</code> which will set the mode to expect
+        <a href="http://json-ld.org">JSON-LD</a> linked data rather
+        than a JavaScript program (<a href="json-ld.html">demo</a>).</li>
+        <li><code>typescript</code> which will activate additional
+        syntax highlighting and some other things for TypeScript code
+        (<a href="typescript.html">demo</a>).</li>
+        <li><code>trackScope</code> can be set to false to turn off
+        tracking of local variables. This will prevent locals from
+        getting the <code>"variable-2"</code> token type, and will
+        break completion of locals with javascript-hint.</li>
+        <li><code>statementIndent</code> which (given a number) will
+        determine the amount of indentation to use for statements
+        continued on a new line.</li>
+        <li><code>wordCharacters</code>, a regexp that indicates which
+        characters should be considered part of an identifier.
+        Defaults to <code>/[\w$]/</code>, which does not handle
+        non-ASCII identifiers. Can be set to something more elaborate
+        to improve Unicode support.</li>
+      </ul>
+    </p>
+
+    <p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/javascript</code>, <code>application/x-javascript</code>, <code>text/ecmascript</code>, <code>application/ecmascript</code>, <code>application/json</code>, <code>application/x-json</code>, <code>application/manifest+json</code>, <code>application/ld+json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/javascript/javascript.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,960 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("javascript", function(config, parserConfig) {
+  var indentUnit = config.indentUnit;
+  var statementIndent = parserConfig.statementIndent;
+  var jsonldMode = parserConfig.jsonld;
+  var jsonMode = parserConfig.json || jsonldMode;
+  var trackScope = parserConfig.trackScope !== false
+  var isTS = parserConfig.typescript;
+  var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
+
+  // Tokenizer
+
+  var keywords = function(){
+    function kw(type) {return {type: type, style: "keyword"};}
+    var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
+    var operator = kw("operator"), atom = {type: "atom", style: "atom"};
+
+    return {
+      "if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
+      "return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
+      "debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
+      "function": kw("function"), "catch": kw("catch"),
+      "for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
+      "in": operator, "typeof": operator, "instanceof": operator,
+      "true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
+      "this": kw("this"), "class": kw("class"), "super": kw("atom"),
+      "yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
+      "await": C
+    };
+  }();
+
+  var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
+  var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
+
+  function readRegexp(stream) {
+    var escaped = false, next, inSet = false;
+    while ((next = stream.next()) != null) {
+      if (!escaped) {
+        if (next == "/" && !inSet) return;
+        if (next == "[") inSet = true;
+        else if (inSet && next == "]") inSet = false;
+      }
+      escaped = !escaped && next == "\\";
+    }
+  }
+
+  // Used as scratch variables to communicate multiple values without
+  // consing up tons of objects.
+  var type, content;
+  function ret(tp, style, cont) {
+    type = tp; content = cont;
+    return style;
+  }
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == '"' || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    } else if (ch == "." && stream.match(/^\d[\d_]*(?:[eE][+\-]?[\d_]+)?/)) {
+      return ret("number", "number");
+    } else if (ch == "." && stream.match("..")) {
+      return ret("spread", "meta");
+    } else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      return ret(ch);
+    } else if (ch == "=" && stream.eat(">")) {
+      return ret("=>", "operator");
+    } else if (ch == "0" && stream.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/)) {
+      return ret("number", "number");
+    } else if (/\d/.test(ch)) {
+      stream.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/);
+      return ret("number", "number");
+    } else if (ch == "/") {
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      } else if (stream.eat("/")) {
+        stream.skipToEnd();
+        return ret("comment", "comment");
+      } else if (expressionAllowed(stream, state, 1)) {
+        readRegexp(stream);
+        stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
+        return ret("regexp", "string-2");
+      } else {
+        stream.eat("=");
+        return ret("operator", "operator", stream.current());
+      }
+    } else if (ch == "`") {
+      state.tokenize = tokenQuasi;
+      return tokenQuasi(stream, state);
+    } else if (ch == "#" && stream.peek() == "!") {
+      stream.skipToEnd();
+      return ret("meta", "meta");
+    } else if (ch == "#" && stream.eatWhile(wordRE)) {
+      return ret("variable", "property")
+    } else if (ch == "<" && stream.match("!--") ||
+               (ch == "-" && stream.match("->") && !/\S/.test(stream.string.slice(0, stream.start)))) {
+      stream.skipToEnd()
+      return ret("comment", "comment")
+    } else if (isOperatorChar.test(ch)) {
+      if (ch != ">" || !state.lexical || state.lexical.type != ">") {
+        if (stream.eat("=")) {
+          if (ch == "!" || ch == "=") stream.eat("=")
+        } else if (/[<>*+\-|&?]/.test(ch)) {
+          stream.eat(ch)
+          if (ch == ">") stream.eat(ch)
+        }
+      }
+      if (ch == "?" && stream.eat(".")) return ret(".")
+      return ret("operator", "operator", stream.current());
+    } else if (wordRE.test(ch)) {
+      stream.eatWhile(wordRE);
+      var word = stream.current()
+      if (state.lastType != ".") {
+        if (keywords.propertyIsEnumerable(word)) {
+          var kw = keywords[word]
+          return ret(kw.type, kw.style, word)
+        }
+        if (word == "async" && stream.match(/^(\s|\/\*([^*]|\*(?!\/))*?\*\/)*[\[\(\w]/, false))
+          return ret("async", "keyword", word)
+      }
+      return ret("variable", "variable", word)
+    }
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next;
+      if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
+        state.tokenize = tokenBase;
+        return ret("jsonld-keyword", "meta");
+      }
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) break;
+        escaped = !escaped && next == "\\";
+      }
+      if (!escaped) state.tokenize = tokenBase;
+      return ret("string", "string");
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return ret("comment", "comment");
+  }
+
+  function tokenQuasi(stream, state) {
+    var escaped = false, next;
+    while ((next = stream.next()) != null) {
+      if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      escaped = !escaped && next == "\\";
+    }
+    return ret("quasi", "string-2", stream.current());
+  }
+
+  var brackets = "([{}])";
+  // This is a crude lookahead trick to try and notice that we're
+  // parsing the argument patterns for a fat-arrow function before we
+  // actually hit the arrow token. It only works if the arrow is on
+  // the same line as the arguments and there's no strange noise
+  // (comments) in between. Fallback is to only notice when we hit the
+  // arrow, and not declare the arguments as locals for the arrow
+  // body.
+  function findFatArrow(stream, state) {
+    if (state.fatArrowAt) state.fatArrowAt = null;
+    var arrow = stream.string.indexOf("=>", stream.start);
+    if (arrow < 0) return;
+
+    if (isTS) { // Try to skip TypeScript return type declarations after the arguments
+      var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
+      if (m) arrow = m.index
+    }
+
+    var depth = 0, sawSomething = false;
+    for (var pos = arrow - 1; pos >= 0; --pos) {
+      var ch = stream.string.charAt(pos);
+      var bracket = brackets.indexOf(ch);
+      if (bracket >= 0 && bracket < 3) {
+        if (!depth) { ++pos; break; }
+        if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
+      } else if (bracket >= 3 && bracket < 6) {
+        ++depth;
+      } else if (wordRE.test(ch)) {
+        sawSomething = true;
+      } else if (/["'\/`]/.test(ch)) {
+        for (;; --pos) {
+          if (pos == 0) return
+          var next = stream.string.charAt(pos - 1)
+          if (next == ch && stream.string.charAt(pos - 2) != "\\") { pos--; break }
+        }
+      } else if (sawSomething && !depth) {
+        ++pos;
+        break;
+      }
+    }
+    if (sawSomething && !depth) state.fatArrowAt = pos;
+  }
+
+  // Parser
+
+  var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true,
+                     "regexp": true, "this": true, "import": true, "jsonld-keyword": true};
+
+  function JSLexical(indented, column, type, align, prev, info) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.prev = prev;
+    this.info = info;
+    if (align != null) this.align = align;
+  }
+
+  function inScope(state, varname) {
+    if (!trackScope) return false
+    for (var v = state.localVars; v; v = v.next)
+      if (v.name == varname) return true;
+    for (var cx = state.context; cx; cx = cx.prev) {
+      for (var v = cx.vars; v; v = v.next)
+        if (v.name == varname) return true;
+    }
+  }
+
+  function parseJS(state, style, type, content, stream) {
+    var cc = state.cc;
+    // Communicate our context to the combinators.
+    // (Less wasteful than consing up a hundred closures on every call.)
+    cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
+
+    if (!state.lexical.hasOwnProperty("align"))
+      state.lexical.align = true;
+
+    while(true) {
+      var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
+      if (combinator(type, content)) {
+        while(cc.length && cc[cc.length - 1].lex)
+          cc.pop()();
+        if (cx.marked) return cx.marked;
+        if (type == "variable" && inScope(state, content)) return "variable-2";
+        return style;
+      }
+    }
+  }
+
+  // Combinator utils
+
+  var cx = {state: null, column: null, marked: null, cc: null};
+  function pass() {
+    for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
+  }
+  function cont() {
+    pass.apply(null, arguments);
+    return true;
+  }
+  function inList(name, list) {
+    for (var v = list; v; v = v.next) if (v.name == name) return true
+    return false;
+  }
+  function register(varname) {
+    var state = cx.state;
+    cx.marked = "def";
+    if (!trackScope) return
+    if (state.context) {
+      if (state.lexical.info == "var" && state.context && state.context.block) {
+        // FIXME function decls are also not block scoped
+        var newContext = registerVarScoped(varname, state.context)
+        if (newContext != null) {
+          state.context = newContext
+          return
+        }
+      } else if (!inList(varname, state.localVars)) {
+        state.localVars = new Var(varname, state.localVars)
+        return
+      }
+    }
+    // Fall through means this is global
+    if (parserConfig.globalVars && !inList(varname, state.globalVars))
+      state.globalVars = new Var(varname, state.globalVars)
+  }
+  function registerVarScoped(varname, context) {
+    if (!context) {
+      return null
+    } else if (context.block) {
+      var inner = registerVarScoped(varname, context.prev)
+      if (!inner) return null
+      if (inner == context.prev) return context
+      return new Context(inner, context.vars, true)
+    } else if (inList(varname, context.vars)) {
+      return context
+    } else {
+      return new Context(context.prev, new Var(varname, context.vars), false)
+    }
+  }
+
+  function isModifier(name) {
+    return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly"
+  }
+
+  // Combinators
+
+  function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
+  function Var(name, next) { this.name = name; this.next = next }
+
+  var defaultVars = new Var("this", new Var("arguments", null))
+  function pushcontext() {
+    cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
+    cx.state.localVars = defaultVars
+  }
+  function pushblockcontext() {
+    cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
+    cx.state.localVars = null
+  }
+  pushcontext.lex = pushblockcontext.lex = true
+  function popcontext() {
+    cx.state.localVars = cx.state.context.vars
+    cx.state.context = cx.state.context.prev
+  }
+  popcontext.lex = true
+  function pushlex(type, info) {
+    var result = function() {
+      var state = cx.state, indent = state.indented;
+      if (state.lexical.type == "stat") indent = state.lexical.indented;
+      else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
+        indent = outer.indented;
+      state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
+    };
+    result.lex = true;
+    return result;
+  }
+  function poplex() {
+    var state = cx.state;
+    if (state.lexical.prev) {
+      if (state.lexical.type == ")")
+        state.indented = state.lexical.indented;
+      state.lexical = state.lexical.prev;
+    }
+  }
+  poplex.lex = true;
+
+  function expect(wanted) {
+    function exp(type) {
+      if (type == wanted) return cont();
+      else if (wanted == ";" || type == "}" || type == ")" || type == "]") return pass();
+      else return cont(exp);
+    };
+    return exp;
+  }
+
+  function statement(type, value) {
+    if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
+    if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
+    if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
+    if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
+    if (type == "debugger") return cont(expect(";"));
+    if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
+    if (type == ";") return cont();
+    if (type == "if") {
+      if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
+        cx.state.cc.pop()();
+      return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
+    }
+    if (type == "function") return cont(functiondef);
+    if (type == "for") return cont(pushlex("form"), pushblockcontext, forspec, statement, popcontext, poplex);
+    if (type == "class" || (isTS && value == "interface")) {
+      cx.marked = "keyword"
+      return cont(pushlex("form", type == "class" ? type : value), className, poplex)
+    }
+    if (type == "variable") {
+      if (isTS && value == "declare") {
+        cx.marked = "keyword"
+        return cont(statement)
+      } else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
+        cx.marked = "keyword"
+        if (value == "enum") return cont(enumdef);
+        else if (value == "type") return cont(typename, expect("operator"), typeexpr, expect(";"));
+        else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
+      } else if (isTS && value == "namespace") {
+        cx.marked = "keyword"
+        return cont(pushlex("form"), expression, statement, poplex)
+      } else if (isTS && value == "abstract") {
+        cx.marked = "keyword"
+        return cont(statement)
+      } else {
+        return cont(pushlex("stat"), maybelabel);
+      }
+    }
+    if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
+                                      block, poplex, poplex, popcontext);
+    if (type == "case") return cont(expression, expect(":"));
+    if (type == "default") return cont(expect(":"));
+    if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
+    if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
+    if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
+    if (type == "async") return cont(statement)
+    if (value == "@") return cont(expression, statement)
+    return pass(pushlex("stat"), expression, expect(";"), poplex);
+  }
+  function maybeCatchBinding(type) {
+    if (type == "(") return cont(funarg, expect(")"))
+  }
+  function expression(type, value) {
+    return expressionInner(type, value, false);
+  }
+  function expressionNoComma(type, value) {
+    return expressionInner(type, value, true);
+  }
+  function parenExpr(type) {
+    if (type != "(") return pass()
+    return cont(pushlex(")"), maybeexpression, expect(")"), poplex)
+  }
+  function expressionInner(type, value, noComma) {
+    if (cx.state.fatArrowAt == cx.stream.start) {
+      var body = noComma ? arrowBodyNoComma : arrowBody;
+      if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
+      else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
+    }
+
+    var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
+    if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
+    if (type == "function") return cont(functiondef, maybeop);
+    if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }
+    if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);
+    if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
+    if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
+    if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
+    if (type == "{") return contCommasep(objprop, "}", null, maybeop);
+    if (type == "quasi") return pass(quasi, maybeop);
+    if (type == "new") return cont(maybeTarget(noComma));
+    return cont();
+  }
+  function maybeexpression(type) {
+    if (type.match(/[;\}\)\],]/)) return pass();
+    return pass(expression);
+  }
+
+  function maybeoperatorComma(type, value) {
+    if (type == ",") return cont(maybeexpression);
+    return maybeoperatorNoComma(type, value, false);
+  }
+  function maybeoperatorNoComma(type, value, noComma) {
+    var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
+    var expr = noComma == false ? expression : expressionNoComma;
+    if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
+    if (type == "operator") {
+      if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
+      if (isTS && value == "<" && cx.stream.match(/^([^<>]|<[^<>]*>)*>\s*\(/, false))
+        return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
+      if (value == "?") return cont(expression, expect(":"), expr);
+      return cont(expr);
+    }
+    if (type == "quasi") { return pass(quasi, me); }
+    if (type == ";") return;
+    if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
+    if (type == ".") return cont(property, me);
+    if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
+    if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }
+    if (type == "regexp") {
+      cx.state.lastType = cx.marked = "operator"
+      cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)
+      return cont(expr)
+    }
+  }
+  function quasi(type, value) {
+    if (type != "quasi") return pass();
+    if (value.slice(value.length - 2) != "${") return cont(quasi);
+    return cont(maybeexpression, continueQuasi);
+  }
+  function continueQuasi(type) {
+    if (type == "}") {
+      cx.marked = "string-2";
+      cx.state.tokenize = tokenQuasi;
+      return cont(quasi);
+    }
+  }
+  function arrowBody(type) {
+    findFatArrow(cx.stream, cx.state);
+    return pass(type == "{" ? statement : expression);
+  }
+  function arrowBodyNoComma(type) {
+    findFatArrow(cx.stream, cx.state);
+    return pass(type == "{" ? statement : expressionNoComma);
+  }
+  function maybeTarget(noComma) {
+    return function(type) {
+      if (type == ".") return cont(noComma ? targetNoComma : target);
+      else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)
+      else return pass(noComma ? expressionNoComma : expression);
+    };
+  }
+  function target(_, value) {
+    if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
+  }
+  function targetNoComma(_, value) {
+    if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
+  }
+  function maybelabel(type) {
+    if (type == ":") return cont(poplex, statement);
+    return pass(maybeoperatorComma, expect(";"), poplex);
+  }
+  function property(type) {
+    if (type == "variable") {cx.marked = "property"; return cont();}
+  }
+  function objprop(type, value) {
+    if (type == "async") {
+      cx.marked = "property";
+      return cont(objprop);
+    } else if (type == "variable" || cx.style == "keyword") {
+      cx.marked = "property";
+      if (value == "get" || value == "set") return cont(getterSetter);
+      var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params
+      if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
+        cx.state.fatArrowAt = cx.stream.pos + m[0].length
+      return cont(afterprop);
+    } else if (type == "number" || type == "string") {
+      cx.marked = jsonldMode ? "property" : (cx.style + " property");
+      return cont(afterprop);
+    } else if (type == "jsonld-keyword") {
+      return cont(afterprop);
+    } else if (isTS && isModifier(value)) {
+      cx.marked = "keyword"
+      return cont(objprop)
+    } else if (type == "[") {
+      return cont(expression, maybetype, expect("]"), afterprop);
+    } else if (type == "spread") {
+      return cont(expressionNoComma, afterprop);
+    } else if (value == "*") {
+      cx.marked = "keyword";
+      return cont(objprop);
+    } else if (type == ":") {
+      return pass(afterprop)
+    }
+  }
+  function getterSetter(type) {
+    if (type != "variable") return pass(afterprop);
+    cx.marked = "property";
+    return cont(functiondef);
+  }
+  function afterprop(type) {
+    if (type == ":") return cont(expressionNoComma);
+    if (type == "(") return pass(functiondef);
+  }
+  function commasep(what, end, sep) {
+    function proceed(type, value) {
+      if (sep ? sep.indexOf(type) > -1 : type == ",") {
+        var lex = cx.state.lexical;
+        if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
+        return cont(function(type, value) {
+          if (type == end || value == end) return pass()
+          return pass(what)
+        }, proceed);
+      }
+      if (type == end || value == end) return cont();
+      if (sep && sep.indexOf(";") > -1) return pass(what)
+      return cont(expect(end));
+    }
+    return function(type, value) {
+      if (type == end || value == end) return cont();
+      return pass(what, proceed);
+    };
+  }
+  function contCommasep(what, end, info) {
+    for (var i = 3; i < arguments.length; i++)
+      cx.cc.push(arguments[i]);
+    return cont(pushlex(end, info), commasep(what, end), poplex);
+  }
+  function block(type) {
+    if (type == "}") return cont();
+    return pass(statement, block);
+  }
+  function maybetype(type, value) {
+    if (isTS) {
+      if (type == ":") return cont(typeexpr);
+      if (value == "?") return cont(maybetype);
+    }
+  }
+  function maybetypeOrIn(type, value) {
+    if (isTS && (type == ":" || value == "in")) return cont(typeexpr)
+  }
+  function mayberettype(type) {
+    if (isTS && type == ":") {
+      if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
+      else return cont(typeexpr)
+    }
+  }
+  function isKW(_, value) {
+    if (value == "is") {
+      cx.marked = "keyword"
+      return cont()
+    }
+  }
+  function typeexpr(type, value) {
+    if (value == "keyof" || value == "typeof" || value == "infer" || value == "readonly") {
+      cx.marked = "keyword"
+      return cont(value == "typeof" ? expressionNoComma : typeexpr)
+    }
+    if (type == "variable" || value == "void") {
+      cx.marked = "type"
+      return cont(afterType)
+    }
+    if (value == "|" || value == "&") return cont(typeexpr)
+    if (type == "string" || type == "number" || type == "atom") return cont(afterType);
+    if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
+    if (type == "{") return cont(pushlex("}"), typeprops, poplex, afterType)
+    if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType, afterType)
+    if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
+    if (type == "quasi") { return pass(quasiType, afterType); }
+  }
+  function maybeReturnType(type) {
+    if (type == "=>") return cont(typeexpr)
+  }
+  function typeprops(type) {
+    if (type.match(/[\}\)\]]/)) return cont()
+    if (type == "," || type == ";") return cont(typeprops)
+    return pass(typeprop, typeprops)
+  }
+  function typeprop(type, value) {
+    if (type == "variable" || cx.style == "keyword") {
+      cx.marked = "property"
+      return cont(typeprop)
+    } else if (value == "?" || type == "number" || type == "string") {
+      return cont(typeprop)
+    } else if (type == ":") {
+      return cont(typeexpr)
+    } else if (type == "[") {
+      return cont(expect("variable"), maybetypeOrIn, expect("]"), typeprop)
+    } else if (type == "(") {
+      return pass(functiondecl, typeprop)
+    } else if (!type.match(/[;\}\)\],]/)) {
+      return cont()
+    }
+  }
+  function quasiType(type, value) {
+    if (type != "quasi") return pass();
+    if (value.slice(value.length - 2) != "${") return cont(quasiType);
+    return cont(typeexpr, continueQuasiType);
+  }
+  function continueQuasiType(type) {
+    if (type == "}") {
+      cx.marked = "string-2";
+      cx.state.tokenize = tokenQuasi;
+      return cont(quasiType);
+    }
+  }
+  function typearg(type, value) {
+    if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
+    if (type == ":") return cont(typeexpr)
+    if (type == "spread") return cont(typearg)
+    return pass(typeexpr)
+  }
+  function afterType(type, value) {
+    if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
+    if (value == "|" || type == "." || value == "&") return cont(typeexpr)
+    if (type == "[") return cont(typeexpr, expect("]"), afterType)
+    if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) }
+    if (value == "?") return cont(typeexpr, expect(":"), typeexpr)
+  }
+  function maybeTypeArgs(_, value) {
+    if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
+  }
+  function typeparam() {
+    return pass(typeexpr, maybeTypeDefault)
+  }
+  function maybeTypeDefault(_, value) {
+    if (value == "=") return cont(typeexpr)
+  }
+  function vardef(_, value) {
+    if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)}
+    return pass(pattern, maybetype, maybeAssign, vardefCont);
+  }
+  function pattern(type, value) {
+    if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
+    if (type == "variable") { register(value); return cont(); }
+    if (type == "spread") return cont(pattern);
+    if (type == "[") return contCommasep(eltpattern, "]");
+    if (type == "{") return contCommasep(proppattern, "}");
+  }
+  function proppattern(type, value) {
+    if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
+      register(value);
+      return cont(maybeAssign);
+    }
+    if (type == "variable") cx.marked = "property";
+    if (type == "spread") return cont(pattern);
+    if (type == "}") return pass();
+    if (type == "[") return cont(expression, expect(']'), expect(':'), proppattern);
+    return cont(expect(":"), pattern, maybeAssign);
+  }
+  function eltpattern() {
+    return pass(pattern, maybeAssign)
+  }
+  function maybeAssign(_type, value) {
+    if (value == "=") return cont(expressionNoComma);
+  }
+  function vardefCont(type) {
+    if (type == ",") return cont(vardef);
+  }
+  function maybeelse(type, value) {
+    if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
+  }
+  function forspec(type, value) {
+    if (value == "await") return cont(forspec);
+    if (type == "(") return cont(pushlex(")"), forspec1, poplex);
+  }
+  function forspec1(type) {
+    if (type == "var") return cont(vardef, forspec2);
+    if (type == "variable") return cont(forspec2);
+    return pass(forspec2)
+  }
+  function forspec2(type, value) {
+    if (type == ")") return cont()
+    if (type == ";") return cont(forspec2)
+    if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression, forspec2) }
+    return pass(expression, forspec2)
+  }
+  function functiondef(type, value) {
+    if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
+    if (type == "variable") {register(value); return cont(functiondef);}
+    if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
+    if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef)
+  }
+  function functiondecl(type, value) {
+    if (value == "*") {cx.marked = "keyword"; return cont(functiondecl);}
+    if (type == "variable") {register(value); return cont(functiondecl);}
+    if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, popcontext);
+    if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondecl)
+  }
+  function typename(type, value) {
+    if (type == "keyword" || type == "variable") {
+      cx.marked = "type"
+      return cont(typename)
+    } else if (value == "<") {
+      return cont(pushlex(">"), commasep(typeparam, ">"), poplex)
+    }
+  }
+  function funarg(type, value) {
+    if (value == "@") cont(expression, funarg)
+    if (type == "spread") return cont(funarg);
+    if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
+    if (isTS && type == "this") return cont(maybetype, maybeAssign)
+    return pass(pattern, maybetype, maybeAssign);
+  }
+  function classExpression(type, value) {
+    // Class expressions may have an optional name.
+    if (type == "variable") return className(type, value);
+    return classNameAfter(type, value);
+  }
+  function className(type, value) {
+    if (type == "variable") {register(value); return cont(classNameAfter);}
+  }
+  function classNameAfter(type, value) {
+    if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
+    if (value == "extends" || value == "implements" || (isTS && type == ",")) {
+      if (value == "implements") cx.marked = "keyword";
+      return cont(isTS ? typeexpr : expression, classNameAfter);
+    }
+    if (type == "{") return cont(pushlex("}"), classBody, poplex);
+  }
+  function classBody(type, value) {
+    if (type == "async" ||
+        (type == "variable" &&
+         (value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
+         cx.stream.match(/^\s+#?[\w$\xa1-\uffff]/, false))) {
+      cx.marked = "keyword";
+      return cont(classBody);
+    }
+    if (type == "variable" || cx.style == "keyword") {
+      cx.marked = "property";
+      return cont(classfield, classBody);
+    }
+    if (type == "number" || type == "string") return cont(classfield, classBody);
+    if (type == "[")
+      return cont(expression, maybetype, expect("]"), classfield, classBody)
+    if (value == "*") {
+      cx.marked = "keyword";
+      return cont(classBody);
+    }
+    if (isTS && type == "(") return pass(functiondecl, classBody)
+    if (type == ";" || type == ",") return cont(classBody);
+    if (type == "}") return cont();
+    if (value == "@") return cont(expression, classBody)
+  }
+  function classfield(type, value) {
+    if (value == "!") return cont(classfield)
+    if (value == "?") return cont(classfield)
+    if (type == ":") return cont(typeexpr, maybeAssign)
+    if (value == "=") return cont(expressionNoComma)
+    var context = cx.state.lexical.prev, isInterface = context && context.info == "interface"
+    return pass(isInterface ? functiondecl : functiondef)
+  }
+  function afterExport(type, value) {
+    if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
+    if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
+    if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
+    return pass(statement);
+  }
+  function exportField(type, value) {
+    if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
+    if (type == "variable") return pass(expressionNoComma, exportField);
+  }
+  function afterImport(type) {
+    if (type == "string") return cont();
+    if (type == "(") return pass(expression);
+    if (type == ".") return pass(maybeoperatorComma);
+    return pass(importSpec, maybeMoreImports, maybeFrom);
+  }
+  function importSpec(type, value) {
+    if (type == "{") return contCommasep(importSpec, "}");
+    if (type == "variable") register(value);
+    if (value == "*") cx.marked = "keyword";
+    return cont(maybeAs);
+  }
+  function maybeMoreImports(type) {
+    if (type == ",") return cont(importSpec, maybeMoreImports)
+  }
+  function maybeAs(_type, value) {
+    if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
+  }
+  function maybeFrom(_type, value) {
+    if (value == "from") { cx.marked = "keyword"; return cont(expression); }
+  }
+  function arrayLiteral(type) {
+    if (type == "]") return cont();
+    return pass(commasep(expressionNoComma, "]"));
+  }
+  function enumdef() {
+    return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex)
+  }
+  function enummember() {
+    return pass(pattern, maybeAssign);
+  }
+
+  function isContinuedStatement(state, textAfter) {
+    return state.lastType == "operator" || state.lastType == "," ||
+      isOperatorChar.test(textAfter.charAt(0)) ||
+      /[,.]/.test(textAfter.charAt(0));
+  }
+
+  function expressionAllowed(stream, state, backUp) {
+    return state.tokenize == tokenBase &&
+      /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
+      (state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
+  }
+
+  // Interface
+
+  return {
+    startState: function(basecolumn) {
+      var state = {
+        tokenize: tokenBase,
+        lastType: "sof",
+        cc: [],
+        lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
+        localVars: parserConfig.localVars,
+        context: parserConfig.localVars && new Context(null, null, false),
+        indented: basecolumn || 0
+      };
+      if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
+        state.globalVars = parserConfig.globalVars;
+      return state;
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (!state.lexical.hasOwnProperty("align"))
+          state.lexical.align = false;
+        state.indented = stream.indentation();
+        findFatArrow(stream, state);
+      }
+      if (state.tokenize != tokenComment && stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      if (type == "comment") return style;
+      state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
+      return parseJS(state, style, type, content, stream);
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize == tokenComment || state.tokenize == tokenQuasi) return CodeMirror.Pass;
+      if (state.tokenize != tokenBase) return 0;
+      var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
+      // Kludge to prevent 'maybelse' from blocking lexical scope pops
+      if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
+        var c = state.cc[i];
+        if (c == poplex) lexical = lexical.prev;
+        else if (c != maybeelse && c != popcontext) break;
+      }
+      while ((lexical.type == "stat" || lexical.type == "form") &&
+             (firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
+                                   (top == maybeoperatorComma || top == maybeoperatorNoComma) &&
+                                   !/^[,\.=+\-*:?[\(]/.test(textAfter))))
+        lexical = lexical.prev;
+      if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
+        lexical = lexical.prev;
+      var type = lexical.type, closing = firstChar == type;
+
+      if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
+      else if (type == "form" && firstChar == "{") return lexical.indented;
+      else if (type == "form") return lexical.indented + indentUnit;
+      else if (type == "stat")
+        return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
+      else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
+        return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
+      else if (lexical.align) return lexical.column + (closing ? 0 : 1);
+      else return lexical.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
+    blockCommentStart: jsonMode ? null : "/*",
+    blockCommentEnd: jsonMode ? null : "*/",
+    blockCommentContinue: jsonMode ? null : " * ",
+    lineComment: jsonMode ? null : "//",
+    fold: "brace",
+    closeBrackets: "()[]{}''\"\"``",
+
+    helperType: jsonMode ? "json" : "javascript",
+    jsonldMode: jsonldMode,
+    jsonMode: jsonMode,
+
+    expressionAllowed: expressionAllowed,
+
+    skipExpression: function(state) {
+      parseJS(state, "atom", "atom", "true", new CodeMirror.StringStream("", 2, null))
+    }
+  };
+});
+
+CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
+
+CodeMirror.defineMIME("text/javascript", "javascript");
+CodeMirror.defineMIME("text/ecmascript", "javascript");
+CodeMirror.defineMIME("application/javascript", "javascript");
+CodeMirror.defineMIME("application/x-javascript", "javascript");
+CodeMirror.defineMIME("application/ecmascript", "javascript");
+CodeMirror.defineMIME("application/json", { name: "javascript", json: true });
+CodeMirror.defineMIME("application/x-json", { name: "javascript", json: true });
+CodeMirror.defineMIME("application/manifest+json", { name: "javascript", json: true })
+CodeMirror.defineMIME("application/ld+json", { name: "javascript", jsonld: true });
+CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
+CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/javascript/json-ld.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+<!doctype html>
+
+<title>CodeMirror: JSON-LD mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../../addon/comment/continuecomment.js"></script>
+<script src="../../addon/comment/comment.js"></script>
+<script src="javascript.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id="nav">
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png"/></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">JSON-LD</a>
+  </ul>
+</div>
+
+<article>
+<h2>JSON-LD mode</h2>
+
+
+<div><textarea id="code" name="code">
+{
+  "@context": {
+    "name": "http://schema.org/name",
+    "description": "http://schema.org/description",
+    "image": {
+      "@id": "http://schema.org/image",
+      "@type": "@id"
+    },
+    "geo": "http://schema.org/geo",
+    "latitude": {
+      "@id": "http://schema.org/latitude",
+      "@type": "xsd:float"
+    },
+    "longitude": {
+      "@id": "http://schema.org/longitude",
+      "@type": "xsd:float"
+    },
+    "xsd": "http://www.w3.org/2001/XMLSchema#"
+  },
+  "name": "The Empire State Building",
+  "description": "The Empire State Building is a 102-story landmark in New York City.",
+  "image": "http://www.civil.usherbrooke.ca/cours/gci215a/empire-state-building.jpg",
+  "geo": {
+    "latitude": "40.75",
+    "longitude": "73.98"
+  }
+}
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        matchBrackets: true,
+        autoCloseBrackets: true,
+        mode: "application/ld+json",
+        lineWrapping: true
+      });
+    </script>
+    
+    <p>This is a specialization of the <a href="index.html">JavaScript mode</a>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/javascript/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,521 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "javascript");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("locals",
+     "[keyword function] [def foo]([def a], [def b]) { [keyword var] [def c] [operator =] [number 10]; [keyword return] [variable-2 a] [operator +] [variable-2 c] [operator +] [variable d]; }");
+
+  MT("comma-and-binop",
+     "[keyword function](){ [keyword var] [def x] [operator =] [number 1] [operator +] [number 2], [def y]; }");
+
+  MT("destructuring",
+     "([keyword function]([def a], [[[def b], [def c] ]]) {",
+     "  [keyword let] {[def d], [property foo]: [def c][operator =][number 10], [def x]} [operator =] [variable foo]([variable-2 a]);",
+     "  [[[variable-2 c], [variable y] ]] [operator =] [variable-2 c];",
+     "})();");
+
+  MT("destructure_trailing_comma",
+    "[keyword let] {[def a], [def b],} [operator =] [variable foo];",
+    "[keyword let] [def c];"); // Parser still in good state?
+
+  MT("class_body",
+     "[keyword class] [def Foo] {",
+     "  [property constructor]() {}",
+     "  [property sayName]() {",
+     "    [keyword return] [string-2 `foo${][variable foo][string-2 }oo`];",
+     "  }",
+     "}");
+
+  MT("class",
+     "[keyword class] [def Point] [keyword extends] [variable SuperThing] {",
+     "  [keyword get] [property prop]() { [keyword return] [number 24]; }",
+     "  [property constructor]([def x], [def y]) {",
+     "    [keyword super]([string 'something']);",
+     "    [keyword this].[property x] [operator =] [variable-2 x];",
+     "  }",
+     "}");
+
+  MT("anonymous_class_expression",
+     "[keyword const] [def Adder] [operator =] [keyword class] [keyword extends] [variable Arithmetic] {",
+     "  [property add]([def a], [def b]) {}",
+     "};");
+
+  MT("named_class_expression",
+     "[keyword const] [def Subber] [operator =] [keyword class] [def Subtract] {",
+     "  [property sub]([def a], [def b]) {}",
+     "};");
+
+  MT("class_async_method",
+     "[keyword class] [def Foo] {",
+     "  [property sayName1]() {}",
+     "  [keyword async] [property sayName2]() {}",
+     "}");
+
+  MT("import",
+     "[keyword function] [def foo]() {",
+     "  [keyword import] [def $] [keyword from] [string 'jquery'];",
+     "  [keyword import] { [def encrypt], [def decrypt] } [keyword from] [string 'crypto'];",
+     "}");
+
+  MT("import_trailing_comma",
+     "[keyword import] {[def foo], [def bar],} [keyword from] [string 'baz']")
+
+  MT("import_dynamic",
+     "[keyword import]([string 'baz']).[property then]")
+
+  MT("import_dynamic",
+     "[keyword const] [def t] [operator =] [keyword import]([string 'baz']).[property then]")
+
+  MT("const",
+     "[keyword function] [def f]() {",
+     "  [keyword const] [[ [def a], [def b] ]] [operator =] [[ [number 1], [number 2] ]];",
+     "}");
+
+  MT("for/of",
+     "[keyword for]([keyword let] [def of] [keyword of] [variable something]) {}");
+
+  MT("for await",
+     "[keyword for] [keyword await]([keyword let] [def of] [keyword of] [variable something]) {}");
+
+  MT("generator",
+     "[keyword function*] [def repeat]([def n]) {",
+     "  [keyword for]([keyword var] [def i] [operator =] [number 0]; [variable-2 i] [operator <] [variable-2 n]; [operator ++][variable-2 i])",
+     "    [keyword yield] [variable-2 i];",
+     "}");
+
+  MT("let_scoping",
+     "[keyword function] [def scoped]([def n]) {",
+     "  { [keyword var] [def i]; } [variable-2 i];",
+     "  { [keyword let] [def j]; [variable-2 j]; } [variable j];",
+     "  [keyword if] ([atom true]) { [keyword const] [def k]; [variable-2 k]; } [variable k];",
+     "}");
+
+  MT("switch_scoping",
+     "[keyword switch] ([variable x]) {",
+     "  [keyword default]:",
+     "    [keyword let] [def j];",
+     "    [keyword return] [variable-2 j]",
+     "}",
+     "[variable j];")
+
+  MT("leaving_scope",
+     "[keyword function] [def a]() {",
+     "  {",
+     "    [keyword const] [def x] [operator =] [number 1]",
+     "    [keyword if] ([atom true]) {",
+     "      [keyword let] [def y] [operator =] [number 2]",
+     "      [keyword var] [def z] [operator =] [number 3]",
+     "      [variable console].[property log]([variable-2 x], [variable-2 y], [variable-2 z])",
+     "    }",
+     "    [variable console].[property log]([variable-2 x], [variable y], [variable-2 z])",
+     "  }",
+     "  [variable console].[property log]([variable x], [variable y], [variable-2 z])",
+     "}")
+
+  MT("quotedStringAddition",
+     "[keyword let] [def f] [operator =] [variable a] [operator +] [string 'fatarrow'] [operator +] [variable c];");
+
+  MT("quotedFatArrow",
+     "[keyword let] [def f] [operator =] [variable a] [operator +] [string '=>'] [operator +] [variable c];");
+
+  MT("fatArrow",
+     "[variable array].[property filter]([def a] [operator =>] [variable-2 a] [operator +] [number 1]);",
+     "[variable a];", // No longer in scope
+     "[keyword let] [def f] [operator =] ([[ [def a], [def b] ]], [def c]) [operator =>] [variable-2 a] [operator +] [variable-2 c];",
+     "[variable c];");
+
+  MT("fatArrow_stringDefault",
+     "([def a], [def b] [operator =] [string 'x\\'y']) [operator =>] [variable-2 a] [operator +] [variable-2 b]")
+
+  MT("spread",
+     "[keyword function] [def f]([def a], [meta ...][def b]) {",
+     "  [variable something]([variable-2 a], [meta ...][variable-2 b]);",
+     "}");
+
+  MT("quasi",
+     "[variable re][string-2 `fofdlakj${][variable x] [operator +] ([variable re][string-2 `foo`]) [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]");
+
+  MT("quasi_no_function",
+     "[variable x] [operator =] [string-2 `fofdlakj${][variable x] [operator +] [string-2 `foo`] [operator +] [number 1][string-2 }fdsa`] [operator +] [number 2]");
+
+  MT("indent_statement",
+     "[keyword var] [def x] [operator =] [number 10]",
+     "[variable x] [operator +=] [variable y] [operator +]",
+     "  [atom Infinity]",
+     "[keyword debugger];");
+
+  MT("indent_if",
+     "[keyword if] ([number 1])",
+     "  [keyword break];",
+     "[keyword else] [keyword if] ([number 2])",
+     "  [keyword continue];",
+     "[keyword else]",
+     "  [number 10];",
+     "[keyword if] ([number 1]) {",
+     "  [keyword break];",
+     "} [keyword else] [keyword if] ([number 2]) {",
+     "  [keyword continue];",
+     "} [keyword else] {",
+     "  [number 10];",
+     "}");
+
+  MT("indent_for",
+     "[keyword for] ([keyword var] [def i] [operator =] [number 0];",
+     "     [variable-2 i] [operator <] [number 100];",
+     "     [variable-2 i][operator ++])",
+     "  [variable doSomething]([variable-2 i]);",
+     "[keyword debugger];");
+
+  MT("indent_c_style",
+     "[keyword function] [def foo]()",
+     "{",
+     "  [keyword debugger];",
+     "}");
+
+  MT("indent_else",
+     "[keyword for] (;;)",
+     "  [keyword if] ([variable foo])",
+     "    [keyword if] ([variable bar])",
+     "      [number 1];",
+     "    [keyword else]",
+     "      [number 2];",
+     "  [keyword else]",
+     "    [number 3];");
+
+  MT("indent_funarg",
+     "[variable foo]([number 10000],",
+     "    [keyword function]([def a]) {",
+     "  [keyword debugger];",
+     "};");
+
+  MT("indent_below_if",
+     "[keyword for] (;;)",
+     "  [keyword if] ([variable foo])",
+     "    [number 1];",
+     "[number 2];");
+
+  MT("indent_semicolonless_if",
+     "[keyword function] [def foo]() {",
+     "  [keyword if] ([variable x])",
+     "    [variable foo]()",
+     "}")
+
+  MT("indent_semicolonless_if_with_statement",
+     "[keyword function] [def foo]() {",
+     "  [keyword if] ([variable x])",
+     "    [variable foo]()",
+     "  [variable bar]()",
+     "}")
+
+  MT("multilinestring",
+     "[keyword var] [def x] [operator =] [string 'foo\\]",
+     "[string bar'];");
+
+  MT("scary_regexp",
+     "[string-2 /foo[[/]]bar/];");
+
+  MT("indent_strange_array",
+     "[keyword var] [def x] [operator =] [[",
+     "  [number 1],,",
+     "  [number 2],",
+     "]];",
+     "[number 10];");
+
+  MT("param_default",
+     "[keyword function] [def foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {",
+     "  [keyword return] [variable-2 x];",
+     "}");
+
+  MT(
+    "param_destructuring",
+    "[keyword function] [def foo]([def x] [operator =] [string-2 `foo${][number 10][string-2 }bar`]) {",
+    "  [keyword return] [variable-2 x];",
+    "}");
+
+  MT("new_target",
+     "[keyword function] [def F]([def target]) {",
+     "  [keyword if] ([variable-2 target] [operator &&] [keyword new].[keyword target].[property name]) {",
+     "    [keyword return] [keyword new]",
+     "      .[keyword target];",
+     "  }",
+     "}");
+
+  MT("async",
+     "[keyword async] [keyword function] [def foo]([def args]) { [keyword return] [atom true]; }");
+
+  MT("async_assignment",
+     "[keyword const] [def foo] [operator =] [keyword async] [keyword function] ([def args]) { [keyword return] [atom true]; };");
+
+  MT("async_object",
+     "[keyword let] [def obj] [operator =] { [property async]: [atom false] };");
+
+  // async be highlighted as keyword and foo as def, but it requires potentially expensive look-ahead. See #4173
+  MT("async_object_function",
+     "[keyword let] [def obj] [operator =] { [property async] [property foo]([def args]) { [keyword return] [atom true]; } };");
+
+  MT("async_object_properties",
+     "[keyword let] [def obj] [operator =] {",
+     "  [property prop1]: [keyword async] [keyword function] ([def args]) { [keyword return] [atom true]; },",
+     "  [property prop2]: [keyword async] [keyword function] ([def args]) { [keyword return] [atom true]; },",
+     "  [property prop3]: [keyword async] [keyword function] [def prop3]([def args]) { [keyword return] [atom true]; },",
+     "};");
+
+  MT("async_arrow",
+     "[keyword const] [def foo] [operator =] [keyword async] ([def args]) [operator =>] { [keyword return] [atom true]; };");
+
+  MT("async_jquery",
+     "[variable $].[property ajax]({",
+     "  [property url]: [variable url],",
+     "  [property async]: [atom true],",
+     "  [property method]: [string 'GET']",
+     "});");
+
+  MT("async_variable",
+     "[keyword const] [def async] [operator =] {[property a]: [number 1]};",
+     "[keyword const] [def foo] [operator =] [string-2 `bar ${][variable async].[property a][string-2 }`];")
+
+  MT("bigint", "[number 1n] [operator +] [number 0x1afn] [operator +] [number 0o064n] [operator +] [number 0b100n];")
+
+  MT("async_comment",
+     "[keyword async] [comment /**/] [keyword function] [def foo]([def args]) { [keyword return] [atom true]; }");
+
+  MT("indent_switch",
+     "[keyword switch] ([variable x]) {",
+     "  [keyword default]:",
+     "    [keyword return] [number 2]",
+     "}")
+
+  MT("regexp_corner_case",
+     "[operator +]{} [operator /] [atom undefined];",
+     "[[[meta ...][string-2 /\\//] ]];",
+     "[keyword void] [string-2 /\\//];",
+     "[keyword do] [string-2 /\\//]; [keyword while] ([number 0]);",
+     "[keyword if] ([number 0]) {} [keyword else] [string-2 /\\//];",
+     "[string-2 `${][variable async][operator ++][string-2 }//`];",
+     "[string-2 `${]{} [operator /] [string-2 /\\//}`];")
+
+  MT("return_eol",
+     "[keyword return]",
+     "{} [string-2 /5/]")
+
+  MT("numeric separator",
+     "[number 123_456];",
+     "[number 0xdead_c0de];",
+     "[number 0o123_456];",
+     "[number 0b1101_1101];",
+     "[number .123_456e0_1];",
+     "[number 1E+123_456];",
+     "[number 12_34_56n];")
+
+  MT("underscore property",
+     "[variable something].[property _property];",
+     "[variable something].[property _123];",
+     "[variable something].[property _for];",
+     "[variable _for];",
+     "[variable _123];")
+
+  MT("private properties",
+     "[keyword class] [def C] {",
+     "  [property #x] [operator =] [number 2];",
+     "  [property #read]() {",
+     "    [keyword return] [keyword this].[property #x]",
+     "  }",
+     "}")
+
+  var ts_mode = CodeMirror.getMode({indentUnit: 2}, "application/typescript")
+  function TS(name) {
+    test.mode(name, ts_mode, Array.prototype.slice.call(arguments, 1))
+  }
+
+  TS("typescript_extend_type",
+     "[keyword class] [def Foo] [keyword extends] [type Some][operator <][type Type][operator >] {}")
+
+  TS("typescript_arrow_type",
+     "[keyword let] [def x]: ([variable arg]: [type Type]) [operator =>] [type ReturnType]")
+
+  TS("typescript_class",
+     "[keyword class] [def Foo] {",
+     "  [keyword public] [keyword static] [property main]() {}",
+     "  [keyword private] [property _foo]: [type string];",
+     "}")
+
+  TS("typescript_literal_types",
+     "[keyword import] [keyword *] [keyword as] [def Sequelize] [keyword from] [string 'sequelize'];",
+     "[keyword interface] [def MyAttributes] {",
+     "  [property truthy]: [string 'true'] [operator |] [number 1] [operator |] [atom true];",
+     "  [property falsy]: [string 'false'] [operator |] [number 0] [operator |] [atom false];",
+     "}",
+     "[keyword interface] [def MyInstance] [keyword extends] [type Sequelize].[type Instance] [operator <] [type MyAttributes] [operator >] {",
+     "  [property rawAttributes]: [type MyAttributes];",
+     "  [property truthy]: [string 'true'] [operator |] [number 1] [operator |] [atom true];",
+     "  [property falsy]: [string 'false'] [operator |] [number 0] [operator |] [atom false];",
+     "}")
+
+  TS("typescript_extend_operators",
+     "[keyword export] [keyword interface] [def UserModel] [keyword extends]",
+     "  [type Sequelize].[type Model] [operator <] [type UserInstance], [type UserAttributes] [operator >] {",
+     "    [property findById]: (",
+     "    [variable userId]: [type number]",
+     "    ) [operator =>] [type Promise] [operator <] [type Array] [operator <] { [property id], [property name] } [operator >>];",
+     "    [property updateById]: (",
+     "    [variable userId]: [type number],",
+     "    [variable isActive]: [type boolean]",
+     "    ) [operator =>] [type Promise] [operator <] [type AccountHolderNotificationPreferenceInstance] [operator >];",
+     "  }")
+
+  TS("typescript_interface_with_const",
+     "[keyword const] [def hello]: {",
+     "  [property prop1][operator ?]: [type string];",
+     "  [property prop2][operator ?]: [type string];",
+     "} [operator =] {};")
+
+  TS("typescript_double_extend",
+     "[keyword export] [keyword interface] [def UserAttributes] {",
+     "  [property id][operator ?]: [type number];",
+     "  [property createdAt][operator ?]: [type Date];",
+     "}",
+     "[keyword export] [keyword interface] [def UserInstance] [keyword extends] [type Sequelize].[type Instance][operator <][type UserAttributes][operator >], [type UserAttributes] {",
+     "  [property id]: [type number];",
+     "  [property createdAt]: [type Date];",
+     "}");
+
+  TS("typescript_index_signature",
+     "[keyword interface] [def A] {",
+     "  [[ [variable prop]: [type string] ]]: [type any];",
+     "  [property prop1]: [type any];",
+     "}");
+
+  TS("typescript_generic_class",
+     "[keyword class] [def Foo][operator <][type T][operator >] {",
+     "  [property bar]() {}",
+     "  [property foo](): [type Foo] {}",
+     "}")
+
+  TS("typescript_type_when_keyword",
+     "[keyword export] [keyword type] [type AB] [operator =] [type A] [operator |] [type B];",
+     "[keyword type] [type Flags] [operator =] {",
+     "  [property p1]: [type string];",
+     "  [property p2]: [type boolean];",
+     "};")
+
+  TS("typescript_type_when_not_keyword",
+     "[keyword class] [def HasType] {",
+     "  [property type]: [type string];",
+     "  [property constructor]([def type]: [type string]) {",
+     "    [keyword this].[property type] [operator =] [variable-2 type];",
+     "  }",
+     "  [property setType]({ [def type] }: { [property type]: [type string]; }) {",
+     "    [keyword this].[property type] [operator =] [variable-2 type];",
+     "  }",
+     "}")
+
+  TS("typescript_function_generics",
+     "[keyword function] [def a]() {}",
+     "[keyword function] [def b][operator <][type IA] [keyword extends] [type object], [type IB] [keyword extends] [type object][operator >]() {}",
+     "[keyword function] [def c]() {}")
+
+  TS("typescript_complex_return_type",
+     "[keyword function] [def A]() {",
+     "  [keyword return] [keyword this].[property property];",
+     "}",
+     "[keyword function] [def B](): [type Promise][operator <]{ [[ [variable key]: [type string] ]]: [type any] } [operator |] [atom null][operator >] {",
+     "  [keyword return] [keyword this].[property property];",
+     "}")
+
+  TS("typescript_complex_type_casting",
+     "[keyword const] [def giftpay] [operator =] [variable config].[property get]([string 'giftpay']) [keyword as] { [[ [variable platformUuid]: [type string] ]]: { [property version]: [type number]; [property apiCode]: [type string]; } };")
+
+  TS("typescript_keyof",
+     "[keyword function] [def x][operator <][type T] [keyword extends] [keyword keyof] [type X][operator >]([def a]: [type T]) {",
+     "  [keyword return]")
+
+  TS("typescript_new_typeargs",
+     "[keyword let] [def x] [operator =] [keyword new] [variable Map][operator <][type string], [type Date][operator >]([string-2 `foo${][variable bar][string-2 }`])")
+
+  TS("modifiers",
+     "[keyword class] [def Foo] {",
+     "  [keyword public] [keyword abstract] [property bar]() {}",
+     "  [property constructor]([keyword readonly] [keyword private] [def x]) {}",
+     "}")
+
+  TS("arrow prop",
+     "({[property a]: [def p] [operator =>] [variable-2 p]})")
+
+  TS("generic in function call",
+     "[keyword this].[property a][operator <][type Type][operator >]([variable foo]);",
+     "[keyword this].[property a][operator <][variable Type][operator >][variable foo];")
+
+  TS("type guard",
+     "[keyword class] [def Appler] {",
+     "  [keyword static] [property assertApple]([def fruit]: [type Fruit]): [variable-2 fruit] [keyword is] [type Apple] {",
+     "    [keyword if] ([operator !]([variable-2 fruit] [keyword instanceof] [variable Apple]))",
+     "      [keyword throw] [keyword new] [variable Error]();",
+     "  }",
+     "}")
+
+  TS("type as variable",
+     "[variable type] [operator =] [variable x] [keyword as] [type Bar];");
+
+  TS("enum body",
+     "[keyword export] [keyword const] [keyword enum] [def CodeInspectionResultType] {",
+     "  [def ERROR] [operator =] [string 'problem_type_error'],",
+     "  [def WARNING] [operator =] [string 'problem_type_warning'],",
+     "  [def META],",
+     "}")
+
+  TS("parenthesized type",
+     "[keyword class] [def Foo] {",
+     "  [property x] [operator =] [keyword new] [variable A][operator <][type B], [type string][operator |](() [operator =>] [type void])[operator >]();",
+     "  [keyword private] [property bar]();",
+     "}")
+
+  TS("abstract class",
+     "[keyword export] [keyword abstract] [keyword class] [def Foo] {}")
+
+  TS("interface without semicolons",
+     "[keyword interface] [def Foo] {",
+     "  [property greet]([def x]: [type int]): [type blah]",
+     "  [property bar]: [type void]",
+     "}")
+
+  var jsonld_mode = CodeMirror.getMode(
+    {indentUnit: 2},
+    {name: "javascript", jsonld: true}
+  );
+  function LD(name) {
+    test.mode(name, jsonld_mode, Array.prototype.slice.call(arguments, 1));
+  }
+
+  LD("json_ld_keywords",
+    '{',
+    '  [meta "@context"]: {',
+    '    [meta "@base"]: [string "http://example.com"],',
+    '    [meta "@vocab"]: [string "http://xmlns.com/foaf/0.1/"],',
+    '    [property "likesFlavor"]: {',
+    '      [meta "@container"]: [meta "@list"]',
+    '      [meta "@reverse"]: [string "@beFavoriteOf"]',
+    '    },',
+    '    [property "nick"]: { [meta "@container"]: [meta "@set"] },',
+    '    [property "nick"]: { [meta "@container"]: [meta "@index"] }',
+    '  },',
+    '  [meta "@graph"]: [[ {',
+    '    [meta "@id"]: [string "http://dbpedia.org/resource/John_Lennon"],',
+    '    [property "name"]: [string "John Lennon"],',
+    '    [property "modified"]: {',
+    '      [meta "@value"]: [string "2010-05-29T14:17:39+02:00"],',
+    '      [meta "@type"]: [string "http://www.w3.org/2001/XMLSchema#dateTime"]',
+    '    }',
+    '  } ]]',
+    '}');
+
+  LD("json_ld_fake",
+    '{',
+    '  [property "@fake"]: [string "@fake"],',
+    '  [property "@contextual"]: [string "@identifier"],',
+    '  [property "user@domain.com"]: [string "@graphical"],',
+    '  [property "@ID"]: [string "@@ID"]',
+    '}');
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/javascript/typescript.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,62 @@
+<!doctype html>
+
+<title>CodeMirror: TypeScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="javascript.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">TypeScript</a>
+  </ul>
+</div>
+
+<article>
+<h2>TypeScript mode</h2>
+
+
+<div><textarea id="code" name="code">
+class Greeter {
+  greeting: string;
+  constructor (message: string) {
+    this.greeting = message;
+  }
+  greet() {
+    return "Hello, " + this.greeting;
+  }
+}   
+
+var greeter = new Greeter("world");
+
+var button = document.createElement('button')
+button.innerText = "Say Hello"
+button.onclick = function() {
+  alert(greeter.greet())
+}
+
+document.body.appendChild(button)
+
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/typescript"
+      });
+    </script>
+
+    <p>This is a specialization of the <a href="index.html">JavaScript mode</a>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/jinja2/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,64 @@
+<!doctype html>
+
+<title>CodeMirror: Jinja2 mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="jinja2.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Jinja2</a>
+  </ul>
+</div>
+
+<article>
+<h2>Jinja2 mode</h2>
+<form><textarea id="code" name="code">
+{# this is a comment #}
+{%- for item in li -%}
+  &lt;li&gt;{{ item.label }}&lt;/li&gt;
+{% endfor -%}
+{{ item.sand == true and item.keyword == false ? 1 : 0 }}
+{{ app.get(55, 1.2, true) }}
+{% if app.get(&#39;_route&#39;) == (&#39;_home&#39;) %}home{% endif %}
+{% if app.session.flashbag.has(&#39;message&#39;) %}
+  {% for message in app.session.flashbag.get(&#39;message&#39;) %}
+    {{ message.content }}
+  {% endfor %}
+{% endif %}
+{{ path(&#39;_home&#39;, {&#39;section&#39;: app.request.get(&#39;section&#39;)}) }}
+{{ path(&#39;_home&#39;, {
+    &#39;section&#39;: app.request.get(&#39;section&#39;),
+    &#39;boolean&#39;: true,
+    &#39;number&#39;: 55.33
+  })
+}}
+{% include (&#39;test.incl.html.twig&#39;) %}
+
+# for item in seq:
+    &lt;li&gt;{{ item }} &lt;/li&gt;    ## this comment is ignored
+# endfor
+# set text = "Multiline
+	text"
+# for href, caption in [('index.html', 'Index'),
+                        ('about.html', 'About')]:
+    &lt;li&gt;&lt;a href="{{ href }}"&gt;{{ caption }}&lt;/a&gt;&lt;/li&gt;
+# endfor
+</textarea></form>
+    <script>
+      var editor =
+      CodeMirror.fromTextArea(document.getElementById("code"), {mode:
+        {name: "jinja2", htmlMode: true}});
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/jinja2/jinja2.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,193 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("jinja2", function() {
+    var keywords = ["and", "as", "block", "endblock", "by", "cycle", "debug", "else", "elif",
+      "extends", "filter", "endfilter", "firstof", "do", "for",
+      "endfor", "if", "endif", "ifchanged", "endifchanged",
+      "ifequal", "endifequal", "ifnotequal", "set", "raw", "endraw",
+      "endifnotequal", "in", "include", "load", "not", "now", "or",
+      "parsed", "regroup", "reversed", "spaceless", "call", "endcall", "macro",
+      "endmacro", "endspaceless", "ssi", "templatetag", "openblock",
+      "closeblock", "openvariable", "closevariable", "without", "context",
+      "openbrace", "closebrace", "opencomment",
+      "closecomment", "widthratio", "url", "with", "endwith",
+      "get_current_language", "trans", "endtrans", "noop", "blocktrans",
+      "endblocktrans", "get_available_languages",
+      "get_current_language_bidi", "pluralize", "autoescape", "endautoescape"],
+    operator = /^[+\-*&%=<>!?|~^]/,
+    sign = /^[:\[\(\{]/,
+    atom = ["true", "false"],
+    number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
+
+    keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
+    atom = new RegExp("((" + atom.join(")|(") + "))\\b");
+
+    function tokenBase (stream, state) {
+      var ch = stream.peek();
+
+      //Comment
+      if (state.incomment) {
+        if(!stream.skipTo("#}")) {
+          stream.skipToEnd();
+        } else {
+          stream.eatWhile(/\#|}/);
+          state.incomment = false;
+        }
+        return "comment";
+      //Tag
+      } else if (state.intag) {
+        //After operator
+        if(state.operator) {
+          state.operator = false;
+          if(stream.match(atom)) {
+            return "atom";
+          }
+          if(stream.match(number)) {
+            return "number";
+          }
+        }
+        //After sign
+        if(state.sign) {
+          state.sign = false;
+          if(stream.match(atom)) {
+            return "atom";
+          }
+          if(stream.match(number)) {
+            return "number";
+          }
+        }
+
+        if(state.instring) {
+          if(ch == state.instring) {
+            state.instring = false;
+          }
+          stream.next();
+          return "string";
+        } else if(ch == "'" || ch == '"') {
+          state.instring = ch;
+          stream.next();
+          return "string";
+        }
+        else if (state.inbraces > 0 && ch ==")") {
+          stream.next()
+          state.inbraces--;
+        }
+        else if (ch == "(") {
+          stream.next()
+          state.inbraces++;
+        }
+        else if (state.inbrackets > 0 && ch =="]") {
+          stream.next()
+          state.inbrackets--;
+        }
+        else if (ch == "[") {
+          stream.next()
+          state.inbrackets++;
+        }
+        else if (!state.lineTag && (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}"))) {
+          state.intag = false;
+          return "tag";
+        } else if(stream.match(operator)) {
+          state.operator = true;
+          return "operator";
+        } else if(stream.match(sign)) {
+          state.sign = true;
+        } else {
+          if (stream.column() == 1 && state.lineTag && stream.match(keywords)) {
+            //allow nospace after tag before the keyword
+            return "keyword";
+          }
+          if(stream.eat(" ") || stream.sol()) {
+            if(stream.match(keywords)) {
+              return "keyword";
+            }
+            if(stream.match(atom)) {
+              return "atom";
+            }
+            if(stream.match(number)) {
+              return "number";
+            }
+            if(stream.sol()) {
+              stream.next();
+            }
+          } else {
+            stream.next();
+          }
+
+        }
+        return "variable";
+      } else if (stream.eat("{")) {
+        if (stream.eat("#")) {
+          state.incomment = true;
+          if(!stream.skipTo("#}")) {
+            stream.skipToEnd();
+          } else {
+            stream.eatWhile(/\#|}/);
+            state.incomment = false;
+          }
+          return "comment";
+        //Open tag
+        } else if (ch = stream.eat(/\{|%/)) {
+          //Cache close tag
+          state.intag = ch;
+          state.inbraces = 0;
+          state.inbrackets = 0;
+          if(ch == "{") {
+            state.intag = "}";
+          }
+          stream.eat("-");
+          return "tag";
+        }
+      //Line statements
+      } else if (stream.eat('#')) {
+        if (stream.peek() == '#') {
+          stream.skipToEnd();
+          return "comment"
+        }
+        else if (!stream.eol()) {
+          state.intag = true;
+          state.lineTag = true;
+          state.inbraces = 0;
+          state.inbrackets = 0;
+          return "tag";
+        }
+      }
+      stream.next();
+    };
+
+    return {
+      startState: function () {
+        return {
+          tokenize: tokenBase,
+          inbrackets:0,
+          inbraces:0
+        };
+      },
+      token: function(stream, state) {
+        var style = state.tokenize(stream, state);
+        if (stream.eol() && state.lineTag && !state.instring && state.inbraces == 0 && state.inbrackets == 0) {
+          //Close line statement at the EOL
+          state.intag = false
+          state.lineTag = false
+        }
+        return style;
+      },
+      blockCommentStart: "{#",
+      blockCommentEnd: "#}",
+      lineComment: "##",
+    };
+  });
+
+  CodeMirror.defineMIME("text/jinja2", "jinja2");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/jsx/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,89 @@
+<!doctype html>
+
+<title>CodeMirror: JSX mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="jsx.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">JSX</a>
+  </ul>
+</div>
+
+<article>
+<h2>JSX mode</h2>
+
+<div><textarea id="code" name="code">// Code snippets from http://facebook.github.io/react/docs/jsx-in-depth.html
+
+// Rendering HTML tags
+var myDivElement = <div className="foo" />;
+ReactDOM.render(myDivElement, document.getElementById('example'));
+
+// Rendering React components
+var MyComponent = React.createClass({/*...*/});
+var myElement = <MyComponent someProperty={true} />;
+ReactDOM.render(myElement, document.getElementById('example'));
+
+// Namespaced components
+var Form = MyFormComponent;
+
+var App = (
+  <Form>
+    <Form.Row>
+      <Form.Label />
+      <Form.Input />
+    </Form.Row>
+  </Form>
+);
+
+// Attribute JavaScript expressions
+var person = <Person name={window.isLoggedIn ? window.name : ''} />;
+
+// Boolean attributes
+<input type="button" disabled />;
+<input type="button" disabled={true} />;
+
+// Child JavaScript expressions
+var content = <Container>{window.isLoggedIn ? <Nav /> : <Login />}</Container>;
+
+// Comments
+var content = (
+  <Nav>
+    {/* child comment, put {} around */}
+    <Person
+      /* multi
+         line
+         comment */
+      name={window.isLoggedIn ? window.name : ''} // end of line comment
+    />
+  </Nav>
+);
+</textarea></div>
+
+<script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  mode: "jsx"
+})
+</script>
+
+<p>JSX Mode for <a href="http://facebook.github.io/react">React</a>'s
+JavaScript syntax extension.</p>
+
+<p><strong>MIME types defined:</strong> <code>text/jsx</code>, <code>text/typescript-jsx</code>.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/jsx/jsx.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,149 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../xml/xml"), require("../javascript/javascript"))
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../xml/xml", "../javascript/javascript"], mod)
+  else // Plain browser env
+    mod(CodeMirror)
+})(function(CodeMirror) {
+  "use strict"
+
+  // Depth means the amount of open braces in JS context, in XML
+  // context 0 means not in tag, 1 means in tag, and 2 means in tag
+  // and js block comment.
+  function Context(state, mode, depth, prev) {
+    this.state = state; this.mode = mode; this.depth = depth; this.prev = prev
+  }
+
+  function copyContext(context) {
+    return new Context(CodeMirror.copyState(context.mode, context.state),
+                       context.mode,
+                       context.depth,
+                       context.prev && copyContext(context.prev))
+  }
+
+  CodeMirror.defineMode("jsx", function(config, modeConfig) {
+    var xmlMode = CodeMirror.getMode(config, {name: "xml", allowMissing: true, multilineTagIndentPastTag: false, allowMissingTagName: true})
+    var jsMode = CodeMirror.getMode(config, modeConfig && modeConfig.base || "javascript")
+
+    function flatXMLIndent(state) {
+      var tagName = state.tagName
+      state.tagName = null
+      var result = xmlMode.indent(state, "", "")
+      state.tagName = tagName
+      return result
+    }
+
+    function token(stream, state) {
+      if (state.context.mode == xmlMode)
+        return xmlToken(stream, state, state.context)
+      else
+        return jsToken(stream, state, state.context)
+    }
+
+    function xmlToken(stream, state, cx) {
+      if (cx.depth == 2) { // Inside a JS /* */ comment
+        if (stream.match(/^.*?\*\//)) cx.depth = 1
+        else stream.skipToEnd()
+        return "comment"
+      }
+
+      if (stream.peek() == "{") {
+        xmlMode.skipAttribute(cx.state)
+
+        var indent = flatXMLIndent(cx.state), xmlContext = cx.state.context
+        // If JS starts on same line as tag
+        if (xmlContext && stream.match(/^[^>]*>\s*$/, false)) {
+          while (xmlContext.prev && !xmlContext.startOfLine)
+            xmlContext = xmlContext.prev
+          // If tag starts the line, use XML indentation level
+          if (xmlContext.startOfLine) indent -= config.indentUnit
+          // Else use JS indentation level
+          else if (cx.prev.state.lexical) indent = cx.prev.state.lexical.indented
+        // Else if inside of tag
+        } else if (cx.depth == 1) {
+          indent += config.indentUnit
+        }
+
+        state.context = new Context(CodeMirror.startState(jsMode, indent),
+                                    jsMode, 0, state.context)
+        return null
+      }
+
+      if (cx.depth == 1) { // Inside of tag
+        if (stream.peek() == "<") { // Tag inside of tag
+          xmlMode.skipAttribute(cx.state)
+          state.context = new Context(CodeMirror.startState(xmlMode, flatXMLIndent(cx.state)),
+                                      xmlMode, 0, state.context)
+          return null
+        } else if (stream.match("//")) {
+          stream.skipToEnd()
+          return "comment"
+        } else if (stream.match("/*")) {
+          cx.depth = 2
+          return token(stream, state)
+        }
+      }
+
+      var style = xmlMode.token(stream, cx.state), cur = stream.current(), stop
+      if (/\btag\b/.test(style)) {
+        if (/>$/.test(cur)) {
+          if (cx.state.context) cx.depth = 0
+          else state.context = state.context.prev
+        } else if (/^</.test(cur)) {
+          cx.depth = 1
+        }
+      } else if (!style && (stop = cur.indexOf("{")) > -1) {
+        stream.backUp(cur.length - stop)
+      }
+      return style
+    }
+
+    function jsToken(stream, state, cx) {
+      if (stream.peek() == "<" && !stream.match(/^<([^<>]|<[^>]*>)+,\s*>/, false) &&
+          jsMode.expressionAllowed(stream, cx.state)) {
+        state.context = new Context(CodeMirror.startState(xmlMode, jsMode.indent(cx.state, "", "")),
+                                    xmlMode, 0, state.context)
+        jsMode.skipExpression(cx.state)
+        return null
+      }
+
+      var style = jsMode.token(stream, cx.state)
+      if (!style && cx.depth != null) {
+        var cur = stream.current()
+        if (cur == "{") {
+          cx.depth++
+        } else if (cur == "}") {
+          if (--cx.depth == 0) state.context = state.context.prev
+        }
+      }
+      return style
+    }
+
+    return {
+      startState: function() {
+        return {context: new Context(CodeMirror.startState(jsMode), jsMode)}
+      },
+
+      copyState: function(state) {
+        return {context: copyContext(state.context)}
+      },
+
+      token: token,
+
+      indent: function(state, textAfter, fullLine) {
+        return state.context.mode.indent(state.context.state, textAfter, fullLine)
+      },
+
+      innerMode: function(state) {
+        return state.context
+      }
+    }
+  }, "xml", "javascript")
+
+  CodeMirror.defineMIME("text/jsx", "jsx")
+  CodeMirror.defineMIME("text/typescript-jsx", {name: "jsx", base: {name: "javascript", typescript: true}})
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/jsx/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,100 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "jsx")
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)) }
+
+  MT("selfclose",
+     "[keyword var] [def x] [operator =] [bracket&tag <] [tag foo] [bracket&tag />] [operator +] [number 1];")
+
+  MT("openclose",
+     "([bracket&tag <][tag foo][bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])")
+
+  MT("openclosefragment",
+     "([bracket&tag <><][tag foo][bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag ></>][operator ++])")
+
+  MT("attr",
+     "([bracket&tag <][tag foo] [attribute abc]=[string 'value'][bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])")
+
+  MT("braced_attr",
+     "([bracket&tag <][tag foo] [attribute abc]={[number 10]}[bracket&tag >]hello [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])")
+
+  MT("braced_text",
+     "([bracket&tag <][tag foo][bracket&tag >]hello {[number 10]} [atom &amp;][bracket&tag </][tag foo][bracket&tag >][operator ++])")
+
+  MT("nested_tag",
+     "([bracket&tag <][tag foo][bracket&tag ><][tag bar][bracket&tag ></][tag bar][bracket&tag ></][tag foo][bracket&tag >][operator ++])")
+
+  MT("nested_jsx",
+     "[keyword return] (",
+     "  [bracket&tag <][tag foo][bracket&tag >]",
+     "    say {[number 1] [operator +] [bracket&tag <][tag bar] [attribute attr]={[number 10]}[bracket&tag />]}!",
+     "  [bracket&tag </][tag foo][bracket&tag >][operator ++]",
+     ")")
+
+  MT("preserve_js_context",
+     "[variable x] [operator =] [string-2 `quasi${][bracket&tag <][tag foo][bracket&tag />][string-2 }quoted`]")
+
+  MT("string_interpolation",
+    "[variable x] [operator =] [string-2 `quasi<code>${] [number 10] [string-2 }</code>`]")
+
+  MT("line_comment",
+     "([bracket&tag <][tag foo] [comment // hello]",
+     "   [bracket&tag ></][tag foo][bracket&tag >][operator ++])")
+
+  MT("line_comment_not_in_tag",
+     "([bracket&tag <][tag foo][bracket&tag >] // hello",
+     "  [bracket&tag </][tag foo][bracket&tag >][operator ++])")
+
+  MT("block_comment",
+     "([bracket&tag <][tag foo] [comment /* hello]",
+     "[comment    line 2]",
+     "[comment    line 3 */] [bracket&tag ></][tag foo][bracket&tag >][operator ++])")
+
+  MT("block_comment_not_in_tag",
+     "([bracket&tag <][tag foo][bracket&tag >]/* hello",
+     "    line 2",
+     "    line 3 */ [bracket&tag </][tag foo][bracket&tag >][operator ++])")
+
+  MT("missing_attr",
+     "([bracket&tag <][tag foo] [attribute selected][bracket&tag />][operator ++])")
+
+  MT("indent_js",
+     "([bracket&tag <][tag foo][bracket&tag >]",
+     "    [bracket&tag <][tag bar] [attribute baz]={[keyword function]() {",
+     "        [keyword return] [number 10]",
+     "      }}[bracket&tag />]",
+     "  [bracket&tag </][tag foo][bracket&tag >])")
+
+  MT("spread",
+     "([bracket&tag <][tag foo] [attribute bar]={[meta ...][variable baz] [operator /][number 2]}[bracket&tag />])")
+
+  MT("tag_attribute",
+     "([bracket&tag <][tag foo] [attribute bar]=[bracket&tag <][tag foo][bracket&tag />/>][operator ++])")
+
+  MT("in_array",
+     "[[",
+     "  [bracket&tag <][tag Something][bracket&tag />],",
+     "  [string-2 `${][variable x][string-2 }`],",
+     "  [variable y]",
+     "]]")
+
+  var ts_mode = CodeMirror.getMode({indentUnit: 2}, "text/typescript-jsx")
+  function TS(name) { test.mode(name, ts_mode, Array.prototype.slice.call(arguments, 1)) }
+
+  TS("tsx_react_integration",
+     "[keyword interface] [def Props] {",
+     "  [property foo]: [type string];",
+     "}",
+     "[keyword class] [def MyComponent] [keyword extends] [type React].[type Component] [operator <] [type Props], [type any] [operator >] {",
+     "  [property render]() {",
+     "    [keyword return] [bracket&tag <][tag span][bracket&tag >]{[keyword this].[property props].[property foo]}[bracket&tag </][tag span][bracket&tag >]",
+     "  }",
+     "}",
+     "[bracket&tag <][tag MyComponent] [attribute foo]=[string \"bar\"] [bracket&tag />]; [comment //ok]",
+     "[bracket&tag <][tag MyComponent] [attribute foo]={[number 0]} [bracket&tag />]; [comment //error]")
+
+   TS("tsx_react_generics",
+      "[variable x] [operator =] [operator <] [variable T],[operator >] ([def v]: [type T]) [operator =>] [variable-2 v];")
+})()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/julia/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,196 @@
+<!doctype html>
+
+<title>CodeMirror: Julia mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="julia.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Julia</a>
+  </ul>
+</div>
+
+<article>
+<h2>Julia mode</h2>
+
+    <div><textarea id="code" name="code">
+#numbers
+1234
+1234im
+.234
+.234im
+2.23im
+2.3f3
+23e2
+0x234
+
+#strings
+'a'
+"asdf"
+r"regex"
+b"bytestring"
+
+"""
+multiline string
+"""
+
+#identifiers
+a
+as123
+function_name!
+
+#unicode identifiers
+# a = x\ddot
+a⃗ = ẍ
+# a = v\dot
+a⃗ = v̇
+#F\vec = m \cdotp a\vec
+F⃗ = m·a⃗
+
+#literal identifier multiples
+3x
+4[1, 2, 3]
+
+#dicts and indexing
+x=[1, 2, 3]
+x[end-1]
+x={"julia"=>"language of technical computing"}
+
+
+#exception handling
+try
+  f()
+catch
+  @printf "Error"
+finally
+  g()
+end
+
+#types
+immutable Color{T<:Number}
+  r::T
+  g::T
+  b::T
+end
+
+#functions
+function change!(x::Vector{Float64})
+  for i = 1:length(x)
+    x[i] *= 2
+  end
+end
+
+#function invocation
+f('b', (2, 3)...)
+
+#operators
+|=
+&=
+^=
+\-
+%=
+*=
++=
+-=
+<=
+>=
+!=
+==
+%
+*
++
+-
+<
+>
+!
+=
+|
+&
+^
+\
+?
+~
+:
+$
+<:
+.<
+.>
+<<
+<<=
+>>
+>>>>
+>>=
+>>>=
+<<=
+<<<=
+.<=
+.>=
+.==
+->
+//
+in
+...
+//
+:=
+.//=
+.*=
+./=
+.^=
+.%=
+.+=
+.-=
+\=
+\\=
+||
+===
+&&
+|=
+.|=
+<:
+>:
+|>
+<|
+::
+x ? y : z
+
+#macros
+@spawnat 2 1+1
+@eval(:x)
+
+#keywords and operators
+if else elseif while for
+ begin let end do
+try catch finally return break continue
+global local const 
+export import importall using
+function macro module baremodule 
+type immutable quote
+true false enumerate
+
+
+    </textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "julia",
+               },
+        lineNumbers: true,
+        indentUnit: 4,
+        matchBrackets: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-julia</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/julia/julia.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,390 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("julia", function(config, parserConf) {
+  function wordRegexp(words, end, pre) {
+    if (typeof pre === "undefined") { pre = ""; }
+    if (typeof end === "undefined") { end = "\\b"; }
+    return new RegExp("^" + pre + "((" + words.join(")|(") + "))" + end);
+  }
+
+  var octChar = "\\\\[0-7]{1,3}";
+  var hexChar = "\\\\x[A-Fa-f0-9]{1,2}";
+  var sChar = "\\\\[abefnrtv0%?'\"\\\\]";
+  var uChar = "([^\\u0027\\u005C\\uD800-\\uDFFF]|[\\uD800-\\uDFFF][\\uDC00-\\uDFFF])";
+
+  var asciiOperatorsList = [
+    "[<>]:", "[<>=]=", "<<=?", ">>>?=?", "=>", "--?>", "<--[->]?", "\\/\\/",
+    "\\.{2,3}", "[\\.\\\\%*+\\-<>!\\/^|&]=?", "\\?", "\\$", "~", ":"
+  ];
+  var operators = parserConf.operators || wordRegexp([
+    "[<>]:", "[<>=]=", "[!=]==", "<<=?", ">>>?=?", "=>?", "--?>", "<--[->]?", "\\/\\/",
+    "[\\\\%*+\\-<>!\\/^|&\\u00F7\\u22BB]=?", "\\?", "\\$", "~", ":",
+    "\\u00D7", "\\u2208", "\\u2209", "\\u220B", "\\u220C", "\\u2218",
+    "\\u221A", "\\u221B", "\\u2229", "\\u222A", "\\u2260", "\\u2264",
+    "\\u2265", "\\u2286", "\\u2288", "\\u228A", "\\u22C5",
+    "\\b(in|isa)\\b(?!\.?\\()"
+  ], "");
+  var delimiters = parserConf.delimiters || /^[;,()[\]{}]/;
+  var identifiers = parserConf.identifiers ||
+        /^[_A-Za-z\u00A1-\u2217\u2219-\uFFFF][\w\u00A1-\u2217\u2219-\uFFFF]*!*/;
+
+  var chars = wordRegexp([octChar, hexChar, sChar, uChar], "'");
+
+  var openersList = ["begin", "function", "type", "struct", "immutable", "let",
+        "macro", "for", "while", "quote", "if", "else", "elseif", "try",
+        "finally", "catch", "do"];
+
+  var closersList = ["end", "else", "elseif", "catch", "finally"];
+
+  var keywordsList = ["if", "else", "elseif", "while", "for", "begin", "let",
+        "end", "do", "try", "catch", "finally", "return", "break", "continue",
+        "global", "local", "const", "export", "import", "importall", "using",
+        "function", "where", "macro", "module", "baremodule", "struct", "type",
+        "mutable", "immutable", "quote", "typealias", "abstract", "primitive",
+        "bitstype"];
+
+  var builtinsList = ["true", "false", "nothing", "NaN", "Inf"];
+
+  CodeMirror.registerHelper("hintWords", "julia", keywordsList.concat(builtinsList));
+
+  var openers = wordRegexp(openersList);
+  var closers = wordRegexp(closersList);
+  var keywords = wordRegexp(keywordsList);
+  var builtins = wordRegexp(builtinsList);
+
+  var macro = /^@[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
+  var symbol = /^:[_A-Za-z\u00A1-\uFFFF][\w\u00A1-\uFFFF]*!*/;
+  var stringPrefixes = /^(`|([_A-Za-z\u00A1-\uFFFF]*"("")?))/;
+
+  var macroOperators = wordRegexp(asciiOperatorsList, "", "@");
+  var symbolOperators = wordRegexp(asciiOperatorsList, "", ":");
+
+  function inArray(state) {
+    return (state.nestedArrays > 0);
+  }
+
+  function inGenerator(state) {
+    return (state.nestedGenerators > 0);
+  }
+
+  function currentScope(state, n) {
+    if (typeof(n) === "undefined") { n = 0; }
+    if (state.scopes.length <= n) {
+      return null;
+    }
+    return state.scopes[state.scopes.length - (n + 1)];
+  }
+
+  // tokenizers
+  function tokenBase(stream, state) {
+    // Handle multiline comments
+    if (stream.match('#=', false)) {
+      state.tokenize = tokenComment;
+      return state.tokenize(stream, state);
+    }
+
+    // Handle scope changes
+    var leavingExpr = state.leavingExpr;
+    if (stream.sol()) {
+      leavingExpr = false;
+    }
+    state.leavingExpr = false;
+
+    if (leavingExpr) {
+      if (stream.match(/^'+/)) {
+        return "operator";
+      }
+    }
+
+    if (stream.match(/\.{4,}/)) {
+      return "error";
+    } else if (stream.match(/\.{1,3}/)) {
+      return "operator";
+    }
+
+    if (stream.eatSpace()) {
+      return null;
+    }
+
+    var ch = stream.peek();
+
+    // Handle single line comments
+    if (ch === '#') {
+      stream.skipToEnd();
+      return "comment";
+    }
+
+    if (ch === '[') {
+      state.scopes.push('[');
+      state.nestedArrays++;
+    }
+
+    if (ch === '(') {
+      state.scopes.push('(');
+      state.nestedGenerators++;
+    }
+
+    if (inArray(state) && ch === ']') {
+      while (state.scopes.length && currentScope(state) !== "[") { state.scopes.pop(); }
+      state.scopes.pop();
+      state.nestedArrays--;
+      state.leavingExpr = true;
+    }
+
+    if (inGenerator(state) && ch === ')') {
+      while (state.scopes.length && currentScope(state) !== "(") { state.scopes.pop(); }
+      state.scopes.pop();
+      state.nestedGenerators--;
+      state.leavingExpr = true;
+    }
+
+    if (inArray(state)) {
+      if (state.lastToken == "end" && stream.match(':')) {
+        return "operator";
+      }
+      if (stream.match('end')) {
+        return "number";
+      }
+    }
+
+    var match;
+    if (match = stream.match(openers, false)) {
+      state.scopes.push(match[0]);
+    }
+
+    if (stream.match(closers, false)) {
+      state.scopes.pop();
+    }
+
+    // Handle type annotations
+    if (stream.match(/^::(?![:\$])/)) {
+      state.tokenize = tokenAnnotation;
+      return state.tokenize(stream, state);
+    }
+
+    // Handle symbols
+    if (!leavingExpr && (stream.match(symbol) || stream.match(symbolOperators))) {
+      return "builtin";
+    }
+
+    // Handle parametric types
+    //if (stream.match(/^{[^}]*}(?=\()/)) {
+    //  return "builtin";
+    //}
+
+    // Handle operators and Delimiters
+    if (stream.match(operators)) {
+      return "operator";
+    }
+
+    // Handle Number Literals
+    if (stream.match(/^\.?\d/, false)) {
+      var imMatcher = RegExp(/^im\b/);
+      var numberLiteral = false;
+      if (stream.match(/^0x\.[0-9a-f_]+p[\+\-]?[_\d]+/i)) { numberLiteral = true; }
+      // Integers
+      if (stream.match(/^0x[0-9a-f_]+/i)) { numberLiteral = true; } // Hex
+      if (stream.match(/^0b[01_]+/i)) { numberLiteral = true; } // Binary
+      if (stream.match(/^0o[0-7_]+/i)) { numberLiteral = true; } // Octal
+      // Floats
+      if (stream.match(/^(?:(?:\d[_\d]*)?\.(?!\.)(?:\d[_\d]*)?|\d[_\d]*\.(?!\.)(?:\d[_\d]*))?([Eef][\+\-]?[_\d]+)?/i)) { numberLiteral = true; }
+      if (stream.match(/^\d[_\d]*(e[\+\-]?\d+)?/i)) { numberLiteral = true; } // Decimal
+      if (numberLiteral) {
+          // Integer literals may be "long"
+          stream.match(imMatcher);
+          state.leavingExpr = true;
+          return "number";
+      }
+    }
+
+    // Handle Chars
+    if (stream.match('\'')) {
+      state.tokenize = tokenChar;
+      return state.tokenize(stream, state);
+    }
+
+    // Handle Strings
+    if (stream.match(stringPrefixes)) {
+      state.tokenize = tokenStringFactory(stream.current());
+      return state.tokenize(stream, state);
+    }
+
+    if (stream.match(macro) || stream.match(macroOperators)) {
+      return "meta";
+    }
+
+    if (stream.match(delimiters)) {
+      return null;
+    }
+
+    if (stream.match(keywords)) {
+      return "keyword";
+    }
+
+    if (stream.match(builtins)) {
+      return "builtin";
+    }
+
+    var isDefinition = state.isDefinition || state.lastToken == "function" ||
+                       state.lastToken == "macro" || state.lastToken == "type" ||
+                       state.lastToken == "struct" || state.lastToken == "immutable";
+
+    if (stream.match(identifiers)) {
+      if (isDefinition) {
+        if (stream.peek() === '.') {
+          state.isDefinition = true;
+          return "variable";
+        }
+        state.isDefinition = false;
+        return "def";
+      }
+      state.leavingExpr = true;
+      return "variable";
+    }
+
+    // Handle non-detected items
+    stream.next();
+    return "error";
+  }
+
+  function tokenAnnotation(stream, state) {
+    stream.match(/.*?(?=[,;{}()=\s]|$)/);
+    if (stream.match('{')) {
+      state.nestedParameters++;
+    } else if (stream.match('}') && state.nestedParameters > 0) {
+      state.nestedParameters--;
+    }
+    if (state.nestedParameters > 0) {
+      stream.match(/.*?(?={|})/) || stream.next();
+    } else if (state.nestedParameters == 0) {
+      state.tokenize = tokenBase;
+    }
+    return "builtin";
+  }
+
+  function tokenComment(stream, state) {
+    if (stream.match('#=')) {
+      state.nestedComments++;
+    }
+    if (!stream.match(/.*?(?=(#=|=#))/)) {
+      stream.skipToEnd();
+    }
+    if (stream.match('=#')) {
+      state.nestedComments--;
+      if (state.nestedComments == 0)
+        state.tokenize = tokenBase;
+    }
+    return "comment";
+  }
+
+  function tokenChar(stream, state) {
+    var isChar = false, match;
+    if (stream.match(chars)) {
+      isChar = true;
+    } else if (match = stream.match(/\\u([a-f0-9]{1,4})(?=')/i)) {
+      var value = parseInt(match[1], 16);
+      if (value <= 55295 || value >= 57344) { // (U+0,U+D7FF), (U+E000,U+FFFF)
+        isChar = true;
+        stream.next();
+      }
+    } else if (match = stream.match(/\\U([A-Fa-f0-9]{5,8})(?=')/)) {
+      var value = parseInt(match[1], 16);
+      if (value <= 1114111) { // U+10FFFF
+        isChar = true;
+        stream.next();
+      }
+    }
+    if (isChar) {
+      state.leavingExpr = true;
+      state.tokenize = tokenBase;
+      return "string";
+    }
+    if (!stream.match(/^[^']+(?=')/)) { stream.skipToEnd(); }
+    if (stream.match('\'')) { state.tokenize = tokenBase; }
+    return "error";
+  }
+
+  function tokenStringFactory(delimiter) {
+    if (delimiter.substr(-3) === '"""') {
+      delimiter = '"""';
+    } else if (delimiter.substr(-1) === '"') {
+      delimiter = '"';
+    }
+    function tokenString(stream, state) {
+      if (stream.eat('\\')) {
+        stream.next();
+      } else if (stream.match(delimiter)) {
+        state.tokenize = tokenBase;
+        state.leavingExpr = true;
+        return "string";
+      } else {
+        stream.eat(/[`"]/);
+      }
+      stream.eatWhile(/[^\\`"]/);
+      return "string";
+    }
+    return tokenString;
+  }
+
+  var external = {
+    startState: function() {
+      return {
+        tokenize: tokenBase,
+        scopes: [],
+        lastToken: null,
+        leavingExpr: false,
+        isDefinition: false,
+        nestedArrays: 0,
+        nestedComments: 0,
+        nestedGenerators: 0,
+        nestedParameters: 0,
+        firstParenPos: -1
+      };
+    },
+
+    token: function(stream, state) {
+      var style = state.tokenize(stream, state);
+      var current = stream.current();
+
+      if (current && style) {
+        state.lastToken = current;
+      }
+
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var delta = 0;
+      if ( textAfter === ']' || textAfter === ')' || /^end\b/.test(textAfter) ||
+           /^else/.test(textAfter) || /^catch\b/.test(textAfter) || /^elseif\b/.test(textAfter) ||
+           /^finally/.test(textAfter) ) {
+        delta = -1;
+      }
+      return (state.scopes.length + delta) * config.indentUnit;
+    },
+
+    electricInput: /\b(end|else|catch|finally)\b/,
+    blockCommentStart: "#=",
+    blockCommentEnd: "=#",
+    lineComment: "#",
+    closeBrackets: "()[]{}\"\"",
+    fold: "indent"
+  };
+  return external;
+});
+
+
+CodeMirror.defineMIME("text/x-julia", "julia");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/livescript/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,459 @@
+<!doctype html>
+
+<title>CodeMirror: LiveScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/solarized.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="livescript.js"></script>
+<style>.CodeMirror {font-size: 80%;border-top: 1px solid silver; border-bottom: 1px solid silver;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">LiveScript</a>
+  </ul>
+</div>
+
+<article>
+<h2>LiveScript mode</h2>
+<form><textarea id="code" name="code">
+# LiveScript mode for CodeMirror
+# The following script, prelude.ls, is used to
+# demonstrate LiveScript mode for CodeMirror.
+#   https://github.com/gkz/prelude-ls
+
+export objToFunc = objToFunc = (obj) ->
+  (key) -> obj[key]
+
+export each = (f, xs) -->
+  if typeof! xs is \Object
+    for , x of xs then f x
+  else
+    for x in xs then f x
+  xs
+
+export map = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  type = typeof! xs
+  if type is \Object
+    {[key, f x] for key, x of xs}
+  else
+    result = [f x for x in xs]
+    if type is \String then result * '' else result
+
+export filter = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  type = typeof! xs
+  if type is \Object
+    {[key, x] for key, x of xs when f x}
+  else
+    result = [x for x in xs when f x]
+    if type is \String then result * '' else result
+
+export reject = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  type = typeof! xs
+  if type is \Object
+    {[key, x] for key, x of xs when not f x}
+  else
+    result = [x for x in xs when not f x]
+    if type is \String then result * '' else result
+
+export partition = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  type = typeof! xs
+  if type is \Object
+    passed = {}
+    failed = {}
+    for key, x of xs
+      (if f x then passed else failed)[key] = x
+  else
+    passed = []
+    failed = []
+    for x in xs
+      (if f x then passed else failed)push x
+    if type is \String
+      passed *= ''
+      failed *= ''
+  [passed, failed]
+
+export find = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  if typeof! xs is \Object
+    for , x of xs when f x then return x
+  else
+    for x in xs when f x then return x
+  void
+
+export head = export first = (xs) ->
+  return void if not xs.length
+  xs.0
+
+export tail = (xs) ->
+  return void if not xs.length
+  xs.slice 1
+
+export last = (xs) ->
+  return void if not xs.length
+  xs[*-1]
+
+export initial = (xs) ->
+  return void if not xs.length
+  xs.slice 0 xs.length - 1
+
+export empty = (xs) ->
+  if typeof! xs is \Object
+    for x of xs then return false
+    return yes
+  not xs.length
+
+export values = (obj) ->
+  [x for , x of obj]
+
+export keys = (obj) ->
+  [x for x of obj]
+
+export len = (xs) ->
+  xs = values xs if typeof! xs is \Object
+  xs.length
+
+export cons = (x, xs) -->
+  if typeof! xs is \String then x + xs else [x] ++ xs
+
+export append = (xs, ys) -->
+  if typeof! ys is \String then xs + ys else xs ++ ys
+
+export join = (sep, xs) -->
+  xs = values xs if typeof! xs is \Object
+  xs.join sep
+
+export reverse = (xs) ->
+  if typeof! xs is \String
+  then (xs / '')reverse! * ''
+  else xs.slice!reverse!
+
+export fold = export foldl = (f, memo, xs) -->
+  if typeof! xs is \Object
+    for , x of xs then memo = f memo, x
+  else
+    for x in xs then memo = f memo, x
+  memo
+
+export fold1 = export foldl1 = (f, xs) --> fold f, xs.0, xs.slice 1
+
+export foldr = (f, memo, xs) --> fold f, memo, xs.slice!reverse!
+
+export foldr1 = (f, xs) -->
+  xs.=slice!reverse!
+  fold f, xs.0, xs.slice 1
+
+export unfoldr = export unfold = (f, b) -->
+  if (f b)?
+    [that.0] ++ unfoldr f, that.1
+  else
+    []
+
+export andList = (xs) ->
+  for x in xs when not x
+    return false
+  true
+
+export orList = (xs) ->
+  for x in xs when x
+    return true
+  false
+
+export any = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  for x in xs when f x
+    return yes
+  no
+
+export all = (f, xs) -->
+  f = objToFunc f if typeof! f isnt \Function
+  for x in xs when not f x
+    return no
+  yes
+
+export unique = (xs) ->
+  result = []
+  if typeof! xs is \Object
+    for , x of xs when x not in result then result.push x
+  else
+    for x   in xs when x not in result then result.push x
+  if typeof! xs is \String then result * '' else result
+
+export sort = (xs) ->
+  xs.concat!sort (x, y) ->
+    | x > y =>  1
+    | x < y => -1
+    | _     =>  0
+
+export sortBy = (f, xs) -->
+  return [] unless xs.length
+  xs.concat!sort f
+
+export compare = (f, x, y) -->
+  | (f x) > (f y) =>  1
+  | (f x) < (f y) => -1
+  | otherwise     =>  0
+
+export sum = (xs) ->
+  result = 0
+  if typeof! xs is \Object
+    for , x of xs then result += x
+  else
+    for x   in xs then result += x
+  result
+
+export product = (xs) ->
+  result = 1
+  if typeof! xs is \Object
+    for , x of xs then result *= x
+  else
+    for x   in xs then result *= x
+  result
+
+export mean = export average = (xs) -> (sum xs) / len xs
+
+export concat = (xss) -> fold append, [], xss
+
+export concatMap = (f, xs) --> fold ((memo, x) -> append memo, f x), [], xs
+
+export listToObj = (xs) ->
+  {[x.0, x.1] for x in xs}
+
+export maximum = (xs) -> fold1 (>?), xs
+
+export minimum = (xs) -> fold1 (<?), xs
+
+export scan = export scanl = (f, memo, xs) -->
+  last = memo
+  if typeof! xs is \Object
+  then [memo] ++ [last = f last, x for , x of xs]
+  else [memo] ++ [last = f last, x for x in xs]
+
+export scan1 = export scanl1 = (f, xs) --> scan f, xs.0, xs.slice 1
+
+export scanr = (f, memo, xs) -->
+  xs.=slice!reverse!
+  scan f, memo, xs .reverse!
+
+export scanr1 = (f, xs) -->
+  xs.=slice!reverse!
+  scan f, xs.0, xs.slice 1 .reverse!
+
+export replicate = (n, x) -->
+  result = []
+  i = 0
+  while i < n, ++i then result.push x
+  result
+
+export take = (n, xs) -->
+  | n <= 0
+    if typeof! xs is \String then '' else []
+  | not xs.length => xs
+  | otherwise     => xs.slice 0, n
+
+export drop = (n, xs) -->
+  | n <= 0        => xs
+  | not xs.length => xs
+  | otherwise     => xs.slice n
+
+export splitAt = (n, xs) --> [(take n, xs), (drop n, xs)]
+
+export takeWhile = (p, xs) -->
+  return xs if not xs.length
+  p = objToFunc p if typeof! p isnt \Function
+  result = []
+  for x in xs
+    break if not p x
+    result.push x
+  if typeof! xs is \String then result * '' else result
+
+export dropWhile = (p, xs) -->
+  return xs if not xs.length
+  p = objToFunc p if typeof! p isnt \Function
+  i = 0
+  for x in xs
+    break if not p x
+    ++i
+  drop i, xs
+
+export span = (p, xs) --> [(takeWhile p, xs), (dropWhile p, xs)]
+
+export breakIt = (p, xs) --> span (not) << p, xs
+
+export zip = (xs, ys) -->
+  result = []
+  for zs, i in [xs, ys]
+    for z, j in zs
+      result.push [] if i is 0
+      result[j]?push z
+  result
+
+export zipWith = (f,xs, ys) -->
+  f = objToFunc f if typeof! f isnt \Function
+  if not xs.length or not ys.length
+    []
+  else
+    [f.apply this, zs for zs in zip.call this, xs, ys]
+
+export zipAll = (...xss) ->
+  result = []
+  for xs, i in xss
+    for x, j in xs
+      result.push [] if i is 0
+      result[j]?push x
+  result
+
+export zipAllWith = (f, ...xss) ->
+  f = objToFunc f if typeof! f isnt \Function
+  if not xss.0.length or not xss.1.length
+    []
+  else
+    [f.apply this, xs for xs in zipAll.apply this, xss]
+
+export compose = (...funcs) ->
+  ->
+    args = arguments
+    for f in funcs
+      args = [f.apply this, args]
+    args.0
+
+export curry = (f) ->
+  curry$ f # using util method curry$ from livescript
+
+export id = (x) -> x
+
+export flip = (f, x, y) --> f y, x
+
+export fix = (f) ->
+  ( (g, x) -> -> f(g g) ...arguments ) do
+    (g, x) -> -> f(g g) ...arguments
+
+export lines = (str) ->
+  return [] if not str.length
+  str / \\n
+
+export unlines = (strs) -> strs * \\n
+
+export words = (str) ->
+  return [] if not str.length
+  str / /[ ]+/
+
+export unwords = (strs) -> strs * ' '
+
+export max = (>?)
+
+export min = (<?)
+
+export negate = (x) -> -x
+
+export abs = Math.abs
+
+export signum = (x) ->
+  | x < 0     => -1
+  | x > 0     =>  1
+  | otherwise =>  0
+
+export quot = (x, y) --> ~~(x / y)
+
+export rem = (%)
+
+export div = (x, y) --> Math.floor x / y
+
+export mod = (%%)
+
+export recip = (1 /)
+
+export pi = Math.PI
+
+export tau = pi * 2
+
+export exp = Math.exp
+
+export sqrt = Math.sqrt
+
+# changed from log as log is a
+# common function for logging things
+export ln = Math.log
+
+export pow = (^)
+
+export sin = Math.sin
+
+export tan = Math.tan
+
+export cos = Math.cos
+
+export asin = Math.asin
+
+export acos = Math.acos
+
+export atan = Math.atan
+
+export atan2 = (x, y) --> Math.atan2 x, y
+
+# sinh
+# tanh
+# cosh
+# asinh
+# atanh
+# acosh
+
+export truncate = (x) -> ~~x
+
+export round = Math.round
+
+export ceiling = Math.ceil
+
+export floor = Math.floor
+
+export isItNaN = (x) -> x isnt x
+
+export even = (x) -> x % 2 == 0
+
+export odd = (x) -> x % 2 != 0
+
+export gcd = (x, y) -->
+  x = Math.abs x
+  y = Math.abs y
+  until y is 0
+    z = x % y
+    x = y
+    y = z
+  x
+
+export lcm = (x, y) -->
+  Math.abs Math.floor (x / (gcd x, y) * y)
+
+# meta
+export installPrelude = !(target) ->
+  unless target.prelude?isInstalled
+    target <<< out$ # using out$ generated by livescript
+    target <<< target.prelude.isInstalled = true
+
+export prelude = out$
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        theme: "solarized light",
+        lineNumbers: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-livescript</code>.</p>
+
+    <p>The LiveScript mode was written by Kenneth Bentley.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/livescript/livescript.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,280 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Link to the project's GitHub page:
+ * https://github.com/duralog/CodeMirror
+ */
+
+(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.defineMode('livescript', function(){
+    var tokenBase = function(stream, state) {
+      var next_rule = state.next || "start";
+      if (next_rule) {
+        state.next = state.next;
+        var nr = Rules[next_rule];
+        if (nr.splice) {
+          for (var i$ = 0; i$ < nr.length; ++i$) {
+            var r = nr[i$];
+            if (r.regex && stream.match(r.regex)) {
+              state.next = r.next || state.next;
+              return r.token;
+            }
+          }
+          stream.next();
+          return 'error';
+        }
+        if (stream.match(r = Rules[next_rule])) {
+          if (r.regex && stream.match(r.regex)) {
+            state.next = r.next;
+            return r.token;
+          } else {
+            stream.next();
+            return 'error';
+          }
+        }
+      }
+      stream.next();
+      return 'error';
+    };
+    var external = {
+      startState: function(){
+        return {
+          next: 'start',
+          lastToken: {style: null, indent: 0, content: ""}
+        };
+      },
+      token: function(stream, state){
+        while (stream.pos == stream.start)
+          var style = tokenBase(stream, state);
+        state.lastToken = {
+          style: style,
+          indent: stream.indentation(),
+          content: stream.current()
+        };
+        return style.replace(/\./g, ' ');
+      },
+      indent: function(state){
+        var indentation = state.lastToken.indent;
+        if (state.lastToken.content.match(indenter)) {
+          indentation += 2;
+        }
+        return indentation;
+      }
+    };
+    return external;
+  });
+
+  var identifier = '(?![\\d\\s])[$\\w\\xAA-\\uFFDC](?:(?!\\s)[$\\w\\xAA-\\uFFDC]|-[A-Za-z])*';
+  var indenter = RegExp('(?:[({[=:]|[-~]>|\\b(?:e(?:lse|xport)|d(?:o|efault)|t(?:ry|hen)|finally|import(?:\\s*all)?|const|var|let|new|catch(?:\\s*' + identifier + ')?))\\s*$');
+  var keywordend = '(?![$\\w]|-[A-Za-z]|\\s*:(?![:=]))';
+  var stringfill = {
+    token: 'string',
+    regex: '.+'
+  };
+  var Rules = {
+    start: [
+      {
+        token: 'comment.doc',
+        regex: '/\\*',
+        next: 'comment'
+      }, {
+        token: 'comment',
+        regex: '#.*'
+      }, {
+        token: 'keyword',
+        regex: '(?:t(?:h(?:is|row|en)|ry|ypeof!?)|c(?:on(?:tinue|st)|a(?:se|tch)|lass)|i(?:n(?:stanceof)?|mp(?:ort(?:\\s+all)?|lements)|[fs])|d(?:e(?:fault|lete|bugger)|o)|f(?:or(?:\\s+own)?|inally|unction)|s(?:uper|witch)|e(?:lse|x(?:tends|port)|val)|a(?:nd|rguments)|n(?:ew|ot)|un(?:less|til)|w(?:hile|ith)|o[fr]|return|break|let|var|loop)' + keywordend
+      }, {
+        token: 'constant.language',
+        regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend
+      }, {
+        token: 'invalid.illegal',
+        regex: '(?:p(?:ackage|r(?:ivate|otected)|ublic)|i(?:mplements|nterface)|enum|static|yield)' + keywordend
+      }, {
+        token: 'language.support.class',
+        regex: '(?:R(?:e(?:gExp|ferenceError)|angeError)|S(?:tring|yntaxError)|E(?:rror|valError)|Array|Boolean|Date|Function|Number|Object|TypeError|URIError)' + keywordend
+      }, {
+        token: 'language.support.function',
+        regex: '(?:is(?:NaN|Finite)|parse(?:Int|Float)|Math|JSON|(?:en|de)codeURI(?:Component)?)' + keywordend
+      }, {
+        token: 'variable.language',
+        regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend
+      }, {
+        token: 'identifier',
+        regex: identifier + '\\s*:(?![:=])'
+      }, {
+        token: 'variable',
+        regex: identifier
+      }, {
+        token: 'keyword.operator',
+        regex: '(?:\\.{3}|\\s+\\?)'
+      }, {
+        token: 'keyword.variable',
+        regex: '(?:@+|::|\\.\\.)',
+        next: 'key'
+      }, {
+        token: 'keyword.operator',
+        regex: '\\.\\s*',
+        next: 'key'
+      }, {
+        token: 'string',
+        regex: '\\\\\\S[^\\s,;)}\\]]*'
+      }, {
+        token: 'string.doc',
+        regex: '\'\'\'',
+        next: 'qdoc'
+      }, {
+        token: 'string.doc',
+        regex: '"""',
+        next: 'qqdoc'
+      }, {
+        token: 'string',
+        regex: '\'',
+        next: 'qstring'
+      }, {
+        token: 'string',
+        regex: '"',
+        next: 'qqstring'
+      }, {
+        token: 'string',
+        regex: '`',
+        next: 'js'
+      }, {
+        token: 'string',
+        regex: '<\\[',
+        next: 'words'
+      }, {
+        token: 'string.regex',
+        regex: '//',
+        next: 'heregex'
+      }, {
+        token: 'string.regex',
+        regex: '\\/(?:[^[\\/\\n\\\\]*(?:(?:\\\\.|\\[[^\\]\\n\\\\]*(?:\\\\.[^\\]\\n\\\\]*)*\\])[^[\\/\\n\\\\]*)*)\\/[gimy$]{0,4}',
+        next: 'key'
+      }, {
+        token: 'constant.numeric',
+        regex: '(?:0x[\\da-fA-F][\\da-fA-F_]*|(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]*|(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*)(?:e[+-]?\\d[\\d_]*)?[\\w$]*)'
+      }, {
+        token: 'lparen',
+        regex: '[({[]'
+      }, {
+        token: 'rparen',
+        regex: '[)}\\]]',
+        next: 'key'
+      }, {
+        token: 'keyword.operator',
+        regex: '\\S+'
+      }, {
+        token: 'text',
+        regex: '\\s+'
+      }
+    ],
+    heregex: [
+      {
+        token: 'string.regex',
+        regex: '.*?//[gimy$?]{0,4}',
+        next: 'start'
+      }, {
+        token: 'string.regex',
+        regex: '\\s*#{'
+      }, {
+        token: 'comment.regex',
+        regex: '\\s+(?:#.*)?'
+      }, {
+        token: 'string.regex',
+        regex: '\\S+'
+      }
+    ],
+    key: [
+      {
+        token: 'keyword.operator',
+        regex: '[.?@!]+'
+      }, {
+        token: 'identifier',
+        regex: identifier,
+        next: 'start'
+      }, {
+        token: 'text',
+        regex: '',
+        next: 'start'
+      }
+    ],
+    comment: [
+      {
+        token: 'comment.doc',
+        regex: '.*?\\*/',
+        next: 'start'
+      }, {
+        token: 'comment.doc',
+        regex: '.+'
+      }
+    ],
+    qdoc: [
+      {
+        token: 'string',
+        regex: ".*?'''",
+        next: 'key'
+      }, stringfill
+    ],
+    qqdoc: [
+      {
+        token: 'string',
+        regex: '.*?"""',
+        next: 'key'
+      }, stringfill
+    ],
+    qstring: [
+      {
+        token: 'string',
+        regex: '[^\\\\\']*(?:\\\\.[^\\\\\']*)*\'',
+        next: 'key'
+      }, stringfill
+    ],
+    qqstring: [
+      {
+        token: 'string',
+        regex: '[^\\\\"]*(?:\\\\.[^\\\\"]*)*"',
+        next: 'key'
+      }, stringfill
+    ],
+    js: [
+      {
+        token: 'string',
+        regex: '[^\\\\`]*(?:\\\\.[^\\\\`]*)*`',
+        next: 'key'
+      }, stringfill
+    ],
+    words: [
+      {
+        token: 'string',
+        regex: '.*?\\]>',
+        next: 'key'
+      }, stringfill
+    ]
+  };
+  for (var idx in Rules) {
+    var r = Rules[idx];
+    if (r.splice) {
+      for (var i = 0, len = r.length; i < len; ++i) {
+        var rr = r[i];
+        if (typeof rr.regex === 'string') {
+          Rules[idx][i].regex = new RegExp('^' + rr.regex);
+        }
+      }
+    } else if (typeof rr.regex === 'string') {
+      Rules[idx].regex = new RegExp('^' + r.regex);
+    }
+  }
+
+  CodeMirror.defineMIME('text/x-livescript', 'livescript');
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/lua/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: Lua mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/neat.css">
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../../lib/codemirror.js"></script>
+<script src="lua.js"></script>
+<style>.CodeMirror {border: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Lua</a>
+  </ul>
+</div>
+
+<article>
+<h2>Lua mode</h2>
+<form><textarea id="code" name="code">
+--[[
+example useless code to show lua syntax highlighting
+this is multiline comment
+]]
+
+function blahblahblah(x)
+
+  local table = {
+    "asd" = 123,
+    "x" = 0.34,  
+  }
+  if x ~= 3 then
+    print( x )
+  elseif x == "string"
+    my_custom_function( 0x34 )
+  else
+    unknown_function( "some string" )
+  end
+
+  --single line comment
+  
+end
+
+function blablabla3()
+
+  for k,v in ipairs( table ) do
+    --abcde..
+    y=[=[
+  x=[[
+      x is a multi line string
+   ]]
+  but its definition is iside a highest level string!
+  ]=]
+    print(" \"\" ")
+
+    s = math.sin( x )
+  end
+
+end
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        matchBrackets: true,
+        theme: "neat"
+      });
+    </script>
+
+    <p>Loosely based on Franciszek
+    Wawrzak's <a href="https://codemirror.net/5/1/contrib/lua">CodeMirror
+    1 mode</a>. One configuration parameter is
+    supported, <code>specials</code>, to which you can provide an
+    array of strings to have those identifiers highlighted with
+    the <code>lua-special</code> style.</p>
+    <p><strong>MIME types defined:</strong> <code>text/x-lua</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/lua/lua.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,160 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// LUA mode. Ported to CodeMirror 2 from Franciszek Wawrzak's
+// CodeMirror 1 mode.
+// highlights keywords, strings, comments (no leveling supported! ("[==[")), tokens, basic indenting
+
+(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.defineMode("lua", function(config, parserConfig) {
+  var indentUnit = config.indentUnit;
+
+  function prefixRE(words) {
+    return new RegExp("^(?:" + words.join("|") + ")", "i");
+  }
+  function wordRE(words) {
+    return new RegExp("^(?:" + words.join("|") + ")$", "i");
+  }
+  var specials = wordRE(parserConfig.specials || []);
+
+  // long list of standard functions from lua manual
+  var builtins = wordRE([
+    "_G","_VERSION","assert","collectgarbage","dofile","error","getfenv","getmetatable","ipairs","load",
+    "loadfile","loadstring","module","next","pairs","pcall","print","rawequal","rawget","rawset","require",
+    "select","setfenv","setmetatable","tonumber","tostring","type","unpack","xpcall",
+
+    "coroutine.create","coroutine.resume","coroutine.running","coroutine.status","coroutine.wrap","coroutine.yield",
+
+    "debug.debug","debug.getfenv","debug.gethook","debug.getinfo","debug.getlocal","debug.getmetatable",
+    "debug.getregistry","debug.getupvalue","debug.setfenv","debug.sethook","debug.setlocal","debug.setmetatable",
+    "debug.setupvalue","debug.traceback",
+
+    "close","flush","lines","read","seek","setvbuf","write",
+
+    "io.close","io.flush","io.input","io.lines","io.open","io.output","io.popen","io.read","io.stderr","io.stdin",
+    "io.stdout","io.tmpfile","io.type","io.write",
+
+    "math.abs","math.acos","math.asin","math.atan","math.atan2","math.ceil","math.cos","math.cosh","math.deg",
+    "math.exp","math.floor","math.fmod","math.frexp","math.huge","math.ldexp","math.log","math.log10","math.max",
+    "math.min","math.modf","math.pi","math.pow","math.rad","math.random","math.randomseed","math.sin","math.sinh",
+    "math.sqrt","math.tan","math.tanh",
+
+    "os.clock","os.date","os.difftime","os.execute","os.exit","os.getenv","os.remove","os.rename","os.setlocale",
+    "os.time","os.tmpname",
+
+    "package.cpath","package.loaded","package.loaders","package.loadlib","package.path","package.preload",
+    "package.seeall",
+
+    "string.byte","string.char","string.dump","string.find","string.format","string.gmatch","string.gsub",
+    "string.len","string.lower","string.match","string.rep","string.reverse","string.sub","string.upper",
+
+    "table.concat","table.insert","table.maxn","table.remove","table.sort"
+  ]);
+  var keywords = wordRE(["and","break","elseif","false","nil","not","or","return",
+                         "true","function", "end", "if", "then", "else", "do",
+                         "while", "repeat", "until", "for", "in", "local" ]);
+
+  var indentTokens = wordRE(["function", "if","repeat","do", "\\(", "{"]);
+  var dedentTokens = wordRE(["end", "until", "\\)", "}"]);
+  var dedentPartial = prefixRE(["end", "until", "\\)", "}", "else", "elseif"]);
+
+  function readBracket(stream) {
+    var level = 0;
+    while (stream.eat("=")) ++level;
+    stream.eat("[");
+    return level;
+  }
+
+  function normal(stream, state) {
+    var ch = stream.next();
+    if (ch == "-" && stream.eat("-")) {
+      if (stream.eat("[") && stream.eat("["))
+        return (state.cur = bracketed(readBracket(stream), "comment"))(stream, state);
+      stream.skipToEnd();
+      return "comment";
+    }
+    if (ch == "\"" || ch == "'")
+      return (state.cur = string(ch))(stream, state);
+    if (ch == "[" && /[\[=]/.test(stream.peek()))
+      return (state.cur = bracketed(readBracket(stream), "string"))(stream, state);
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w.%]/);
+      return "number";
+    }
+    if (/[\w_]/.test(ch)) {
+      stream.eatWhile(/[\w\\\-_.]/);
+      return "variable";
+    }
+    return null;
+  }
+
+  function bracketed(level, style) {
+    return function(stream, state) {
+      var curlev = null, ch;
+      while ((ch = stream.next()) != null) {
+        if (curlev == null) {if (ch == "]") curlev = 0;}
+        else if (ch == "=") ++curlev;
+        else if (ch == "]" && curlev == level) { state.cur = normal; break; }
+        else curlev = null;
+      }
+      return style;
+    };
+  }
+
+  function string(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) break;
+        escaped = !escaped && ch == "\\";
+      }
+      if (!escaped) state.cur = normal;
+      return "string";
+    };
+  }
+
+  return {
+    startState: function(basecol) {
+      return {basecol: basecol || 0, indentDepth: 0, cur: normal};
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      var style = state.cur(stream, state);
+      var word = stream.current();
+      if (style == "variable") {
+        if (keywords.test(word)) style = "keyword";
+        else if (builtins.test(word)) style = "builtin";
+        else if (specials.test(word)) style = "variable-2";
+      }
+      if ((style != "comment") && (style != "string")){
+        if (indentTokens.test(word)) ++state.indentDepth;
+        else if (dedentTokens.test(word)) --state.indentDepth;
+      }
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var closing = dedentPartial.test(textAfter);
+      return state.basecol + indentUnit * (state.indentDepth - (closing ? 1 : 0));
+    },
+
+    electricInput: /^\s*(?:end|until|else|\)|\})$/,
+    lineComment: "--",
+    blockCommentStart: "--[[",
+    blockCommentEnd: "]]"
+  };
+});
+
+CodeMirror.defineMIME("text/x-lua", "lua");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/markdown/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,418 @@
+<!doctype html>
+
+<title>CodeMirror: Markdown mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/continuelist.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="markdown.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .cm-s-default .cm-trailing-space-a:before,
+      .cm-s-default .cm-trailing-space-b:before {position: absolute; content: "\00B7"; color: #777;}
+      .cm-s-default .cm-trailing-space-new-line:before {position: absolute; content: "\21B5"; color: #777;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Markdown</a>
+  </ul>
+</div>
+
+<article>
+<h2>Markdown mode</h2>
+<form><textarea id="code" name="code">
+Markdown: Basics
+================
+
+&lt;ul id="ProjectSubmenu"&gt;
+    &lt;li&gt;&lt;a href="/projects/markdown/" title="Markdown Project Page"&gt;Main&lt;/a&gt;&lt;/li&gt;
+    &lt;li&gt;&lt;a class="selected" title="Markdown Basics"&gt;Basics&lt;/a&gt;&lt;/li&gt;
+    &lt;li&gt;&lt;a href="/projects/markdown/syntax" title="Markdown Syntax Documentation"&gt;Syntax&lt;/a&gt;&lt;/li&gt;
+    &lt;li&gt;&lt;a href="/projects/markdown/license" title="Pricing and License Information"&gt;License&lt;/a&gt;&lt;/li&gt;
+    &lt;li&gt;&lt;a href="/projects/markdown/dingus" title="Online Markdown Web Form"&gt;Dingus&lt;/a&gt;&lt;/li&gt;
+&lt;/ul&gt;
+
+
+Getting the Gist of Markdown's Formatting Syntax
+------------------------------------------------
+
+This page offers a brief overview of what it's like to use Markdown.
+The [syntax page] [s] provides complete, detailed documentation for
+every feature, but Markdown should be very easy to pick up simply by
+looking at a few examples of it in action. The examples on this page
+are written in a before/after style, showing example syntax and the
+HTML output produced by Markdown.
+
+It's also helpful to simply try Markdown out; the [Dingus] [d] is a
+web application that allows you type your own Markdown-formatted text
+and translate it to XHTML.
+
+**Note:** This document is itself written using Markdown; you
+can [see the source for it by adding '.text' to the URL] [src].
+
+  [s]: /projects/markdown/syntax  "Markdown Syntax"
+  [d]: /projects/markdown/dingus  "Markdown Dingus"
+  [src]: /projects/markdown/basics.text
+
+
+## Paragraphs, Headers, Blockquotes ##
+
+A paragraph is simply one or more consecutive lines of text, separated
+by one or more blank lines. (A blank line is any line that looks like
+a blank line -- a line containing nothing but spaces or tabs is
+considered blank.) Normal paragraphs should not be indented with
+spaces or tabs.
+
+Markdown offers two styles of headers: *Setext* and *atx*.
+Setext-style headers for `&lt;h1&gt;` and `&lt;h2&gt;` are created by
+"underlining" with equal signs (`=`) and hyphens (`-`), respectively.
+To create an atx-style header, you put 1-6 hash marks (`#`) at the
+beginning of the line -- the number of hashes equals the resulting
+HTML header level.
+
+Blockquotes are indicated using email-style '`&gt;`' angle brackets.
+
+Markdown:
+
+    A First Level Header
+    ====================
+
+    A Second Level Header
+    ---------------------
+
+    Now is the time for all good men to come to
+    the aid of their country. This is just a
+    regular paragraph.
+
+    The quick brown fox jumped over the lazy
+    dog's back.
+
+    ### Header 3
+
+    &gt; This is a blockquote.
+    &gt;
+    &gt; This is the second paragraph in the blockquote.
+    &gt;
+    &gt; ## This is an H2 in a blockquote
+
+
+Output:
+
+    &lt;h1&gt;A First Level Header&lt;/h1&gt;
+
+    &lt;h2&gt;A Second Level Header&lt;/h2&gt;
+
+    &lt;p&gt;Now is the time for all good men to come to
+    the aid of their country. This is just a
+    regular paragraph.&lt;/p&gt;
+
+    &lt;p&gt;The quick brown fox jumped over the lazy
+    dog's back.&lt;/p&gt;
+
+    &lt;h3&gt;Header 3&lt;/h3&gt;
+
+    &lt;blockquote&gt;
+        &lt;p&gt;This is a blockquote.&lt;/p&gt;
+
+        &lt;p&gt;This is the second paragraph in the blockquote.&lt;/p&gt;
+
+        &lt;h2&gt;This is an H2 in a blockquote&lt;/h2&gt;
+    &lt;/blockquote&gt;
+
+
+
+### Phrase Emphasis ###
+
+Markdown uses asterisks and underscores to indicate spans of emphasis.
+
+Markdown:
+
+    Some of these words *are emphasized*.
+    Some of these words _are emphasized also_.
+
+    Use two asterisks for **strong emphasis**.
+    Or, if you prefer, __use two underscores instead__.
+
+Output:
+
+    &lt;p&gt;Some of these words &lt;em&gt;are emphasized&lt;/em&gt;.
+    Some of these words &lt;em&gt;are emphasized also&lt;/em&gt;.&lt;/p&gt;
+
+    &lt;p&gt;Use two asterisks for &lt;strong&gt;strong emphasis&lt;/strong&gt;.
+    Or, if you prefer, &lt;strong&gt;use two underscores instead&lt;/strong&gt;.&lt;/p&gt;
+
+
+
+## Lists ##
+
+Unordered (bulleted) lists use asterisks, pluses, and hyphens (`*`,
+`+`, and `-`) as list markers. These three markers are
+interchangeable; this:
+
+    *   Candy.
+    *   Gum.
+    *   Booze.
+
+this:
+
+    +   Candy.
+    +   Gum.
+    +   Booze.
+
+and this:
+
+    -   Candy.
+    -   Gum.
+    -   Booze.
+
+all produce the same output:
+
+    &lt;ul&gt;
+    &lt;li&gt;Candy.&lt;/li&gt;
+    &lt;li&gt;Gum.&lt;/li&gt;
+    &lt;li&gt;Booze.&lt;/li&gt;
+    &lt;/ul&gt;
+
+Ordered (numbered) lists use regular numbers, followed by periods, as
+list markers:
+
+    1.  Red
+    2.  Green
+    3.  Blue
+
+Output:
+
+    &lt;ol&gt;
+    &lt;li&gt;Red&lt;/li&gt;
+    &lt;li&gt;Green&lt;/li&gt;
+    &lt;li&gt;Blue&lt;/li&gt;
+    &lt;/ol&gt;
+
+If you put blank lines between items, you'll get `&lt;p&gt;` tags for the
+list item text. You can create multi-paragraph list items by indenting
+the paragraphs by 4 spaces or 1 tab:
+
+    *   A list item.
+
+        With multiple paragraphs.
+
+    *   Another item in the list.
+
+Output:
+
+    &lt;ul&gt;
+    &lt;li&gt;&lt;p&gt;A list item.&lt;/p&gt;
+    &lt;p&gt;With multiple paragraphs.&lt;/p&gt;&lt;/li&gt;
+    &lt;li&gt;&lt;p&gt;Another item in the list.&lt;/p&gt;&lt;/li&gt;
+    &lt;/ul&gt;
+
+
+
+### Links ###
+
+Markdown supports two styles for creating links: *inline* and
+*reference*. With both styles, you use square brackets to delimit the
+text you want to turn into a link.
+
+Inline-style links use parentheses immediately after the link text.
+For example:
+
+    This is an [example link](http://example.com/).
+
+Output:
+
+    &lt;p&gt;This is an &lt;a href="http://example.com/"&gt;
+    example link&lt;/a&gt;.&lt;/p&gt;
+
+Optionally, you may include a title attribute in the parentheses:
+
+    This is an [example link](http://example.com/ "With a Title").
+
+Output:
+
+    &lt;p&gt;This is an &lt;a href="http://example.com/" title="With a Title"&gt;
+    example link&lt;/a&gt;.&lt;/p&gt;
+
+Reference-style links allow you to refer to your links by names, which
+you define elsewhere in your document:
+
+    I get 10 times more traffic from [Google][1] than from
+    [Yahoo][2] or [MSN][3].
+
+    [1]: http://google.com/        "Google"
+    [2]: http://search.yahoo.com/  "Yahoo Search"
+    [3]: http://search.msn.com/    "MSN Search"
+
+Output:
+
+    &lt;p&gt;I get 10 times more traffic from &lt;a href="http://google.com/"
+    title="Google"&gt;Google&lt;/a&gt; than from &lt;a href="http://search.yahoo.com/"
+    title="Yahoo Search"&gt;Yahoo&lt;/a&gt; or &lt;a href="http://search.msn.com/"
+    title="MSN Search"&gt;MSN&lt;/a&gt;.&lt;/p&gt;
+
+The title attribute is optional. Link names may contain letters,
+numbers and spaces, but are *not* case sensitive:
+
+    I start my morning with a cup of coffee and
+    [The New York Times][NY Times].
+
+    [ny times]: http://www.nytimes.com/
+
+Output:
+
+    &lt;p&gt;I start my morning with a cup of coffee and
+    &lt;a href="http://www.nytimes.com/"&gt;The New York Times&lt;/a&gt;.&lt;/p&gt;
+
+
+### Images ###
+
+Image syntax is very much like link syntax.
+
+Inline (titles are optional):
+
+    ![alt text](/path/to/img.jpg "Title")
+
+Reference-style:
+
+    ![alt text][id]
+
+    [id]: /path/to/img.jpg "Title"
+
+Both of the above examples produce the same output:
+
+    &lt;img src="/path/to/img.jpg" alt="alt text" title="Title" /&gt;
+
+
+
+### Code ###
+
+In a regular paragraph, you can create code span by wrapping text in
+backtick quotes. Any ampersands (`&amp;`) and angle brackets (`&lt;` or
+`&gt;`) will automatically be translated into HTML entities. This makes
+it easy to use Markdown to write about HTML example code:
+
+    I strongly recommend against using any `&lt;blink&gt;` tags.
+
+    I wish SmartyPants used named entities like `&amp;mdash;`
+    instead of decimal-encoded entities like `&amp;#8212;`.
+
+Output:
+
+    &lt;p&gt;I strongly recommend against using any
+    &lt;code&gt;&amp;lt;blink&amp;gt;&lt;/code&gt; tags.&lt;/p&gt;
+
+    &lt;p&gt;I wish SmartyPants used named entities like
+    &lt;code&gt;&amp;amp;mdash;&lt;/code&gt; instead of decimal-encoded
+    entities like &lt;code&gt;&amp;amp;#8212;&lt;/code&gt;.&lt;/p&gt;
+
+
+To specify an entire block of pre-formatted code, indent every line of
+the block by 4 spaces or 1 tab. Just like with code spans, `&amp;`, `&lt;`,
+and `&gt;` characters will be escaped automatically.
+
+Markdown:
+
+    If you want your page to validate under XHTML 1.0 Strict,
+    you've got to put paragraph tags in your blockquotes:
+
+        &lt;blockquote&gt;
+            &lt;p&gt;For example.&lt;/p&gt;
+        &lt;/blockquote&gt;
+
+Output:
+
+    &lt;p&gt;If you want your page to validate under XHTML 1.0 Strict,
+    you've got to put paragraph tags in your blockquotes:&lt;/p&gt;
+
+    &lt;pre&gt;&lt;code&gt;&amp;lt;blockquote&amp;gt;
+        &amp;lt;p&amp;gt;For example.&amp;lt;/p&amp;gt;
+    &amp;lt;/blockquote&amp;gt;
+    &lt;/code&gt;&lt;/pre&gt;
+
+## Fenced code blocks (and syntax highlighting)
+
+```javascript
+for (var i = 0; i < items.length; i++) {
+    console.log(items[i], i); // log them
+}
+```
+
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: 'markdown',
+        lineNumbers: true,
+        theme: "default",
+        extraKeys: {"Enter": "newlineAndIndentContinueMarkdownList"}
+      });
+    </script>
+
+    <p>If you also want support <code>strikethrough</code>, <code>emoji</code> and few other goodies, check out <a href="../gfm/index.html">GitHub-Flavored Markdown mode</a>.</p>
+
+    <p>Optionally depends on other modes for properly highlighted code blocks,
+      and XML mode for properly highlighted inline XML blocks.</p>
+
+    <p>Markdown mode supports these options:</p>
+    <ul>
+      <li>
+        <d1>
+          <dt><code>highlightFormatting: boolean</code></dt>
+          <dd>Whether to separately highlight markdown meta characters (<code>*[]()</code>etc.) (default: <code>false</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>maxBlockquoteDepth: boolean</code></dt>
+          <dd>Maximum allowed blockquote nesting (default: <code>0</code> - infinite nesting).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>xml: boolean</code></dt>
+          <dd>Whether to highlight inline XML (default: <code>true</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>fencedCodeBlockHighlighting: boolean</code></dt>
+          <dd>Whether to syntax-highlight fenced code blocks, if given mode is included, or fencedCodeBlockDefaultMode is set (default: <code>true</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>fencedCodeBlockDefaultMode: string</code></dt>
+          <dd>Mode to use for fencedCodeBlockHighlighting, if given mode is not included.</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>tokenTypeOverrides: Object</code></dt>
+          <dd>When you want to override default token type names (e.g. <code>{code: "code"}</code>).</dd>
+        </d1>
+      </li>
+      <li>
+        <d1>
+          <dt><code>allowAtxHeaderWithoutSpace: boolean</code></dt>
+          <dd>Allow lazy headers without whitespace between hashtag and text (default: <code>false</code>).</dd>
+        </d1>
+      </li>
+    </ul>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-markdown</code>.</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#markdown_*">normal</a>,  <a href="../../test/index.html#verbose,markdown_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/markdown/markdown.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,886 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../xml/xml", "../meta"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
+
+  var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
+  var htmlModeMissing = htmlMode.name == "null"
+
+  function getMode(name) {
+    if (CodeMirror.findModeByName) {
+      var found = CodeMirror.findModeByName(name);
+      if (found) name = found.mime || found.mimes[0];
+    }
+    var mode = CodeMirror.getMode(cmCfg, name);
+    return mode.name == "null" ? null : mode;
+  }
+
+  // Should characters that affect highlighting be highlighted separate?
+  // Does not include characters that will be output (such as `1.` and `-` for lists)
+  if (modeCfg.highlightFormatting === undefined)
+    modeCfg.highlightFormatting = false;
+
+  // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
+  // Excess `>` will emit `error` token.
+  if (modeCfg.maxBlockquoteDepth === undefined)
+    modeCfg.maxBlockquoteDepth = 0;
+
+  // Turn on task lists? ("- [ ] " and "- [x] ")
+  if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
+
+  // Turn on strikethrough syntax
+  if (modeCfg.strikethrough === undefined)
+    modeCfg.strikethrough = false;
+
+  if (modeCfg.emoji === undefined)
+    modeCfg.emoji = false;
+
+  if (modeCfg.fencedCodeBlockHighlighting === undefined)
+    modeCfg.fencedCodeBlockHighlighting = true;
+
+  if (modeCfg.fencedCodeBlockDefaultMode === undefined)
+    modeCfg.fencedCodeBlockDefaultMode = 'text/plain';
+
+  if (modeCfg.xml === undefined)
+    modeCfg.xml = true;
+
+  // Allow token types to be overridden by user-provided token types.
+  if (modeCfg.tokenTypeOverrides === undefined)
+    modeCfg.tokenTypeOverrides = {};
+
+  var tokenTypes = {
+    header: "header",
+    code: "comment",
+    quote: "quote",
+    list1: "variable-2",
+    list2: "variable-3",
+    list3: "keyword",
+    hr: "hr",
+    image: "image",
+    imageAltText: "image-alt-text",
+    imageMarker: "image-marker",
+    formatting: "formatting",
+    linkInline: "link",
+    linkEmail: "link",
+    linkText: "link",
+    linkHref: "string",
+    em: "em",
+    strong: "strong",
+    strikethrough: "strikethrough",
+    emoji: "builtin"
+  };
+
+  for (var tokenType in tokenTypes) {
+    if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
+      tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
+    }
+  }
+
+  var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
+  ,   listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
+  ,   taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
+  ,   atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
+  ,   setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/
+  ,   textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
+  ,   fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/
+  ,   linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
+  ,   punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
+  ,   expandedTab = "    " // CommonMark specifies tab as 4 spaces
+
+  function switchInline(stream, state, f) {
+    state.f = state.inline = f;
+    return f(stream, state);
+  }
+
+  function switchBlock(stream, state, f) {
+    state.f = state.block = f;
+    return f(stream, state);
+  }
+
+  function lineIsEmpty(line) {
+    return !line || !/\S/.test(line.string)
+  }
+
+  // Blocks
+
+  function blankLine(state) {
+    // Reset linkTitle state
+    state.linkTitle = false;
+    state.linkHref = false;
+    state.linkText = false;
+    // Reset EM state
+    state.em = false;
+    // Reset STRONG state
+    state.strong = false;
+    // Reset strikethrough state
+    state.strikethrough = false;
+    // Reset state.quote
+    state.quote = 0;
+    // Reset state.indentedCode
+    state.indentedCode = false;
+    if (state.f == htmlBlock) {
+      var exit = htmlModeMissing
+      if (!exit) {
+        var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
+        exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
+          (!inner.state.context && inner.state.tokenize.isInText)
+      }
+      if (exit) {
+        state.f = inlineNormal;
+        state.block = blockNormal;
+        state.htmlState = null;
+      }
+    }
+    // Reset state.trailingSpace
+    state.trailingSpace = 0;
+    state.trailingSpaceNewLine = false;
+    // Mark this line as blank
+    state.prevLine = state.thisLine
+    state.thisLine = {stream: null}
+    return null;
+  }
+
+  function blockNormal(stream, state) {
+    var firstTokenOnLine = stream.column() === state.indentation;
+    var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
+    var prevLineIsIndentedCode = state.indentedCode;
+    var prevLineIsHr = state.prevLine.hr;
+    var prevLineIsList = state.list !== false;
+    var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
+
+    state.indentedCode = false;
+
+    var lineIndentation = state.indentation;
+    // compute once per line (on first token)
+    if (state.indentationDiff === null) {
+      state.indentationDiff = state.indentation;
+      if (prevLineIsList) {
+        state.list = null;
+        // While this list item's marker's indentation is less than the deepest
+        //  list item's content's indentation,pop the deepest list item
+        //  indentation off the stack, and update block indentation state
+        while (lineIndentation < state.listStack[state.listStack.length - 1]) {
+          state.listStack.pop();
+          if (state.listStack.length) {
+            state.indentation = state.listStack[state.listStack.length - 1];
+          // less than the first list's indent -> the line is no longer a list
+          } else {
+            state.list = false;
+          }
+        }
+        if (state.list !== false) {
+          state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
+        }
+      }
+    }
+
+    // not comprehensive (currently only for setext detection purposes)
+    var allowsInlineContinuation = (
+        !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
+        (!prevLineIsList || !prevLineIsIndentedCode) &&
+        !state.prevLine.fencedCodeEnd
+    );
+
+    var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
+      state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
+
+    var match = null;
+    if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
+         state.prevLine.header || prevLineLineIsEmpty)) {
+      stream.skipToEnd();
+      state.indentedCode = true;
+      return tokenTypes.code;
+    } else if (stream.eatSpace()) {
+      return null;
+    } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
+      state.quote = 0;
+      state.header = match[1].length;
+      state.thisLine.header = true;
+      if (modeCfg.highlightFormatting) state.formatting = "header";
+      state.f = state.inline;
+      return getType(state);
+    } else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
+      state.quote = firstTokenOnLine ? 1 : state.quote + 1;
+      if (modeCfg.highlightFormatting) state.formatting = "quote";
+      stream.eatSpace();
+      return getType(state);
+    } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
+      var listType = match[1] ? "ol" : "ul";
+
+      state.indentation = lineIndentation + stream.current().length;
+      state.list = true;
+      state.quote = 0;
+
+      // Add this list item's content's indentation to the stack
+      state.listStack.push(state.indentation);
+      // Reset inline styles which shouldn't propagate across list items
+      state.em = false;
+      state.strong = false;
+      state.code = false;
+      state.strikethrough = false;
+
+      if (modeCfg.taskLists && stream.match(taskListRE, false)) {
+        state.taskList = true;
+      }
+      state.f = state.inline;
+      if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
+      return getType(state);
+    } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
+      state.quote = 0;
+      state.fencedEndRE = new RegExp(match[1] + "+ *$");
+      // try switching mode
+      state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode );
+      if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
+      state.f = state.block = local;
+      if (modeCfg.highlightFormatting) state.formatting = "code-block";
+      state.code = -1
+      return getType(state);
+    // SETEXT has lowest block-scope precedence after HR, so check it after
+    //  the others (code, blockquote, list...)
+    } else if (
+      // if setext set, indicates line after ---/===
+      state.setext || (
+        // line before ---/===
+        (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
+        !state.code && !isHr && !linkDefRE.test(stream.string) &&
+        (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
+      )
+    ) {
+      if ( !state.setext ) {
+        state.header = match[0].charAt(0) == '=' ? 1 : 2;
+        state.setext = state.header;
+      } else {
+        state.header = state.setext;
+        // has no effect on type so we can reset it now
+        state.setext = 0;
+        stream.skipToEnd();
+        if (modeCfg.highlightFormatting) state.formatting = "header";
+      }
+      state.thisLine.header = true;
+      state.f = state.inline;
+      return getType(state);
+    } else if (isHr) {
+      stream.skipToEnd();
+      state.hr = true;
+      state.thisLine.hr = true;
+      return tokenTypes.hr;
+    } else if (stream.peek() === '[') {
+      return switchInline(stream, state, footnoteLink);
+    }
+
+    return switchInline(stream, state, state.inline);
+  }
+
+  function htmlBlock(stream, state) {
+    var style = htmlMode.token(stream, state.htmlState);
+    if (!htmlModeMissing) {
+      var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
+      if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
+           (!inner.state.context && inner.state.tokenize.isInText)) ||
+          (state.md_inside && stream.current().indexOf(">") > -1)) {
+        state.f = inlineNormal;
+        state.block = blockNormal;
+        state.htmlState = null;
+      }
+    }
+    return style;
+  }
+
+  function local(stream, state) {
+    var currListInd = state.listStack[state.listStack.length - 1] || 0;
+    var hasExitedList = state.indentation < currListInd;
+    var maxFencedEndInd = currListInd + 3;
+    if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
+      if (modeCfg.highlightFormatting) state.formatting = "code-block";
+      var returnType;
+      if (!hasExitedList) returnType = getType(state)
+      state.localMode = state.localState = null;
+      state.block = blockNormal;
+      state.f = inlineNormal;
+      state.fencedEndRE = null;
+      state.code = 0
+      state.thisLine.fencedCodeEnd = true;
+      if (hasExitedList) return switchBlock(stream, state, state.block);
+      return returnType;
+    } else if (state.localMode) {
+      return state.localMode.token(stream, state.localState);
+    } else {
+      stream.skipToEnd();
+      return tokenTypes.code;
+    }
+  }
+
+  // Inline
+  function getType(state) {
+    var styles = [];
+
+    if (state.formatting) {
+      styles.push(tokenTypes.formatting);
+
+      if (typeof state.formatting === "string") state.formatting = [state.formatting];
+
+      for (var i = 0; i < state.formatting.length; i++) {
+        styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
+
+        if (state.formatting[i] === "header") {
+          styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
+        }
+
+        // Add `formatting-quote` and `formatting-quote-#` for blockquotes
+        // Add `error` instead if the maximum blockquote nesting depth is passed
+        if (state.formatting[i] === "quote") {
+          if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
+            styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
+          } else {
+            styles.push("error");
+          }
+        }
+      }
+    }
+
+    if (state.taskOpen) {
+      styles.push("meta");
+      return styles.length ? styles.join(' ') : null;
+    }
+    if (state.taskClosed) {
+      styles.push("property");
+      return styles.length ? styles.join(' ') : null;
+    }
+
+    if (state.linkHref) {
+      styles.push(tokenTypes.linkHref, "url");
+    } else { // Only apply inline styles to non-url text
+      if (state.strong) { styles.push(tokenTypes.strong); }
+      if (state.em) { styles.push(tokenTypes.em); }
+      if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
+      if (state.emoji) { styles.push(tokenTypes.emoji); }
+      if (state.linkText) { styles.push(tokenTypes.linkText); }
+      if (state.code) { styles.push(tokenTypes.code); }
+      if (state.image) { styles.push(tokenTypes.image); }
+      if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
+      if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
+    }
+
+    if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
+
+    if (state.quote) {
+      styles.push(tokenTypes.quote);
+
+      // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
+      if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
+        styles.push(tokenTypes.quote + "-" + state.quote);
+      } else {
+        styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
+      }
+    }
+
+    if (state.list !== false) {
+      var listMod = (state.listStack.length - 1) % 3;
+      if (!listMod) {
+        styles.push(tokenTypes.list1);
+      } else if (listMod === 1) {
+        styles.push(tokenTypes.list2);
+      } else {
+        styles.push(tokenTypes.list3);
+      }
+    }
+
+    if (state.trailingSpaceNewLine) {
+      styles.push("trailing-space-new-line");
+    } else if (state.trailingSpace) {
+      styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
+    }
+
+    return styles.length ? styles.join(' ') : null;
+  }
+
+  function handleText(stream, state) {
+    if (stream.match(textRE, true)) {
+      return getType(state);
+    }
+    return undefined;
+  }
+
+  function inlineNormal(stream, state) {
+    var style = state.text(stream, state);
+    if (typeof style !== 'undefined')
+      return style;
+
+    if (state.list) { // List marker (*, +, -, 1., etc)
+      state.list = null;
+      return getType(state);
+    }
+
+    if (state.taskList) {
+      var taskOpen = stream.match(taskListRE, true)[1] === " ";
+      if (taskOpen) state.taskOpen = true;
+      else state.taskClosed = true;
+      if (modeCfg.highlightFormatting) state.formatting = "task";
+      state.taskList = false;
+      return getType(state);
+    }
+
+    state.taskOpen = false;
+    state.taskClosed = false;
+
+    if (state.header && stream.match(/^#+$/, true)) {
+      if (modeCfg.highlightFormatting) state.formatting = "header";
+      return getType(state);
+    }
+
+    var ch = stream.next();
+
+    // Matches link titles present on next line
+    if (state.linkTitle) {
+      state.linkTitle = false;
+      var matchCh = ch;
+      if (ch === '(') {
+        matchCh = ')';
+      }
+      matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
+      var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
+      if (stream.match(new RegExp(regex), true)) {
+        return tokenTypes.linkHref;
+      }
+    }
+
+    // If this block is changed, it may need to be updated in GFM mode
+    if (ch === '`') {
+      var previousFormatting = state.formatting;
+      if (modeCfg.highlightFormatting) state.formatting = "code";
+      stream.eatWhile('`');
+      var count = stream.current().length
+      if (state.code == 0 && (!state.quote || count == 1)) {
+        state.code = count
+        return getType(state)
+      } else if (count == state.code) { // Must be exact
+        var t = getType(state)
+        state.code = 0
+        return t
+      } else {
+        state.formatting = previousFormatting
+        return getType(state)
+      }
+    } else if (state.code) {
+      return getType(state);
+    }
+
+    if (ch === '\\') {
+      stream.next();
+      if (modeCfg.highlightFormatting) {
+        var type = getType(state);
+        var formattingEscape = tokenTypes.formatting + "-escape";
+        return type ? type + " " + formattingEscape : formattingEscape;
+      }
+    }
+
+    if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
+      state.imageMarker = true;
+      state.image = true;
+      if (modeCfg.highlightFormatting) state.formatting = "image";
+      return getType(state);
+    }
+
+    if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
+      state.imageMarker = false;
+      state.imageAltText = true
+      if (modeCfg.highlightFormatting) state.formatting = "image";
+      return getType(state);
+    }
+
+    if (ch === ']' && state.imageAltText) {
+      if (modeCfg.highlightFormatting) state.formatting = "image";
+      var type = getType(state);
+      state.imageAltText = false;
+      state.image = false;
+      state.inline = state.f = linkHref;
+      return type;
+    }
+
+    if (ch === '[' && !state.image) {
+      if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
+      state.linkText = true;
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      return getType(state);
+    }
+
+    if (ch === ']' && state.linkText) {
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      var type = getType(state);
+      state.linkText = false;
+      state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
+      return type;
+    }
+
+    if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
+      state.f = state.inline = linkInline;
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      var type = getType(state);
+      if (type){
+        type += " ";
+      } else {
+        type = "";
+      }
+      return type + tokenTypes.linkInline;
+    }
+
+    if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
+      state.f = state.inline = linkInline;
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      var type = getType(state);
+      if (type){
+        type += " ";
+      } else {
+        type = "";
+      }
+      return type + tokenTypes.linkEmail;
+    }
+
+    if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
+      var end = stream.string.indexOf(">", stream.pos);
+      if (end != -1) {
+        var atts = stream.string.substring(stream.start, end);
+        if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
+      }
+      stream.backUp(1);
+      state.htmlState = CodeMirror.startState(htmlMode);
+      return switchBlock(stream, state, htmlBlock);
+    }
+
+    if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
+      state.md_inside = false;
+      return "tag";
+    } else if (ch === "*" || ch === "_") {
+      var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
+      while (len < 3 && stream.eat(ch)) len++
+      var after = stream.peek() || " "
+      // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
+      var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
+      var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
+      var setEm = null, setStrong = null
+      if (len % 2) { // Em
+        if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
+          setEm = true
+        else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
+          setEm = false
+      }
+      if (len > 1) { // Strong
+        if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
+          setStrong = true
+        else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
+          setStrong = false
+      }
+      if (setStrong != null || setEm != null) {
+        if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
+        if (setEm === true) state.em = ch
+        if (setStrong === true) state.strong = ch
+        var t = getType(state)
+        if (setEm === false) state.em = false
+        if (setStrong === false) state.strong = false
+        return t
+      }
+    } else if (ch === ' ') {
+      if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
+        if (stream.peek() === ' ') { // Surrounded by spaces, ignore
+          return getType(state);
+        } else { // Not surrounded by spaces, back up pointer
+          stream.backUp(1);
+        }
+      }
+    }
+
+    if (modeCfg.strikethrough) {
+      if (ch === '~' && stream.eatWhile(ch)) {
+        if (state.strikethrough) {// Remove strikethrough
+          if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
+          var t = getType(state);
+          state.strikethrough = false;
+          return t;
+        } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
+          state.strikethrough = true;
+          if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
+          return getType(state);
+        }
+      } else if (ch === ' ') {
+        if (stream.match('~~', true)) { // Probably surrounded by space
+          if (stream.peek() === ' ') { // Surrounded by spaces, ignore
+            return getType(state);
+          } else { // Not surrounded by spaces, back up pointer
+            stream.backUp(2);
+          }
+        }
+      }
+    }
+
+    if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
+      state.emoji = true;
+      if (modeCfg.highlightFormatting) state.formatting = "emoji";
+      var retType = getType(state);
+      state.emoji = false;
+      return retType;
+    }
+
+    if (ch === ' ') {
+      if (stream.match(/^ +$/, false)) {
+        state.trailingSpace++;
+      } else if (state.trailingSpace) {
+        state.trailingSpaceNewLine = true;
+      }
+    }
+
+    return getType(state);
+  }
+
+  function linkInline(stream, state) {
+    var ch = stream.next();
+
+    if (ch === ">") {
+      state.f = state.inline = inlineNormal;
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      var type = getType(state);
+      if (type){
+        type += " ";
+      } else {
+        type = "";
+      }
+      return type + tokenTypes.linkInline;
+    }
+
+    stream.match(/^[^>]+/, true);
+
+    return tokenTypes.linkInline;
+  }
+
+  function linkHref(stream, state) {
+    // Check if space, and return NULL if so (to avoid marking the space)
+    if(stream.eatSpace()){
+      return null;
+    }
+    var ch = stream.next();
+    if (ch === '(' || ch === '[') {
+      state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
+      if (modeCfg.highlightFormatting) state.formatting = "link-string";
+      state.linkHref = true;
+      return getType(state);
+    }
+    return 'error';
+  }
+
+  var linkRE = {
+    ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
+    "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
+  }
+
+  function getLinkHrefInside(endChar) {
+    return function(stream, state) {
+      var ch = stream.next();
+
+      if (ch === endChar) {
+        state.f = state.inline = inlineNormal;
+        if (modeCfg.highlightFormatting) state.formatting = "link-string";
+        var returnState = getType(state);
+        state.linkHref = false;
+        return returnState;
+      }
+
+      stream.match(linkRE[endChar])
+      state.linkHref = true;
+      return getType(state);
+    };
+  }
+
+  function footnoteLink(stream, state) {
+    if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
+      state.f = footnoteLinkInside;
+      stream.next(); // Consume [
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      state.linkText = true;
+      return getType(state);
+    }
+    return switchInline(stream, state, inlineNormal);
+  }
+
+  function footnoteLinkInside(stream, state) {
+    if (stream.match(']:', true)) {
+      state.f = state.inline = footnoteUrl;
+      if (modeCfg.highlightFormatting) state.formatting = "link";
+      var returnType = getType(state);
+      state.linkText = false;
+      return returnType;
+    }
+
+    stream.match(/^([^\]\\]|\\.)+/, true);
+
+    return tokenTypes.linkText;
+  }
+
+  function footnoteUrl(stream, state) {
+    // Check if space, and return NULL if so (to avoid marking the space)
+    if(stream.eatSpace()){
+      return null;
+    }
+    // Match URL
+    stream.match(/^[^\s]+/, true);
+    // Check for link title
+    if (stream.peek() === undefined) { // End of line, set flag to check next line
+      state.linkTitle = true;
+    } else { // More content on line, check if link title
+      stream.match(/^(?:\s+(?:"(?:[^"\\]|\\.)+"|'(?:[^'\\]|\\.)+'|\((?:[^)\\]|\\.)+\)))?/, true);
+    }
+    state.f = state.inline = inlineNormal;
+    return tokenTypes.linkHref + " url";
+  }
+
+  var mode = {
+    startState: function() {
+      return {
+        f: blockNormal,
+
+        prevLine: {stream: null},
+        thisLine: {stream: null},
+
+        block: blockNormal,
+        htmlState: null,
+        indentation: 0,
+
+        inline: inlineNormal,
+        text: handleText,
+
+        formatting: false,
+        linkText: false,
+        linkHref: false,
+        linkTitle: false,
+        code: 0,
+        em: false,
+        strong: false,
+        header: 0,
+        setext: 0,
+        hr: false,
+        taskList: false,
+        list: false,
+        listStack: [],
+        quote: 0,
+        trailingSpace: 0,
+        trailingSpaceNewLine: false,
+        strikethrough: false,
+        emoji: false,
+        fencedEndRE: null
+      };
+    },
+
+    copyState: function(s) {
+      return {
+        f: s.f,
+
+        prevLine: s.prevLine,
+        thisLine: s.thisLine,
+
+        block: s.block,
+        htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
+        indentation: s.indentation,
+
+        localMode: s.localMode,
+        localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
+
+        inline: s.inline,
+        text: s.text,
+        formatting: false,
+        linkText: s.linkText,
+        linkTitle: s.linkTitle,
+        linkHref: s.linkHref,
+        code: s.code,
+        em: s.em,
+        strong: s.strong,
+        strikethrough: s.strikethrough,
+        emoji: s.emoji,
+        header: s.header,
+        setext: s.setext,
+        hr: s.hr,
+        taskList: s.taskList,
+        list: s.list,
+        listStack: s.listStack.slice(0),
+        quote: s.quote,
+        indentedCode: s.indentedCode,
+        trailingSpace: s.trailingSpace,
+        trailingSpaceNewLine: s.trailingSpaceNewLine,
+        md_inside: s.md_inside,
+        fencedEndRE: s.fencedEndRE
+      };
+    },
+
+    token: function(stream, state) {
+
+      // Reset state.formatting
+      state.formatting = false;
+
+      if (stream != state.thisLine.stream) {
+        state.header = 0;
+        state.hr = false;
+
+        if (stream.match(/^\s*$/, true)) {
+          blankLine(state);
+          return null;
+        }
+
+        state.prevLine = state.thisLine
+        state.thisLine = {stream: stream}
+
+        // Reset state.taskList
+        state.taskList = false;
+
+        // Reset state.trailingSpace
+        state.trailingSpace = 0;
+        state.trailingSpaceNewLine = false;
+
+        if (!state.localState) {
+          state.f = state.block;
+          if (state.f != htmlBlock) {
+            var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
+            state.indentation = indentation;
+            state.indentationDiff = null;
+            if (indentation > 0) return null;
+          }
+        }
+      }
+      return state.f(stream, state);
+    },
+
+    innerMode: function(state) {
+      if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
+      if (state.localState) return {state: state.localState, mode: state.localMode};
+      return {state: state, mode: mode};
+    },
+
+    indent: function(state, textAfter, line) {
+      if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
+      if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
+      return CodeMirror.Pass
+    },
+
+    blankLine: blankLine,
+
+    getType: getType,
+
+    blockCommentStart: "<!--",
+    blockCommentEnd: "-->",
+    closeBrackets: "()[]{}''\"\"``",
+    fold: "markdown"
+  };
+  return mode;
+}, "xml");
+
+CodeMirror.defineMIME("text/markdown", "markdown");
+
+CodeMirror.defineMIME("text/x-markdown", "markdown");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/markdown/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1319 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var config = {tabSize: 4, indentUnit: 2}
+  var mode = CodeMirror.getMode(config, "markdown");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+  var modeHighlightFormatting = CodeMirror.getMode(config, {name: "markdown", highlightFormatting: true});
+  function FT(name) { test.mode(name, modeHighlightFormatting, Array.prototype.slice.call(arguments, 1)); }
+  var modeMT_noXml = CodeMirror.getMode(config, {name: "markdown", xml: false});
+  function MT_noXml(name) { test.mode(name, modeMT_noXml, Array.prototype.slice.call(arguments, 1)); }
+  var modeMT_noFencedHighlight = CodeMirror.getMode(config, {name: "markdown", fencedCodeBlockHighlighting: false});
+  function MT_noFencedHighlight(name) { test.mode(name, modeMT_noFencedHighlight, Array.prototype.slice.call(arguments, 1)); }
+  var modeAtxNoSpace = CodeMirror.getMode(config, {name: "markdown", allowAtxHeaderWithoutSpace: true});
+  function AtxNoSpaceTest(name) { test.mode(name, modeAtxNoSpace, Array.prototype.slice.call(arguments, 1)); }
+  var modeOverrideClasses = CodeMirror.getMode(config, {
+    name: "markdown",
+    strikethrough: true,
+    emoji: true,
+    tokenTypeOverrides: {
+      "header" : "override-header",
+      "code" : "override-code",
+      "quote" : "override-quote",
+      "list1" : "override-list1",
+      "list2" : "override-list2",
+      "list3" : "override-list3",
+      "hr" : "override-hr",
+      "image" : "override-image",
+      "imageAltText": "override-image-alt-text",
+      "imageMarker": "override-image-marker",
+      "linkInline" : "override-link-inline",
+      "linkEmail" : "override-link-email",
+      "linkText" : "override-link-text",
+      "linkHref" : "override-link-href",
+      "em" : "override-em",
+      "strong" : "override-strong",
+      "strikethrough" : "override-strikethrough",
+      "emoji" : "override-emoji"
+  }});
+  function TokenTypeOverrideTest(name) { test.mode(name, modeOverrideClasses, Array.prototype.slice.call(arguments, 1)); }
+  var modeFormattingOverride = CodeMirror.getMode(config, {
+    name: "markdown",
+    highlightFormatting: true,
+    tokenTypeOverrides: {
+      "formatting" : "override-formatting"
+  }});
+  function FormatTokenTypeOverrideTest(name) { test.mode(name, modeFormattingOverride, Array.prototype.slice.call(arguments, 1)); }
+  var modeET = CodeMirror.getMode(config, {name: "markdown", emoji: true});
+  function ET(name) { test.mode(name, modeET, Array.prototype.slice.call(arguments, 1)); }
+
+
+  FT("formatting_emAsterisk",
+     "[em&formatting&formatting-em *][em foo][em&formatting&formatting-em *]");
+
+  FT("formatting_emUnderscore",
+     "[em&formatting&formatting-em _][em foo][em&formatting&formatting-em _]");
+
+  FT("formatting_strongAsterisk",
+     "[strong&formatting&formatting-strong **][strong foo][strong&formatting&formatting-strong **]");
+
+  FT("formatting_strongUnderscore",
+     "[strong&formatting&formatting-strong __][strong foo][strong&formatting&formatting-strong __]");
+
+  FT("formatting_codeBackticks",
+     "[comment&formatting&formatting-code `][comment foo][comment&formatting&formatting-code `]");
+
+  FT("formatting_doubleBackticks",
+     "[comment&formatting&formatting-code ``][comment foo ` bar][comment&formatting&formatting-code ``]");
+
+  FT("formatting_atxHeader",
+     "[header&header-1&formatting&formatting-header&formatting-header-1 # ][header&header-1 foo # bar ][header&header-1&formatting&formatting-header&formatting-header-1 #]");
+
+  FT("formatting_setextHeader",
+     "[header&header-1 foo]",
+     "[header&header-1&formatting&formatting-header&formatting-header-1 =]");
+
+  FT("formatting_blockquote",
+     "[quote&quote-1&formatting&formatting-quote&formatting-quote-1 > ][quote&quote-1 foo]");
+
+  FT("formatting_list",
+     "[variable-2&formatting&formatting-list&formatting-list-ul - ][variable-2 foo]");
+  FT("formatting_list",
+     "[variable-2&formatting&formatting-list&formatting-list-ol 1. ][variable-2 foo]");
+
+  FT("formatting_link",
+     "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string&url (][string&url http://example.com/][string&formatting&formatting-link-string&url )]");
+
+  FT("formatting_linkReference",
+     "[link&formatting&formatting-link [][link foo][link&formatting&formatting-link ]]][string&formatting&formatting-link-string&url [][string&url bar][string&formatting&formatting-link-string&url ]]]",
+     "[link&formatting&formatting-link [][link bar][link&formatting&formatting-link ]]:] [string&url http://example.com/]");
+
+  FT("formatting_linkWeb",
+     "[link&formatting&formatting-link <][link http://example.com/][link&formatting&formatting-link >]");
+
+  FT("formatting_linkEmail",
+     "[link&formatting&formatting-link <][link user@example.com][link&formatting&formatting-link >]");
+
+  FT("formatting_escape",
+     "[formatting-escape \\*]");
+
+  FT("formatting_image",
+     "[formatting&formatting-image&image&image-marker !][formatting&formatting-image&image&image-alt-text&link [[][image&image-alt-text&link alt text][formatting&formatting-image&image&image-alt-text&link ]]][formatting&formatting-link-string&string&url (][url&string http://link.to/image.jpg][formatting&formatting-link-string&string&url )]");
+
+  FT("codeBlock",
+     "[comment&formatting&formatting-code-block ```css]",
+     "[tag foo]",
+     "[comment&formatting&formatting-code-block ```]");
+
+  MT("plainText",
+     "foo");
+
+  // Don't style single trailing space
+  MT("trailingSpace1",
+     "foo ");
+
+  // Two or more trailing spaces should be styled with line break character
+  MT("trailingSpace2",
+     "foo[trailing-space-a  ][trailing-space-new-line  ]");
+
+  MT("trailingSpace3",
+     "foo[trailing-space-a  ][trailing-space-b  ][trailing-space-new-line  ]");
+
+  MT("trailingSpace4",
+     "foo[trailing-space-a  ][trailing-space-b  ][trailing-space-a  ][trailing-space-new-line  ]");
+
+  // Code blocks using 4 spaces (regardless of CodeMirror.tabSize value)
+  MT("codeBlocksUsing4Spaces",
+     "    [comment foo]");
+
+  // Code blocks using 4 spaces with internal indentation
+  MT("codeBlocksUsing4SpacesIndentation",
+     "    [comment bar]",
+     "        [comment hello]",
+     "            [comment world]",
+     "    [comment foo]",
+     "bar");
+
+  // Code blocks should end even after extra indented lines
+  MT("codeBlocksWithTrailingIndentedLine",
+     "    [comment foo]",
+     "        [comment bar]",
+     "    [comment baz]",
+     "    ",
+     "hello");
+
+  // Code blocks using 1 tab (regardless of CodeMirror.indentWithTabs value)
+  MT("codeBlocksUsing1Tab",
+     "\t[comment foo]");
+
+  // No code blocks directly after paragraph
+  // http://spec.commonmark.org/0.19/#example-65
+  MT("noCodeBlocksAfterParagraph",
+     "Foo",
+     "    Bar");
+
+  MT("codeBlocksAfterATX",
+     "[header&header-1 # foo]",
+     "    [comment code]");
+
+  MT("codeBlocksAfterSetext",
+     "[header&header-2 foo]",
+     "[header&header-2 ---]",
+     "    [comment code]");
+
+  MT("codeBlocksAfterFencedCode",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment ```]",
+     "    [comment code]");
+
+  // Inline code using backticks
+  MT("inlineCodeUsingBackticks",
+     "foo [comment `bar`]");
+
+  // Block code using single backtick (shouldn't work)
+  MT("blockCodeSingleBacktick",
+     "[comment `]",
+     "[comment foo]",
+     "[comment `]");
+
+  // Unclosed backticks
+  // Instead of simply marking as CODE, it would be nice to have an
+  // incomplete flag for CODE, that is styled slightly different.
+  MT("unclosedBackticks",
+     "foo [comment `bar]");
+
+  // Per documentation: "To include a literal backtick character within a
+  // code span, you can use multiple backticks as the opening and closing
+  // delimiters"
+  MT("doubleBackticks",
+     "[comment ``foo ` bar``]");
+
+  // Tests based on Dingus
+  // http://daringfireball.net/projects/markdown/dingus
+  //
+  // Multiple backticks within an inline code block
+  MT("consecutiveBackticks",
+     "[comment `foo```bar`]");
+
+  // Multiple backticks within an inline code block with a second code block
+  MT("consecutiveBackticks",
+     "[comment `foo```bar`] hello [comment `world`]");
+
+  // Unclosed with several different groups of backticks
+  MT("unclosedBackticks",
+     "[comment ``foo ``` bar` hello]");
+
+  // Closed with several different groups of backticks
+  MT("closedBackticks",
+     "[comment ``foo ``` bar` hello``] world");
+
+  // info string cannot contain backtick, thus should result in inline code
+  MT("closingFencedMarksOnSameLine",
+     "[comment ``` code ```] foo");
+
+  // atx headers
+  // http://daringfireball.net/projects/markdown/syntax#header
+
+  MT("atxH1",
+     "[header&header-1 # foo]");
+
+  MT("atxH2",
+     "[header&header-2 ## foo]");
+
+  MT("atxH3",
+     "[header&header-3 ### foo]");
+
+  MT("atxH4",
+     "[header&header-4 #### foo]");
+
+  MT("atxH5",
+     "[header&header-5 ##### foo]");
+
+  MT("atxH6",
+     "[header&header-6 ###### foo]");
+
+  // http://spec.commonmark.org/0.19/#example-24
+  MT("noAtxH7",
+     "####### foo");
+
+  // http://spec.commonmark.org/0.19/#example-25
+  MT("noAtxH1WithoutSpace",
+     "#5 bolt");
+
+  // CommonMark requires a space after # but most parsers don't
+  AtxNoSpaceTest("atxNoSpaceAllowed_H1NoSpace",
+     "[header&header-1 #foo]");
+
+  AtxNoSpaceTest("atxNoSpaceAllowed_H4NoSpace",
+     "[header&header-4 ####foo]");
+
+  AtxNoSpaceTest("atxNoSpaceAllowed_H1Space",
+     "[header&header-1 # foo]");
+
+  // Inline styles should be parsed inside headers
+  MT("atxH1inline",
+     "[header&header-1 # foo ][header&header-1&em *bar*]");
+
+  MT("atxIndentedTooMuch",
+     "[header&header-1 # foo]",
+     "    [comment # bar]");
+
+  // disable atx inside blockquote until we implement proper blockquote inner mode
+  // TODO: fix to be CommonMark-compliant
+  MT("atxNestedInsideBlockquote",
+     "[quote&quote-1 > # foo]");
+
+  MT("atxAfterBlockquote",
+     "[quote&quote-1 > foo]",
+     "[header&header-1 # bar]");
+
+  // Setext headers - H1, H2
+  // Per documentation, "Any number of underlining =’s or -’s will work."
+  // http://daringfireball.net/projects/markdown/syntax#header
+  // Ideally, the text would be marked as `header` as well, but this is
+  // not really feasible at the moment. So, instead, we're testing against
+  // what works today, to avoid any regressions.
+  //
+  // Check if single underlining = works
+  MT("setextH1",
+     "[header&header-1 foo]",
+     "[header&header-1 =]");
+
+  // Check if 3+ ='s work
+  MT("setextH1",
+     "[header&header-1 foo]",
+     "[header&header-1 ===]");
+
+  // Check if single underlining - should not be interpreted
+  // as it might lead to an empty list:
+  // https://spec.commonmark.org/0.28/#setext-heading-underline
+  MT("setextH2Single",
+     "foo",
+     "-");
+
+  // Check if 3+ -'s work
+  MT("setextH2",
+     "[header&header-2 foo]",
+     "[header&header-2 ---]");
+
+  // http://spec.commonmark.org/0.19/#example-45
+  MT("setextH2AllowSpaces",
+     "[header&header-2 foo]",
+     "   [header&header-2 ----      ]");
+
+  // http://spec.commonmark.org/0.19/#example-44
+  MT("noSetextAfterIndentedCodeBlock",
+     "     [comment foo]",
+     "[hr ---]");
+
+  MT("setextAfterFencedCode",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment ```]",
+     "[header&header-2 bar]",
+     "[header&header-2 ---]");
+
+  MT("setextAfterATX",
+     "[header&header-1 # foo]",
+     "[header&header-2 bar]",
+     "[header&header-2 ---]");
+
+  // http://spec.commonmark.org/0.19/#example-51
+  MT("noSetextAfterQuote",
+     "[quote&quote-1 > foo]",
+     "[hr ---]",
+     "",
+     "[quote&quote-1 > foo]",
+     "[quote&quote-1 bar]",
+     "[hr ---]");
+
+  MT("noSetextAfterList",
+     "[variable-2 - foo]",
+     "[hr ---]");
+
+  MT("noSetextAfterList_listContinuation",
+     "[variable-2 - foo]",
+     "bar",
+     "[hr ---]");
+
+  MT("setextAfterList_afterIndentedCode",
+     "[variable-2 - foo]",
+     "",
+     "      [comment bar]",
+     "[header&header-2 baz]",
+     "[header&header-2 ---]");
+
+  MT("setextAfterList_afterFencedCodeBlocks",
+     "[variable-2 - foo]",
+     "",
+     "      [comment ```]",
+     "      [comment bar]",
+     "      [comment ```]",
+     "[header&header-2 baz]",
+     "[header&header-2 ---]");
+
+  MT("setextAfterList_afterHeader",
+     "[variable-2 - foo]",
+     "  [variable-2&header&header-1 # bar]",
+     "[header&header-2 baz]",
+     "[header&header-2 ---]");
+
+  MT("setextAfterList_afterHr",
+     "[variable-2 - foo]",
+     "",
+     "  [hr ---]",
+     "[header&header-2 bar]",
+     "[header&header-2 ---]");
+
+  MT("setext_nestedInlineMarkup",
+     "[header&header-1 foo ][em&header&header-1 *bar*]",
+     "[header&header-1 =]");
+
+  MT("setext_linkDef",
+     "[link [[aaa]]:] [string&url http://google.com 'title']",
+     "[hr ---]");
+
+  // currently, looks max one line ahead, thus won't catch valid CommonMark
+  //  markup
+  MT("setext_oneLineLookahead",
+     "foo",
+     "[header&header-1 bar]",
+     "[header&header-1 =]");
+
+  // ensure we regard space after a single dash as a list
+  MT("setext_emptyList",
+     "foo",
+     "[variable-2 - ]",
+     "foo");
+
+  // Single-line blockquote with trailing space
+  MT("blockquoteSpace",
+     "[quote&quote-1 > foo]");
+
+  // Single-line blockquote
+  MT("blockquoteNoSpace",
+     "[quote&quote-1 >foo]");
+
+  // No blank line before blockquote
+  MT("blockquoteNoBlankLine",
+     "foo",
+     "[quote&quote-1 > bar]");
+
+  MT("blockquoteNested",
+     "[quote&quote-1 > foo]",
+     "[quote&quote-1 >][quote&quote-2 > foo]",
+     "[quote&quote-1 >][quote&quote-2 >][quote&quote-3 > foo]");
+
+  // ensure quote-level is inferred correctly even if indented
+  MT("blockquoteNestedIndented",
+     " [quote&quote-1 > foo]",
+     " [quote&quote-1 >][quote&quote-2 > foo]",
+     " [quote&quote-1 >][quote&quote-2 >][quote&quote-3 > foo]");
+
+  // ensure quote-level is inferred correctly even if indented
+  MT("blockquoteIndentedTooMuch",
+     "foo",
+     "    > bar");
+
+  // Single-line blockquote followed by normal paragraph
+  MT("blockquoteThenParagraph",
+     "[quote&quote-1 >foo]",
+     "",
+     "bar");
+
+  // Multi-line blockquote (lazy mode)
+  MT("multiBlockquoteLazy",
+     "[quote&quote-1 >foo]",
+     "[quote&quote-1 bar]");
+
+  // Multi-line blockquote followed by normal paragraph (lazy mode)
+  MT("multiBlockquoteLazyThenParagraph",
+     "[quote&quote-1 >foo]",
+     "[quote&quote-1 bar]",
+     "",
+     "hello");
+
+  // Multi-line blockquote (non-lazy mode)
+  MT("multiBlockquote",
+     "[quote&quote-1 >foo]",
+     "[quote&quote-1 >bar]");
+
+  // Multi-line blockquote followed by normal paragraph (non-lazy mode)
+  MT("multiBlockquoteThenParagraph",
+     "[quote&quote-1 >foo]",
+     "[quote&quote-1 >bar]",
+     "",
+     "hello");
+
+  // disallow lists inside blockquote for now because it causes problems outside blockquote
+  // TODO: fix to be CommonMark-compliant
+  MT("listNestedInBlockquote",
+     "[quote&quote-1 > - foo]");
+
+  // disallow fenced blocks inside blockquote because it causes problems outside blockquote
+  // TODO: fix to be CommonMark-compliant
+  MT("fencedBlockNestedInBlockquote",
+     "[quote&quote-1 > ```]",
+     "[quote&quote-1 > code]",
+     "[quote&quote-1 > ```]",
+     // ensure we still allow inline code
+     "[quote&quote-1 > ][quote&quote-1&comment `code`]");
+
+  // Header with leading space after continued blockquote (#3287, negative indentation)
+  MT("headerAfterContinuedBlockquote",
+     "[quote&quote-1 > foo]",
+     "[quote&quote-1 bar]",
+     "",
+     " [header&header-1 # hello]");
+
+  // Check list types
+
+  MT("listAsterisk",
+     "foo",
+     "bar",
+     "",
+     "[variable-2 * foo]",
+     "[variable-2 * bar]");
+
+  MT("listPlus",
+     "foo",
+     "bar",
+     "",
+     "[variable-2 + foo]",
+     "[variable-2 + bar]");
+
+  MT("listDash",
+     "foo",
+     "bar",
+     "",
+     "[variable-2 - foo]",
+     "[variable-2 - bar]");
+
+  MT("listNumber",
+     "foo",
+     "bar",
+     "",
+     "[variable-2 1. foo]",
+     "[variable-2 2. bar]");
+
+  MT("listFromParagraph",
+     "foo",
+     "[variable-2 1. bar]",
+     "[variable-2 2. hello]");
+
+  // List after hr
+  MT("listAfterHr",
+     "[hr ---]",
+     "[variable-2 - bar]");
+
+  // List after header
+  MT("listAfterHeader",
+     "[header&header-1 # foo]",
+     "[variable-2 - bar]");
+
+  // hr after list
+  MT("hrAfterList",
+     "[variable-2 - foo]",
+     "[hr -----]");
+
+  MT("hrAfterFencedCode",
+     "[comment ```]",
+     "[comment code]",
+     "[comment ```]",
+     "[hr ---]");
+
+  // allow hr inside lists
+  // (require prev line to be empty or hr, TODO: non-CommonMark-compliant)
+  MT("hrInsideList",
+     "[variable-2 - foo]",
+     "",
+     "  [hr ---]",
+     "     [hr ---]",
+     "",
+     "      [comment ---]");
+
+  MT("consecutiveHr",
+     "[hr ---]",
+     "[hr ---]",
+     "[hr ---]");
+
+  // Formatting in lists (*)
+  MT("listAsteriskFormatting",
+     "[variable-2 * ][variable-2&em *foo*][variable-2  bar]",
+     "[variable-2 * ][variable-2&strong **foo**][variable-2  bar]",
+     "[variable-2 * ][variable-2&em&strong ***foo***][variable-2  bar]",
+     "[variable-2 * ][variable-2&comment `foo`][variable-2  bar]");
+
+  // Formatting in lists (+)
+  MT("listPlusFormatting",
+     "[variable-2 + ][variable-2&em *foo*][variable-2  bar]",
+     "[variable-2 + ][variable-2&strong **foo**][variable-2  bar]",
+     "[variable-2 + ][variable-2&em&strong ***foo***][variable-2  bar]",
+     "[variable-2 + ][variable-2&comment `foo`][variable-2  bar]");
+
+  // Formatting in lists (-)
+  MT("listDashFormatting",
+     "[variable-2 - ][variable-2&em *foo*][variable-2  bar]",
+     "[variable-2 - ][variable-2&strong **foo**][variable-2  bar]",
+     "[variable-2 - ][variable-2&em&strong ***foo***][variable-2  bar]",
+     "[variable-2 - ][variable-2&comment `foo`][variable-2  bar]");
+
+  // Formatting in lists (1.)
+  MT("listNumberFormatting",
+     "[variable-2 1. ][variable-2&em *foo*][variable-2  bar]",
+     "[variable-2 2. ][variable-2&strong **foo**][variable-2  bar]",
+     "[variable-2 3. ][variable-2&em&strong ***foo***][variable-2  bar]",
+     "[variable-2 4. ][variable-2&comment `foo`][variable-2  bar]");
+
+  // Paragraph lists
+  MT("listParagraph",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]");
+
+  // Multi-paragraph lists
+  //
+  // 4 spaces
+  MT("listMultiParagraph",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "    [variable-2 hello]");
+
+  // 4 spaces, extra blank lines (should still be list, per Dingus)
+  MT("listMultiParagraphExtra",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "",
+     "    [variable-2 hello]");
+
+  // 4 spaces, plus 1 space (should still be list, per Dingus)
+  MT("listMultiParagraphExtraSpace",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "     [variable-2 hello]",
+     "",
+     "    [variable-2 world]");
+
+  // 1 tab
+  MT("listTab",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "\t[variable-2 hello]");
+
+  // No indent
+  MT("listNoIndent",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "hello");
+
+  MT("listCommonMarkIndentationCode",
+     "[variable-2 * Code blocks also affect]",
+     "  [variable-3 * The next level starts where the contents start.]",
+     "   [variable-3 *    Anything less than that will keep the item on the same level.]",
+     "       [variable-3 * Each list item can indent the first level further and further.]",
+     "  [variable-3 * For the most part, this makes sense while writing a list.]",
+     "    [keyword * This means two items with same indentation can be different levels.]",
+     "     [keyword *  Each level has an indent requirement that can change between items.]",
+     "       [keyword * A list item that meets this will be part of the next level.]",
+     "   [variable-3 * Otherwise, it will be part of the level where it does meet this.]",
+     " [variable-2 * World]");
+
+  // should handle nested and un-nested lists
+  MT("listCommonMark_MixedIndents",
+     "[variable-2 * list1]",
+     "    [variable-2 list1]",
+     "  [variable-2&header&header-1 # heading still part of list1]",
+     "  [variable-2 text after heading still part of list1]",
+     "",
+     "      [comment indented codeblock]",
+     "  [variable-2 list1 after code block]",
+     "  [variable-3 * list2]",
+     // amount of spaces on empty lines between lists doesn't matter
+     "              ",
+     // extra empty lines irrelevant
+     "",
+     "",
+     "    [variable-3 indented text part of list2]",
+     "    [keyword * list3]",
+     "",
+     "    [variable-3 text at level of list2]",
+     "",
+     "  [variable-2 de-indented text part of list1 again]",
+     "",
+     "  [variable-2&comment ```]",
+     "  [comment code]",
+     "  [variable-2&comment ```]",
+     "",
+     "  [variable-2 text after fenced code]");
+
+  // should correctly parse numbered list content indentation
+  MT("listCommonMark_NumberedListIndent",
+     "[variable-2 1000. list with base indent of 6]",
+     "",
+     "      [variable-2 text must be indented 6 spaces at minimum]",
+     "",
+     "         [variable-2 9-spaces indented text still part of list]",
+     "",
+     "          [comment indented codeblock starts at 10 spaces]",
+     "",
+     "     [comment text indented by 5 spaces no longer belong to list]");
+
+  // should consider tab as 4 spaces
+  MT("listCommonMark_TabIndented",
+     "[variable-2 * list]",
+     "\t[variable-3 * list2]",
+     "",
+     "\t\t[variable-3 part of list2]");
+
+  MT("listAfterBlockquote",
+     "[quote&quote-1 > foo]",
+     "[variable-2 - bar]");
+
+  // shouldn't create sublist if it's indented more than allowed
+  MT("nestedListIndentedTooMuch",
+     "[variable-2 - foo]",
+     "          [variable-2 - bar]");
+
+  MT("listIndentedTooMuchAfterParagraph",
+     "foo",
+     "    - bar");
+
+  // Blockquote
+  MT("blockquote",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "    [variable-2&quote&quote-1 > hello]");
+
+  // Code block
+  MT("blockquoteCode",
+     "[variable-2 * foo]",
+     "",
+     "[variable-2 * bar]",
+     "",
+     "        [comment > hello]",
+     "",
+     "    [variable-2 world]");
+
+  // Code block followed by text
+  MT("blockquoteCodeText",
+     "[variable-2 * foo]",
+     "",
+     "    [variable-2 bar]",
+     "",
+     "        [comment hello]",
+     "",
+     "    [variable-2 world]");
+
+  // Nested list
+
+  MT("listAsteriskNested",
+     "[variable-2 * foo]",
+     "",
+     "    [variable-3 * bar]");
+
+  MT("listPlusNested",
+     "[variable-2 + foo]",
+     "",
+     "    [variable-3 + bar]");
+
+  MT("listDashNested",
+     "[variable-2 - foo]",
+     "",
+     "    [variable-3 - bar]");
+
+  MT("listNumberNested",
+     "[variable-2 1. foo]",
+     "",
+     "    [variable-3 2. bar]");
+
+  MT("listMixed",
+     "[variable-2 * foo]",
+     "",
+     "    [variable-3 + bar]",
+     "",
+     "        [keyword - hello]",
+     "",
+     "            [variable-2 1. world]");
+
+  MT("listBlockquote",
+     "[variable-2 * foo]",
+     "",
+     "    [variable-3 + bar]",
+     "",
+     "        [quote&quote-1&variable-3 > hello]");
+
+  MT("listCode",
+     "[variable-2 * foo]",
+     "",
+     "    [variable-3 + bar]",
+     "",
+     "            [comment hello]");
+
+  // Code with internal indentation
+  MT("listCodeIndentation",
+     "[variable-2 * foo]",
+     "",
+     "        [comment bar]",
+     "            [comment hello]",
+     "                [comment world]",
+     "        [comment foo]",
+     "    [variable-2 bar]");
+
+  // List nesting edge cases
+  MT("listNested",
+    "[variable-2 * foo]",
+    "",
+    "    [variable-3 * bar]",
+    "",
+    "       [variable-3 hello]"
+  );
+  MT("listNested",
+    "[variable-2 * foo]",
+    "",
+    "    [variable-3 * bar]",
+    "",
+    "      [keyword * foo]"
+  );
+
+  // Code followed by text
+  MT("listCodeText",
+     "[variable-2 * foo]",
+     "",
+     "        [comment bar]",
+     "",
+     "hello");
+
+  // Following tests directly from official Markdown documentation
+  // http://daringfireball.net/projects/markdown/syntax#hr
+
+  MT("hrSpace",
+     "[hr * * *]");
+
+  MT("hr",
+     "[hr ***]");
+
+  MT("hrLong",
+     "[hr *****]");
+
+  MT("hrSpaceDash",
+     "[hr - - -]");
+
+  MT("hrDashLong",
+     "[hr ---------------------------------------]");
+
+  //Images
+  MT("Images",
+     "[image&image-marker !][image&image-alt-text&link [[alt text]]][string&url (http://link.to/image.jpg)]")
+
+  //Images with highlight alt text
+  MT("imageEm",
+     "[image&image-marker !][image&image-alt-text&link [[][image-alt-text&em&image&link *alt text*][image&image-alt-text&link ]]][string&url (http://link.to/image.jpg)]");
+
+  MT("imageStrong",
+     "[image&image-marker !][image&image-alt-text&link [[][image-alt-text&strong&image&link **alt text**][image&image-alt-text&link ]]][string&url (http://link.to/image.jpg)]");
+
+  MT("imageEmStrong",
+     "[image&image-marker !][image&image-alt-text&link [[][image&image-alt-text&em&strong&link ***alt text***][image&image-alt-text&link ]]][string&url (http://link.to/image.jpg)]");
+
+  // Inline link with title
+  MT("linkTitle",
+     "[link [[foo]]][string&url (http://example.com/ \"bar\")] hello");
+
+  // Inline link without title
+  MT("linkNoTitle",
+     "[link [[foo]]][string&url (http://example.com/)] bar");
+
+  // Inline link with image
+  MT("linkImage",
+     "[link [[][link&image&image-marker !][link&image&image-alt-text&link [[alt text]]][string&url (http://link.to/image.jpg)][link ]]][string&url (http://example.com/)] bar");
+
+  // Inline link with Em
+  MT("linkEm",
+     "[link [[][link&em *foo*][link ]]][string&url (http://example.com/)] bar");
+
+  // Inline link with Strong
+  MT("linkStrong",
+     "[link [[][link&strong **foo**][link ]]][string&url (http://example.com/)] bar");
+
+  // Inline link with EmStrong
+  MT("linkEmStrong",
+     "[link [[][link&em&strong ***foo***][link ]]][string&url (http://example.com/)] bar");
+
+  MT("multilineLink",
+     "[link [[foo]",
+     "[link bar]]][string&url (https://foo#_a)]",
+     "should not be italics")
+
+  // Image with title
+  MT("imageTitle",
+     "[image&image-marker !][image&image-alt-text&link [[alt text]]][string&url (http://example.com/ \"bar\")] hello");
+
+  // Image without title
+  MT("imageNoTitle",
+     "[image&image-marker !][image&image-alt-text&link [[alt text]]][string&url (http://example.com/)] bar");
+
+  // Image with asterisks
+  MT("imageAsterisks",
+     "[image&image-marker !][image&image-alt-text&link [[ ][image&image-alt-text&em&link *alt text*][image&image-alt-text&link ]]][string&url (http://link.to/image.jpg)] bar");
+
+  // Not a link. Should be normal text due to square brackets being used
+  // regularly in text, especially in quoted material, and no space is allowed
+  // between square brackets and parentheses (per Dingus).
+  MT("notALink",
+     "[link [[foo]]] (bar)");
+
+  // Reference-style links
+  MT("linkReference",
+     "[link [[foo]]][string&url [[bar]]] hello");
+
+  // Reference-style links with Em
+  MT("linkReferenceEm",
+     "[link [[][link&em *foo*][link ]]][string&url [[bar]]] hello");
+
+  // Reference-style links with Strong
+  MT("linkReferenceStrong",
+     "[link [[][link&strong **foo**][link ]]][string&url [[bar]]] hello");
+
+  // Reference-style links with EmStrong
+  MT("linkReferenceEmStrong",
+     "[link [[][link&em&strong ***foo***][link ]]][string&url [[bar]]] hello");
+
+  // Reference-style links with optional space separator (per documentation)
+  // "You can optionally use a space to separate the sets of brackets"
+  MT("linkReferenceSpace",
+     "[link [[foo]]] [string&url [[bar]]] hello");
+
+  // Should only allow a single space ("...use *a* space...")
+  MT("linkReferenceDoubleSpace",
+     "[link [[foo]]]  [link [[bar]]] hello");
+
+  // Reference-style links with implicit link name
+  MT("linkImplicit",
+     "[link [[foo]]][string&url [[]]] hello");
+
+  // @todo It would be nice if, at some point, the document was actually
+  // checked to see if the referenced link exists
+
+  // Link label, for reference-style links (taken from documentation)
+
+  MT("labelNoTitle",
+     "[link [[foo]]:] [string&url http://example.com/]");
+
+  MT("labelIndented",
+     "   [link [[foo]]:] [string&url http://example.com/]");
+
+  MT("labelSpaceTitle",
+     "[link [[foo bar]]:] [string&url http://example.com/ \"hello\"]");
+
+  MT("labelDoubleTitle",
+     "[link [[foo bar]]:] [string&url http://example.com/ \"hello\"] \"world\"");
+
+  MT("labelTitleDoubleQuotes",
+     "[link [[foo]]:] [string&url http://example.com/  \"bar\"]");
+
+  MT("labelTitleSingleQuotes",
+     "[link [[foo]]:] [string&url http://example.com/  'bar']");
+
+  MT("labelTitleParentheses",
+     "[link [[foo]]:] [string&url http://example.com/  (bar)]");
+
+  MT("labelTitleInvalid",
+     "[link [[foo]]:] [string&url http://example.com/] bar");
+
+  MT("labelLinkAngleBrackets",
+     "[link [[foo]]:] [string&url <http://example.com/>  \"bar\"]");
+
+  MT("labelTitleNextDoubleQuotes",
+     "[link [[foo]]:] [string&url http://example.com/]",
+     "[string \"bar\"] hello");
+
+  MT("labelTitleNextSingleQuotes",
+     "[link [[foo]]:] [string&url http://example.com/]",
+     "[string 'bar'] hello");
+
+  MT("labelTitleNextParentheses",
+     "[link [[foo]]:] [string&url http://example.com/]",
+     "[string (bar)] hello");
+
+  MT("labelTitleNextMixed",
+     "[link [[foo]]:] [string&url http://example.com/]",
+     "(bar\" hello");
+
+  MT("labelEscape",
+     "[link [[foo \\]] ]]:] [string&url http://example.com/]");
+
+  MT("labelEscapeColon",
+     "[link [[foo \\]]: bar]]:] [string&url http://example.com/]");
+
+  MT("labelEscapeEnd",
+     "\\[[foo\\]]: http://example.com/");
+
+  MT("linkWeb",
+     "[link <http://example.com/>] foo");
+
+  MT("linkWebDouble",
+     "[link <http://example.com/>] foo [link <http://example.com/>]");
+
+  MT("linkEmail",
+     "[link <user@example.com>] foo");
+
+  MT("linkEmailDouble",
+     "[link <user@example.com>] foo [link <user@example.com>]");
+
+  MT("emAsterisk",
+     "[em *foo*] bar");
+
+  MT("emUnderscore",
+     "[em _foo_] bar");
+
+  MT("emInWordAsterisk",
+     "foo[em *bar*]hello");
+
+  MT("emInWordUnderscore",
+     "foo_bar_hello");
+
+  // Per documentation: "...surround an * or _ with spaces, it’ll be
+  // treated as a literal asterisk or underscore."
+
+  MT("emEscapedBySpaceIn",
+     "foo [em _bar _ hello_] world");
+
+  MT("emEscapedBySpaceOut",
+     "foo _ bar [em _hello_] world");
+
+  MT("emEscapedByNewline",
+     "foo",
+     "_ bar [em _hello_] world");
+
+  // Unclosed emphasis characters
+  // Instead of simply marking as EM / STRONG, it would be nice to have an
+  // incomplete flag for EM and STRONG, that is styled slightly different.
+  MT("emIncompleteAsterisk",
+     "foo [em *bar]");
+
+  MT("emIncompleteUnderscore",
+     "foo [em _bar]");
+
+  MT("strongAsterisk",
+     "[strong **foo**] bar");
+
+  MT("strongUnderscore",
+     "[strong __foo__] bar");
+
+  MT("emStrongAsterisk",
+     "[em *foo][em&strong **bar*][strong hello**] world");
+
+  MT("emStrongUnderscore",
+     "[em _foo ][em&strong __bar_][strong  hello__] world");
+
+  // "...same character must be used to open and close an emphasis span.""
+  MT("emStrongMixed",
+     "[em _foo][em&strong **bar*hello__ world]");
+
+  MT("emStrongMixed",
+     "[em *foo ][em&strong __bar_hello** world]");
+
+  MT("linkWithNestedParens",
+     "[link [[foo]]][string&url (bar(baz))]")
+
+  // These characters should be escaped:
+  // \   backslash
+  // `   backtick
+  // *   asterisk
+  // _   underscore
+  // {}  curly braces
+  // []  square brackets
+  // ()  parentheses
+  // #   hash mark
+  // +   plus sign
+  // -   minus sign (hyphen)
+  // .   dot
+  // !   exclamation mark
+
+  MT("escapeBacktick",
+     "foo \\`bar\\`");
+
+  MT("doubleEscapeBacktick",
+     "foo \\\\[comment `bar\\\\`]");
+
+  MT("escapeAsterisk",
+     "foo \\*bar\\*");
+
+  MT("doubleEscapeAsterisk",
+     "foo \\\\[em *bar\\\\*]");
+
+  MT("escapeUnderscore",
+     "foo \\_bar\\_");
+
+  MT("doubleEscapeUnderscore",
+     "foo \\\\[em _bar\\\\_]");
+
+  MT("escapeHash",
+     "\\# foo");
+
+  MT("doubleEscapeHash",
+     "\\\\# foo");
+
+  MT("escapeNewline",
+     "\\",
+     "[em *foo*]");
+
+  // Class override tests
+  TokenTypeOverrideTest("overrideHeader1",
+    "[override-header&override-header-1 # Foo]");
+
+  TokenTypeOverrideTest("overrideHeader2",
+    "[override-header&override-header-2 ## Foo]");
+
+  TokenTypeOverrideTest("overrideHeader3",
+    "[override-header&override-header-3 ### Foo]");
+
+  TokenTypeOverrideTest("overrideHeader4",
+    "[override-header&override-header-4 #### Foo]");
+
+  TokenTypeOverrideTest("overrideHeader5",
+    "[override-header&override-header-5 ##### Foo]");
+
+  TokenTypeOverrideTest("overrideHeader6",
+    "[override-header&override-header-6 ###### Foo]");
+
+  TokenTypeOverrideTest("overrideCode",
+    "[override-code `foo`]");
+
+  TokenTypeOverrideTest("overrideCodeBlock",
+    "[override-code ```]",
+    "[override-code foo]",
+    "[override-code ```]");
+
+  TokenTypeOverrideTest("overrideQuote",
+    "[override-quote&override-quote-1 > foo]",
+    "[override-quote&override-quote-1 > bar]");
+
+  TokenTypeOverrideTest("overrideQuoteNested",
+    "[override-quote&override-quote-1 > foo]",
+    "[override-quote&override-quote-1 >][override-quote&override-quote-2 > bar]",
+    "[override-quote&override-quote-1 >][override-quote&override-quote-2 >][override-quote&override-quote-3 > baz]");
+
+  TokenTypeOverrideTest("overrideLists",
+    "[override-list1 - foo]",
+    "",
+    "    [override-list2 + bar]",
+    "",
+    "        [override-list3 * baz]",
+    "",
+    "            [override-list1 1. qux]",
+    "",
+    "                [override-list2 - quux]");
+
+  TokenTypeOverrideTest("overrideHr",
+    "[override-hr * * *]");
+
+  TokenTypeOverrideTest("overrideImage",
+    "[override-image&override-image-marker !][override-image&override-image-alt-text&link [[alt text]]][override-link-href&url (http://link.to/image.jpg)]");
+
+  TokenTypeOverrideTest("overrideLinkText",
+    "[override-link-text [[foo]]][override-link-href&url (http://example.com)]");
+
+  TokenTypeOverrideTest("overrideLinkEmailAndInline",
+    "[override-link-email <][override-link-inline foo@example.com>]");
+
+  TokenTypeOverrideTest("overrideEm",
+    "[override-em *foo*]");
+
+  TokenTypeOverrideTest("overrideStrong",
+    "[override-strong **foo**]");
+
+  TokenTypeOverrideTest("overrideStrikethrough",
+    "[override-strikethrough ~~foo~~]");
+
+  TokenTypeOverrideTest("overrideEmoji",
+    "[override-emoji :foo:]");
+
+  FormatTokenTypeOverrideTest("overrideFormatting",
+    "[override-formatting-escape \\*]");
+
+  // Tests to make sure GFM-specific things aren't getting through
+
+  MT("taskList",
+     "[variable-2 * ][link&variable-2 [[ ]]][variable-2 bar]");
+
+  MT("fencedCodeBlocks",
+     "[comment ```]",
+     "[comment foo]",
+     "",
+     "[comment bar]",
+     "[comment ```]",
+     "baz");
+
+  MT("fencedCodeBlocks_invalidClosingFence_trailingText",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment ``` must not have trailing text]",
+     "[comment baz]");
+
+  MT("fencedCodeBlocks_invalidClosingFence_trailingTabs",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment ```\t]",
+     "[comment baz]");
+
+  MT("fencedCodeBlocks_validClosingFence",
+     "[comment ```]",
+     "[comment foo]",
+     // may have trailing spaces
+     "[comment ```     ]",
+     "baz");
+
+  MT("fencedCodeBlocksInList_closingFenceIndented",
+     "[variable-2 - list]",
+     "    [variable-2&comment ```]",
+     "    [comment foo]",
+     "     [variable-2&comment ```]",
+     "    [variable-2 baz]");
+
+  MT("fencedCodeBlocksInList_closingFenceIndentedTooMuch",
+     "[variable-2 - list]",
+     "    [variable-2&comment ```]",
+     "    [comment foo]",
+     "      [comment ```]",
+     "    [comment baz]");
+
+  MT("fencedCodeBlockModeSwitching",
+     "[comment ```javascript]",
+     "[variable foo]",
+     "",
+     "[comment ```]",
+     "bar");
+
+  MT_noFencedHighlight("fencedCodeBlock_noHighlight",
+     "[comment ```javascript]",
+     "[comment foo]",
+     "[comment ```]");
+
+  MT("fencedCodeBlockModeSwitchingObjc",
+     "[comment ```objective-c]",
+     "[keyword @property] [variable NSString] [operator *] [variable foo];",
+     "[comment ```]",
+     "bar");
+
+  MT("fencedCodeBlocksMultipleChars",
+     "[comment `````]",
+     "[comment foo]",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment `````]",
+     "bar");
+
+  MT("fencedCodeBlocksTildes",
+     "[comment ~~~]",
+     "[comment foo]",
+     "[comment ~~~]",
+     "bar");
+
+  MT("fencedCodeBlocksTildesMultipleChars",
+     "[comment ~~~~~]",
+     "[comment ~~~]",
+     "[comment foo]",
+     "[comment ~~~~~]",
+     "bar");
+
+  MT("fencedCodeBlocksMultipleChars",
+     "[comment `````]",
+     "[comment foo]",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment `````]",
+     "bar");
+
+  MT("fencedCodeBlocksMixed",
+     "[comment ~~~]",
+     "[comment ```]",
+     "[comment foo]",
+     "[comment ~~~]",
+     "bar");
+
+  MT("fencedCodeBlocksAfterBlockquote",
+     "[quote&quote-1 > foo]",
+     "[comment ```]",
+     "[comment bar]",
+     "[comment ```]");
+
+  // fencedCode indented too much should act as simple indentedCode
+  //  (hence has no highlight formatting)
+  FT("tooMuchIndentedFencedCode",
+     "    [comment ```]",
+     "    [comment code]",
+     "    [comment ```]");
+
+  MT("autoTerminateFencedCodeWhenLeavingList",
+     "[variable-2 - list1]",
+     "  [variable-3 - list2]",
+     "    [variable-3&comment ```]",
+     "    [comment code]",
+     "  [variable-3 - list2]",
+     "  [variable-2&comment ```]",
+     "  [comment code]",
+     "[quote&quote-1 > foo]");
+
+  // Tests that require XML mode
+
+  MT("xmlMode",
+     "[tag&bracket <][tag div][tag&bracket >]",
+     "  *foo*",
+     "  [tag&bracket <][tag http://github.com][tag&bracket />]",
+     "[tag&bracket </][tag div][tag&bracket >]",
+     "[link <http://github.com/>]");
+
+  MT("xmlModeWithMarkdownInside",
+     "[tag&bracket <][tag div] [attribute markdown]=[string 1][tag&bracket >]",
+     "[em *foo*]",
+     "[link <http://github.com/>]",
+     "[tag </div>]",
+     "[link <http://github.com/>]",
+     "[tag&bracket <][tag div][tag&bracket >]",
+     "[tag&bracket </][tag div][tag&bracket >]");
+
+  MT("xmlModeLineBreakInTags",
+     "[tag&bracket <][tag div] [attribute id]=[string \"1\"]",
+     "     [attribute class]=[string \"sth\"][tag&bracket >]xxx",
+     "[tag&bracket </][tag div][tag&bracket >]");
+
+  MT("xmlModeCommentWithBlankLine",
+     "[comment <!-- Hello]",
+     "",
+     "[comment World -->]");
+
+  MT("xmlModeCDATA",
+     "[atom <![CDATA[ Hello]",
+     "",
+     "[atom FooBar]",
+     "[atom Test ]]]]>]");
+
+  MT("xmlModePreprocessor",
+     "[meta <?php] [meta echo '1234'; ?>]");
+
+  MT_noXml("xmlHighlightDisabled",
+     "<div>foo</div>");
+
+  // Tests Emojis
+
+  ET("emojiDefault",
+    "[builtin :foobar:]");
+
+  ET("emojiTable",
+    " :--:");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mathematica/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+<!doctype html>
+
+<title>CodeMirror: Mathematica mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src=../../addon/edit/matchbrackets.js></script>
+<script src=mathematica.js></script>
+<style type=text/css>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Mathematica</a>
+  </ul>
+</div>
+
+<article>
+<h2>Mathematica mode</h2>
+
+
+<textarea id="mathematicaCode">
+(* example Mathematica code *)
+(* Dualisiert wird anhand einer Polarität an einer
+   Quadrik $x^t Q x = 0$ mit regulärer Matrix $Q$ (also
+   mit $det(Q) \neq 0$), z.B. die Identitätsmatrix.
+   $p$ ist eine Liste von Polynomen - ein Ideal. *)
+dualize::"singular" = "Q must be regular: found Det[Q]==0.";
+dualize[ Q_, p_ ] := Block[
+    { m, n, xv, lv, uv, vars, polys, dual },
+    If[Det[Q] == 0,
+      Message[dualize::"singular"],
+      m = Length[p];
+      n = Length[Q] - 1;
+      xv = Table[Subscript[x, i], {i, 0, n}];
+      lv = Table[Subscript[l, i], {i, 1, m}];
+      uv = Table[Subscript[u, i], {i, 0, n}];
+      (* Konstruiere Ideal polys. *)
+      If[m == 0,
+        polys = Q.uv,
+        polys = Join[p, Q.uv - Transpose[Outer[D, p, xv]].lv]
+        ];
+      (* Eliminiere die ersten n + 1 + m Variablen xv und lv
+         aus dem Ideal polys. *)
+      vars = Join[xv, lv];
+      dual = GroebnerBasis[polys, uv, vars];
+      (* Ersetze u mit x im Ergebnis. *)
+      ReplaceAll[dual, Rule[u, x]]
+      ]
+    ]
+</textarea>
+
+<script>
+  var mathematicaEditor = CodeMirror.fromTextArea(document.getElementById('mathematicaCode'), {
+    mode: 'text/x-mathematica',
+    lineNumbers: true,
+    matchBrackets: true
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-mathematica</code> (Mathematica).</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mathematica/mathematica.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,176 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Mathematica mode copyright (c) 2015 by Calin Barbat
+// Based on code by Patrick Scheibe (halirutan)
+// See: https://github.com/halirutan/Mathematica-Source-Highlighting/tree/master/src/lang-mma.js
+
+(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.defineMode('mathematica', function(_config, _parserConfig) {
+
+  // used pattern building blocks
+  var Identifier = '[a-zA-Z\\$][a-zA-Z0-9\\$]*';
+  var pBase      = "(?:\\d+)";
+  var pFloat     = "(?:\\.\\d+|\\d+\\.\\d*|\\d+)";
+  var pFloatBase = "(?:\\.\\w+|\\w+\\.\\w*|\\w+)";
+  var pPrecision = "(?:`(?:`?"+pFloat+")?)";
+
+  // regular expressions
+  var reBaseForm        = new RegExp('(?:'+pBase+'(?:\\^\\^'+pFloatBase+pPrecision+'?(?:\\*\\^[+-]?\\d+)?))');
+  var reFloatForm       = new RegExp('(?:' + pFloat + pPrecision + '?(?:\\*\\^[+-]?\\d+)?)');
+  var reIdInContext     = new RegExp('(?:`?)(?:' + Identifier + ')(?:`(?:' + Identifier + '))*(?:`?)');
+
+  function tokenBase(stream, state) {
+    var ch;
+
+    // get next character
+    ch = stream.next();
+
+    // string
+    if (ch === '"') {
+      state.tokenize = tokenString;
+      return state.tokenize(stream, state);
+    }
+
+    // comment
+    if (ch === '(') {
+      if (stream.eat('*')) {
+        state.commentLevel++;
+        state.tokenize = tokenComment;
+        return state.tokenize(stream, state);
+      }
+    }
+
+    // go back one character
+    stream.backUp(1);
+
+    // look for numbers
+    // Numbers in a baseform
+    if (stream.match(reBaseForm, true, false)) {
+      return 'number';
+    }
+
+    // Mathematica numbers. Floats (1.2, .2, 1.) can have optionally a precision (`float) or an accuracy definition
+    // (``float). Note: while 1.2` is possible 1.2`` is not. At the end an exponent (float*^+12) can follow.
+    if (stream.match(reFloatForm, true, false)) {
+      return 'number';
+    }
+
+    /* In[23] and Out[34] */
+    if (stream.match(/(?:In|Out)\[[0-9]*\]/, true, false)) {
+      return 'atom';
+    }
+
+    // usage
+    if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::usage)/, true, false)) {
+      return 'meta';
+    }
+
+    // message
+    if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*(?:`[a-zA-Z0-9\$]+)*::[a-zA-Z\$][a-zA-Z0-9\$]*):?/, true, false)) {
+      return 'string-2';
+    }
+
+    // this makes a look-ahead match for something like variable:{_Integer}
+    // the match is then forwarded to the mma-patterns tokenizer.
+    if (stream.match(/([a-zA-Z\$][a-zA-Z0-9\$]*\s*:)(?:(?:[a-zA-Z\$][a-zA-Z0-9\$]*)|(?:[^:=>~@\^\&\*\)\[\]'\?,\|])).*/, true, false)) {
+      return 'variable-2';
+    }
+
+    // catch variables which are used together with Blank (_), BlankSequence (__) or BlankNullSequence (___)
+    // Cannot start with a number, but can have numbers at any other position. Examples
+    // blub__Integer, a1_, b34_Integer32
+    if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) {
+      return 'variable-2';
+    }
+    if (stream.match(/[a-zA-Z\$][a-zA-Z0-9\$]*_+/, true, false)) {
+      return 'variable-2';
+    }
+    if (stream.match(/_+[a-zA-Z\$][a-zA-Z0-9\$]*/, true, false)) {
+      return 'variable-2';
+    }
+
+    // Named characters in Mathematica, like \[Gamma].
+    if (stream.match(/\\\[[a-zA-Z\$][a-zA-Z0-9\$]*\]/, true, false)) {
+      return 'variable-3';
+    }
+
+    // Match all braces separately
+    if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
+      return 'bracket';
+    }
+
+    // Catch Slots (#, ##, #3, ##9 and the V10 named slots #name). I have never seen someone using more than one digit after #, so we match
+    // only one.
+    if (stream.match(/(?:#[a-zA-Z\$][a-zA-Z0-9\$]*|#+[0-9]?)/, true, false)) {
+      return 'variable-2';
+    }
+
+    // Literals like variables, keywords, functions
+    if (stream.match(reIdInContext, true, false)) {
+      return 'keyword';
+    }
+
+    // operators. Note that operators like @@ or /; are matched separately for each symbol.
+    if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%)/, true, false)) {
+      return 'operator';
+    }
+
+    // everything else is an error
+    stream.next(); // advance the stream.
+    return 'error';
+  }
+
+  function tokenString(stream, state) {
+    var next, end = false, escaped = false;
+    while ((next = stream.next()) != null) {
+      if (next === '"' && !escaped) {
+        end = true;
+        break;
+      }
+      escaped = !escaped && next === '\\';
+    }
+    if (end && !escaped) {
+      state.tokenize = tokenBase;
+    }
+    return 'string';
+  };
+
+  function tokenComment(stream, state) {
+    var prev, next;
+    while(state.commentLevel > 0 && (next = stream.next()) != null) {
+      if (prev === '(' && next === '*') state.commentLevel++;
+      if (prev === '*' && next === ')') state.commentLevel--;
+      prev = next;
+    }
+    if (state.commentLevel <= 0) {
+      state.tokenize = tokenBase;
+    }
+    return 'comment';
+  }
+
+  return {
+    startState: function() {return {tokenize: tokenBase, commentLevel: 0};},
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      return state.tokenize(stream, state);
+    },
+    blockCommentStart: "(*",
+    blockCommentEnd: "*)"
+  };
+});
+
+CodeMirror.defineMIME('text/x-mathematica', {
+  name: 'mathematica'
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mbox/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+<!doctype html>
+
+<title>CodeMirror: mbox mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="mbox.js"></script>
+<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">mbox</a>
+  </ul>
+</div>
+
+<article>
+<h2>mbox mode</h2>
+<form><textarea id="code" name="code">
+From timothygu99@gmail.com Sun Apr 17 01:40:43 2016
+From: Timothy Gu &lt;timothygu99@gmail.com&gt;
+Date: Sat, 16 Apr 2016 18:40:43 -0700
+Subject: mbox mode
+Message-ID: &lt;Z8d+bTT50U/az94FZnyPkDjZmW0=@gmail.com&gt;
+
+mbox mode is working!
+
+Timothy
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>application/mbox</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mbox/mbox.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,129 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+var rfc2822 = [
+  "From", "Sender", "Reply-To", "To", "Cc", "Bcc", "Message-ID",
+  "In-Reply-To", "References", "Resent-From", "Resent-Sender", "Resent-To",
+  "Resent-Cc", "Resent-Bcc", "Resent-Message-ID", "Return-Path", "Received"
+];
+var rfc2822NoEmail = [
+  "Date", "Subject", "Comments", "Keywords", "Resent-Date"
+];
+
+CodeMirror.registerHelper("hintWords", "mbox", rfc2822.concat(rfc2822NoEmail));
+
+var whitespace = /^[ \t]/;
+var separator = /^From /; // See RFC 4155
+var rfc2822Header = new RegExp("^(" + rfc2822.join("|") + "): ");
+var rfc2822HeaderNoEmail = new RegExp("^(" + rfc2822NoEmail.join("|") + "): ");
+var header = /^[^:]+:/; // Optional fields defined in RFC 2822
+var email = /^[^ ]+@[^ ]+/;
+var untilEmail = /^.*?(?=[^ ]+?@[^ ]+)/;
+var bracketedEmail = /^<.*?>/;
+var untilBracketedEmail = /^.*?(?=<.*>)/;
+
+function styleForHeader(header) {
+  if (header === "Subject") return "header";
+  return "string";
+}
+
+function readToken(stream, state) {
+  if (stream.sol()) {
+    // From last line
+    state.inSeparator = false;
+    if (state.inHeader && stream.match(whitespace)) {
+      // Header folding
+      return null;
+    } else {
+      state.inHeader = false;
+      state.header = null;
+    }
+
+    if (stream.match(separator)) {
+      state.inHeaders = true;
+      state.inSeparator = true;
+      return "atom";
+    }
+
+    var match;
+    var emailPermitted = false;
+    if ((match = stream.match(rfc2822HeaderNoEmail)) ||
+        (emailPermitted = true) && (match = stream.match(rfc2822Header))) {
+      state.inHeaders = true;
+      state.inHeader = true;
+      state.emailPermitted = emailPermitted;
+      state.header = match[1];
+      return "atom";
+    }
+
+    // Use vim's heuristics: recognize custom headers only if the line is in a
+    // block of legitimate headers.
+    if (state.inHeaders && (match = stream.match(header))) {
+      state.inHeader = true;
+      state.emailPermitted = true;
+      state.header = match[1];
+      return "atom";
+    }
+
+    state.inHeaders = false;
+    stream.skipToEnd();
+    return null;
+  }
+
+  if (state.inSeparator) {
+    if (stream.match(email)) return "link";
+    if (stream.match(untilEmail)) return "atom";
+    stream.skipToEnd();
+    return "atom";
+  }
+
+  if (state.inHeader) {
+    var style = styleForHeader(state.header);
+
+    if (state.emailPermitted) {
+      if (stream.match(bracketedEmail)) return style + " link";
+      if (stream.match(untilBracketedEmail)) return style;
+    }
+    stream.skipToEnd();
+    return style;
+  }
+
+  stream.skipToEnd();
+  return null;
+};
+
+CodeMirror.defineMode("mbox", function() {
+  return {
+    startState: function() {
+      return {
+        // Is in a mbox separator
+        inSeparator: false,
+        // Is in a mail header
+        inHeader: false,
+        // If bracketed email is permitted. Only applicable when inHeader
+        emailPermitted: false,
+        // Name of current header
+        header: null,
+        // Is in a region of mail headers
+        inHeaders: false
+      };
+    },
+    token: readToken,
+    blankLine: function(state) {
+      state.inHeaders = state.inSeparator = state.inHeader = false;
+    }
+  };
+});
+
+CodeMirror.defineMIME("application/mbox", "mbox");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/meta.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,221 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.modeInfo = [
+    {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
+    {name: "PGP", mimes: ["application/pgp", "application/pgp-encrypted", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["asc", "pgp", "sig"]},
+    {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]},
+    {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
+    {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
+    {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
+    {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
+    {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy", "cbl"]},
+    {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]},
+    {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
+    {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
+    {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]},
+    {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists\.txt$/},
+    {name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
+    {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},
+    {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]},
+    {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]},
+    {name: "Crystal", mime: "text/x-crystal", mode: "crystal", ext: ["cr"]},
+    {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]},
+    {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]},
+    {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]},
+    {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]},
+    {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]},
+    {name: "Django", mime: "text/x-django", mode: "django"},
+    {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/},
+    {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]},
+    {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]},
+    {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
+    {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
+    {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
+    {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
+    {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
+    {name: "Embedded JavaScript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
+    {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
+    {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
+    {name: "Esper", mime: "text/x-esper", mode: "sql"},
+    {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]},
+    {name: "FCL", mime: "text/x-fcl", mode: "fcl"},
+    {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]},
+    {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90", "f95"]},
+    {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
+    {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
+    {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
+    {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history)\.md$/i},
+    {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
+    {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/},
+    {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
+    {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
+    {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]},
+    {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
+    {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
+    {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
+    {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm", "handlebars", "hbs"], alias: ["xhtml"]},
+    {name: "HTTP", mime: "message/http", mode: "http"},
+    {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
+    {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
+    {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
+    {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
+    {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
+     mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
+    {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
+    {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
+    {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]},
+    {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]},
+    {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"], alias: ["jl"]},
+    {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]},
+    {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
+    {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},
+    {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]},
+    {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
+    {name: "mIRC", mime: "text/mirc", mode: "mirc"},
+    {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
+    {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb", "wl", "wls"]},
+    {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
+    {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
+    {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
+    {name: "mbox", mime: "application/mbox", mode: "mbox", ext: ["mbox"]},
+    {name: "MySQL", mime: "text/x-mysql", mode: "sql"},
+    {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i},
+    {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
+    {name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
+     mode: "ntriples", ext: ["nt", "nq"]},
+    {name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m"], alias: ["objective-c", "objc"]},
+    {name: "Objective-C++", mime: "text/x-objectivec++", mode: "clike", ext: ["mm"], alias: ["objective-c++", "objc++"]},
+    {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
+    {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
+    {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
+    {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
+    {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]},
+    {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
+    {name: "PHP", mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]},
+    {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]},
+    {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
+    {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]},
+    {name: "PostgreSQL", mime: "text/x-pgsql", mode: "sql"},
+    {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]},
+    {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]},
+    {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]},
+    {name: "Python", mime: "text/x-python", mode: "python", ext: ["BUILD", "bzl", "py", "pyw"], file: /^(BUCK|BUILD)$/},
+    {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]},
+    {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]},
+    {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r", "R"], alias: ["rscript"]},
+    {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]},
+    {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"},
+    {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]},
+    {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]},
+    {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]},
+    {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]},
+    {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]},
+    {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]},
+    {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]},
+    {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]},
+    {name: "Shell", mimes: ["text/x-sh", "application/x-sh"], mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"], file: /^PKGBUILD$/},
+    {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]},
+    {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]},
+    {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
+    {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
+    {name: "Solr", mime: "text/x-solr", mode: "solr"},
+    {name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]},
+    {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},
+    {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
+    {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
+    {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
+    {name: "SQLite", mime: "text/x-sqlite", mode: "sql"},
+    {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
+    {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
+    {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
+    {name: "sTeX", mime: "text/x-stex", mode: "stex"},
+    {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]},
+    {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
+    {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
+    {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
+    {name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
+    {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
+    {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
+    {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
+    {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
+    {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]},
+    {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]},
+    {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
+    {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
+    {name: "TypeScript-JSX", mime: "text/typescript-jsx", mode: "jsx", ext: ["tsx"], alias: ["tsx"]},
+    {name: "Twig", mime: "text/x-twig", mode: "twig"},
+    {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]},
+    {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
+    {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]},
+    {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
+    {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]},
+    {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]},
+    {name: "Vue.js Component", mimes: ["script/x-vue", "text/x-vue"], mode: "vue", ext: ["vue"]},
+    {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd", "svg"], alias: ["rss", "wsdl", "xsd"]},
+    {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
+    {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]},
+    {name: "YAML", mimes: ["text/x-yaml", "text/yaml"], mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]},
+    {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
+    {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
+    {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
+    {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]},
+    {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]},
+  ];
+  // Ensure all modes have a mime property for backwards compatibility
+  for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+    var info = CodeMirror.modeInfo[i];
+    if (info.mimes) info.mime = info.mimes[0];
+  }
+
+  CodeMirror.findModeByMIME = function(mime) {
+    mime = mime.toLowerCase();
+    for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+      var info = CodeMirror.modeInfo[i];
+      if (info.mime == mime) return info;
+      if (info.mimes) for (var j = 0; j < info.mimes.length; j++)
+        if (info.mimes[j] == mime) return info;
+    }
+    if (/\+xml$/.test(mime)) return CodeMirror.findModeByMIME("application/xml")
+    if (/\+json$/.test(mime)) return CodeMirror.findModeByMIME("application/json")
+  };
+
+  CodeMirror.findModeByExtension = function(ext) {
+    ext = ext.toLowerCase();
+    for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+      var info = CodeMirror.modeInfo[i];
+      if (info.ext) for (var j = 0; j < info.ext.length; j++)
+        if (info.ext[j] == ext) return info;
+    }
+  };
+
+  CodeMirror.findModeByFileName = function(filename) {
+    for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+      var info = CodeMirror.modeInfo[i];
+      if (info.file && info.file.test(filename)) return info;
+    }
+    var dot = filename.lastIndexOf(".");
+    var ext = dot > -1 && filename.substring(dot + 1, filename.length);
+    if (ext) return CodeMirror.findModeByExtension(ext);
+  };
+
+  CodeMirror.findModeByName = function(name) {
+    name = name.toLowerCase();
+    for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
+      var info = CodeMirror.modeInfo[i];
+      if (info.name.toLowerCase() == name) return info;
+      if (info.alias) for (var j = 0; j < info.alias.length; j++)
+        if (info.alias[j].toLowerCase() == name) return info;
+    }
+  };
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mirc/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,161 @@
+<!doctype html>
+
+<title>CodeMirror: mIRC mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/twilight.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="mirc.js"></script>
+<style>.CodeMirror {border: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">mIRC</a>
+  </ul>
+</div>
+
+<article>
+<h2>mIRC mode</h2>
+<form><textarea id="code" name="code">
+;AKA Nick Tracker by Ford_Lawnmower irc.GeekShed.net #Script-Help
+;*****************************************************************************;
+;**Start Setup
+;Change JoinDisplay, below, for On Join AKA Display. On = 1 - Off = 0
+alias -l JoinDisplay { return 1 }
+;Change MaxNicks, below, to the number of nicknames you want to store for each hostmask. I wouldn't go over 400 with this ;/
+alias -l MaxNicks { return 20 }
+;Change AKALogo, below, To the text you want displayed before each AKA result.
+alias -l AKALogo { return 06 05A06K07A 06 }
+;**End Setup
+;*****************************************************************************;
+On *:Join:#: {
+  if ($nick == $me) { .timer 1 1 ialupdateCheck $chan }
+  NickNamesAdd $nick $+($network,$wildsite)
+  if ($JoinDisplay) { .timerNickNames $+ $nick 1 2 NickNames.display $nick $chan $network $wildsite }
+}
+on *:Nick: { NickNamesAdd $newnick $+($network,$wildsite) $nick }
+alias -l NickNames.display {
+  if ($gettok($hget(NickNames,$+($3,$4)),0,126) > 1) {
+    echo -g $2 $AKALogo $+(09,$1) $AKALogo 07 $mid($replace($hget(NickNames,$+($3,$4)),$chr(126),$chr(44)),2,-1)
+  }
+}
+alias -l NickNamesAdd {
+  if ($hget(NickNames,$2)) {
+    if (!$regex($hget(NickNames,$2),/~\Q $+ $replacecs($1,\E,\E\\E\Q) $+ \E~/i)) {
+      if ($gettok($hget(NickNames,$2),0,126) <= $MaxNicks) {
+        hadd NickNames $2 $+($hget(NickNames,$2),$1,~)
+      }
+      else {
+        hadd NickNames $2 $+($mid($hget(NickNames,$2),$pos($hget(NickNames,$2),~,2)),$1,~)
+      }
+    }
+  }
+  else {
+    hadd -m NickNames $2 $+(~,$1,~,$iif($3,$+($3,~)))
+  }
+}
+alias -l Fix.All.MindUser {
+  var %Fix.Count = $hfind(NickNames,/[^~]+[0-9]{4}~/,0,r).data
+  while (%Fix.Count) {
+    if ($Fix.MindUser($hget(NickNames,$hfind(NickNames,/[^~]+[0-9]{4}~/,%Fix.Count,r).data))) {
+      echo -ag Record %Fix.Count - $v1 - Was Cleaned
+      hadd NickNames $hfind(NickNames,/[^~]+[0-9]{4}~/,%Fix.Count,r).data $v1
+    }
+    dec %Fix.Count
+  }
+}
+alias -l Fix.MindUser { return $regsubex($1,/[^~]+[0-9]{4}~/g,$null) }
+menu nicklist,query {
+  -
+  .AKA
+  ..Check $$1: {
+    if ($gettok($hget(NickNames,$+($network,$address($1,2))),0,126) > 1) {
+      NickNames.display $1 $active $network $address($1,2)
+    }
+    else { echo -ag $AKALogo $+(09,$1) 07has not been known by any other nicknames while I have been watching. }
+  }
+  ..Cleanup $$1:hadd NickNames $+($network,$address($1,2)) $fix.minduser($hget(NickNames,$+($network,$address($1,2))))
+  ..Clear $$1:hadd NickNames $+($network,$address($1,2)) $+(~,$1,~)
+  ..AKA Search Dialog:dialog $iif($dialog(AKA_Search),-v,-m) AKA_Search AKA_Search
+  -
+}
+menu status,channel {
+  -
+  .AKA
+  ..AKA Search Dialog:dialog $iif($dialog(AKA_Search),-v,-m) AKA_Search AKA_Search
+  ..Clean All Records:Fix.All.Minduser
+  -
+}
+dialog AKA_Search {
+  title "AKA Search Engine"
+  size -1 -1 206 221
+  option dbu
+  edit "", 1, 8 5 149 10, autohs
+  button "Search", 2, 163 4 32 12
+  radio "Search HostMask", 4, 61 22 55 10
+  radio "Search Nicknames", 5, 123 22 56 10
+  list 6, 8 38 190 169, sort extsel vsbar
+  button "Check Selected", 7, 67 206 40 12
+  button "Close", 8, 160 206 38 12, cancel
+  box "Search Type", 3, 11 17 183 18
+  button "Copy to Clipboard", 9, 111 206 46 12
+}
+On *:Dialog:Aka_Search:init:*: { did -c $dname 5 }
+On *:Dialog:Aka_Search:Sclick:2,7,9: {
+  if ($did == 2) && ($did($dname,1)) {
+    did -r $dname 6
+    var %search $+(*,$v1,*), %type $iif($did($dname,5).state,data,item), %matches = $hfind(NickNames,%search,0,w). [ $+ [ %type ] ]
+    while (%matches) {
+      did -a $dname 6 $hfind(NickNames,%search,%matches,w). [ $+ [ %type ] ]
+      dec %matches
+    }
+    did -c $dname 6 1
+  }
+  elseif ($did == 7) && ($did($dname,6).seltext) { echo -ga $AKALogo 07 $mid($replace($hget(NickNames,$v1),$chr(126),$chr(44)),2,-1) }
+  elseif ($did == 9) && ($did($dname,6).seltext) { clipboard $mid($v1,$pos($v1,*,1)) }
+}
+On *:Start:{
+  if (!$hget(NickNames)) { hmake NickNames 10 }
+  if ($isfile(NickNames.hsh)) { hload  NickNames NickNames.hsh }
+}
+On *:Exit: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
+On *:Disconnect: { if ($hget(NickNames)) { hsave NickNames NickNames.hsh } }
+On *:Unload: { hfree NickNames }
+alias -l ialupdateCheck {
+  inc -z $+(%,ialupdateCheck,$network) $calc($nick($1,0) / 4)
+  ;If your ial is already being updated on join .who $1 out.
+  ;If you are using /names to update ial you will still need this line.
+  .who $1
+}
+Raw 352:*: {
+  if ($($+(%,ialupdateCheck,$network),2)) haltdef
+  NickNamesAdd $6 $+($network,$address($6,2))
+}
+Raw 315:*: {
+  if ($($+(%,ialupdateCheck,$network),2)) haltdef
+}
+
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        theme: "twilight",
+        lineNumbers: true,
+        matchBrackets: true,
+        indentUnit: 4,
+        mode: "text/mirc"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/mirc</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mirc/mirc.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,193 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+//mIRC mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
+
+(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.defineMIME("text/mirc", "mirc");
+CodeMirror.defineMode("mirc", function() {
+  function parseWords(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+  var specials = parseWords("$! $$ $& $? $+ $abook $abs $active $activecid " +
+                            "$activewid $address $addtok $agent $agentname $agentstat $agentver " +
+                            "$alias $and $anick $ansi2mirc $aop $appactive $appstate $asc $asctime " +
+                            "$asin $atan $avoice $away $awaymsg $awaytime $banmask $base $bfind " +
+                            "$binoff $biton $bnick $bvar $bytes $calc $cb $cd $ceil $chan $chanmodes " +
+                            "$chantypes $chat $chr $cid $clevel $click $cmdbox $cmdline $cnick $color " +
+                            "$com $comcall $comchan $comerr $compact $compress $comval $cos $count " +
+                            "$cr $crc $creq $crlf $ctime $ctimer $ctrlenter $date $day $daylight " +
+                            "$dbuh $dbuw $dccignore $dccport $dde $ddename $debug $decode $decompress " +
+                            "$deltok $devent $dialog $did $didreg $didtok $didwm $disk $dlevel $dll " +
+                            "$dllcall $dname $dns $duration $ebeeps $editbox $emailaddr $encode $error " +
+                            "$eval $event $exist $feof $ferr $fgetc $file $filename $filtered $finddir " +
+                            "$finddirn $findfile $findfilen $findtok $fline $floor $fopen $fread $fserve " +
+                            "$fulladdress $fulldate $fullname $fullscreen $get $getdir $getdot $gettok $gmt " +
+                            "$group $halted $hash $height $hfind $hget $highlight $hnick $hotline " +
+                            "$hotlinepos $ial $ialchan $ibl $idle $iel $ifmatch $ignore $iif $iil " +
+                            "$inelipse $ini $inmidi $inpaste $inpoly $input $inrect $inroundrect " +
+                            "$insong $instok $int $inwave $ip $isalias $isbit $isdde $isdir $isfile " +
+                            "$isid $islower $istok $isupper $keychar $keyrpt $keyval $knick $lactive " +
+                            "$lactivecid $lactivewid $left $len $level $lf $line $lines $link $lock " +
+                            "$lock $locked $log $logstamp $logstampfmt $longfn $longip $lower $ltimer " +
+                            "$maddress $mask $matchkey $matchtok $md5 $me $menu $menubar $menucontext " +
+                            "$menutype $mid $middir $mircdir $mircexe $mircini $mklogfn $mnick $mode " +
+                            "$modefirst $modelast $modespl $mouse $msfile $network $newnick $nick $nofile " +
+                            "$nopath $noqt $not $notags $notify $null $numeric $numok $oline $onpoly " +
+                            "$opnick $or $ord $os $passivedcc $pic $play $pnick $port $portable $portfree " +
+                            "$pos $prefix $prop $protect $puttok $qt $query $rand $r $rawmsg $read $readomo " +
+                            "$readn $regex $regml $regsub $regsubex $remove $remtok $replace $replacex " +
+                            "$reptok $result $rgb $right $round $scid $scon $script $scriptdir $scriptline " +
+                            "$sdir $send $server $serverip $sfile $sha1 $shortfn $show $signal $sin " +
+                            "$site $sline $snick $snicks $snotify $sock $sockbr $sockerr $sockname " +
+                            "$sorttok $sound $sqrt $ssl $sreq $sslready $status $strip $str $stripped " +
+                            "$syle $submenu $switchbar $tan $target $ticks $time $timer $timestamp " +
+                            "$timestampfmt $timezone $tip $titlebar $toolbar $treebar $trust $ulevel " +
+                            "$ulist $upper $uptime $url $usermode $v1 $v2 $var $vcmd $vcmdstat $vcmdver " +
+                            "$version $vnick $vol $wid $width $wildsite $wildtok $window $wrap $xor");
+  var keywords = parseWords("abook ajinvite alias aline ame amsg anick aop auser autojoin avoice " +
+                            "away background ban bcopy beep bread break breplace bset btrunc bunset bwrite " +
+                            "channel clear clearall cline clipboard close cnick color comclose comopen " +
+                            "comreg continue copy creq ctcpreply ctcps dcc dccserver dde ddeserver " +
+                            "debug dec describe dialog did didtok disable disconnect dlevel dline dll " +
+                            "dns dqwindow drawcopy drawdot drawfill drawline drawpic drawrect drawreplace " +
+                            "drawrot drawsave drawscroll drawtext ebeeps echo editbox emailaddr enable " +
+                            "events exit fclose filter findtext finger firewall flash flist flood flush " +
+                            "flushini font fopen fseek fsend fserve fullname fwrite ghide gload gmove " +
+                            "gopts goto gplay gpoint gqreq groups gshow gsize gstop gtalk gunload hadd " +
+                            "halt haltdef hdec hdel help hfree hinc hload hmake hop hsave ial ialclear " +
+                            "ialmark identd if ignore iline inc invite iuser join kick linesep links list " +
+                            "load loadbuf localinfo log mdi me menubar mkdir mnick mode msg nick noop notice " +
+                            "notify omsg onotice part partall pdcc perform play playctrl pop protect pvoice " +
+                            "qme qmsg query queryn quit raw reload remini remote remove rename renwin " +
+                            "reseterror resetidle return rlevel rline rmdir run ruser save savebuf saveini " +
+                            "say scid scon server set showmirc signam sline sockaccept sockclose socklist " +
+                            "socklisten sockmark sockopen sockpause sockread sockrename sockudp sockwrite " +
+                            "sound speak splay sreq strip switchbar timer timestamp titlebar tnick tokenize " +
+                            "toolbar topic tray treebar ulist unload unset unsetall updatenl url uwho " +
+                            "var vcadd vcmd vcrem vol while whois window winhelp write writeint if isalnum " +
+                            "isalpha isaop isavoice isban ischan ishop isignore isin isincs isletter islower " +
+                            "isnotify isnum ison isop isprotect isreg isupper isvoice iswm iswmcs " +
+                            "elseif else goto menu nicklist status title icon size option text edit " +
+                            "button check radio box scroll list combo link tab item");
+  var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");
+  var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+  function tokenBase(stream, state) {
+    var beforeParams = state.beforeParams;
+    state.beforeParams = false;
+    var ch = stream.next();
+    if (/[\[\]{}\(\),\.]/.test(ch)) {
+      if (ch == "(" && beforeParams) state.inParams = true;
+      else if (ch == ")") state.inParams = false;
+      return null;
+    }
+    else if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      return "number";
+    }
+    else if (ch == "\\") {
+      stream.eat("\\");
+      stream.eat(/./);
+      return "number";
+    }
+    else if (ch == "/" && stream.eat("*")) {
+      return chain(stream, state, tokenComment);
+    }
+    else if (ch == ";" && stream.match(/ *\( *\(/)) {
+      return chain(stream, state, tokenUnparsed);
+    }
+    else if (ch == ";" && !state.inParams) {
+      stream.skipToEnd();
+      return "comment";
+    }
+    else if (ch == '"') {
+      stream.eat(/"/);
+      return "keyword";
+    }
+    else if (ch == "$") {
+      stream.eatWhile(/[$_a-z0-9A-Z\.:]/);
+      if (specials && specials.propertyIsEnumerable(stream.current().toLowerCase())) {
+        return "keyword";
+      }
+      else {
+        state.beforeParams = true;
+        return "builtin";
+      }
+    }
+    else if (ch == "%") {
+      stream.eatWhile(/[^,\s()]/);
+      state.beforeParams = true;
+      return "string";
+    }
+    else if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    else {
+      stream.eatWhile(/[\w\$_{}]/);
+      var word = stream.current().toLowerCase();
+      if (keywords && keywords.propertyIsEnumerable(word))
+        return "keyword";
+      if (functions && functions.propertyIsEnumerable(word)) {
+        state.beforeParams = true;
+        return "keyword";
+      }
+      return null;
+    }
+  }
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+  function tokenUnparsed(stream, state) {
+    var maybeEnd = 0, ch;
+    while (ch = stream.next()) {
+      if (ch == ";" && maybeEnd == 2) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      if (ch == ")")
+        maybeEnd++;
+      else if (ch != " ")
+        maybeEnd = 0;
+    }
+    return "meta";
+  }
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase,
+        beforeParams: false,
+        inParams: false
+      };
+    },
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      return state.tokenize(stream, state);
+    }
+  };
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mllike/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,198 @@
+<!doctype html>
+
+<title>CodeMirror: ML-like mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src=../../addon/edit/matchbrackets.js></script>
+<script src=mllike.js></script>
+<style type=text/css>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">ML-like</a>
+  </ul>
+</div>
+
+<article>
+<h2>OCaml mode</h2>
+
+
+<textarea id="ocamlCode">
+(* Summing a list of integers *)
+let rec sum xs =
+  match xs with
+    | []       -&gt; 0
+    | x :: xs' -&gt; x + sum xs'
+
+(* Quicksort *)
+let rec qsort = function
+   | [] -&gt; []
+   | pivot :: rest -&gt;
+       let is_less x = x &lt; pivot in
+       let left, right = List.partition is_less rest in
+       qsort left @ [pivot] @ qsort right
+
+(* Fibonacci Sequence *)
+let rec fib_aux n a b =
+  match n with
+  | 0 -&gt; a
+  | _ -&gt; fib_aux (n - 1) (a + b) a
+let fib n = fib_aux n 0 1
+
+(* Birthday paradox *)
+let year_size = 365.
+
+let rec birthday_paradox prob people =
+    let prob' = (year_size -. float people) /. year_size *. prob  in
+    if prob' &lt; 0.5 then
+        Printf.printf "answer = %d\n" (people+1)
+    else
+        birthday_paradox prob' (people+1) ;;
+
+birthday_paradox 1.0 1
+
+(* Church numerals *)
+let zero f x = x
+let succ n f x = f (n f x)
+let one = succ zero
+let two = succ (succ zero)
+let add n1 n2 f x = n1 f (n2 f x)
+let to_string n = n (fun k -&gt; "S" ^ k) "0"
+let _ = to_string (add (succ two) two)
+
+(* Elementary functions *)
+let square x = x * x;;
+let rec fact x =
+  if x &lt;= 1 then 1 else x * fact (x - 1);;
+
+(* Automatic memory management *)
+let l = 1 :: 2 :: 3 :: [];;
+[1; 2; 3];;
+5 :: l;;
+
+(* Polymorphism: sorting lists *)
+let rec sort = function
+  | [] -&gt; []
+  | x :: l -&gt; insert x (sort l)
+
+and insert elem = function
+  | [] -&gt; [elem]
+  | x :: l -&gt;
+      if elem &lt; x then elem :: x :: l else x :: insert elem l;;
+
+(* Imperative features *)
+let add_polynom p1 p2 =
+  let n1 = Array.length p1
+  and n2 = Array.length p2 in
+  let result = Array.create (max n1 n2) 0 in
+  for i = 0 to n1 - 1 do result.(i) &lt;- p1.(i) done;
+  for i = 0 to n2 - 1 do result.(i) &lt;- result.(i) + p2.(i) done;
+  result;;
+add_polynom [| 1; 2 |] [| 1; 2; 3 |];;
+
+(* We may redefine fact using a reference cell and a for loop *)
+let fact n =
+  let result = ref 1 in
+  for i = 2 to n do
+    result := i * !result
+   done;
+   !result;;
+fact 5;;
+
+(* Triangle (graphics) *)
+let () =
+  ignore( Glut.init Sys.argv );
+  Glut.initDisplayMode ~double_buffer:true ();
+  ignore (Glut.createWindow ~title:"OpenGL Demo");
+  let angle t = 10. *. t *. t in
+  let render () =
+    GlClear.clear [ `color ];
+    GlMat.load_identity ();
+    GlMat.rotate ~angle: (angle (Sys.time ())) ~z:1. ();
+    GlDraw.begins `triangles;
+    List.iter GlDraw.vertex2 [-1., -1.; 0., 1.; 1., -1.];
+    GlDraw.ends ();
+    Glut.swapBuffers () in
+  GlMat.mode `modelview;
+  Glut.displayFunc ~cb:render;
+  Glut.idleFunc ~cb:(Some Glut.postRedisplay);
+  Glut.mainLoop ()
+
+(* A Hundred Lines of Caml - http://caml.inria.fr/about/taste.en.html *)
+(* OCaml page on Wikipedia - http://en.wikipedia.org/wiki/OCaml *)
+
+module type S = sig type t end
+
+let x = {| 
+  this is a long string 
+  with many lines and stuff
+  |}
+
+let b = 0b00110
+let h = 0x123abcd
+let e = 1e-10
+let i = 1.
+let x = 30_000
+let o = 0o1234
+
+[1; 2; 3] (* lists *)
+
+1 @ 2
+1. +. 2.
+</textarea>
+
+<h2>F# mode</h2>
+<textarea id="fsharpCode">
+module CodeMirror.FSharp
+
+let rec fib = function
+    | 0 -> 0
+    | 1 -> 1
+    | n -> fib (n - 1) + fib (n - 2)
+
+type Point =
+    {
+        x : int
+        y : int
+    }
+
+type Color =
+    | Red
+    | Green
+    | Blue
+
+[0 .. 10]
+|> List.map ((+) 2)
+|> List.fold (fun x y -> x + y) 0
+|> printf "%i"
+</textarea>
+
+
+<script>
+  var ocamlEditor = CodeMirror.fromTextArea(document.getElementById('ocamlCode'), {
+    mode: 'text/x-ocaml',
+    lineNumbers: true,
+    matchBrackets: true
+  });
+
+  var fsharpEditor = CodeMirror.fromTextArea(document.getElementById('fsharpCode'), {
+    mode: 'text/x-fsharp',
+    lineNumbers: true,
+    matchBrackets: true
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-ocaml</code> (OCaml) and <code>text/x-fsharp</code> (F#).</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mllike/mllike.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,359 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode('mllike', function(_config, parserConfig) {
+  var words = {
+    'as': 'keyword',
+    'do': 'keyword',
+    'else': 'keyword',
+    'end': 'keyword',
+    'exception': 'keyword',
+    'fun': 'keyword',
+    'functor': 'keyword',
+    'if': 'keyword',
+    'in': 'keyword',
+    'include': 'keyword',
+    'let': 'keyword',
+    'of': 'keyword',
+    'open': 'keyword',
+    'rec': 'keyword',
+    'struct': 'keyword',
+    'then': 'keyword',
+    'type': 'keyword',
+    'val': 'keyword',
+    'while': 'keyword',
+    'with': 'keyword'
+  };
+
+  var extraWords = parserConfig.extraWords || {};
+  for (var prop in extraWords) {
+    if (extraWords.hasOwnProperty(prop)) {
+      words[prop] = parserConfig.extraWords[prop];
+    }
+  }
+  var hintWords = [];
+  for (var k in words) { hintWords.push(k); }
+  CodeMirror.registerHelper("hintWords", "mllike", hintWords);
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+
+    if (ch === '"') {
+      state.tokenize = tokenString;
+      return state.tokenize(stream, state);
+    }
+    if (ch === '{') {
+      if (stream.eat('|')) {
+        state.longString = true;
+        state.tokenize = tokenLongString;
+        return state.tokenize(stream, state);
+      }
+    }
+    if (ch === '(') {
+      if (stream.match(/^\*(?!\))/)) {
+        state.commentLevel++;
+        state.tokenize = tokenComment;
+        return state.tokenize(stream, state);
+      }
+    }
+    if (ch === '~' || ch === '?') {
+      stream.eatWhile(/\w/);
+      return 'variable-2';
+    }
+    if (ch === '`') {
+      stream.eatWhile(/\w/);
+      return 'quote';
+    }
+    if (ch === '/' && parserConfig.slashComments && stream.eat('/')) {
+      stream.skipToEnd();
+      return 'comment';
+    }
+    if (/\d/.test(ch)) {
+      if (ch === '0' && stream.eat(/[bB]/)) {
+        stream.eatWhile(/[01]/);
+      } if (ch === '0' && stream.eat(/[xX]/)) {
+        stream.eatWhile(/[0-9a-fA-F]/)
+      } if (ch === '0' && stream.eat(/[oO]/)) {
+        stream.eatWhile(/[0-7]/);
+      } else {
+        stream.eatWhile(/[\d_]/);
+        if (stream.eat('.')) {
+          stream.eatWhile(/[\d]/);
+        }
+        if (stream.eat(/[eE]/)) {
+          stream.eatWhile(/[\d\-+]/);
+        }
+      }
+      return 'number';
+    }
+    if ( /[+\-*&%=<>!?|@\.~:]/.test(ch)) {
+      return 'operator';
+    }
+    if (/[\w\xa1-\uffff]/.test(ch)) {
+      stream.eatWhile(/[\w\xa1-\uffff]/);
+      var cur = stream.current();
+      return words.hasOwnProperty(cur) ? words[cur] : 'variable';
+    }
+    return null
+  }
+
+  function tokenString(stream, state) {
+    var next, end = false, escaped = false;
+    while ((next = stream.next()) != null) {
+      if (next === '"' && !escaped) {
+        end = true;
+        break;
+      }
+      escaped = !escaped && next === '\\';
+    }
+    if (end && !escaped) {
+      state.tokenize = tokenBase;
+    }
+    return 'string';
+  };
+
+  function tokenComment(stream, state) {
+    var prev, next;
+    while(state.commentLevel > 0 && (next = stream.next()) != null) {
+      if (prev === '(' && next === '*') state.commentLevel++;
+      if (prev === '*' && next === ')') state.commentLevel--;
+      prev = next;
+    }
+    if (state.commentLevel <= 0) {
+      state.tokenize = tokenBase;
+    }
+    return 'comment';
+  }
+
+  function tokenLongString(stream, state) {
+    var prev, next;
+    while (state.longString && (next = stream.next()) != null) {
+      if (prev === '|' && next === '}') state.longString = false;
+      prev = next;
+    }
+    if (!state.longString) {
+      state.tokenize = tokenBase;
+    }
+    return 'string';
+  }
+
+  return {
+    startState: function() {return {tokenize: tokenBase, commentLevel: 0, longString: false};},
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      return state.tokenize(stream, state);
+    },
+
+    blockCommentStart: "(*",
+    blockCommentEnd: "*)",
+    lineComment: parserConfig.slashComments ? "//" : null
+  };
+});
+
+CodeMirror.defineMIME('text/x-ocaml', {
+  name: 'mllike',
+  extraWords: {
+    'and': 'keyword',
+    'assert': 'keyword',
+    'begin': 'keyword',
+    'class': 'keyword',
+    'constraint': 'keyword',
+    'done': 'keyword',
+    'downto': 'keyword',
+    'external': 'keyword',
+    'function': 'keyword',
+    'initializer': 'keyword',
+    'lazy': 'keyword',
+    'match': 'keyword',
+    'method': 'keyword',
+    'module': 'keyword',
+    'mutable': 'keyword',
+    'new': 'keyword',
+    'nonrec': 'keyword',
+    'object': 'keyword',
+    'private': 'keyword',
+    'sig': 'keyword',
+    'to': 'keyword',
+    'try': 'keyword',
+    'value': 'keyword',
+    'virtual': 'keyword',
+    'when': 'keyword',
+
+    // builtins
+    'raise': 'builtin',
+    'failwith': 'builtin',
+    'true': 'builtin',
+    'false': 'builtin',
+
+    // Pervasives builtins
+    'asr': 'builtin',
+    'land': 'builtin',
+    'lor': 'builtin',
+    'lsl': 'builtin',
+    'lsr': 'builtin',
+    'lxor': 'builtin',
+    'mod': 'builtin',
+    'or': 'builtin',
+
+    // More Pervasives
+    'raise_notrace': 'builtin',
+    'trace': 'builtin',
+    'exit': 'builtin',
+    'print_string': 'builtin',
+    'print_endline': 'builtin',
+
+     'int': 'type',
+     'float': 'type',
+     'bool': 'type',
+     'char': 'type',
+     'string': 'type',
+     'unit': 'type',
+
+     // Modules
+     'List': 'builtin'
+  }
+});
+
+CodeMirror.defineMIME('text/x-fsharp', {
+  name: 'mllike',
+  extraWords: {
+    'abstract': 'keyword',
+    'assert': 'keyword',
+    'base': 'keyword',
+    'begin': 'keyword',
+    'class': 'keyword',
+    'default': 'keyword',
+    'delegate': 'keyword',
+    'do!': 'keyword',
+    'done': 'keyword',
+    'downcast': 'keyword',
+    'downto': 'keyword',
+    'elif': 'keyword',
+    'extern': 'keyword',
+    'finally': 'keyword',
+    'for': 'keyword',
+    'function': 'keyword',
+    'global': 'keyword',
+    'inherit': 'keyword',
+    'inline': 'keyword',
+    'interface': 'keyword',
+    'internal': 'keyword',
+    'lazy': 'keyword',
+    'let!': 'keyword',
+    'match': 'keyword',
+    'member': 'keyword',
+    'module': 'keyword',
+    'mutable': 'keyword',
+    'namespace': 'keyword',
+    'new': 'keyword',
+    'null': 'keyword',
+    'override': 'keyword',
+    'private': 'keyword',
+    'public': 'keyword',
+    'return!': 'keyword',
+    'return': 'keyword',
+    'select': 'keyword',
+    'static': 'keyword',
+    'to': 'keyword',
+    'try': 'keyword',
+    'upcast': 'keyword',
+    'use!': 'keyword',
+    'use': 'keyword',
+    'void': 'keyword',
+    'when': 'keyword',
+    'yield!': 'keyword',
+    'yield': 'keyword',
+
+    // Reserved words
+    'atomic': 'keyword',
+    'break': 'keyword',
+    'checked': 'keyword',
+    'component': 'keyword',
+    'const': 'keyword',
+    'constraint': 'keyword',
+    'constructor': 'keyword',
+    'continue': 'keyword',
+    'eager': 'keyword',
+    'event': 'keyword',
+    'external': 'keyword',
+    'fixed': 'keyword',
+    'method': 'keyword',
+    'mixin': 'keyword',
+    'object': 'keyword',
+    'parallel': 'keyword',
+    'process': 'keyword',
+    'protected': 'keyword',
+    'pure': 'keyword',
+    'sealed': 'keyword',
+    'tailcall': 'keyword',
+    'trait': 'keyword',
+    'virtual': 'keyword',
+    'volatile': 'keyword',
+
+    // builtins
+    'List': 'builtin',
+    'Seq': 'builtin',
+    'Map': 'builtin',
+    'Set': 'builtin',
+    'Option': 'builtin',
+    'int': 'builtin',
+    'string': 'builtin',
+    'not': 'builtin',
+    'true': 'builtin',
+    'false': 'builtin',
+
+    'raise': 'builtin',
+    'failwith': 'builtin'
+  },
+  slashComments: true
+});
+
+
+CodeMirror.defineMIME('text/x-sml', {
+  name: 'mllike',
+  extraWords: {
+    'abstype': 'keyword',
+    'and': 'keyword',
+    'andalso': 'keyword',
+    'case': 'keyword',
+    'datatype': 'keyword',
+    'fn': 'keyword',
+    'handle': 'keyword',
+    'infix': 'keyword',
+    'infixr': 'keyword',
+    'local': 'keyword',
+    'nonfix': 'keyword',
+    'op': 'keyword',
+    'orelse': 'keyword',
+    'raise': 'keyword',
+    'withtype': 'keyword',
+    'eqtype': 'keyword',
+    'sharing': 'keyword',
+    'sig': 'keyword',
+    'signature': 'keyword',
+    'structure': 'keyword',
+    'where': 'keyword',
+    'true': 'keyword',
+    'false': 'keyword',
+
+    // types
+    'int': 'builtin',
+    'real': 'builtin',
+    'string': 'builtin',
+    'char': 'builtin',
+    'bool': 'builtin'
+  },
+  slashComments: true
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/modelica/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,67 @@
+<!doctype html>
+
+<title>CodeMirror: Modelica mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<link rel="stylesheet" href="../../addon/hint/show-hint.css">
+<script src="../../addon/hint/show-hint.js"></script>
+<script src="modelica.js"></script>
+<style>.CodeMirror {border: 2px inset #dee;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Modelica</a>
+  </ul>
+</div>
+
+<article>
+<h2>Modelica mode</h2>
+
+<div><textarea id="modelica">
+model BouncingBall
+  parameter Real e = 0.7;
+  parameter Real g = 9.81;
+  Real h(start=1);
+  Real v;
+  Boolean flying(start=true);
+  Boolean impact;
+  Real v_new;
+equation
+  impact = h <= 0.0;
+  der(v) = if flying then -g else 0;
+  der(h) = v;
+  when {h <= 0.0 and v <= 0.0, impact} then
+    v_new = if edge(impact) then -e*pre(v) else 0;
+    flying = v_new > 0;
+    reinit(v, v_new);
+  end when;
+  annotation (uses(Modelica(version="3.2")));
+end BouncingBall;
+</textarea></div>
+
+    <script>
+      var modelicaEditor = CodeMirror.fromTextArea(document.getElementById("modelica"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-modelica"
+      });
+      var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+      CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+    </script>
+
+    <p>Simple mode that tries to handle Modelica as well as it can.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-modelica</code>
+    (Modlica code).</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/modelica/modelica.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,245 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Modelica support for CodeMirror, copyright (c) by Lennart Ochel
+
+(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.defineMode("modelica", function(config, parserConfig) {
+
+    var indentUnit = config.indentUnit;
+    var keywords = parserConfig.keywords || {};
+    var builtin = parserConfig.builtin || {};
+    var atoms = parserConfig.atoms || {};
+
+    var isSingleOperatorChar = /[;=\(:\),{}.*<>+\-\/^\[\]]/;
+    var isDoubleOperatorChar = /(:=|<=|>=|==|<>|\.\+|\.\-|\.\*|\.\/|\.\^)/;
+    var isDigit = /[0-9]/;
+    var isNonDigit = /[_a-zA-Z]/;
+
+    function tokenLineComment(stream, state) {
+      stream.skipToEnd();
+      state.tokenize = null;
+      return "comment";
+    }
+
+    function tokenBlockComment(stream, state) {
+      var maybeEnd = false, ch;
+      while (ch = stream.next()) {
+        if (maybeEnd && ch == "/") {
+          state.tokenize = null;
+          break;
+        }
+        maybeEnd = (ch == "*");
+      }
+      return "comment";
+    }
+
+    function tokenString(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == '"' && !escaped) {
+          state.tokenize = null;
+          state.sol = false;
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+
+      return "string";
+    }
+
+    function tokenIdent(stream, state) {
+      stream.eatWhile(isDigit);
+      while (stream.eat(isDigit) || stream.eat(isNonDigit)) { }
+
+
+      var cur = stream.current();
+
+      if(state.sol && (cur == "package" || cur == "model" || cur == "when" || cur == "connector")) state.level++;
+      else if(state.sol && cur == "end" && state.level > 0) state.level--;
+
+      state.tokenize = null;
+      state.sol = false;
+
+      if (keywords.propertyIsEnumerable(cur)) return "keyword";
+      else if (builtin.propertyIsEnumerable(cur)) return "builtin";
+      else if (atoms.propertyIsEnumerable(cur)) return "atom";
+      else return "variable";
+    }
+
+    function tokenQIdent(stream, state) {
+      while (stream.eat(/[^']/)) { }
+
+      state.tokenize = null;
+      state.sol = false;
+
+      if(stream.eat("'"))
+        return "variable";
+      else
+        return "error";
+    }
+
+    function tokenUnsignedNumber(stream, state) {
+      stream.eatWhile(isDigit);
+      if (stream.eat('.')) {
+        stream.eatWhile(isDigit);
+      }
+      if (stream.eat('e') || stream.eat('E')) {
+        if (!stream.eat('-'))
+          stream.eat('+');
+        stream.eatWhile(isDigit);
+      }
+
+      state.tokenize = null;
+      state.sol = false;
+      return "number";
+    }
+
+    // Interface
+    return {
+      startState: function() {
+        return {
+          tokenize: null,
+          level: 0,
+          sol: true
+        };
+      },
+
+      token: function(stream, state) {
+        if(state.tokenize != null) {
+          return state.tokenize(stream, state);
+        }
+
+        if(stream.sol()) {
+          state.sol = true;
+        }
+
+        // WHITESPACE
+        if(stream.eatSpace()) {
+          state.tokenize = null;
+          return null;
+        }
+
+        var ch = stream.next();
+
+        // LINECOMMENT
+        if(ch == '/' && stream.eat('/')) {
+          state.tokenize = tokenLineComment;
+        }
+        // BLOCKCOMMENT
+        else if(ch == '/' && stream.eat('*')) {
+          state.tokenize = tokenBlockComment;
+        }
+        // TWO SYMBOL TOKENS
+        else if(isDoubleOperatorChar.test(ch+stream.peek())) {
+          stream.next();
+          state.tokenize = null;
+          return "operator";
+        }
+        // SINGLE SYMBOL TOKENS
+        else if(isSingleOperatorChar.test(ch)) {
+          state.tokenize = null;
+          return "operator";
+        }
+        // IDENT
+        else if(isNonDigit.test(ch)) {
+          state.tokenize = tokenIdent;
+        }
+        // Q-IDENT
+        else if(ch == "'" && stream.peek() && stream.peek() != "'") {
+          state.tokenize = tokenQIdent;
+        }
+        // STRING
+        else if(ch == '"') {
+          state.tokenize = tokenString;
+        }
+        // UNSIGNED_NUMBER
+        else if(isDigit.test(ch)) {
+          state.tokenize = tokenUnsignedNumber;
+        }
+        // ERROR
+        else {
+          state.tokenize = null;
+          return "error";
+        }
+
+        return state.tokenize(stream, state);
+      },
+
+      indent: function(state, textAfter) {
+        if (state.tokenize != null) return CodeMirror.Pass;
+
+        var level = state.level;
+        if(/(algorithm)/.test(textAfter)) level--;
+        if(/(equation)/.test(textAfter)) level--;
+        if(/(initial algorithm)/.test(textAfter)) level--;
+        if(/(initial equation)/.test(textAfter)) level--;
+        if(/(end)/.test(textAfter)) level--;
+
+        if(level > 0)
+          return indentUnit*level;
+        else
+          return 0;
+      },
+
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/",
+      lineComment: "//"
+    };
+  });
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i=0; i<words.length; ++i)
+      obj[words[i]] = true;
+    return obj;
+  }
+
+  var modelicaKeywords = "algorithm and annotation assert block break class connect connector constant constrainedby der discrete each else elseif elsewhen encapsulated end enumeration equation expandable extends external false final flow for function if import impure in initial inner input loop model not operator or outer output package parameter partial protected public pure record redeclare replaceable return stream then true type when while within";
+  var modelicaBuiltin = "abs acos actualStream asin atan atan2 cardinality ceil cos cosh delay div edge exp floor getInstanceName homotopy inStream integer log log10 mod pre reinit rem semiLinear sign sin sinh spatialDistribution sqrt tan tanh";
+  var modelicaAtoms = "Real Boolean Integer String";
+
+  function def(mimes, mode) {
+    if (typeof mimes == "string")
+      mimes = [mimes];
+
+    var words = [];
+
+    function add(obj) {
+      if (obj)
+        for (var prop in obj)
+          if (obj.hasOwnProperty(prop))
+            words.push(prop);
+    }
+
+    add(mode.keywords);
+    add(mode.builtin);
+    add(mode.atoms);
+
+    if (words.length) {
+      mode.helperType = mimes[0];
+      CodeMirror.registerHelper("hintWords", mimes[0], words);
+    }
+
+    for (var i=0; i<mimes.length; ++i)
+      CodeMirror.defineMIME(mimes[i], mode);
+  }
+
+  def(["text/x-modelica"], {
+    name: "modelica",
+    keywords: words(modelicaKeywords),
+    builtin: words(modelicaBuiltin),
+    atoms: words(modelicaAtoms)
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mscgen/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,151 @@
+<!doctype html>
+
+<title>CodeMirror: MscGen mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="mscgen.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">MscGen</a>
+  </ul>
+</div>
+
+<article>
+<h2>MscGen mode</h2>
+
+<div><textarea id="mscgen-code">
+# Sample mscgen program
+# See http://www.mcternan.me.uk/mscgen or
+# https://sverweij.github.io/mscgen_js for more samples
+msc {
+  # options
+  hscale="1.2";
+
+  # entities/ lifelines
+  a [label="Entity A"],
+  b [label="Entity B", linecolor="red", arclinecolor="red", textbgcolor="pink"],
+  c [label="Entity C"];
+
+  # arcs/ messages
+  a => c [label="doSomething(args)"];
+  b => c [label="doSomething(args)"];
+  c >> * [label="everyone asked me", arcskip="1"];
+  c =>> c [label="doing something"];
+  c -x * [label="report back", arcskip="1"];
+  |||;
+  --- [label="shows's over, however ..."];
+  b => a [label="did you see c doing something?"];
+  a -> b [label="nope"];
+  b :> a [label="shall we ask again?"];
+  a => b [label="naah"];
+  ...;
+}
+</textarea></div>
+
+<h2>Xù mode</h2>
+
+<div><textarea id="xu-code">
+# Xù - expansions to MscGen to support inline expressions
+#      https://github.com/sverweij/mscgen_js/blob/master/wikum/xu.md
+# More samples: https://sverweij.github.io/mscgen_js
+xu {
+  hscale="0.8",
+  width="700";
+
+  a,
+  b [label="change store"],
+  c,
+  d [label="necro queue"],
+  e [label="natalis queue"],
+  f;
+
+  a =>> b [label="get change list()"];
+  a alt f [label="changes found"] { /* alt is a xu specific keyword*/
+    b >> a [label="list of changes"];
+    a =>> c [label="cull old stuff (list of changes)"];
+    b loop e [label="for each change"] { // loop is xu specific as well...
+      /*
+       * Interesting stuff happens.
+       */
+      c =>> b [label="get change()"];
+      b >> c [label="change"];
+      c alt e [label="change too old"] {
+        c =>> d [label="queue(change)"];
+        --- [label="change newer than latest run"];
+        c =>> e [label="queue(change)"];
+        --- [label="all other cases"];
+        ||| [label="leave well alone"];
+      };
+    };
+
+    c >> a [label="done
+    processing"];
+
+    /* shucks! nothing found ...*/
+    --- [label="nothing found"];
+    b >> a [label="nothing"];
+    a note a [label="silent exit"];
+  };
+}
+</textarea></div>
+
+<h2>MsGenny mode</h2>
+<div><textarea id="msgenny-code">
+# MsGenny - simplified version of MscGen / Xù
+#           https://github.com/sverweij/mscgen_js/blob/master/wikum/msgenny.md
+# More samples: https://sverweij.github.io/mscgen_js
+a -> b   : a -> b  (signal);
+a => b   : a => b  (method);
+b >> a   : b >> a  (return value);
+a =>> b  : a =>> b (callback);
+a -x b   : a -x b  (lost);
+a :> b   : a :> b  (emphasis);
+a .. b   : a .. b  (dotted);
+a -- b   : "a -- b straight line";
+a note a : a note a\n(note),
+b box b  : b box b\n(action);
+a rbox a : a rbox a\n(reference),
+b abox b : b abox b\n(state/ condition);
+|||      : ||| (empty row);
+...      : ... (omitted row);
+---      : --- (comment);
+</textarea></div>
+
+    <p>
+      Simple mode for highlighting MscGen and two derived sequence
+      chart languages.
+    </p>
+
+    <script>
+      var mscgenEditor = CodeMirror.fromTextArea(document.getElementById("mscgen-code"), {
+        lineNumbers: true,
+        mode: "text/x-mscgen",
+      });
+      var xuEditor = CodeMirror.fromTextArea(document.getElementById("xu-code"), {
+        lineNumbers: true,
+        mode: "text/x-xu",
+      });
+      var msgennyEditor = CodeMirror.fromTextArea(document.getElementById("msgenny-code"), {
+        lineNumbers: true,
+        mode: "text/x-msgenny",
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong>
+      <code>text/x-mscgen</code>
+      <code>text/x-xu</code>
+      <code>text/x-msgenny</code>
+    </p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mscgen/mscgen.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,175 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// mode(s) for the sequence chart dsl's mscgen, xù and msgenny
+// For more information on mscgen, see the site of the original author:
+// http://www.mcternan.me.uk/mscgen
+//
+// This mode for mscgen and the two derivative languages were
+// originally made for use in the mscgen_js interpreter
+// (https://sverweij.github.io/mscgen_js)
+
+(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";
+
+  var languages = {
+    mscgen: {
+      "keywords" : ["msc"],
+      "options" : ["hscale", "width", "arcgradient", "wordwraparcs"],
+      "constants" : ["true", "false", "on", "off"],
+      "attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip"],
+      "brackets" : ["\\{", "\\}"], // [ and  ] are brackets too, but these get handled in with lists
+      "arcsWords" : ["note", "abox", "rbox", "box"],
+      "arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
+      "singlecomment" : ["//", "#"],
+      "operators" : ["="]
+    },
+    xu: {
+      "keywords" : ["msc", "xu"],
+      "options" : ["hscale", "width", "arcgradient", "wordwraparcs", "wordwrapentities", "watermark"],
+      "constants" : ["true", "false", "on", "off", "auto"],
+      "attributes" : ["label", "idurl", "id", "url", "linecolor", "linecolour", "textcolor", "textcolour", "textbgcolor", "textbgcolour", "arclinecolor", "arclinecolour", "arctextcolor", "arctextcolour", "arctextbgcolor", "arctextbgcolour", "arcskip", "title", "deactivate", "activate", "activation"],
+      "brackets" : ["\\{", "\\}"],  // [ and  ] are brackets too, but these get handled in with lists
+      "arcsWords" : ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
+      "arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
+      "singlecomment" : ["//", "#"],
+      "operators" : ["="]
+    },
+    msgenny: {
+      "keywords" : null,
+      "options" : ["hscale", "width", "arcgradient", "wordwraparcs", "wordwrapentities", "watermark"],
+      "constants" : ["true", "false", "on", "off", "auto"],
+      "attributes" : null,
+      "brackets" : ["\\{", "\\}"],
+      "arcsWords" : ["note", "abox", "rbox", "box", "alt", "else", "opt", "break", "par", "seq", "strict", "neg", "critical", "ignore", "consider", "assert", "loop", "ref", "exc"],
+      "arcsOthers" : ["\\|\\|\\|", "\\.\\.\\.", "---", "--", "<->", "==", "<<=>>", "<=>", "\\.\\.", "<<>>", "::", "<:>", "->", "=>>", "=>", ">>", ":>", "<-", "<<=", "<=", "<<", "<:", "x-", "-x"],
+      "singlecomment" : ["//", "#"],
+      "operators" : ["="]
+    }
+  }
+
+  CodeMirror.defineMode("mscgen", function(_, modeConfig) {
+    var language = languages[modeConfig && modeConfig.language || "mscgen"]
+    return {
+      startState: startStateFn,
+      copyState: copyStateFn,
+      token: produceTokenFunction(language),
+      lineComment : "#",
+      blockCommentStart : "/*",
+      blockCommentEnd : "*/"
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-mscgen", "mscgen");
+  CodeMirror.defineMIME("text/x-xu", {name: "mscgen", language: "xu"});
+  CodeMirror.defineMIME("text/x-msgenny", {name: "mscgen", language: "msgenny"});
+
+  function wordRegexpBoundary(pWords) {
+    return new RegExp("^\\b(?:" + pWords.join("|") + ")\\b", "i");
+  }
+
+  function wordRegexp(pWords) {
+    return new RegExp("^(?:" + pWords.join("|") + ")", "i");
+  }
+
+  function startStateFn() {
+    return {
+      inComment : false,
+      inString : false,
+      inAttributeList : false,
+      inScript : false
+    };
+  }
+
+  function copyStateFn(pState) {
+    return {
+      inComment : pState.inComment,
+      inString : pState.inString,
+      inAttributeList : pState.inAttributeList,
+      inScript : pState.inScript
+    };
+  }
+
+  function produceTokenFunction(pConfig) {
+
+    return function(pStream, pState) {
+      if (pStream.match(wordRegexp(pConfig.brackets), true, true)) {
+        return "bracket";
+      }
+      /* comments */
+      if (!pState.inComment) {
+        if (pStream.match(/\/\*[^\*\/]*/, true, true)) {
+          pState.inComment = true;
+          return "comment";
+        }
+        if (pStream.match(wordRegexp(pConfig.singlecomment), true, true)) {
+          pStream.skipToEnd();
+          return "comment";
+        }
+      }
+      if (pState.inComment) {
+        if (pStream.match(/[^\*\/]*\*\//, true, true))
+          pState.inComment = false;
+        else
+          pStream.skipToEnd();
+        return "comment";
+      }
+      /* strings */
+      if (!pState.inString && pStream.match(/\"(\\\"|[^\"])*/, true, true)) {
+        pState.inString = true;
+        return "string";
+      }
+      if (pState.inString) {
+        if (pStream.match(/[^\"]*\"/, true, true))
+          pState.inString = false;
+        else
+          pStream.skipToEnd();
+        return "string";
+      }
+      /* keywords & operators */
+      if (!!pConfig.keywords && pStream.match(wordRegexpBoundary(pConfig.keywords), true, true))
+        return "keyword";
+
+      if (pStream.match(wordRegexpBoundary(pConfig.options), true, true))
+        return "keyword";
+
+      if (pStream.match(wordRegexpBoundary(pConfig.arcsWords), true, true))
+        return "keyword";
+
+      if (pStream.match(wordRegexp(pConfig.arcsOthers), true, true))
+        return "keyword";
+
+      if (!!pConfig.operators && pStream.match(wordRegexp(pConfig.operators), true, true))
+        return "operator";
+
+      if (!!pConfig.constants && pStream.match(wordRegexp(pConfig.constants), true, true))
+        return "variable";
+
+      /* attribute lists */
+      if (!pConfig.inAttributeList && !!pConfig.attributes && pStream.match('[', true, true)) {
+        pConfig.inAttributeList = true;
+        return "bracket";
+      }
+      if (pConfig.inAttributeList) {
+        if (pConfig.attributes !== null && pStream.match(wordRegexpBoundary(pConfig.attributes), true, true)) {
+          return "attribute";
+        }
+        if (pStream.match(']', true, true)) {
+          pConfig.inAttributeList = false;
+          return "bracket";
+        }
+      }
+
+      pStream.next();
+      return "base";
+    };
+  }
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mscgen/mscgen_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,84 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "mscgen");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("empty chart",
+     "[keyword msc][bracket {]",
+     "[base   ]",
+     "[bracket }]"
+   );
+
+  MT("comments",
+    "[comment // a single line comment]",
+    "[comment # another  single line comment /* and */ ignored here]",
+    "[comment /* A multi-line comment even though it contains]",
+    "[comment msc keywords and \"quoted text\"*/]");
+
+  MT("strings",
+    "[string \"// a string\"]",
+    "[string \"a string running over]",
+    "[string two lines\"]",
+    "[string \"with \\\"escaped quote\"]"
+  );
+
+  MT("xù/ msgenny keywords classify as 'base'",
+    "[base watermark]",
+    "[base wordwrapentities]",
+    "[base alt loop opt ref else break par seq assert]"
+  );
+
+  MT("xù/ msgenny constants classify as 'base'",
+    "[base auto]"
+  );
+
+  MT("mscgen constants classify as 'variable'",
+    "[variable true]", "[variable false]", "[variable on]", "[variable off]"
+  );
+
+  MT("mscgen options classify as keyword",
+    "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
+  );
+
+  MT("mscgen arcs classify as keyword",
+    "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
+    "[keyword |||...---]", "[keyword ..--==::]",
+    "[keyword ->]", "[keyword <-]", "[keyword <->]",
+    "[keyword =>]", "[keyword <=]", "[keyword <=>]",
+    "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
+    "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
+    "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
+    "[keyword :>]", "[keyword <:]", "[keyword <:>]"
+  );
+
+  MT("within an attribute list, attributes classify as attribute",
+    "[bracket [[][attribute label]",
+    "[attribute id]","[attribute url]","[attribute idurl]",
+    "[attribute linecolor]","[attribute linecolour]","[attribute textcolor]","[attribute textcolour]","[attribute textbgcolor]","[attribute textbgcolour]",
+    "[attribute arclinecolor]","[attribute arclinecolour]","[attribute arctextcolor]","[attribute arctextcolour]","[attribute arctextbgcolor]","[attribute arctextbgcolour]",
+    "[attribute arcskip][bracket ]]]"
+  );
+
+  MT("outside an attribute list, attributes classify as base",
+    "[base label]",
+    "[base id]","[base url]","[base idurl]",
+    "[base linecolor]","[base linecolour]","[base textcolor]","[base textcolour]","[base textbgcolor]","[base textbgcolour]",
+    "[base arclinecolor]","[base arclinecolour]","[base arctextcolor]","[base arctextcolour]","[base arctextbgcolor]","[base arctextbgcolour]",
+    "[base arcskip]"
+  );
+
+  MT("a typical program",
+    "[comment # typical mscgen program]",
+    "[keyword msc][base  ][bracket {]",
+    "[keyword wordwraparcs][operator =][variable true][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30;]",
+    "[base   a][bracket [[][attribute label][operator =][string \"Entity A\"][bracket ]]][base ,]",
+    "[base   b][bracket [[][attribute label][operator =][string \"Entity B\"][bracket ]]][base ,]",
+    "[base   c][bracket [[][attribute label][operator =][string \"Entity C\"][bracket ]]][base ;]",
+    "[base   a ][keyword =>>][base  b][bracket [[][attribute label][operator =][string \"Hello entity B\"][bracket ]]][base ;]",
+    "[base   a ][keyword <<][base  b][bracket [[][attribute label][operator =][string \"Here's an answer dude!\"][bracket ]]][base ;]",
+    "[base   c ][keyword :>][base  *][bracket [[][attribute label][operator =][string \"What about me?\"][base , ][attribute textcolor][operator =][base red][bracket ]]][base ;]",
+    "[bracket }]"
+  );
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mscgen/msgenny_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,77 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-msgenny");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "msgenny"); }
+
+  MT("comments",
+    "[comment // a single line comment]",
+    "[comment # another  single line comment /* and */ ignored here]",
+    "[comment /* A multi-line comment even though it contains]",
+    "[comment msc keywords and \"quoted text\"*/]");
+
+  MT("strings",
+    "[string \"// a string\"]",
+    "[string \"a string running over]",
+    "[string two lines\"]",
+    "[string \"with \\\"escaped quote\"]"
+  );
+
+  MT("xù/ msgenny keywords classify as 'keyword'",
+    "[keyword watermark]",
+    "[keyword wordwrapentities]",
+    "[keyword alt]","[keyword loop]","[keyword opt]","[keyword ref]","[keyword else]","[keyword break]","[keyword par]","[keyword seq]","[keyword assert]"
+  );
+
+  MT("xù/ msgenny constants classify as 'variable'",
+    "[variable auto]",
+    "[variable true]", "[variable false]", "[variable on]", "[variable off]"
+  );
+
+  MT("mscgen options classify as keyword",
+    "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
+  );
+
+  MT("mscgen arcs classify as keyword",
+    "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
+    "[keyword |||...---]", "[keyword ..--==::]",
+    "[keyword ->]", "[keyword <-]", "[keyword <->]",
+    "[keyword =>]", "[keyword <=]", "[keyword <=>]",
+    "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
+    "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
+    "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
+    "[keyword :>]", "[keyword <:]", "[keyword <:>]"
+  );
+
+  MT("within an attribute list, mscgen/ xù attributes classify as base",
+    "[base [[label]",
+    "[base idurl id url]",
+    "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
+    "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
+    "[base arcskip]]]"
+  );
+
+  MT("outside an attribute list, mscgen/ xù attributes classify as base",
+    "[base label]",
+    "[base idurl id url]",
+    "[base linecolor linecolour textcolor textcolour textbgcolor textbgcolour]",
+    "[base arclinecolor arclinecolour arctextcolor arctextcolour arctextbgcolor arctextbgcolour]",
+    "[base arcskip]"
+  );
+
+  MT("a typical program",
+    "[comment # typical msgenny program]",
+    "[keyword wordwraparcs][operator =][variable true][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30;]",
+    "[base   a : ][string \"Entity A\"][base ,]",
+    "[base   b : Entity B,]",
+    "[base   c : Entity C;]",
+    "[base   a ][keyword =>>][base  b: ][string \"Hello entity B\"][base ;]",
+    "[base   a ][keyword alt][base  c][bracket {]",
+    "[base     a ][keyword <<][base  b: ][string \"Here's an answer dude!\"][base ;]",
+    "[keyword ---][base : ][string \"sorry, won't march - comm glitch\"]",
+    "[base     a ][keyword x-][base  b: ][string \"Here's an answer dude! (won't arrive...)\"][base ;]",
+    "[bracket }]",
+    "[base   c ][keyword :>][base  *: What about me?;]"
+  );
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mscgen/xu_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,87 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "text/x-xu");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), "xu"); }
+
+  MT("empty chart",
+     "[keyword msc][bracket {]",
+     "[base   ]",
+     "[bracket }]"
+  );
+
+  MT("empty chart",
+     "[keyword xu][bracket {]",
+     "[base   ]",
+     "[bracket }]"
+  );
+
+  MT("comments",
+    "[comment // a single line comment]",
+    "[comment # another  single line comment /* and */ ignored here]",
+    "[comment /* A multi-line comment even though it contains]",
+    "[comment msc keywords and \"quoted text\"*/]");
+
+  MT("strings",
+    "[string \"// a string\"]",
+    "[string \"a string running over]",
+    "[string two lines\"]",
+    "[string \"with \\\"escaped quote\"]"
+  );
+
+  MT("xù/ msgenny keywords classify as 'keyword'",
+    "[keyword watermark]",
+    "[keyword alt]","[keyword loop]","[keyword opt]","[keyword ref]","[keyword else]","[keyword break]","[keyword par]","[keyword seq]","[keyword assert]"
+  );
+
+  MT("xù/ msgenny constants classify as 'variable'",
+    "[variable auto]",
+    "[variable true]", "[variable false]", "[variable on]", "[variable off]"
+  );
+
+  MT("mscgen options classify as keyword",
+    "[keyword hscale]", "[keyword width]", "[keyword arcgradient]", "[keyword wordwraparcs]"
+  );
+
+  MT("mscgen arcs classify as keyword",
+    "[keyword note]","[keyword abox]","[keyword rbox]","[keyword box]",
+    "[keyword |||...---]", "[keyword ..--==::]",
+    "[keyword ->]", "[keyword <-]", "[keyword <->]",
+    "[keyword =>]", "[keyword <=]", "[keyword <=>]",
+    "[keyword =>>]", "[keyword <<=]", "[keyword <<=>>]",
+    "[keyword >>]", "[keyword <<]", "[keyword <<>>]",
+    "[keyword -x]", "[keyword x-]", "[keyword -X]", "[keyword X-]",
+    "[keyword :>]", "[keyword <:]", "[keyword <:>]"
+  );
+
+  MT("within an attribute list, attributes classify as attribute",
+    "[bracket [[][attribute label]",
+    "[attribute id]","[attribute url]","[attribute idurl]",
+    "[attribute linecolor]","[attribute linecolour]","[attribute textcolor]","[attribute textcolour]","[attribute textbgcolor]","[attribute textbgcolour]",
+    "[attribute arclinecolor]","[attribute arclinecolour]","[attribute arctextcolor]","[attribute arctextcolour]","[attribute arctextbgcolor]","[attribute arctextbgcolour]",
+    "[attribute arcskip]","[attribute title]",
+    "[attribute activate]","[attribute deactivate]","[attribute activation][bracket ]]]"
+  );
+
+  MT("outside an attribute list, attributes classify as base",
+    "[base label]",
+    "[base id]","[base url]","[base idurl]",
+    "[base linecolor]","[base linecolour]","[base textcolor]","[base textcolour]","[base textbgcolor]","[base textbgcolour]",
+    "[base arclinecolor]","[base arclinecolour]","[base arctextcolor]","[base arctextcolour]","[base arctextbgcolor]","[base arctextbgcolour]",
+    "[base arcskip]", "[base title]"
+  );
+
+  MT("a typical program",
+    "[comment # typical xu program]",
+    "[keyword xu][base  ][bracket {]",
+    "[keyword wordwraparcs][operator =][string \"true\"][base , ][keyword hscale][operator =][string \"0.8\"][base , ][keyword arcgradient][operator =][base 30, ][keyword width][operator =][variable auto][base ;]",
+    "[base   a][bracket [[][attribute label][operator =][string \"Entity A\"][bracket ]]][base ,]",
+    "[base   b][bracket [[][attribute label][operator =][string \"Entity B\"][bracket ]]][base ,]",
+    "[base   c][bracket [[][attribute label][operator =][string \"Entity C\"][bracket ]]][base ;]",
+    "[base   a ][keyword =>>][base  b][bracket [[][attribute label][operator =][string \"Hello entity B\"][bracket ]]][base ;]",
+    "[base   a ][keyword <<][base  b][bracket [[][attribute label][operator =][string \"Here's an answer dude!\"][base , ][attribute title][operator =][string \"This is a title for this message\"][bracket ]]][base ;]",
+    "[base   c ][keyword :>][base  *][bracket [[][attribute label][operator =][string \"What about me?\"][base , ][attribute textcolor][operator =][base red][bracket ]]][base ;]",
+    "[bracket }]"
+  );
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mumps/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+<!doctype html>
+
+<title>CodeMirror: MUMPS mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="mumps.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">MUMPS</a>
+  </ul>
+</div>
+
+<article>
+<h2>MUMPS mode</h2>
+
+
+<div><textarea id="code" name="code">
+ ; Lloyd Milligan
+ ; 03-30-2015
+ ;
+ ; MUMPS support for Code Mirror - Excerpts below from routine ^XUS
+ ;
+CHECKAV(X1) ;Check A/V code return DUZ or Zero. (Called from XUSRB)
+ N %,%1,X,Y,IEN,DA,DIK
+ S IEN=0
+ ;Start CCOW
+ I $E(X1,1,7)="~~TOK~~" D  Q:IEN>0 IEN
+ . I $E(X1,8,9)="~1" S IEN=$$CHKASH^XUSRB4($E(X1,8,255))
+ . I $E(X1,8,9)="~2" S IEN=$$CHKCCOW^XUSRB4($E(X1,8,255))
+ . Q
+ ;End CCOW
+ S X1=$$UP(X1) S:X1[":" XUTT=1,X1=$TR(X1,":")
+ S X=$P(X1,";") Q:X="^" -1 S:XUF %1="Access: "_X
+ Q:X'?1.20ANP 0
+ S X=$$EN^XUSHSH(X) I '$D(^VA(200,"A",X)) D LBAV Q 0
+ S %1="",IEN=$O(^VA(200,"A",X,0)),XUF(.3)=IEN D USER(IEN)
+ S X=$P(X1,";",2) S:XUF %1="Verify: "_X S X=$$EN^XUSHSH(X)
+ I $P(XUSER(1),"^",2)'=X D LBAV Q 0
+ I $G(XUFAC(1)) S DIK="^XUSEC(4,",DA=XUFAC(1) D ^DIK
+ Q IEN
+ ;
+ ; Spell out commands
+ ;
+SET2() ;EF. Return error code (also called from XUSRB)
+ NEW %,X
+ SET XUNOW=$$HTFM^XLFDT($H),DT=$P(XUNOW,".")
+ KILL DUZ,XUSER
+ SET (DUZ,DUZ(2))=0,(DUZ(0),DUZ("AG"),XUSER(0),XUSER(1),XUTT,%UCI)=""
+ SET %=$$INHIBIT^XUSRB() IF %>0 QUIT %
+ SET X=$G(^%ZIS(1,XUDEV,"XUS")),XU1=$G(^(1))
+ IF $L(X) FOR I=1:1:15 IF $L($P(X,U,I)) SET $P(XOPT,U,I)=$P(X,U,I)
+ SET DTIME=600
+ IF '$P(XOPT,U,11),$D(^%ZIS(1,XUDEV,90)),^(90)>2800000,^(90)'>DT QUIT 8
+ QUIT 0
+ ;
+ ; Spell out commands and functions
+ ;
+ IF $PIECE(XUSER(0),U,11),$PIECE(XUSER(0),U,11)'>DT QUIT 11 ;Terminated
+ IF $DATA(DUZ("ASH")) QUIT 0 ;If auto handle, Allow to sign-on p434
+ IF $PIECE(XUSER(0),U,7) QUIT 5 ;Disuser flag set
+ IF '$LENGTH($PIECE(XUSER(1),U,2)) QUIT 21 ;p419, p434
+ Q 0
+ ;
+  </textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+         mode: "mumps",
+         lineNumbers: true,
+         lineWrapping: true
+      });
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/mumps/mumps.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,148 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+  This MUMPS Language script was constructed using vbscript.js as a template.
+*/
+
+(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.defineMode("mumps", function() {
+    function wordRegexp(words) {
+      return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
+    }
+
+    var singleOperators = new RegExp("^[\\+\\-\\*/&#!_?\\\\<>=\\'\\[\\]]");
+    var doubleOperators = new RegExp("^(('=)|(<=)|(>=)|('>)|('<)|([[)|(]])|(^$))");
+    var singleDelimiters = new RegExp("^[\\.,:]");
+    var brackets = new RegExp("[()]");
+    var identifiers = new RegExp("^[%A-Za-z][A-Za-z0-9]*");
+    var commandKeywords = ["break","close","do","else","for","goto", "halt", "hang", "if", "job","kill","lock","merge","new","open", "quit", "read", "set", "tcommit", "trollback", "tstart", "use", "view", "write", "xecute", "b","c","d","e","f","g", "h", "i", "j","k","l","m","n","o", "q", "r", "s", "tc", "tro", "ts", "u", "v", "w", "x"];
+    // The following list includes intrinsic functions _and_ special variables
+    var intrinsicFuncsWords = ["\\$ascii", "\\$char", "\\$data", "\\$ecode", "\\$estack", "\\$etrap", "\\$extract", "\\$find", "\\$fnumber", "\\$get", "\\$horolog", "\\$io", "\\$increment", "\\$job", "\\$justify", "\\$length", "\\$name", "\\$next", "\\$order", "\\$piece", "\\$qlength", "\\$qsubscript", "\\$query", "\\$quit", "\\$random", "\\$reverse", "\\$select", "\\$stack", "\\$test", "\\$text", "\\$translate", "\\$view", "\\$x", "\\$y", "\\$a", "\\$c", "\\$d", "\\$e", "\\$ec", "\\$es", "\\$et", "\\$f", "\\$fn", "\\$g", "\\$h", "\\$i", "\\$j", "\\$l", "\\$n", "\\$na", "\\$o", "\\$p", "\\$q", "\\$ql", "\\$qs", "\\$r", "\\$re", "\\$s", "\\$st", "\\$t", "\\$tr", "\\$v", "\\$z"];
+    var intrinsicFuncs = wordRegexp(intrinsicFuncsWords);
+    var command = wordRegexp(commandKeywords);
+
+    function tokenBase(stream, state) {
+      if (stream.sol()) {
+        state.label = true;
+        state.commandMode = 0;
+      }
+
+      // The <space> character has meaning in MUMPS. Ignoring consecutive
+      // spaces would interfere with interpreting whether the next non-space
+      // character belongs to the command or argument context.
+
+      // Examine each character and update a mode variable whose interpretation is:
+      //   >0 => command    0 => argument    <0 => command post-conditional
+      var ch = stream.peek();
+
+      if (ch == " " || ch == "\t") { // Pre-process <space>
+        state.label = false;
+        if (state.commandMode == 0)
+          state.commandMode = 1;
+        else if ((state.commandMode < 0) || (state.commandMode == 2))
+          state.commandMode = 0;
+      } else if ((ch != ".") && (state.commandMode > 0)) {
+        if (ch == ":")
+          state.commandMode = -1;   // SIS - Command post-conditional
+        else
+          state.commandMode = 2;
+      }
+
+      // Do not color parameter list as line tag
+      if ((ch === "(") || (ch === "\u0009"))
+        state.label = false;
+
+      // MUMPS comment starts with ";"
+      if (ch === ";") {
+        stream.skipToEnd();
+        return "comment";
+      }
+
+      // Number Literals // SIS/RLM - MUMPS permits canonic number followed by concatenate operator
+      if (stream.match(/^[-+]?\d+(\.\d+)?([eE][-+]?\d+)?/))
+        return "number";
+
+      // Handle Strings
+      if (ch == '"') {
+        if (stream.skipTo('"')) {
+          stream.next();
+          return "string";
+        } else {
+          stream.skipToEnd();
+          return "error";
+        }
+      }
+
+      // Handle operators and Delimiters
+      if (stream.match(doubleOperators) || stream.match(singleOperators))
+        return "operator";
+
+      // Prevents leading "." in DO block from falling through to error
+      if (stream.match(singleDelimiters))
+        return null;
+
+      if (brackets.test(ch)) {
+        stream.next();
+        return "bracket";
+      }
+
+      if (state.commandMode > 0 && stream.match(command))
+        return "variable-2";
+
+      if (stream.match(intrinsicFuncs))
+        return "builtin";
+
+      if (stream.match(identifiers))
+        return "variable";
+
+      // Detect dollar-sign when not a documented intrinsic function
+      // "^" may introduce a GVN or SSVN - Color same as function
+      if (ch === "$" || ch === "^") {
+        stream.next();
+        return "builtin";
+      }
+
+      // MUMPS Indirection
+      if (ch === "@") {
+        stream.next();
+        return "string-2";
+      }
+
+      if (/[\w%]/.test(ch)) {
+        stream.eatWhile(/[\w%]/);
+        return "variable";
+      }
+
+      // Handle non-detected items
+      stream.next();
+      return "error";
+    }
+
+    return {
+      startState: function() {
+        return {
+          label: false,
+          commandMode: 0
+        };
+      },
+
+      token: function(stream, state) {
+        var style = tokenBase(stream, state);
+        if (state.label) return "tag";
+        return style;
+      }
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-mumps", "mumps");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/nginx/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,181 @@
+<!doctype html>
+<head>
+<title>CodeMirror: NGINX mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="nginx.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+    <link rel="stylesheet" href="../../doc/docs.css">
+  </head>
+
+  <style>
+    body {
+      margin: 0em auto;
+    }
+
+    .CodeMirror, .CodeMirror-scroll {
+      height: 600px;
+    }
+  </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">NGINX</a>
+  </ul>
+</div>
+
+<article>
+<h2>NGINX mode</h2>
+<form><textarea id="code" name="code" style="height: 800px;">
+server {
+  listen 173.255.219.235:80;
+  server_name website.com.au;
+  rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
+}
+
+server {
+  listen 173.255.219.235:443;
+  server_name website.com.au;
+  rewrite / $scheme://www.$host$request_uri permanent; ## Forcibly prepend a www
+}
+
+server {
+
+  listen      173.255.219.235:80;
+  server_name www.website.com.au;
+
+
+
+  root        /data/www;
+  index       index.html index.php;
+
+  location / {
+    index index.html index.php;     ## Allow a static html file to be shown first
+    try_files $uri $uri/ @handler;  ## If missing pass the URI to Magento's front handler
+    expires 30d;                    ## Assume all files are cacheable
+  }
+
+  ## These locations would be hidden by .htaccess normally
+  location /app/                { deny all; }
+  location /includes/           { deny all; }
+  location /lib/                { deny all; }
+  location /media/downloadable/ { deny all; }
+  location /pkginfo/            { deny all; }
+  location /report/config.xml   { deny all; }
+  location /var/                { deny all; }
+
+  location /var/export/ { ## Allow admins only to view export folder
+    auth_basic           "Restricted"; ## Message shown in login window
+    auth_basic_user_file /rs/passwords/testfile; ## See /etc/nginx/htpassword
+    autoindex            on;
+  }
+
+  location  /. { ## Disable .htaccess and other hidden files
+    return 404;
+  }
+
+  location @handler { ## Magento uses a common front handler
+    rewrite / /index.php;
+  }
+
+  location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
+    rewrite ^/(.*.php)/ /$1 last;
+  }
+
+  location ~ \.php$ {
+    if (!-e $request_filename) { rewrite / /index.php last; } ## Catch 404s that try_files miss
+
+    fastcgi_pass   127.0.0.1:9000;
+    fastcgi_index  index.php;
+    fastcgi_param PATH_INFO $fastcgi_script_name;
+    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
+    include        /rs/confs/nginx/fastcgi_params;
+  }
+
+}
+
+
+server {
+
+  listen              173.255.219.235:443;
+  server_name         website.com.au www.website.com.au;
+
+  root   /data/www;
+  index index.html index.php;
+
+  ssl                 on;
+  ssl_certificate     /rs/ssl/ssl.crt;
+  ssl_certificate_key /rs/ssl/ssl.key;
+
+  ssl_session_timeout  5m;
+
+  ssl_protocols  SSLv2 SSLv3 TLSv1;
+  ssl_ciphers  ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
+  ssl_prefer_server_ciphers   on;
+
+
+
+  location / {
+    index index.html index.php; ## Allow a static html file to be shown first
+    try_files $uri $uri/ @handler; ## If missing pass the URI to Magento's front handler
+    expires 30d; ## Assume all files are cacheable
+  }
+
+  ## These locations would be hidden by .htaccess normally
+  location /app/                { deny all; }
+  location /includes/           { deny all; }
+  location /lib/                { deny all; }
+  location /media/downloadable/ { deny all; }
+  location /pkginfo/            { deny all; }
+  location /report/config.xml   { deny all; }
+  location /var/                { deny all; }
+
+  location /var/export/ { ## Allow admins only to view export folder
+    auth_basic           "Restricted"; ## Message shown in login window
+    auth_basic_user_file htpasswd; ## See /etc/nginx/htpassword
+    autoindex            on;
+  }
+
+  location  /. { ## Disable .htaccess and other hidden files
+    return 404;
+  }
+
+  location @handler { ## Magento uses a common front handler
+    rewrite / /index.php;
+  }
+
+  location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
+    rewrite ^/(.*.php)/ /$1 last;
+  }
+
+  location ~ .php$ { ## Execute PHP scripts
+    if (!-e $request_filename) { rewrite  /index.php last; } ## Catch 404s that try_files miss
+
+    fastcgi_pass 127.0.0.1:9000;
+    fastcgi_index  index.php;
+    fastcgi_param PATH_INFO $fastcgi_script_name;
+    fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
+    include        /rs/confs/nginx/fastcgi_params;
+
+    fastcgi_param HTTPS on;
+  }
+
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-nginx-conf</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/nginx/nginx.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,178 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("nginx", function(config) {
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  var keywords = words(
+    /* ngxDirectiveControl */ "break return rewrite set" +
+    /* ngxDirective */ " accept_mutex accept_mutex_delay access_log add_after_body add_before_body add_header addition_types aio alias allow ancient_browser ancient_browser_value auth_basic auth_basic_user_file auth_http auth_http_header auth_http_timeout autoindex autoindex_exact_size autoindex_localtime charset charset_types client_body_buffer_size client_body_in_file_only client_body_in_single_buffer client_body_temp_path client_body_timeout client_header_buffer_size client_header_timeout client_max_body_size connection_pool_size create_full_put_path daemon dav_access dav_methods debug_connection debug_points default_type degradation degrade deny devpoll_changes devpoll_events directio directio_alignment empty_gif env epoll_events error_log eventport_events expires fastcgi_bind fastcgi_buffer_size fastcgi_buffers fastcgi_busy_buffers_size fastcgi_cache fastcgi_cache_key fastcgi_cache_methods fastcgi_cache_min_uses fastcgi_cache_path fastcgi_cache_use_stale fastcgi_cache_valid fastcgi_catch_stderr fastcgi_connect_timeout fastcgi_hide_header fastcgi_ignore_client_abort fastcgi_ignore_headers fastcgi_index fastcgi_intercept_errors fastcgi_max_temp_file_size fastcgi_next_upstream fastcgi_param fastcgi_pass_header fastcgi_pass_request_body fastcgi_pass_request_headers fastcgi_read_timeout fastcgi_send_lowat fastcgi_send_timeout fastcgi_split_path_info fastcgi_store fastcgi_store_access fastcgi_temp_file_write_size fastcgi_temp_path fastcgi_upstream_fail_timeout fastcgi_upstream_max_fails flv geoip_city geoip_country google_perftools_profiles gzip gzip_buffers gzip_comp_level gzip_disable gzip_hash gzip_http_version gzip_min_length gzip_no_buffer gzip_proxied gzip_static gzip_types gzip_vary gzip_window if_modified_since ignore_invalid_headers image_filter image_filter_buffer image_filter_jpeg_quality image_filter_transparency imap_auth imap_capabilities imap_client_buffer index ip_hash keepalive_requests keepalive_timeout kqueue_changes kqueue_events large_client_header_buffers limit_conn limit_conn_log_level limit_rate limit_rate_after limit_req limit_req_log_level limit_req_zone limit_zone lingering_time lingering_timeout lock_file log_format log_not_found log_subrequest map_hash_bucket_size map_hash_max_size master_process memcached_bind memcached_buffer_size memcached_connect_timeout memcached_next_upstream memcached_read_timeout memcached_send_timeout memcached_upstream_fail_timeout memcached_upstream_max_fails merge_slashes min_delete_depth modern_browser modern_browser_value msie_padding msie_refresh multi_accept open_file_cache open_file_cache_errors open_file_cache_events open_file_cache_min_uses open_file_cache_valid open_log_file_cache output_buffers override_charset perl perl_modules perl_require perl_set pid pop3_auth pop3_capabilities port_in_redirect postpone_gzipping postpone_output protocol proxy proxy_bind proxy_buffer proxy_buffer_size proxy_buffering proxy_buffers proxy_busy_buffers_size proxy_cache proxy_cache_key proxy_cache_methods proxy_cache_min_uses proxy_cache_path proxy_cache_use_stale proxy_cache_valid proxy_connect_timeout proxy_headers_hash_bucket_size proxy_headers_hash_max_size proxy_hide_header proxy_ignore_client_abort proxy_ignore_headers proxy_intercept_errors proxy_max_temp_file_size proxy_method proxy_next_upstream proxy_pass_error_message proxy_pass_header proxy_pass_request_body proxy_pass_request_headers proxy_read_timeout proxy_redirect proxy_send_lowat proxy_send_timeout proxy_set_body proxy_set_header proxy_ssl_session_reuse proxy_store proxy_store_access proxy_temp_file_write_size proxy_temp_path proxy_timeout proxy_upstream_fail_timeout proxy_upstream_max_fails random_index read_ahead real_ip_header recursive_error_pages request_pool_size reset_timedout_connection resolver resolver_timeout rewrite_log rtsig_overflow_events rtsig_overflow_test rtsig_overflow_threshold rtsig_signo satisfy secure_link_secret send_lowat send_timeout sendfile sendfile_max_chunk server_name_in_redirect server_names_hash_bucket_size server_names_hash_max_size server_tokens set_real_ip_from smtp_auth smtp_capabilities smtp_client_buffer smtp_greeting_delay so_keepalive source_charset ssi ssi_ignore_recycled_buffers ssi_min_file_chunk ssi_silent_errors ssi_types ssi_value_length ssl ssl_certificate ssl_certificate_key ssl_ciphers ssl_client_certificate ssl_crl ssl_dhparam ssl_engine ssl_prefer_server_ciphers ssl_protocols ssl_session_cache ssl_session_timeout ssl_verify_client ssl_verify_depth starttls stub_status sub_filter sub_filter_once sub_filter_types tcp_nodelay tcp_nopush thread_stack_size timeout timer_resolution types_hash_bucket_size types_hash_max_size underscores_in_headers uninitialized_variable_warn use user userid userid_domain userid_expires userid_mark userid_name userid_p3p userid_path userid_service valid_referers variables_hash_bucket_size variables_hash_max_size worker_connections worker_cpu_affinity worker_priority worker_processes worker_rlimit_core worker_rlimit_nofile worker_rlimit_sigpending worker_threads working_directory xclient xml_entities xslt_stylesheet xslt_typesdrew@li229-23"
+    );
+
+  var keywords_block = words(
+    /* ngxDirectiveBlock */ "http mail events server types location upstream charset_map limit_except if geo map"
+    );
+
+  var keywords_important = words(
+    /* ngxDirectiveImportant */ "include root server server_name listen internal proxy_pass memcached_pass fastcgi_pass try_files"
+    );
+
+  var indentUnit = config.indentUnit, type;
+  function ret(style, tp) {type = tp; return style;}
+
+  function tokenBase(stream, state) {
+
+
+    stream.eatWhile(/[\w\$_]/);
+
+    var cur = stream.current();
+
+
+    if (keywords.propertyIsEnumerable(cur)) {
+      return "keyword";
+    }
+    else if (keywords_block.propertyIsEnumerable(cur)) {
+      return "variable-2";
+    }
+    else if (keywords_important.propertyIsEnumerable(cur)) {
+      return "string-2";
+    }
+    /**/
+
+    var ch = stream.next();
+    if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("meta", stream.current());}
+    else if (ch == "/" && stream.eat("*")) {
+      state.tokenize = tokenCComment;
+      return tokenCComment(stream, state);
+    }
+    else if (ch == "<" && stream.eat("!")) {
+      state.tokenize = tokenSGMLComment;
+      return tokenSGMLComment(stream, state);
+    }
+    else if (ch == "=") ret(null, "compare");
+    else if ((ch == "~" || ch == "|") && stream.eat("=")) return ret(null, "compare");
+    else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    else if (ch == "#") {
+      stream.skipToEnd();
+      return ret("comment", "comment");
+    }
+    else if (ch == "!") {
+      stream.match(/^\s*\w*/);
+      return ret("keyword", "important");
+    }
+    else if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w.%]/);
+      return ret("number", "unit");
+    }
+    else if (/[,.+>*\/]/.test(ch)) {
+      return ret(null, "select-op");
+    }
+    else if (/[;{}:\[\]]/.test(ch)) {
+      return ret(null, ch);
+    }
+    else {
+      stream.eatWhile(/[\w\\\-]/);
+      return ret("variable", "variable");
+    }
+  }
+
+  function tokenCComment(stream, state) {
+    var maybeEnd = false, ch;
+    while ((ch = stream.next()) != null) {
+      if (maybeEnd && ch == "/") {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return ret("comment", "comment");
+  }
+
+  function tokenSGMLComment(stream, state) {
+    var dashes = 0, ch;
+    while ((ch = stream.next()) != null) {
+      if (dashes >= 2 && ch == ">") {
+        state.tokenize = tokenBase;
+        break;
+      }
+      dashes = (ch == "-") ? dashes + 1 : 0;
+    }
+    return ret("comment", "comment");
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped)
+          break;
+        escaped = !escaped && ch == "\\";
+      }
+      if (!escaped) state.tokenize = tokenBase;
+      return ret("string", "string");
+    };
+  }
+
+  return {
+    startState: function(base) {
+      return {tokenize: tokenBase,
+              baseIndent: base || 0,
+              stack: []};
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      type = null;
+      var style = state.tokenize(stream, state);
+
+      var context = state.stack[state.stack.length-1];
+      if (type == "hash" && context == "rule") style = "atom";
+      else if (style == "variable") {
+        if (context == "rule") style = "number";
+        else if (!context || context == "@media{") style = "tag";
+      }
+
+      if (context == "rule" && /^[\{\};]$/.test(type))
+        state.stack.pop();
+      if (type == "{") {
+        if (context == "@media") state.stack[state.stack.length-1] = "@media{";
+        else state.stack.push("{");
+      }
+      else if (type == "}") state.stack.pop();
+      else if (type == "@media") state.stack.push("@media");
+      else if (context == "{" && type != "comment") state.stack.push("rule");
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var n = state.stack.length;
+      if (/^\}/.test(textAfter))
+        n -= state.stack[state.stack.length-1] == "rule" ? 2 : 1;
+      return state.baseIndent + n * indentUnit;
+    },
+
+    electricChars: "}"
+  };
+});
+
+CodeMirror.defineMIME("text/x-nginx-conf", "nginx");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/nsis/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,80 @@
+<!doctype html>
+
+<title>CodeMirror: NSIS mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src=nsis.js></script>
+<style type=text/css>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">NSIS</a>
+  </ul>
+</div>
+
+<article>
+<h2>NSIS mode</h2>
+
+
+<textarea id=code>
+; This is a comment
+!ifdef ERROR
+    !error "Something went wrong"
+!endif
+
+OutFile "demo.exe"
+RequestExecutionLevel user
+SetDetailsPrint listonly
+
+!include "LogicLib.nsh"
+!include "WinVer.nsh"
+
+Section -mandatory
+
+    Call logWinVer
+
+    ${If} 1 > 0
+      MessageBox MB_OK "Hello world"
+    ${EndIf}
+
+SectionEnd
+
+Function logWinVer
+
+    ${If} ${IsWin10}
+        DetailPrint "Windows 10!"
+    ${ElseIf} ${AtLeastWinVista}
+        DetailPrint "We're post-XP"
+    ${Else}
+        DetailPrint "Legacy system"
+    ${EndIf}
+
+FunctionEnd
+</textarea>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+    mode: 'nsis',
+    indentWithTabs: true,
+    smartIndent: true,
+    lineNumbers: true,
+    matchBrackets: true
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-nsis</code>.</p>
+</article>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/nsis/nsis.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Author: Jan T. Sott (http://github.com/idleberg)
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineSimpleMode("nsis",{
+  start:[
+    // Numbers
+    {regex: /(?:[+-]?)(?:0x[\d,a-f]+)|(?:0o[0-7]+)|(?:0b[0,1]+)|(?:\d+.?\d*)/, token: "number"},
+
+    // Strings
+    { regex: /"(?:[^\\"]|\\.)*"?/, token: "string" },
+    { regex: /'(?:[^\\']|\\.)*'?/, token: "string" },
+    { regex: /`(?:[^\\`]|\\.)*`?/, token: "string" },
+
+    // Compile Time Commands
+    {regex: /^\s*(?:\!(addincludedir|addplugindir|appendfile|assert|cd|define|delfile|echo|error|execute|finalize|getdllversion|gettlbversion|include|insertmacro|macro|macroend|makensis|packhdr|pragma|searchparse|searchreplace|system|tempfile|undef|uninstfinalize|verbose|warning))\b/i, token: "keyword"},
+
+    // Conditional Compilation
+    {regex: /^\s*(?:\!(if(?:n?def)?|ifmacron?def|macro))\b/i, token: "keyword", indent: true},
+    {regex: /^\s*(?:\!(else|endif|macroend))\b/i, token: "keyword", dedent: true},
+
+    // Runtime Commands
+    {regex: /^\s*(?:Abort|AddBrandingImage|AddSize|AllowRootDirInstall|AllowSkipFiles|AutoCloseWindow|BGFont|BGGradient|BrandingText|BringToFront|Call|CallInstDLL|Caption|ChangeUI|CheckBitmap|ClearErrors|CompletedText|ComponentText|CopyFiles|CRCCheck|CreateDirectory|CreateFont|CreateShortCut|Delete|DeleteINISec|DeleteINIStr|DeleteRegKey|DeleteRegValue|DetailPrint|DetailsButtonText|DirText|DirVar|DirVerify|EnableWindow|EnumRegKey|EnumRegValue|Exch|Exec|ExecShell|ExecShellWait|ExecWait|ExpandEnvStrings|File|FileBufSize|FileClose|FileErrorText|FileOpen|FileRead|FileReadByte|FileReadUTF16LE|FileReadWord|FileWriteUTF16LE|FileSeek|FileWrite|FileWriteByte|FileWriteWord|FindClose|FindFirst|FindNext|FindWindow|FlushINI|GetCurInstType|GetCurrentAddress|GetDlgItem|GetDLLVersion|GetDLLVersionLocal|GetErrorLevel|GetFileTime|GetFileTimeLocal|GetFullPathName|GetFunctionAddress|GetInstDirError|GetKnownFolderPath|GetLabelAddress|GetTempFileName|GetWinVer|Goto|HideWindow|Icon|IfAbort|IfErrors|IfFileExists|IfRebootFlag|IfRtlLanguage|IfShellVarContextAll|IfSilent|InitPluginsDir|InstallButtonText|InstallColors|InstallDir|InstallDirRegKey|InstProgressFlags|InstType|InstTypeGetText|InstTypeSetText|Int64Cmp|Int64CmpU|Int64Fmt|IntCmp|IntCmpU|IntFmt|IntOp|IntPtrCmp|IntPtrCmpU|IntPtrOp|IsWindow|LangString|LicenseBkColor|LicenseData|LicenseForceSelection|LicenseLangString|LicenseText|LoadAndSetImage|LoadLanguageFile|LockWindow|LogSet|LogText|ManifestDPIAware|ManifestLongPathAware|ManifestMaxVersionTested|ManifestSupportedOS|MessageBox|MiscButtonText|Name|Nop|OutFile|Page|PageCallbacks|PEAddResource|PEDllCharacteristics|PERemoveResource|PESubsysVer|Pop|Push|Quit|ReadEnvStr|ReadINIStr|ReadRegDWORD|ReadRegStr|Reboot|RegDLL|Rename|RequestExecutionLevel|ReserveFile|Return|RMDir|SearchPath|SectionGetFlags|SectionGetInstTypes|SectionGetSize|SectionGetText|SectionIn|SectionSetFlags|SectionSetInstTypes|SectionSetSize|SectionSetText|SendMessage|SetAutoClose|SetBrandingImage|SetCompress|SetCompressor|SetCompressorDictSize|SetCtlColors|SetCurInstType|SetDatablockOptimize|SetDateSave|SetDetailsPrint|SetDetailsView|SetErrorLevel|SetErrors|SetFileAttributes|SetFont|SetOutPath|SetOverwrite|SetRebootFlag|SetRegView|SetShellVarContext|SetSilent|ShowInstDetails|ShowUninstDetails|ShowWindow|SilentInstall|SilentUnInstall|Sleep|SpaceTexts|StrCmp|StrCmpS|StrCpy|StrLen|SubCaption|Target|Unicode|UninstallButtonText|UninstallCaption|UninstallIcon|UninstallSubCaption|UninstallText|UninstPage|UnRegDLL|Var|VIAddVersionKey|VIFileVersion|VIProductVersion|WindowIcon|WriteINIStr|WriteRegBin|WriteRegDWORD|WriteRegExpandStr|WriteRegMultiStr|WriteRegNone|WriteRegStr|WriteUninstaller|XPStyle)\b/i, token: "keyword"},
+    {regex: /^\s*(?:Function|PageEx|Section(?:Group)?)\b/i, token: "keyword", indent: true},
+    {regex: /^\s*(?:(Function|PageEx|Section(?:Group)?)End)\b/i, token: "keyword", dedent: true},
+
+    // Command Options
+    {regex: /\b(?:ARCHIVE|FILE_ATTRIBUTE_ARCHIVE|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_NORMAL|FILE_ATTRIBUTE_OFFLINE|FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_TEMPORARY|HIDDEN|HKCC|HKCR(32|64)?|HKCU(32|64)?|HKDD|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_DYN_DATA|HKEY_LOCAL_MACHINE|HKEY_PERFORMANCE_DATA|HKEY_USERS|HKLM(32|64)?|HKPD|HKU|IDABORT|IDCANCEL|IDD_DIR|IDD_INST|IDD_INSTFILES|IDD_LICENSE|IDD_SELCOM|IDD_UNINST|IDD_VERIFY|IDIGNORE|IDNO|IDOK|IDRETRY|IDYES|MB_ABORTRETRYIGNORE|MB_DEFBUTTON1|MB_DEFBUTTON2|MB_DEFBUTTON3|MB_DEFBUTTON4|MB_ICONEXCLAMATION|MB_ICONINFORMATION|MB_ICONQUESTION|MB_ICONSTOP|MB_OK|MB_OKCANCEL|MB_RETRYCANCEL|MB_RIGHT|MB_RTLREADING|MB_SETFOREGROUND|MB_TOPMOST|MB_USERICON|MB_YESNO|MB_YESNOCANCEL|NORMAL|OFFLINE|READONLY|SHCTX|SHELL_CONTEXT|SW_HIDE|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWNORMAL|SYSTEM|TEMPORARY)\b/i, token: "atom"},
+    {regex: /\b(?:admin|all|amd64-unicode|auto|both|bottom|bzip2|components|current|custom|directory|false|force|hide|highest|ifdiff|ifnewer|instfiles|lastused|leave|left|license|listonly|lzma|nevershow|none|normal|notset|off|on|right|show|silent|silentlog|textonly|top|true|try|un\.components|un\.custom|un\.directory|un\.instfiles|un\.license|uninstConfirm|user|Win10|Win7|Win8|WinVista|x-86-(ansi|unicode)|zlib)\b/i, token: "builtin"},
+
+    // LogicLib.nsh
+    {regex: /\$\{(?:And(?:If(?:Not)?|Unless)|Break|Case(?:2|3|4|5|Else)?|Continue|Default|Do(?:Until|While)?|Else(?:If(?:Not)?|Unless)?|End(?:If|Select|Switch)|Exit(?:Do|For|While)|For(?:Each)?|If(?:Cmd|Not(?:Then)?|Then)?|Loop(?:Until|While)?|Or(?:If(?:Not)?|Unless)|Select|Switch|Unless|While)\}/i, token: "variable-2", indent: true},
+
+    // FileFunc.nsh
+    {regex: /\$\{(?:BannerTrimPath|DirState|DriveSpace|Get(BaseName|Drives|ExeName|ExePath|FileAttributes|FileExt|FileName|FileVersion|Options|OptionsS|Parameters|Parent|Root|Size|Time)|Locate|RefreshShellIcons)\}/i, token: "variable-2", dedent: true},
+
+    // Memento.nsh
+    {regex: /\$\{(?:Memento(?:Section(?:Done|End|Restore|Save)?|UnselectedSection))\}/i, token: "variable-2", dedent: true},
+
+    // TextFunc.nsh
+    {regex: /\$\{(?:Config(?:Read|ReadS|Write|WriteS)|File(?:Join|ReadFromEnd|Recode)|Line(?:Find|Read|Sum)|Text(?:Compare|CompareS)|TrimNewLines)\}/i, token: "variable-2", dedent: true},
+
+    // WinVer.nsh
+    {regex: /\$\{(?:(?:At(?:Least|Most)|Is)(?:ServicePack|Win(?:7|8|10|95|98|200(?:0|3|8(?:R2)?)|ME|NT4|Vista|XP))|Is(?:NT|Server))\}/i, token: "variable", dedent: true},
+
+    // WordFunc.nsh
+    {regex: /\$\{(?:StrFilterS?|Version(?:Compare|Convert)|Word(?:AddS?|Find(?:(?:2|3)X)?S?|InsertS?|ReplaceS?))\}/i, token: "variable-2", dedent: true},
+
+    // x64.nsh
+    {regex: /\$\{(?:RunningX64)\}/i, token: "variable", dedent: true},
+    {regex: /\$\{(?:Disable|Enable)X64FSRedirection\}/i, token: "variable-2", dedent: true},
+
+    // Line Comment
+    {regex: /(#|;).*/, token: "comment"},
+
+    // Block Comment
+    {regex: /\/\*/, token: "comment", next: "comment"},
+
+    // Operator
+    {regex: /[-+\/*=<>!]+/, token: "operator"},
+
+    // Variable
+    {regex: /\$\w[\w\.]*/, token: "variable"},
+
+    // Constant
+    {regex: /\${[\!\w\.:-]+}/, token: "variable-2"},
+
+    // Language String
+    {regex: /\$\([\!\w\.:-]+\)/, token: "variable-3"}
+  ],
+  comment: [
+    {regex: /.*?\*\//, token: "comment", next: "start"},
+    {regex: /.*/, token: "comment"}
+  ],
+  meta: {
+    electricInput: /^\s*((Function|PageEx|Section|Section(Group)?)End|(\!(endif|macroend))|\$\{(End(If|Unless|While)|Loop(Until)|Next)\})$/i,
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: ["#", ";"]
+  }
+});
+
+CodeMirror.defineMIME("text/x-nsis", "nsis");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ntriples/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,70 @@
+<!doctype html>
+
+<title>CodeMirror: N-Triples mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="ntriples.js"></script>
+<style>
+      .CodeMirror {
+        border: 1px solid #eee;
+        height: auto;
+      }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">N-Triples/N-Quads</a>
+  </ul>
+</div>
+
+<article>
+  <h2><a href="https://www.w3.org/TR/n-triples/">N-Triples</a> mode</h2>
+  <p>The N-Triples mode also works well with on
+    <a href="https://www.w3.org/TR/n-quads/">N-Quad</a> documents.
+  </p>
+<form>
+<textarea id="ntriples" name="ntriples">    
+<http://Sub1>     <http://pred1>     <http://obj> .
+<http://Sub2>     <http://pred2#an2> "literal 1" .
+<http://Sub3#an3> <http://pred3>     _:bnode3 .
+_:bnode4          <http://pred4>     "literal 2"@lang .
+_:bnode5          <http://pred5>     "literal 3"^^<http://type> .
+</textarea>
+</form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("ntriples"), {});
+    </script>
+    <p><strong>MIME types defined:</strong> <code>application/n-triples</code>.</p>
+
+    <hr />
+    <p><a href="https://www.w3.org/TR/n-quads/">N-Quads</a> add a fourth
+    element to the statement to track which graph the statement is from.
+    Otherwise, it's identical to N-Triples.</p>
+    <form>
+    <textarea id="nquads" name="nquads">
+
+    <http://Sub1>     <http://pred1>     <http://obj>   <http://graph3> .
+    <http://Sub2>     <http://pred2#an2> "literal 1"    <http://graph2> .
+    <http://Sub3#an3> <http://pred3>     _:bnode3     <http://graph2> .
+    _:bnode4          <http://pred4>     "literal 2"@lang     <http://graph2> .
+    # if a graph label
+    _:bnode5          <http://pred5>     "literal 3"^^<http://type> .
+    </textarea>
+    </form>
+
+    <script>
+      var nquads_editor = CodeMirror.fromTextArea(document.getElementById("nquads"), {});
+    </script>
+    <p><strong>MIME types defined:</strong> <code>application/n-quads</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ntriples/ntriples.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,195 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**********************************************************
+* This script provides syntax highlighting support for
+* the N-Triples format.
+* N-Triples format specification:
+*     https://www.w3.org/TR/n-triples/
+***********************************************************/
+
+/*
+    The following expression defines the defined ASF grammar transitions.
+
+    pre_subject ->
+        {
+        ( writing_subject_uri | writing_bnode_uri )
+            -> pre_predicate
+                -> writing_predicate_uri
+                    -> pre_object
+                        -> writing_object_uri | writing_object_bnode |
+                          (
+                            writing_object_literal
+                                -> writing_literal_lang | writing_literal_type
+                          )
+                            -> post_object
+                                -> BEGIN
+         } otherwise {
+             -> ERROR
+         }
+*/
+
+(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.defineMode("ntriples", function() {
+
+  var Location = {
+    PRE_SUBJECT         : 0,
+    WRITING_SUB_URI     : 1,
+    WRITING_BNODE_URI   : 2,
+    PRE_PRED            : 3,
+    WRITING_PRED_URI    : 4,
+    PRE_OBJ             : 5,
+    WRITING_OBJ_URI     : 6,
+    WRITING_OBJ_BNODE   : 7,
+    WRITING_OBJ_LITERAL : 8,
+    WRITING_LIT_LANG    : 9,
+    WRITING_LIT_TYPE    : 10,
+    POST_OBJ            : 11,
+    ERROR               : 12
+  };
+  function transitState(currState, c) {
+    var currLocation = currState.location;
+    var ret;
+
+    // Opening.
+    if     (currLocation == Location.PRE_SUBJECT && c == '<') ret = Location.WRITING_SUB_URI;
+    else if(currLocation == Location.PRE_SUBJECT && c == '_') ret = Location.WRITING_BNODE_URI;
+    else if(currLocation == Location.PRE_PRED    && c == '<') ret = Location.WRITING_PRED_URI;
+    else if(currLocation == Location.PRE_OBJ     && c == '<') ret = Location.WRITING_OBJ_URI;
+    else if(currLocation == Location.PRE_OBJ     && c == '_') ret = Location.WRITING_OBJ_BNODE;
+    else if(currLocation == Location.PRE_OBJ     && c == '"') ret = Location.WRITING_OBJ_LITERAL;
+
+    // Closing.
+    else if(currLocation == Location.WRITING_SUB_URI     && c == '>') ret = Location.PRE_PRED;
+    else if(currLocation == Location.WRITING_BNODE_URI   && c == ' ') ret = Location.PRE_PRED;
+    else if(currLocation == Location.WRITING_PRED_URI    && c == '>') ret = Location.PRE_OBJ;
+    else if(currLocation == Location.WRITING_OBJ_URI     && c == '>') ret = Location.POST_OBJ;
+    else if(currLocation == Location.WRITING_OBJ_BNODE   && c == ' ') ret = Location.POST_OBJ;
+    else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '"') ret = Location.POST_OBJ;
+    else if(currLocation == Location.WRITING_LIT_LANG && c == ' ') ret = Location.POST_OBJ;
+    else if(currLocation == Location.WRITING_LIT_TYPE && c == '>') ret = Location.POST_OBJ;
+
+    // Closing typed and language literal.
+    else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '@') ret = Location.WRITING_LIT_LANG;
+    else if(currLocation == Location.WRITING_OBJ_LITERAL && c == '^') ret = Location.WRITING_LIT_TYPE;
+
+    // Spaces.
+    else if( c == ' ' &&
+             (
+               currLocation == Location.PRE_SUBJECT ||
+               currLocation == Location.PRE_PRED    ||
+               currLocation == Location.PRE_OBJ     ||
+               currLocation == Location.POST_OBJ
+             )
+           ) ret = currLocation;
+
+    // Reset.
+    else if(currLocation == Location.POST_OBJ && c == '.') ret = Location.PRE_SUBJECT;
+
+    // Error
+    else ret = Location.ERROR;
+
+    currState.location=ret;
+  }
+
+  return {
+    startState: function() {
+       return {
+           location : Location.PRE_SUBJECT,
+           uris     : [],
+           anchors  : [],
+           bnodes   : [],
+           langs    : [],
+           types    : []
+       };
+    },
+    token: function(stream, state) {
+      var ch = stream.next();
+      if(ch == '<') {
+         transitState(state, ch);
+         var parsedURI = '';
+         stream.eatWhile( function(c) { if( c != '#' && c != '>' ) { parsedURI += c; return true; } return false;} );
+         state.uris.push(parsedURI);
+         if( stream.match('#', false) ) return 'variable';
+         stream.next();
+         transitState(state, '>');
+         return 'variable';
+      }
+      if(ch == '#') {
+        var parsedAnchor = '';
+        stream.eatWhile(function(c) { if(c != '>' && c != ' ') { parsedAnchor+= c; return true; } return false;});
+        state.anchors.push(parsedAnchor);
+        return 'variable-2';
+      }
+      if(ch == '>') {
+          transitState(state, '>');
+          return 'variable';
+      }
+      if(ch == '_') {
+          transitState(state, ch);
+          var parsedBNode = '';
+          stream.eatWhile(function(c) { if( c != ' ' ) { parsedBNode += c; return true; } return false;});
+          state.bnodes.push(parsedBNode);
+          stream.next();
+          transitState(state, ' ');
+          return 'builtin';
+      }
+      if(ch == '"') {
+          transitState(state, ch);
+          stream.eatWhile( function(c) { return c != '"'; } );
+          stream.next();
+          if( stream.peek() != '@' && stream.peek() != '^' ) {
+              transitState(state, '"');
+          }
+          return 'string';
+      }
+      if( ch == '@' ) {
+          transitState(state, '@');
+          var parsedLang = '';
+          stream.eatWhile(function(c) { if( c != ' ' ) { parsedLang += c; return true; } return false;});
+          state.langs.push(parsedLang);
+          stream.next();
+          transitState(state, ' ');
+          return 'string-2';
+      }
+      if( ch == '^' ) {
+          stream.next();
+          transitState(state, '^');
+          var parsedType = '';
+          stream.eatWhile(function(c) { if( c != '>' ) { parsedType += c; return true; } return false;} );
+          state.types.push(parsedType);
+          stream.next();
+          transitState(state, '>');
+          return 'variable';
+      }
+      if( ch == ' ' ) {
+          transitState(state, ch);
+      }
+      if( ch == '.' ) {
+          transitState(state, ch);
+      }
+    }
+  };
+});
+
+// define the registered Media Type for n-triples:
+// https://www.w3.org/TR/n-triples/#n-triples-mediatype
+CodeMirror.defineMIME("application/n-triples", "ntriples");
+
+// N-Quads is based on the N-Triples format (so same highlighting works)
+// https://www.w3.org/TR/n-quads/
+CodeMirror.defineMIME("application/n-quads", "ntriples");
+
+// previously used, though technically incorrect media type for n-triples
+CodeMirror.defineMIME("text/n-triples", "ntriples");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/octave/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,84 @@
+<!doctype html>
+
+<title>CodeMirror: Octave mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="octave.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Octave</a>
+  </ul>
+</div>
+
+<article>
+<h2>Octave mode</h2>
+
+    <div><textarea id="code" name="code">
+%numbers
+[1234 1234i 1234j]
+[.234 .234j 2.23i]
+[23e2 12E1j 123D-4 0x234]
+
+%strings
+'asda''a'
+"asda""a"
+
+%identifiers
+a + as123 - __asd__
+
+%operators
+-
++
+=
+==
+>
+<
+>=
+<=
+&
+~
+...
+break zeros default margin round ones rand
+ceil floor size clear zeros eye mean std cov
+error eval function
+abs acos atan asin cos cosh exp log prod sum
+log10 max min sign sin sinh sqrt tan reshape
+return
+case switch
+else elseif end if otherwise
+do for while
+try catch
+classdef properties events methods
+global persistent
+
+%one line comment
+%{ multi 
+line comment %}
+
+    </textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "octave",
+               version: 2,
+               singleLineStringErrors: false},
+        lineNumbers: true,
+        indentUnit: 4,
+        matchBrackets: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-octave</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/octave/octave.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,139 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("octave", function() {
+  function wordRegexp(words) {
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
+  }
+
+  var singleOperators = new RegExp("^[\\+\\-\\*/&|\\^~<>!@'\\\\]");
+  var singleDelimiters = new RegExp('^[\\(\\[\\{\\},:=;\\.]');
+  var doubleOperators = new RegExp("^((==)|(~=)|(<=)|(>=)|(<<)|(>>)|(\\.[\\+\\-\\*/\\^\\\\]))");
+  var doubleDelimiters = new RegExp("^((!=)|(\\+=)|(\\-=)|(\\*=)|(/=)|(&=)|(\\|=)|(\\^=))");
+  var tripleDelimiters = new RegExp("^((>>=)|(<<=))");
+  var expressionEnd = new RegExp("^[\\]\\)]");
+  var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*");
+
+  var builtins = wordRegexp([
+    'error', 'eval', 'function', 'abs', 'acos', 'atan', 'asin', 'cos',
+    'cosh', 'exp', 'log', 'prod', 'sum', 'log10', 'max', 'min', 'sign', 'sin', 'sinh',
+    'sqrt', 'tan', 'reshape', 'break', 'zeros', 'default', 'margin', 'round', 'ones',
+    'rand', 'syn', 'ceil', 'floor', 'size', 'clear', 'zeros', 'eye', 'mean', 'std', 'cov',
+    'det', 'eig', 'inv', 'norm', 'rank', 'trace', 'expm', 'logm', 'sqrtm', 'linspace', 'plot',
+    'title', 'xlabel', 'ylabel', 'legend', 'text', 'grid', 'meshgrid', 'mesh', 'num2str',
+    'fft', 'ifft', 'arrayfun', 'cellfun', 'input', 'fliplr', 'flipud', 'ismember'
+  ]);
+
+  var keywords = wordRegexp([
+    'return', 'case', 'switch', 'else', 'elseif', 'end', 'endif', 'endfunction',
+    'if', 'otherwise', 'do', 'for', 'while', 'try', 'catch', 'classdef', 'properties', 'events',
+    'methods', 'global', 'persistent', 'endfor', 'endwhile', 'printf', 'sprintf', 'disp', 'until',
+    'continue', 'pkg'
+  ]);
+
+
+  // tokenizers
+  function tokenTranspose(stream, state) {
+    if (!stream.sol() && stream.peek() === '\'') {
+      stream.next();
+      state.tokenize = tokenBase;
+      return 'operator';
+    }
+    state.tokenize = tokenBase;
+    return tokenBase(stream, state);
+  }
+
+
+  function tokenComment(stream, state) {
+    if (stream.match(/^.*%}/)) {
+      state.tokenize = tokenBase;
+      return 'comment';
+    };
+    stream.skipToEnd();
+    return 'comment';
+  }
+
+  function tokenBase(stream, state) {
+    // whitespaces
+    if (stream.eatSpace()) return null;
+
+    // Handle one line Comments
+    if (stream.match('%{')){
+      state.tokenize = tokenComment;
+      stream.skipToEnd();
+      return 'comment';
+    }
+
+    if (stream.match(/^[%#]/)){
+      stream.skipToEnd();
+      return 'comment';
+    }
+
+    // Handle Number Literals
+    if (stream.match(/^[0-9\.+-]/, false)) {
+      if (stream.match(/^[+-]?0x[0-9a-fA-F]+[ij]?/)) {
+        stream.tokenize = tokenBase;
+        return 'number'; };
+      if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; };
+      if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?[ij]?/)) { return 'number'; };
+    }
+    if (stream.match(wordRegexp(['nan','NaN','inf','Inf']))) { return 'number'; };
+
+    // Handle Strings
+    var m = stream.match(/^"(?:[^"]|"")*("|$)/) || stream.match(/^'(?:[^']|'')*('|$)/)
+    if (m) { return m[1] ? 'string' : "string error"; }
+
+    // Handle words
+    if (stream.match(keywords)) { return 'keyword'; } ;
+    if (stream.match(builtins)) { return 'builtin'; } ;
+    if (stream.match(identifiers)) { return 'variable'; } ;
+
+    if (stream.match(singleOperators) || stream.match(doubleOperators)) { return 'operator'; };
+    if (stream.match(singleDelimiters) || stream.match(doubleDelimiters) || stream.match(tripleDelimiters)) { return null; };
+
+    if (stream.match(expressionEnd)) {
+      state.tokenize = tokenTranspose;
+      return null;
+    };
+
+
+    // Handle non-detected items
+    stream.next();
+    return 'error';
+  };
+
+
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase
+      };
+    },
+
+    token: function(stream, state) {
+      var style = state.tokenize(stream, state);
+      if (style === 'number' || style === 'variable'){
+        state.tokenize = tokenTranspose;
+      }
+      return style;
+    },
+
+    lineComment: '%',
+
+    fold: 'indent'
+  };
+});
+
+CodeMirror.defineMIME("text/x-octave", "octave");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/oz/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,59 @@
+<!doctype html>
+
+<title>CodeMirror: Oz mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="oz.js"></script>
+<script src="../../addon/runmode/runmode.js"></script>
+<style>
+  .CodeMirror {border: 1px solid #aaa;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Oz</a>
+  </ul>
+</div>
+
+<article>
+<h2>Oz mode</h2>
+<textarea id="code" name="code">
+declare
+fun {Ints N Max}
+  if N == Max then nil
+  else
+    {Delay 1000}
+    N|{Ints N+1 Max}
+  end
+end
+
+fun {Sum S Stream}
+  case Stream of nil then S
+  [] H|T then S|{Sum H+S T} end
+end
+
+local X Y in
+  thread X = {Ints 0 1000} end
+  thread Y = {Sum 0 X} end
+  {Browse Y}
+end
+</textarea>
+<p>MIME type defined: <code>text/x-oz</code>.</p>
+
+<script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    mode: "text/x-oz",
+    readOnly: false
+});
+</script>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/oz/oz.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,252 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("oz", function (conf) {
+
+  function wordRegexp(words) {
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
+  }
+
+  var singleOperators = /[\^@!\|<>#~\.\*\-\+\\/,=]/;
+  var doubleOperators = /(<-)|(:=)|(=<)|(>=)|(<=)|(<:)|(>:)|(=:)|(\\=)|(\\=:)|(!!)|(==)|(::)/;
+  var tripleOperators = /(:::)|(\.\.\.)|(=<:)|(>=:)/;
+
+  var middle = ["in", "then", "else", "of", "elseof", "elsecase", "elseif", "catch",
+    "finally", "with", "require", "prepare", "import", "export", "define", "do"];
+  var end = ["end"];
+
+  var atoms = wordRegexp(["true", "false", "nil", "unit"]);
+  var commonKeywords = wordRegexp(["andthen", "at", "attr", "declare", "feat", "from", "lex",
+    "mod", "div", "mode", "orelse", "parser", "prod", "prop", "scanner", "self", "syn", "token"]);
+  var openingKeywords = wordRegexp(["local", "proc", "fun", "case", "class", "if", "cond", "or", "dis",
+    "choice", "not", "thread", "try", "raise", "lock", "for", "suchthat", "meth", "functor"]);
+  var middleKeywords = wordRegexp(middle);
+  var endKeywords = wordRegexp(end);
+
+  // Tokenizers
+  function tokenBase(stream, state) {
+    if (stream.eatSpace()) {
+      return null;
+    }
+
+    // Brackets
+    if(stream.match(/[{}]/)) {
+      return "bracket";
+    }
+
+    // Special [] keyword
+    if (stream.match('[]')) {
+        return "keyword"
+    }
+
+    // Operators
+    if (stream.match(tripleOperators) || stream.match(doubleOperators)) {
+      return "operator";
+    }
+
+    // Atoms
+    if(stream.match(atoms)) {
+      return 'atom';
+    }
+
+    // Opening keywords
+    var matched = stream.match(openingKeywords);
+    if (matched) {
+      if (!state.doInCurrentLine)
+        state.currentIndent++;
+      else
+        state.doInCurrentLine = false;
+
+      // Special matching for signatures
+      if(matched[0] == "proc" || matched[0] == "fun")
+        state.tokenize = tokenFunProc;
+      else if(matched[0] == "class")
+        state.tokenize = tokenClass;
+      else if(matched[0] == "meth")
+        state.tokenize = tokenMeth;
+
+      return 'keyword';
+    }
+
+    // Middle and other keywords
+    if (stream.match(middleKeywords) || stream.match(commonKeywords)) {
+      return "keyword"
+    }
+
+    // End keywords
+    if (stream.match(endKeywords)) {
+      state.currentIndent--;
+      return 'keyword';
+    }
+
+    // Eat the next char for next comparisons
+    var ch = stream.next();
+
+    // Strings
+    if (ch == '"' || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+
+    // Numbers
+    if (/[~\d]/.test(ch)) {
+      if (ch == "~") {
+        if(! /^[0-9]/.test(stream.peek()))
+          return null;
+        else if (( stream.next() == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) || stream.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/))
+          return "number";
+      }
+
+      if ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/)) || stream.match(/^[0-9]*(\.[0-9]+)?([eE][~+]?[0-9]+)?/))
+        return "number";
+
+      return null;
+    }
+
+    // Comments
+    if (ch == "%") {
+      stream.skipToEnd();
+      return 'comment';
+    }
+    else if (ch == "/") {
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+    }
+
+    // Single operators
+    if(singleOperators.test(ch)) {
+      return "operator";
+    }
+
+    // If nothing match, we skip the entire alphanumeric block
+    stream.eatWhile(/\w/);
+
+    return "variable";
+  }
+
+  function tokenClass(stream, state) {
+    if (stream.eatSpace()) {
+      return null;
+    }
+    stream.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)/);
+    state.tokenize = tokenBase;
+    return "variable-3"
+  }
+
+  function tokenMeth(stream, state) {
+    if (stream.eatSpace()) {
+      return null;
+    }
+    stream.match(/([a-zA-Z][A-Za-z0-9_]*)|(`.+`)/);
+    state.tokenize = tokenBase;
+    return "def"
+  }
+
+  function tokenFunProc(stream, state) {
+    if (stream.eatSpace()) {
+      return null;
+    }
+
+    if(!state.hasPassedFirstStage && stream.eat("{")) {
+      state.hasPassedFirstStage = true;
+      return "bracket";
+    }
+    else if(state.hasPassedFirstStage) {
+      stream.match(/([A-Z][A-Za-z0-9_]*)|(`.+`)|\$/);
+      state.hasPassedFirstStage = false;
+      state.tokenize = tokenBase;
+      return "def"
+    }
+    else {
+      state.tokenize = tokenBase;
+      return null;
+    }
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function tokenString(quote) {
+    return function (stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {
+          end = true;
+          break;
+        }
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !escaped)
+        state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+
+  function buildElectricInputRegEx() {
+    // Reindentation should occur on [] or on a match of any of
+    // the block closing keywords, at the end of a line.
+    var allClosings = middle.concat(end);
+    return new RegExp("[\\[\\]]|(" + allClosings.join("|") + ")$");
+  }
+
+  return {
+
+    startState: function () {
+      return {
+        tokenize: tokenBase,
+        currentIndent: 0,
+        doInCurrentLine: false,
+        hasPassedFirstStage: false
+      };
+    },
+
+    token: function (stream, state) {
+      if (stream.sol())
+        state.doInCurrentLine = 0;
+
+      return state.tokenize(stream, state);
+    },
+
+    indent: function (state, textAfter) {
+      var trueText = textAfter.replace(/^\s+|\s+$/g, '');
+
+      if (trueText.match(endKeywords) || trueText.match(middleKeywords) || trueText.match(/(\[])/))
+        return conf.indentUnit * (state.currentIndent - 1);
+
+      if (state.currentIndent < 0)
+        return 0;
+
+      return state.currentIndent * conf.indentUnit;
+    },
+    fold: "indent",
+    electricInput: buildElectricInputRegEx(),
+    lineComment: "%",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/"
+  };
+});
+
+CodeMirror.defineMIME("text/x-oz", "oz");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pascal/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: Pascal mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="pascal.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Pascal</a>
+  </ul>
+</div>
+
+<article>
+<h2>Pascal mode</h2>
+
+
+<div><textarea id="code" name="code">
+(* Example Pascal code *)
+
+while a <> b do writeln('Waiting');
+ 
+if a > b then 
+  writeln('Condition met')
+else 
+  writeln('Condition not met');
+ 
+for i := 1 to 10 do 
+  writeln('Iteration: ', i:1);
+ 
+repeat
+  a := a + 1
+until a = 10;
+ 
+case i of
+  0: write('zero');
+  1: write('one');
+  2: write('two')
+end;
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "text/x-pascal"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-pascal</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pascal/pascal.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,136 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("pascal", function() {
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+  var keywords = words(
+    "absolute and array asm begin case const constructor destructor div do " +
+    "downto else end file for function goto if implementation in inherited " +
+    "inline interface label mod nil not object of operator or packed procedure " +
+    "program record reintroduce repeat self set shl shr string then to type " +
+    "unit until uses var while with xor as class dispinterface except exports " +
+    "finalization finally initialization inline is library on out packed " +
+    "property raise resourcestring threadvar try absolute abstract alias " +
+    "assembler bitpacked break cdecl continue cppdecl cvar default deprecated " +
+    "dynamic enumerator experimental export external far far16 forward generic " +
+    "helper implements index interrupt iocheck local message name near " +
+    "nodefault noreturn nostackframe oldfpccall otherwise overload override " +
+    "pascal platform private protected public published read register " +
+    "reintroduce result safecall saveregisters softfloat specialize static " +
+    "stdcall stored strict unaligned unimplemented varargs virtual write");
+  var atoms = {"null": true};
+
+  var isOperatorChar = /[+\-*&%=<>!?|\/]/;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == "#" && state.startOfLine) {
+      stream.skipToEnd();
+      return "meta";
+    }
+    if (ch == '"' || ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (ch == "(" && stream.eat("*")) {
+      state.tokenize = tokenComment;
+      return tokenComment(stream, state);
+    }
+    if (ch == "{") {
+      state.tokenize = tokenCommentBraces;
+      return tokenCommentBraces(stream, state);
+    }
+    if (/[\[\]\(\),;\:\.]/.test(ch)) {
+      return null;
+    }
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      return "number";
+    }
+    if (ch == "/") {
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_]/);
+    var cur = stream.current();
+    if (keywords.propertyIsEnumerable(cur)) return "keyword";
+    if (atoms.propertyIsEnumerable(cur)) return "atom";
+    return "variable";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !escaped) state.tokenize = null;
+      return "string";
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == ")" && maybeEnd) {
+        state.tokenize = null;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function tokenCommentBraces(stream, state) {
+    var ch;
+    while (ch = stream.next()) {
+      if (ch == "}") {
+        state.tokenize = null;
+        break;
+      }
+    }
+    return "comment";
+  }
+
+  // Interface
+
+  return {
+    startState: function() {
+      return {tokenize: null};
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta") return style;
+      return style;
+    },
+
+    electricChars: "{}"
+  };
+});
+
+CodeMirror.defineMIME("text/x-pascal", "pascal");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pegjs/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+<!doctype html>
+<html>
+  <head>
+    <title>CodeMirror: PEG.js Mode</title>
+    <meta charset="utf-8"/>
+    <link rel=stylesheet href="../../doc/docs.css">
+
+    <link rel="stylesheet" href="../../lib/codemirror.css">
+    <script src="../../lib/codemirror.js"></script>
+    <script src="../javascript/javascript.js"></script>
+    <script src="pegjs.js"></script>
+    <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+  </head>
+  <body>
+    <div id=nav>
+      <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+      <ul>
+        <li><a href="../../index.html">Home</a>
+        <li><a href="../../doc/manual.html">Manual</a>
+        <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+      </ul>
+      <ul>
+        <li><a href="../index.html">Language modes</a>
+        <li><a class=active href="#">PEG.js Mode</a>
+      </ul>
+    </div>
+
+    <article>
+      <h2>PEG.js Mode</h2>
+      <form><textarea id="code" name="code">
+/*
+ * Classic example grammar, which recognizes simple arithmetic expressions like
+ * "2*(3+4)". The parser generated from this grammar then computes their value.
+ */
+
+start
+  = additive
+
+additive
+  = left:multiplicative "+" right:additive { return left + right; }
+  / multiplicative
+
+multiplicative
+  = left:primary "*" right:multiplicative { return left * right; }
+  / primary
+
+primary
+  = integer
+  / "(" additive:additive ")" { return additive; }
+
+integer "integer"
+  = digits:[0-9]+ { return parseInt(digits.join(""), 10); }
+
+letter = [a-z]+</textarea></form>
+      <script>
+        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+          mode: {name: "pegjs"},
+          lineNumbers: true
+        });
+      </script>
+      <h3>The PEG.js Mode</h3>
+      <p> Created by Forbes Lindesay.</p>
+    </article>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pegjs/pegjs.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,111 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../javascript/javascript"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../javascript/javascript"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("pegjs", function (config) {
+  var jsMode = CodeMirror.getMode(config, "javascript");
+
+  function identifier(stream) {
+    return stream.match(/^[a-zA-Z_][a-zA-Z0-9_]*/);
+  }
+
+  return {
+    startState: function () {
+      return {
+        inString: false,
+        stringType: null,
+        inComment: false,
+        inCharacterClass: false,
+        braced: 0,
+        lhs: true,
+        localState: null
+      };
+    },
+    token: function (stream, state) {
+      //check for state changes
+      if (!state.inString && !state.inComment && ((stream.peek() == '"') || (stream.peek() == "'"))) {
+        state.stringType = stream.peek();
+        stream.next(); // Skip quote
+        state.inString = true; // Update state
+      }
+      if (!state.inString && !state.inComment && stream.match('/*')) {
+        state.inComment = true;
+      }
+
+      if (state.inString) {
+        while (state.inString && !stream.eol()) {
+          if (stream.peek() === state.stringType) {
+            stream.next(); // Skip quote
+            state.inString = false; // Clear flag
+          } else if (stream.peek() === '\\') {
+            stream.next();
+            stream.next();
+          } else {
+            stream.match(/^.[^\\\"\']*/);
+          }
+        }
+        return state.lhs ? "property string" : "string"; // Token style
+      } else if (state.inComment) {
+        while (state.inComment && !stream.eol()) {
+          if (stream.match('*/')) {
+            state.inComment = false; // Clear flag
+          } else {
+            stream.match(/^.[^\*]*/);
+          }
+        }
+        return "comment";
+      } else if (state.inCharacterClass) {
+          while (state.inCharacterClass && !stream.eol()) {
+            if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) {
+              state.inCharacterClass = false;
+            }
+          }
+      } else if (stream.peek() === '[') {
+        stream.next();
+        state.inCharacterClass = true;
+        return 'bracket';
+      } else if (stream.match('//')) {
+        stream.skipToEnd();
+        return "comment";
+      } else if (state.braced || stream.peek() === '{') {
+        if (state.localState === null) {
+          state.localState = CodeMirror.startState(jsMode);
+        }
+        var token = jsMode.token(stream, state.localState);
+        var text = stream.current();
+        if (!token) {
+          for (var i = 0; i < text.length; i++) {
+            if (text[i] === '{') {
+              state.braced++;
+            } else if (text[i] === '}') {
+              state.braced--;
+            }
+          };
+        }
+        return token;
+      } else if (identifier(stream)) {
+        if (stream.peek() === ':') {
+          return 'variable';
+        }
+        return 'variable-2';
+      } else if (['[', ']', '(', ')'].indexOf(stream.peek()) != -1) {
+        stream.next();
+        return 'bracket';
+      } else if (!stream.eatSpace()) {
+        stream.next();
+      }
+      return null;
+    }
+  };
+}, "javascript");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/perl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,75 @@
+<!doctype html>
+
+<title>CodeMirror: Perl mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="perl.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Perl</a>
+  </ul>
+</div>
+
+<article>
+<h2>Perl mode</h2>
+
+
+<div><textarea id="code" name="code">
+#!/usr/bin/perl
+
+use Something qw(func1 func2);
+
+# strings
+my $s1 = qq'single line';
+our $s2 = q(multi-
+              line);
+
+=item Something
+	Example.
+=cut
+
+my $html=<<'HTML'
+<html>
+<title>hi!</title>
+</html>
+HTML
+
+print "first,".join(',', 'second', qq~third~);
+
+if($s1 =~ m[(?<!\s)(l.ne)\z]o) {
+	$h->{$1}=$$.' predefined variables';
+	$s2 =~ s/\-line//ox;
+	$s1 =~ s[
+		  line ]
+		[
+		  block
+		]ox;
+}
+
+1; # numbers and comments
+
+__END__
+something...
+
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-perl</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/perl/perl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,836 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// CodeMirror2 mode/perl/perl.js (text/x-perl) beta 0.10 (2011-11-08)
+// This is a part of CodeMirror from https://github.com/sabaca/CodeMirror_mode_perl (mail@sabaca.com)
+
+(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.defineMode("perl",function(){
+        // http://perldoc.perl.org
+        var PERL={                                      //   null - magic touch
+                                                        //   1 - keyword
+                                                        //   2 - def
+                                                        //   3 - atom
+                                                        //   4 - operator
+                                                        //   5 - variable-2 (predefined)
+                                                        //   [x,y] - x=1,2,3; y=must be defined if x{...}
+                                                //      PERL operators
+                '->'                            :   4,
+                '++'                            :   4,
+                '--'                            :   4,
+                '**'                            :   4,
+                                                        //   ! ~ \ and unary + and -
+                '=~'                            :   4,
+                '!~'                            :   4,
+                '*'                             :   4,
+                '/'                             :   4,
+                '%'                             :   4,
+                'x'                             :   4,
+                '+'                             :   4,
+                '-'                             :   4,
+                '.'                             :   4,
+                '<<'                            :   4,
+                '>>'                            :   4,
+                                                        //   named unary operators
+                '<'                             :   4,
+                '>'                             :   4,
+                '<='                            :   4,
+                '>='                            :   4,
+                'lt'                            :   4,
+                'gt'                            :   4,
+                'le'                            :   4,
+                'ge'                            :   4,
+                '=='                            :   4,
+                '!='                            :   4,
+                '<=>'                           :   4,
+                'eq'                            :   4,
+                'ne'                            :   4,
+                'cmp'                           :   4,
+                '~~'                            :   4,
+                '&'                             :   4,
+                '|'                             :   4,
+                '^'                             :   4,
+                '&&'                            :   4,
+                '||'                            :   4,
+                '//'                            :   4,
+                '..'                            :   4,
+                '...'                           :   4,
+                '?'                             :   4,
+                ':'                             :   4,
+                '='                             :   4,
+                '+='                            :   4,
+                '-='                            :   4,
+                '*='                            :   4,  //   etc. ???
+                ','                             :   4,
+                '=>'                            :   4,
+                '::'                            :   4,
+                                                        //   list operators (rightward)
+                'not'                           :   4,
+                'and'                           :   4,
+                'or'                            :   4,
+                'xor'                           :   4,
+                                                //      PERL predefined variables (I know, what this is a paranoid idea, but may be needed for people, who learn PERL, and for me as well, ...and may be for you?;)
+                'BEGIN'                         :   [5,1],
+                'END'                           :   [5,1],
+                'PRINT'                         :   [5,1],
+                'PRINTF'                        :   [5,1],
+                'GETC'                          :   [5,1],
+                'READ'                          :   [5,1],
+                'READLINE'                      :   [5,1],
+                'DESTROY'                       :   [5,1],
+                'TIE'                           :   [5,1],
+                'TIEHANDLE'                     :   [5,1],
+                'UNTIE'                         :   [5,1],
+                'STDIN'                         :    5,
+                'STDIN_TOP'                     :    5,
+                'STDOUT'                        :    5,
+                'STDOUT_TOP'                    :    5,
+                'STDERR'                        :    5,
+                'STDERR_TOP'                    :    5,
+                '$ARG'                          :    5,
+                '$_'                            :    5,
+                '@ARG'                          :    5,
+                '@_'                            :    5,
+                '$LIST_SEPARATOR'               :    5,
+                '$"'                            :    5,
+                '$PROCESS_ID'                   :    5,
+                '$PID'                          :    5,
+                '$$'                            :    5,
+                '$REAL_GROUP_ID'                :    5,
+                '$GID'                          :    5,
+                '$('                            :    5,
+                '$EFFECTIVE_GROUP_ID'           :    5,
+                '$EGID'                         :    5,
+                '$)'                            :    5,
+                '$PROGRAM_NAME'                 :    5,
+                '$0'                            :    5,
+                '$SUBSCRIPT_SEPARATOR'          :    5,
+                '$SUBSEP'                       :    5,
+                '$;'                            :    5,
+                '$REAL_USER_ID'                 :    5,
+                '$UID'                          :    5,
+                '$<'                            :    5,
+                '$EFFECTIVE_USER_ID'            :    5,
+                '$EUID'                         :    5,
+                '$>'                            :    5,
+                '$a'                            :    5,
+                '$b'                            :    5,
+                '$COMPILING'                    :    5,
+                '$^C'                           :    5,
+                '$DEBUGGING'                    :    5,
+                '$^D'                           :    5,
+                '${^ENCODING}'                  :    5,
+                '$ENV'                          :    5,
+                '%ENV'                          :    5,
+                '$SYSTEM_FD_MAX'                :    5,
+                '$^F'                           :    5,
+                '@F'                            :    5,
+                '${^GLOBAL_PHASE}'              :    5,
+                '$^H'                           :    5,
+                '%^H'                           :    5,
+                '@INC'                          :    5,
+                '%INC'                          :    5,
+                '$INPLACE_EDIT'                 :    5,
+                '$^I'                           :    5,
+                '$^M'                           :    5,
+                '$OSNAME'                       :    5,
+                '$^O'                           :    5,
+                '${^OPEN}'                      :    5,
+                '$PERLDB'                       :    5,
+                '$^P'                           :    5,
+                '$SIG'                          :    5,
+                '%SIG'                          :    5,
+                '$BASETIME'                     :    5,
+                '$^T'                           :    5,
+                '${^TAINT}'                     :    5,
+                '${^UNICODE}'                   :    5,
+                '${^UTF8CACHE}'                 :    5,
+                '${^UTF8LOCALE}'                :    5,
+                '$PERL_VERSION'                 :    5,
+                '$^V'                           :    5,
+                '${^WIN32_SLOPPY_STAT}'         :    5,
+                '$EXECUTABLE_NAME'              :    5,
+                '$^X'                           :    5,
+                '$1'                            :    5, // - regexp $1, $2...
+                '$MATCH'                        :    5,
+                '$&'                            :    5,
+                '${^MATCH}'                     :    5,
+                '$PREMATCH'                     :    5,
+                '$`'                            :    5,
+                '${^PREMATCH}'                  :    5,
+                '$POSTMATCH'                    :    5,
+                "$'"                            :    5,
+                '${^POSTMATCH}'                 :    5,
+                '$LAST_PAREN_MATCH'             :    5,
+                '$+'                            :    5,
+                '$LAST_SUBMATCH_RESULT'         :    5,
+                '$^N'                           :    5,
+                '@LAST_MATCH_END'               :    5,
+                '@+'                            :    5,
+                '%LAST_PAREN_MATCH'             :    5,
+                '%+'                            :    5,
+                '@LAST_MATCH_START'             :    5,
+                '@-'                            :    5,
+                '%LAST_MATCH_START'             :    5,
+                '%-'                            :    5,
+                '$LAST_REGEXP_CODE_RESULT'      :    5,
+                '$^R'                           :    5,
+                '${^RE_DEBUG_FLAGS}'            :    5,
+                '${^RE_TRIE_MAXBUF}'            :    5,
+                '$ARGV'                         :    5,
+                '@ARGV'                         :    5,
+                'ARGV'                          :    5,
+                'ARGVOUT'                       :    5,
+                '$OUTPUT_FIELD_SEPARATOR'       :    5,
+                '$OFS'                          :    5,
+                '$,'                            :    5,
+                '$INPUT_LINE_NUMBER'            :    5,
+                '$NR'                           :    5,
+                '$.'                            :    5,
+                '$INPUT_RECORD_SEPARATOR'       :    5,
+                '$RS'                           :    5,
+                '$/'                            :    5,
+                '$OUTPUT_RECORD_SEPARATOR'      :    5,
+                '$ORS'                          :    5,
+                '$\\'                           :    5,
+                '$OUTPUT_AUTOFLUSH'             :    5,
+                '$|'                            :    5,
+                '$ACCUMULATOR'                  :    5,
+                '$^A'                           :    5,
+                '$FORMAT_FORMFEED'              :    5,
+                '$^L'                           :    5,
+                '$FORMAT_PAGE_NUMBER'           :    5,
+                '$%'                            :    5,
+                '$FORMAT_LINES_LEFT'            :    5,
+                '$-'                            :    5,
+                '$FORMAT_LINE_BREAK_CHARACTERS' :    5,
+                '$:'                            :    5,
+                '$FORMAT_LINES_PER_PAGE'        :    5,
+                '$='                            :    5,
+                '$FORMAT_TOP_NAME'              :    5,
+                '$^'                            :    5,
+                '$FORMAT_NAME'                  :    5,
+                '$~'                            :    5,
+                '${^CHILD_ERROR_NATIVE}'        :    5,
+                '$EXTENDED_OS_ERROR'            :    5,
+                '$^E'                           :    5,
+                '$EXCEPTIONS_BEING_CAUGHT'      :    5,
+                '$^S'                           :    5,
+                '$WARNING'                      :    5,
+                '$^W'                           :    5,
+                '${^WARNING_BITS}'              :    5,
+                '$OS_ERROR'                     :    5,
+                '$ERRNO'                        :    5,
+                '$!'                            :    5,
+                '%OS_ERROR'                     :    5,
+                '%ERRNO'                        :    5,
+                '%!'                            :    5,
+                '$CHILD_ERROR'                  :    5,
+                '$?'                            :    5,
+                '$EVAL_ERROR'                   :    5,
+                '$@'                            :    5,
+                '$OFMT'                         :    5,
+                '$#'                            :    5,
+                '$*'                            :    5,
+                '$ARRAY_BASE'                   :    5,
+                '$['                            :    5,
+                '$OLD_PERL_VERSION'             :    5,
+                '$]'                            :    5,
+                                                //      PERL blocks
+                'if'                            :[1,1],
+                elsif                           :[1,1],
+                'else'                          :[1,1],
+                'while'                         :[1,1],
+                unless                          :[1,1],
+                'for'                           :[1,1],
+                foreach                         :[1,1],
+                                                //      PERL functions
+                'abs'                           :1,     // - absolute value function
+                accept                          :1,     // - accept an incoming socket connect
+                alarm                           :1,     // - schedule a SIGALRM
+                'atan2'                         :1,     // - arctangent of Y/X in the range -PI to PI
+                bind                            :1,     // - binds an address to a socket
+                binmode                         :1,     // - prepare binary files for I/O
+                bless                           :1,     // - create an object
+                bootstrap                       :1,     //
+                'break'                         :1,     // - break out of a "given" block
+                caller                          :1,     // - get context of the current subroutine call
+                chdir                           :1,     // - change your current working directory
+                chmod                           :1,     // - changes the permissions on a list of files
+                chomp                           :1,     // - remove a trailing record separator from a string
+                chop                            :1,     // - remove the last character from a string
+                chown                           :1,     // - change the ownership on a list of files
+                chr                             :1,     // - get character this number represents
+                chroot                          :1,     // - make directory new root for path lookups
+                close                           :1,     // - close file (or pipe or socket) handle
+                closedir                        :1,     // - close directory handle
+                connect                         :1,     // - connect to a remote socket
+                'continue'                      :[1,1], // - optional trailing block in a while or foreach
+                'cos'                           :1,     // - cosine function
+                crypt                           :1,     // - one-way passwd-style encryption
+                dbmclose                        :1,     // - breaks binding on a tied dbm file
+                dbmopen                         :1,     // - create binding on a tied dbm file
+                'default'                       :1,     //
+                defined                         :1,     // - test whether a value, variable, or function is defined
+                'delete'                        :1,     // - deletes a value from a hash
+                die                             :1,     // - raise an exception or bail out
+                'do'                            :1,     // - turn a BLOCK into a TERM
+                dump                            :1,     // - create an immediate core dump
+                each                            :1,     // - retrieve the next key/value pair from a hash
+                endgrent                        :1,     // - be done using group file
+                endhostent                      :1,     // - be done using hosts file
+                endnetent                       :1,     // - be done using networks file
+                endprotoent                     :1,     // - be done using protocols file
+                endpwent                        :1,     // - be done using passwd file
+                endservent                      :1,     // - be done using services file
+                eof                             :1,     // - test a filehandle for its end
+                'eval'                          :1,     // - catch exceptions or compile and run code
+                'exec'                          :1,     // - abandon this program to run another
+                exists                          :1,     // - test whether a hash key is present
+                exit                            :1,     // - terminate this program
+                'exp'                           :1,     // - raise I to a power
+                fcntl                           :1,     // - file control system call
+                fileno                          :1,     // - return file descriptor from filehandle
+                flock                           :1,     // - lock an entire file with an advisory lock
+                fork                            :1,     // - create a new process just like this one
+                format                          :1,     // - declare a picture format with use by the write() function
+                formline                        :1,     // - internal function used for formats
+                getc                            :1,     // - get the next character from the filehandle
+                getgrent                        :1,     // - get next group record
+                getgrgid                        :1,     // - get group record given group user ID
+                getgrnam                        :1,     // - get group record given group name
+                gethostbyaddr                   :1,     // - get host record given its address
+                gethostbyname                   :1,     // - get host record given name
+                gethostent                      :1,     // - get next hosts record
+                getlogin                        :1,     // - return who logged in at this tty
+                getnetbyaddr                    :1,     // - get network record given its address
+                getnetbyname                    :1,     // - get networks record given name
+                getnetent                       :1,     // - get next networks record
+                getpeername                     :1,     // - find the other end of a socket connection
+                getpgrp                         :1,     // - get process group
+                getppid                         :1,     // - get parent process ID
+                getpriority                     :1,     // - get current nice value
+                getprotobyname                  :1,     // - get protocol record given name
+                getprotobynumber                :1,     // - get protocol record numeric protocol
+                getprotoent                     :1,     // - get next protocols record
+                getpwent                        :1,     // - get next passwd record
+                getpwnam                        :1,     // - get passwd record given user login name
+                getpwuid                        :1,     // - get passwd record given user ID
+                getservbyname                   :1,     // - get services record given its name
+                getservbyport                   :1,     // - get services record given numeric port
+                getservent                      :1,     // - get next services record
+                getsockname                     :1,     // - retrieve the sockaddr for a given socket
+                getsockopt                      :1,     // - get socket options on a given socket
+                given                           :1,     //
+                glob                            :1,     // - expand filenames using wildcards
+                gmtime                          :1,     // - convert UNIX time into record or string using Greenwich time
+                'goto'                          :1,     // - create spaghetti code
+                grep                            :1,     // - locate elements in a list test true against a given criterion
+                hex                             :1,     // - convert a string to a hexadecimal number
+                'import'                        :1,     // - patch a module's namespace into your own
+                index                           :1,     // - find a substring within a string
+                'int'                           :1,     // - get the integer portion of a number
+                ioctl                           :1,     // - system-dependent device control system call
+                'join'                          :1,     // - join a list into a string using a separator
+                keys                            :1,     // - retrieve list of indices from a hash
+                kill                            :1,     // - send a signal to a process or process group
+                last                            :1,     // - exit a block prematurely
+                lc                              :1,     // - return lower-case version of a string
+                lcfirst                         :1,     // - return a string with just the next letter in lower case
+                length                          :1,     // - return the number of bytes in a string
+                'link'                          :1,     // - create a hard link in the filesystem
+                listen                          :1,     // - register your socket as a server
+                local                           : 2,    // - create a temporary value for a global variable (dynamic scoping)
+                localtime                       :1,     // - convert UNIX time into record or string using local time
+                lock                            :1,     // - get a thread lock on a variable, subroutine, or method
+                'log'                           :1,     // - retrieve the natural logarithm for a number
+                lstat                           :1,     // - stat a symbolic link
+                m                               :null,  // - match a string with a regular expression pattern
+                map                             :1,     // - apply a change to a list to get back a new list with the changes
+                mkdir                           :1,     // - create a directory
+                msgctl                          :1,     // - SysV IPC message control operations
+                msgget                          :1,     // - get SysV IPC message queue
+                msgrcv                          :1,     // - receive a SysV IPC message from a message queue
+                msgsnd                          :1,     // - send a SysV IPC message to a message queue
+                my                              : 2,    // - declare and assign a local variable (lexical scoping)
+                'new'                           :1,     //
+                next                            :1,     // - iterate a block prematurely
+                no                              :1,     // - unimport some module symbols or semantics at compile time
+                oct                             :1,     // - convert a string to an octal number
+                open                            :1,     // - open a file, pipe, or descriptor
+                opendir                         :1,     // - open a directory
+                ord                             :1,     // - find a character's numeric representation
+                our                             : 2,    // - declare and assign a package variable (lexical scoping)
+                pack                            :1,     // - convert a list into a binary representation
+                'package'                       :1,     // - declare a separate global namespace
+                pipe                            :1,     // - open a pair of connected filehandles
+                pop                             :1,     // - remove the last element from an array and return it
+                pos                             :1,     // - find or set the offset for the last/next m//g search
+                print                           :1,     // - output a list to a filehandle
+                printf                          :1,     // - output a formatted list to a filehandle
+                prototype                       :1,     // - get the prototype (if any) of a subroutine
+                push                            :1,     // - append one or more elements to an array
+                q                               :null,  // - singly quote a string
+                qq                              :null,  // - doubly quote a string
+                qr                              :null,  // - Compile pattern
+                quotemeta                       :null,  // - quote regular expression magic characters
+                qw                              :null,  // - quote a list of words
+                qx                              :null,  // - backquote quote a string
+                rand                            :1,     // - retrieve the next pseudorandom number
+                read                            :1,     // - fixed-length buffered input from a filehandle
+                readdir                         :1,     // - get a directory from a directory handle
+                readline                        :1,     // - fetch a record from a file
+                readlink                        :1,     // - determine where a symbolic link is pointing
+                readpipe                        :1,     // - execute a system command and collect standard output
+                recv                            :1,     // - receive a message over a Socket
+                redo                            :1,     // - start this loop iteration over again
+                ref                             :1,     // - find out the type of thing being referenced
+                rename                          :1,     // - change a filename
+                require                         :1,     // - load in external functions from a library at runtime
+                reset                           :1,     // - clear all variables of a given name
+                'return'                        :1,     // - get out of a function early
+                reverse                         :1,     // - flip a string or a list
+                rewinddir                       :1,     // - reset directory handle
+                rindex                          :1,     // - right-to-left substring search
+                rmdir                           :1,     // - remove a directory
+                s                               :null,  // - replace a pattern with a string
+                say                             :1,     // - print with newline
+                scalar                          :1,     // - force a scalar context
+                seek                            :1,     // - reposition file pointer for random-access I/O
+                seekdir                         :1,     // - reposition directory pointer
+                select                          :1,     // - reset default output or do I/O multiplexing
+                semctl                          :1,     // - SysV semaphore control operations
+                semget                          :1,     // - get set of SysV semaphores
+                semop                           :1,     // - SysV semaphore operations
+                send                            :1,     // - send a message over a socket
+                setgrent                        :1,     // - prepare group file for use
+                sethostent                      :1,     // - prepare hosts file for use
+                setnetent                       :1,     // - prepare networks file for use
+                setpgrp                         :1,     // - set the process group of a process
+                setpriority                     :1,     // - set a process's nice value
+                setprotoent                     :1,     // - prepare protocols file for use
+                setpwent                        :1,     // - prepare passwd file for use
+                setservent                      :1,     // - prepare services file for use
+                setsockopt                      :1,     // - set some socket options
+                shift                           :1,     // - remove the first element of an array, and return it
+                shmctl                          :1,     // - SysV shared memory operations
+                shmget                          :1,     // - get SysV shared memory segment identifier
+                shmread                         :1,     // - read SysV shared memory
+                shmwrite                        :1,     // - write SysV shared memory
+                shutdown                        :1,     // - close down just half of a socket connection
+                'sin'                           :1,     // - return the sine of a number
+                sleep                           :1,     // - block for some number of seconds
+                socket                          :1,     // - create a socket
+                socketpair                      :1,     // - create a pair of sockets
+                'sort'                          :1,     // - sort a list of values
+                splice                          :1,     // - add or remove elements anywhere in an array
+                'split'                         :1,     // - split up a string using a regexp delimiter
+                sprintf                         :1,     // - formatted print into a string
+                'sqrt'                          :1,     // - square root function
+                srand                           :1,     // - seed the random number generator
+                stat                            :1,     // - get a file's status information
+                state                           :1,     // - declare and assign a state variable (persistent lexical scoping)
+                study                           :1,     // - optimize input data for repeated searches
+                'sub'                           :1,     // - declare a subroutine, possibly anonymously
+                'substr'                        :1,     // - get or alter a portion of a string
+                symlink                         :1,     // - create a symbolic link to a file
+                syscall                         :1,     // - execute an arbitrary system call
+                sysopen                         :1,     // - open a file, pipe, or descriptor
+                sysread                         :1,     // - fixed-length unbuffered input from a filehandle
+                sysseek                         :1,     // - position I/O pointer on handle used with sysread and syswrite
+                system                          :1,     // - run a separate program
+                syswrite                        :1,     // - fixed-length unbuffered output to a filehandle
+                tell                            :1,     // - get current seekpointer on a filehandle
+                telldir                         :1,     // - get current seekpointer on a directory handle
+                tie                             :1,     // - bind a variable to an object class
+                tied                            :1,     // - get a reference to the object underlying a tied variable
+                time                            :1,     // - return number of seconds since 1970
+                times                           :1,     // - return elapsed time for self and child processes
+                tr                              :null,  // - transliterate a string
+                truncate                        :1,     // - shorten a file
+                uc                              :1,     // - return upper-case version of a string
+                ucfirst                         :1,     // - return a string with just the next letter in upper case
+                umask                           :1,     // - set file creation mode mask
+                undef                           :1,     // - remove a variable or function definition
+                unlink                          :1,     // - remove one link to a file
+                unpack                          :1,     // - convert binary structure into normal perl variables
+                unshift                         :1,     // - prepend more elements to the beginning of a list
+                untie                           :1,     // - break a tie binding to a variable
+                use                             :1,     // - load in a module at compile time
+                utime                           :1,     // - set a file's last access and modify times
+                values                          :1,     // - return a list of the values in a hash
+                vec                             :1,     // - test or set particular bits in a string
+                wait                            :1,     // - wait for any child process to die
+                waitpid                         :1,     // - wait for a particular child process to die
+                wantarray                       :1,     // - get void vs scalar vs list context of current subroutine call
+                warn                            :1,     // - print debugging info
+                when                            :1,     //
+                write                           :1,     // - print a picture record
+                y                               :null}; // - transliterate a string
+
+        var RXstyle="string-2";
+        var RXmodifiers=/[goseximacplud]/;              // NOTE: "m", "s", "y" and "tr" need to correct real modifiers for each regexp type
+
+        function tokenChain(stream,state,chain,style,tail){     // NOTE: chain.length > 2 is not working now (it's for s[...][...]geos;)
+                state.chain=null;                               //                                                          12   3tail
+                state.style=null;
+                state.tail=null;
+                state.tokenize=function(stream,state){
+                        var e=false,c,i=0;
+                        while(c=stream.next()){
+                                if(c===chain[i]&&!e){
+                                        if(chain[++i]!==undefined){
+                                                state.chain=chain[i];
+                                                state.style=style;
+                                                state.tail=tail;}
+                                        else if(tail)
+                                                stream.eatWhile(tail);
+                                        state.tokenize=tokenPerl;
+                                        return style;}
+                                e=!e&&c=="\\";}
+                        return style;};
+                return state.tokenize(stream,state);}
+
+        function tokenSOMETHING(stream,state,string){
+                state.tokenize=function(stream,state){
+                        if(stream.string==string)
+                                state.tokenize=tokenPerl;
+                        stream.skipToEnd();
+                        return "string";};
+                return state.tokenize(stream,state);}
+
+        function tokenPerl(stream,state){
+                if(stream.eatSpace())
+                        return null;
+                if(state.chain)
+                        return tokenChain(stream,state,state.chain,state.style,state.tail);
+                if(stream.match(/^(\-?((\d[\d_]*)?\.\d+(e[+-]?\d+)?|\d+\.\d*)|0x[\da-fA-F_]+|0b[01_]+|\d[\d_]*(e[+-]?\d+)?)/))
+                        return 'number';
+                if(stream.match(/^<<(?=[_a-zA-Z])/)){                  // NOTE: <<SOMETHING\n...\nSOMETHING\n
+                        stream.eatWhile(/\w/);
+                        return tokenSOMETHING(stream,state,stream.current().substr(2));}
+                if(stream.sol()&&stream.match(/^\=item(?!\w)/)){// NOTE: \n=item...\n=cut\n
+                        return tokenSOMETHING(stream,state,'=cut');}
+                var ch=stream.next();
+                if(ch=='"'||ch=="'"){                           // NOTE: ' or " or <<'SOMETHING'\n...\nSOMETHING\n or <<"SOMETHING"\n...\nSOMETHING\n
+                        if(prefix(stream, 3)=="<<"+ch){
+                                var p=stream.pos;
+                                stream.eatWhile(/\w/);
+                                var n=stream.current().substr(1);
+                                if(n&&stream.eat(ch))
+                                        return tokenSOMETHING(stream,state,n);
+                                stream.pos=p;}
+                        return tokenChain(stream,state,[ch],"string");}
+                if(ch=="q"){
+                        var c=look(stream, -2);
+                        if(!(c&&/\w/.test(c))){
+                                c=look(stream, 0);
+                                if(c=="x"){
+                                        c=look(stream, 1);
+                                        if(c=="("){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
+                                        if(c=="["){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
+                                        if(c=="{"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
+                                        if(c=="<"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
+                                        if(/[\^'"!~\/]/.test(c)){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
+                                else if(c=="q"){
+                                        c=look(stream, 1);
+                                        if(c=="("){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[")"],"string");}
+                                        if(c=="["){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["]"],"string");}
+                                        if(c=="{"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["}"],"string");}
+                                        if(c=="<"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[">"],"string");}
+                                        if(/[\^'"!~\/]/.test(c)){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,[stream.eat(c)],"string");}}
+                                else if(c=="w"){
+                                        c=look(stream, 1);
+                                        if(c=="("){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[")"],"bracket");}
+                                        if(c=="["){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["]"],"bracket");}
+                                        if(c=="{"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["}"],"bracket");}
+                                        if(c=="<"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[">"],"bracket");}
+                                        if(/[\^'"!~\/]/.test(c)){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,[stream.eat(c)],"bracket");}}
+                                else if(c=="r"){
+                                        c=look(stream, 1);
+                                        if(c=="("){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
+                                        if(c=="["){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
+                                        if(c=="{"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
+                                        if(c=="<"){
+                                                eatSuffix(stream, 2);
+                                                return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}
+                                        if(/[\^'"!~\/]/.test(c)){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,[stream.eat(c)],RXstyle,RXmodifiers);}}
+                                else if(/[\^'"!~\/(\[{<]/.test(c)){
+                                        if(c=="("){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,[")"],"string");}
+                                        if(c=="["){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,["]"],"string");}
+                                        if(c=="{"){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,["}"],"string");}
+                                        if(c=="<"){
+                                                eatSuffix(stream, 1);
+                                                return tokenChain(stream,state,[">"],"string");}
+                                        if(/[\^'"!~\/]/.test(c)){
+                                                return tokenChain(stream,state,[stream.eat(c)],"string");}}}}
+                if(ch=="m"){
+                        var c=look(stream, -2);
+                        if(!(c&&/\w/.test(c))){
+                                c=stream.eat(/[(\[{<\^'"!~\/]/);
+                                if(c){
+                                        if(/[\^'"!~\/]/.test(c)){
+                                                return tokenChain(stream,state,[c],RXstyle,RXmodifiers);}
+                                        if(c=="("){
+                                                return tokenChain(stream,state,[")"],RXstyle,RXmodifiers);}
+                                        if(c=="["){
+                                                return tokenChain(stream,state,["]"],RXstyle,RXmodifiers);}
+                                        if(c=="{"){
+                                                return tokenChain(stream,state,["}"],RXstyle,RXmodifiers);}
+                                        if(c=="<"){
+                                                return tokenChain(stream,state,[">"],RXstyle,RXmodifiers);}}}}
+                if(ch=="s"){
+                        var c=/[\/>\]})\w]/.test(look(stream, -2));
+                        if(!c){
+                                c=stream.eat(/[(\[{<\^'"!~\/]/);
+                                if(c){
+                                        if(c=="[")
+                                                return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
+                                        if(c=="{")
+                                                return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
+                                        if(c=="<")
+                                                return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
+                                        if(c=="(")
+                                                return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
+                                        return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
+                if(ch=="y"){
+                        var c=/[\/>\]})\w]/.test(look(stream, -2));
+                        if(!c){
+                                c=stream.eat(/[(\[{<\^'"!~\/]/);
+                                if(c){
+                                        if(c=="[")
+                                                return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
+                                        if(c=="{")
+                                                return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
+                                        if(c=="<")
+                                                return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
+                                        if(c=="(")
+                                                return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
+                                        return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}
+                if(ch=="t"){
+                        var c=/[\/>\]})\w]/.test(look(stream, -2));
+                        if(!c){
+                                c=stream.eat("r");if(c){
+                                c=stream.eat(/[(\[{<\^'"!~\/]/);
+                                if(c){
+                                        if(c=="[")
+                                                return tokenChain(stream,state,["]","]"],RXstyle,RXmodifiers);
+                                        if(c=="{")
+                                                return tokenChain(stream,state,["}","}"],RXstyle,RXmodifiers);
+                                        if(c=="<")
+                                                return tokenChain(stream,state,[">",">"],RXstyle,RXmodifiers);
+                                        if(c=="(")
+                                                return tokenChain(stream,state,[")",")"],RXstyle,RXmodifiers);
+                                        return tokenChain(stream,state,[c,c],RXstyle,RXmodifiers);}}}}
+                if(ch=="`"){
+                        return tokenChain(stream,state,[ch],"variable-2");}
+                if(ch=="/"){
+                        if(!/~\s*$/.test(prefix(stream)))
+                                return "operator";
+                        else
+                                return tokenChain(stream,state,[ch],RXstyle,RXmodifiers);}
+                if(ch=="$"){
+                        var p=stream.pos;
+                        if(stream.eatWhile(/\d/)||stream.eat("{")&&stream.eatWhile(/\d/)&&stream.eat("}"))
+                                return "variable-2";
+                        else
+                                stream.pos=p;}
+                if(/[$@%]/.test(ch)){
+                        var p=stream.pos;
+                        if(stream.eat("^")&&stream.eat(/[A-Z]/)||!/[@$%&]/.test(look(stream, -2))&&stream.eat(/[=|\\\-#?@;:&`~\^!\[\]*'"$+.,\/<>()]/)){
+                                var c=stream.current();
+                                if(PERL[c])
+                                        return "variable-2";}
+                        stream.pos=p;}
+                if(/[$@%&]/.test(ch)){
+                        if(stream.eatWhile(/[\w$]/)||stream.eat("{")&&stream.eatWhile(/[\w$]/)&&stream.eat("}")){
+                                var c=stream.current();
+                                if(PERL[c])
+                                        return "variable-2";
+                                else
+                                        return "variable";}}
+                if(ch=="#"){
+                        if(look(stream, -2)!="$"){
+                                stream.skipToEnd();
+                                return "comment";}}
+                if(/[:+\-\^*$&%@=<>!?|\/~\.]/.test(ch)){
+                        var p=stream.pos;
+                        stream.eatWhile(/[:+\-\^*$&%@=<>!?|\/~\.]/);
+                        if(PERL[stream.current()])
+                                return "operator";
+                        else
+                                stream.pos=p;}
+                if(ch=="_"){
+                        if(stream.pos==1){
+                                if(suffix(stream, 6)=="_END__"){
+                                        return tokenChain(stream,state,['\0'],"comment");}
+                                else if(suffix(stream, 7)=="_DATA__"){
+                                        return tokenChain(stream,state,['\0'],"variable-2");}
+                                else if(suffix(stream, 7)=="_C__"){
+                                        return tokenChain(stream,state,['\0'],"string");}}}
+                if(/\w/.test(ch)){
+                        var p=stream.pos;
+                        if(look(stream, -2)=="{"&&(look(stream, 0)=="}"||stream.eatWhile(/\w/)&&look(stream, 0)=="}"))
+                                return "string";
+                        else
+                                stream.pos=p;}
+                if(/[A-Z]/.test(ch)){
+                        var l=look(stream, -2);
+                        var p=stream.pos;
+                        stream.eatWhile(/[A-Z_]/);
+                        if(/[\da-z]/.test(look(stream, 0))){
+                                stream.pos=p;}
+                        else{
+                                var c=PERL[stream.current()];
+                                if(!c)
+                                        return "meta";
+                                if(c[1])
+                                        c=c[0];
+                                if(l!=":"){
+                                        if(c==1)
+                                                return "keyword";
+                                        else if(c==2)
+                                                return "def";
+                                        else if(c==3)
+                                                return "atom";
+                                        else if(c==4)
+                                                return "operator";
+                                        else if(c==5)
+                                                return "variable-2";
+                                        else
+                                                return "meta";}
+                                else
+                                        return "meta";}}
+                if(/[a-zA-Z_]/.test(ch)){
+                        var l=look(stream, -2);
+                        stream.eatWhile(/\w/);
+                        var c=PERL[stream.current()];
+                        if(!c)
+                                return "meta";
+                        if(c[1])
+                                c=c[0];
+                        if(l!=":"){
+                                if(c==1)
+                                        return "keyword";
+                                else if(c==2)
+                                        return "def";
+                                else if(c==3)
+                                        return "atom";
+                                else if(c==4)
+                                        return "operator";
+                                else if(c==5)
+                                        return "variable-2";
+                                else
+                                        return "meta";}
+                        else
+                                return "meta";}
+                return null;}
+
+        return {
+            startState: function() {
+                return {
+                    tokenize: tokenPerl,
+                    chain: null,
+                    style: null,
+                    tail: null
+                };
+            },
+            token: function(stream, state) {
+                return (state.tokenize || tokenPerl)(stream, state);
+            },
+            lineComment: '#'
+        };
+});
+
+CodeMirror.registerHelper("wordChars", "perl", /[\w$]/);
+
+CodeMirror.defineMIME("text/x-perl", "perl");
+
+// it's like "peek", but need for look-ahead or look-behind if index < 0
+function look(stream, c){
+  return stream.string.charAt(stream.pos+(c||0));
+}
+
+// return a part of prefix of current stream from current position
+function prefix(stream, c){
+  if(c){
+    var x=stream.pos-c;
+    return stream.string.substr((x>=0?x:0),c);}
+  else{
+    return stream.string.substr(0,stream.pos-1);
+  }
+}
+
+// return a part of suffix of current stream from current position
+function suffix(stream, c){
+  var y=stream.string.length;
+  var x=y-stream.pos+1;
+  return stream.string.substr(stream.pos,(c&&c<y?c:x));
+}
+
+// eating and vomiting a part of stream from current position
+function eatSuffix(stream, c){
+  var x=stream.pos+c;
+  var y;
+  if(x<=0)
+    stream.pos=0;
+  else if(x>=(y=stream.string.length-1))
+    stream.pos=y;
+  else
+    stream.pos=x;
+}
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/php/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,64 @@
+<!doctype html>
+
+<title>CodeMirror: PHP mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../clike/clike.js"></script>
+<script src="php.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">PHP</a>
+  </ul>
+</div>
+
+<article>
+<h2>PHP mode</h2>
+<form><textarea id="code" name="code">
+<?php
+$a = array('a' => 1, 'b' => 2, 3 => 'c');
+
+echo "$a[a] ${a[3] /* } comment */} {$a[b]} \$a[a]";
+
+function hello($who) {
+	return "Hello $who!";
+}
+?>
+<p>The program says <?= hello("World") ?>.</p>
+<script>
+	alert("And here is some JS code"); // also colored
+</script>
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "application/x-httpd-php",
+        indentUnit: 4,
+        indentWithTabs: true
+      });
+    </script>
+
+    <p>Simple HTML/PHP mode based on
+    the <a href="../clike/">C-like</a> mode. Depends on XML,
+    JavaScript, CSS, HTMLMixed, and C-like modes.</p>
+
+    <p><strong>MIME types defined:</strong> <code>application/x-httpd-php</code> (HTML with PHP code), <code>text/x-php</code> (plain, non-wrapped PHP code).</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/php/php.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,234 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../clike/clike"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../clike/clike"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  function keywords(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  // Helper for phpString
+  function matchSequence(list, end, escapes) {
+    if (list.length == 0) return phpString(end);
+    return function (stream, state) {
+      var patterns = list[0];
+      for (var i = 0; i < patterns.length; i++) if (stream.match(patterns[i][0])) {
+        state.tokenize = matchSequence(list.slice(1), end);
+        return patterns[i][1];
+      }
+      state.tokenize = phpString(end, escapes);
+      return "string";
+    };
+  }
+  function phpString(closing, escapes) {
+    return function(stream, state) { return phpString_(stream, state, closing, escapes); };
+  }
+  function phpString_(stream, state, closing, escapes) {
+    // "Complex" syntax
+    if (escapes !== false && stream.match("${", false) || stream.match("{$", false)) {
+      state.tokenize = null;
+      return "string";
+    }
+
+    // Simple syntax
+    if (escapes !== false && stream.match(/^\$[a-zA-Z_][a-zA-Z0-9_]*/)) {
+      // After the variable name there may appear array or object operator.
+      if (stream.match("[", false)) {
+        // Match array operator
+        state.tokenize = matchSequence([
+          [["[", null]],
+          [[/\d[\w\.]*/, "number"],
+           [/\$[a-zA-Z_][a-zA-Z0-9_]*/, "variable-2"],
+           [/[\w\$]+/, "variable"]],
+          [["]", null]]
+        ], closing, escapes);
+      }
+      if (stream.match(/^->\w/, false)) {
+        // Match object operator
+        state.tokenize = matchSequence([
+          [["->", null]],
+          [[/[\w]+/, "variable"]]
+        ], closing, escapes);
+      }
+      return "variable-2";
+    }
+
+    var escaped = false;
+    // Normal string
+    while (!stream.eol() &&
+           (escaped || escapes === false ||
+            (!stream.match("{$", false) &&
+             !stream.match(/^(\$[a-zA-Z_][a-zA-Z0-9_]*|\$\{)/, false)))) {
+      if (!escaped && stream.match(closing)) {
+        state.tokenize = null;
+        state.tokStack.pop(); state.tokStack.pop();
+        break;
+      }
+      escaped = stream.next() == "\\" && !escaped;
+    }
+    return "string";
+  }
+
+  var phpKeywords = "abstract and array as break case catch class clone const continue declare default " +
+    "do else elseif enddeclare endfor endforeach endif endswitch endwhile enum extends final " +
+    "for foreach function global goto if implements interface instanceof namespace " +
+    "new or private protected public static switch throw trait try use var while xor " +
+    "die echo empty exit eval include include_once isset list require require_once return " +
+    "print unset __halt_compiler self static parent yield insteadof finally readonly match";
+  var phpAtoms = "true false null TRUE FALSE NULL __CLASS__ __DIR__ __FILE__ __LINE__ __METHOD__ __FUNCTION__ __NAMESPACE__ __TRAIT__";
+  var phpBuiltin = "func_num_args func_get_arg func_get_args strlen strcmp strncmp strcasecmp strncasecmp each error_reporting define defined trigger_error user_error set_error_handler restore_error_handler get_declared_classes get_loaded_extensions extension_loaded get_extension_funcs debug_backtrace constant bin2hex hex2bin sleep usleep time mktime gmmktime strftime gmstrftime strtotime date gmdate getdate localtime checkdate flush wordwrap htmlspecialchars htmlentities html_entity_decode md5 md5_file crc32 getimagesize image_type_to_mime_type phpinfo phpversion phpcredits strnatcmp strnatcasecmp substr_count strspn strcspn strtok strtoupper strtolower strpos strrpos strrev hebrev hebrevc nl2br basename dirname pathinfo stripslashes stripcslashes strstr stristr strrchr str_shuffle str_word_count strcoll substr substr_replace quotemeta ucfirst ucwords strtr addslashes addcslashes rtrim str_replace str_repeat count_chars chunk_split trim ltrim strip_tags similar_text explode implode setlocale localeconv parse_str str_pad chop strchr sprintf printf vprintf vsprintf sscanf fscanf parse_url urlencode urldecode rawurlencode rawurldecode readlink linkinfo link unlink exec system escapeshellcmd escapeshellarg passthru shell_exec proc_open proc_close rand srand getrandmax mt_rand mt_srand mt_getrandmax base64_decode base64_encode abs ceil floor round is_finite is_nan is_infinite bindec hexdec octdec decbin decoct dechex base_convert number_format fmod ip2long long2ip getenv putenv getopt microtime gettimeofday getrusage uniqid quoted_printable_decode set_time_limit get_cfg_var magic_quotes_runtime set_magic_quotes_runtime get_magic_quotes_gpc get_magic_quotes_runtime import_request_variables error_log serialize unserialize memory_get_usage memory_get_peak_usage var_dump var_export debug_zval_dump print_r highlight_file show_source highlight_string ini_get ini_get_all ini_set ini_alter ini_restore get_include_path set_include_path restore_include_path setcookie header headers_sent connection_aborted connection_status ignore_user_abort parse_ini_file is_uploaded_file move_uploaded_file intval floatval doubleval strval gettype settype is_null is_resource is_bool is_long is_float is_int is_integer is_double is_real is_numeric is_string is_array is_object is_scalar ereg ereg_replace eregi eregi_replace split spliti join sql_regcase dl pclose popen readfile rewind rmdir umask fclose feof fgetc fgets fgetss fread fopen fpassthru ftruncate fstat fseek ftell fflush fwrite fputs mkdir rename copy tempnam tmpfile file file_get_contents file_put_contents stream_select stream_context_create stream_context_set_params stream_context_set_option stream_context_get_options stream_filter_prepend stream_filter_append fgetcsv flock get_meta_tags stream_set_write_buffer set_file_buffer set_socket_blocking stream_set_blocking socket_set_blocking stream_get_meta_data stream_register_wrapper stream_wrapper_register stream_set_timeout socket_set_timeout socket_get_status realpath fnmatch fsockopen pfsockopen pack unpack get_browser crypt opendir closedir chdir getcwd rewinddir readdir dir glob fileatime filectime filegroup fileinode filemtime fileowner fileperms filesize filetype file_exists is_writable is_writeable is_readable is_executable is_file is_dir is_link stat lstat chown touch clearstatcache mail ob_start ob_flush ob_clean ob_end_flush ob_end_clean ob_get_flush ob_get_clean ob_get_length ob_get_level ob_get_status ob_get_contents ob_implicit_flush ob_list_handlers ksort krsort natsort natcasesort asort arsort sort rsort usort uasort uksort shuffle array_walk count end prev next reset current key min max in_array array_search extract compact array_fill range array_multisort array_push array_pop array_shift array_unshift array_splice array_slice array_merge array_merge_recursive array_keys array_values array_count_values array_reverse array_reduce array_pad array_flip array_change_key_case array_rand array_unique array_intersect array_intersect_assoc array_diff array_diff_assoc array_sum array_filter array_map array_chunk array_key_exists array_intersect_key array_combine array_column pos sizeof key_exists assert assert_options version_compare ftok str_rot13 aggregate session_name session_module_name session_save_path session_id session_regenerate_id session_decode session_register session_unregister session_is_registered session_encode session_start session_destroy session_unset session_set_save_handler session_cache_limiter session_cache_expire session_set_cookie_params session_get_cookie_params session_write_close preg_match preg_match_all preg_replace preg_replace_callback preg_split preg_quote preg_grep overload ctype_alnum ctype_alpha ctype_cntrl ctype_digit ctype_lower ctype_graph ctype_print ctype_punct ctype_space ctype_upper ctype_xdigit virtual apache_request_headers apache_note apache_lookup_uri apache_child_terminate apache_setenv apache_response_headers apache_get_version getallheaders mysql_connect mysql_pconnect mysql_close mysql_select_db mysql_create_db mysql_drop_db mysql_query mysql_unbuffered_query mysql_db_query mysql_list_dbs mysql_list_tables mysql_list_fields mysql_list_processes mysql_error mysql_errno mysql_affected_rows mysql_insert_id mysql_result mysql_num_rows mysql_num_fields mysql_fetch_row mysql_fetch_array mysql_fetch_assoc mysql_fetch_object mysql_data_seek mysql_fetch_lengths mysql_fetch_field mysql_field_seek mysql_free_result mysql_field_name mysql_field_table mysql_field_len mysql_field_type mysql_field_flags mysql_escape_string mysql_real_escape_string mysql_stat mysql_thread_id mysql_client_encoding mysql_get_client_info mysql_get_host_info mysql_get_proto_info mysql_get_server_info mysql_info mysql mysql_fieldname mysql_fieldtable mysql_fieldlen mysql_fieldtype mysql_fieldflags mysql_selectdb mysql_createdb mysql_dropdb mysql_freeresult mysql_numfields mysql_numrows mysql_listdbs mysql_listtables mysql_listfields mysql_db_name mysql_dbname mysql_tablename mysql_table_name pg_connect pg_pconnect pg_close pg_connection_status pg_connection_busy pg_connection_reset pg_host pg_dbname pg_port pg_tty pg_options pg_ping pg_query pg_send_query pg_cancel_query pg_fetch_result pg_fetch_row pg_fetch_assoc pg_fetch_array pg_fetch_object pg_fetch_all pg_affected_rows pg_get_result pg_result_seek pg_result_status pg_free_result pg_last_oid pg_num_rows pg_num_fields pg_field_name pg_field_num pg_field_size pg_field_type pg_field_prtlen pg_field_is_null pg_get_notify pg_get_pid pg_result_error pg_last_error pg_last_notice pg_put_line pg_end_copy pg_copy_to pg_copy_from pg_trace pg_untrace pg_lo_create pg_lo_unlink pg_lo_open pg_lo_close pg_lo_read pg_lo_write pg_lo_read_all pg_lo_import pg_lo_export pg_lo_seek pg_lo_tell pg_escape_string pg_escape_bytea pg_unescape_bytea pg_client_encoding pg_set_client_encoding pg_meta_data pg_convert pg_insert pg_update pg_delete pg_select pg_exec pg_getlastoid pg_cmdtuples pg_errormessage pg_numrows pg_numfields pg_fieldname pg_fieldsize pg_fieldtype pg_fieldnum pg_fieldprtlen pg_fieldisnull pg_freeresult pg_result pg_loreadall pg_locreate pg_lounlink pg_loopen pg_loclose pg_loread pg_lowrite pg_loimport pg_loexport http_response_code get_declared_traits getimagesizefromstring socket_import_stream stream_set_chunk_size trait_exists header_register_callback class_uses session_status session_register_shutdown echo print global static exit array empty eval isset unset die include require include_once require_once json_decode json_encode json_last_error json_last_error_msg curl_close curl_copy_handle curl_errno curl_error curl_escape curl_exec curl_file_create curl_getinfo curl_init curl_multi_add_handle curl_multi_close curl_multi_exec curl_multi_getcontent curl_multi_info_read curl_multi_init curl_multi_remove_handle curl_multi_select curl_multi_setopt curl_multi_strerror curl_pause curl_reset curl_setopt_array curl_setopt curl_share_close curl_share_init curl_share_setopt curl_strerror curl_unescape curl_version mysqli_affected_rows mysqli_autocommit mysqli_change_user mysqli_character_set_name mysqli_close mysqli_commit mysqli_connect_errno mysqli_connect_error mysqli_connect mysqli_data_seek mysqli_debug mysqli_dump_debug_info mysqli_errno mysqli_error_list mysqli_error mysqli_fetch_all mysqli_fetch_array mysqli_fetch_assoc mysqli_fetch_field_direct mysqli_fetch_field mysqli_fetch_fields mysqli_fetch_lengths mysqli_fetch_object mysqli_fetch_row mysqli_field_count mysqli_field_seek mysqli_field_tell mysqli_free_result mysqli_get_charset mysqli_get_client_info mysqli_get_client_stats mysqli_get_client_version mysqli_get_connection_stats mysqli_get_host_info mysqli_get_proto_info mysqli_get_server_info mysqli_get_server_version mysqli_info mysqli_init mysqli_insert_id mysqli_kill mysqli_more_results mysqli_multi_query mysqli_next_result mysqli_num_fields mysqli_num_rows mysqli_options mysqli_ping mysqli_prepare mysqli_query mysqli_real_connect mysqli_real_escape_string mysqli_real_query mysqli_reap_async_query mysqli_refresh mysqli_rollback mysqli_select_db mysqli_set_charset mysqli_set_local_infile_default mysqli_set_local_infile_handler mysqli_sqlstate mysqli_ssl_set mysqli_stat mysqli_stmt_init mysqli_store_result mysqli_thread_id mysqli_thread_safe mysqli_use_result mysqli_warning_count";
+  CodeMirror.registerHelper("hintWords", "php", [phpKeywords, phpAtoms, phpBuiltin].join(" ").split(" "));
+  CodeMirror.registerHelper("wordChars", "php", /[\w$]/);
+
+  var phpConfig = {
+    name: "clike",
+    helperType: "php",
+    keywords: keywords(phpKeywords),
+    blockKeywords: keywords("catch do else elseif for foreach if switch try while finally"),
+    defKeywords: keywords("class enum function interface namespace trait"),
+    atoms: keywords(phpAtoms),
+    builtin: keywords(phpBuiltin),
+    multiLineStrings: true,
+    hooks: {
+      "$": function(stream) {
+        stream.eatWhile(/[\w\$_]/);
+        return "variable-2";
+      },
+      "<": function(stream, state) {
+        var before;
+        if (before = stream.match(/^<<\s*/)) {
+          var quoted = stream.eat(/['"]/);
+          stream.eatWhile(/[\w\.]/);
+          var delim = stream.current().slice(before[0].length + (quoted ? 2 : 1));
+          if (quoted) stream.eat(quoted);
+          if (delim) {
+            (state.tokStack || (state.tokStack = [])).push(delim, 0);
+            state.tokenize = phpString(delim, quoted != "'");
+            return "string";
+          }
+        }
+        return false;
+      },
+      "#": function(stream) {
+        while (!stream.eol() && !stream.match("?>", false)) stream.next();
+        return "comment";
+      },
+      "/": function(stream) {
+        if (stream.eat("/")) {
+          while (!stream.eol() && !stream.match("?>", false)) stream.next();
+          return "comment";
+        }
+        return false;
+      },
+      '"': function(_stream, state) {
+        (state.tokStack || (state.tokStack = [])).push('"', 0);
+        state.tokenize = phpString('"');
+        return "string";
+      },
+      "{": function(_stream, state) {
+        if (state.tokStack && state.tokStack.length)
+          state.tokStack[state.tokStack.length - 1]++;
+        return false;
+      },
+      "}": function(_stream, state) {
+        if (state.tokStack && state.tokStack.length > 0 &&
+            !--state.tokStack[state.tokStack.length - 1]) {
+          state.tokenize = phpString(state.tokStack[state.tokStack.length - 2]);
+        }
+        return false;
+      }
+    }
+  };
+
+  CodeMirror.defineMode("php", function(config, parserConfig) {
+    var htmlMode = CodeMirror.getMode(config, (parserConfig && parserConfig.htmlMode) || "text/html");
+    var phpMode = CodeMirror.getMode(config, phpConfig);
+
+    function dispatch(stream, state) {
+      var isPHP = state.curMode == phpMode;
+      if (stream.sol() && state.pending && state.pending != '"' && state.pending != "'") state.pending = null;
+      if (!isPHP) {
+        if (stream.match(/^<\?\w*/)) {
+          state.curMode = phpMode;
+          if (!state.php) state.php = CodeMirror.startState(phpMode, htmlMode.indent(state.html, "", ""))
+          state.curState = state.php;
+          return "meta";
+        }
+        if (state.pending == '"' || state.pending == "'") {
+          while (!stream.eol() && stream.next() != state.pending) {}
+          var style = "string";
+        } else if (state.pending && stream.pos < state.pending.end) {
+          stream.pos = state.pending.end;
+          var style = state.pending.style;
+        } else {
+          var style = htmlMode.token(stream, state.curState);
+        }
+        if (state.pending) state.pending = null;
+        var cur = stream.current(), openPHP = cur.search(/<\?/), m;
+        if (openPHP != -1) {
+          if (style == "string" && (m = cur.match(/[\'\"]$/)) && !/\?>/.test(cur)) state.pending = m[0];
+          else state.pending = {end: stream.pos, style: style};
+          stream.backUp(cur.length - openPHP);
+        }
+        return style;
+      } else if (isPHP && state.php.tokenize == null && stream.match("?>")) {
+        state.curMode = htmlMode;
+        state.curState = state.html;
+        if (!state.php.context.prev) state.php = null;
+        return "meta";
+      } else {
+        return phpMode.token(stream, state.curState);
+      }
+    }
+
+    return {
+      startState: function() {
+        var html = CodeMirror.startState(htmlMode)
+        var php = parserConfig.startOpen ? CodeMirror.startState(phpMode) : null
+        return {html: html,
+                php: php,
+                curMode: parserConfig.startOpen ? phpMode : htmlMode,
+                curState: parserConfig.startOpen ? php : html,
+                pending: null};
+      },
+
+      copyState: function(state) {
+        var html = state.html, htmlNew = CodeMirror.copyState(htmlMode, html),
+            php = state.php, phpNew = php && CodeMirror.copyState(phpMode, php), cur;
+        if (state.curMode == htmlMode) cur = htmlNew;
+        else cur = phpNew;
+        return {html: htmlNew, php: phpNew, curMode: state.curMode, curState: cur,
+                pending: state.pending};
+      },
+
+      token: dispatch,
+
+      indent: function(state, textAfter, line) {
+        if ((state.curMode != phpMode && /^\s*<\//.test(textAfter)) ||
+            (state.curMode == phpMode && /^\?>/.test(textAfter)))
+          return htmlMode.indent(state.html, textAfter, line);
+        return state.curMode.indent(state.curState, textAfter, line);
+      },
+
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/",
+      lineComment: "//",
+
+      innerMode: function(state) { return {state: state.curState, mode: state.curMode}; }
+    };
+  }, "htmlmixed", "clike");
+
+  CodeMirror.defineMIME("application/x-httpd-php", "php");
+  CodeMirror.defineMIME("application/x-httpd-php-open", {name: "php", startOpen: true});
+  CodeMirror.defineMIME("text/x-php", phpConfig);
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/php/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,154 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "php");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT('simple_test',
+     '[meta <?php] ' +
+     '[keyword echo] [string "aaa"]; ' +
+     '[meta ?>]');
+
+  MT('variable_interpolation_non_alphanumeric',
+     '[meta <?php]',
+     '[keyword echo] [string "aaa$~$!$@$#$$$%$^$&$*$($)$.$<$>$/$\\$}$\\\"$:$;$?$|$[[$]]$+$=aaa"]',
+     '[meta ?>]');
+
+  MT('variable_interpolation_digits',
+     '[meta <?php]',
+     '[keyword echo] [string "aaa$1$2$3$4$5$6$7$8$9$0aaa"]',
+     '[meta ?>]');
+
+  MT('variable_interpolation_simple_syntax_1',
+     '[meta <?php]',
+     '[keyword echo] [string "aaa][variable-2 $aaa][string .aaa"];',
+     '[meta ?>]');
+
+  MT('variable_interpolation_simple_syntax_2',
+     '[meta <?php]',
+     '[keyword echo] [string "][variable-2 $aaaa][[','[number 2]',         ']][string aa"];',
+     '[keyword echo] [string "][variable-2 $aaaa][[','[number 2345]',      ']][string aa"];',
+     '[keyword echo] [string "][variable-2 $aaaa][[','[number 2.3]',       ']][string aa"];',
+     '[keyword echo] [string "][variable-2 $aaaa][[','[variable aaaaa]',   ']][string aa"];',
+     '[keyword echo] [string "][variable-2 $aaaa][[','[variable-2 $aaaaa]',']][string aa"];',
+
+     '[keyword echo] [string "1aaa][variable-2 $aaaa][[','[number 2]',         ']][string aa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa][[','[number 2345]',      ']][string aa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa][[','[number 2.3]',       ']][string aa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa][[','[variable aaaaa]',   ']][string aa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa][[','[variable-2 $aaaaa]',']][string aa"];',
+     '[meta ?>]');
+
+  MT('variable_interpolation_simple_syntax_3',
+     '[meta <?php]',
+     '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string .aaaaaa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa][string ->][variable-2 $aaaaa][string .aaaaaa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string [[2]].aaaaaa"];',
+     '[keyword echo] [string "aaa][variable-2 $aaaa]->[variable aaaaa][string ->aaaa2.aaaaaa"];',
+     '[meta ?>]');
+
+  MT('variable_interpolation_escaping',
+     '[meta <?php] [comment /* Escaping */]',
+     '[keyword echo] [string "aaa\\$aaaa->aaa.aaa"];',
+     '[keyword echo] [string "aaa\\$aaaa[[2]]aaa.aaa"];',
+     '[keyword echo] [string "aaa\\$aaaa[[asd]]aaa.aaa"];',
+     '[keyword echo] [string "aaa{\\$aaaa->aaa.aaa"];',
+     '[keyword echo] [string "aaa{\\$aaaa[[2]]aaa.aaa"];',
+     '[keyword echo] [string "aaa{\\aaaaa[[asd]]aaa.aaa"];',
+     '[keyword echo] [string "aaa\\${aaaa->aaa.aaa"];',
+     '[keyword echo] [string "aaa\\${aaaa[[2]]aaa.aaa"];',
+     '[keyword echo] [string "aaa\\${aaaa[[asd]]aaa.aaa"];',
+     '[meta ?>]');
+
+  MT('variable_interpolation_complex_syntax_1',
+     '[meta <?php]',
+     '[keyword echo] [string "aaa][variable-2 $]{[variable aaaa]}[string ->aaa.aaa"];',
+     '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa]}[string ->aaa.aaa"];',
+     '[keyword echo] [string "aaa][variable-2 $]{[variable-2 $aaaa][[','  [number 42]',']]}[string ->aaa.aaa"];',
+     '[keyword echo] [string "aaa][variable-2 $]{[variable aaaa][meta ?>]aaaaaa');
+
+  MT('variable_interpolation_complex_syntax_2',
+     '[meta <?php] [comment /* Monsters */]',
+     '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>} $aaa<?php } */]}[string ->aaa.aaa"];',
+     '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*}?>*/][[','  [string "aaa][variable-2 $aaa][string {}][variable-2 $]{[variable aaa]}[string "]',']]}[string ->aaa.aaa"];',
+     '[keyword echo] [string "][variable-2 $]{[variable aaa][comment /*} } $aaa } */]}[string ->aaa.aaa"];');
+
+
+  function build_recursive_monsters(nt, t, n){
+    var monsters = [t];
+    for (var i = 1; i <= n; ++i)
+      monsters[i] = nt.join(monsters[i - 1]);
+    return monsters;
+  }
+
+  var m1 = build_recursive_monsters(
+    ['[string "][variable-2 $]{[variable aaa] [operator +] ', '}[string "]'],
+    '[comment /* }?>} */] [string "aaa][variable-2 $aaa][string .aaa"]',
+    10
+  );
+
+  MT('variable_interpolation_complex_syntax_3_1',
+     '[meta <?php] [comment /* Recursive monsters */]',
+     '[keyword echo] ' + m1[4] + ';',
+     '[keyword echo] ' + m1[7] + ';',
+     '[keyword echo] ' + m1[8] + ';',
+     '[keyword echo] ' + m1[5] + ';',
+     '[keyword echo] ' + m1[1] + ';',
+     '[keyword echo] ' + m1[6] + ';',
+     '[keyword echo] ' + m1[9] + ';',
+     '[keyword echo] ' + m1[0] + ';',
+     '[keyword echo] ' + m1[10] + ';',
+     '[keyword echo] ' + m1[2] + ';',
+     '[keyword echo] ' + m1[3] + ';',
+     '[keyword echo] [string "end"];',
+     '[meta ?>]');
+
+  var m2 = build_recursive_monsters(
+    ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', '}[string .a"]'],
+    '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]',
+    5
+  );
+
+  MT('variable_interpolation_complex_syntax_3_2',
+     '[meta <?php] [comment /* Recursive monsters 2 */]',
+     '[keyword echo] ' + m2[0] + ';',
+     '[keyword echo] ' + m2[1] + ';',
+     '[keyword echo] ' + m2[5] + ';',
+     '[keyword echo] ' + m2[4] + ';',
+     '[keyword echo] ' + m2[2] + ';',
+     '[keyword echo] ' + m2[3] + ';',
+     '[keyword echo] [string "end"];',
+     '[meta ?>]');
+
+  function build_recursive_monsters_2(mf1, mf2, nt, t, n){
+    var monsters = [t];
+    for (var i = 1; i <= n; ++i)
+      monsters[i] = nt[0] + mf1[i - 1] + nt[1] + mf2[i - 1] + nt[2] + monsters[i - 1] + nt[3];
+    return monsters;
+  }
+
+  var m3 = build_recursive_monsters_2(
+    m1,
+    m2,
+    ['[string "a][variable-2 $]{[variable aaa] [operator +] ', ' [operator +] ', ' [operator +] ', '}[string .a"]'],
+    '[comment /* }?>{{ */] [string "a?>}{{aa][variable-2 $aaa][string .a}a?>a"]',
+    4
+  );
+
+  MT('variable_interpolation_complex_syntax_3_3',
+     '[meta <?php] [comment /* Recursive monsters 2 */]',
+     '[keyword echo] ' + m3[4] + ';',
+     '[keyword echo] ' + m3[0] + ';',
+     '[keyword echo] ' + m3[3] + ';',
+     '[keyword echo] ' + m3[1] + ';',
+     '[keyword echo] ' + m3[2] + ';',
+     '[keyword echo] [string "end"];',
+     '[meta ?>]');
+
+  MT("variable_interpolation_heredoc",
+     "[meta <?php]",
+     "[string <<<here]",
+     "[string doc ][variable-2 $]{[variable yay]}[string more]",
+     "[string here]; [comment // normal]");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pig/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,53 @@
+<!doctype html>
+<title>CodeMirror: Pig Latin mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="pig.js"></script>
+<style>.CodeMirror {border: 2px inset #dee;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Pig Latin</a>
+  </ul>
+</div>
+
+<article>
+<h2>Pig Latin mode</h2>
+<form><textarea id="code" name="code">
+-- Apache Pig (Pig Latin Language) Demo
+/* 
+This is a multiline comment.
+*/
+a = LOAD "\path\to\input" USING PigStorage('\t') AS (x:long, y:chararray, z:bytearray);
+b = GROUP a BY (x,y,3+4);
+c = FOREACH b GENERATE flatten(group) as (x,y), SUM(group.$2) as z;
+STORE c INTO "\path\to\output";
+
+--
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        indentUnit: 4,
+        mode: "text/x-pig"
+      });
+    </script>
+
+    <p>
+        Simple mode that handles Pig Latin language.
+    </p>
+
+    <p><strong>MIME type defined:</strong> <code>text/x-pig</code>
+    (PIG code)
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pig/pig.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,178 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+ *      Pig Latin Mode for CodeMirror 2
+ *      @author Prasanth Jayachandran
+ *      @link   https://github.com/prasanthj/pig-codemirror-2
+ *  This implementation is adapted from PL/SQL mode in CodeMirror 2.
+ */
+(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.defineMode("pig", function(_config, parserConfig) {
+  var keywords = parserConfig.keywords,
+  builtins = parserConfig.builtins,
+  types = parserConfig.types,
+  multiLineStrings = parserConfig.multiLineStrings;
+
+  var isOperatorChar = /[*+\-%<>=&?:\/!|]/;
+
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+
+  function tokenComment(stream, state) {
+    var isEnd = false;
+    var ch;
+    while(ch = stream.next()) {
+      if(ch == "/" && isEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      isEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while((next = stream.next()) != null) {
+        if (next == quote && !escaped) {
+          end = true; break;
+        }
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !(escaped || multiLineStrings))
+        state.tokenize = tokenBase;
+      return "error";
+    };
+  }
+
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+
+    // is a start of string?
+    if (ch == '"' || ch == "'")
+      return chain(stream, state, tokenString(ch));
+    // is it one of the special chars
+    else if(/[\[\]{}\(\),;\.]/.test(ch))
+      return null;
+    // is it a number?
+    else if(/\d/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      return "number";
+    }
+    // multi line comment or operator
+    else if (ch == "/") {
+      if (stream.eat("*")) {
+        return chain(stream, state, tokenComment);
+      }
+      else {
+        stream.eatWhile(isOperatorChar);
+        return "operator";
+      }
+    }
+    // single line comment or operator
+    else if (ch=="-") {
+      if(stream.eat("-")){
+        stream.skipToEnd();
+        return "comment";
+      }
+      else {
+        stream.eatWhile(isOperatorChar);
+        return "operator";
+      }
+    }
+    // is it an operator
+    else if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    else {
+      // get the while word
+      stream.eatWhile(/[\w\$_]/);
+      // is it one of the listed keywords?
+      if (keywords && keywords.propertyIsEnumerable(stream.current().toUpperCase())) {
+        //keywords can be used as variables like flatten(group), group.$0 etc..
+        if (!stream.eat(")") && !stream.eat("."))
+          return "keyword";
+      }
+      // is it one of the builtin functions?
+      if (builtins && builtins.propertyIsEnumerable(stream.current().toUpperCase()))
+        return "variable-2";
+      // is it one of the listed types?
+      if (types && types.propertyIsEnumerable(stream.current().toUpperCase()))
+        return "variable-3";
+      // default is a 'variable'
+      return "variable";
+    }
+  }
+
+  // Interface
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase,
+        startOfLine: true
+      };
+    },
+
+    token: function(stream, state) {
+      if(stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      return style;
+    }
+  };
+});
+
+(function() {
+  function keywords(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  // builtin funcs taken from trunk revision 1303237
+  var pBuiltins = "ABS ACOS ARITY ASIN ATAN AVG BAGSIZE BINSTORAGE BLOOM BUILDBLOOM CBRT CEIL "
+    + "CONCAT COR COS COSH COUNT COUNT_STAR COV CONSTANTSIZE CUBEDIMENSIONS DIFF DISTINCT DOUBLEABS "
+    + "DOUBLEAVG DOUBLEBASE DOUBLEMAX DOUBLEMIN DOUBLEROUND DOUBLESUM EXP FLOOR FLOATABS FLOATAVG "
+    + "FLOATMAX FLOATMIN FLOATROUND FLOATSUM GENERICINVOKER INDEXOF INTABS INTAVG INTMAX INTMIN "
+    + "INTSUM INVOKEFORDOUBLE INVOKEFORFLOAT INVOKEFORINT INVOKEFORLONG INVOKEFORSTRING INVOKER "
+    + "ISEMPTY JSONLOADER JSONMETADATA JSONSTORAGE LAST_INDEX_OF LCFIRST LOG LOG10 LOWER LONGABS "
+    + "LONGAVG LONGMAX LONGMIN LONGSUM MAX MIN MAPSIZE MONITOREDUDF NONDETERMINISTIC OUTPUTSCHEMA  "
+    + "PIGSTORAGE PIGSTREAMING RANDOM REGEX_EXTRACT REGEX_EXTRACT_ALL REPLACE ROUND SIN SINH SIZE "
+    + "SQRT STRSPLIT SUBSTRING SUM STRINGCONCAT STRINGMAX STRINGMIN STRINGSIZE TAN TANH TOBAG "
+    + "TOKENIZE TOMAP TOP TOTUPLE TRIM TEXTLOADER TUPLESIZE UCFIRST UPPER UTF8STORAGECONVERTER ";
+
+  // taken from QueryLexer.g
+  var pKeywords = "VOID IMPORT RETURNS DEFINE LOAD FILTER FOREACH ORDER CUBE DISTINCT COGROUP "
+    + "JOIN CROSS UNION SPLIT INTO IF OTHERWISE ALL AS BY USING INNER OUTER ONSCHEMA PARALLEL "
+    + "PARTITION GROUP AND OR NOT GENERATE FLATTEN ASC DESC IS STREAM THROUGH STORE MAPREDUCE "
+    + "SHIP CACHE INPUT OUTPUT STDERROR STDIN STDOUT LIMIT SAMPLE LEFT RIGHT FULL EQ GT LT GTE LTE "
+    + "NEQ MATCHES TRUE FALSE DUMP";
+
+  // data types
+  var pTypes = "BOOLEAN INT LONG FLOAT DOUBLE CHARARRAY BYTEARRAY BAG TUPLE MAP ";
+
+  CodeMirror.defineMIME("text/x-pig", {
+    name: "pig",
+    builtins: keywords(pBuiltins),
+    keywords: keywords(pKeywords),
+    types: keywords(pTypes)
+  });
+
+  CodeMirror.registerHelper("hintWords", "pig", (pBuiltins + pTypes + pKeywords).split(" "));
+}());
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/powershell/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,209 @@
+<!doctype html>
+<html>
+  <head>
+    <meta charset="utf-8">
+    <title>CodeMirror: Powershell mode</title>
+    <link rel="stylesheet" href="../../doc/docs.css">
+    <link rel="stylesheet" href="../../lib/codemirror.css">
+    <script src="../../lib/codemirror.js"></script>
+    <script src="../../addon/edit/matchbrackets.js"></script>
+    <script src="powershell.js"></script>
+    <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+  </head>
+  <body>
+    <div id=nav>
+      <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+      <ul>
+        <li><a href="../../index.html">Home</a>
+        <li><a href="../../doc/manual.html">Manual</a>
+        <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+      </ul>
+      <ul>
+        <li><a href="../index.html">Language modes</a>
+        <li><a class=active href="#">JavaScript</a>
+      </ul>
+    </div>
+    <article>
+      <h2>PowerShell mode</h2>
+
+      <div><textarea id="code" name="code">
+# Paths
+cd c:\
+c:\windows\calc.exe
+
+# Number Literals
+0 12345
+12kb 12mb 12gB 12Tb 12PB 12L 12D 12lkb 12dtb
+1.234 1.234e56 1. 1.e2 .2 .2e34
+1.2MB 1.kb .1dTb 1.e1gb
+0x1 0xabcdef 0x3tb 0xelmb
+
+# String Literals
+'Literal escaping'''
+'Literal $variable'
+"Escaping 1`""
+"Escaping 2"""
+"Escaped `$variable"
+"Text, $variable and more text"
+"Text, ${variable with spaces} and more text."
+"Text, $($expression + 3) and more text."
+"Text, $("interpolation $("inception")") and more text."
+
+@"
+Multiline
+string
+"@
+# --
+@"
+Multiline
+string with quotes "'
+"@
+# --
+@'
+Multiline literal
+string with quotes "'
+'@
+
+# Array and Hash literals
+@( 'a','b','c' )
+@{ 'key': 'value' }
+
+# Variables
+$Variable = 5
+$global:variable = 5
+${Variable with spaces} = 5
+
+# Operators
+= += -= *= /= %=
+++ -- .. -f * / % + -
+-not ! -bnot
+-split -isplit -csplit
+-join
+-is -isnot -as
+-eq -ieq -ceq -ne -ine -cne
+-gt -igt -cgt -ge -ige -cge
+-lt -ilt -clt -le -ile -cle
+-like -ilike -clike -notlike -inotlike -cnotlike
+-match -imatch -cmatch -notmatch -inotmatch -cnotmatch
+-contains -icontains -ccontains -notcontains -inotcontains -cnotcontains
+-replace -ireplace -creplace
+-band	-bor -bxor
+-and -or -xor
+
+# Punctuation
+() [] {} , : ` = ; .
+
+# Keywords
+elseif begin function for foreach return else trap while do data dynamicparam
+until end break if throw param continue finally in switch exit filter from try
+process catch
+
+# Built-in variables
+$$ $? $^ $_
+$args $ConfirmPreference $ConsoleFileName $DebugPreference $Error
+$ErrorActionPreference $ErrorView $ExecutionContext $false $FormatEnumerationLimit
+$HOME $Host $input $MaximumAliasCount $MaximumDriveCount $MaximumErrorCount
+$MaximumFunctionCount $MaximumHistoryCount $MaximumVariableCount $MyInvocation
+$NestedPromptLevel $null $OutputEncoding $PID $PROFILE $ProgressPreference
+$PSBoundParameters $PSCommandPath $PSCulture $PSDefaultParameterValues
+$PSEmailServer $PSHOME $PSScriptRoot $PSSessionApplicationName
+$PSSessionConfigurationName $PSSessionOption $PSUICulture $PSVersionTable $PWD
+$ShellId $StackTrace $true $VerbosePreference $WarningPreference $WhatIfPreference
+$true $false $null
+
+# Built-in functions
+A:
+Add-Computer Add-Content Add-History Add-Member Add-PSSnapin Add-Type
+B:
+C:
+Checkpoint-Computer Clear-Content Clear-EventLog Clear-History Clear-Host Clear-Item
+Clear-ItemProperty Clear-Variable Compare-Object Complete-Transaction Connect-PSSession
+ConvertFrom-Csv ConvertFrom-Json ConvertFrom-SecureString ConvertFrom-StringData
+Convert-Path ConvertTo-Csv ConvertTo-Html ConvertTo-Json ConvertTo-SecureString
+ConvertTo-Xml Copy-Item Copy-ItemProperty
+D:
+Debug-Process Disable-ComputerRestore Disable-PSBreakpoint Disable-PSRemoting
+Disable-PSSessionConfiguration Disconnect-PSSession
+E:
+Enable-ComputerRestore Enable-PSBreakpoint Enable-PSRemoting Enable-PSSessionConfiguration
+Enter-PSSession Exit-PSSession Export-Alias Export-Clixml Export-Console Export-Counter
+Export-Csv Export-FormatData Export-ModuleMember Export-PSSession
+F:
+ForEach-Object Format-Custom Format-List Format-Table Format-Wide
+G:
+Get-Acl Get-Alias Get-AuthenticodeSignature Get-ChildItem Get-Command Get-ComputerRestorePoint
+Get-Content Get-ControlPanelItem Get-Counter Get-Credential Get-Culture Get-Date
+Get-Event Get-EventLog Get-EventSubscriber Get-ExecutionPolicy Get-FormatData Get-Help
+Get-History Get-Host Get-HotFix Get-Item Get-ItemProperty Get-Job Get-Location Get-Member
+Get-Module Get-PfxCertificate Get-Process Get-PSBreakpoint Get-PSCallStack Get-PSDrive
+Get-PSProvider Get-PSSession Get-PSSessionConfiguration Get-PSSnapin Get-Random Get-Service
+Get-TraceSource Get-Transaction Get-TypeData Get-UICulture  Get-Unique Get-Variable Get-Verb
+Get-WinEvent Get-WmiObject Group-Object
+H:
+help
+I:
+Import-Alias Import-Clixml Import-Counter Import-Csv Import-LocalizedData Import-Module
+Import-PSSession ImportSystemModules Invoke-Command Invoke-Expression Invoke-History
+Invoke-Item Invoke-RestMethod Invoke-WebRequest Invoke-WmiMethod
+J:
+Join-Path
+K:
+L:
+Limit-EventLog
+M:
+Measure-Command Measure-Object mkdir more Move-Item Move-ItemProperty
+N:
+New-Alias New-Event New-EventLog New-Item New-ItemProperty New-Module New-ModuleManifest
+New-Object New-PSDrive New-PSSession New-PSSessionConfigurationFile New-PSSessionOption
+New-PSTransportOption New-Service New-TimeSpan New-Variable New-WebServiceProxy
+New-WinEvent
+O:
+oss Out-Default Out-File Out-GridView Out-Host Out-Null Out-Printer Out-String
+P:
+Pause Pop-Location prompt Push-Location
+Q:
+R:
+Read-Host Receive-Job Receive-PSSession Register-EngineEvent Register-ObjectEvent
+Register-PSSessionConfiguration Register-WmiEvent Remove-Computer Remove-Event
+Remove-EventLog Remove-Item Remove-ItemProperty Remove-Job Remove-Module
+Remove-PSBreakpoint Remove-PSDrive Remove-PSSession Remove-PSSnapin Remove-TypeData
+Remove-Variable Remove-WmiObject Rename-Computer Rename-Item Rename-ItemProperty
+Reset-ComputerMachinePassword Resolve-Path Restart-Computer Restart-Service
+Restore-Computer Resume-Job Resume-Service
+S:
+Save-Help Select-Object Select-String Select-Xml Send-MailMessage Set-Acl Set-Alias
+Set-AuthenticodeSignature Set-Content Set-Date Set-ExecutionPolicy Set-Item
+Set-ItemProperty Set-Location Set-PSBreakpoint Set-PSDebug
+Set-PSSessionConfiguration Set-Service Set-StrictMode Set-TraceSource Set-Variable
+Set-WmiInstance Show-Command Show-ControlPanelItem Show-EventLog Sort-Object
+Split-Path Start-Job Start-Process Start-Service Start-Sleep Start-Transaction
+Start-Transcript Stop-Computer Stop-Job Stop-Process Stop-Service Stop-Transcript
+Suspend-Job Suspend-Service
+T:
+TabExpansion2 Tee-Object Test-ComputerSecureChannel Test-Connection
+Test-ModuleManifest Test-Path Test-PSSessionConfigurationFile Trace-Command
+U:
+Unblock-File Undo-Transaction Unregister-Event Unregister-PSSessionConfiguration
+Update-FormatData Update-Help Update-List Update-TypeData Use-Transaction
+V:
+W:
+Wait-Event Wait-Job Wait-Process Where-Object Write-Debug Write-Error Write-EventLog
+Write-Host Write-Output Write-Progress Write-Verbose Write-Warning
+X:
+Y:
+Z:</textarea></div>
+      <script>
+        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+          mode: "powershell",
+          lineNumbers: true,
+          indentUnit: 4,
+          tabMode: "shift",
+          matchBrackets: true
+        });
+      </script>
+
+      <p><strong>MIME types defined:</strong> <code>application/x-powershell</code>.</p>
+    </article>
+  </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/powershell/powershell.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,398 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  'use strict';
+  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(window.CodeMirror);
+})(function(CodeMirror) {
+'use strict';
+
+CodeMirror.defineMode('powershell', function() {
+  function buildRegexp(patterns, options) {
+    options = options || {};
+    var prefix = options.prefix !== undefined ? options.prefix : '^';
+    var suffix = options.suffix !== undefined ? options.suffix : '\\b';
+
+    for (var i = 0; i < patterns.length; i++) {
+      if (patterns[i] instanceof RegExp) {
+        patterns[i] = patterns[i].source;
+      }
+      else {
+        patterns[i] = patterns[i].replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
+      }
+    }
+
+    return new RegExp(prefix + '(' + patterns.join('|') + ')' + suffix, 'i');
+  }
+
+  var notCharacterOrDash = '(?=[^A-Za-z\\d\\-_]|$)';
+  var varNames = /[\w\-:]/
+  var keywords = buildRegexp([
+    /begin|break|catch|continue|data|default|do|dynamicparam/,
+    /else|elseif|end|exit|filter|finally|for|foreach|from|function|if|in/,
+    /param|process|return|switch|throw|trap|try|until|where|while/
+  ], { suffix: notCharacterOrDash });
+
+  var punctuation = /[\[\]{},;`\\\.]|@[({]/;
+  var wordOperators = buildRegexp([
+    'f',
+    /b?not/,
+    /[ic]?split/, 'join',
+    /is(not)?/, 'as',
+    /[ic]?(eq|ne|[gl][te])/,
+    /[ic]?(not)?(like|match|contains)/,
+    /[ic]?replace/,
+    /b?(and|or|xor)/
+  ], { prefix: '-' });
+  var symbolOperators = /[+\-*\/%]=|\+\+|--|\.\.|[+\-*&^%:=!|\/]|<(?!#)|(?!#)>/;
+  var operators = buildRegexp([wordOperators, symbolOperators], { suffix: '' });
+
+  var numbers = /^((0x[\da-f]+)|((\d+\.\d+|\d\.|\.\d+|\d+)(e[\+\-]?\d+)?))[ld]?([kmgtp]b)?/i;
+
+  var identifiers = /^[A-Za-z\_][A-Za-z\-\_\d]*\b/;
+
+  var symbolBuiltins = /[A-Z]:|%|\?/i;
+  var namedBuiltins = buildRegexp([
+    /Add-(Computer|Content|History|Member|PSSnapin|Type)/,
+    /Checkpoint-Computer/,
+    /Clear-(Content|EventLog|History|Host|Item(Property)?|Variable)/,
+    /Compare-Object/,
+    /Complete-Transaction/,
+    /Connect-PSSession/,
+    /ConvertFrom-(Csv|Json|SecureString|StringData)/,
+    /Convert-Path/,
+    /ConvertTo-(Csv|Html|Json|SecureString|Xml)/,
+    /Copy-Item(Property)?/,
+    /Debug-Process/,
+    /Disable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/,
+    /Disconnect-PSSession/,
+    /Enable-(ComputerRestore|PSBreakpoint|PSRemoting|PSSessionConfiguration)/,
+    /(Enter|Exit)-PSSession/,
+    /Export-(Alias|Clixml|Console|Counter|Csv|FormatData|ModuleMember|PSSession)/,
+    /ForEach-Object/,
+    /Format-(Custom|List|Table|Wide)/,
+    new RegExp('Get-(Acl|Alias|AuthenticodeSignature|ChildItem|Command|ComputerRestorePoint|Content|ControlPanelItem|Counter|Credential'
+      + '|Culture|Date|Event|EventLog|EventSubscriber|ExecutionPolicy|FormatData|Help|History|Host|HotFix|Item|ItemProperty|Job'
+      + '|Location|Member|Module|PfxCertificate|Process|PSBreakpoint|PSCallStack|PSDrive|PSProvider|PSSession|PSSessionConfiguration'
+      + '|PSSnapin|Random|Service|TraceSource|Transaction|TypeData|UICulture|Unique|Variable|Verb|WinEvent|WmiObject)'),
+    /Group-Object/,
+    /Import-(Alias|Clixml|Counter|Csv|LocalizedData|Module|PSSession)/,
+    /ImportSystemModules/,
+    /Invoke-(Command|Expression|History|Item|RestMethod|WebRequest|WmiMethod)/,
+    /Join-Path/,
+    /Limit-EventLog/,
+    /Measure-(Command|Object)/,
+    /Move-Item(Property)?/,
+    new RegExp('New-(Alias|Event|EventLog|Item(Property)?|Module|ModuleManifest|Object|PSDrive|PSSession|PSSessionConfigurationFile'
+      + '|PSSessionOption|PSTransportOption|Service|TimeSpan|Variable|WebServiceProxy|WinEvent)'),
+    /Out-(Default|File|GridView|Host|Null|Printer|String)/,
+    /Pause/,
+    /(Pop|Push)-Location/,
+    /Read-Host/,
+    /Receive-(Job|PSSession)/,
+    /Register-(EngineEvent|ObjectEvent|PSSessionConfiguration|WmiEvent)/,
+    /Remove-(Computer|Event|EventLog|Item(Property)?|Job|Module|PSBreakpoint|PSDrive|PSSession|PSSnapin|TypeData|Variable|WmiObject)/,
+    /Rename-(Computer|Item(Property)?)/,
+    /Reset-ComputerMachinePassword/,
+    /Resolve-Path/,
+    /Restart-(Computer|Service)/,
+    /Restore-Computer/,
+    /Resume-(Job|Service)/,
+    /Save-Help/,
+    /Select-(Object|String|Xml)/,
+    /Send-MailMessage/,
+    new RegExp('Set-(Acl|Alias|AuthenticodeSignature|Content|Date|ExecutionPolicy|Item(Property)?|Location|PSBreakpoint|PSDebug' +
+               '|PSSessionConfiguration|Service|StrictMode|TraceSource|Variable|WmiInstance)'),
+    /Show-(Command|ControlPanelItem|EventLog)/,
+    /Sort-Object/,
+    /Split-Path/,
+    /Start-(Job|Process|Service|Sleep|Transaction|Transcript)/,
+    /Stop-(Computer|Job|Process|Service|Transcript)/,
+    /Suspend-(Job|Service)/,
+    /TabExpansion2/,
+    /Tee-Object/,
+    /Test-(ComputerSecureChannel|Connection|ModuleManifest|Path|PSSessionConfigurationFile)/,
+    /Trace-Command/,
+    /Unblock-File/,
+    /Undo-Transaction/,
+    /Unregister-(Event|PSSessionConfiguration)/,
+    /Update-(FormatData|Help|List|TypeData)/,
+    /Use-Transaction/,
+    /Wait-(Event|Job|Process)/,
+    /Where-Object/,
+    /Write-(Debug|Error|EventLog|Host|Output|Progress|Verbose|Warning)/,
+    /cd|help|mkdir|more|oss|prompt/,
+    /ac|asnp|cat|cd|chdir|clc|clear|clhy|cli|clp|cls|clv|cnsn|compare|copy|cp|cpi|cpp|cvpa|dbp|del|diff|dir|dnsn|ebp/,
+    /echo|epal|epcsv|epsn|erase|etsn|exsn|fc|fl|foreach|ft|fw|gal|gbp|gc|gci|gcm|gcs|gdr|ghy|gi|gjb|gl|gm|gmo|gp|gps/,
+    /group|gsn|gsnp|gsv|gu|gv|gwmi|h|history|icm|iex|ihy|ii|ipal|ipcsv|ipmo|ipsn|irm|ise|iwmi|iwr|kill|lp|ls|man|md/,
+    /measure|mi|mount|move|mp|mv|nal|ndr|ni|nmo|npssc|nsn|nv|ogv|oh|popd|ps|pushd|pwd|r|rbp|rcjb|rcsn|rd|rdr|ren|ri/,
+    /rjb|rm|rmdir|rmo|rni|rnp|rp|rsn|rsnp|rujb|rv|rvpa|rwmi|sajb|sal|saps|sasv|sbp|sc|select|set|shcm|si|sl|sleep|sls/,
+    /sort|sp|spjb|spps|spsv|start|sujb|sv|swmi|tee|trcm|type|where|wjb|write/
+  ], { prefix: '', suffix: '' });
+  var variableBuiltins = buildRegexp([
+    /[$?^_]|Args|ConfirmPreference|ConsoleFileName|DebugPreference|Error|ErrorActionPreference|ErrorView|ExecutionContext/,
+    /FormatEnumerationLimit|Home|Host|Input|MaximumAliasCount|MaximumDriveCount|MaximumErrorCount|MaximumFunctionCount/,
+    /MaximumHistoryCount|MaximumVariableCount|MyInvocation|NestedPromptLevel|OutputEncoding|Pid|Profile|ProgressPreference/,
+    /PSBoundParameters|PSCommandPath|PSCulture|PSDefaultParameterValues|PSEmailServer|PSHome|PSScriptRoot|PSSessionApplicationName/,
+    /PSSessionConfigurationName|PSSessionOption|PSUICulture|PSVersionTable|Pwd|ShellId|StackTrace|VerbosePreference/,
+    /WarningPreference|WhatIfPreference/,
+
+    /Event|EventArgs|EventSubscriber|Sender/,
+    /Matches|Ofs|ForEach|LastExitCode|PSCmdlet|PSItem|PSSenderInfo|This/,
+    /true|false|null/
+  ], { prefix: '\\$', suffix: '' });
+
+  var builtins = buildRegexp([symbolBuiltins, namedBuiltins, variableBuiltins], { suffix: notCharacterOrDash });
+
+  var grammar = {
+    keyword: keywords,
+    number: numbers,
+    operator: operators,
+    builtin: builtins,
+    punctuation: punctuation,
+    identifier: identifiers
+  };
+
+  // tokenizers
+  function tokenBase(stream, state) {
+    // Handle Comments
+    //var ch = stream.peek();
+
+    var parent = state.returnStack[state.returnStack.length - 1];
+    if (parent && parent.shouldReturnFrom(state)) {
+      state.tokenize = parent.tokenize;
+      state.returnStack.pop();
+      return state.tokenize(stream, state);
+    }
+
+    if (stream.eatSpace()) {
+      return null;
+    }
+
+    if (stream.eat('(')) {
+      state.bracketNesting += 1;
+      return 'punctuation';
+    }
+
+    if (stream.eat(')')) {
+      state.bracketNesting -= 1;
+      return 'punctuation';
+    }
+
+    for (var key in grammar) {
+      if (stream.match(grammar[key])) {
+        return key;
+      }
+    }
+
+    var ch = stream.next();
+
+    // single-quote string
+    if (ch === "'") {
+      return tokenSingleQuoteString(stream, state);
+    }
+
+    if (ch === '$') {
+      return tokenVariable(stream, state);
+    }
+
+    // double-quote string
+    if (ch === '"') {
+      return tokenDoubleQuoteString(stream, state);
+    }
+
+    if (ch === '<' && stream.eat('#')) {
+      state.tokenize = tokenComment;
+      return tokenComment(stream, state);
+    }
+
+    if (ch === '#') {
+      stream.skipToEnd();
+      return 'comment';
+    }
+
+    if (ch === '@') {
+      var quoteMatch = stream.eat(/["']/);
+      if (quoteMatch && stream.eol()) {
+        state.tokenize = tokenMultiString;
+        state.startQuote = quoteMatch[0];
+        return tokenMultiString(stream, state);
+      } else if (stream.eol()) {
+        return 'error';
+      } else if (stream.peek().match(/[({]/)) {
+        return 'punctuation';
+      } else if (stream.peek().match(varNames)) {
+        // splatted variable
+        return tokenVariable(stream, state);
+      }
+    }
+    return 'error';
+  }
+
+  function tokenSingleQuoteString(stream, state) {
+    var ch;
+    while ((ch = stream.peek()) != null) {
+      stream.next();
+
+      if (ch === "'" && !stream.eat("'")) {
+        state.tokenize = tokenBase;
+        return 'string';
+      }
+    }
+
+    return 'error';
+  }
+
+  function tokenDoubleQuoteString(stream, state) {
+    var ch;
+    while ((ch = stream.peek()) != null) {
+      if (ch === '$') {
+        state.tokenize = tokenStringInterpolation;
+        return 'string';
+      }
+
+      stream.next();
+      if (ch === '`') {
+        stream.next();
+        continue;
+      }
+
+      if (ch === '"' && !stream.eat('"')) {
+        state.tokenize = tokenBase;
+        return 'string';
+      }
+    }
+
+    return 'error';
+  }
+
+  function tokenStringInterpolation(stream, state) {
+    return tokenInterpolation(stream, state, tokenDoubleQuoteString);
+  }
+
+  function tokenMultiStringReturn(stream, state) {
+    state.tokenize = tokenMultiString;
+    state.startQuote = '"'
+    return tokenMultiString(stream, state);
+  }
+
+  function tokenHereStringInterpolation(stream, state) {
+    return tokenInterpolation(stream, state, tokenMultiStringReturn);
+  }
+
+  function tokenInterpolation(stream, state, parentTokenize) {
+    if (stream.match('$(')) {
+      var savedBracketNesting = state.bracketNesting;
+      state.returnStack.push({
+        /*jshint loopfunc:true */
+        shouldReturnFrom: function(state) {
+          return state.bracketNesting === savedBracketNesting;
+        },
+        tokenize: parentTokenize
+      });
+      state.tokenize = tokenBase;
+      state.bracketNesting += 1;
+      return 'punctuation';
+    } else {
+      stream.next();
+      state.returnStack.push({
+        shouldReturnFrom: function() { return true; },
+        tokenize: parentTokenize
+      });
+      state.tokenize = tokenVariable;
+      return state.tokenize(stream, state);
+    }
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while ((ch = stream.next()) != null) {
+      if (maybeEnd && ch == '>') {
+          state.tokenize = tokenBase;
+          break;
+      }
+      maybeEnd = (ch === '#');
+    }
+    return 'comment';
+  }
+
+  function tokenVariable(stream, state) {
+    var ch = stream.peek();
+    if (stream.eat('{')) {
+      state.tokenize = tokenVariableWithBraces;
+      return tokenVariableWithBraces(stream, state);
+    } else if (ch != undefined && ch.match(varNames)) {
+      stream.eatWhile(varNames);
+      state.tokenize = tokenBase;
+      return 'variable-2';
+    } else {
+      state.tokenize = tokenBase;
+      return 'error';
+    }
+  }
+
+  function tokenVariableWithBraces(stream, state) {
+    var ch;
+    while ((ch = stream.next()) != null) {
+      if (ch === '}') {
+        state.tokenize = tokenBase;
+        break;
+      }
+    }
+    return 'variable-2';
+  }
+
+  function tokenMultiString(stream, state) {
+    var quote = state.startQuote;
+    if (stream.sol() && stream.match(new RegExp(quote + '@'))) {
+      state.tokenize = tokenBase;
+    }
+    else if (quote === '"') {
+      while (!stream.eol()) {
+        var ch = stream.peek();
+        if (ch === '$') {
+          state.tokenize = tokenHereStringInterpolation;
+          return 'string';
+        }
+
+        stream.next();
+        if (ch === '`') {
+          stream.next();
+        }
+      }
+    }
+    else {
+      stream.skipToEnd();
+    }
+
+    return 'string';
+  }
+
+  var external = {
+    startState: function() {
+      return {
+        returnStack: [],
+        bracketNesting: 0,
+        tokenize: tokenBase
+      };
+    },
+
+    token: function(stream, state) {
+      return state.tokenize(stream, state);
+    },
+
+    blockCommentStart: '<#',
+    blockCommentEnd: '#>',
+    lineComment: '#',
+    fold: 'brace'
+  };
+  return external;
+});
+
+CodeMirror.defineMIME('application/x-powershell', 'powershell');
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/powershell/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,74 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "powershell");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  function forEach(arr, f) { for (var i = 0; i < arr.length; i++) f(arr[i], i) }
+
+  MT('comment', '[number 1][comment # A]');
+  MT('comment_multiline', '[number 1][comment <#]',
+    '[comment ABC]',
+  '[comment #>][number 2]');
+
+  forEach([
+    '0', '1234',
+    '12kb', '12mb', '12Gb', '12Tb', '12PB', '12L', '12D', '12lkb', '12dtb',
+    '1.234', '1.234e56', '1.', '1.e2', '.2', '.2e34',
+    '1.2MB', '1.kb', '.1dTB', '1.e1gb', '.2', '.2e34',
+    '0x1', '0xabcdef', '0x3tb', '0xelmb'
+  ], function(number) {
+    MT("number_" + number, "[number " + number + "]");
+  });
+
+  MT('string_literal_escaping', "[string 'a''']");
+  MT('string_literal_variable', "[string 'a $x']");
+  MT('string_escaping_1', '[string "a `""]');
+  MT('string_escaping_2', '[string "a """]');
+  MT('string_variable_escaping', '[string "a `$x"]');
+  MT('string_variable', '[string "a ][variable-2 $x][string  b"]');
+  MT('string_variable_spaces', '[string "a ][variable-2 ${x y}][string  b"]');
+  MT('string_expression', '[string "a ][punctuation $(][variable-2 $x][operator +][number 3][punctuation )][string  b"]');
+  MT('string_expression_nested', '[string "A][punctuation $(][string "a][punctuation $(][string "w"][punctuation )][string b"][punctuation )][string B"]');
+
+  MT('string_heredoc', '[string @"]',
+    '[string abc]',
+  '[string "@]');
+  MT('string_heredoc_quotes', '[string @"]',
+    '[string abc "\']',
+  '[string "@]');
+  MT('string_heredoc_variable', '[string @"]',
+    '[string a ][variable-2 $x][string  b]',
+  '[string "@]');
+  MT('string_heredoc_nested_string', '[string @"]',
+    '[string a][punctuation $(][string "w"][punctuation )][string b]',
+  '[string "@]');
+  MT('string_heredoc_literal_quotes', "[string @']",
+    '[string abc "\']',
+  "[string '@]");
+
+  MT('array', "[punctuation @(][string 'a'][punctuation ,][string 'b'][punctuation )]");
+  MT('hash', "[punctuation @{][string 'key'][operator :][string 'value'][punctuation }]");
+
+  MT('variable', "[variable-2 $test]");
+  MT('variable_global',  "[variable-2 $global:test]");
+  MT('variable_spaces',  "[variable-2 ${test test}]");
+  MT('operator_splat',   "[variable-2 @x]");
+  MT('variable_builtin', "[builtin $ErrorActionPreference]");
+  MT('variable_builtin_symbols', "[builtin $$]");
+
+  MT('operator', "[operator +]");
+  MT('operator_unary', "[operator +][number 3]");
+  MT('operator_long', "[operator -match]");
+
+  forEach([
+    '(', ')', '[[', ']]', '{', '}', ',', '`', ';', '.', '\\'
+  ], function(punctuation) {
+    MT("punctuation_" + punctuation.replace(/^[\[\]]/,''), "[punctuation " + punctuation + "]");
+  });
+
+  MT('keyword', "[keyword if]");
+
+  MT('call_builtin', "[builtin Get-ChildItem]");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/properties/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,53 @@
+<!doctype html>
+
+<title>CodeMirror: Properties files mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="properties.js"></script>
+<style>.CodeMirror {border-top: 1px solid #ddd; border-bottom: 1px solid #ddd;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Properties files</a>
+  </ul>
+</div>
+
+<article>
+<h2>Properties files mode</h2>
+<form><textarea id="code" name="code">
+# This is a properties file
+a.key = A value
+another.key = http://example.com
+! Exclamation mark as comment
+but.not=Within ! A value # indeed
+   # Spaces at the beginning of a line
+   spaces.before.key=value
+backslash=Used for multi\
+          line entries,\
+          that's convenient.
+# Unicode sequences
+unicode.key=This is \u0020 Unicode
+no.multiline=here
+# Colons
+colons : can be used too
+# Spaces
+spaces\ in\ keys=Not very common...
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-properties</code>,
+    <code>text/x-ini</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/properties/properties.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,78 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("properties", function() {
+  return {
+    token: function(stream, state) {
+      var sol = stream.sol() || state.afterSection;
+      var eol = stream.eol();
+
+      state.afterSection = false;
+
+      if (sol) {
+        if (state.nextMultiline) {
+          state.inMultiline = true;
+          state.nextMultiline = false;
+        } else {
+          state.position = "def";
+        }
+      }
+
+      if (eol && ! state.nextMultiline) {
+        state.inMultiline = false;
+        state.position = "def";
+      }
+
+      if (sol) {
+        while(stream.eatSpace()) {}
+      }
+
+      var ch = stream.next();
+
+      if (sol && (ch === "#" || ch === "!" || ch === ";")) {
+        state.position = "comment";
+        stream.skipToEnd();
+        return "comment";
+      } else if (sol && ch === "[") {
+        state.afterSection = true;
+        stream.skipTo("]"); stream.eat("]");
+        return "header";
+      } else if (ch === "=" || ch === ":") {
+        state.position = "quote";
+        return null;
+      } else if (ch === "\\" && state.position === "quote") {
+        if (stream.eol()) {  // end of line?
+          // Multiline value
+          state.nextMultiline = true;
+        }
+      }
+
+      return state.position;
+    },
+
+    startState: function() {
+      return {
+        position : "def",       // Current position, "def", "quote" or "comment"
+        nextMultiline : false,  // Is the next line multiline value
+        inMultiline : false,    // Is the current line a multiline value
+        afterSection : false    // Did we just open a section
+      };
+    }
+
+  };
+});
+
+CodeMirror.defineMIME("text/x-properties", "properties");
+CodeMirror.defineMIME("text/x-ini", "properties");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/protobuf/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,104 @@
+<!doctype html>
+
+<title>CodeMirror: ProtoBuf mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="protobuf.js"></script>
+<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">ProtoBuf</a>
+  </ul>
+</div>
+
+<article>
+<h2>ProtoBuf mode</h2>
+<form><textarea id="code" name="code">
+package addressbook;
+
+message Address {
+   required string street = 1;
+   required string postCode = 2;
+}
+
+message PhoneNumber {
+   required string number = 1;
+}
+
+message Person {
+   optional int32 id = 1;
+   required string name = 2;
+   required string surname = 3;
+   optional Address address = 4;
+   repeated PhoneNumber phoneNumbers = 5;
+   optional uint32 age = 6;
+   repeated uint32 favouriteNumbers = 7;
+   optional string license = 8;
+   enum Gender {
+      MALE = 0;
+      FEMALE = 1;
+   }
+   optional Gender gender = 9;
+   optional fixed64 lastUpdate = 10;
+   required bool deleted = 11 [default = false];
+}
+
+</textarea>
+  <textarea id="code2" name="code2">
+syntax = "proto3";
+package tutorial;
+
+import "google/protobuf/timestamp.proto";
+option java_package = "com.example.tutorial";
+option java_outer_classname = "AddressBookProtos";
+option csharp_namespace = "Google.Protobuf.Examples.AddressBook";
+
+message Person {
+  string name = 1;
+  int32 id = 2;  // Unique ID number for this person.
+  string email = 3;
+
+  enum PhoneType {
+    MOBILE = 0;
+    HOME = 1;
+    WORK = 2;
+  }
+
+  message PhoneNumber {
+    string number = 1;
+    PhoneType type = 2;
+  }
+
+  repeated PhoneNumber phones = 4;
+
+  google.protobuf.Timestamp last_updated = 5;
+}
+
+// Our address book file is just one of these.
+message AddressBook {
+  repeated Person people = 1;
+}
+service Test {
+  rpc SayHello (HelloRequest) returns (HelloReply) {}
+  rpc SayHelloAgain (HelloRequest) returns (HelloReply) {}
+}</textarea>
+</form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+      var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-protobuf</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/protobuf/protobuf.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  function wordRegexp(words) {
+    return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
+  };
+
+  var keywordArray = [
+    "package", "message", "import", "syntax",
+    "required", "optional", "repeated", "reserved", "default", "extensions", "packed",
+    "bool", "bytes", "double", "enum", "float", "string",
+    "int32", "int64", "uint32", "uint64", "sint32", "sint64", "fixed32", "fixed64", "sfixed32", "sfixed64",
+    "option", "service", "rpc", "returns"
+  ];
+  var keywords = wordRegexp(keywordArray);
+
+  CodeMirror.registerHelper("hintWords", "protobuf", keywordArray);
+
+  var identifiers = new RegExp("^[_A-Za-z\xa1-\uffff][_A-Za-z0-9\xa1-\uffff]*");
+
+  function tokenBase(stream) {
+    // whitespaces
+    if (stream.eatSpace()) return null;
+
+    // Handle one line Comments
+    if (stream.match("//")) {
+      stream.skipToEnd();
+      return "comment";
+    }
+
+    // Handle Number Literals
+    if (stream.match(/^[0-9\.+-]/, false)) {
+      if (stream.match(/^[+-]?0x[0-9a-fA-F]+/))
+        return "number";
+      if (stream.match(/^[+-]?\d*\.\d+([EeDd][+-]?\d+)?/))
+        return "number";
+      if (stream.match(/^[+-]?\d+([EeDd][+-]?\d+)?/))
+        return "number";
+    }
+
+    // Handle Strings
+    if (stream.match(/^"([^"]|(""))*"/)) { return "string"; }
+    if (stream.match(/^'([^']|(''))*'/)) { return "string"; }
+
+    // Handle words
+    if (stream.match(keywords)) { return "keyword"; }
+    if (stream.match(identifiers)) { return "variable"; } ;
+
+    // Handle non-detected items
+    stream.next();
+    return null;
+  };
+
+  CodeMirror.defineMode("protobuf", function() {
+    return {
+      token: tokenBase,
+      fold: "brace"
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-protobuf", "protobuf");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pug/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,70 @@
+<!doctype html>
+
+<title>CodeMirror: Pug Templating Mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="pug.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Pug Templating Mode</a>
+  </ul>
+</div>
+
+<article>
+<h2>Pug Templating Mode</h2>
+<form><textarea id="code" name="code">
+doctype html
+  html
+    head
+      title= "Pug Templating CodeMirror Mode Example"
+      link(rel='stylesheet', href='/css/bootstrap.min.css')
+      link(rel='stylesheet', href='/css/index.css')
+      script(type='text/javascript', src='/js/jquery-1.9.1.min.js')
+      script(type='text/javascript', src='/js/bootstrap.min.js')
+    body
+      div.header
+        h1 Welcome to this Example
+      div.spots
+        if locals.spots
+          each spot in spots
+            div.spot.well
+         div
+           if spot.logo
+             img.img-rounded.logo(src=spot.logo)
+           else
+             img.img-rounded.logo(src="img/placeholder.png")
+         h3
+           a(href=spot.hash) ##{spot.hash}
+           if spot.title
+             span.title #{spot.title}
+           if spot.desc
+             div #{spot.desc}
+        else
+          h3 There are no spots currently available.
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "pug", alignCDATA: true},
+        lineNumbers: true
+      });
+    </script>
+    <h3>The Pug Templating Mode</h3>
+      <p> Created by Forbes Lindesay. Managed as part of a Brackets extension at <a href="https://github.com/ForbesLindesay/jade-brackets">https://github.com/ForbesLindesay/jade-brackets</a>.</p>
+    <p><strong>MIME type defined:</strong> <code>text/x-pug</code>, <code>text/x-jade</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/pug/pug.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,591 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../javascript/javascript"), require("../css/css"), require("../htmlmixed/htmlmixed"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../javascript/javascript", "../css/css", "../htmlmixed/htmlmixed"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("pug", function (config) {
+  // token types
+  var KEYWORD = 'keyword';
+  var DOCTYPE = 'meta';
+  var ID = 'builtin';
+  var CLASS = 'qualifier';
+
+  var ATTRS_NEST = {
+    '{': '}',
+    '(': ')',
+    '[': ']'
+  };
+
+  var jsMode = CodeMirror.getMode(config, 'javascript');
+
+  function State() {
+    this.javaScriptLine = false;
+    this.javaScriptLineExcludesColon = false;
+
+    this.javaScriptArguments = false;
+    this.javaScriptArgumentsDepth = 0;
+
+    this.isInterpolating = false;
+    this.interpolationNesting = 0;
+
+    this.jsState = CodeMirror.startState(jsMode);
+
+    this.restOfLine = '';
+
+    this.isIncludeFiltered = false;
+    this.isEach = false;
+
+    this.lastTag = '';
+    this.scriptType = '';
+
+    // Attributes Mode
+    this.isAttrs = false;
+    this.attrsNest = [];
+    this.inAttributeName = true;
+    this.attributeIsType = false;
+    this.attrValue = '';
+
+    // Indented Mode
+    this.indentOf = Infinity;
+    this.indentToken = '';
+
+    this.innerMode = null;
+    this.innerState = null;
+
+    this.innerModeForLine = false;
+  }
+  /**
+   * Safely copy a state
+   *
+   * @return {State}
+   */
+  State.prototype.copy = function () {
+    var res = new State();
+    res.javaScriptLine = this.javaScriptLine;
+    res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon;
+    res.javaScriptArguments = this.javaScriptArguments;
+    res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth;
+    res.isInterpolating = this.isInterpolating;
+    res.interpolationNesting = this.interpolationNesting;
+
+    res.jsState = CodeMirror.copyState(jsMode, this.jsState);
+
+    res.innerMode = this.innerMode;
+    if (this.innerMode && this.innerState) {
+      res.innerState = CodeMirror.copyState(this.innerMode, this.innerState);
+    }
+
+    res.restOfLine = this.restOfLine;
+
+    res.isIncludeFiltered = this.isIncludeFiltered;
+    res.isEach = this.isEach;
+    res.lastTag = this.lastTag;
+    res.scriptType = this.scriptType;
+    res.isAttrs = this.isAttrs;
+    res.attrsNest = this.attrsNest.slice();
+    res.inAttributeName = this.inAttributeName;
+    res.attributeIsType = this.attributeIsType;
+    res.attrValue = this.attrValue;
+    res.indentOf = this.indentOf;
+    res.indentToken = this.indentToken;
+
+    res.innerModeForLine = this.innerModeForLine;
+
+    return res;
+  };
+
+  function javaScript(stream, state) {
+    if (stream.sol()) {
+      // if javaScriptLine was set at end of line, ignore it
+      state.javaScriptLine = false;
+      state.javaScriptLineExcludesColon = false;
+    }
+    if (state.javaScriptLine) {
+      if (state.javaScriptLineExcludesColon && stream.peek() === ':') {
+        state.javaScriptLine = false;
+        state.javaScriptLineExcludesColon = false;
+        return;
+      }
+      var tok = jsMode.token(stream, state.jsState);
+      if (stream.eol()) state.javaScriptLine = false;
+      return tok || true;
+    }
+  }
+  function javaScriptArguments(stream, state) {
+    if (state.javaScriptArguments) {
+      if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') {
+        state.javaScriptArguments = false;
+        return;
+      }
+      if (stream.peek() === '(') {
+        state.javaScriptArgumentsDepth++;
+      } else if (stream.peek() === ')') {
+        state.javaScriptArgumentsDepth--;
+      }
+      if (state.javaScriptArgumentsDepth === 0) {
+        state.javaScriptArguments = false;
+        return;
+      }
+
+      var tok = jsMode.token(stream, state.jsState);
+      return tok || true;
+    }
+  }
+
+  function yieldStatement(stream) {
+    if (stream.match(/^yield\b/)) {
+        return 'keyword';
+    }
+  }
+
+  function doctype(stream) {
+    if (stream.match(/^(?:doctype) *([^\n]+)?/)) {
+        return DOCTYPE;
+    }
+  }
+
+  function interpolation(stream, state) {
+    if (stream.match('#{')) {
+      state.isInterpolating = true;
+      state.interpolationNesting = 0;
+      return 'punctuation';
+    }
+  }
+
+  function interpolationContinued(stream, state) {
+    if (state.isInterpolating) {
+      if (stream.peek() === '}') {
+        state.interpolationNesting--;
+        if (state.interpolationNesting < 0) {
+          stream.next();
+          state.isInterpolating = false;
+          return 'punctuation';
+        }
+      } else if (stream.peek() === '{') {
+        state.interpolationNesting++;
+      }
+      return jsMode.token(stream, state.jsState) || true;
+    }
+  }
+
+  function caseStatement(stream, state) {
+    if (stream.match(/^case\b/)) {
+      state.javaScriptLine = true;
+      return KEYWORD;
+    }
+  }
+
+  function when(stream, state) {
+    if (stream.match(/^when\b/)) {
+      state.javaScriptLine = true;
+      state.javaScriptLineExcludesColon = true;
+      return KEYWORD;
+    }
+  }
+
+  function defaultStatement(stream) {
+    if (stream.match(/^default\b/)) {
+      return KEYWORD;
+    }
+  }
+
+  function extendsStatement(stream, state) {
+    if (stream.match(/^extends?\b/)) {
+      state.restOfLine = 'string';
+      return KEYWORD;
+    }
+  }
+
+  function append(stream, state) {
+    if (stream.match(/^append\b/)) {
+      state.restOfLine = 'variable';
+      return KEYWORD;
+    }
+  }
+  function prepend(stream, state) {
+    if (stream.match(/^prepend\b/)) {
+      state.restOfLine = 'variable';
+      return KEYWORD;
+    }
+  }
+  function block(stream, state) {
+    if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) {
+      state.restOfLine = 'variable';
+      return KEYWORD;
+    }
+  }
+
+  function include(stream, state) {
+    if (stream.match(/^include\b/)) {
+      state.restOfLine = 'string';
+      return KEYWORD;
+    }
+  }
+
+  function includeFiltered(stream, state) {
+    if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) {
+      state.isIncludeFiltered = true;
+      return KEYWORD;
+    }
+  }
+
+  function includeFilteredContinued(stream, state) {
+    if (state.isIncludeFiltered) {
+      var tok = filter(stream, state);
+      state.isIncludeFiltered = false;
+      state.restOfLine = 'string';
+      return tok;
+    }
+  }
+
+  function mixin(stream, state) {
+    if (stream.match(/^mixin\b/)) {
+      state.javaScriptLine = true;
+      return KEYWORD;
+    }
+  }
+
+  function call(stream, state) {
+    if (stream.match(/^\+([-\w]+)/)) {
+      if (!stream.match(/^\( *[-\w]+ *=/, false)) {
+        state.javaScriptArguments = true;
+        state.javaScriptArgumentsDepth = 0;
+      }
+      return 'variable';
+    }
+    if (stream.match('+#{', false)) {
+      stream.next();
+      state.mixinCallAfter = true;
+      return interpolation(stream, state);
+    }
+  }
+  function callArguments(stream, state) {
+    if (state.mixinCallAfter) {
+      state.mixinCallAfter = false;
+      if (!stream.match(/^\( *[-\w]+ *=/, false)) {
+        state.javaScriptArguments = true;
+        state.javaScriptArgumentsDepth = 0;
+      }
+      return true;
+    }
+  }
+
+  function conditional(stream, state) {
+    if (stream.match(/^(if|unless|else if|else)\b/)) {
+      state.javaScriptLine = true;
+      return KEYWORD;
+    }
+  }
+
+  function each(stream, state) {
+    if (stream.match(/^(- *)?(each|for)\b/)) {
+      state.isEach = true;
+      return KEYWORD;
+    }
+  }
+  function eachContinued(stream, state) {
+    if (state.isEach) {
+      if (stream.match(/^ in\b/)) {
+        state.javaScriptLine = true;
+        state.isEach = false;
+        return KEYWORD;
+      } else if (stream.sol() || stream.eol()) {
+        state.isEach = false;
+      } else if (stream.next()) {
+        while (!stream.match(/^ in\b/, false) && stream.next());
+        return 'variable';
+      }
+    }
+  }
+
+  function whileStatement(stream, state) {
+    if (stream.match(/^while\b/)) {
+      state.javaScriptLine = true;
+      return KEYWORD;
+    }
+  }
+
+  function tag(stream, state) {
+    var captures;
+    if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) {
+      state.lastTag = captures[1].toLowerCase();
+      if (state.lastTag === 'script') {
+        state.scriptType = 'application/javascript';
+      }
+      return 'tag';
+    }
+  }
+
+  function filter(stream, state) {
+    if (stream.match(/^:([\w\-]+)/)) {
+      var innerMode;
+      if (config && config.innerModes) {
+        innerMode = config.innerModes(stream.current().substring(1));
+      }
+      if (!innerMode) {
+        innerMode = stream.current().substring(1);
+      }
+      if (typeof innerMode === 'string') {
+        innerMode = CodeMirror.getMode(config, innerMode);
+      }
+      setInnerMode(stream, state, innerMode);
+      return 'atom';
+    }
+  }
+
+  function code(stream, state) {
+    if (stream.match(/^(!?=|-)/)) {
+      state.javaScriptLine = true;
+      return 'punctuation';
+    }
+  }
+
+  function id(stream) {
+    if (stream.match(/^#([\w-]+)/)) {
+      return ID;
+    }
+  }
+
+  function className(stream) {
+    if (stream.match(/^\.([\w-]+)/)) {
+      return CLASS;
+    }
+  }
+
+  function attrs(stream, state) {
+    if (stream.peek() == '(') {
+      stream.next();
+      state.isAttrs = true;
+      state.attrsNest = [];
+      state.inAttributeName = true;
+      state.attrValue = '';
+      state.attributeIsType = false;
+      return 'punctuation';
+    }
+  }
+
+  function attrsContinued(stream, state) {
+    if (state.isAttrs) {
+      if (ATTRS_NEST[stream.peek()]) {
+        state.attrsNest.push(ATTRS_NEST[stream.peek()]);
+      }
+      if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) {
+        state.attrsNest.pop();
+      } else  if (stream.eat(')')) {
+        state.isAttrs = false;
+        return 'punctuation';
+      }
+      if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
+        if (stream.peek() === '=' || stream.peek() === '!') {
+          state.inAttributeName = false;
+          state.jsState = CodeMirror.startState(jsMode);
+          if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') {
+            state.attributeIsType = true;
+          } else {
+            state.attributeIsType = false;
+          }
+        }
+        return 'attribute';
+      }
+
+      var tok = jsMode.token(stream, state.jsState);
+      if (state.attributeIsType && tok === 'string') {
+        state.scriptType = stream.current().toString();
+      }
+      if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) {
+        try {
+          Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, ''));
+          state.inAttributeName = true;
+          state.attrValue = '';
+          stream.backUp(stream.current().length);
+          return attrsContinued(stream, state);
+        } catch (ex) {
+          //not the end of an attribute
+        }
+      }
+      state.attrValue += stream.current();
+      return tok || true;
+    }
+  }
+
+  function attributesBlock(stream, state) {
+    if (stream.match(/^&attributes\b/)) {
+      state.javaScriptArguments = true;
+      state.javaScriptArgumentsDepth = 0;
+      return 'keyword';
+    }
+  }
+
+  function indent(stream) {
+    if (stream.sol() && stream.eatSpace()) {
+      return 'indent';
+    }
+  }
+
+  function comment(stream, state) {
+    if (stream.match(/^ *\/\/(-)?([^\n]*)/)) {
+      state.indentOf = stream.indentation();
+      state.indentToken = 'comment';
+      return 'comment';
+    }
+  }
+
+  function colon(stream) {
+    if (stream.match(/^: */)) {
+      return 'colon';
+    }
+  }
+
+  function text(stream, state) {
+    if (stream.match(/^(?:\| ?| )([^\n]+)/)) {
+      return 'string';
+    }
+    if (stream.match(/^(<[^\n]*)/, false)) {
+      // html string
+      setInnerMode(stream, state, 'htmlmixed');
+      state.innerModeForLine = true;
+      return innerMode(stream, state, true);
+    }
+  }
+
+  function dot(stream, state) {
+    if (stream.eat('.')) {
+      var innerMode = null;
+      if (state.lastTag === 'script' && state.scriptType.toLowerCase().indexOf('javascript') != -1) {
+        innerMode = state.scriptType.toLowerCase().replace(/"|'/g, '');
+      } else if (state.lastTag === 'style') {
+        innerMode = 'css';
+      }
+      setInnerMode(stream, state, innerMode);
+      return 'dot';
+    }
+  }
+
+  function fail(stream) {
+    stream.next();
+    return null;
+  }
+
+
+  function setInnerMode(stream, state, mode) {
+    mode = CodeMirror.mimeModes[mode] || mode;
+    mode = config.innerModes ? config.innerModes(mode) || mode : mode;
+    mode = CodeMirror.mimeModes[mode] || mode;
+    mode = CodeMirror.getMode(config, mode);
+    state.indentOf = stream.indentation();
+
+    if (mode && mode.name !== 'null') {
+      state.innerMode = mode;
+    } else {
+      state.indentToken = 'string';
+    }
+  }
+  function innerMode(stream, state, force) {
+    if (stream.indentation() > state.indentOf || (state.innerModeForLine && !stream.sol()) || force) {
+      if (state.innerMode) {
+        if (!state.innerState) {
+          state.innerState = state.innerMode.startState ? CodeMirror.startState(state.innerMode, stream.indentation()) : {};
+        }
+        return stream.hideFirstChars(state.indentOf + 2, function () {
+          return state.innerMode.token(stream, state.innerState) || true;
+        });
+      } else {
+        stream.skipToEnd();
+        return state.indentToken;
+      }
+    } else if (stream.sol()) {
+      state.indentOf = Infinity;
+      state.indentToken = null;
+      state.innerMode = null;
+      state.innerState = null;
+    }
+  }
+  function restOfLine(stream, state) {
+    if (stream.sol()) {
+      // if restOfLine was set at end of line, ignore it
+      state.restOfLine = '';
+    }
+    if (state.restOfLine) {
+      stream.skipToEnd();
+      var tok = state.restOfLine;
+      state.restOfLine = '';
+      return tok;
+    }
+  }
+
+
+  function startState() {
+    return new State();
+  }
+  function copyState(state) {
+    return state.copy();
+  }
+  /**
+   * Get the next token in the stream
+   *
+   * @param {Stream} stream
+   * @param {State} state
+   */
+  function nextToken(stream, state) {
+    var tok = innerMode(stream, state)
+      || restOfLine(stream, state)
+      || interpolationContinued(stream, state)
+      || includeFilteredContinued(stream, state)
+      || eachContinued(stream, state)
+      || attrsContinued(stream, state)
+      || javaScript(stream, state)
+      || javaScriptArguments(stream, state)
+      || callArguments(stream, state)
+
+      || yieldStatement(stream)
+      || doctype(stream)
+      || interpolation(stream, state)
+      || caseStatement(stream, state)
+      || when(stream, state)
+      || defaultStatement(stream)
+      || extendsStatement(stream, state)
+      || append(stream, state)
+      || prepend(stream, state)
+      || block(stream, state)
+      || include(stream, state)
+      || includeFiltered(stream, state)
+      || mixin(stream, state)
+      || call(stream, state)
+      || conditional(stream, state)
+      || each(stream, state)
+      || whileStatement(stream, state)
+      || tag(stream, state)
+      || filter(stream, state)
+      || code(stream, state)
+      || id(stream)
+      || className(stream)
+      || attrs(stream, state)
+      || attributesBlock(stream, state)
+      || indent(stream)
+      || text(stream, state)
+      || comment(stream, state)
+      || colon(stream)
+      || dot(stream, state)
+      || fail(stream);
+
+    return tok === true ? null : tok;
+  }
+  return {
+    startState: startState,
+    copyState: copyState,
+    token: nextToken
+  };
+}, 'javascript', 'css', 'htmlmixed');
+
+CodeMirror.defineMIME('text/x-pug', 'pug');
+CodeMirror.defineMIME('text/x-jade', 'pug');
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/puppet/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,121 @@
+<!doctype html>
+
+<title>CodeMirror: Puppet mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="puppet.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .cm-s-default span.cm-arrow { color: red; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Puppet</a>
+  </ul>
+</div>
+
+<article>
+<h2>Puppet mode</h2>
+<form><textarea id="code" name="code">
+# == Class: automysqlbackup
+#
+# Puppet module to install AutoMySQLBackup for periodic MySQL backups.
+#
+# class { 'automysqlbackup':
+#   backup_dir => '/mnt/backups',
+# }
+#
+
+class automysqlbackup (
+  $bin_dir = $automysqlbackup::params::bin_dir,
+  $etc_dir = $automysqlbackup::params::etc_dir,
+  $backup_dir = $automysqlbackup::params::backup_dir,
+  $install_multicore = undef,
+  $config = {},
+  $config_defaults = {},
+) inherits automysqlbackup::params {
+
+# Ensure valid paths are assigned
+  validate_absolute_path($bin_dir)
+  validate_absolute_path($etc_dir)
+  validate_absolute_path($backup_dir)
+
+# Create a subdirectory in /etc for config files
+  file { $etc_dir:
+    ensure => directory,
+    owner => 'root',
+    group => 'root',
+    mode => '0750',
+  }
+
+# Create an example backup file, useful for reference
+  file { "${etc_dir}/automysqlbackup.conf.example":
+    ensure => file,
+    owner => 'root',
+    group => 'root',
+    mode => '0660',
+    source => 'puppet:///modules/automysqlbackup/automysqlbackup.conf',
+  }
+
+# Add files from the developer
+  file { "${etc_dir}/AMB_README":
+    ensure => file,
+    source => 'puppet:///modules/automysqlbackup/AMB_README',
+  }
+  file { "${etc_dir}/AMB_LICENSE":
+    ensure => file,
+    source => 'puppet:///modules/automysqlbackup/AMB_LICENSE',
+  }
+
+# Install the actual binary file
+  file { "${bin_dir}/automysqlbackup":
+    ensure => file,
+    owner => 'root',
+    group => 'root',
+    mode => '0755',
+    source => 'puppet:///modules/automysqlbackup/automysqlbackup',
+  }
+
+# Create the base backup directory
+  file { $backup_dir:
+    ensure => directory,
+    owner => 'root',
+    group => 'root',
+    mode => '0755',
+  }
+
+# If you'd like to keep your config in hiera and pass it to this class
+  if !empty($config) {
+    create_resources('automysqlbackup::backup', $config, $config_defaults)
+  }
+
+# If using RedHat family, must have the RPMforge repo's enabled
+  if $install_multicore {
+    package { ['pigz', 'pbzip2']: ensure => installed }
+  }
+
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/x-puppet",
+        matchBrackets: true,
+        indentUnit: 4
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-puppet</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/puppet/puppet.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,220 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("puppet", function () {
+  // Stores the words from the define method
+  var words = {};
+  // Taken, mostly, from the Puppet official variable standards regex
+  var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;
+
+  // Takes a string of words separated by spaces and adds them as
+  // keys with the value of the first argument 'style'
+  function define(style, string) {
+    var split = string.split(' ');
+    for (var i = 0; i < split.length; i++) {
+      words[split[i]] = style;
+    }
+  }
+
+  // Takes commonly known puppet types/words and classifies them to a style
+  define('keyword', 'class define site node include import inherits');
+  define('keyword', 'case if else in and elsif default or');
+  define('atom', 'false true running present absent file directory undef');
+  define('builtin', 'action augeas burst chain computer cron destination dport exec ' +
+    'file filebucket group host icmp iniface interface jump k5login limit log_level ' +
+    'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' +
+    'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' +
+    'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' +
+    'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' +
+    'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' +
+    'resources router schedule scheduled_task selboolean selmodule service source ' +
+    'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' +
+    'user vlan yumrepo zfs zone zpool');
+
+  // After finding a start of a string ('|") this function attempts to find the end;
+  // If a variable is encountered along the way, we display it differently when it
+  // is encapsulated in a double-quoted string.
+  function tokenString(stream, state) {
+    var current, prev, found_var = false;
+    while (!stream.eol() && (current = stream.next()) != state.pending) {
+      if (current === '$' && prev != '\\' && state.pending == '"') {
+        found_var = true;
+        break;
+      }
+      prev = current;
+    }
+    if (found_var) {
+      stream.backUp(1);
+    }
+    if (current == state.pending) {
+      state.continueString = false;
+    } else {
+      state.continueString = true;
+    }
+    return "string";
+  }
+
+  // Main function
+  function tokenize(stream, state) {
+    // Matches one whole word
+    var word = stream.match(/[\w]+/, false);
+    // Matches attributes (i.e. ensure => present ; 'ensure' would be matched)
+    var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false);
+    // Matches non-builtin resource declarations
+    // (i.e. "apache::vhost {" or "mycustomclasss {" would be matched)
+    var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
+    // Matches virtual and exported resources (i.e. @@user { ; and the like)
+    var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);
+
+    // Finally advance the stream
+    var ch = stream.next();
+
+    // Have we found a variable?
+    if (ch === '$') {
+      if (stream.match(variable_regex)) {
+        // If so, and its in a string, assign it a different color
+        return state.continueString ? 'variable-2' : 'variable';
+      }
+      // Otherwise return an invalid variable
+      return "error";
+    }
+    // Should we still be looking for the end of a string?
+    if (state.continueString) {
+      // If so, go through the loop again
+      stream.backUp(1);
+      return tokenString(stream, state);
+    }
+    // Are we in a definition (class, node, define)?
+    if (state.inDefinition) {
+      // If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched)
+      if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
+        return 'def';
+      }
+      // Match the rest it the next time around
+      stream.match(/\s+{/);
+      state.inDefinition = false;
+    }
+    // Are we in an 'include' statement?
+    if (state.inInclude) {
+      // Match and return the included class
+      stream.match(/(\s+)?\S+(\s+)?/);
+      state.inInclude = false;
+      return 'def';
+    }
+    // Do we just have a function on our hands?
+    // In 'ensure_resource("myclass")', 'ensure_resource' is matched
+    if (stream.match(/(\s+)?\w+\(/)) {
+      stream.backUp(1);
+      return 'def';
+    }
+    // Have we matched the prior attribute regex?
+    if (attribute) {
+      stream.match(/(\s+)?\w+/);
+      return 'tag';
+    }
+    // Do we have Puppet specific words?
+    if (word && words.hasOwnProperty(word)) {
+      // Negates the initial next()
+      stream.backUp(1);
+      // rs move the stream
+      stream.match(/[\w]+/);
+      // We want to process these words differently
+      // do to the importance they have in Puppet
+      if (stream.match(/\s+\S+\s+{/, false)) {
+        state.inDefinition = true;
+      }
+      if (word == 'include') {
+        state.inInclude = true;
+      }
+      // Returns their value as state in the prior define methods
+      return words[word];
+    }
+    // Is there a match on a reference?
+    if (/(^|\s+)[A-Z][\w:_]+/.test(word)) {
+      // Negate the next()
+      stream.backUp(1);
+      // Match the full reference
+      stream.match(/(^|\s+)[A-Z][\w:_]+/);
+      return 'def';
+    }
+    // Have we matched the prior resource regex?
+    if (resource) {
+      stream.match(/(\s+)?[\w:_]+/);
+      return 'def';
+    }
+    // Have we matched the prior special_resource regex?
+    if (special_resource) {
+      stream.match(/(\s+)?[@]{1,2}/);
+      return 'special';
+    }
+    // Match all the comments. All of them.
+    if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    // Have we found a string?
+    if (ch == "'" || ch == '"') {
+      // Store the type (single or double)
+      state.pending = ch;
+      // Perform the looping function to find the end
+      return tokenString(stream, state);
+    }
+    // Match all the brackets
+    if (ch == '{' || ch == '}') {
+      return 'bracket';
+    }
+    // Match characters that we are going to assume
+    // are trying to be regex
+    if (ch == '/') {
+      stream.match(/^[^\/]*\//);
+      return 'variable-3';
+    }
+    // Match all the numbers
+    if (ch.match(/[0-9]/)) {
+      stream.eatWhile(/[0-9]+/);
+      return 'number';
+    }
+    // Match the '=' and '=>' operators
+    if (ch == '=') {
+      if (stream.peek() == '>') {
+          stream.next();
+      }
+      return "operator";
+    }
+    // Keep advancing through all the rest
+    stream.eatWhile(/[\w-]/);
+    // Return a blank line for everything else
+    return null;
+  }
+  // Start it all
+  return {
+    startState: function () {
+      var state = {};
+      state.inDefinition = false;
+      state.inInclude = false;
+      state.continueString = false;
+      state.pending = false;
+      return state;
+    },
+    token: function (stream, state) {
+      // Strip the spaces, but regex will account for them eitherway
+      if (stream.eatSpace()) return null;
+      // Go through the main process
+      return tokenize(stream, state);
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-puppet", "puppet");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/python/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,207 @@
+<!doctype html>
+
+<title>CodeMirror: Python mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="python.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Python</a>
+  </ul>
+</div>
+
+<article>
+<h2>Python mode</h2>
+
+    <div><textarea id="code" name="code">
+# Literals
+1234
+0.0e101
+.123
+0b01010011100
+0o01234567
+0x0987654321abcdef
+7
+2147483647
+3L
+79228162514264337593543950336L
+0x100000000L
+79228162514264337593543950336
+0xdeadbeef
+3.14j
+10.j
+10j
+.001j
+1e100j
+3.14e-10j
+
+
+# String Literals
+'For\''
+"God\""
+"""so loved
+the world"""
+'''that he gave
+his only begotten\' '''
+'that whosoever believeth \
+in him'
+''
+
+# Identifiers
+__a__
+a.b
+a.b.c
+
+#Unicode identifiers on Python3
+# a = x\ddot
+a⃗ = ẍ
+# a = v\dot
+a⃗ = v̇
+
+#F\vec = m \cdot a\vec
+F⃗ = m•a⃗ 
+
+# Operators
++ - * / % & | ^ ~ < >
+== != <= >= <> << >> // **
+and or not in is
+
+#infix matrix multiplication operator (PEP 465)
+A @ B
+
+# Delimiters
+() [] {} , : ` = ; @ .  # Note that @ and . require the proper context on Python 2.
++= -= *= /= %= &= |= ^=
+//= >>= <<= **=
+
+# Keywords
+as assert break class continue def del elif else except
+finally for from global if import lambda pass raise
+return try while with yield
+
+# Python 2 Keywords (otherwise Identifiers)
+exec print
+
+# Python 3 Keywords (otherwise Identifiers)
+nonlocal
+
+# Types
+bool classmethod complex dict enumerate float frozenset int list object
+property reversed set slice staticmethod str super tuple type
+
+# Python 2 Types (otherwise Identifiers)
+basestring buffer file long unicode xrange
+
+# Python 3 Types (otherwise Identifiers)
+bytearray bytes filter map memoryview open range zip
+
+# Some Example code
+import os
+from package import ParentClass
+
+@nonsenseDecorator
+def doesNothing():
+    pass
+
+class ExampleClass(ParentClass):
+    @staticmethod
+    def example(inputStr):
+        a = list(inputStr)
+        a.reverse()
+        return ''.join(a)
+
+    def __init__(self, mixin = 'Hello'):
+        self.mixin = mixin
+
+# Python 3.6 f-strings (https://www.python.org/dev/peps/pep-0498/)
+f'My name is {name}, my age next year is {age+1}, my anniversary is {anniversary:%A, %B %d, %Y}.'
+f'He said his name is {name!r}.'
+f"""He said his name is {name!r}."""
+f'{"quoted string"}'
+f'{{ {4*10} }}'
+f'This is an error }'
+f'This is ok }}'
+fr'x={4*10}\n'
+</textarea></div>
+
+
+<h2>Cython mode</h2>
+
+<div><textarea id="code-cython" name="code-cython">
+
+import numpy as np
+cimport cython
+from libc.math cimport sqrt
+
+@cython.boundscheck(False)
+@cython.wraparound(False)
+def pairwise_cython(double[:, ::1] X):
+    cdef int M = X.shape[0]
+    cdef int N = X.shape[1]
+    cdef double tmp, d
+    cdef double[:, ::1] D = np.empty((M, M), dtype=np.float64)
+    for i in range(M):
+        for j in range(M):
+            d = 0.0
+            for k in range(N):
+                tmp = X[i, k] - X[j, k]
+                d += tmp * tmp
+            D[i, j] = sqrt(d)
+    return np.asarray(D)
+
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "python",
+               version: 3,
+               singleLineStringErrors: false},
+        lineNumbers: true,
+        indentUnit: 4,
+        matchBrackets: true
+    });
+
+    CodeMirror.fromTextArea(document.getElementById("code-cython"), {
+        mode: {name: "text/x-cython",
+               version: 2,
+               singleLineStringErrors: false},
+        lineNumbers: true,
+        indentUnit: 4,
+        matchBrackets: true
+      });
+    </script>
+    <h2>Configuration Options for Python mode:</h2>
+    <ul>
+      <li>version - 2/3 - The version of Python to recognize.  Default is 3.</li>
+      <li>singleLineStringErrors - true/false - If you have a single-line string that is not terminated at the end of the line, this will show subsequent lines as errors if true, otherwise it will consider the newline as the end of the string. Default is false.</li>
+      <li>hangingIndent - int - If you want to write long arguments to a function starting on a new line, how much that line should be indented. Defaults to one normal indentation unit.</li>
+    </ul>
+    <h2>Advanced Configuration Options:</h2>
+    <p>Useful for superset of python syntax like Enthought enaml, IPython magics and  questionmark help</p>
+    <ul>
+      <li>singleOperators - RegEx - Regular Expression for single operator matching,  default : <pre>^[\\+\\-\\*/%&amp;|\\^~&lt;&gt;!]</pre> including <pre>@</pre> on Python 3</li>
+      <li>singleDelimiters - RegEx - Regular Expression for single delimiter matching, default :  <pre>^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]</pre></li>
+      <li>doubleOperators - RegEx - Regular Expression for double operators matching, default : <pre>^((==)|(!=)|(&lt;=)|(&gt;=)|(&lt;&gt;)|(&lt;&lt;)|(&gt;&gt;)|(//)|(\\*\\*))</pre></li>
+      <li>doubleDelimiters - RegEx - Regular Expression for double delimiters matching, default : <pre>^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&amp;=)|(\\|=)|(\\^=))</pre></li>
+      <li>tripleDelimiters - RegEx - Regular Expression for triple delimiters matching, default : <pre>^((//=)|(&gt;&gt;=)|(&lt;&lt;=)|(\\*\\*=))</pre></li>
+      <li>identifiers - RegEx - Regular Expression for identifier, default : <pre>^[_A-Za-z][_A-Za-z0-9]*</pre> on Python 2 and <pre>^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*</pre> on Python 3.</li>
+      <li>extra_keywords - list of string - List of extra words ton consider as keywords</li>
+      <li>extra_builtins - list of string - List of extra words ton consider as builtins</li>
+    </ul>
+
+
+    <p><strong>MIME types defined:</strong> <code>text/x-python</code> and <code>text/x-cython</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/python/python.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,402 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  function wordRegexp(words) {
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
+  }
+
+  var wordOperators = wordRegexp(["and", "or", "not", "is"]);
+  var commonKeywords = ["as", "assert", "break", "class", "continue",
+                        "def", "del", "elif", "else", "except", "finally",
+                        "for", "from", "global", "if", "import",
+                        "lambda", "pass", "raise", "return",
+                        "try", "while", "with", "yield", "in", "False", "True"];
+  var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
+                        "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
+                        "enumerate", "eval", "filter", "float", "format", "frozenset",
+                        "getattr", "globals", "hasattr", "hash", "help", "hex", "id",
+                        "input", "int", "isinstance", "issubclass", "iter", "len",
+                        "list", "locals", "map", "max", "memoryview", "min", "next",
+                        "object", "oct", "open", "ord", "pow", "property", "range",
+                        "repr", "reversed", "round", "set", "setattr", "slice",
+                        "sorted", "staticmethod", "str", "sum", "super", "tuple",
+                        "type", "vars", "zip", "__import__", "NotImplemented",
+                        "Ellipsis", "__debug__"];
+  CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins).concat(["exec", "print"]));
+
+  function top(state) {
+    return state.scopes[state.scopes.length - 1];
+  }
+
+  CodeMirror.defineMode("python", function(conf, parserConf) {
+    var ERRORCLASS = "error";
+
+    var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
+    //               (Backwards-compatibility with old, cumbersome config system)
+    var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
+                     parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/]
+    for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
+
+    var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
+
+    var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
+    if (parserConf.extra_keywords != undefined)
+      myKeywords = myKeywords.concat(parserConf.extra_keywords);
+
+    if (parserConf.extra_builtins != undefined)
+      myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
+
+    var py3 = !(parserConf.version && Number(parserConf.version) < 3)
+    if (py3) {
+      // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
+      var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
+      myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
+      myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
+      var stringPrefixes = new RegExp("^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\"{3}|['\"]))", "i");
+    } else {
+      var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
+      myKeywords = myKeywords.concat(["exec", "print"]);
+      myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
+                                      "file", "intern", "long", "raw_input", "reduce", "reload",
+                                      "unichr", "unicode", "xrange", "None"]);
+      var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
+    }
+    var keywords = wordRegexp(myKeywords);
+    var builtins = wordRegexp(myBuiltins);
+
+    // tokenizers
+    function tokenBase(stream, state) {
+      var sol = stream.sol() && state.lastToken != "\\"
+      if (sol) state.indent = stream.indentation()
+      // Handle scope changes
+      if (sol && top(state).type == "py") {
+        var scopeOffset = top(state).offset;
+        if (stream.eatSpace()) {
+          var lineOffset = stream.indentation();
+          if (lineOffset > scopeOffset)
+            pushPyScope(state);
+          else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
+            state.errorToken = true;
+          return null;
+        } else {
+          var style = tokenBaseInner(stream, state);
+          if (scopeOffset > 0 && dedent(stream, state))
+            style += " " + ERRORCLASS;
+          return style;
+        }
+      }
+      return tokenBaseInner(stream, state);
+    }
+
+    function tokenBaseInner(stream, state, inFormat) {
+      if (stream.eatSpace()) return null;
+
+      // Handle Comments
+      if (!inFormat && stream.match(/^#.*/)) return "comment";
+
+      // Handle Number Literals
+      if (stream.match(/^[0-9\.]/, false)) {
+        var floatLiteral = false;
+        // Floats
+        if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
+        if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
+        if (stream.match(/^\.\d+/)) { floatLiteral = true; }
+        if (floatLiteral) {
+          // Float literals may be "imaginary"
+          stream.eat(/J/i);
+          return "number";
+        }
+        // Integers
+        var intLiteral = false;
+        // Hex
+        if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
+        // Binary
+        if (stream.match(/^0b[01_]+/i)) intLiteral = true;
+        // Octal
+        if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
+        // Decimal
+        if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
+          // Decimal literals may be "imaginary"
+          stream.eat(/J/i);
+          // TODO - Can you have imaginary longs?
+          intLiteral = true;
+        }
+        // Zero by itself with no other piece of number.
+        if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
+        if (intLiteral) {
+          // Integer literals may be "long"
+          stream.eat(/L/i);
+          return "number";
+        }
+      }
+
+      // Handle Strings
+      if (stream.match(stringPrefixes)) {
+        var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
+        if (!isFmtString) {
+          state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
+          return state.tokenize(stream, state);
+        } else {
+          state.tokenize = formatStringFactory(stream.current(), state.tokenize);
+          return state.tokenize(stream, state);
+        }
+      }
+
+      for (var i = 0; i < operators.length; i++)
+        if (stream.match(operators[i])) return "operator"
+
+      if (stream.match(delimiters)) return "punctuation";
+
+      if (state.lastToken == "." && stream.match(identifiers))
+        return "property";
+
+      if (stream.match(keywords) || stream.match(wordOperators))
+        return "keyword";
+
+      if (stream.match(builtins))
+        return "builtin";
+
+      if (stream.match(/^(self|cls)\b/))
+        return "variable-2";
+
+      if (stream.match(identifiers)) {
+        if (state.lastToken == "def" || state.lastToken == "class")
+          return "def";
+        return "variable";
+      }
+
+      // Handle non-detected items
+      stream.next();
+      return inFormat ? null :ERRORCLASS;
+    }
+
+    function formatStringFactory(delimiter, tokenOuter) {
+      while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
+        delimiter = delimiter.substr(1);
+
+      var singleline = delimiter.length == 1;
+      var OUTCLASS = "string";
+
+      function tokenNestedExpr(depth) {
+        return function(stream, state) {
+          var inner = tokenBaseInner(stream, state, true)
+          if (inner == "punctuation") {
+            if (stream.current() == "{") {
+              state.tokenize = tokenNestedExpr(depth + 1)
+            } else if (stream.current() == "}") {
+              if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)
+              else state.tokenize = tokenString
+            }
+          }
+          return inner
+        }
+      }
+
+      function tokenString(stream, state) {
+        while (!stream.eol()) {
+          stream.eatWhile(/[^'"\{\}\\]/);
+          if (stream.eat("\\")) {
+            stream.next();
+            if (singleline && stream.eol())
+              return OUTCLASS;
+          } else if (stream.match(delimiter)) {
+            state.tokenize = tokenOuter;
+            return OUTCLASS;
+          } else if (stream.match('{{')) {
+            // ignore {{ in f-str
+            return OUTCLASS;
+          } else if (stream.match('{', false)) {
+            // switch to nested mode
+            state.tokenize = tokenNestedExpr(0)
+            if (stream.current()) return OUTCLASS;
+            else return state.tokenize(stream, state)
+          } else if (stream.match('}}')) {
+            return OUTCLASS;
+          } else if (stream.match('}')) {
+            // single } in f-string is an error
+            return ERRORCLASS;
+          } else {
+            stream.eat(/['"]/);
+          }
+        }
+        if (singleline) {
+          if (parserConf.singleLineStringErrors)
+            return ERRORCLASS;
+          else
+            state.tokenize = tokenOuter;
+        }
+        return OUTCLASS;
+      }
+      tokenString.isString = true;
+      return tokenString;
+    }
+
+    function tokenStringFactory(delimiter, tokenOuter) {
+      while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
+        delimiter = delimiter.substr(1);
+
+      var singleline = delimiter.length == 1;
+      var OUTCLASS = "string";
+
+      function tokenString(stream, state) {
+        while (!stream.eol()) {
+          stream.eatWhile(/[^'"\\]/);
+          if (stream.eat("\\")) {
+            stream.next();
+            if (singleline && stream.eol())
+              return OUTCLASS;
+          } else if (stream.match(delimiter)) {
+            state.tokenize = tokenOuter;
+            return OUTCLASS;
+          } else {
+            stream.eat(/['"]/);
+          }
+        }
+        if (singleline) {
+          if (parserConf.singleLineStringErrors)
+            return ERRORCLASS;
+          else
+            state.tokenize = tokenOuter;
+        }
+        return OUTCLASS;
+      }
+      tokenString.isString = true;
+      return tokenString;
+    }
+
+    function pushPyScope(state) {
+      while (top(state).type != "py") state.scopes.pop()
+      state.scopes.push({offset: top(state).offset + conf.indentUnit,
+                         type: "py",
+                         align: null})
+    }
+
+    function pushBracketScope(stream, state, type) {
+      var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1
+      state.scopes.push({offset: state.indent + hangingIndent,
+                         type: type,
+                         align: align})
+    }
+
+    function dedent(stream, state) {
+      var indented = stream.indentation();
+      while (state.scopes.length > 1 && top(state).offset > indented) {
+        if (top(state).type != "py") return true;
+        state.scopes.pop();
+      }
+      return top(state).offset != indented;
+    }
+
+    function tokenLexer(stream, state) {
+      if (stream.sol()) {
+        state.beginningOfLine = true;
+        state.dedent = false;
+      }
+
+      var style = state.tokenize(stream, state);
+      var current = stream.current();
+
+      // Handle decorators
+      if (state.beginningOfLine && current == "@")
+        return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
+
+      if (/\S/.test(current)) state.beginningOfLine = false;
+
+      if ((style == "variable" || style == "builtin")
+          && state.lastToken == "meta")
+        style = "meta";
+
+      // Handle scope changes.
+      if (current == "pass" || current == "return")
+        state.dedent = true;
+
+      if (current == "lambda") state.lambda = true;
+      if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
+        pushPyScope(state);
+
+      if (current.length == 1 && !/string|comment/.test(style)) {
+        var delimiter_index = "[({".indexOf(current);
+        if (delimiter_index != -1)
+          pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
+
+        delimiter_index = "])}".indexOf(current);
+        if (delimiter_index != -1) {
+          if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
+          else return ERRORCLASS;
+        }
+      }
+      if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
+        state.scopes.pop();
+
+      return style;
+    }
+
+    var external = {
+      startState: function(basecolumn) {
+        return {
+          tokenize: tokenBase,
+          scopes: [{offset: basecolumn || 0, type: "py", align: null}],
+          indent: basecolumn || 0,
+          lastToken: null,
+          lambda: false,
+          dedent: 0
+        };
+      },
+
+      token: function(stream, state) {
+        var addErr = state.errorToken;
+        if (addErr) state.errorToken = false;
+        var style = tokenLexer(stream, state);
+
+        if (style && style != "comment")
+          state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
+        if (style == "punctuation") style = null;
+
+        if (stream.eol() && state.lambda)
+          state.lambda = false;
+        return addErr ? style + " " + ERRORCLASS : style;
+      },
+
+      indent: function(state, textAfter) {
+        if (state.tokenize != tokenBase)
+          return state.tokenize.isString ? CodeMirror.Pass : 0;
+
+        var scope = top(state)
+        var closing = scope.type == textAfter.charAt(0) ||
+            scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter)
+        if (scope.align != null)
+          return scope.align - (closing ? 1 : 0)
+        else
+          return scope.offset - (closing ? hangingIndent : 0)
+      },
+
+      electricInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
+      closeBrackets: {triples: "'\""},
+      lineComment: "#",
+      fold: "indent"
+    };
+    return external;
+  });
+
+  CodeMirror.defineMIME("text/x-python", "python");
+
+  var words = function(str) { return str.split(" "); };
+
+  CodeMirror.defineMIME("text/x-cython", {
+    name: "python",
+    extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
+                          "extern gil include nogil property public "+
+                          "readonly struct union DEF IF ELIF ELSE")
+  });
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/python/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,89 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 4},
+              {name: "python",
+               version: 3,
+               singleLineStringErrors: false});
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  // Error, because "foobarhello" is neither a known type or property, but
+  // property was expected (after "and"), and it should be in parentheses.
+  MT("decoratorStartOfLine",
+     "[meta @dec]",
+     "[keyword def] [def function]():",
+     "    [keyword pass]");
+
+  MT("decoratorIndented",
+     "[keyword class] [def Foo]:",
+     "    [meta @dec]",
+     "    [keyword def] [def function]():",
+     "        [keyword pass]");
+
+  MT("matmulWithSpace:", "[variable a] [operator @] [variable b]");
+  MT("matmulWithoutSpace:", "[variable a][operator @][variable b]");
+  MT("matmulSpaceBefore:", "[variable a] [operator @][variable b]");
+  var before_equal_sign = ["+", "-", "*", "/", "=", "!", ">", "<"];
+  for (var i = 0; i < before_equal_sign.length; ++i) {
+    var c = before_equal_sign[i]
+    MT("before_equal_sign_" + c, "[variable a] [operator " + c + "=] [variable b]");
+  }
+
+  MT("fValidStringPrefix", "[string f'this is a]{[variable formatted]}[string string']");
+  MT("fValidExpressionInFString", "[string f'expression ]{[number 100][operator *][number 5]}[string string']");
+  MT("fInvalidFString", "[error f'this is wrong}]");
+  MT("fNestedFString", "[string f'expression ]{[number 100] [operator +] [string f'inner]{[number 5]}[string ']}[string string']");
+  MT("uValidStringPrefix", "[string u'this is an unicode string']");
+
+  MT("nestedString", "[string f']{[variable b][[ [string \"c\"] ]]}[string f'] [comment # oops]")
+
+  MT("bracesInFString", "[string f']{[variable x] [operator +] {}}[string !']")
+
+  MT("nestedFString", "[string f']{[variable b][[ [string f\"c\"] ]]}[string f'] [comment # oops]")
+
+  MT("dontIndentTypeDecl",
+     "[variable i]: [builtin int] [operator =] [number 32]",
+     "[builtin print]([variable i])")
+
+  MT("dedentElse",
+     "[keyword if] [variable x]:",
+     "    [variable foo]()",
+     "[keyword elif] [variable y]:",
+     "    [variable bar]()",
+     "[keyword else]:",
+     "    [variable baz]()")
+
+  MT("dedentElsePass",
+     "[keyword if] [variable x]:",
+     "    [keyword pass]",
+     "[keyword elif] [variable y]:",
+     "    [keyword pass]",
+     "[keyword else]:",
+     "    [keyword pass]")
+
+  MT("dedentElseInFunction",
+     "[keyword def] [def foo]():",
+     "    [keyword if] [variable x]:",
+     "        [variable foo]()",
+     "    [keyword elif] [variable y]:",
+     "        [variable bar]()",
+     "        [keyword pass]",
+     "    [keyword else]:",
+     "        [variable baz]()")
+
+  MT("dedentCase",
+     "[keyword match] [variable x]:",
+     "    [keyword case] [variable y]:",
+     "        [variable foo]()")
+  MT("dedentCasePass",
+     "[keyword match] [variable x]:",
+     "    [keyword case] [variable y]:",
+     "        [keyword pass]")
+
+  MT("dedentCaseInFunction",
+     "[keyword def] [def foo]():",
+     "    [keyword match] [variable x]:",
+     "        [keyword case] [variable y]:",
+     "            [variable foo]()")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/q/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,144 @@
+<!doctype html>
+
+<title>CodeMirror: Q mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="q.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Q</a>
+  </ul>
+</div>
+
+<article>
+<h2>Q mode</h2>
+
+
+<div><textarea id="code" name="code">
+/ utilities to quickly load a csv file - for more exhaustive analysis of the csv contents see csvguess.q
+/ 2009.09.20 - updated to match latest csvguess.q 
+
+/ .csv.colhdrs[file] - return a list of colhdrs from file
+/ info:.csv.info[file] - return a table of information about the file
+/ columns are: 
+/	c - column name; ci - column index; t - load type; mw - max width; 
+/	dchar - distinct characters in values; rule - rule that caught the type
+/	maybe - needs checking, _could_ be say a date, but perhaps just a float?
+/ .csv.info0[file;onlycols] - like .csv.info except that it only analyses <onlycols>
+/ example:
+/	info:.csv.info0[file;(.csv.colhdrs file)like"*price"]
+/	info:.csv.infolike[file;"*price"]
+/	show delete from info where t=" "
+/ .csv.data[file;info] - use the info from .csv.info to read the data
+/ .csv.data10[file;info] - like .csv.data but only returns the first 10 rows
+/ bulkload[file;info] - bulk loads file into table DATA (which must be already defined :: DATA:() )
+/ .csv.read[file]/read10[file] - for when you don't care about checking/tweaking the <info> before reading 
+
+\d .csv
+DELIM:","
+ZAPHDRS:0b / lowercase and remove _ from colhdrs (junk characters are always removed)
+WIDTHHDR:25000 / number of characters read to get the header
+READLINES:222 / number of lines read and used to guess the types
+SYMMAXWIDTH:11 / character columns narrower than this are stored as symbols
+SYMMAXGR:10 / max symbol granularity% before we give up and keep as a * string
+FORCECHARWIDTH:30 / every field (of any type) with values this wide or more is forced to character "*"
+DISCARDEMPTY:0b / completely ignore empty columns if true else set them to "C"
+CHUNKSIZE:50000000 / used in fs2 (modified .Q.fs)
+
+k)nameltrim:{$[~@x;.z.s'x;~(*x)in aA:.Q.a,.Q.A;(+/&\~x in aA)_x;x]}
+k)fs2:{[f;s]((-7!s)>){[f;s;x]i:1+last@&0xa=r:1:(s;x;CHUNKSIZE);f@`\:i#r;x+i}[f;s]/0j}
+cleanhdrs:{{$[ZAPHDRS;lower x except"_";x]}x where x in DELIM,.Q.an}
+cancast:{nw:x$"";if[not x in"BXCS";nw:(min 0#;max 0#;::)@\:nw];$[not any nw in x$(11&count y)#y;$[11<count y;not any nw in x$y;1b];0b]}
+
+read:{[file]data[file;info[file]]}  
+read10:{[file]data10[file;info[file]]}  
+
+colhdrs:{[file]
+	`$nameltrim DELIM vs cleanhdrs first read0(file;0;1+first where 0xa=read1(file;0;WIDTHHDR))}
+data:{[file;info]
+	(exec c from info where not t=" ")xcol(exec t from info;enlist DELIM)0:file}
+data10:{[file;info]
+	data[;info](file;0;1+last 11#where 0xa=read1(file;0;15*WIDTHHDR))}
+info0:{[file;onlycols]
+	colhdrs:`$nameltrim DELIM vs cleanhdrs first head:read0(file;0;1+last where 0xa=read1(file;0;WIDTHHDR));
+	loadfmts:(count colhdrs)#"S";if[count onlycols;loadfmts[where not colhdrs in onlycols]:"C"];
+	breaks:where 0xa=read1(file;0;floor(10+READLINES)*WIDTHHDR%count head);
+	nas:count as:colhdrs xcol(loadfmts;enlist DELIM)0:(file;0;1+last((1+READLINES)&count breaks)#breaks);
+	info:([]c:key flip as;v:value flip as);as:();
+	reserved:key`.q;reserved,:.Q.res;reserved,:`i;
+	info:update res:c in reserved from info;
+	info:update ci:i,t:"?",ipa:0b,mdot:0,mw:0,rule:0,gr:0,ndv:0,maybe:0b,empty:0b,j10:0b,j12:0b from info;
+	info:update ci:`s#ci from info;
+	if[count onlycols;info:update t:" ",rule:10 from info where not c in onlycols];
+	info:update sdv:{string(distinct x)except`}peach v from info; 
+	info:update ndv:count each sdv from info;
+	info:update gr:floor 0.5+100*ndv%nas,mw:{max count each x}peach sdv from info where 0<ndv;
+	info:update t:"*",rule:20 from info where mw>.csv.FORCECHARWIDTH; / long values
+	info:update t:"C "[.csv.DISCARDEMPTY],rule:30,empty:1b from info where t="?",mw=0; / empty columns
+	info:update dchar:{asc distinct raze x}peach sdv from info where t="?";
+	info:update mdot:{max sum each"."=x}peach sdv from info where t="?",{"."in x}each dchar;
+	info:update t:"n",rule:40 from info where t="?",{any x in"0123456789"}each dchar; / vaguely numeric..
+	info:update t:"I",rule:50,ipa:1b from info where t="n",mw within 7 15,mdot=3,{all x in".0123456789"}each dchar,.csv.cancast["I"]peach sdv; / ip-address
+	info:update t:"J",rule:60 from info where t="n",mdot=0,{all x in"+-0123456789"}each dchar,.csv.cancast["J"]peach sdv;
+	info:update t:"I",rule:70 from info where t="J",mw<12,.csv.cancast["I"]peach sdv;
+	info:update t:"H",rule:80 from info where t="I",mw<7,.csv.cancast["H"]peach sdv;
+	info:update t:"F",rule:90 from info where t="n",mdot<2,mw>1,.csv.cancast["F"]peach sdv;
+	info:update t:"E",rule:100,maybe:1b from info where t="F",mw<9;
+	info:update t:"M",rule:110,maybe:1b from info where t in"nIHEF",mdot<2,mw within 4 7,.csv.cancast["M"]peach sdv; 
+	info:update t:"D",rule:120,maybe:1b from info where t in"nI",mdot in 0 2,mw within 6 11,.csv.cancast["D"]peach sdv; 
+	info:update t:"V",rule:130,maybe:1b from info where t="I",mw in 5 6,7<count each dchar,{all x like"*[0-9][0-5][0-9][0-5][0-9]"}peach sdv,.csv.cancast["V"]peach sdv; / 235959 12345        
+	info:update t:"U",rule:140,maybe:1b from info where t="H",mw in 3 4,7<count each dchar,{all x like"*[0-9][0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv; /2359
+	info:update t:"U",rule:150,maybe:0b from info where t="n",mw in 4 5,mdot=0,{all x like"*[0-9]:[0-5][0-9]"}peach sdv,.csv.cancast["U"]peach sdv;
+	info:update t:"T",rule:160,maybe:0b from info where t="n",mw within 7 12,mdot<2,{all x like"*[0-9]:[0-5][0-9]:[0-5][0-9]*"}peach sdv,.csv.cancast["T"]peach sdv;
+	info:update t:"V",rule:170,maybe:0b from info where t="T",mw in 7 8,mdot=0,.csv.cancast["V"]peach sdv;
+	info:update t:"T",rule:180,maybe:1b from info where t in"EF",mw within 7 10,mdot=1,{all x like"*[0-9][0-5][0-9][0-5][0-9].*"}peach sdv,.csv.cancast["T"]peach sdv;
+	info:update t:"Z",rule:190,maybe:0b from info where t="n",mw within 11 24,mdot<4,.csv.cancast["Z"]peach sdv;
+	info:update t:"P",rule:200,maybe:1b from info where t="n",mw within 12 29,mdot<4,{all x like"[12]*"}peach sdv,.csv.cancast["P"]peach sdv;
+	info:update t:"N",rule:210,maybe:1b from info where t="n",mw within 3 28,mdot=1,.csv.cancast["N"]peach sdv;
+	info:update t:"?",rule:220,maybe:0b from info where t="n"; / reset remaining maybe numeric
+	info:update t:"C",rule:230,maybe:0b from info where t="?",mw=1; / char
+	info:update t:"B",rule:240,maybe:0b from info where t in"HC",mw=1,mdot=0,{$[all x in"01tTfFyYnN";(any"0fFnN"in x)and any"1tTyY"in x;0b]}each dchar; / boolean
+	info:update t:"B",rule:250,maybe:1b from info where t in"HC",mw=1,mdot=0,{all x in"01tTfFyYnN"}each dchar; / boolean
+	info:update t:"X",rule:260,maybe:0b from info where t="?",mw=2,{$[all x in"0123456789abcdefABCDEF";(any .Q.n in x)and any"abcdefABCDEF"in x;0b]}each dchar; /hex
+	info:update t:"S",rule:270,maybe:1b from info where t="?",mw<.csv.SYMMAXWIDTH,mw>1,gr<.csv.SYMMAXGR; / symbols (max width permitting)
+	info:update t:"*",rule:280,maybe:0b from info where t="?"; / the rest as strings
+	/ flag those S/* columns which could be encoded to integers (.Q.j10/x10/j12/x12) to avoid symbols
+	info:update j12:1b from info where t in"S*",mw<13,{all x in .Q.nA}each dchar;
+	info:update j10:1b from info where t in"S*",mw<11,{all x in .Q.b6}each dchar; 
+	select c,ci,t,maybe,empty,res,j10,j12,ipa,mw,mdot,rule,gr,ndv,dchar from info}
+info:info0[;()] / by default don't restrict columns
+infolike:{[file;pattern] info0[file;{x where x like y}[lower colhdrs[file];pattern]]} / .csv.infolike[file;"*time"]
+
+\d .
+/ DATA:()
+bulkload:{[file;info]
+	if[not`DATA in system"v";'`DATA.not.defined];
+	if[count DATA;'`DATA.not.empty];
+	loadhdrs:exec c from info where not t=" ";loadfmts:exec t from info;
+	.csv.fs2[{[file;loadhdrs;loadfmts] `DATA insert $[count DATA;flip loadhdrs!(loadfmts;.csv.DELIM)0:file;loadhdrs xcol(loadfmts;enlist .csv.DELIM)0:file]}[file;loadhdrs;loadfmts]];
+	count DATA}
+@[.:;"\\l csvutil.custom.q";::]; / save your custom settings in csvutil.custom.q to override those set at the beginning of the file 
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true
+      });
+    </script>
+
+    <p><strong>MIME type defined:</strong> <code>text/x-q</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/q/q.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,139 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("q",function(config){
+  var indentUnit=config.indentUnit,
+      curPunc,
+      keywords=buildRE(["abs","acos","aj","aj0","all","and","any","asc","asin","asof","atan","attr","avg","avgs","bin","by","ceiling","cols","cor","cos","count","cov","cross","csv","cut","delete","deltas","desc","dev","differ","distinct","div","do","each","ej","enlist","eval","except","exec","exit","exp","fby","fills","first","fkeys","flip","floor","from","get","getenv","group","gtime","hclose","hcount","hdel","hopen","hsym","iasc","idesc","if","ij","in","insert","inter","inv","key","keys","last","like","list","lj","load","log","lower","lsq","ltime","ltrim","mavg","max","maxs","mcount","md5","mdev","med","meta","min","mins","mmax","mmin","mmu","mod","msum","neg","next","not","null","or","over","parse","peach","pj","plist","prd","prds","prev","prior","rand","rank","ratios","raze","read0","read1","reciprocal","reverse","rload","rotate","rsave","rtrim","save","scan","select","set","setenv","show","signum","sin","sqrt","ss","ssr","string","sublist","sum","sums","sv","system","tables","tan","til","trim","txf","type","uj","ungroup","union","update","upper","upsert","value","var","view","views","vs","wavg","where","where","while","within","wj","wj1","wsum","xasc","xbar","xcol","xcols","xdesc","xexp","xgroup","xkey","xlog","xprev","xrank"]),
+      E=/[|/&^!+:\\\-*%$=~#;@><,?_\'\"\[\(\]\)\s{}]/;
+  function buildRE(w){return new RegExp("^("+w.join("|")+")$");}
+  function tokenBase(stream,state){
+    var sol=stream.sol(),c=stream.next();
+    curPunc=null;
+    if(sol)
+      if(c=="/")
+        return(state.tokenize=tokenLineComment)(stream,state);
+      else if(c=="\\"){
+        if(stream.eol()||/\s/.test(stream.peek()))
+          return stream.skipToEnd(),/^\\\s*$/.test(stream.current())?(state.tokenize=tokenCommentToEOF)(stream):state.tokenize=tokenBase,"comment";
+        else
+          return state.tokenize=tokenBase,"builtin";
+      }
+    if(/\s/.test(c))
+      return stream.peek()=="/"?(stream.skipToEnd(),"comment"):"whitespace";
+    if(c=='"')
+      return(state.tokenize=tokenString)(stream,state);
+    if(c=='`')
+      return stream.eatWhile(/[A-Za-z\d_:\/.]/),"symbol";
+    if(("."==c&&/\d/.test(stream.peek()))||/\d/.test(c)){
+      var t=null;
+      stream.backUp(1);
+      if(stream.match(/^\d{4}\.\d{2}(m|\.\d{2}([DT](\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)?)?)/)
+      || stream.match(/^\d+D(\d{2}(:\d{2}(:\d{2}(\.\d{1,9})?)?)?)/)
+      || stream.match(/^\d{2}:\d{2}(:\d{2}(\.\d{1,9})?)?/)
+      || stream.match(/^\d+[ptuv]{1}/))
+        t="temporal";
+      else if(stream.match(/^0[NwW]{1}/)
+      || stream.match(/^0x[\da-fA-F]*/)
+      || stream.match(/^[01]+[b]{1}/)
+      || stream.match(/^\d+[chijn]{1}/)
+      || stream.match(/-?\d*(\.\d*)?(e[+\-]?\d+)?(e|f)?/))
+        t="number";
+      return(t&&(!(c=stream.peek())||E.test(c)))?t:(stream.next(),"error");
+    }
+    if(/[A-Za-z]|\./.test(c))
+      return stream.eatWhile(/[A-Za-z._\d]/),keywords.test(stream.current())?"keyword":"variable";
+    if(/[|/&^!+:\\\-*%$=~#;@><\.,?_\']/.test(c))
+      return null;
+    if(/[{}\(\[\]\)]/.test(c))
+      return null;
+    return"error";
+  }
+  function tokenLineComment(stream,state){
+    return stream.skipToEnd(),/\/\s*$/.test(stream.current())?(state.tokenize=tokenBlockComment)(stream,state):(state.tokenize=tokenBase),"comment";
+  }
+  function tokenBlockComment(stream,state){
+    var f=stream.sol()&&stream.peek()=="\\";
+    stream.skipToEnd();
+    if(f&&/^\\\s*$/.test(stream.current()))
+      state.tokenize=tokenBase;
+    return"comment";
+  }
+  function tokenCommentToEOF(stream){return stream.skipToEnd(),"comment";}
+  function tokenString(stream,state){
+    var escaped=false,next,end=false;
+    while((next=stream.next())){
+      if(next=="\""&&!escaped){end=true;break;}
+      escaped=!escaped&&next=="\\";
+    }
+    if(end)state.tokenize=tokenBase;
+    return"string";
+  }
+  function pushContext(state,type,col){state.context={prev:state.context,indent:state.indent,col:col,type:type};}
+  function popContext(state){state.indent=state.context.indent;state.context=state.context.prev;}
+  return{
+    startState:function(){
+      return{tokenize:tokenBase,
+             context:null,
+             indent:0,
+             col:0};
+    },
+    token:function(stream,state){
+      if(stream.sol()){
+        if(state.context&&state.context.align==null)
+          state.context.align=false;
+        state.indent=stream.indentation();
+      }
+      //if (stream.eatSpace()) return null;
+      var style=state.tokenize(stream,state);
+      if(style!="comment"&&state.context&&state.context.align==null&&state.context.type!="pattern"){
+        state.context.align=true;
+      }
+      if(curPunc=="(")pushContext(state,")",stream.column());
+      else if(curPunc=="[")pushContext(state,"]",stream.column());
+      else if(curPunc=="{")pushContext(state,"}",stream.column());
+      else if(/[\]\}\)]/.test(curPunc)){
+        while(state.context&&state.context.type=="pattern")popContext(state);
+        if(state.context&&curPunc==state.context.type)popContext(state);
+      }
+      else if(curPunc=="."&&state.context&&state.context.type=="pattern")popContext(state);
+      else if(/atom|string|variable/.test(style)&&state.context){
+        if(/[\}\]]/.test(state.context.type))
+          pushContext(state,"pattern",stream.column());
+        else if(state.context.type=="pattern"&&!state.context.align){
+          state.context.align=true;
+          state.context.col=stream.column();
+        }
+      }
+      return style;
+    },
+    indent:function(state,textAfter){
+      var firstChar=textAfter&&textAfter.charAt(0);
+      var context=state.context;
+      if(/[\]\}]/.test(firstChar))
+        while (context&&context.type=="pattern")context=context.prev;
+      var closing=context&&firstChar==context.type;
+      if(!context)
+        return 0;
+      else if(context.type=="pattern")
+        return context.col;
+      else if(context.align)
+        return context.col+(closing?0:1);
+      else
+        return context.indent+(closing?0:indentUnit);
+    }
+  };
+});
+CodeMirror.defineMIME("text/x-q","q");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/r/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,88 @@
+<!doctype html>
+
+<title>CodeMirror: R mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="r.js"></script>
+<style>
+      .CodeMirror { border-top: 1px solid silver; border-bottom: 1px solid silver; }
+      .cm-s-default span.cm-semi { color: blue; font-weight: bold; }
+      .cm-s-default span.cm-dollar { color: orange; font-weight: bold; }
+      .cm-s-default span.cm-arrow { color: brown; }
+      .cm-s-default span.cm-arg-is { color: brown; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">R</a>
+  </ul>
+</div>
+
+<article>
+<h2>R mode</h2>
+<form><textarea id="code" name="code">
+X <- list(height = 5.4, weight = 54)
+cat("Printing objects: "); print(X)
+print("Accessing individual elements:")
+cat(sprintf("Your height is %s and your weight is %s\n", X$height, X$weight))
+
+# Functions:
+square <- function(x) {
+  return(x * x)
+}
+cat(sprintf("The square of 3 is %s\n", square(3)))
+
+# In R, the last expression in a function is, by default, what is
+# returned. The idiomatic way to write the function is:
+square <- function(x) {
+  x * x
+}
+# or, for functions with short content:
+square <- function(x) x * x
+
+# Function arguments with default values:
+cube <- function(x = 5) x * x * x
+cat(sprintf("Calling cube with 2 : %s\n", cube(2))  # will give 2^3
+cat(sprintf("Calling cube        : %s\n", cube())   # will default to 5^3.
+
+powers <- function(x) list(x2 = x*x, x3 = x*x*x, x4 = x*x*x*x)
+
+cat("Powers of 3: "); print(powers(3))
+
+# Data frames
+df <- data.frame(letters = letters[1:5], '#letter' = 1:5)
+print(df$letters)
+print(df$`#letter`)
+
+# Operators:
+m1 <- matrix(1:6, 2, 3)
+m2 <- m1 %*% t(m1)
+cat("Matrix product: "); print(m2)
+
+# Assignments:
+a <- 1
+b <<- 2
+c = 3
+4 -> d
+5 ->> e
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-rsrc</code>.</p>
+
+    <p>Development of the CodeMirror R mode was kindly sponsored
+    by <a href="https://twitter.com/ubalo">Ubalo</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/r/r.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,190 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.registerHelper("wordChars", "r", /[\w.]/);
+
+CodeMirror.defineMode("r", function(config) {
+  function wordObj(words) {
+    var res = {};
+    for (var i = 0; i < words.length; ++i) res[words[i]] = true;
+    return res;
+  }
+  var commonAtoms = ["NULL", "NA", "Inf", "NaN", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_", "TRUE", "FALSE"];
+  var commonBuiltins = ["list", "quote", "bquote", "eval", "return", "call", "parse", "deparse"];
+  var commonKeywords = ["if", "else", "repeat", "while", "function", "for", "in", "next", "break"];
+  var commonBlockKeywords = ["if", "else", "repeat", "while", "function", "for"];
+
+  CodeMirror.registerHelper("hintWords", "r", commonAtoms.concat(commonBuiltins, commonKeywords));
+
+  var atoms = wordObj(commonAtoms);
+  var builtins = wordObj(commonBuiltins);
+  var keywords = wordObj(commonKeywords);
+  var blockkeywords = wordObj(commonBlockKeywords);
+  var opChars = /[+\-*\/^<>=!&|~$:]/;
+  var curPunc;
+
+  function tokenBase(stream, state) {
+    curPunc = null;
+    var ch = stream.next();
+    if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    } else if (ch == "0" && stream.eat("x")) {
+      stream.eatWhile(/[\da-f]/i);
+      return "number";
+    } else if (ch == "." && stream.eat(/\d/)) {
+      stream.match(/\d*(?:e[+\-]?\d+)?/);
+      return "number";
+    } else if (/\d/.test(ch)) {
+      stream.match(/\d*(?:\.\d+)?(?:e[+\-]\d+)?L?/);
+      return "number";
+    } else if (ch == "'" || ch == '"') {
+      state.tokenize = tokenString(ch);
+      return "string";
+    } else if (ch == "`") {
+      stream.match(/[^`]+`/);
+      return "variable-3";
+    } else if (ch == "." && stream.match(/.(?:[.]|\d+)/)) {
+      return "keyword";
+    } else if (/[a-zA-Z\.]/.test(ch)) {
+      stream.eatWhile(/[\w\.]/);
+      var word = stream.current();
+      if (atoms.propertyIsEnumerable(word)) return "atom";
+      if (keywords.propertyIsEnumerable(word)) {
+        // Block keywords start new blocks, except 'else if', which only starts
+        // one new block for the 'if', no block for the 'else'.
+        if (blockkeywords.propertyIsEnumerable(word) &&
+            !stream.match(/\s*if(\s+|$)/, false))
+          curPunc = "block";
+        return "keyword";
+      }
+      if (builtins.propertyIsEnumerable(word)) return "builtin";
+      return "variable";
+    } else if (ch == "%") {
+      if (stream.skipTo("%")) stream.next();
+      return "operator variable-2";
+    } else if (
+        (ch == "<" && stream.eat("-")) ||
+        (ch == "<" && stream.match("<-")) ||
+        (ch == "-" && stream.match(/>>?/))
+      ) {
+      return "operator arrow";
+    } else if (ch == "=" && state.ctx.argList) {
+      return "arg-is";
+    } else if (opChars.test(ch)) {
+      if (ch == "$") return "operator dollar";
+      stream.eatWhile(opChars);
+      return "operator";
+    } else if (/[\(\){}\[\];]/.test(ch)) {
+      curPunc = ch;
+      if (ch == ";") return "semi";
+      return null;
+    } else {
+      return null;
+    }
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      if (stream.eat("\\")) {
+        var ch = stream.next();
+        if (ch == "x") stream.match(/^[a-f0-9]{2}/i);
+        else if ((ch == "u" || ch == "U") && stream.eat("{") && stream.skipTo("}")) stream.next();
+        else if (ch == "u") stream.match(/^[a-f0-9]{4}/i);
+        else if (ch == "U") stream.match(/^[a-f0-9]{8}/i);
+        else if (/[0-7]/.test(ch)) stream.match(/^[0-7]{1,2}/);
+        return "string-2";
+      } else {
+        var next;
+        while ((next = stream.next()) != null) {
+          if (next == quote) { state.tokenize = tokenBase; break; }
+          if (next == "\\") { stream.backUp(1); break; }
+        }
+        return "string";
+      }
+    };
+  }
+
+  var ALIGN_YES = 1, ALIGN_NO = 2, BRACELESS = 4
+
+  function push(state, type, stream) {
+    state.ctx = {type: type,
+                 indent: state.indent,
+                 flags: 0,
+                 column: stream.column(),
+                 prev: state.ctx};
+  }
+  function setFlag(state, flag) {
+    var ctx = state.ctx
+    state.ctx = {type: ctx.type,
+                 indent: ctx.indent,
+                 flags: ctx.flags | flag,
+                 column: ctx.column,
+                 prev: ctx.prev}
+  }
+  function pop(state) {
+    state.indent = state.ctx.indent;
+    state.ctx = state.ctx.prev;
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: tokenBase,
+              ctx: {type: "top",
+                    indent: -config.indentUnit,
+                    flags: ALIGN_NO},
+              indent: 0,
+              afterIdent: false};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if ((state.ctx.flags & 3) == 0) state.ctx.flags |= ALIGN_NO
+        if (state.ctx.flags & BRACELESS) pop(state)
+        state.indent = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      if (style != "comment" && (state.ctx.flags & ALIGN_NO) == 0) setFlag(state, ALIGN_YES)
+
+      if ((curPunc == ";" || curPunc == "{" || curPunc == "}") && state.ctx.type == "block") pop(state);
+      if (curPunc == "{") push(state, "}", stream);
+      else if (curPunc == "(") {
+        push(state, ")", stream);
+        if (state.afterIdent) state.ctx.argList = true;
+      }
+      else if (curPunc == "[") push(state, "]", stream);
+      else if (curPunc == "block") push(state, "block", stream);
+      else if (curPunc == state.ctx.type) pop(state);
+      else if (state.ctx.type == "block" && style != "comment") setFlag(state, BRACELESS)
+      state.afterIdent = style == "variable" || style == "keyword";
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase) return 0;
+      var firstChar = textAfter && textAfter.charAt(0), ctx = state.ctx,
+          closing = firstChar == ctx.type;
+      if (ctx.flags & BRACELESS) ctx = ctx.prev
+      if (ctx.type == "block") return ctx.indent + (firstChar == "{" ? 0 : config.indentUnit);
+      else if (ctx.flags & ALIGN_YES) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indent + (closing ? 0 : config.indentUnit);
+    },
+
+    lineComment: "#"
+  };
+});
+
+CodeMirror.defineMIME("text/x-rsrc", "r");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rpm/changes/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+<!doctype html>
+
+<title>CodeMirror: RPM changes mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+    <link rel="stylesheet" href="../../../lib/codemirror.css">
+    <script src="../../../lib/codemirror.js"></script>
+    <script src="changes.js"></script>
+    <link rel="stylesheet" href="../../../doc/docs.css">
+    <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../../../index.html">Home</a>
+    <li><a href="../../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../../index.html">Language modes</a>
+    <li><a class=active href="#">RPM changes</a>
+  </ul>
+</div>
+
+<article>
+<h2>RPM changes mode</h2>
+
+    <div><textarea id="code" name="code">
+-------------------------------------------------------------------
+Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
+
+- Update to r60.3
+- Fixes bug in the reflect package
+  * disallow Interface method on Value obtained via unexported name
+
+-------------------------------------------------------------------
+Thu Oct  6 08:14:24 UTC 2011 - misterx@example.com
+
+- Update to r60.2
+- Fixes memory leak in certain map types
+
+-------------------------------------------------------------------
+Wed Oct  5 14:34:10 UTC 2011 - misterx@example.com
+
+- Tweaks for gdb debugging
+- go.spec changes:
+  - move %go_arch definition to %prep section
+  - pass correct location of go specific gdb pretty printer and
+    functions to cpp as HOST_EXTRA_CFLAGS macro
+  - install go gdb functions & printer
+- gdb-printer.patch
+  - patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
+    gdb functions and pretty printer
+</textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "changes"},
+        lineNumbers: true,
+        indentUnit: 4
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-rpm-changes</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rpm/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,149 @@
+<!doctype html>
+
+<title>CodeMirror: RPM changes mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+    <link rel="stylesheet" href="../../lib/codemirror.css">
+    <script src="../../lib/codemirror.js"></script>
+    <script src="rpm.js"></script>
+    <link rel="stylesheet" href="../../doc/docs.css">
+    <style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">RPM</a>
+  </ul>
+</div>
+
+<article>
+<h2>RPM changes mode</h2>
+
+    <div><textarea id="code" name="code">
+-------------------------------------------------------------------
+Tue Oct 18 13:58:40 UTC 2011 - misterx@example.com
+
+- Update to r60.3
+- Fixes bug in the reflect package
+  * disallow Interface method on Value obtained via unexported name
+
+-------------------------------------------------------------------
+Thu Oct  6 08:14:24 UTC 2011 - misterx@example.com
+
+- Update to r60.2
+- Fixes memory leak in certain map types
+
+-------------------------------------------------------------------
+Wed Oct  5 14:34:10 UTC 2011 - misterx@example.com
+
+- Tweaks for gdb debugging
+- go.spec changes:
+  - move %go_arch definition to %prep section
+  - pass correct location of go specific gdb pretty printer and
+    functions to cpp as HOST_EXTRA_CFLAGS macro
+  - install go gdb functions & printer
+- gdb-printer.patch
+  - patch linker (src/cmd/ld/dwarf.c) to emit correct location of go
+    gdb functions and pretty printer
+</textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "rpm-changes"},
+        lineNumbers: true,
+        indentUnit: 4
+      });
+    </script>
+
+<h2>RPM spec mode</h2>
+    
+    <div><textarea id="code2" name="code2">
+#
+# spec file for package minidlna
+#
+# Copyright (c) 2011, Sascha Peilicke <saschpe@gmx.de>
+#
+# All modifications and additions to the file contributed by third parties
+# remain the property of their copyright owners, unless otherwise agreed
+# upon. The license for this file, and modifications and additions to the
+# file, is the same license as for the pristine package itself (unless the
+# license for the pristine package is not an Open Source License, in which
+# case the license is the MIT License). An "Open Source License" is a
+# license that conforms to the Open Source Definition (Version 1.9)
+# published by the Open Source Initiative.
+
+
+Name:           libupnp6
+Version:        1.6.13
+Release:        0
+Summary:        Portable Universal Plug and Play (UPnP) SDK
+Group:          System/Libraries
+License:        BSD-3-Clause
+Url:            http://sourceforge.net/projects/pupnp/
+Source0:        http://downloads.sourceforge.net/pupnp/libupnp-%{version}.tar.bz2
+BuildRoot:      %{_tmppath}/%{name}-%{version}-build
+
+%description
+The portable Universal Plug and Play (UPnP) SDK provides support for building
+UPnP-compliant control points, devices, and bridges on several operating
+systems.
+
+%package -n libupnp-devel
+Summary:        Portable Universal Plug and Play (UPnP) SDK
+Group:          Development/Libraries/C and C++
+Provides:       pkgconfig(libupnp)
+Requires:       %{name} = %{version}
+
+%description -n libupnp-devel
+The portable Universal Plug and Play (UPnP) SDK provides support for building
+UPnP-compliant control points, devices, and bridges on several operating
+systems.
+
+%prep
+%setup -n libupnp-%{version}
+
+%build
+%configure --disable-static
+make %{?_smp_mflags}
+
+%install
+%makeinstall
+find %{buildroot} -type f -name '*.la' -exec rm -f {} ';'
+
+%post -p /sbin/ldconfig
+
+%postun -p /sbin/ldconfig
+
+%files
+%defattr(-,root,root,-)
+%doc ChangeLog NEWS README TODO
+%{_libdir}/libixml.so.*
+%{_libdir}/libthreadutil.so.*
+%{_libdir}/libupnp.so.*
+
+%files -n libupnp-devel
+%defattr(-,root,root,-)
+%{_libdir}/pkgconfig/libupnp.pc
+%{_libdir}/libixml.so
+%{_libdir}/libthreadutil.so
+%{_libdir}/libupnp.so
+%{_includedir}/upnp/
+
+%changelog</textarea></div>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
+        mode: {name: "rpm-spec"},
+        lineNumbers: true,
+        indentUnit: 4
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-rpm-spec</code>, <code>text/x-rpm-changes</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rpm/rpm.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,109 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("rpm-changes", function() {
+  var headerSeparator = /^-+$/;
+  var headerLine = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)  ?\d{1,2} \d{2}:\d{2}(:\d{2})? [A-Z]{3,4} \d{4} - /;
+  var simpleEmail = /^[\w+.-]+@[\w.-]+/;
+
+  return {
+    token: function(stream) {
+      if (stream.sol()) {
+        if (stream.match(headerSeparator)) { return 'tag'; }
+        if (stream.match(headerLine)) { return 'tag'; }
+      }
+      if (stream.match(simpleEmail)) { return 'string'; }
+      stream.next();
+      return null;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-rpm-changes", "rpm-changes");
+
+// Quick and dirty spec file highlighting
+
+CodeMirror.defineMode("rpm-spec", function() {
+  var arch = /^(i386|i586|i686|x86_64|ppc64le|ppc64|ppc|ia64|s390x|s390|sparc64|sparcv9|sparc|noarch|alphaev6|alpha|hppa|mipsel)/;
+
+  var preamble = /^[a-zA-Z0-9()]+:/;
+  var section = /^%(debug_package|package|description|prep|build|install|files|clean|changelog|preinstall|preun|postinstall|postun|pretrans|posttrans|pre|post|triggerin|triggerun|verifyscript|check|triggerpostun|triggerprein|trigger)/;
+  var control_flow_complex = /^%(ifnarch|ifarch|if)/; // rpm control flow macros
+  var control_flow_simple = /^%(else|endif)/; // rpm control flow macros
+  var operators = /^(\!|\?|\<\=|\<|\>\=|\>|\=\=|\&\&|\|\|)/; // operators in control flow macros
+
+  return {
+    startState: function () {
+        return {
+          controlFlow: false,
+          macroParameters: false,
+          section: false
+        };
+    },
+    token: function (stream, state) {
+      var ch = stream.peek();
+      if (ch == "#") { stream.skipToEnd(); return "comment"; }
+
+      if (stream.sol()) {
+        if (stream.match(preamble)) { return "header"; }
+        if (stream.match(section)) { return "atom"; }
+      }
+
+      if (stream.match(/^\$\w+/)) { return "def"; } // Variables like '$RPM_BUILD_ROOT'
+      if (stream.match(/^\$\{\w+\}/)) { return "def"; } // Variables like '${RPM_BUILD_ROOT}'
+
+      if (stream.match(control_flow_simple)) { return "keyword"; }
+      if (stream.match(control_flow_complex)) {
+        state.controlFlow = true;
+        return "keyword";
+      }
+      if (state.controlFlow) {
+        if (stream.match(operators)) { return "operator"; }
+        if (stream.match(/^(\d+)/)) { return "number"; }
+        if (stream.eol()) { state.controlFlow = false; }
+      }
+
+      if (stream.match(arch)) {
+        if (stream.eol()) { state.controlFlow = false; }
+        return "number";
+      }
+
+      // Macros like '%make_install' or '%attr(0775,root,root)'
+      if (stream.match(/^%[\w]+/)) {
+        if (stream.match('(')) { state.macroParameters = true; }
+        return "keyword";
+      }
+      if (state.macroParameters) {
+        if (stream.match(/^\d+/)) { return "number";}
+        if (stream.match(')')) {
+          state.macroParameters = false;
+          return "keyword";
+        }
+      }
+
+      // Macros like '%{defined fedora}'
+      if (stream.match(/^%\{\??[\w \-\:\!]+\}/)) {
+        if (stream.eol()) { state.controlFlow = false; }
+        return "def";
+      }
+
+      //TODO: Include bash script sub-parser (CodeMirror supports that)
+      stream.next();
+      return null;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-rpm-spec", "rpm-spec");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rst/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,535 @@
+<!doctype html>
+
+<title>CodeMirror: reStructuredText mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="rst.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">reStructuredText</a>
+  </ul>
+</div>
+
+<article>
+<h2>reStructuredText mode</h2>
+<form><textarea id="code" name="code">
+.. This is an excerpt from Sphinx documentation: http://sphinx.pocoo.org/_sources/rest.txt
+
+.. highlightlang:: rest
+
+.. _rst-primer:
+
+reStructuredText Primer
+=======================
+
+This section is a brief introduction to reStructuredText (reST) concepts and
+syntax, intended to provide authors with enough information to author documents
+productively.  Since reST was designed to be a simple, unobtrusive markup
+language, this will not take too long.
+
+.. seealso::
+
+   The authoritative `reStructuredText User Documentation
+   &lt;http://docutils.sourceforge.net/rst.html&gt;`_.  The "ref" links in this
+   document link to the description of the individual constructs in the reST
+   reference.
+
+
+Paragraphs
+----------
+
+The paragraph (:duref:`ref &lt;paragraphs&gt;`) is the most basic block in a reST
+document.  Paragraphs are simply chunks of text separated by one or more blank
+lines.  As in Python, indentation is significant in reST, so all lines of the
+same paragraph must be left-aligned to the same level of indentation.
+
+
+.. _inlinemarkup:
+
+Inline markup
+-------------
+
+The standard reST inline markup is quite simple: use
+
+* one asterisk: ``*text*`` for emphasis (italics),
+* two asterisks: ``**text**`` for strong emphasis (boldface), and
+* backquotes: ````text```` for code samples.
+
+If asterisks or backquotes appear in running text and could be confused with
+inline markup delimiters, they have to be escaped with a backslash.
+
+Be aware of some restrictions of this markup:
+
+* it may not be nested,
+* content may not start or end with whitespace: ``* text*`` is wrong,
+* it must be separated from surrounding text by non-word characters.  Use a
+  backslash escaped space to work around that: ``thisis\ *one*\ word``.
+
+These restrictions may be lifted in future versions of the docutils.
+
+reST also allows for custom "interpreted text roles"', which signify that the
+enclosed text should be interpreted in a specific way.  Sphinx uses this to
+provide semantic markup and cross-referencing of identifiers, as described in
+the appropriate section.  The general syntax is ``:rolename:`content```.
+
+Standard reST provides the following roles:
+
+* :durole:`emphasis` -- alternate spelling for ``*emphasis*``
+* :durole:`strong` -- alternate spelling for ``**strong**``
+* :durole:`literal` -- alternate spelling for ````literal````
+* :durole:`subscript` -- subscript text
+* :durole:`superscript` -- superscript text
+* :durole:`title-reference` -- for titles of books, periodicals, and other
+  materials
+
+See :ref:`inline-markup` for roles added by Sphinx.
+
+
+Lists and Quote-like blocks
+---------------------------
+
+List markup (:duref:`ref &lt;bullet-lists&gt;`) is natural: just place an asterisk at
+the start of a paragraph and indent properly.  The same goes for numbered lists;
+they can also be autonumbered using a ``#`` sign::
+
+   * This is a bulleted list.
+   * It has two items, the second
+     item uses two lines.
+
+   1. This is a numbered list.
+   2. It has two items too.
+
+   #. This is a numbered list.
+   #. It has two items too.
+
+
+Nested lists are possible, but be aware that they must be separated from the
+parent list items by blank lines::
+
+   * this is
+   * a list
+
+     * with a nested list
+     * and some subitems
+
+   * and here the parent list continues
+
+Definition lists (:duref:`ref &lt;definition-lists&gt;`) are created as follows::
+
+   term (up to a line of text)
+      Definition of the term, which must be indented
+
+      and can even consist of multiple paragraphs
+
+   next term
+      Description.
+
+Note that the term cannot have more than one line of text.
+
+Quoted paragraphs (:duref:`ref &lt;block-quotes&gt;`) are created by just indenting
+them more than the surrounding paragraphs.
+
+Line blocks (:duref:`ref &lt;line-blocks&gt;`) are a way of preserving line breaks::
+
+   | These lines are
+   | broken exactly like in
+   | the source file.
+
+There are also several more special blocks available:
+
+* field lists (:duref:`ref &lt;field-lists&gt;`)
+* option lists (:duref:`ref &lt;option-lists&gt;`)
+* quoted literal blocks (:duref:`ref &lt;quoted-literal-blocks&gt;`)
+* doctest blocks (:duref:`ref &lt;doctest-blocks&gt;`)
+
+
+Source Code
+-----------
+
+Literal code blocks (:duref:`ref &lt;literal-blocks&gt;`) are introduced by ending a
+paragraph with the special marker ``::``.  The literal block must be indented
+(and, like all paragraphs, separated from the surrounding ones by blank lines)::
+
+   This is a normal text paragraph. The next paragraph is a code sample::
+
+      It is not processed in any way, except
+      that the indentation is removed.
+
+      It can span multiple lines.
+
+   This is a normal text paragraph again.
+
+The handling of the ``::`` marker is smart:
+
+* If it occurs as a paragraph of its own, that paragraph is completely left
+  out of the document.
+* If it is preceded by whitespace, the marker is removed.
+* If it is preceded by non-whitespace, the marker is replaced by a single
+  colon.
+
+That way, the second sentence in the above example's first paragraph would be
+rendered as "The next paragraph is a code sample:".
+
+
+.. _rst-tables:
+
+Tables
+------
+
+Two forms of tables are supported.  For *grid tables* (:duref:`ref
+&lt;grid-tables&gt;`), you have to "paint" the cell grid yourself.  They look like
+this::
+
+   +------------------------+------------+----------+----------+
+   | Header row, column 1   | Header 2   | Header 3 | Header 4 |
+   | (header rows optional) |            |          |          |
+   +========================+============+==========+==========+
+   | body row 1, column 1   | column 2   | column 3 | column 4 |
+   +------------------------+------------+----------+----------+
+   | body row 2             | ...        | ...      |          |
+   +------------------------+------------+----------+----------+
+
+*Simple tables* (:duref:`ref &lt;simple-tables&gt;`) are easier to write, but
+limited: they must contain more than one row, and the first column cannot
+contain multiple lines.  They look like this::
+
+   =====  =====  =======
+   A      B      A and B
+   =====  =====  =======
+   False  False  False
+   True   False  False
+   False  True   False
+   True   True   True
+   =====  =====  =======
+
+
+Hyperlinks
+----------
+
+External links
+^^^^^^^^^^^^^^
+
+Use ```Link text &lt;http://example.com/&gt;`_`` for inline web links.  If the link
+text should be the web address, you don't need special markup at all, the parser
+finds links and mail addresses in ordinary text.
+
+You can also separate the link and the target definition (:duref:`ref
+&lt;hyperlink-targets&gt;`), like this::
+
+   This is a paragraph that contains `a link`_.
+
+   .. _a link: http://example.com/
+
+
+Internal links
+^^^^^^^^^^^^^^
+
+Internal linking is done via a special reST role provided by Sphinx, see the
+section on specific markup, :ref:`ref-role`.
+
+
+Sections
+--------
+
+Section headers (:duref:`ref &lt;sections&gt;`) are created by underlining (and
+optionally overlining) the section title with a punctuation character, at least
+as long as the text::
+
+   =================
+   This is a heading
+   =================
+
+Normally, there are no heading levels assigned to certain characters as the
+structure is determined from the succession of headings.  However, for the
+Python documentation, this convention is used which you may follow:
+
+* ``#`` with overline, for parts
+* ``*`` with overline, for chapters
+* ``=``, for sections
+* ``-``, for subsections
+* ``^``, for subsubsections
+* ``"``, for paragraphs
+
+Of course, you are free to use your own marker characters (see the reST
+documentation), and use a deeper nesting level, but keep in mind that most
+target formats (HTML, LaTeX) have a limited supported nesting depth.
+
+
+Explicit Markup
+---------------
+
+"Explicit markup" (:duref:`ref &lt;explicit-markup-blocks&gt;`) is used in reST for
+most constructs that need special handling, such as footnotes,
+specially-highlighted paragraphs, comments, and generic directives.
+
+An explicit markup block begins with a line starting with ``..`` followed by
+whitespace and is terminated by the next paragraph at the same level of
+indentation.  (There needs to be a blank line between explicit markup and normal
+paragraphs.  This may all sound a bit complicated, but it is intuitive enough
+when you write it.)
+
+
+.. _directives:
+
+Directives
+----------
+
+A directive (:duref:`ref &lt;directives&gt;`) is a generic block of explicit markup.
+Besides roles, it is one of the extension mechanisms of reST, and Sphinx makes
+heavy use of it.
+
+Docutils supports the following directives:
+
+* Admonitions: :dudir:`attention`, :dudir:`caution`, :dudir:`danger`,
+  :dudir:`error`, :dudir:`hint`, :dudir:`important`, :dudir:`note`,
+  :dudir:`tip`, :dudir:`warning` and the generic :dudir:`admonition`.
+  (Most themes style only "note" and "warning" specially.)
+
+* Images:
+
+  - :dudir:`image` (see also Images_ below)
+  - :dudir:`figure` (an image with caption and optional legend)
+
+* Additional body elements:
+
+  - :dudir:`contents` (a local, i.e. for the current file only, table of
+    contents)
+  - :dudir:`container` (a container with a custom class, useful to generate an
+    outer ``&lt;div&gt;`` in HTML)
+  - :dudir:`rubric` (a heading without relation to the document sectioning)
+  - :dudir:`topic`, :dudir:`sidebar` (special highlighted body elements)
+  - :dudir:`parsed-literal` (literal block that supports inline markup)
+  - :dudir:`epigraph` (a block quote with optional attribution line)
+  - :dudir:`highlights`, :dudir:`pull-quote` (block quotes with their own
+    class attribute)
+  - :dudir:`compound` (a compound paragraph)
+
+* Special tables:
+
+  - :dudir:`table` (a table with title)
+  - :dudir:`csv-table` (a table generated from comma-separated values)
+  - :dudir:`list-table` (a table generated from a list of lists)
+
+* Special directives:
+
+  - :dudir:`raw` (include raw target-format markup)
+  - :dudir:`include` (include reStructuredText from another file)
+    -- in Sphinx, when given an absolute include file path, this directive takes
+    it as relative to the source directory
+  - :dudir:`class` (assign a class attribute to the next element) [1]_
+
+* HTML specifics:
+
+  - :dudir:`meta` (generation of HTML ``&lt;meta&gt;`` tags)
+  - :dudir:`title` (override document title)
+
+* Influencing markup:
+
+  - :dudir:`default-role` (set a new default role)
+  - :dudir:`role` (create a new role)
+
+  Since these are only per-file, better use Sphinx' facilities for setting the
+  :confval:`default_role`.
+
+Do *not* use the directives :dudir:`sectnum`, :dudir:`header` and
+:dudir:`footer`.
+
+Directives added by Sphinx are described in :ref:`sphinxmarkup`.
+
+Basically, a directive consists of a name, arguments, options and content. (Keep
+this terminology in mind, it is used in the next chapter describing custom
+directives.)  Looking at this example, ::
+
+   .. function:: foo(x)
+                 foo(y, z)
+      :module: some.module.name
+
+      Return a line of text input from the user.
+
+``function`` is the directive name.  It is given two arguments here, the
+remainder of the first line and the second line, as well as one option
+``module`` (as you can see, options are given in the lines immediately following
+the arguments and indicated by the colons).  Options must be indented to the
+same level as the directive content.
+
+The directive content follows after a blank line and is indented relative to the
+directive start.
+
+
+Images
+------
+
+reST supports an image directive (:dudir:`ref &lt;image&gt;`), used like so::
+
+   .. image:: gnu.png
+      (options)
+
+When used within Sphinx, the file name given (here ``gnu.png``) must either be
+relative to the source file, or absolute which means that they are relative to
+the top source directory.  For example, the file ``sketch/spam.rst`` could refer
+to the image ``images/spam.png`` as ``../images/spam.png`` or
+``/images/spam.png``.
+
+Sphinx will automatically copy image files over to a subdirectory of the output
+directory on building (e.g. the ``_static`` directory for HTML output.)
+
+Interpretation of image size options (``width`` and ``height``) is as follows:
+if the size has no unit or the unit is pixels, the given size will only be
+respected for output channels that support pixels (i.e. not in LaTeX output).
+Other units (like ``pt`` for points) will be used for HTML and LaTeX output.
+
+Sphinx extends the standard docutils behavior by allowing an asterisk for the
+extension::
+
+   .. image:: gnu.*
+
+Sphinx then searches for all images matching the provided pattern and determines
+their type.  Each builder then chooses the best image out of these candidates.
+For instance, if the file name ``gnu.*`` was given and two files :file:`gnu.pdf`
+and :file:`gnu.png` existed in the source tree, the LaTeX builder would choose
+the former, while the HTML builder would prefer the latter.
+
+.. versionchanged:: 0.4
+   Added the support for file names ending in an asterisk.
+
+.. versionchanged:: 0.6
+   Image paths can now be absolute.
+
+
+Footnotes
+---------
+
+For footnotes (:duref:`ref &lt;footnotes&gt;`), use ``[#name]_`` to mark the footnote
+location, and add the footnote body at the bottom of the document after a
+"Footnotes" rubric heading, like so::
+
+   Lorem ipsum [#f1]_ dolor sit amet ... [#f2]_
+
+   .. rubric:: Footnotes
+
+   .. [#f1] Text of the first footnote.
+   .. [#f2] Text of the second footnote.
+
+You can also explicitly number the footnotes (``[1]_``) or use auto-numbered
+footnotes without names (``[#]_``).
+
+
+Citations
+---------
+
+Standard reST citations (:duref:`ref &lt;citations&gt;`) are supported, with the
+additional feature that they are "global", i.e. all citations can be referenced
+from all files.  Use them like so::
+
+   Lorem ipsum [Ref]_ dolor sit amet.
+
+   .. [Ref] Book or article reference, URL or whatever.
+
+Citation usage is similar to footnote usage, but with a label that is not
+numeric or begins with ``#``.
+
+
+Substitutions
+-------------
+
+reST supports "substitutions" (:duref:`ref &lt;substitution-definitions&gt;`), which
+are pieces of text and/or markup referred to in the text by ``|name|``.  They
+are defined like footnotes with explicit markup blocks, like this::
+
+   .. |name| replace:: replacement *text*
+
+or this::
+
+   .. |caution| image:: warning.png
+                :alt: Warning!
+
+See the :duref:`reST reference for substitutions &lt;substitution-definitions&gt;`
+for details.
+
+If you want to use some substitutions for all documents, put them into
+:confval:`rst_prolog` or put them into a separate file and include it into all
+documents you want to use them in, using the :rst:dir:`include` directive.  (Be
+sure to give the include file a file name extension differing from that of other
+source files, to avoid Sphinx finding it as a standalone document.)
+
+Sphinx defines some default substitutions, see :ref:`default-substitutions`.
+
+
+Comments
+--------
+
+Every explicit markup block which isn't a valid markup construct (like the
+footnotes above) is regarded as a comment (:duref:`ref &lt;comments&gt;`).  For
+example::
+
+   .. This is a comment.
+
+You can indent text after a comment start to form multiline comments::
+
+   ..
+      This whole indented block
+      is a comment.
+
+      Still in the comment.
+
+
+Source encoding
+---------------
+
+Since the easiest way to include special characters like em dashes or copyright
+signs in reST is to directly write them as Unicode characters, one has to
+specify an encoding.  Sphinx assumes source files to be encoded in UTF-8 by
+default; you can change this with the :confval:`source_encoding` config value.
+
+
+Gotchas
+-------
+
+There are some problems one commonly runs into while authoring reST documents:
+
+* **Separation of inline markup:** As said above, inline markup spans must be
+  separated from the surrounding text by non-word characters, you have to use a
+  backslash-escaped space to get around that.  See `the reference
+  &lt;http://docutils.sf.net/docs/ref/rst/restructuredtext.html#inline-markup&gt;`_
+  for the details.
+
+* **No nested inline markup:** Something like ``*see :func:`foo`*`` is not
+  possible.
+
+
+.. rubric:: Footnotes
+
+.. [1] When the default domain contains a :rst:dir:`class` directive, this directive
+       will be shadowed.  Therefore, Sphinx re-exports it as :rst:dir:`rst-class`.
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+      });
+    </script>
+    <p>
+        The <code>python</code> mode will be used for highlighting blocks
+        containing Python/IPython terminal sessions: blocks starting with
+        <code>&gt;&gt;&gt;</code> (for Python) or <code>In [num]:</code> (for
+        IPython).
+
+        Further, the <code>stex</code> mode will be used for highlighting
+        blocks containing LaTex code.
+    </p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-rst</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rst/rst.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,557 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../python/python"), require("../stex/stex"), require("../../addon/mode/overlay"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../python/python", "../stex/stex", "../../addon/mode/overlay"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode('rst', function (config, options) {
+
+  var rx_strong = /^\*\*[^\*\s](?:[^\*]*[^\*\s])?\*\*/;
+  var rx_emphasis = /^\*[^\*\s](?:[^\*]*[^\*\s])?\*/;
+  var rx_literal = /^``[^`\s](?:[^`]*[^`\s])``/;
+
+  var rx_number = /^(?:[\d]+(?:[\.,]\d+)*)/;
+  var rx_positive = /^(?:\s\+[\d]+(?:[\.,]\d+)*)/;
+  var rx_negative = /^(?:\s\-[\d]+(?:[\.,]\d+)*)/;
+
+  var rx_uri_protocol = "[Hh][Tt][Tt][Pp][Ss]?://";
+  var rx_uri_domain = "(?:[\\d\\w.-]+)\\.(?:\\w{2,6})";
+  var rx_uri_path = "(?:/[\\d\\w\\#\\%\\&\\-\\.\\,\\/\\:\\=\\?\\~]+)*";
+  var rx_uri = new RegExp("^" + rx_uri_protocol + rx_uri_domain + rx_uri_path);
+
+  var overlay = {
+    token: function (stream) {
+
+      if (stream.match(rx_strong) && stream.match (/\W+|$/, false))
+        return 'strong';
+      if (stream.match(rx_emphasis) && stream.match (/\W+|$/, false))
+        return 'em';
+      if (stream.match(rx_literal) && stream.match (/\W+|$/, false))
+        return 'string-2';
+      if (stream.match(rx_number))
+        return 'number';
+      if (stream.match(rx_positive))
+        return 'positive';
+      if (stream.match(rx_negative))
+        return 'negative';
+      if (stream.match(rx_uri))
+        return 'link';
+
+      while (stream.next() != null) {
+        if (stream.match(rx_strong, false)) break;
+        if (stream.match(rx_emphasis, false)) break;
+        if (stream.match(rx_literal, false)) break;
+        if (stream.match(rx_number, false)) break;
+        if (stream.match(rx_positive, false)) break;
+        if (stream.match(rx_negative, false)) break;
+        if (stream.match(rx_uri, false)) break;
+      }
+
+      return null;
+    }
+  };
+
+  var mode = CodeMirror.getMode(
+    config, options.backdrop || 'rst-base'
+  );
+
+  return CodeMirror.overlayMode(mode, overlay, true); // combine
+}, 'python', 'stex');
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+CodeMirror.defineMode('rst-base', function (config) {
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  function format(string) {
+    var args = Array.prototype.slice.call(arguments, 1);
+    return string.replace(/{(\d+)}/g, function (match, n) {
+      return typeof args[n] != 'undefined' ? args[n] : match;
+    });
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  var mode_python = CodeMirror.getMode(config, 'python');
+  var mode_stex = CodeMirror.getMode(config, 'stex');
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  var SEPA = "\\s+";
+  var TAIL = "(?:\\s*|\\W|$)",
+  rx_TAIL = new RegExp(format('^{0}', TAIL));
+
+  var NAME =
+    "(?:[^\\W\\d_](?:[\\w!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)",
+  rx_NAME = new RegExp(format('^{0}', NAME));
+  var NAME_WWS =
+    "(?:[^\\W\\d_](?:[\\w\\s!\"#$%&'()\\*\\+,\\-\\.\/:;<=>\\?]*[^\\W_])?)";
+  var REF_NAME = format('(?:{0}|`{1}`)', NAME, NAME_WWS);
+
+  var TEXT1 = "(?:[^\\s\\|](?:[^\\|]*[^\\s\\|])?)";
+  var TEXT2 = "(?:[^\\`]+)",
+  rx_TEXT2 = new RegExp(format('^{0}', TEXT2));
+
+  var rx_section = new RegExp(
+    "^([!'#$%&\"()*+,-./:;<=>?@\\[\\\\\\]^_`{|}~])\\1{3,}\\s*$");
+  var rx_explicit = new RegExp(
+    format('^\\.\\.{0}', SEPA));
+  var rx_link = new RegExp(
+    format('^_{0}:{1}|^__:{1}', REF_NAME, TAIL));
+  var rx_directive = new RegExp(
+    format('^{0}::{1}', REF_NAME, TAIL));
+  var rx_substitution = new RegExp(
+    format('^\\|{0}\\|{1}{2}::{3}', TEXT1, SEPA, REF_NAME, TAIL));
+  var rx_footnote = new RegExp(
+    format('^\\[(?:\\d+|#{0}?|\\*)]{1}', REF_NAME, TAIL));
+  var rx_citation = new RegExp(
+    format('^\\[{0}\\]{1}', REF_NAME, TAIL));
+
+  var rx_substitution_ref = new RegExp(
+    format('^\\|{0}\\|', TEXT1));
+  var rx_footnote_ref = new RegExp(
+    format('^\\[(?:\\d+|#{0}?|\\*)]_', REF_NAME));
+  var rx_citation_ref = new RegExp(
+    format('^\\[{0}\\]_', REF_NAME));
+  var rx_link_ref1 = new RegExp(
+    format('^{0}__?', REF_NAME));
+  var rx_link_ref2 = new RegExp(
+    format('^`{0}`_', TEXT2));
+
+  var rx_role_pre = new RegExp(
+    format('^:{0}:`{1}`{2}', NAME, TEXT2, TAIL));
+  var rx_role_suf = new RegExp(
+    format('^`{1}`:{0}:{2}', NAME, TEXT2, TAIL));
+  var rx_role = new RegExp(
+    format('^:{0}:{1}', NAME, TAIL));
+
+  var rx_directive_name = new RegExp(format('^{0}', REF_NAME));
+  var rx_directive_tail = new RegExp(format('^::{0}', TAIL));
+  var rx_substitution_text = new RegExp(format('^\\|{0}\\|', TEXT1));
+  var rx_substitution_sepa = new RegExp(format('^{0}', SEPA));
+  var rx_substitution_name = new RegExp(format('^{0}', REF_NAME));
+  var rx_substitution_tail = new RegExp(format('^::{0}', TAIL));
+  var rx_link_head = new RegExp("^_");
+  var rx_link_name = new RegExp(format('^{0}|_', REF_NAME));
+  var rx_link_tail = new RegExp(format('^:{0}', TAIL));
+
+  var rx_verbatim = new RegExp('^::\\s*$');
+  var rx_examples = new RegExp('^\\s+(?:>>>|In \\[\\d+\\]:)\\s');
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  function to_normal(stream, state) {
+    var token = null;
+
+    if (stream.sol() && stream.match(rx_examples, false)) {
+      change(state, to_mode, {
+        mode: mode_python, local: CodeMirror.startState(mode_python)
+      });
+    } else if (stream.sol() && stream.match(rx_explicit)) {
+      change(state, to_explicit);
+      token = 'meta';
+    } else if (stream.sol() && stream.match(rx_section)) {
+      change(state, to_normal);
+      token = 'header';
+    } else if (phase(state) == rx_role_pre ||
+               stream.match(rx_role_pre, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_normal, context(rx_role_pre, 1));
+        stream.match(/^:/);
+        token = 'meta';
+        break;
+      case 1:
+        change(state, to_normal, context(rx_role_pre, 2));
+        stream.match(rx_NAME);
+        token = 'keyword';
+
+        if (stream.current().match(/^(?:math|latex)/)) {
+          state.tmp_stex = true;
+        }
+        break;
+      case 2:
+        change(state, to_normal, context(rx_role_pre, 3));
+        stream.match(/^:`/);
+        token = 'meta';
+        break;
+      case 3:
+        if (state.tmp_stex) {
+          state.tmp_stex = undefined; state.tmp = {
+            mode: mode_stex, local: CodeMirror.startState(mode_stex)
+          };
+        }
+
+        if (state.tmp) {
+          if (stream.peek() == '`') {
+            change(state, to_normal, context(rx_role_pre, 4));
+            state.tmp = undefined;
+            break;
+          }
+
+          token = state.tmp.mode.token(stream, state.tmp.local);
+          break;
+        }
+
+        change(state, to_normal, context(rx_role_pre, 4));
+        stream.match(rx_TEXT2);
+        token = 'string';
+        break;
+      case 4:
+        change(state, to_normal, context(rx_role_pre, 5));
+        stream.match(/^`/);
+        token = 'meta';
+        break;
+      case 5:
+        change(state, to_normal, context(rx_role_pre, 6));
+        stream.match(rx_TAIL);
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (phase(state) == rx_role_suf ||
+               stream.match(rx_role_suf, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_normal, context(rx_role_suf, 1));
+        stream.match(/^`/);
+        token = 'meta';
+        break;
+      case 1:
+        change(state, to_normal, context(rx_role_suf, 2));
+        stream.match(rx_TEXT2);
+        token = 'string';
+        break;
+      case 2:
+        change(state, to_normal, context(rx_role_suf, 3));
+        stream.match(/^`:/);
+        token = 'meta';
+        break;
+      case 3:
+        change(state, to_normal, context(rx_role_suf, 4));
+        stream.match(rx_NAME);
+        token = 'keyword';
+        break;
+      case 4:
+        change(state, to_normal, context(rx_role_suf, 5));
+        stream.match(/^:/);
+        token = 'meta';
+        break;
+      case 5:
+        change(state, to_normal, context(rx_role_suf, 6));
+        stream.match(rx_TAIL);
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (phase(state) == rx_role || stream.match(rx_role, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_normal, context(rx_role, 1));
+        stream.match(/^:/);
+        token = 'meta';
+        break;
+      case 1:
+        change(state, to_normal, context(rx_role, 2));
+        stream.match(rx_NAME);
+        token = 'keyword';
+        break;
+      case 2:
+        change(state, to_normal, context(rx_role, 3));
+        stream.match(/^:/);
+        token = 'meta';
+        break;
+      case 3:
+        change(state, to_normal, context(rx_role, 4));
+        stream.match(rx_TAIL);
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (phase(state) == rx_substitution_ref ||
+               stream.match(rx_substitution_ref, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_normal, context(rx_substitution_ref, 1));
+        stream.match(rx_substitution_text);
+        token = 'variable-2';
+        break;
+      case 1:
+        change(state, to_normal, context(rx_substitution_ref, 2));
+        if (stream.match(/^_?_?/)) token = 'link';
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (stream.match(rx_footnote_ref)) {
+      change(state, to_normal);
+      token = 'quote';
+    } else if (stream.match(rx_citation_ref)) {
+      change(state, to_normal);
+      token = 'quote';
+    } else if (stream.match(rx_link_ref1)) {
+      change(state, to_normal);
+      if (!stream.peek() || stream.peek().match(/^\W$/)) {
+        token = 'link';
+      }
+    } else if (phase(state) == rx_link_ref2 ||
+               stream.match(rx_link_ref2, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        if (!stream.peek() || stream.peek().match(/^\W$/)) {
+          change(state, to_normal, context(rx_link_ref2, 1));
+        } else {
+          stream.match(rx_link_ref2);
+        }
+        break;
+      case 1:
+        change(state, to_normal, context(rx_link_ref2, 2));
+        stream.match(/^`/);
+        token = 'link';
+        break;
+      case 2:
+        change(state, to_normal, context(rx_link_ref2, 3));
+        stream.match(rx_TEXT2);
+        break;
+      case 3:
+        change(state, to_normal, context(rx_link_ref2, 4));
+        stream.match(/^`_/);
+        token = 'link';
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (stream.match(rx_verbatim)) {
+      change(state, to_verbatim);
+    }
+
+    else {
+      if (stream.next()) change(state, to_normal);
+    }
+
+    return token;
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  function to_explicit(stream, state) {
+    var token = null;
+
+    if (phase(state) == rx_substitution ||
+        stream.match(rx_substitution, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_explicit, context(rx_substitution, 1));
+        stream.match(rx_substitution_text);
+        token = 'variable-2';
+        break;
+      case 1:
+        change(state, to_explicit, context(rx_substitution, 2));
+        stream.match(rx_substitution_sepa);
+        break;
+      case 2:
+        change(state, to_explicit, context(rx_substitution, 3));
+        stream.match(rx_substitution_name);
+        token = 'keyword';
+        break;
+      case 3:
+        change(state, to_explicit, context(rx_substitution, 4));
+        stream.match(rx_substitution_tail);
+        token = 'meta';
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (phase(state) == rx_directive ||
+               stream.match(rx_directive, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_explicit, context(rx_directive, 1));
+        stream.match(rx_directive_name);
+        token = 'keyword';
+
+        if (stream.current().match(/^(?:math|latex)/))
+          state.tmp_stex = true;
+        else if (stream.current().match(/^python/))
+          state.tmp_py = true;
+        break;
+      case 1:
+        change(state, to_explicit, context(rx_directive, 2));
+        stream.match(rx_directive_tail);
+        token = 'meta';
+
+        if (stream.match(/^latex\s*$/) || state.tmp_stex) {
+          state.tmp_stex = undefined; change(state, to_mode, {
+            mode: mode_stex, local: CodeMirror.startState(mode_stex)
+          });
+        }
+        break;
+      case 2:
+        change(state, to_explicit, context(rx_directive, 3));
+        if (stream.match(/^python\s*$/) || state.tmp_py) {
+          state.tmp_py = undefined; change(state, to_mode, {
+            mode: mode_python, local: CodeMirror.startState(mode_python)
+          });
+        }
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (phase(state) == rx_link || stream.match(rx_link, false)) {
+
+      switch (stage(state)) {
+      case 0:
+        change(state, to_explicit, context(rx_link, 1));
+        stream.match(rx_link_head);
+        stream.match(rx_link_name);
+        token = 'link';
+        break;
+      case 1:
+        change(state, to_explicit, context(rx_link, 2));
+        stream.match(rx_link_tail);
+        token = 'meta';
+        break;
+      default:
+        change(state, to_normal);
+      }
+    } else if (stream.match(rx_footnote)) {
+      change(state, to_normal);
+      token = 'quote';
+    } else if (stream.match(rx_citation)) {
+      change(state, to_normal);
+      token = 'quote';
+    }
+
+    else {
+      stream.eatSpace();
+      if (stream.eol()) {
+        change(state, to_normal);
+      } else {
+        stream.skipToEnd();
+        change(state, to_comment);
+        token = 'comment';
+      }
+    }
+
+    return token;
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  function to_comment(stream, state) {
+    return as_block(stream, state, 'comment');
+  }
+
+  function to_verbatim(stream, state) {
+    return as_block(stream, state, 'meta');
+  }
+
+  function as_block(stream, state, token) {
+    if (stream.eol() || stream.eatSpace()) {
+      stream.skipToEnd();
+      return token;
+    } else {
+      change(state, to_normal);
+      return null;
+    }
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  function to_mode(stream, state) {
+
+    if (state.ctx.mode && state.ctx.local) {
+
+      if (stream.sol()) {
+        if (!stream.eatSpace()) change(state, to_normal);
+        return null;
+      }
+
+      return state.ctx.mode.token(stream, state.ctx.local);
+    }
+
+    change(state, to_normal);
+    return null;
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  function context(phase, stage, mode, local) {
+    return {phase: phase, stage: stage, mode: mode, local: local};
+  }
+
+  function change(state, tok, ctx) {
+    state.tok = tok;
+    state.ctx = ctx || {};
+  }
+
+  function stage(state) {
+    return state.ctx.stage || 0;
+  }
+
+  function phase(state) {
+    return state.ctx.phase;
+  }
+
+  ///////////////////////////////////////////////////////////////////////////
+  ///////////////////////////////////////////////////////////////////////////
+
+  return {
+    startState: function () {
+      return {tok: to_normal, ctx: context(undefined, 0)};
+    },
+
+    copyState: function (state) {
+      var ctx = state.ctx, tmp = state.tmp;
+      if (ctx.local)
+        ctx = {mode: ctx.mode, local: CodeMirror.copyState(ctx.mode, ctx.local)};
+      if (tmp)
+        tmp = {mode: tmp.mode, local: CodeMirror.copyState(tmp.mode, tmp.local)};
+      return {tok: state.tok, ctx: ctx, tmp: tmp};
+    },
+
+    innerMode: function (state) {
+      return state.tmp      ? {state: state.tmp.local, mode: state.tmp.mode}
+      : state.ctx.mode ? {state: state.ctx.local, mode: state.ctx.mode}
+      : null;
+    },
+
+    token: function (stream, state) {
+      return state.tok(stream, state);
+    }
+  };
+}, 'python', 'stex');
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+CodeMirror.defineMIME('text/x-rst', 'rst');
+
+///////////////////////////////////////////////////////////////////////////////
+///////////////////////////////////////////////////////////////////////////////
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ruby/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,183 @@
+<!doctype html>
+
+<title>CodeMirror: Ruby mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="ruby.js"></script>
+<style>
+      .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+      .cm-s-default span.cm-arrow { color: red; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Ruby</a>
+  </ul>
+</div>
+
+<article>
+<h2>Ruby mode</h2>
+<form><textarea id="code" name="code">
+# Code from http://sandbox.mc.edu/~bennet/ruby/code/poly_rb.html
+#
+# This program evaluates polynomials.  It first asks for the coefficients
+# of a polynomial, which must be entered on one line, highest-order first.
+# It then requests values of x and will compute the value of the poly for
+# each x.  It will repeatedly ask for x values, unless you the user enters
+# a blank line.  It that case, it will ask for another polynomial.  If the
+# user types quit for either input, the program immediately exits.
+#
+
+#
+# Function to evaluate a polynomial at x.  The polynomial is given
+# as a list of coefficients, from the greatest to the least.
+def polyval(x, coef)
+    sum = 0
+    coef = coef.clone           # Don't want to destroy the original
+    while true
+        sum += coef.shift       # Add and remove the next coef
+        break if coef.empty?    # If no more, done entirely.
+        sum *= x                # This happens the right number of times.
+    end
+    return sum
+end
+
+#
+# Function to read a line containing a list of integers and return
+# them as an array of integers.  If the string conversion fails, it
+# throws TypeError.  If the input line is the word 'quit', then it
+# converts it to an end-of-file exception
+def readints(prompt)
+    # Read a line
+    print prompt
+    line = readline.chomp
+    raise EOFError.new if line == 'quit' # You can also use a real EOF.
+            
+    # Go through each item on the line, converting each one and adding it
+    # to retval.
+    retval = [ ]
+    for str in line.split(/\s+/)
+        if str =~ /^\-?\d+$/
+            retval.push(str.to_i)
+        else
+            raise TypeError.new
+        end
+    end
+
+    return retval
+end
+
+#
+# Take a coeff and an exponent and return the string representation, ignoring
+# the sign of the coefficient.
+def term_to_str(coef, exp)
+    ret = ""
+
+    # Show coeff, unless it's 1 or at the right
+    coef = coef.abs
+    ret = coef.to_s     unless coef == 1 && exp > 0
+    ret += "x" if exp > 0                               # x if exponent not 0
+    ret += "^" + exp.to_s if exp > 1                    # ^exponent, if > 1.
+
+    return ret
+end
+
+#
+# Create a string of the polynomial in sort-of-readable form.
+def polystr(p)
+    # Get the exponent of first coefficient, plus 1.
+    exp = p.length
+
+    # Assign exponents to each term, making pairs of coeff and exponent,
+    # Then get rid of the zero terms.
+    p = (p.map { |c| exp -= 1; [ c, exp ] }).select { |p| p[0] != 0 }
+
+    # If there's nothing left, it's a zero
+    return "0" if p.empty?
+
+    # *** Now p is a non-empty list of [ coef, exponent ] pairs. ***
+
+    # Convert the first term, preceded by a "-" if it's negative.
+    result = (if p[0][0] < 0 then "-" else "" end) + term_to_str(*p[0])
+
+    # Convert the rest of the terms, in each case adding the appropriate
+    # + or - separating them.  
+    for term in p[1...p.length]
+        # Add the separator then the rep. of the term.
+        result += (if term[0] < 0 then " - " else " + " end) + 
+                term_to_str(*term)
+    end
+
+    return result
+end
+        
+#
+# Run until some kind of endfile.
+begin
+    # Repeat until an exception or quit gets us out.
+    while true
+        # Read a poly until it works.  An EOF will except out of the
+        # program.
+        print "\n"
+        begin
+            poly = readints("Enter a polynomial coefficients: ")
+        rescue TypeError
+            print "Try again.\n"
+            retry
+        end
+        break if poly.empty?
+
+        # Read and evaluate x values until the user types a blank line.
+        # Again, an EOF will except out of the pgm.
+        while true
+            # Request an integer.
+            print "Enter x value or blank line: "
+            x = readline.chomp
+            break if x == ''
+            raise EOFError.new if x == 'quit'
+
+            # If it looks bad, let's try again.
+            if x !~ /^\-?\d+$/
+                print "That doesn't look like an integer.  Please try again.\n"
+                next
+            end
+
+            # Convert to an integer and print the result.
+            x = x.to_i
+            print "p(x) = ", polystr(poly), "\n"
+            print "p(", x, ") = ", polyval(x, poly), "\n"
+        end
+    end
+rescue EOFError
+    print "\n=== EOF ===\n"
+rescue Interrupt, SignalException
+    print "\n=== Interrupted ===\n"
+else
+    print "--- Bye ---\n"
+end
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/x-ruby",
+        matchBrackets: true,
+        indentUnit: 4
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-ruby</code>.</p>
+
+    <p>Development of the CodeMirror Ruby mode was kindly sponsored
+    by <a href="http://ubalo.com/">Ubalo</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ruby/ruby.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,303 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+function wordObj(words) {
+  var o = {};
+  for (var i = 0, e = words.length; i < e; ++i) o[words[i]] = true;
+  return o;
+}
+
+var keywordList = [
+  "alias", "and", "BEGIN", "begin", "break", "case", "class", "def", "defined?", "do", "else",
+  "elsif", "END", "end", "ensure", "false", "for", "if", "in", "module", "next", "not", "or",
+  "redo", "rescue", "retry", "return", "self", "super", "then", "true", "undef", "unless",
+  "until", "when", "while", "yield", "nil", "raise", "throw", "catch", "fail", "loop", "callcc",
+  "caller", "lambda", "proc", "public", "protected", "private", "require", "load",
+  "require_relative", "extend", "autoload", "__END__", "__FILE__", "__LINE__", "__dir__"
+], keywords = wordObj(keywordList);
+
+var indentWords = wordObj(["def", "class", "case", "for", "while", "until", "module",
+                           "catch", "loop", "proc", "begin"]);
+var dedentWords = wordObj(["end", "until"]);
+var opening = {"[": "]", "{": "}", "(": ")"};
+var closing = {"]": "[", "}": "{", ")": "("};
+
+CodeMirror.defineMode("ruby", function(config) {
+  var curPunc;
+
+  function chain(newtok, stream, state) {
+    state.tokenize.push(newtok);
+    return newtok(stream, state);
+  }
+
+  function tokenBase(stream, state) {
+    if (stream.sol() && stream.match("=begin") && stream.eol()) {
+      state.tokenize.push(readBlockComment);
+      return "comment";
+    }
+    if (stream.eatSpace()) return null;
+    var ch = stream.next(), m;
+    if (ch == "`" || ch == "'" || ch == '"') {
+      return chain(readQuoted(ch, "string", ch == '"' || ch == "`"), stream, state);
+    } else if (ch == "/") {
+      if (regexpAhead(stream))
+        return chain(readQuoted(ch, "string-2", true), stream, state);
+      else
+        return "operator";
+    } else if (ch == "%") {
+      var style = "string", embed = true;
+      if (stream.eat("s")) style = "atom";
+      else if (stream.eat(/[WQ]/)) style = "string";
+      else if (stream.eat(/[r]/)) style = "string-2";
+      else if (stream.eat(/[wxq]/)) { style = "string"; embed = false; }
+      var delim = stream.eat(/[^\w\s=]/);
+      if (!delim) return "operator";
+      if (opening.propertyIsEnumerable(delim)) delim = opening[delim];
+      return chain(readQuoted(delim, style, embed, true), stream, state);
+    } else if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    } else if (ch == "<" && (m = stream.match(/^<([-~])[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/))) {
+      return chain(readHereDoc(m[2], m[1]), stream, state);
+    } else if (ch == "0") {
+      if (stream.eat("x")) stream.eatWhile(/[\da-fA-F]/);
+      else if (stream.eat("b")) stream.eatWhile(/[01]/);
+      else stream.eatWhile(/[0-7]/);
+      return "number";
+    } else if (/\d/.test(ch)) {
+      stream.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/);
+      return "number";
+    } else if (ch == "?") {
+      while (stream.match(/^\\[CM]-/)) {}
+      if (stream.eat("\\")) stream.eatWhile(/\w/);
+      else stream.next();
+      return "string";
+    } else if (ch == ":") {
+      if (stream.eat("'")) return chain(readQuoted("'", "atom", false), stream, state);
+      if (stream.eat('"')) return chain(readQuoted('"', "atom", true), stream, state);
+
+      // :> :>> :< :<< are valid symbols
+      if (stream.eat(/[\<\>]/)) {
+        stream.eat(/[\<\>]/);
+        return "atom";
+      }
+
+      // :+ :- :/ :* :| :& :! are valid symbols
+      if (stream.eat(/[\+\-\*\/\&\|\:\!]/)) {
+        return "atom";
+      }
+
+      // Symbols can't start by a digit
+      if (stream.eat(/[a-zA-Z$@_\xa1-\uffff]/)) {
+        stream.eatWhile(/[\w$\xa1-\uffff]/);
+        // Only one ? ! = is allowed and only as the last character
+        stream.eat(/[\?\!\=]/);
+        return "atom";
+      }
+      return "operator";
+    } else if (ch == "@" && stream.match(/^@?[a-zA-Z_\xa1-\uffff]/)) {
+      stream.eat("@");
+      stream.eatWhile(/[\w\xa1-\uffff]/);
+      return "variable-2";
+    } else if (ch == "$") {
+      if (stream.eat(/[a-zA-Z_]/)) {
+        stream.eatWhile(/[\w]/);
+      } else if (stream.eat(/\d/)) {
+        stream.eat(/\d/);
+      } else {
+        stream.next(); // Must be a special global like $: or $!
+      }
+      return "variable-3";
+    } else if (/[a-zA-Z_\xa1-\uffff]/.test(ch)) {
+      stream.eatWhile(/[\w\xa1-\uffff]/);
+      stream.eat(/[\?\!]/);
+      if (stream.eat(":")) return "atom";
+      return "ident";
+    } else if (ch == "|" && (state.varList || state.lastTok == "{" || state.lastTok == "do")) {
+      curPunc = "|";
+      return null;
+    } else if (/[\(\)\[\]{}\\;]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    } else if (ch == "-" && stream.eat(">")) {
+      return "arrow";
+    } else if (/[=+\-\/*:\.^%<>~|]/.test(ch)) {
+      var more = stream.eatWhile(/[=+\-\/*:\.^%<>~|]/);
+      if (ch == "." && !more) curPunc = ".";
+      return "operator";
+    } else {
+      return null;
+    }
+  }
+
+  function regexpAhead(stream) {
+    var start = stream.pos, depth = 0, next, found = false, escaped = false
+    while ((next = stream.next()) != null) {
+      if (!escaped) {
+        if ("[{(".indexOf(next) > -1) {
+          depth++
+        } else if ("]})".indexOf(next) > -1) {
+          depth--
+          if (depth < 0) break
+        } else if (next == "/" && depth == 0) {
+          found = true
+          break
+        }
+        escaped = next == "\\"
+      } else {
+        escaped = false
+      }
+    }
+    stream.backUp(stream.pos - start)
+    return found
+  }
+
+  function tokenBaseUntilBrace(depth) {
+    if (!depth) depth = 1;
+    return function(stream, state) {
+      if (stream.peek() == "}") {
+        if (depth == 1) {
+          state.tokenize.pop();
+          return state.tokenize[state.tokenize.length-1](stream, state);
+        } else {
+          state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth - 1);
+        }
+      } else if (stream.peek() == "{") {
+        state.tokenize[state.tokenize.length - 1] = tokenBaseUntilBrace(depth + 1);
+      }
+      return tokenBase(stream, state);
+    };
+  }
+  function tokenBaseOnce() {
+    var alreadyCalled = false;
+    return function(stream, state) {
+      if (alreadyCalled) {
+        state.tokenize.pop();
+        return state.tokenize[state.tokenize.length-1](stream, state);
+      }
+      alreadyCalled = true;
+      return tokenBase(stream, state);
+    };
+  }
+  function readQuoted(quote, style, embed, unescaped) {
+    return function(stream, state) {
+      var escaped = false, ch;
+
+      if (state.context.type === 'read-quoted-paused') {
+        state.context = state.context.prev;
+        stream.eat("}");
+      }
+
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && (unescaped || !escaped)) {
+          state.tokenize.pop();
+          break;
+        }
+        if (embed && ch == "#" && !escaped) {
+          if (stream.eat("{")) {
+            if (quote == "}") {
+              state.context = {prev: state.context, type: 'read-quoted-paused'};
+            }
+            state.tokenize.push(tokenBaseUntilBrace());
+            break;
+          } else if (/[@\$]/.test(stream.peek())) {
+            state.tokenize.push(tokenBaseOnce());
+            break;
+          }
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      return style;
+    };
+  }
+  function readHereDoc(phrase, mayIndent) {
+    return function(stream, state) {
+      if (mayIndent) stream.eatSpace()
+      if (stream.match(phrase)) state.tokenize.pop();
+      else stream.skipToEnd();
+      return "string";
+    };
+  }
+  function readBlockComment(stream, state) {
+    if (stream.sol() && stream.match("=end") && stream.eol())
+      state.tokenize.pop();
+    stream.skipToEnd();
+    return "comment";
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: [tokenBase],
+              indented: 0,
+              context: {type: "top", indented: -config.indentUnit},
+              continuedLine: false,
+              lastTok: null,
+              varList: false};
+    },
+
+    token: function(stream, state) {
+      curPunc = null;
+      if (stream.sol()) state.indented = stream.indentation();
+      var style = state.tokenize[state.tokenize.length-1](stream, state), kwtype;
+      var thisTok = curPunc;
+      if (style == "ident") {
+        var word = stream.current();
+        style = state.lastTok == "." ? "property"
+          : keywords.propertyIsEnumerable(stream.current()) ? "keyword"
+          : /^[A-Z]/.test(word) ? "tag"
+          : (state.lastTok == "def" || state.lastTok == "class" || state.varList) ? "def"
+          : "variable";
+        if (style == "keyword") {
+          thisTok = word;
+          if (indentWords.propertyIsEnumerable(word)) kwtype = "indent";
+          else if (dedentWords.propertyIsEnumerable(word)) kwtype = "dedent";
+          else if ((word == "if" || word == "unless") && stream.column() == stream.indentation())
+            kwtype = "indent";
+          else if (word == "do" && state.context.indented < state.indented)
+            kwtype = "indent";
+        }
+      }
+      if (curPunc || (style && style != "comment")) state.lastTok = thisTok;
+      if (curPunc == "|") state.varList = !state.varList;
+
+      if (kwtype == "indent" || /[\(\[\{]/.test(curPunc))
+        state.context = {prev: state.context, type: curPunc || style, indented: state.indented};
+      else if ((kwtype == "dedent" || /[\)\]\}]/.test(curPunc)) && state.context.prev)
+        state.context = state.context.prev;
+
+      if (stream.eol())
+        state.continuedLine = (curPunc == "\\" || style == "operator");
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize[state.tokenize.length-1] != tokenBase) return CodeMirror.Pass;
+      var firstChar = textAfter && textAfter.charAt(0);
+      var ct = state.context;
+      var closed = ct.type == closing[firstChar] ||
+        ct.type == "keyword" && /^(?:end|until|else|elsif|when|rescue)\b/.test(textAfter);
+      return ct.indented + (closed ? 0 : config.indentUnit) +
+        (state.continuedLine ? config.indentUnit : 0);
+    },
+
+    electricInput: /^\s*(?:end|rescue|elsif|else|\})$/,
+    lineComment: "#",
+    fold: "indent"
+  };
+});
+
+CodeMirror.defineMIME("text/x-ruby", "ruby");
+
+CodeMirror.registerHelper("hintWords", "ruby", keywordList);
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ruby/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "ruby");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("divide_equal_operator",
+     "[variable bar] [operator /=] [variable foo]");
+
+  MT("divide_equal_operator_no_spacing",
+     "[variable foo][operator /=][number 42]");
+
+  MT("complex_regexp",
+     "[keyword if] [variable cr] [operator =~] [string-2 /(?: \\( #{][tag RE_NOT][string-2 }\\( | #{][tag RE_NOT_PAR_OR][string-2 }* #{][tag RE_OPA_OR][string-2 } )/][variable x]")
+
+  MT("indented_heredoc",
+     "[keyword def] [def x]",
+     "  [variable y] [operator =] [string <<-FOO]",
+     "[string     bar]",
+     "[string   FOO]",
+     "[keyword end]")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rust/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,64 @@
+<!doctype html>
+
+<title>CodeMirror: Rust mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="rust.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Rust</a>
+  </ul>
+</div>
+
+<article>
+<h2>Rust mode</h2>
+
+
+<div><textarea id="code" name="code">
+// Demo code.
+
+type foo<T> = i32;
+enum bar {
+    Some(i32, foo<f32>),
+    None
+}
+
+fn check_crate(x: i32) {
+    let v = 10;
+    match foo {
+        1 ... 3 {
+            print_foo();
+            if x {
+                blah().to_string();
+            }
+        }
+        (x, y) { "bye" }
+        _ { "hi" }
+    }
+}
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        lineWrapping: true,
+        indentUnit: 4,
+        mode: "rust"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-rustsrc</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rust/rust.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineSimpleMode("rust",{
+  start: [
+    // string and byte string
+    {regex: /b?"/, token: "string", next: "string"},
+    // raw string and raw byte string
+    {regex: /b?r"/, token: "string", next: "string_raw"},
+    {regex: /b?r#+"/, token: "string", next: "string_raw_hash"},
+    // character
+    {regex: /'(?:[^'\\]|\\(?:[nrt0'"]|x[\da-fA-F]{2}|u\{[\da-fA-F]{6}\}))'/, token: "string-2"},
+    // byte
+    {regex: /b'(?:[^']|\\(?:['\\nrt0]|x[\da-fA-F]{2}))'/, token: "string-2"},
+
+    {regex: /(?:(?:[0-9][0-9_]*)(?:(?:[Ee][+-]?[0-9_]+)|\.[0-9_]+(?:[Ee][+-]?[0-9_]+)?)(?:f32|f64)?)|(?:0(?:b[01_]+|(?:o[0-7_]+)|(?:x[0-9a-fA-F_]+))|(?:[0-9][0-9_]*))(?:u8|u16|u32|u64|i8|i16|i32|i64|isize|usize)?/,
+     token: "number"},
+    {regex: /(let(?:\s+mut)?|fn|enum|mod|struct|type|union)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/, token: ["keyword", null, "def"]},
+    {regex: /(?:abstract|alignof|as|async|await|box|break|continue|const|crate|do|dyn|else|enum|extern|fn|for|final|if|impl|in|loop|macro|match|mod|move|offsetof|override|priv|proc|pub|pure|ref|return|self|sizeof|static|struct|super|trait|type|typeof|union|unsafe|unsized|use|virtual|where|while|yield)\b/, token: "keyword"},
+    {regex: /\b(?:Self|isize|usize|char|bool|u8|u16|u32|u64|f16|f32|f64|i8|i16|i32|i64|str|Option)\b/, token: "atom"},
+    {regex: /\b(?:true|false|Some|None|Ok|Err)\b/, token: "builtin"},
+    {regex: /\b(fn)(\s+)([a-zA-Z_][a-zA-Z0-9_]*)/,
+     token: ["keyword", null ,"def"]},
+    {regex: /#!?\[.*\]/, token: "meta"},
+    {regex: /\/\/.*/, token: "comment"},
+    {regex: /\/\*/, token: "comment", next: "comment"},
+    {regex: /[-+\/*=<>!]+/, token: "operator"},
+    {regex: /[a-zA-Z_]\w*!/,token: "variable-3"},
+    {regex: /[a-zA-Z_]\w*/, token: "variable"},
+    {regex: /[\{\[\(]/, indent: true},
+    {regex: /[\}\]\)]/, dedent: true}
+  ],
+  string: [
+    {regex: /"/, token: "string", next: "start"},
+    {regex: /(?:[^\\"]|\\(?:.|$))*/, token: "string"}
+  ],
+  string_raw: [
+    {regex: /"/, token: "string", next: "start"},
+    {regex: /[^"]*/, token: "string"}
+  ],
+  string_raw_hash: [
+    {regex: /"#+/, token: "string", next: "start"},
+    {regex: /(?:[^"]|"(?!#))*/, token: "string"}
+  ],
+  comment: [
+    {regex: /.*?\*\//, token: "comment", next: "start"},
+    {regex: /.*/, token: "comment"}
+  ],
+  meta: {
+    dontIndentStates: ["comment"],
+    electricInput: /^\s*\}$/,
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//",
+    fold: "brace"
+  }
+});
+
+
+CodeMirror.defineMIME("text/x-rustsrc", "rust");
+CodeMirror.defineMIME("text/rust", "rust");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/rust/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,39 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 4}, "rust");
+  function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}
+
+  MT('integer_test',
+     '[number 123i32]',
+     '[number 123u32]',
+     '[number 123_u32]',
+     '[number 0xff_u8]',
+     '[number 0o70_i16]',
+     '[number 0b1111_1111_1001_0000_i32]',
+     '[number 0usize]');
+
+  MT('float_test',
+     '[number 123.0f64]',
+     '[number 0.1f64]',
+     '[number 0.1f32]',
+     '[number 12E+99_f64]');
+
+  MT('string-literals-test',
+     '[string "foo"]',
+     '[string r"foo"]',
+     '[string "\\"foo\\""]',
+     '[string r#""foo""#]',
+     '[string "foo #\\"# bar"]',
+
+     '[string b"foo"]',
+     '[string br"foo"]',
+     '[string b"\\"foo\\""]',
+     '[string br#""foo""#]',
+     '[string br##"foo #" bar"##]',
+
+     "[string-2 'h']",
+     "[string-2 b'h']");
+
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sas/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,81 @@
+<!doctype html>
+
+<title>CodeMirror: SAS mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="sas.js"></script>
+<style>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+  .cm-s-default .cm-trailing-space-a:before,
+  .cm-s-default .cm-trailing-space-b:before {position: absolute; content: "\00B7"; color: #777;}
+  .cm-s-default .cm-trailing-space-new-line:before {position: absolute; content: "\21B5"; color: #777;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">SAS</a>
+  </ul>
+</div>
+
+<article>
+<h2>SAS mode</h2>
+<form><textarea id="code" name="code">
+libname foo "/tmp/foobar";
+%let count=1;
+
+/* Multi line
+Comment
+*/
+data _null_;
+    x=ranuni();
+    * single comment;
+    x2=x**2;
+    sx=sqrt(x);
+    if x=x2 then put "x must be 1";
+    else do;
+        put x=;
+    end;
+run;
+
+/* embedded comment
+* comment;
+*/
+
+proc glm data=sashelp.class;
+    class sex;
+    model weight = height sex;
+run;
+
+proc sql;
+    select count(*)
+    from sashelp.class;
+
+    create table foo as
+    select * from sashelp.class;
+
+    select *
+    from foo;
+quit;
+</textarea></form>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    mode: 'sas',
+    lineNumbers: true
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-sas</code>.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sas/sas.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,303 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+
+// SAS mode copyright (c) 2016 Jared Dean, SAS Institute
+// Created by Jared Dean
+
+// TODO
+// indent and de-indent
+// identify macro variables
+
+
+//Definitions
+//  comment -- text within * ; or /* */
+//  keyword -- SAS language variable
+//  variable -- macro variables starts with '&' or variable formats
+//  variable-2 -- DATA Step, proc, or macro names
+//  string -- text within ' ' or " "
+//  operator -- numeric operator + / - * ** le eq ge ... and so on
+//  builtin -- proc %macro data run mend
+//  atom
+//  def
+
+(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.defineMode("sas", function () {
+    var words = {};
+    var isDoubleOperatorSym = {
+      eq: 'operator',
+      lt: 'operator',
+      le: 'operator',
+      gt: 'operator',
+      ge: 'operator',
+      "in": 'operator',
+      ne: 'operator',
+      or: 'operator'
+    };
+    var isDoubleOperatorChar = /(<=|>=|!=|<>)/;
+    var isSingleOperatorChar = /[=\(:\),{}.*<>+\-\/^\[\]]/;
+
+    // Takes a string of words separated by spaces and adds them as
+    // keys with the value of the first argument 'style'
+    function define(style, string, context) {
+      if (context) {
+        var split = string.split(' ');
+        for (var i = 0; i < split.length; i++) {
+          words[split[i]] = {style: style, state: context};
+        }
+      }
+    }
+    //datastep
+    define('def', 'stack pgm view source debug nesting nolist', ['inDataStep']);
+    define('def', 'if while until for do do; end end; then else cancel', ['inDataStep']);
+    define('def', 'label format _n_ _error_', ['inDataStep']);
+    define('def', 'ALTER BUFNO BUFSIZE CNTLLEV COMPRESS DLDMGACTION ENCRYPT ENCRYPTKEY EXTENDOBSCOUNTER GENMAX GENNUM INDEX LABEL OBSBUF OUTREP PW PWREQ READ REPEMPTY REPLACE REUSE ROLE SORTEDBY SPILL TOBSNO TYPE WRITE FILECLOSE FIRSTOBS IN OBS POINTOBS WHERE WHEREUP IDXNAME IDXWHERE DROP KEEP RENAME', ['inDataStep']);
+    define('def', 'filevar finfo finv fipname fipnamel fipstate first firstobs floor', ['inDataStep']);
+    define('def', 'varfmt varinfmt varlabel varlen varname varnum varray varrayx vartype verify vformat vformatd vformatdx vformatn vformatnx vformatw vformatwx vformatx vinarray vinarrayx vinformat vinformatd vinformatdx vinformatn vinformatnx vinformatw vinformatwx vinformatx vlabel vlabelx vlength vlengthx vname vnamex vnferr vtype vtypex weekday', ['inDataStep']);
+    define('def', 'zipfips zipname zipnamel zipstate', ['inDataStep']);
+    define('def', 'put putc putn', ['inDataStep']);
+    define('builtin', 'data run', ['inDataStep']);
+
+
+    //proc
+    define('def', 'data', ['inProc']);
+
+    // flow control for macros
+    define('def', '%if %end %end; %else %else; %do %do; %then', ['inMacro']);
+
+    //everywhere
+    define('builtin', 'proc run; quit; libname filename %macro %mend option options', ['ALL']);
+
+    define('def', 'footnote title libname ods', ['ALL']);
+    define('def', '%let %put %global %sysfunc %eval ', ['ALL']);
+    // automatic macro variables http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/viewer.htm#a003167023.htm
+    define('variable', '&sysbuffr &syscc &syscharwidth &syscmd &sysdate &sysdate9 &sysday &sysdevic &sysdmg &sysdsn &sysencoding &sysenv &syserr &syserrortext &sysfilrc &syshostname &sysindex &sysinfo &sysjobid &syslast &syslckrc &syslibrc &syslogapplname &sysmacroname &sysmenv &sysmsg &sysncpu &sysodspath &sysparm &syspbuff &sysprocessid &sysprocessname &sysprocname &sysrc &sysscp &sysscpl &sysscpl &syssite &sysstartid &sysstartname &systcpiphostname &systime &sysuserid &sysver &sysvlong &sysvlong4 &syswarningtext', ['ALL']);
+
+    //footnote[1-9]? title[1-9]?
+
+    //options statement
+    define('def', 'source2 nosource2 page pageno pagesize', ['ALL']);
+
+    //proc and datastep
+    define('def', '_all_ _character_ _cmd_ _freq_ _i_ _infile_ _last_ _msg_ _null_ _numeric_ _temporary_ _type_ abort abs addr adjrsq airy alpha alter altlog altprint and arcos array arsin as atan attrc attrib attrn authserver autoexec awscontrol awsdef awsmenu awsmenumerge awstitle backward band base betainv between blocksize blshift bnot bor brshift bufno bufsize bxor by byerr byline byte calculated call cards cards4 catcache cbufno cdf ceil center cexist change chisq cinv class cleanup close cnonct cntllev coalesce codegen col collate collin column comamid comaux1 comaux2 comdef compbl compound compress config continue convert cos cosh cpuid create cross crosstab css curobs cv daccdb daccdbsl daccsl daccsyd dacctab dairy datalines datalines4 datejul datepart datetime day dbcslang dbcstype dclose ddfm ddm delete delimiter depdb depdbsl depsl depsyd deptab dequote descending descript design= device dflang dhms dif digamma dim dinfo display distinct dkricond dkrocond dlm dnum do dopen doptname doptnum dread drop dropnote dsname dsnferr echo else emaildlg emailid emailpw emailserver emailsys encrypt end endsas engine eof eov erf erfc error errorcheck errors exist exp fappend fclose fcol fdelete feedback fetch fetchobs fexist fget file fileclose fileexist filefmt filename fileref  fmterr fmtsearch fnonct fnote font fontalias  fopen foptname foptnum force formatted formchar formdelim formdlim forward fpoint fpos fput fread frewind frlen from fsep fuzz fwrite gaminv gamma getoption getvarc getvarn go goto group gwindow hbar hbound helpenv helploc hms honorappearance hosthelp hostprint hour hpct html hvar ibessel ibr id if index indexc indexw initcmd initstmt inner input inputc inputn inr insert int intck intnx into intrr invaliddata irr is jbessel join juldate keep kentb kurtosis label lag last lbound leave left length levels lgamma lib  library libref line linesize link list log log10 log2 logpdf logpmf logsdf lostcard lowcase lrecl ls macro macrogen maps mautosource max maxdec maxr mdy mean measures median memtype merge merror min minute missing missover mlogic mod mode model modify month mopen mort mprint mrecall msglevel msymtabmax mvarsize myy n nest netpv new news nmiss no nobatch nobs nocaps nocardimage nocenter nocharcode nocmdmac nocol nocum nodate nodbcs nodetails nodmr nodms nodmsbatch nodup nodupkey noduplicates noechoauto noequals noerrorabend noexitwindows nofullstimer noicon noimplmac noint nolist noloadlist nomiss nomlogic nomprint nomrecall nomsgcase nomstored nomultenvappl nonotes nonumber noobs noovp nopad nopercent noprint noprintinit normal norow norsasuser nosetinit  nosplash nosymbolgen note notes notitle notitles notsorted noverbose noxsync noxwait npv null number numkeys nummousekeys nway obs  on open     order ordinal otherwise out outer outp= output over ovp p(1 5 10 25 50 75 90 95 99) pad pad2  paired parm parmcards path pathdll pathname pdf peek peekc pfkey pmf point poisson poke position printer probbeta probbnml probchi probf probgam probhypr probit probnegb probnorm probsig probt procleave prt ps  pw pwreq qtr quote r ranbin rancau random ranexp rangam range ranks rannor ranpoi rantbl rantri ranuni rcorr read recfm register regr remote remove rename repeat repeated replace resolve retain return reuse reverse rewind right round rsquare rtf rtrace rtraceloc s s2 samploc sasautos sascontrol sasfrscr sasmsg sasmstore sasscript sasuser saving scan sdf second select selection separated seq serror set setcomm setot sign simple sin sinh siteinfo skewness skip sle sls sortedby sortpgm sortseq sortsize soundex  spedis splashlocation split spool sqrt start std stderr stdin stfips stimer stname stnamel stop stopover sub subgroup subpopn substr sum sumwgt symbol symbolgen symget symput sysget sysin sysleave sysmsg sysparm sysprint sysprintfont sysprod sysrc system t table tables tan tanh tapeclose tbufsize terminal test then timepart tinv  tnonct to today tol tooldef totper transformout translate trantab tranwrd trigamma trim trimn trunc truncover type unformatted uniform union until upcase update user usericon uss validate value var  weight when where while wincharset window work workinit workterm write wsum xsync xwait yearcutoff yes yyq  min max', ['inDataStep', 'inProc']);
+    define('operator', 'and not ', ['inDataStep', 'inProc']);
+
+    // Main function
+    function tokenize(stream, state) {
+      // Finally advance the stream
+      var ch = stream.next();
+
+      // BLOCKCOMMENT
+      if (ch === '/' && stream.eat('*')) {
+        state.continueComment = true;
+        return "comment";
+      } else if (state.continueComment === true) { // in comment block
+        //comment ends at the beginning of the line
+        if (ch === '*' && stream.peek() === '/') {
+          stream.next();
+          state.continueComment = false;
+        } else if (stream.skipTo('*')) { //comment is potentially later in line
+          stream.skipTo('*');
+          stream.next();
+          if (stream.eat('/'))
+            state.continueComment = false;
+        } else {
+          stream.skipToEnd();
+        }
+        return "comment";
+      }
+
+      if (ch == "*" && stream.column() == stream.indentation()) {
+        stream.skipToEnd()
+        return "comment"
+      }
+
+      // DoubleOperator match
+      var doubleOperator = ch + stream.peek();
+
+      if ((ch === '"' || ch === "'") && !state.continueString) {
+        state.continueString = ch
+        return "string"
+      } else if (state.continueString) {
+        if (state.continueString == ch) {
+          state.continueString = null;
+        } else if (stream.skipTo(state.continueString)) {
+          // quote found on this line
+          stream.next();
+          state.continueString = null;
+        } else {
+          stream.skipToEnd();
+        }
+        return "string";
+      } else if (state.continueString !== null && stream.eol()) {
+        stream.skipTo(state.continueString) || stream.skipToEnd();
+        return "string";
+      } else if (/[\d\.]/.test(ch)) { //find numbers
+        if (ch === ".")
+          stream.match(/^[0-9]+([eE][\-+]?[0-9]+)?/);
+        else if (ch === "0")
+          stream.match(/^[xX][0-9a-fA-F]+/) || stream.match(/^0[0-7]+/);
+        else
+          stream.match(/^[0-9]*\.?[0-9]*([eE][\-+]?[0-9]+)?/);
+        return "number";
+      } else if (isDoubleOperatorChar.test(ch + stream.peek())) { // TWO SYMBOL TOKENS
+        stream.next();
+        return "operator";
+      } else if (isDoubleOperatorSym.hasOwnProperty(doubleOperator)) {
+        stream.next();
+        if (stream.peek() === ' ')
+          return isDoubleOperatorSym[doubleOperator.toLowerCase()];
+      } else if (isSingleOperatorChar.test(ch)) { // SINGLE SYMBOL TOKENS
+        return "operator";
+      }
+
+      // Matches one whole word -- even if the word is a character
+      var word;
+      if (stream.match(/[%&;\w]+/, false) != null) {
+        word = ch + stream.match(/[%&;\w]+/, true);
+        if (/&/.test(word)) return 'variable'
+      } else {
+        word = ch;
+      }
+      // the word after DATA PROC or MACRO
+      if (state.nextword) {
+        stream.match(/[\w]+/);
+        // match memname.libname
+        if (stream.peek() === '.') stream.skipTo(' ');
+        state.nextword = false;
+        return 'variable-2';
+      }
+
+      word = word.toLowerCase()
+      // Are we in a DATA Step?
+      if (state.inDataStep) {
+        if (word === 'run;' || stream.match(/run\s;/)) {
+          state.inDataStep = false;
+          return 'builtin';
+        }
+        // variable formats
+        if ((word) && stream.next() === '.') {
+          //either a format or libname.memname
+          if (/\w/.test(stream.peek())) return 'variable-2';
+          else return 'variable';
+        }
+        // do we have a DATA Step keyword
+        if (word && words.hasOwnProperty(word) &&
+            (words[word].state.indexOf("inDataStep") !== -1 ||
+             words[word].state.indexOf("ALL") !== -1)) {
+          //backup to the start of the word
+          if (stream.start < stream.pos)
+            stream.backUp(stream.pos - stream.start);
+          //advance the length of the word and return
+          for (var i = 0; i < word.length; ++i) stream.next();
+          return words[word].style;
+        }
+      }
+      // Are we in an Proc statement?
+      if (state.inProc) {
+        if (word === 'run;' || word === 'quit;') {
+          state.inProc = false;
+          return 'builtin';
+        }
+        // do we have a proc keyword
+        if (word && words.hasOwnProperty(word) &&
+            (words[word].state.indexOf("inProc") !== -1 ||
+             words[word].state.indexOf("ALL") !== -1)) {
+          stream.match(/[\w]+/);
+          return words[word].style;
+        }
+      }
+      // Are we in a Macro statement?
+      if (state.inMacro) {
+        if (word === '%mend') {
+          if (stream.peek() === ';') stream.next();
+          state.inMacro = false;
+          return 'builtin';
+        }
+        if (word && words.hasOwnProperty(word) &&
+            (words[word].state.indexOf("inMacro") !== -1 ||
+             words[word].state.indexOf("ALL") !== -1)) {
+          stream.match(/[\w]+/);
+          return words[word].style;
+        }
+
+        return 'atom';
+      }
+      // Do we have Keywords specific words?
+      if (word && words.hasOwnProperty(word)) {
+        // Negates the initial next()
+        stream.backUp(1);
+        // Actually move the stream
+        stream.match(/[\w]+/);
+        if (word === 'data' && /=/.test(stream.peek()) === false) {
+          state.inDataStep = true;
+          state.nextword = true;
+          return 'builtin';
+        }
+        if (word === 'proc') {
+          state.inProc = true;
+          state.nextword = true;
+          return 'builtin';
+        }
+        if (word === '%macro') {
+          state.inMacro = true;
+          state.nextword = true;
+          return 'builtin';
+        }
+        if (/title[1-9]/.test(word)) return 'def';
+
+        if (word === 'footnote') {
+          stream.eat(/[1-9]/);
+          return 'def';
+        }
+
+        // Returns their value as state in the prior define methods
+        if (state.inDataStep === true && words[word].state.indexOf("inDataStep") !== -1)
+          return words[word].style;
+        if (state.inProc === true && words[word].state.indexOf("inProc") !== -1)
+          return words[word].style;
+        if (state.inMacro === true && words[word].state.indexOf("inMacro") !== -1)
+          return words[word].style;
+        if (words[word].state.indexOf("ALL") !== -1)
+          return words[word].style;
+        return null;
+      }
+      // Unrecognized syntax
+      return null;
+    }
+
+    return {
+      startState: function () {
+        return {
+          inDataStep: false,
+          inProc: false,
+          inMacro: false,
+          nextword: false,
+          continueString: null,
+          continueComment: false
+        };
+      },
+      token: function (stream, state) {
+        // Strip the spaces, but regex will account for them either way
+        if (stream.eatSpace()) return null;
+        // Go through the main process
+        return tokenize(stream, state);
+      },
+
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/"
+    };
+
+  });
+
+  CodeMirror.defineMIME("text/x-sas", "sas");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sass/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,68 @@
+<!doctype html>
+
+<title>CodeMirror: Sass mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../css/css.js"></script>
+<script src="sass.js"></script>
+<style>.CodeMirror {border: 1px solid #ddd; font-size:12px; height: 400px}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Sass</a>
+  </ul>
+</div>
+
+<article>
+<h2>Sass mode</h2>
+<form><textarea id="code" name="code">// Variable Definitions
+
+$page-width:    800px
+$sidebar-width: 200px
+$primary-color: #eeeeee
+
+// Global Attributes
+
+body
+  font:
+    family: sans-serif
+    size: 30em
+    weight: bold
+
+// Scoped Styles
+
+#contents
+  width: $page-width
+  #sidebar
+    float: right
+    width: $sidebar-width
+  #main
+    width: $page-width - $sidebar-width
+    background: $primary-color
+    h2
+      color: blue
+
+#footer
+  height: 200px
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers : true,
+        matchBrackets : true,
+        mode: "sass"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-sass</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sass/sass.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,459 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../css/css"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../css/css"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode("sass", function(config) {
+  var cssMode = CodeMirror.mimeModes["text/css"];
+  var propertyKeywords = cssMode.propertyKeywords || {},
+      colorKeywords = cssMode.colorKeywords || {},
+      valueKeywords = cssMode.valueKeywords || {},
+      fontProperties = cssMode.fontProperties || {};
+
+  function tokenRegexp(words) {
+    return new RegExp("^" + words.join("|"));
+  }
+
+  var keywords = ["true", "false", "null", "auto"];
+  var keywordsRegexp = new RegExp("^" + keywords.join("|"));
+
+  var operators = ["\\(", "\\)", "=", ">", "<", "==", ">=", "<=", "\\+", "-",
+                   "\\!=", "/", "\\*", "%", "and", "or", "not", ";","\\{","\\}",":"];
+  var opRegexp = tokenRegexp(operators);
+
+  var pseudoElementsRegexp = /^::?[a-zA-Z_][\w\-]*/;
+
+  var word;
+
+  function isEndLine(stream) {
+    return !stream.peek() || stream.match(/\s+$/, false);
+  }
+
+  function urlTokens(stream, state) {
+    var ch = stream.peek();
+
+    if (ch === ")") {
+      stream.next();
+      state.tokenizer = tokenBase;
+      return "operator";
+    } else if (ch === "(") {
+      stream.next();
+      stream.eatSpace();
+
+      return "operator";
+    } else if (ch === "'" || ch === '"') {
+      state.tokenizer = buildStringTokenizer(stream.next());
+      return "string";
+    } else {
+      state.tokenizer = buildStringTokenizer(")", false);
+      return "string";
+    }
+  }
+  function comment(indentation, multiLine) {
+    return function(stream, state) {
+      if (stream.sol() && stream.indentation() <= indentation) {
+        state.tokenizer = tokenBase;
+        return tokenBase(stream, state);
+      }
+
+      if (multiLine && stream.skipTo("*/")) {
+        stream.next();
+        stream.next();
+        state.tokenizer = tokenBase;
+      } else {
+        stream.skipToEnd();
+      }
+
+      return "comment";
+    };
+  }
+
+  function buildStringTokenizer(quote, greedy) {
+    if (greedy == null) { greedy = true; }
+
+    function stringTokenizer(stream, state) {
+      var nextChar = stream.next();
+      var peekChar = stream.peek();
+      var previousChar = stream.string.charAt(stream.pos-2);
+
+      var endingString = ((nextChar !== "\\" && peekChar === quote) || (nextChar === quote && previousChar !== "\\"));
+
+      if (endingString) {
+        if (nextChar !== quote && greedy) { stream.next(); }
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        state.tokenizer = tokenBase;
+        return "string";
+      } else if (nextChar === "#" && peekChar === "{") {
+        state.tokenizer = buildInterpolationTokenizer(stringTokenizer);
+        stream.next();
+        return "operator";
+      } else {
+        return "string";
+      }
+    }
+
+    return stringTokenizer;
+  }
+
+  function buildInterpolationTokenizer(currentTokenizer) {
+    return function(stream, state) {
+      if (stream.peek() === "}") {
+        stream.next();
+        state.tokenizer = currentTokenizer;
+        return "operator";
+      } else {
+        return tokenBase(stream, state);
+      }
+    };
+  }
+
+  function indent(state) {
+    if (state.indentCount == 0) {
+      state.indentCount++;
+      var lastScopeOffset = state.scopes[0].offset;
+      var currentOffset = lastScopeOffset + config.indentUnit;
+      state.scopes.unshift({ offset:currentOffset });
+    }
+  }
+
+  function dedent(state) {
+    if (state.scopes.length == 1) return;
+
+    state.scopes.shift();
+  }
+
+  function tokenBase(stream, state) {
+    var ch = stream.peek();
+
+    // Comment
+    if (stream.match("/*")) {
+      state.tokenizer = comment(stream.indentation(), true);
+      return state.tokenizer(stream, state);
+    }
+    if (stream.match("//")) {
+      state.tokenizer = comment(stream.indentation(), false);
+      return state.tokenizer(stream, state);
+    }
+
+    // Interpolation
+    if (stream.match("#{")) {
+      state.tokenizer = buildInterpolationTokenizer(tokenBase);
+      return "operator";
+    }
+
+    // Strings
+    if (ch === '"' || ch === "'") {
+      stream.next();
+      state.tokenizer = buildStringTokenizer(ch);
+      return "string";
+    }
+
+    if(!state.cursorHalf){// state.cursorHalf === 0
+    // first half i.e. before : for key-value pairs
+    // including selectors
+
+      if (ch === "-") {
+        if (stream.match(/^-\w+-/)) {
+          return "meta";
+        }
+      }
+
+      if (ch === ".") {
+        stream.next();
+        if (stream.match(/^[\w-]+/)) {
+          indent(state);
+          return "qualifier";
+        } else if (stream.peek() === "#") {
+          indent(state);
+          return "tag";
+        }
+      }
+
+      if (ch === "#") {
+        stream.next();
+        // ID selectors
+        if (stream.match(/^[\w-]+/)) {
+          indent(state);
+          return "builtin";
+        }
+        if (stream.peek() === "#") {
+          indent(state);
+          return "tag";
+        }
+      }
+
+      // Variables
+      if (ch === "$") {
+        stream.next();
+        stream.eatWhile(/[\w-]/);
+        return "variable-2";
+      }
+
+      // Numbers
+      if (stream.match(/^-?[0-9\.]+/))
+        return "number";
+
+      // Units
+      if (stream.match(/^(px|em|in)\b/))
+        return "unit";
+
+      if (stream.match(keywordsRegexp))
+        return "keyword";
+
+      if (stream.match(/^url/) && stream.peek() === "(") {
+        state.tokenizer = urlTokens;
+        return "atom";
+      }
+
+      if (ch === "=") {
+        // Match shortcut mixin definition
+        if (stream.match(/^=[\w-]+/)) {
+          indent(state);
+          return "meta";
+        }
+      }
+
+      if (ch === "+") {
+        // Match shortcut mixin definition
+        if (stream.match(/^\+[\w-]+/)){
+          return "variable-3";
+        }
+      }
+
+      if(ch === "@"){
+        if(stream.match('@extend')){
+          if(!stream.match(/\s*[\w]/))
+            dedent(state);
+        }
+      }
+
+
+      // Indent Directives
+      if (stream.match(/^@(else if|if|media|else|for|each|while|mixin|function)/)) {
+        indent(state);
+        return "def";
+      }
+
+      // Other Directives
+      if (ch === "@") {
+        stream.next();
+        stream.eatWhile(/[\w-]/);
+        return "def";
+      }
+
+      if (stream.eatWhile(/[\w-]/)){
+        if(stream.match(/ *: *[\w-\+\$#!\("']/,false)){
+          word = stream.current().toLowerCase();
+          var prop = state.prevProp + "-" + word;
+          if (propertyKeywords.hasOwnProperty(prop)) {
+            return "property";
+          } else if (propertyKeywords.hasOwnProperty(word)) {
+            state.prevProp = word;
+            return "property";
+          } else if (fontProperties.hasOwnProperty(word)) {
+            return "property";
+          }
+          return "tag";
+        }
+        else if(stream.match(/ *:/,false)){
+          indent(state);
+          state.cursorHalf = 1;
+          state.prevProp = stream.current().toLowerCase();
+          return "property";
+        }
+        else if(stream.match(/ *,/,false)){
+          return "tag";
+        }
+        else{
+          indent(state);
+          return "tag";
+        }
+      }
+
+      if(ch === ":"){
+        if (stream.match(pseudoElementsRegexp)){ // could be a pseudo-element
+          return "variable-3";
+        }
+        stream.next();
+        state.cursorHalf=1;
+        return "operator";
+      }
+
+    } // cursorHalf===0 ends here
+    else{
+
+      if (ch === "#") {
+        stream.next();
+        // Hex numbers
+        if (stream.match(/[0-9a-fA-F]{6}|[0-9a-fA-F]{3}/)){
+          if (isEndLine(stream)) {
+            state.cursorHalf = 0;
+          }
+          return "number";
+        }
+      }
+
+      // Numbers
+      if (stream.match(/^-?[0-9\.]+/)){
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        return "number";
+      }
+
+      // Units
+      if (stream.match(/^(px|em|in)\b/)){
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        return "unit";
+      }
+
+      if (stream.match(keywordsRegexp)){
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        return "keyword";
+      }
+
+      if (stream.match(/^url/) && stream.peek() === "(") {
+        state.tokenizer = urlTokens;
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        return "atom";
+      }
+
+      // Variables
+      if (ch === "$") {
+        stream.next();
+        stream.eatWhile(/[\w-]/);
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        return "variable-2";
+      }
+
+      // bang character for !important, !default, etc.
+      if (ch === "!") {
+        stream.next();
+        state.cursorHalf = 0;
+        return stream.match(/^[\w]+/) ? "keyword": "operator";
+      }
+
+      if (stream.match(opRegexp)){
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        return "operator";
+      }
+
+      // attributes
+      if (stream.eatWhile(/[\w-]/)) {
+        if (isEndLine(stream)) {
+          state.cursorHalf = 0;
+        }
+        word = stream.current().toLowerCase();
+        if (valueKeywords.hasOwnProperty(word)) {
+          return "atom";
+        } else if (colorKeywords.hasOwnProperty(word)) {
+          return "keyword";
+        } else if (propertyKeywords.hasOwnProperty(word)) {
+          state.prevProp = stream.current().toLowerCase();
+          return "property";
+        } else {
+          return "tag";
+        }
+      }
+
+      //stream.eatSpace();
+      if (isEndLine(stream)) {
+        state.cursorHalf = 0;
+        return null;
+      }
+
+    } // else ends here
+
+    if (stream.match(opRegexp))
+      return "operator";
+
+    // If we haven't returned by now, we move 1 character
+    // and return an error
+    stream.next();
+    return null;
+  }
+
+  function tokenLexer(stream, state) {
+    if (stream.sol()) state.indentCount = 0;
+    var style = state.tokenizer(stream, state);
+    var current = stream.current();
+
+    if (current === "@return" || current === "}"){
+      dedent(state);
+    }
+
+    if (style !== null) {
+      var startOfToken = stream.pos - current.length;
+
+      var withCurrentIndent = startOfToken + (config.indentUnit * state.indentCount);
+
+      var newScopes = [];
+
+      for (var i = 0; i < state.scopes.length; i++) {
+        var scope = state.scopes[i];
+
+        if (scope.offset <= withCurrentIndent)
+          newScopes.push(scope);
+      }
+
+      state.scopes = newScopes;
+    }
+
+
+    return style;
+  }
+
+  return {
+    startState: function() {
+      return {
+        tokenizer: tokenBase,
+        scopes: [{offset: 0, type: "sass"}],
+        indentCount: 0,
+        cursorHalf: 0,  // cursor half tells us if cursor lies after (1)
+                        // or before (0) colon (well... more or less)
+        definedVars: [],
+        definedMixins: []
+      };
+    },
+    token: function(stream, state) {
+      var style = tokenLexer(stream, state);
+
+      state.lastToken = { style: style, content: stream.current() };
+
+      return style;
+    },
+
+    indent: function(state) {
+      return state.scopes[0].offset;
+    },
+
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//",
+    fold: "indent"
+  };
+}, "css");
+
+CodeMirror.defineMIME("text/x-sass", "sass");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sass/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,122 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "sass");
+  // Since Sass has an indent-based syntax, is almost impossible to test correctly the indentation in all cases.
+  // So disable it for tests.
+  mode.indent = undefined;
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("comment",
+     "[comment // this is a comment]",
+     "[comment   also this is a comment]")
+
+  MT("comment_multiline",
+     "[comment /* this is a comment]",
+     "[comment   also this is a comment]")
+
+  MT("variable",
+     "[variable-2 $page-width][operator :] [number 800][unit px]")
+
+  MT("global_attributes",
+     "[tag body]",
+     "  [property font][operator :]",
+     "    [property family][operator :] [atom sans-serif]",
+     "    [property size][operator :] [number 30][unit em]",
+     "    [property weight][operator :] [atom bold]")
+
+  MT("scoped_styles",
+     "[builtin #contents]",
+     "  [property width][operator :] [variable-2 $page-width]",
+     "  [builtin #sidebar]",
+     "    [property float][operator :] [atom right]",
+     "    [property width][operator :] [variable-2 $sidebar-width]",
+     "  [builtin #main]",
+     "    [property width][operator :] [variable-2 $page-width] [operator -] [variable-2 $sidebar-width]",
+     "    [property background][operator :] [variable-2 $primary-color]",
+     "    [tag h2]",
+     "      [property color][operator :] [keyword blue]")
+
+  // Sass allows to write the colon as first char instead of a "separator".
+  //   :color red
+  // Not supported
+  // MT("property_syntax",
+  //    "[qualifier .foo]",
+  //    "  [operator :][property color] [keyword red]")
+
+  MT("import",
+     "[def @import] [string \"sass/variables\"]",
+     // Probably it should parsed as above: as a string even without the " or '
+     // "[def @import] [string sass/baz]"
+     "[def @import] [tag sass][operator /][tag baz]")
+
+  MT("def",
+     "[def @if] [variable-2 $foo] [def @else]")
+
+  MT("tag_on_more_lines",
+    "[tag td],",
+    "[tag th]",
+    "  [property font-family][operator :] [string \"Arial\"], [atom serif]")
+
+  MT("important",
+     "[qualifier .foo]",
+     "  [property text-decoration][operator :] [atom none] [keyword !important]",
+     "[tag h1]",
+     "  [property font-size][operator :] [number 2.5][unit em]")
+
+  MT("selector",
+     // SCSS doesn't highlight the :
+     // "[tag h1]:[variable-3 before],",
+     // "[tag h2]:[variable-3 before]",
+     "[tag h1][variable-3 :before],",
+     "[tag h2][variable-3 :before]",
+     "  [property content][operator :] [string \"::\"]")
+
+  MT("definition_mixin_equal",
+     "[variable-2 $defined-bs-type][operator :] [atom border-box] [keyword !default]",
+     "[meta =bs][operator (][variable-2 $bs-type][operator :] [variable-2 $defined-bs-type][operator )]",
+     "  [meta -webkit-][property box-sizing][operator :] [variable-2 $bs-type]",
+     "  [property box-sizing][operator :] [variable-2 $bs-type]")
+
+  MT("definition_mixin_with_space",
+     "[variable-2 $defined-bs-type][operator :] [atom border-box] [keyword !default]",
+     "[def @mixin] [tag bs][operator (][variable-2 $bs-type][operator :] [variable-2 $defined-bs-type][operator )] ",
+     "  [meta -moz-][property box-sizing][operator :] [variable-2 $bs-type]",
+     "  [property box-sizing][operator :] [variable-2 $bs-type]")
+
+  MT("numbers_start_dot_include_plus",
+     // The % is not highlighted correctly
+     // "[meta =button-links][operator (][variable-2 $button-base][operator :] [atom darken][operator (][variable-2 $color11], [number 10][unit %][operator )][operator )]",
+     "[meta =button-links][operator (][variable-2 $button-base][operator :] [atom darken][operator (][variable-2 $color11], [number 10][operator %))]",
+     "  [property padding][operator :] [number .3][unit em] [number .6][unit em]",
+     "  [variable-3 +border-radius][operator (][number 8][unit px][operator )]",
+     "  [property background-color][operator :] [variable-2 $button-base]")
+
+  MT("include",
+     "[qualifier .bar]",
+     "  [def @include] [tag border-radius][operator (][number 8][unit px][operator )]")
+
+  MT("reference_parent",
+     "[qualifier .col]",
+     "  [property clear][operator :] [atom both]",
+     // SCSS doesn't highlight the :
+     // "  &:[variable-3 after]",
+     "  &[variable-3 :after]",
+     "    [property content][operator :] [string '']",
+     "    [property clear][operator :] [atom both]")
+
+  MT("reference_parent_with_spaces",
+     "[tag section]",
+     "  [property border-left][operator :]  [number 20][unit px] [atom transparent] [atom solid] ",
+     "  &[qualifier .section3]",
+     "    [qualifier .title]",
+     "      [property color][operator :] [keyword white] ",
+     "    [qualifier .vermas]",
+     "      [property display][operator :] [atom none]")
+
+  MT("font_face",
+     "[def @font-face]",
+     "  [property font-family][operator :] [string 'icomoon']",
+     "  [property src][operator :] [atom url][operator (][string fonts/icomoon.ttf][operator )]")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/scheme/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,77 @@
+<!doctype html>
+
+<title>CodeMirror: Scheme mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="scheme.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Scheme</a>
+  </ul>
+</div>
+
+<article>
+<h2>Scheme mode</h2>
+<form><textarea id="code" name="code">
+; See if the input starts with a given symbol.
+(define (match-symbol input pattern)
+  (cond ((null? (remain input)) #f)
+	((eqv? (car (remain input)) pattern) (r-cdr input))
+	(else #f)))
+
+; Allow the input to start with one of a list of patterns.
+(define (match-or input pattern)
+  (cond ((null? pattern) #f)
+	((match-pattern input (car pattern)))
+	(else (match-or input (cdr pattern)))))
+
+; Allow a sequence of patterns.
+(define (match-seq input pattern)
+  (if (null? pattern)
+      input
+      (let ((match (match-pattern input (car pattern))))
+	(if match (match-seq match (cdr pattern)) #f))))
+
+; Match with the pattern but no problem if it does not match.
+(define (match-opt input pattern)
+  (let ((match (match-pattern input (car pattern))))
+    (if match match input)))
+
+; Match anything (other than '()), until pattern is found. The rather
+; clumsy form of requiring an ending pattern is needed to decide where
+; the end of the match is. If none is given, this will match the rest
+; of the sentence.
+(define (match-any input pattern)
+  (cond ((null? (remain input)) #f)
+	((null? pattern) (f-cons (remain input) (clear-remain input)))
+	(else
+	 (let ((accum-any (collector)))
+	   (define (match-pattern-any input pattern)
+	     (cond ((null? (remain input)) #f)
+		   (else (accum-any (car (remain input)))
+			 (cond ((match-pattern (r-cdr input) pattern))
+			       (else (match-pattern-any (r-cdr input) pattern))))))
+	   (let ((retval (match-pattern-any input (car pattern))))
+	     (if retval
+		 (f-cons (accum-any) retval)
+		 #f))))))
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-scheme</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/scheme/scheme.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,284 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Author: Koh Zi Han, based on implementation by Koh Zi Chun
+ * Improved by: Jakub T. Jankiewicz
+ */
+
+(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.defineMode("scheme", function () {
+    var BUILTIN = "builtin", COMMENT = "comment", STRING = "string",
+        SYMBOL = "symbol", ATOM = "atom", NUMBER = "number", BRACKET = "bracket";
+    var INDENT_WORD_SKIP = 2;
+
+    function makeKeywords(str) {
+        var obj = {}, words = str.split(" ");
+        for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+        return obj;
+    }
+
+    var keywords = makeKeywords("λ case-lambda call/cc class cond-expand define-class define-values exit-handler field import inherit init-field interface let*-values let-values let/ec mixin opt-lambda override protect provide public rename require require-for-syntax syntax syntax-case syntax-error unit/sig unless when with-syntax and begin call-with-current-continuation call-with-input-file call-with-output-file case cond define define-syntax define-macro defmacro delay do dynamic-wind else for-each if lambda let let* let-syntax letrec letrec-syntax map or syntax-rules abs acos angle append apply asin assoc assq assv atan boolean? caar cadr call-with-input-file call-with-output-file call-with-values car cdddar cddddr cdr ceiling char->integer char-alphabetic? char-ci<=? char-ci<? char-ci=? char-ci>=? char-ci>? char-downcase char-lower-case? char-numeric? char-ready? char-upcase char-upper-case? char-whitespace? char<=? char<? char=? char>=? char>? char? close-input-port close-output-port complex? cons cos current-input-port current-output-port denominator display eof-object? eq? equal? eqv? eval even? exact->inexact exact? exp expt #f floor force gcd imag-part inexact->exact inexact? input-port? integer->char integer? interaction-environment lcm length list list->string list->vector list-ref list-tail list? load log magnitude make-polar make-rectangular make-string make-vector max member memq memv min modulo negative? newline not null-environment null? number->string number? numerator odd? open-input-file open-output-file output-port? pair? peek-char port? positive? procedure? quasiquote quote quotient rational? rationalize read read-char real-part real? remainder reverse round scheme-report-environment set! set-car! set-cdr! sin sqrt string string->list string->number string->symbol string-append string-ci<=? string-ci<? string-ci=? string-ci>=? string-ci>? string-copy string-fill! string-length string-ref string-set! string<=? string<? string=? string>=? string>? string? substring symbol->string symbol? #t tan transcript-off transcript-on truncate values vector vector->list vector-fill! vector-length vector-ref vector-set! with-input-from-file with-output-to-file write write-char zero?");
+    var indentKeys = makeKeywords("define let letrec let* lambda define-macro defmacro let-syntax letrec-syntax let-values let*-values define-syntax syntax-rules define-values when unless");
+
+    function stateStack(indent, type, prev) { // represents a state stack object
+        this.indent = indent;
+        this.type = type;
+        this.prev = prev;
+    }
+
+    function pushStack(state, indent, type) {
+        state.indentStack = new stateStack(indent, type, state.indentStack);
+    }
+
+    function popStack(state) {
+        state.indentStack = state.indentStack.prev;
+    }
+
+    var binaryMatcher = new RegExp(/^(?:[-+]i|[-+][01]+#*(?:\/[01]+#*)?i|[-+]?[01]+#*(?:\/[01]+#*)?@[-+]?[01]+#*(?:\/[01]+#*)?|[-+]?[01]+#*(?:\/[01]+#*)?[-+](?:[01]+#*(?:\/[01]+#*)?)?i|[-+]?[01]+#*(?:\/[01]+#*)?)(?=[()\s;"]|$)/i);
+    var octalMatcher = new RegExp(/^(?:[-+]i|[-+][0-7]+#*(?:\/[0-7]+#*)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?@[-+]?[0-7]+#*(?:\/[0-7]+#*)?|[-+]?[0-7]+#*(?:\/[0-7]+#*)?[-+](?:[0-7]+#*(?:\/[0-7]+#*)?)?i|[-+]?[0-7]+#*(?:\/[0-7]+#*)?)(?=[()\s;"]|$)/i);
+    var hexMatcher = new RegExp(/^(?:[-+]i|[-+][\da-f]+#*(?:\/[\da-f]+#*)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?@[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?[-+](?:[\da-f]+#*(?:\/[\da-f]+#*)?)?i|[-+]?[\da-f]+#*(?:\/[\da-f]+#*)?)(?=[()\s;"]|$)/i);
+    var decimalMatcher = new RegExp(/^(?:[-+]i|[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)i|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)@[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)|[-+]?(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)[-+](?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*)?i|(?:(?:(?:\d+#+\.?#*|\d+\.\d*#*|\.\d+#*|\d+)(?:[esfdl][-+]?\d+)?)|\d+#*\/\d+#*))(?=[()\s;"]|$)/i);
+
+    function isBinaryNumber (stream) {
+        return stream.match(binaryMatcher);
+    }
+
+    function isOctalNumber (stream) {
+        return stream.match(octalMatcher);
+    }
+
+    function isDecimalNumber (stream, backup) {
+        if (backup === true) {
+            stream.backUp(1);
+        }
+        return stream.match(decimalMatcher);
+    }
+
+    function isHexNumber (stream) {
+        return stream.match(hexMatcher);
+    }
+
+    function processEscapedSequence(stream, options) {
+        var next, escaped = false;
+        while ((next = stream.next()) != null) {
+            if (next == options.token && !escaped) {
+
+                options.state.mode = false;
+                break;
+            }
+            escaped = !escaped && next == "\\";
+        }
+    }
+
+    return {
+        startState: function () {
+            return {
+                indentStack: null,
+                indentation: 0,
+                mode: false,
+                sExprComment: false,
+                sExprQuote: false
+            };
+        },
+
+        token: function (stream, state) {
+            if (state.indentStack == null && stream.sol()) {
+                // update indentation, but only if indentStack is empty
+                state.indentation = stream.indentation();
+            }
+
+            // skip spaces
+            if (stream.eatSpace()) {
+                return null;
+            }
+            var returnType = null;
+
+            switch(state.mode){
+                case "string": // multi-line string parsing mode
+                    processEscapedSequence(stream, {
+                        token: "\"",
+                        state: state
+                    });
+                    returnType = STRING; // continue on in scheme-string mode
+                    break;
+                case "symbol": // escape symbol
+                    processEscapedSequence(stream, {
+                        token: "|",
+                        state: state
+                    });
+                    returnType = SYMBOL; // continue on in scheme-symbol mode
+                    break;
+                case "comment": // comment parsing mode
+                    var next, maybeEnd = false;
+                    while ((next = stream.next()) != null) {
+                        if (next == "#" && maybeEnd) {
+
+                            state.mode = false;
+                            break;
+                        }
+                        maybeEnd = (next == "|");
+                    }
+                    returnType = COMMENT;
+                    break;
+                case "s-expr-comment": // s-expr commenting mode
+                    state.mode = false;
+                    if(stream.peek() == "(" || stream.peek() == "["){
+                        // actually start scheme s-expr commenting mode
+                        state.sExprComment = 0;
+                    }else{
+                        // if not we just comment the entire of the next token
+                        stream.eatWhile(/[^\s\(\)\[\]]/); // eat symbol atom
+                        returnType = COMMENT;
+                        break;
+                    }
+                default: // default parsing mode
+                    var ch = stream.next();
+
+                    if (ch == "\"") {
+                        state.mode = "string";
+                        returnType = STRING;
+
+                    } else if (ch == "'") {
+                        if (stream.peek() == "(" || stream.peek() == "["){
+                            if (typeof state.sExprQuote != "number") {
+                                state.sExprQuote = 0;
+                            } // else already in a quoted expression
+                            returnType = ATOM;
+                        } else {
+                            stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/);
+                            returnType = ATOM;
+                        }
+                    } else if (ch == '|') {
+                        state.mode = "symbol";
+                        returnType = SYMBOL;
+                    } else if (ch == '#') {
+                        if (stream.eat("|")) {                    // Multi-line comment
+                            state.mode = "comment"; // toggle to comment mode
+                            returnType = COMMENT;
+                        } else if (stream.eat(/[tf]/i)) {            // #t/#f (atom)
+                            returnType = ATOM;
+                        } else if (stream.eat(';')) {                // S-Expr comment
+                            state.mode = "s-expr-comment";
+                            returnType = COMMENT;
+                        } else {
+                            var numTest = null, hasExactness = false, hasRadix = true;
+                            if (stream.eat(/[ei]/i)) {
+                                hasExactness = true;
+                            } else {
+                                stream.backUp(1);       // must be radix specifier
+                            }
+                            if (stream.match(/^#b/i)) {
+                                numTest = isBinaryNumber;
+                            } else if (stream.match(/^#o/i)) {
+                                numTest = isOctalNumber;
+                            } else if (stream.match(/^#x/i)) {
+                                numTest = isHexNumber;
+                            } else if (stream.match(/^#d/i)) {
+                                numTest = isDecimalNumber;
+                            } else if (stream.match(/^[-+0-9.]/, false)) {
+                                hasRadix = false;
+                                numTest = isDecimalNumber;
+                            // re-consume the initial # if all matches failed
+                            } else if (!hasExactness) {
+                                stream.eat('#');
+                            }
+                            if (numTest != null) {
+                                if (hasRadix && !hasExactness) {
+                                    // consume optional exactness after radix
+                                    stream.match(/^#[ei]/i);
+                                }
+                                if (numTest(stream))
+                                    returnType = NUMBER;
+                            }
+                        }
+                    } else if (/^[-+0-9.]/.test(ch) && isDecimalNumber(stream, true)) { // match non-prefixed number, must be decimal
+                        returnType = NUMBER;
+                    } else if (ch == ";") { // comment
+                        stream.skipToEnd(); // rest of the line is a comment
+                        returnType = COMMENT;
+                    } else if (ch == "(" || ch == "[") {
+                      var keyWord = ''; var indentTemp = stream.column(), letter;
+                        /**
+                        Either
+                        (indent-word ..
+                        (non-indent-word ..
+                        (;something else, bracket, etc.
+                        */
+
+                        while ((letter = stream.eat(/[^\s\(\[\;\)\]]/)) != null) {
+                            keyWord += letter;
+                        }
+
+                        if (keyWord.length > 0 && indentKeys.propertyIsEnumerable(keyWord)) { // indent-word
+
+                            pushStack(state, indentTemp + INDENT_WORD_SKIP, ch);
+                        } else { // non-indent word
+                            // we continue eating the spaces
+                            stream.eatSpace();
+                            if (stream.eol() || stream.peek() == ";") {
+                                // nothing significant after
+                                // we restart indentation 1 space after
+                                pushStack(state, indentTemp + 1, ch);
+                            } else {
+                                pushStack(state, indentTemp + stream.current().length, ch); // else we match
+                            }
+                        }
+                        stream.backUp(stream.current().length - 1); // undo all the eating
+
+                        if(typeof state.sExprComment == "number") state.sExprComment++;
+                        if(typeof state.sExprQuote == "number") state.sExprQuote++;
+
+                        returnType = BRACKET;
+                    } else if (ch == ")" || ch == "]") {
+                        returnType = BRACKET;
+                        if (state.indentStack != null && state.indentStack.type == (ch == ")" ? "(" : "[")) {
+                            popStack(state);
+
+                            if(typeof state.sExprComment == "number"){
+                                if(--state.sExprComment == 0){
+                                    returnType = COMMENT; // final closing bracket
+                                    state.sExprComment = false; // turn off s-expr commenting mode
+                                }
+                            }
+                            if(typeof state.sExprQuote == "number"){
+                                if(--state.sExprQuote == 0){
+                                    returnType = ATOM; // final closing bracket
+                                    state.sExprQuote = false; // turn off s-expr quote mode
+                                }
+                            }
+                        }
+                    } else {
+                        stream.eatWhile(/[\w_\-!$%&*+\.\/:<=>?@\^~]/);
+
+                        if (keywords && keywords.propertyIsEnumerable(stream.current())) {
+                            returnType = BUILTIN;
+                        } else returnType = "variable";
+                    }
+            }
+            return (typeof state.sExprComment == "number") ? COMMENT : ((typeof state.sExprQuote == "number") ? ATOM : returnType);
+        },
+
+        indent: function (state) {
+            if (state.indentStack == null) return state.indentation;
+            return state.indentStack.indent;
+        },
+
+        fold: "brace-paren",
+        closeBrackets: {pairs: "()[]{}\"\""},
+        lineComment: ";;"
+    };
+});
+
+CodeMirror.defineMIME("text/x-scheme", "scheme");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/shell/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,66 @@
+<!doctype html>
+
+<title>CodeMirror: Shell mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src=shell.js></script>
+<style type=text/css>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Shell</a>
+  </ul>
+</div>
+
+<article>
+<h2>Shell mode</h2>
+
+
+<textarea id=code>
+#!/bin/bash
+
+# clone the repository
+git clone http://github.com/garden/tree
+
+# generate HTTPS credentials
+cd tree
+openssl genrsa -aes256 -out https.key 1024
+openssl req -new -nodes -key https.key -out https.csr
+openssl x509 -req -days 365 -in https.csr -signkey https.key -out https.crt
+cp https.key{,.orig}
+openssl rsa -in https.key.orig -out https.key
+
+# start the server in HTTPS mode
+cd web
+sudo node ../server.js 443 'yes' &gt;&gt; ../node.log &amp;
+
+# here is how to stop the server
+for pid in `ps aux | grep 'node ../server.js' | awk '{print $2}'` ; do
+  sudo kill -9 $pid 2&gt; /dev/null
+done
+
+exit 0</textarea>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+    mode: 'shell',
+    lineNumbers: true,
+    matchBrackets: true
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-sh</code>, <code>application/x-sh</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/shell/shell.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,168 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode('shell', function() {
+
+  var words = {};
+  function define(style, dict) {
+    for(var i = 0; i < dict.length; i++) {
+      words[dict[i]] = style;
+    }
+  };
+
+  var commonAtoms = ["true", "false"];
+  var commonKeywords = ["if", "then", "do", "else", "elif", "while", "until", "for", "in", "esac", "fi",
+    "fin", "fil", "done", "exit", "set", "unset", "export", "function"];
+  var commonCommands = ["ab", "awk", "bash", "beep", "cat", "cc", "cd", "chown", "chmod", "chroot", "clear",
+    "cp", "curl", "cut", "diff", "echo", "find", "gawk", "gcc", "get", "git", "grep", "hg", "kill", "killall",
+    "ln", "ls", "make", "mkdir", "openssl", "mv", "nc", "nl", "node", "npm", "ping", "ps", "restart", "rm",
+    "rmdir", "sed", "service", "sh", "shopt", "shred", "source", "sort", "sleep", "ssh", "start", "stop",
+    "su", "sudo", "svn", "tee", "telnet", "top", "touch", "vi", "vim", "wall", "wc", "wget", "who", "write",
+    "yes", "zsh"];
+
+  CodeMirror.registerHelper("hintWords", "shell", commonAtoms.concat(commonKeywords, commonCommands));
+
+  define('atom', commonAtoms);
+  define('keyword', commonKeywords);
+  define('builtin', commonCommands);
+
+  function tokenBase(stream, state) {
+    if (stream.eatSpace()) return null;
+
+    var sol = stream.sol();
+    var ch = stream.next();
+
+    if (ch === '\\') {
+      stream.next();
+      return null;
+    }
+    if (ch === '\'' || ch === '"' || ch === '`') {
+      state.tokens.unshift(tokenString(ch, ch === "`" ? "quote" : "string"));
+      return tokenize(stream, state);
+    }
+    if (ch === '#') {
+      if (sol && stream.eat('!')) {
+        stream.skipToEnd();
+        return 'meta'; // 'comment'?
+      }
+      stream.skipToEnd();
+      return 'comment';
+    }
+    if (ch === '$') {
+      state.tokens.unshift(tokenDollar);
+      return tokenize(stream, state);
+    }
+    if (ch === '+' || ch === '=') {
+      return 'operator';
+    }
+    if (ch === '-') {
+      stream.eat('-');
+      stream.eatWhile(/\w/);
+      return 'attribute';
+    }
+    if (ch == "<") {
+      if (stream.match("<<")) return "operator"
+      var heredoc = stream.match(/^<-?\s*['"]?([^'"]*)['"]?/)
+      if (heredoc) {
+        state.tokens.unshift(tokenHeredoc(heredoc[1]))
+        return 'string-2'
+      }
+    }
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/\d/);
+      if(stream.eol() || !/\w/.test(stream.peek())) {
+        return 'number';
+      }
+    }
+    stream.eatWhile(/[\w-]/);
+    var cur = stream.current();
+    if (stream.peek() === '=' && /\w+/.test(cur)) return 'def';
+    return words.hasOwnProperty(cur) ? words[cur] : null;
+  }
+
+  function tokenString(quote, style) {
+    var close = quote == "(" ? ")" : quote == "{" ? "}" : quote
+    return function(stream, state) {
+      var next, escaped = false;
+      while ((next = stream.next()) != null) {
+        if (next === close && !escaped) {
+          state.tokens.shift();
+          break;
+        } else if (next === '$' && !escaped && quote !== "'" && stream.peek() != close) {
+          escaped = true;
+          stream.backUp(1);
+          state.tokens.unshift(tokenDollar);
+          break;
+        } else if (!escaped && quote !== close && next === quote) {
+          state.tokens.unshift(tokenString(quote, style))
+          return tokenize(stream, state)
+        } else if (!escaped && /['"]/.test(next) && !/['"]/.test(quote)) {
+          state.tokens.unshift(tokenStringStart(next, "string"));
+          stream.backUp(1);
+          break;
+        }
+        escaped = !escaped && next === '\\';
+      }
+      return style;
+    };
+  };
+
+  function tokenStringStart(quote, style) {
+    return function(stream, state) {
+      state.tokens[0] = tokenString(quote, style)
+      stream.next()
+      return tokenize(stream, state)
+    }
+  }
+
+  var tokenDollar = function(stream, state) {
+    if (state.tokens.length > 1) stream.eat('$');
+    var ch = stream.next()
+    if (/['"({]/.test(ch)) {
+      state.tokens[0] = tokenString(ch, ch == "(" ? "quote" : ch == "{" ? "def" : "string");
+      return tokenize(stream, state);
+    }
+    if (!/\d/.test(ch)) stream.eatWhile(/\w/);
+    state.tokens.shift();
+    return 'def';
+  };
+
+  function tokenHeredoc(delim) {
+    return function(stream, state) {
+      if (stream.sol() && stream.string == delim) state.tokens.shift()
+      stream.skipToEnd()
+      return "string-2"
+    }
+  }
+
+  function tokenize(stream, state) {
+    return (state.tokens[0] || tokenBase) (stream, state);
+  };
+
+  return {
+    startState: function() {return {tokens:[]};},
+    token: function(stream, state) {
+      return tokenize(stream, state);
+    },
+    closeBrackets: "()[]{}''\"\"``",
+    lineComment: '#',
+    fold: "brace"
+  };
+});
+
+CodeMirror.defineMIME('text/x-sh', 'shell');
+// Apache uses a slightly different Media Type for Shell scripts
+// http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
+CodeMirror.defineMIME('application/x-sh', 'shell');
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/shell/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,80 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({}, "shell");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("var",
+     "text [def $var] text");
+  MT("varBraces",
+     "text[def ${var}]text");
+  MT("varVar",
+     "text [def $a$b] text");
+  MT("varBracesVarBraces",
+     "text[def ${a}${b}]text");
+
+  MT("singleQuotedVar",
+     "[string 'text $var text']");
+  MT("singleQuotedVarBraces",
+     "[string 'text ${var} text']");
+
+  MT("doubleQuotedVar",
+     '[string "text ][def $var][string  text"]');
+  MT("doubleQuotedVarBraces",
+     '[string "text][def ${var}][string text"]');
+  MT("doubleQuotedVarPunct",
+     '[string "text ][def $@][string  text"]');
+  MT("doubleQuotedVarVar",
+     '[string "][def $a$b][string "]');
+  MT("doubleQuotedVarBracesVarBraces",
+     '[string "][def ${a}${b}][string "]');
+
+  MT("notAString",
+     "text\\'text");
+  MT("escapes",
+     "outside\\'\\\"\\`\\\\[string \"inside\\`\\'\\\"\\\\`\\$notAVar\"]outside\\$\\(notASubShell\\)");
+
+  MT("subshell",
+     "[builtin echo] [quote $(whoami)] s log, stardate [quote `date`].");
+  MT("doubleQuotedSubshell",
+     "[builtin echo] [string \"][quote $(whoami)][string 's log, stardate `date`.\"]");
+
+  MT("hashbang",
+     "[meta #!/bin/bash]");
+  MT("comment",
+     "text [comment # Blurb]");
+
+  MT("numbers",
+     "[number 0] [number 1] [number 2]");
+  MT("keywords",
+     "[keyword while] [atom true]; [keyword do]",
+     "  [builtin sleep] [number 3]",
+     "[keyword done]");
+  MT("options",
+     "[builtin ls] [attribute -l] [attribute --human-readable]");
+  MT("operator",
+     "[def var][operator =]value");
+
+  MT("doubleParens",
+     "foo [quote $((bar))]")
+
+  MT("nested braces",
+     "[builtin echo] [def ${A[${B}]]}]")
+
+  MT("strings in parens",
+     "[def FOO][operator =]([quote $(<][string \"][def $MYDIR][string \"][quote /myfile grep ][string 'hello$'][quote )])")
+
+  MT("string ending in dollar",
+    '[def a][operator =][string "xyz$"]; [def b][operator =][string "y"]')
+
+  MT("quote ending in dollar",
+    "[quote $(echo a$)]")
+
+  MT("heredoc",
+     "[builtin cat] [string-2 <<- end]",
+     "[string-2 content one]",
+     "[string-2 content two end]",
+     "[string-2 end]",
+     "[builtin echo]")
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sieve/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,93 @@
+<!doctype html>
+
+<title>CodeMirror: Sieve (RFC5228) mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="sieve.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Sieve (RFC5228)</a>
+  </ul>
+</div>
+
+<article>
+<h2>Sieve (RFC5228) mode</h2>
+<form><textarea id="code" name="code">
+#
+# Example Sieve Filter
+# Declare any optional features or extension used by the script
+#
+
+require ["fileinto", "reject"];
+
+#
+# Reject any large messages (note that the four leading dots get
+# "stuffed" to three)
+#
+if size :over 1M
+{
+  reject text:
+Please do not send me large attachments.
+Put your file on a server and send me the URL.
+Thank you.
+.... Fred
+.
+;
+  stop;
+}
+
+#
+# Handle messages from known mailing lists
+# Move messages from IETF filter discussion list to filter folder
+#
+if header :is "Sender" "owner-ietf-mta-filters@imc.org"
+{
+  fileinto "filter";  # move to "filter" folder
+}
+#
+# Keep all messages to or from people in my company
+#
+elsif address :domain :is ["From", "To"] "example.com"
+{
+  keep;               # keep in "In" folder
+}
+
+#
+# Try and catch unsolicited email.  If a message is not to me,
+# or it contains a subject known to be spam, file it away.
+#
+elsif anyof (not address :all :contains
+               ["To", "Cc", "Bcc"] "me@example.com",
+             header :matches "subject"
+               ["*make*money*fast*", "*university*dipl*mas*"])
+{
+  # If message header does not contain my address,
+  # it's from a list.
+  fileinto "spam";   # move to "spam" folder
+}
+else
+{
+  # Move all other (non-company) mail to "personal"
+  # folder.
+  fileinto "personal";
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>application/sieve</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sieve/sieve.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,193 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("sieve", function(config) {
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  var keywords = words("if elsif else stop require");
+  var atoms = words("true false not");
+  var indentUnit = config.indentUnit;
+
+  function tokenBase(stream, state) {
+
+    var ch = stream.next();
+    if (ch == "/" && stream.eat("*")) {
+      state.tokenize = tokenCComment;
+      return tokenCComment(stream, state);
+    }
+
+    if (ch === '#') {
+      stream.skipToEnd();
+      return "comment";
+    }
+
+    if (ch == "\"") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+
+    if (ch == "(") {
+      state._indent.push("(");
+      // add virtual angel wings so that editor behaves...
+      // ...more sane in case of broken brackets
+      state._indent.push("{");
+      return null;
+    }
+
+    if (ch === "{") {
+      state._indent.push("{");
+      return null;
+    }
+
+    if (ch == ")")  {
+      state._indent.pop();
+      state._indent.pop();
+    }
+
+    if (ch === "}") {
+      state._indent.pop();
+      return null;
+    }
+
+    if (ch == ",")
+      return null;
+
+    if (ch == ";")
+      return null;
+
+
+    if (/[{}\(\),;]/.test(ch))
+      return null;
+
+    // 1*DIGIT "K" / "M" / "G"
+    if (/\d/.test(ch)) {
+      stream.eatWhile(/[\d]/);
+      stream.eat(/[KkMmGg]/);
+      return "number";
+    }
+
+    // ":" (ALPHA / "_") *(ALPHA / DIGIT / "_")
+    if (ch == ":") {
+      stream.eatWhile(/[a-zA-Z_]/);
+      stream.eatWhile(/[a-zA-Z0-9_]/);
+
+      return "operator";
+    }
+
+    stream.eatWhile(/\w/);
+    var cur = stream.current();
+
+    // "text:" *(SP / HTAB) (hash-comment / CRLF)
+    // *(multiline-literal / multiline-dotstart)
+    // "." CRLF
+    if ((cur == "text") && stream.eat(":"))
+    {
+      state.tokenize = tokenMultiLineString;
+      return "string";
+    }
+
+    if (keywords.propertyIsEnumerable(cur))
+      return "keyword";
+
+    if (atoms.propertyIsEnumerable(cur))
+      return "atom";
+
+    return null;
+  }
+
+  function tokenMultiLineString(stream, state)
+  {
+    state._multiLineString = true;
+    // the first line is special it may contain a comment
+    if (!stream.sol()) {
+      stream.eatSpace();
+
+      if (stream.peek() == "#") {
+        stream.skipToEnd();
+        return "comment";
+      }
+
+      stream.skipToEnd();
+      return "string";
+    }
+
+    if ((stream.next() == ".")  && (stream.eol()))
+    {
+      state._multiLineString = false;
+      state.tokenize = tokenBase;
+    }
+
+    return "string";
+  }
+
+  function tokenCComment(stream, state) {
+    var maybeEnd = false, ch;
+    while ((ch = stream.next()) != null) {
+      if (maybeEnd && ch == "/") {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped)
+          break;
+        escaped = !escaped && ch == "\\";
+      }
+      if (!escaped) state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+
+  return {
+    startState: function(base) {
+      return {tokenize: tokenBase,
+              baseIndent: base || 0,
+              _indent: []};
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace())
+        return null;
+
+      return (state.tokenize || tokenBase)(stream, state);
+    },
+
+    indent: function(state, _textAfter) {
+      var length = state._indent.length;
+      if (_textAfter && (_textAfter[0] == "}"))
+        length--;
+
+      if (length <0)
+        length = 0;
+
+      return length * indentUnit;
+    },
+
+    electricChars: "}"
+  };
+});
+
+CodeMirror.defineMIME("application/sieve", "sieve");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/slim/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,96 @@
+<!doctype html>
+
+<title>CodeMirror: SLIM mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/ambiance.css">
+<script src="https://code.jquery.com/jquery-1.11.1.min.js"></script>
+<script src="https://code.jquery.com/ui/1.11.0/jquery-ui.min.js"></script>
+<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../htmlembedded/htmlembedded.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../coffeescript/coffeescript.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../ruby/ruby.js"></script>
+<script src="../markdown/markdown.js"></script>
+<script src="slim.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">SLIM</a>
+  </ul>
+</div>
+
+<article>
+  <h2>SLIM mode</h2>
+  <form><textarea id="code" name="code">
+body
+  table
+    - for user in users
+      td id="user_#{user.id}" class=user.role
+        a href=user_action(user, :edit) Edit #{user.name}
+        a href=(path_to_user user) = user.name
+body
+  h1(id="logo") = page_logo
+  h2[id="tagline" class="small tagline"] = page_tagline
+
+h2[id="tagline"
+   class="small tagline"] = page_tagline
+
+h1 id = "logo" = page_logo
+h2 [ id = "tagline" ] = page_tagline
+
+/ comment
+  second line
+/! html comment
+   second line
+<!-- html comment -->
+<a href="#{'hello' if set}">link</a>
+a.slim href="work" disabled=false running==:atom Text <b>bold</b>
+.clazz data-id="test" == 'hello' unless quark
+ | Text mode #{12}
+   Second line
+= x ||= :ruby_atom
+#menu.left
+  - @env.each do |x|
+    li: a = x
+*@dyntag attr="val"
+.first *{:class => [:second, :third]} Text
+.second class=["text","more"]
+.third class=:text,:symbol
+
+  </textarea></form>
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      lineNumbers: true,
+      theme: "ambiance",
+      mode: "application/x-slim"
+    });
+    $('.CodeMirror').resizable({
+      resize: function() {
+        editor.setSize($(this).width(), $(this).height());
+        //editor.refresh();
+      }
+    });
+  </script>
+
+  <p><strong>MIME types defined:</strong> <code>application/x-slim</code>.</p>
+
+  <p>
+    <strong>Parsing/Highlighting Tests:</strong>
+    <a href="../../test/index.html#slim_*">normal</a>,
+    <a href="../../test/index.html#verbose,slim_*">verbose</a>.
+  </p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/slim/slim.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,575 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), require("../ruby/ruby"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed", "../ruby/ruby"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+  CodeMirror.defineMode("slim", function(config) {
+    var htmlMode = CodeMirror.getMode(config, {name: "htmlmixed"});
+    var rubyMode = CodeMirror.getMode(config, "ruby");
+    var modes = { html: htmlMode, ruby: rubyMode };
+    var embedded = {
+      ruby: "ruby",
+      javascript: "javascript",
+      css: "text/css",
+      sass: "text/x-sass",
+      scss: "text/x-scss",
+      less: "text/x-less",
+      styl: "text/x-styl", // no highlighting so far
+      coffee: "coffeescript",
+      asciidoc: "text/x-asciidoc",
+      markdown: "text/x-markdown",
+      textile: "text/x-textile", // no highlighting so far
+      creole: "text/x-creole", // no highlighting so far
+      wiki: "text/x-wiki", // no highlighting so far
+      mediawiki: "text/x-mediawiki", // no highlighting so far
+      rdoc: "text/x-rdoc", // no highlighting so far
+      builder: "text/x-builder", // no highlighting so far
+      nokogiri: "text/x-nokogiri", // no highlighting so far
+      erb: "application/x-erb"
+    };
+    var embeddedRegexp = function(map){
+      var arr = [];
+      for(var key in map) arr.push(key);
+      return new RegExp("^("+arr.join('|')+"):");
+    }(embedded);
+
+    var styleMap = {
+      "commentLine": "comment",
+      "slimSwitch": "operator special",
+      "slimTag": "tag",
+      "slimId": "attribute def",
+      "slimClass": "attribute qualifier",
+      "slimAttribute": "attribute",
+      "slimSubmode": "keyword special",
+      "closeAttributeTag": null,
+      "slimDoctype": null,
+      "lineContinuation": null
+    };
+    var closing = {
+      "{": "}",
+      "[": "]",
+      "(": ")"
+    };
+
+    var nameStartChar = "_a-zA-Z\xC0-\xD6\xD8-\xF6\xF8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD";
+    var nameChar = nameStartChar + "\\-0-9\xB7\u0300-\u036F\u203F-\u2040";
+    var nameRegexp = new RegExp("^[:"+nameStartChar+"](?::["+nameChar+"]|["+nameChar+"]*)");
+    var attributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*(?=\\s*=)");
+    var wrappedAttributeNameRegexp = new RegExp("^[:"+nameStartChar+"][:\\."+nameChar+"]*");
+    var classNameRegexp = /^\.-?[_a-zA-Z]+[\w\-]*/;
+    var classIdRegexp = /^#[_a-zA-Z]+[\w\-]*/;
+
+    function backup(pos, tokenize, style) {
+      var restore = function(stream, state) {
+        state.tokenize = tokenize;
+        if (stream.pos < pos) {
+          stream.pos = pos;
+          return style;
+        }
+        return state.tokenize(stream, state);
+      };
+      return function(stream, state) {
+        state.tokenize = restore;
+        return tokenize(stream, state);
+      };
+    }
+
+    function maybeBackup(stream, state, pat, offset, style) {
+      var cur = stream.current();
+      var idx = cur.search(pat);
+      if (idx > -1) {
+        state.tokenize = backup(stream.pos, state.tokenize, style);
+        stream.backUp(cur.length - idx - offset);
+      }
+      return style;
+    }
+
+    function continueLine(state, column) {
+      state.stack = {
+        parent: state.stack,
+        style: "continuation",
+        indented: column,
+        tokenize: state.line
+      };
+      state.line = state.tokenize;
+    }
+    function finishContinue(state) {
+      if (state.line == state.tokenize) {
+        state.line = state.stack.tokenize;
+        state.stack = state.stack.parent;
+      }
+    }
+
+    function lineContinuable(column, tokenize) {
+      return function(stream, state) {
+        finishContinue(state);
+        if (stream.match(/^\\$/)) {
+          continueLine(state, column);
+          return "lineContinuation";
+        }
+        var style = tokenize(stream, state);
+        if (stream.eol() && stream.current().match(/(?:^|[^\\])(?:\\\\)*\\$/)) {
+          stream.backUp(1);
+        }
+        return style;
+      };
+    }
+    function commaContinuable(column, tokenize) {
+      return function(stream, state) {
+        finishContinue(state);
+        var style = tokenize(stream, state);
+        if (stream.eol() && stream.current().match(/,$/)) {
+          continueLine(state, column);
+        }
+        return style;
+      };
+    }
+
+    function rubyInQuote(endQuote, tokenize) {
+      // TODO: add multi line support
+      return function(stream, state) {
+        var ch = stream.peek();
+        if (ch == endQuote && state.rubyState.tokenize.length == 1) {
+          // step out of ruby context as it seems to complete processing all the braces
+          stream.next();
+          state.tokenize = tokenize;
+          return "closeAttributeTag";
+        } else {
+          return ruby(stream, state);
+        }
+      };
+    }
+    function startRubySplat(tokenize) {
+      var rubyState;
+      var runSplat = function(stream, state) {
+        if (state.rubyState.tokenize.length == 1 && !state.rubyState.context.prev) {
+          stream.backUp(1);
+          if (stream.eatSpace()) {
+            state.rubyState = rubyState;
+            state.tokenize = tokenize;
+            return tokenize(stream, state);
+          }
+          stream.next();
+        }
+        return ruby(stream, state);
+      };
+      return function(stream, state) {
+        rubyState = state.rubyState;
+        state.rubyState = CodeMirror.startState(rubyMode);
+        state.tokenize = runSplat;
+        return ruby(stream, state);
+      };
+    }
+
+    function ruby(stream, state) {
+      return rubyMode.token(stream, state.rubyState);
+    }
+
+    function htmlLine(stream, state) {
+      if (stream.match(/^\\$/)) {
+        return "lineContinuation";
+      }
+      return html(stream, state);
+    }
+    function html(stream, state) {
+      if (stream.match(/^#\{/)) {
+        state.tokenize = rubyInQuote("}", state.tokenize);
+        return null;
+      }
+      return maybeBackup(stream, state, /[^\\]#\{/, 1, htmlMode.token(stream, state.htmlState));
+    }
+
+    function startHtmlLine(lastTokenize) {
+      return function(stream, state) {
+        var style = htmlLine(stream, state);
+        if (stream.eol()) state.tokenize = lastTokenize;
+        return style;
+      };
+    }
+
+    function startHtmlMode(stream, state, offset) {
+      state.stack = {
+        parent: state.stack,
+        style: "html",
+        indented: stream.column() + offset, // pipe + space
+        tokenize: state.line
+      };
+      state.line = state.tokenize = html;
+      return null;
+    }
+
+    function comment(stream, state) {
+      stream.skipToEnd();
+      return state.stack.style;
+    }
+
+    function commentMode(stream, state) {
+      state.stack = {
+        parent: state.stack,
+        style: "comment",
+        indented: state.indented + 1,
+        tokenize: state.line
+      };
+      state.line = comment;
+      return comment(stream, state);
+    }
+
+    function attributeWrapper(stream, state) {
+      if (stream.eat(state.stack.endQuote)) {
+        state.line = state.stack.line;
+        state.tokenize = state.stack.tokenize;
+        state.stack = state.stack.parent;
+        return null;
+      }
+      if (stream.match(wrappedAttributeNameRegexp)) {
+        state.tokenize = attributeWrapperAssign;
+        return "slimAttribute";
+      }
+      stream.next();
+      return null;
+    }
+    function attributeWrapperAssign(stream, state) {
+      if (stream.match(/^==?/)) {
+        state.tokenize = attributeWrapperValue;
+        return null;
+      }
+      return attributeWrapper(stream, state);
+    }
+    function attributeWrapperValue(stream, state) {
+      var ch = stream.peek();
+      if (ch == '"' || ch == "\'") {
+        state.tokenize = readQuoted(ch, "string", true, false, attributeWrapper);
+        stream.next();
+        return state.tokenize(stream, state);
+      }
+      if (ch == '[') {
+        return startRubySplat(attributeWrapper)(stream, state);
+      }
+      if (stream.match(/^(true|false|nil)\b/)) {
+        state.tokenize = attributeWrapper;
+        return "keyword";
+      }
+      return startRubySplat(attributeWrapper)(stream, state);
+    }
+
+    function startAttributeWrapperMode(state, endQuote, tokenize) {
+      state.stack = {
+        parent: state.stack,
+        style: "wrapper",
+        indented: state.indented + 1,
+        tokenize: tokenize,
+        line: state.line,
+        endQuote: endQuote
+      };
+      state.line = state.tokenize = attributeWrapper;
+      return null;
+    }
+
+    function sub(stream, state) {
+      if (stream.match(/^#\{/)) {
+        state.tokenize = rubyInQuote("}", state.tokenize);
+        return null;
+      }
+      var subStream = new CodeMirror.StringStream(stream.string.slice(state.stack.indented), stream.tabSize);
+      subStream.pos = stream.pos - state.stack.indented;
+      subStream.start = stream.start - state.stack.indented;
+      subStream.lastColumnPos = stream.lastColumnPos - state.stack.indented;
+      subStream.lastColumnValue = stream.lastColumnValue - state.stack.indented;
+      var style = state.subMode.token(subStream, state.subState);
+      stream.pos = subStream.pos + state.stack.indented;
+      return style;
+    }
+    function firstSub(stream, state) {
+      state.stack.indented = stream.column();
+      state.line = state.tokenize = sub;
+      return state.tokenize(stream, state);
+    }
+
+    function createMode(mode) {
+      var query = embedded[mode];
+      var spec = CodeMirror.mimeModes[query];
+      if (spec) {
+        return CodeMirror.getMode(config, spec);
+      }
+      var factory = CodeMirror.modes[query];
+      if (factory) {
+        return factory(config, {name: query});
+      }
+      return CodeMirror.getMode(config, "null");
+    }
+
+    function getMode(mode) {
+      if (!modes.hasOwnProperty(mode)) {
+        return modes[mode] = createMode(mode);
+      }
+      return modes[mode];
+    }
+
+    function startSubMode(mode, state) {
+      var subMode = getMode(mode);
+      var subState = CodeMirror.startState(subMode);
+
+      state.subMode = subMode;
+      state.subState = subState;
+
+      state.stack = {
+        parent: state.stack,
+        style: "sub",
+        indented: state.indented + 1,
+        tokenize: state.line
+      };
+      state.line = state.tokenize = firstSub;
+      return "slimSubmode";
+    }
+
+    function doctypeLine(stream, _state) {
+      stream.skipToEnd();
+      return "slimDoctype";
+    }
+
+    function startLine(stream, state) {
+      var ch = stream.peek();
+      if (ch == '<') {
+        return (state.tokenize = startHtmlLine(state.tokenize))(stream, state);
+      }
+      if (stream.match(/^[|']/)) {
+        return startHtmlMode(stream, state, 1);
+      }
+      if (stream.match(/^\/(!|\[\w+])?/)) {
+        return commentMode(stream, state);
+      }
+      if (stream.match(/^(-|==?[<>]?)/)) {
+        state.tokenize = lineContinuable(stream.column(), commaContinuable(stream.column(), ruby));
+        return "slimSwitch";
+      }
+      if (stream.match(/^doctype\b/)) {
+        state.tokenize = doctypeLine;
+        return "keyword";
+      }
+
+      var m = stream.match(embeddedRegexp);
+      if (m) {
+        return startSubMode(m[1], state);
+      }
+
+      return slimTag(stream, state);
+    }
+
+    function slim(stream, state) {
+      if (state.startOfLine) {
+        return startLine(stream, state);
+      }
+      return slimTag(stream, state);
+    }
+
+    function slimTag(stream, state) {
+      if (stream.eat('*')) {
+        state.tokenize = startRubySplat(slimTagExtras);
+        return null;
+      }
+      if (stream.match(nameRegexp)) {
+        state.tokenize = slimTagExtras;
+        return "slimTag";
+      }
+      return slimClass(stream, state);
+    }
+    function slimTagExtras(stream, state) {
+      if (stream.match(/^(<>?|><?)/)) {
+        state.tokenize = slimClass;
+        return null;
+      }
+      return slimClass(stream, state);
+    }
+    function slimClass(stream, state) {
+      if (stream.match(classIdRegexp)) {
+        state.tokenize = slimClass;
+        return "slimId";
+      }
+      if (stream.match(classNameRegexp)) {
+        state.tokenize = slimClass;
+        return "slimClass";
+      }
+      return slimAttribute(stream, state);
+    }
+    function slimAttribute(stream, state) {
+      if (stream.match(/^([\[\{\(])/)) {
+        return startAttributeWrapperMode(state, closing[RegExp.$1], slimAttribute);
+      }
+      if (stream.match(attributeNameRegexp)) {
+        state.tokenize = slimAttributeAssign;
+        return "slimAttribute";
+      }
+      if (stream.peek() == '*') {
+        stream.next();
+        state.tokenize = startRubySplat(slimContent);
+        return null;
+      }
+      return slimContent(stream, state);
+    }
+    function slimAttributeAssign(stream, state) {
+      if (stream.match(/^==?/)) {
+        state.tokenize = slimAttributeValue;
+        return null;
+      }
+      // should never happen, because of forward lookup
+      return slimAttribute(stream, state);
+    }
+
+    function slimAttributeValue(stream, state) {
+      var ch = stream.peek();
+      if (ch == '"' || ch == "\'") {
+        state.tokenize = readQuoted(ch, "string", true, false, slimAttribute);
+        stream.next();
+        return state.tokenize(stream, state);
+      }
+      if (ch == '[') {
+        return startRubySplat(slimAttribute)(stream, state);
+      }
+      if (ch == ':') {
+        return startRubySplat(slimAttributeSymbols)(stream, state);
+      }
+      if (stream.match(/^(true|false|nil)\b/)) {
+        state.tokenize = slimAttribute;
+        return "keyword";
+      }
+      return startRubySplat(slimAttribute)(stream, state);
+    }
+    function slimAttributeSymbols(stream, state) {
+      stream.backUp(1);
+      if (stream.match(/^[^\s],(?=:)/)) {
+        state.tokenize = startRubySplat(slimAttributeSymbols);
+        return null;
+      }
+      stream.next();
+      return slimAttribute(stream, state);
+    }
+    function readQuoted(quote, style, embed, unescaped, nextTokenize) {
+      return function(stream, state) {
+        finishContinue(state);
+        var fresh = stream.current().length == 0;
+        if (stream.match(/^\\$/, fresh)) {
+          if (!fresh) return style;
+          continueLine(state, state.indented);
+          return "lineContinuation";
+        }
+        if (stream.match(/^#\{/, fresh)) {
+          if (!fresh) return style;
+          state.tokenize = rubyInQuote("}", state.tokenize);
+          return null;
+        }
+        var escaped = false, ch;
+        while ((ch = stream.next()) != null) {
+          if (ch == quote && (unescaped || !escaped)) {
+            state.tokenize = nextTokenize;
+            break;
+          }
+          if (embed && ch == "#" && !escaped) {
+            if (stream.eat("{")) {
+              stream.backUp(2);
+              break;
+            }
+          }
+          escaped = !escaped && ch == "\\";
+        }
+        if (stream.eol() && escaped) {
+          stream.backUp(1);
+        }
+        return style;
+      };
+    }
+    function slimContent(stream, state) {
+      if (stream.match(/^==?/)) {
+        state.tokenize = ruby;
+        return "slimSwitch";
+      }
+      if (stream.match(/^\/$/)) { // tag close hint
+        state.tokenize = slim;
+        return null;
+      }
+      if (stream.match(/^:/)) { // inline tag
+        state.tokenize = slimTag;
+        return "slimSwitch";
+      }
+      startHtmlMode(stream, state, 0);
+      return state.tokenize(stream, state);
+    }
+
+    var mode = {
+      // default to html mode
+      startState: function() {
+        var htmlState = CodeMirror.startState(htmlMode);
+        var rubyState = CodeMirror.startState(rubyMode);
+        return {
+          htmlState: htmlState,
+          rubyState: rubyState,
+          stack: null,
+          last: null,
+          tokenize: slim,
+          line: slim,
+          indented: 0
+        };
+      },
+
+      copyState: function(state) {
+        return {
+          htmlState : CodeMirror.copyState(htmlMode, state.htmlState),
+          rubyState: CodeMirror.copyState(rubyMode, state.rubyState),
+          subMode: state.subMode,
+          subState: state.subMode && CodeMirror.copyState(state.subMode, state.subState),
+          stack: state.stack,
+          last: state.last,
+          tokenize: state.tokenize,
+          line: state.line
+        };
+      },
+
+      token: function(stream, state) {
+        if (stream.sol()) {
+          state.indented = stream.indentation();
+          state.startOfLine = true;
+          state.tokenize = state.line;
+          while (state.stack && state.stack.indented > state.indented && state.last != "slimSubmode") {
+            state.line = state.tokenize = state.stack.tokenize;
+            state.stack = state.stack.parent;
+            state.subMode = null;
+            state.subState = null;
+          }
+        }
+        if (stream.eatSpace()) return null;
+        var style = state.tokenize(stream, state);
+        state.startOfLine = false;
+        if (style) state.last = style;
+        return styleMap.hasOwnProperty(style) ? styleMap[style] : style;
+      },
+
+      blankLine: function(state) {
+        if (state.subMode && state.subMode.blankLine) {
+          return state.subMode.blankLine(state.subState);
+        }
+      },
+
+      innerMode: function(state) {
+        if (state.subMode) return {state: state.subState, mode: state.subMode};
+        return {state: state, mode: mode};
+      }
+
+      //indent: function(state) {
+      //  return state.indented;
+      //}
+    };
+    return mode;
+  }, "htmlmixed", "ruby");
+
+  CodeMirror.defineMIME("text/x-slim", "slim");
+  CodeMirror.defineMIME("application/x-slim", "slim");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/slim/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,96 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Slim Highlighting for CodeMirror copyright (c) HicknHack Software Gmbh
+
+(function() {
+  var mode = CodeMirror.getMode({tabSize: 4, indentUnit: 2}, "slim");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  // Requires at least one media query
+  MT("elementName",
+     "[tag h1] Hey There");
+
+  MT("oneElementPerLine",
+     "[tag h1] Hey There .h2");
+
+  MT("idShortcut",
+     "[attribute&def #test] Hey There");
+
+  MT("tagWithIdShortcuts",
+     "[tag h1][attribute&def #test] Hey There");
+
+  MT("classShortcut",
+     "[attribute&qualifier .hello] Hey There");
+
+  MT("tagWithIdAndClassShortcuts",
+     "[tag h1][attribute&def #test][attribute&qualifier .hello] Hey There");
+
+  MT("docType",
+     "[keyword doctype] xml");
+
+  MT("comment",
+     "[comment / Hello WORLD]");
+
+  MT("notComment",
+     "[tag h1] This is not a / comment ");
+
+  MT("attributes",
+     "[tag a]([attribute title]=[string \"test\"]) [attribute href]=[string \"link\"]}");
+
+  MT("multiLineAttributes",
+     "[tag a]([attribute title]=[string \"test\"]",
+     "  ) [attribute href]=[string \"link\"]}");
+
+  MT("htmlCode",
+     "[tag&bracket <][tag h1][tag&bracket >]Title[tag&bracket </][tag h1][tag&bracket >]");
+
+  MT("rubyBlock",
+     "[operator&special =][variable-2 @item]");
+
+  MT("selectorRubyBlock",
+     "[tag a][attribute&qualifier .test][operator&special =] [variable-2 @item]");
+
+  MT("nestedRubyBlock",
+      "[tag a]",
+      "  [operator&special =][variable puts] [string \"test\"]");
+
+  MT("multilinePlaintext",
+      "[tag p]",
+      "  | Hello,",
+      "    World");
+
+  MT("multilineRuby",
+      "[tag p]",
+      "  [comment /# this is a comment]",
+      "     [comment and this is a comment too]",
+      "  | Date/Time",
+      "  [operator&special -] [variable now] [operator =] [tag DateTime][operator .][property now]",
+      "  [tag strong][operator&special =] [variable now]",
+      "  [operator&special -] [keyword if] [variable now] [operator >] [tag DateTime][operator .][property parse]([string \"December 31, 2006\"])",
+      "     [operator&special =][string \"Happy\"]",
+      "     [operator&special =][string \"Belated\"]",
+      "     [operator&special =][string \"Birthday\"]");
+
+  MT("multilineComment",
+      "[comment /]",
+      "  [comment Multiline]",
+      "  [comment Comment]");
+
+  MT("hamlAfterRubyTag",
+    "[attribute&qualifier .block]",
+    "  [tag strong][operator&special =] [variable now]",
+    "  [attribute&qualifier .test]",
+    "     [operator&special =][variable now]",
+    "  [attribute&qualifier .right]");
+
+  MT("stretchedRuby",
+     "[operator&special =] [variable puts] [string \"Hello\"],",
+     "   [string \"World\"]");
+
+  MT("interpolationInHashAttribute",
+     "[tag div]{[attribute id] = [string \"]#{[variable test]}[string _]#{[variable ting]}[string \"]} test");
+
+  MT("interpolationInHTMLAttribute",
+     "[tag div]([attribute title]=[string \"]#{[variable test]}[string _]#{[variable ting]()}[string \"]) Test");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/smalltalk/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,68 @@
+<!doctype html>
+
+<title>CodeMirror: Smalltalk mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="smalltalk.js"></script>
+<style>
+      .CodeMirror {border: 2px solid #dee; border-right-width: 10px;}
+      .CodeMirror-gutter {border: none; background: #dee;}
+      .CodeMirror-gutter pre {color: white; font-weight: bold;}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Smalltalk</a>
+  </ul>
+</div>
+
+<article>
+<h2>Smalltalk mode</h2>
+<form><textarea id="code" name="code">
+" 
+    This is a test of the Smalltalk code
+"
+Seaside.WAComponent subclass: #MyCounter [
+    | count |
+    MyCounter class &gt;&gt; canBeRoot [ ^true ]
+
+    initialize [
+        super initialize.
+        count := 0.
+    ]
+    states [ ^{ self } ]
+    renderContentOn: html [
+        html heading: count.
+        html anchor callback: [ count := count + 1 ]; with: '++'.
+        html space.
+        html anchor callback: [ count := count - 1 ]; with: '--'.
+    ]
+]
+
+MyCounter registerAsApplication: 'mycounter'
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-stsrc",
+        indentUnit: 4
+      });
+    </script>
+
+    <p>Simple Smalltalk mode.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-stsrc</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/smalltalk/smalltalk.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,168 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode('smalltalk', function(config) {
+
+  var specialChars = /[+\-\/\\*~<>=@%|&?!.,:;^]/;
+  var keywords = /true|false|nil|self|super|thisContext/;
+
+  var Context = function(tokenizer, parent) {
+    this.next = tokenizer;
+    this.parent = parent;
+  };
+
+  var Token = function(name, context, eos) {
+    this.name = name;
+    this.context = context;
+    this.eos = eos;
+  };
+
+  var State = function() {
+    this.context = new Context(next, null);
+    this.expectVariable = true;
+    this.indentation = 0;
+    this.userIndentationDelta = 0;
+  };
+
+  State.prototype.userIndent = function(indentation) {
+    this.userIndentationDelta = indentation > 0 ? (indentation / config.indentUnit - this.indentation) : 0;
+  };
+
+  var next = function(stream, context, state) {
+    var token = new Token(null, context, false);
+    var aChar = stream.next();
+
+    if (aChar === '"') {
+      token = nextComment(stream, new Context(nextComment, context));
+
+    } else if (aChar === '\'') {
+      token = nextString(stream, new Context(nextString, context));
+
+    } else if (aChar === '#') {
+      if (stream.peek() === '\'') {
+        stream.next();
+        token = nextSymbol(stream, new Context(nextSymbol, context));
+      } else {
+        if (stream.eatWhile(/[^\s.{}\[\]()]/))
+          token.name = 'string-2';
+        else
+          token.name = 'meta';
+      }
+
+    } else if (aChar === '$') {
+      if (stream.next() === '<') {
+        stream.eatWhile(/[^\s>]/);
+        stream.next();
+      }
+      token.name = 'string-2';
+
+    } else if (aChar === '|' && state.expectVariable) {
+      token.context = new Context(nextTemporaries, context);
+
+    } else if (/[\[\]{}()]/.test(aChar)) {
+      token.name = 'bracket';
+      token.eos = /[\[{(]/.test(aChar);
+
+      if (aChar === '[') {
+        state.indentation++;
+      } else if (aChar === ']') {
+        state.indentation = Math.max(0, state.indentation - 1);
+      }
+
+    } else if (specialChars.test(aChar)) {
+      stream.eatWhile(specialChars);
+      token.name = 'operator';
+      token.eos = aChar !== ';'; // ; cascaded message expression
+
+    } else if (/\d/.test(aChar)) {
+      stream.eatWhile(/[\w\d]/);
+      token.name = 'number';
+
+    } else if (/[\w_]/.test(aChar)) {
+      stream.eatWhile(/[\w\d_]/);
+      token.name = state.expectVariable ? (keywords.test(stream.current()) ? 'keyword' : 'variable') : null;
+
+    } else {
+      token.eos = state.expectVariable;
+    }
+
+    return token;
+  };
+
+  var nextComment = function(stream, context) {
+    stream.eatWhile(/[^"]/);
+    return new Token('comment', stream.eat('"') ? context.parent : context, true);
+  };
+
+  var nextString = function(stream, context) {
+    stream.eatWhile(/[^']/);
+    return new Token('string', stream.eat('\'') ? context.parent : context, false);
+  };
+
+  var nextSymbol = function(stream, context) {
+    stream.eatWhile(/[^']/);
+    return new Token('string-2', stream.eat('\'') ? context.parent : context, false);
+  };
+
+  var nextTemporaries = function(stream, context) {
+    var token = new Token(null, context, false);
+    var aChar = stream.next();
+
+    if (aChar === '|') {
+      token.context = context.parent;
+      token.eos = true;
+
+    } else {
+      stream.eatWhile(/[^|]/);
+      token.name = 'variable';
+    }
+
+    return token;
+  };
+
+  return {
+    startState: function() {
+      return new State;
+    },
+
+    token: function(stream, state) {
+      state.userIndent(stream.indentation());
+
+      if (stream.eatSpace()) {
+        return null;
+      }
+
+      var token = state.context.next(stream, state.context, state);
+      state.context = token.context;
+      state.expectVariable = token.eos;
+
+      return token.name;
+    },
+
+    blankLine: function(state) {
+      state.userIndent(0);
+    },
+
+    indent: function(state, textAfter) {
+      var i = state.context.next === next && textAfter && textAfter.charAt(0) === ']' ? -1 : state.userIndentationDelta;
+      return (state.indentation + i) * config.indentUnit;
+    },
+
+    electricChars: ']'
+  };
+
+});
+
+CodeMirror.defineMIME('text/x-stsrc', {name: 'smalltalk'});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/smarty/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,138 @@
+<!doctype html>
+
+<title>CodeMirror: Smarty mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="smarty.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Smarty</a>
+  </ul>
+</div>
+
+<article>
+<h2>Smarty mode</h2>
+<form><textarea id="code" name="code">
+{extends file="parent.tpl"}
+{include file="template.tpl"}
+
+{* some example Smarty content *}
+{if isset($name) && $name == 'Blog'}
+  This is a {$var}.
+  {$integer = 451}, {$array[] = "a"}, {$stringvar = "string"}
+  {assign var='bob' value=$var.prop}
+{elseif $name == $foo}
+  {function name=menu level=0}
+    {foreach $data as $entry}
+      {if is_array($entry)}
+        - {$entry@key}
+        {menu data=$entry level=$level+1}
+      {else}
+        {$entry}
+      {/if}
+    {/foreach}
+  {/function}
+{/if}</textarea></form>
+
+<p>Mode for Smarty version 2 or 3, which allows for custom delimiter tags.</p>
+
+<p>Several configuration parameters are supported:</p>
+
+<ul>
+  <li><code>leftDelimiter</code> and <code>rightDelimiter</code>,
+  which should be strings that determine where the Smarty syntax
+  starts and ends.</li>
+  <li><code>version</code>, which should be 2 or 3.</li>
+  <li><code>baseMode</code>, which can be a mode spec
+  like <code>"text/html"</code> to set a different background mode.</li>
+</ul>
+
+<p><strong>MIME types defined:</strong> <code>text/x-smarty</code></p>
+
+<h3>Smarty 2, custom delimiters</h3>
+
+<form><textarea id="code2" name="code2">
+{--extends file="parent.tpl"--}
+{--include file="template.tpl"--}
+
+{--* some example Smarty content *--}
+{--if isset($name) && $name == 'Blog'--}
+  This is a {--$var--}.
+  {--$integer = 451--}, {--$array[] = "a"--}, {--$stringvar = "string"--}
+  {--assign var='bob' value=$var.prop--}
+{--elseif $name == $foo--}
+  {--function name=menu level=0--}
+    {--foreach $data as $entry--}
+      {--if is_array($entry)--}
+        - {--$entry@key--}
+        {--menu data=$entry level=$level+1--}
+      {--else--}
+        {--$entry--}
+      {--/if--}
+    {--/foreach--}
+  {--/function--}
+{--/if--}</textarea></form>
+
+<h3>Smarty 3</h3>
+
+<textarea id="code3" name="code3">
+Nested tags {$foo={counter one=1 two={inception}}+3} are now valid in Smarty 3.
+
+<script>
+function test() {
+  console.log("Smarty 3 permits single curly braces followed by whitespace to NOT slip into Smarty mode.");
+}
+</script>
+
+{assign var=foo value=[1,2,3]}
+{assign var=foo value=['y'=>'yellow','b'=>'blue']}
+{assign var=foo value=[1,[9,8],3]}
+
+{$foo=$bar+2} {* a comment *}
+{$foo.bar=1}  {* another comment *}
+{$foo = myfunct(($x+$y)*3)}
+{$foo = strlen($bar)}
+{$foo.bar.baz=1}, {$foo[]=1}
+
+Smarty "dot" syntax (note: embedded {} are used to address ambiguities):
+
+{$foo.a.b.c}      => $foo['a']['b']['c']
+{$foo.a.$b.c}     => $foo['a'][$b]['c']
+{$foo.a.{$b+4}.c} => $foo['a'][$b+4]['c']
+{$foo.a.{$b.c}}   => $foo['a'][$b['c']]
+
+{$object->method1($x)->method2($y)}</textarea>
+
+<script>
+var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+  lineNumbers: true,
+  mode: "smarty"
+});
+var editor = CodeMirror.fromTextArea(document.getElementById("code2"), {
+  lineNumbers: true,
+  mode: {
+    name: "smarty",
+    leftDelimiter: "{--",
+    rightDelimiter: "--}"
+  }
+});
+var editor = CodeMirror.fromTextArea(document.getElementById("code3"), {
+  lineNumbers: true,
+  mode: {name: "smarty", version: 3, baseMode: "text/html"}
+});
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/smarty/smarty.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,225 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/**
+ * Smarty 2 and 3 mode.
+ */
+
+(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.defineMode("smarty", function(config, parserConf) {
+    var rightDelimiter = parserConf.rightDelimiter || "}";
+    var leftDelimiter = parserConf.leftDelimiter || "{";
+    var version = parserConf.version || 2;
+    var baseMode = CodeMirror.getMode(config, parserConf.baseMode || "null");
+
+    var keyFunctions = ["debug", "extends", "function", "include", "literal"];
+    var regs = {
+      operatorChars: /[+\-*&%=<>!?]/,
+      validIdentifier: /[a-zA-Z0-9_]/,
+      stringChar: /['"]/
+    };
+
+    var last;
+    function cont(style, lastType) {
+      last = lastType;
+      return style;
+    }
+
+    function chain(stream, state, parser) {
+      state.tokenize = parser;
+      return parser(stream, state);
+    }
+
+    // Smarty 3 allows { and } surrounded by whitespace to NOT slip into Smarty mode
+    function doesNotCount(stream, pos) {
+      if (pos == null) pos = stream.pos;
+      return version === 3 && leftDelimiter == "{" &&
+        (pos == stream.string.length || /\s/.test(stream.string.charAt(pos)));
+    }
+
+    function tokenTop(stream, state) {
+      var string = stream.string;
+      for (var scan = stream.pos;;) {
+        var nextMatch = string.indexOf(leftDelimiter, scan);
+        scan = nextMatch + leftDelimiter.length;
+        if (nextMatch == -1 || !doesNotCount(stream, nextMatch + leftDelimiter.length)) break;
+      }
+      if (nextMatch == stream.pos) {
+        stream.match(leftDelimiter);
+        if (stream.eat("*")) {
+          return chain(stream, state, tokenBlock("comment", "*" + rightDelimiter));
+        } else {
+          state.depth++;
+          state.tokenize = tokenSmarty;
+          last = "startTag";
+          return "tag";
+        }
+      }
+
+      if (nextMatch > -1) stream.string = string.slice(0, nextMatch);
+      var token = baseMode.token(stream, state.base);
+      if (nextMatch > -1) stream.string = string;
+      return token;
+    }
+
+    // parsing Smarty content
+    function tokenSmarty(stream, state) {
+      if (stream.match(rightDelimiter, true)) {
+        if (version === 3) {
+          state.depth--;
+          if (state.depth <= 0) {
+            state.tokenize = tokenTop;
+          }
+        } else {
+          state.tokenize = tokenTop;
+        }
+        return cont("tag", null);
+      }
+
+      if (stream.match(leftDelimiter, true)) {
+        state.depth++;
+        return cont("tag", "startTag");
+      }
+
+      var ch = stream.next();
+      if (ch == "$") {
+        stream.eatWhile(regs.validIdentifier);
+        return cont("variable-2", "variable");
+      } else if (ch == "|") {
+        return cont("operator", "pipe");
+      } else if (ch == ".") {
+        return cont("operator", "property");
+      } else if (regs.stringChar.test(ch)) {
+        state.tokenize = tokenAttribute(ch);
+        return cont("string", "string");
+      } else if (regs.operatorChars.test(ch)) {
+        stream.eatWhile(regs.operatorChars);
+        return cont("operator", "operator");
+      } else if (ch == "[" || ch == "]") {
+        return cont("bracket", "bracket");
+      } else if (ch == "(" || ch == ")") {
+        return cont("bracket", "operator");
+      } else if (/\d/.test(ch)) {
+        stream.eatWhile(/\d/);
+        return cont("number", "number");
+      } else {
+
+        if (state.last == "variable") {
+          if (ch == "@") {
+            stream.eatWhile(regs.validIdentifier);
+            return cont("property", "property");
+          } else if (ch == "|") {
+            stream.eatWhile(regs.validIdentifier);
+            return cont("qualifier", "modifier");
+          }
+        } else if (state.last == "pipe") {
+          stream.eatWhile(regs.validIdentifier);
+          return cont("qualifier", "modifier");
+        } else if (state.last == "whitespace") {
+          stream.eatWhile(regs.validIdentifier);
+          return cont("attribute", "modifier");
+        } if (state.last == "property") {
+          stream.eatWhile(regs.validIdentifier);
+          return cont("property", null);
+        } else if (/\s/.test(ch)) {
+          last = "whitespace";
+          return null;
+        }
+
+        var str = "";
+        if (ch != "/") {
+          str += ch;
+        }
+        var c = null;
+        while (c = stream.eat(regs.validIdentifier)) {
+          str += c;
+        }
+        for (var i=0, j=keyFunctions.length; i<j; i++) {
+          if (keyFunctions[i] == str) {
+            return cont("keyword", "keyword");
+          }
+        }
+        if (/\s/.test(ch)) {
+          return null;
+        }
+        return cont("tag", "tag");
+      }
+    }
+
+    function tokenAttribute(quote) {
+      return function(stream, state) {
+        var prevChar = null;
+        var currChar = null;
+        while (!stream.eol()) {
+          currChar = stream.peek();
+          if (stream.next() == quote && prevChar !== '\\') {
+            state.tokenize = tokenSmarty;
+            break;
+          }
+          prevChar = currChar;
+        }
+        return "string";
+      };
+    }
+
+    function tokenBlock(style, terminator) {
+      return function(stream, state) {
+        while (!stream.eol()) {
+          if (stream.match(terminator)) {
+            state.tokenize = tokenTop;
+            break;
+          }
+          stream.next();
+        }
+        return style;
+      };
+    }
+
+    return {
+      startState: function() {
+        return {
+          base: CodeMirror.startState(baseMode),
+          tokenize: tokenTop,
+          last: null,
+          depth: 0
+        };
+      },
+      copyState: function(state) {
+        return {
+          base: CodeMirror.copyState(baseMode, state.base),
+          tokenize: state.tokenize,
+          last: state.last,
+          depth: state.depth
+        };
+      },
+      innerMode: function(state) {
+        if (state.tokenize == tokenTop)
+          return {mode: baseMode, state: state.base};
+      },
+      token: function(stream, state) {
+        var style = state.tokenize(stream, state);
+        state.last = last;
+        return style;
+      },
+      indent: function(state, text, line) {
+        if (state.tokenize == tokenTop && baseMode.indent)
+          return baseMode.indent(state.base, text, line);
+        else
+          return CodeMirror.Pass;
+      },
+      blockCommentStart: leftDelimiter + "*",
+      blockCommentEnd: "*" + rightDelimiter
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-smarty", "smarty");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/solr/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,57 @@
+<!doctype html>
+
+<title>CodeMirror: Solr mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="solr.js"></script>
+<style>
+  .CodeMirror {
+    border-top: 1px solid black;
+    border-bottom: 1px solid black;
+  }
+
+  .CodeMirror .cm-operator {
+    color: orange;
+  }
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Solr</a>
+  </ul>
+</div>
+
+<article>
+  <h2>Solr mode</h2>
+
+  <div>
+    <textarea id="code" name="code">author:Camus
+
+title:"The Rebel" and author:Camus
+
+philosophy:Existentialism -author:Kierkegaard
+
+hardToSpell:Dostoevsky~
+
+published:[194* TO 1960] and author:(Sartre or "Simone de Beauvoir")</textarea>
+  </div>
+
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      mode: 'solr',
+      lineNumbers: true
+    });
+  </script>
+
+  <p><strong>MIME types defined:</strong> <code>text/x-solr</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/solr/solr.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,104 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("solr", function() {
+  "use strict";
+
+  var isStringChar = /[^\s\|\!\+\-\*\?\~\^\&\:\(\)\[\]\{\}\"\\]/;
+  var isOperatorChar = /[\|\!\+\-\*\?\~\^\&]/;
+  var isOperatorString = /^(OR|AND|NOT|TO)$/i;
+
+  function isNumber(word) {
+    return parseFloat(word).toString() === word;
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) break;
+        escaped = !escaped && next == "\\";
+      }
+
+      if (!escaped) state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+
+  function tokenOperator(operator) {
+    return function(stream, state) {
+      var style = "operator";
+      if (operator == "+")
+        style += " positive";
+      else if (operator == "-")
+        style += " negative";
+      else if (operator == "|")
+        stream.eat(/\|/);
+      else if (operator == "&")
+        stream.eat(/\&/);
+      else if (operator == "^")
+        style += " boost";
+
+      state.tokenize = tokenBase;
+      return style;
+    };
+  }
+
+  function tokenWord(ch) {
+    return function(stream, state) {
+      var word = ch;
+      while ((ch = stream.peek()) && ch.match(isStringChar) != null) {
+        word += stream.next();
+      }
+
+      state.tokenize = tokenBase;
+      if (isOperatorString.test(word))
+        return "operator";
+      else if (isNumber(word))
+        return "number";
+      else if (stream.peek() == ":")
+        return "field";
+      else
+        return "string";
+    };
+  }
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (ch == '"')
+      state.tokenize = tokenString(ch);
+    else if (isOperatorChar.test(ch))
+      state.tokenize = tokenOperator(ch);
+    else if (isStringChar.test(ch))
+      state.tokenize = tokenWord(ch);
+
+    return (state.tokenize != tokenBase) ? state.tokenize(stream, state) : null;
+  }
+
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase
+      };
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      return state.tokenize(stream, state);
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-solr", "solr");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/soy/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,68 @@
+<!doctype html>
+
+<title>CodeMirror: Soy (Closure Template) mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="soy.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Soy (Closure Template)</a>
+  </ul>
+</div>
+
+<article>
+<h2>Soy (Closure Template) mode</h2>
+<form><textarea id="code" name="code">
+{namespace example}
+
+/**
+ * Says hello to the world.
+ */
+{template .helloWorld}
+  {@param name: string}
+  {@param? score: number}
+  Hello <b>{$name}</b>!
+  <div>
+    {if $score}
+      <em>{$score} points</em>
+    {else}
+      no score
+    {/if}
+  </div>
+{/template}
+
+{template .alertHelloWorld kind="js"}
+  alert('Hello World');
+{/template}
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-soy",
+        indentUnit: 2,
+        indentWithTabs: false
+      });
+    </script>
+
+    <p>A mode for <a href="https://developers.google.com/closure/templates/">Closure Templates</a> (Soy).</p>
+    <p><strong>MIME type defined:</strong> <code>text/x-soy</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/soy/soy.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,665 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  var paramData = { noEndTag: true, soyState: "param-def" };
+  var tags = {
+    "alias": { noEndTag: true },
+    "delpackage": { noEndTag: true },
+    "namespace": { noEndTag: true, soyState: "namespace-def" },
+    "@attribute": paramData,
+    "@attribute?": paramData,
+    "@param": paramData,
+    "@param?": paramData,
+    "@inject": paramData,
+    "@inject?": paramData,
+    "@state": paramData,
+    "template": { soyState: "templ-def", variableScope: true},
+    "extern": {soyState: "param-def"},
+    "export": {soyState: "export"},
+    "literal": { },
+    "msg": {},
+    "fallbackmsg": { noEndTag: true, reduceIndent: true},
+    "select": {},
+    "plural": {},
+    "let": { soyState: "var-def" },
+    "if": {},
+    "javaimpl": {},
+    "jsimpl": {},
+    "elseif": { noEndTag: true, reduceIndent: true},
+    "else": { noEndTag: true, reduceIndent: true},
+    "switch": {},
+    "case": { noEndTag: true, reduceIndent: true},
+    "default": { noEndTag: true, reduceIndent: true},
+    "foreach": { variableScope: true, soyState: "for-loop" },
+    "ifempty": { noEndTag: true, reduceIndent: true},
+    "for": { variableScope: true, soyState: "for-loop" },
+    "call": { soyState: "templ-ref" },
+    "param": { soyState: "param-ref"},
+    "print": { noEndTag: true },
+    "deltemplate": { soyState: "templ-def", variableScope: true},
+    "delcall": { soyState: "templ-ref" },
+    "log": {},
+    "element": { variableScope: true },
+    "velog": {},
+    "const": { soyState: "const-def"},
+  };
+
+  var indentingTags = Object.keys(tags).filter(function(tag) {
+    return !tags[tag].noEndTag || tags[tag].reduceIndent;
+  });
+
+  CodeMirror.defineMode("soy", function(config) {
+    var textMode = CodeMirror.getMode(config, "text/plain");
+    var modes = {
+      html: CodeMirror.getMode(config, {name: "text/html", multilineTagIndentFactor: 2, multilineTagIndentPastTag: false, allowMissingTagName: true}),
+      attributes: textMode,
+      text: textMode,
+      uri: textMode,
+      trusted_resource_uri: textMode,
+      css: CodeMirror.getMode(config, "text/css"),
+      js: CodeMirror.getMode(config, {name: "text/javascript", statementIndent: 2 * config.indentUnit})
+    };
+
+    function last(array) {
+      return array[array.length - 1];
+    }
+
+    function tokenUntil(stream, state, untilRegExp) {
+      if (stream.sol()) {
+        for (var indent = 0; indent < state.indent; indent++) {
+          if (!stream.eat(/\s/)) break;
+        }
+        if (indent) return null;
+      }
+      var oldString = stream.string;
+      var match = untilRegExp.exec(oldString.substr(stream.pos));
+      if (match) {
+        // We don't use backUp because it backs up just the position, not the state.
+        // This uses an undocumented API.
+        stream.string = oldString.substr(0, stream.pos + match.index);
+      }
+      var result = stream.hideFirstChars(state.indent, function() {
+        var localState = last(state.localStates);
+        return localState.mode.token(stream, localState.state);
+      });
+      stream.string = oldString;
+      return result;
+    }
+
+    function contains(list, element) {
+      while (list) {
+        if (list.element === element) return true;
+        list = list.next;
+      }
+      return false;
+    }
+
+    function prepend(list, element) {
+      return {
+        element: element,
+        next: list
+      };
+    }
+
+    function popcontext(state) {
+      if (!state.context) return;
+      if (state.context.scope) {
+        state.variables = state.context.scope;
+      }
+      state.context = state.context.previousContext;
+    }
+
+    // Reference a variable `name` in `list`.
+    // Let `loose` be truthy to ignore missing identifiers.
+    function ref(list, name, loose) {
+      return contains(list, name) ? "variable-2" : (loose ? "variable" : "variable-2 error");
+    }
+
+    // Data for an open soy tag.
+    function Context(previousContext, tag, scope) {
+      this.previousContext = previousContext;
+      this.tag = tag;
+      this.kind = null;
+      this.scope = scope;
+    }
+
+    function expression(stream, state) {
+      var match;
+      if (stream.match(/[[]/)) {
+        state.soyState.push("list-literal");
+        state.context = new Context(state.context, "list-literal", state.variables);
+        state.lookupVariables = false;
+        return null;
+      } else if (stream.match(/\bmap(?=\()/)) {
+        state.soyState.push("map-literal");
+        return "keyword";
+      } else if (stream.match(/\brecord(?=\()/)) {
+        state.soyState.push("record-literal");
+        return "keyword";
+      } else if (stream.match(/([\w]+)(?=\()/)) {
+        return "variable callee";
+      } else if (match = stream.match(/^["']/)) {
+        state.soyState.push("string");
+        state.quoteKind = match[0];
+        return "string";
+      } else if (stream.match(/^[(]/)) {
+        state.soyState.push("open-parentheses");
+        return null;
+      } else if (stream.match(/(null|true|false)(?!\w)/) ||
+          stream.match(/0x([0-9a-fA-F]{2,})/) ||
+          stream.match(/-?([0-9]*[.])?[0-9]+(e[0-9]*)?/)) {
+        return "atom";
+      } else if (stream.match(/(\||[+\-*\/%]|[=!]=|\?:|[<>]=?)/)) {
+        // Tokenize filter, binary, null propagator, and equality operators.
+        return "operator";
+      } else if (match = stream.match(/^\$([\w]+)/)) {
+        return ref(state.variables, match[1], !state.lookupVariables);
+      } else if (match = stream.match(/^\w+/)) {
+        return /^(?:as|and|or|not|in|if)$/.test(match[0]) ? "keyword" : null;
+      }
+
+      stream.next();
+      return null;
+    }
+
+    return {
+      startState: function() {
+        return {
+          soyState: [],
+          variables: prepend(null, 'ij'),
+          scopes: null,
+          indent: 0,
+          quoteKind: null,
+          context: null,
+          lookupVariables: true, // Is unknown variables considered an error
+          localStates: [{
+            mode: modes.html,
+            state: CodeMirror.startState(modes.html)
+          }]
+        };
+      },
+
+      copyState: function(state) {
+        return {
+          tag: state.tag, // Last seen Soy tag.
+          soyState: state.soyState.concat([]),
+          variables: state.variables,
+          context: state.context,
+          indent: state.indent, // Indentation of the following line.
+          quoteKind: state.quoteKind,
+          lookupVariables: state.lookupVariables,
+          localStates: state.localStates.map(function(localState) {
+            return {
+              mode: localState.mode,
+              state: CodeMirror.copyState(localState.mode, localState.state)
+            };
+          })
+        };
+      },
+
+      token: function(stream, state) {
+        var match;
+
+        switch (last(state.soyState)) {
+          case "comment":
+            if (stream.match(/^.*?\*\//)) {
+              state.soyState.pop();
+            } else {
+              stream.skipToEnd();
+            }
+            if (!state.context || !state.context.scope) {
+              var paramRe = /@param\??\s+(\S+)/g;
+              var current = stream.current();
+              for (var match; (match = paramRe.exec(current)); ) {
+                state.variables = prepend(state.variables, match[1]);
+              }
+            }
+            return "comment";
+
+          case "string":
+            var match = stream.match(/^.*?(["']|\\[\s\S])/);
+            if (!match) {
+              stream.skipToEnd();
+            } else if (match[1] == state.quoteKind) {
+              state.quoteKind = null;
+              state.soyState.pop();
+            }
+            return "string";
+        }
+
+        if (!state.soyState.length || last(state.soyState) != "literal") {
+          if (stream.match(/^\/\*/)) {
+            state.soyState.push("comment");
+            return "comment";
+          } else if (stream.match(stream.sol() ? /^\s*\/\/.*/ : /^\s+\/\/.*/)) {
+            return "comment";
+          }
+        }
+
+        switch (last(state.soyState)) {
+          case "templ-def":
+            if (match = stream.match(/^\.?([\w]+(?!\.[\w]+)*)/)) {
+              state.soyState.pop();
+              return "def";
+            }
+            stream.next();
+            return null;
+
+          case "templ-ref":
+            if (match = stream.match(/(\.?[a-zA-Z_][a-zA-Z_0-9]+)+/)) {
+              state.soyState.pop();
+              // If the first character is '.', it can only be a local template.
+              if (match[0][0] == '.') {
+                return "variable-2"
+              }
+              // Otherwise
+              return "variable";
+            }
+            if (match = stream.match(/^\$([\w]+)/)) {
+              state.soyState.pop();
+              return ref(state.variables, match[1], !state.lookupVariables);
+            }
+
+            stream.next();
+            return null;
+
+          case "namespace-def":
+            if (match = stream.match(/^\.?([\w\.]+)/)) {
+              state.soyState.pop();
+              return "variable";
+            }
+            stream.next();
+            return null;
+
+          case "param-def":
+            if (match = stream.match(/^\*/)) {
+              state.soyState.pop();
+              state.soyState.push("param-type");
+              return "type";
+            }
+            if (match = stream.match(/^\w+/)) {
+              state.variables = prepend(state.variables, match[0]);
+              state.soyState.pop();
+              state.soyState.push("param-type");
+              return "def";
+            }
+            stream.next();
+            return null;
+
+          case "param-ref":
+            if (match = stream.match(/^\w+/)) {
+              state.soyState.pop();
+              return "property";
+            }
+            stream.next();
+            return null;
+
+          case "open-parentheses":
+            if (stream.match(/[)]/)) {
+              state.soyState.pop();
+              return null;
+            }
+            return expression(stream, state);
+
+          case "param-type":
+            var peekChar = stream.peek();
+            if ("}]=>,".indexOf(peekChar) != -1) {
+              state.soyState.pop();
+              return null;
+            } else if (peekChar == "[") {
+              state.soyState.push('param-type-record');
+              return null;
+            } else if (peekChar == "(") {
+              state.soyState.push('param-type-template');
+              return null;
+            } else if (peekChar == "<") {
+              state.soyState.push('param-type-parameter');
+              return null;
+            } else if (match = stream.match(/^([\w]+|[?])/)) {
+              return "type";
+            }
+            stream.next();
+            return null;
+
+          case "param-type-record":
+            var peekChar = stream.peek();
+            if (peekChar == "]") {
+              state.soyState.pop();
+              return null;
+            }
+            if (stream.match(/^\w+/)) {
+              state.soyState.push('param-type');
+              return "property";
+            }
+            stream.next();
+            return null;
+
+          case "param-type-parameter":
+            if (stream.match(/^[>]/)) {
+              state.soyState.pop();
+              return null;
+            }
+            if (stream.match(/^[<,]/)) {
+              state.soyState.push('param-type');
+              return null;
+            }
+            stream.next();
+            return null;
+
+          case "param-type-template":
+            if (stream.match(/[>]/)) {
+              state.soyState.pop();
+              state.soyState.push('param-type');
+              return null;
+            }
+            if (stream.match(/^\w+/)) {
+              state.soyState.push('param-type');
+              return "def";
+            }
+            stream.next();
+            return null;
+
+          case "var-def":
+            if (match = stream.match(/^\$([\w]+)/)) {
+              state.variables = prepend(state.variables, match[1]);
+              state.soyState.pop();
+              return "def";
+            }
+            stream.next();
+            return null;
+
+          case "for-loop":
+            if (stream.match(/\bin\b/)) {
+              state.soyState.pop();
+              return "keyword";
+            }
+            if (stream.peek() == "$") {
+              state.soyState.push('var-def');
+              return null;
+            }
+            stream.next();
+            return null;
+
+          case "record-literal":
+            if (stream.match(/^[)]/)) {
+              state.soyState.pop();
+              return null;
+            }
+            if (stream.match(/[(,]/)) {
+              state.soyState.push("map-value")
+              state.soyState.push("record-key")
+              return null;
+            }
+            stream.next()
+            return null;
+
+          case "map-literal":
+            if (stream.match(/^[)]/)) {
+              state.soyState.pop();
+              return null;
+            }
+            if (stream.match(/[(,]/)) {
+              state.soyState.push("map-value")
+              state.soyState.push("map-value")
+              return null;
+            }
+            stream.next()
+            return null;
+
+          case "list-literal":
+            if (stream.match(']')) {
+              state.soyState.pop();
+              state.lookupVariables = true;
+              popcontext(state);
+              return null;
+            }
+            if (stream.match(/\bfor\b/)) {
+              state.lookupVariables = true;
+              state.soyState.push('for-loop');
+              return "keyword";
+            }
+            return expression(stream, state);
+
+          case "record-key":
+            if (stream.match(/[\w]+/)) {
+              return "property";
+            }
+            if (stream.match(/^[:]/)) {
+              state.soyState.pop();
+              return null;
+            }
+            stream.next();
+            return null;
+
+          case "map-value":
+            if (stream.peek() == ")" || stream.peek() == "," || stream.match(/^[:)]/)) {
+              state.soyState.pop();
+              return null;
+            }
+            return expression(stream, state);
+
+          case "import":
+            if (stream.eat(";")) {
+              state.soyState.pop();
+              state.indent -= 2 * config.indentUnit;
+              return null;
+            }
+            if (stream.match(/\w+(?=\s+as\b)/)) {
+              return "variable";
+            }
+            if (match = stream.match(/\w+/)) {
+              return /\b(from|as)\b/.test(match[0]) ? "keyword" : "def";
+            }
+            if (match = stream.match(/^["']/)) {
+              state.soyState.push("string");
+              state.quoteKind = match[0];
+              return "string";
+            }
+            stream.next();
+            return null;
+
+          case "tag":
+            var endTag;
+            var tagName;
+            if (state.tag === undefined) {
+              endTag = true;
+              tagName = '';
+            } else {
+              endTag = state.tag[0] == "/";
+              tagName = endTag ? state.tag.substring(1) : state.tag;
+            }
+            var tag = tags[tagName];
+            if (stream.match(/^\/?}/)) {
+              var selfClosed = stream.current() == "/}";
+              if (selfClosed && !endTag) {
+                popcontext(state);
+              }
+              if (state.tag == "/template" || state.tag == "/deltemplate") {
+                state.variables = prepend(null, 'ij');
+                state.indent = 0;
+              } else {
+                state.indent -= config.indentUnit *
+                    (selfClosed || indentingTags.indexOf(state.tag) == -1 ? 2 : 1);
+              }
+              state.soyState.pop();
+              return "keyword";
+            } else if (stream.match(/^([\w?]+)(?==)/)) {
+              if (state.context && state.context.tag == tagName && stream.current() == "kind" && (match = stream.match(/^="([^"]+)/, false))) {
+                var kind = match[1];
+                state.context.kind = kind;
+                var mode = modes[kind] || modes.html;
+                var localState = last(state.localStates);
+                if (localState.mode.indent) {
+                  state.indent += localState.mode.indent(localState.state, "", "");
+                }
+                state.localStates.push({
+                  mode: mode,
+                  state: CodeMirror.startState(mode)
+                });
+              }
+              return "attribute";
+            }
+            return expression(stream, state);
+
+          case "template-call-expression":
+            if (stream.match(/^([\w-?]+)(?==)/)) {
+              return "attribute";
+            } else if (stream.eat('>')) {
+              state.soyState.pop();
+              return "keyword";
+            } else if (stream.eat('/>')) {
+              state.soyState.pop();
+              return "keyword";
+            }
+            return expression(stream, state);
+          case "literal":
+            if (stream.match('{/literal}', false)) {
+              state.soyState.pop();
+              return this.token(stream, state);
+            }
+            return tokenUntil(stream, state, /\{\/literal}/);
+          case "export":
+            if (match = stream.match(/\w+/)) {
+              state.soyState.pop();
+              if (match == "const") {
+                state.soyState.push("const-def")
+                return "keyword";
+              } else if (match == "extern") {
+                state.soyState.push("param-def")
+                return "keyword";
+              }
+            } else {
+              stream.next();
+            }
+            return null;
+          case "const-def":
+            if (stream.match(/^\w+/)) {
+              state.soyState.pop();
+              return "def";
+            }
+            stream.next();
+            return null;
+        }
+
+        if (stream.match('{literal}')) {
+          state.indent += config.indentUnit;
+          state.soyState.push("literal");
+          state.context = new Context(state.context, "literal", state.variables);
+          return "keyword";
+
+        // A tag-keyword must be followed by whitespace, comment or a closing tag.
+        } else if (match = stream.match(/^\{([/@\\]?\w+\??)(?=$|[\s}]|\/[/*])/)) {
+          var prevTag = state.tag;
+          state.tag = match[1];
+          var endTag = state.tag[0] == "/";
+          var indentingTag = !!tags[state.tag];
+          var tagName = endTag ? state.tag.substring(1) : state.tag;
+          var tag = tags[tagName];
+          if (state.tag != "/switch")
+            state.indent += ((endTag || tag && tag.reduceIndent) && prevTag != "switch" ? 1 : 2) * config.indentUnit;
+
+          state.soyState.push("tag");
+          var tagError = false;
+          if (tag) {
+            if (!endTag) {
+              if (tag.soyState) state.soyState.push(tag.soyState);
+            }
+            // If a new tag, open a new context.
+            if (!tag.noEndTag && (indentingTag || !endTag)) {
+              state.context = new Context(state.context, state.tag, tag.variableScope ? state.variables : null);
+            // Otherwise close the current context.
+            } else if (endTag) {
+              var isBalancedForExtern = tagName == 'extern' && (state.context && state.context.tag == 'export');
+              if (!state.context || ((state.context.tag != tagName) && !isBalancedForExtern)) {
+                tagError = true;
+              } else if (state.context) {
+                if (state.context.kind) {
+                  state.localStates.pop();
+                  var localState = last(state.localStates);
+                  if (localState.mode.indent) {
+                    state.indent -= localState.mode.indent(localState.state, "", "");
+                  }
+                }
+                popcontext(state);
+              }
+            }
+          } else if (endTag) {
+            // Assume all tags with a closing tag are defined in the config.
+            tagError = true;
+          }
+          return (tagError ? "error " : "") + "keyword";
+
+        // Not a tag-keyword; it's an implicit print tag.
+        } else if (stream.eat('{')) {
+          state.tag = "print";
+          state.indent += 2 * config.indentUnit;
+          state.soyState.push("tag");
+          return "keyword";
+        } else if (!state.context && stream.sol() && stream.match(/import\b/)) {
+          state.soyState.push("import");
+          state.indent += 2 * config.indentUnit;
+          return "keyword";
+        } else if (match = stream.match('<{')) {
+          state.soyState.push("template-call-expression");
+          state.indent += 2 * config.indentUnit;
+          state.soyState.push("tag");
+          return "keyword";
+        } else if (match = stream.match('</>')) {
+          state.indent -= 1 * config.indentUnit;
+          return "keyword";
+        }
+
+        return tokenUntil(stream, state, /\{|\s+\/\/|\/\*/);
+      },
+
+      indent: function(state, textAfter, line) {
+        var indent = state.indent, top = last(state.soyState);
+        if (top == "comment") return CodeMirror.Pass;
+
+        if (top == "literal") {
+          if (/^\{\/literal}/.test(textAfter)) indent -= config.indentUnit;
+        } else {
+          if (/^\s*\{\/(template|deltemplate)\b/.test(textAfter)) return 0;
+          if (/^\{(\/|(fallbackmsg|elseif|else|ifempty)\b)/.test(textAfter)) indent -= config.indentUnit;
+          if (state.tag != "switch" && /^\{(case|default)\b/.test(textAfter)) indent -= config.indentUnit;
+          if (/^\{\/switch\b/.test(textAfter)) indent -= config.indentUnit;
+        }
+        var localState = last(state.localStates);
+        if (indent && localState.mode.indent) {
+          indent += localState.mode.indent(localState.state, textAfter, line);
+        }
+        return indent;
+      },
+
+      innerMode: function(state) {
+        if (state.soyState.length && last(state.soyState) != "literal") return null;
+        else return last(state.localStates);
+      },
+
+      electricInput: /^\s*\{(\/|\/template|\/deltemplate|\/switch|fallbackmsg|elseif|else|case|default|ifempty|\/literal\})$/,
+      lineComment: "//",
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/",
+      blockCommentContinue: " * ",
+      useInnerComments: false,
+      fold: "indent"
+    };
+  }, "htmlmixed");
+
+  CodeMirror.registerHelper("wordChars", "soy", /[\w$]/);
+
+  CodeMirror.registerHelper("hintWords", "soy", Object.keys(tags).concat(
+      ["css", "debugger"]));
+
+  CodeMirror.defineMIME("text/x-soy", "soy");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/soy/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,322 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "soy");
+  function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}
+
+  // Test of small keywords and words containing them.
+  MT('keywords-test',
+     '[keyword {] [keyword as] worrying [keyword and] notorious [keyword as]',
+     '    the Fandor[operator -]alias assassin, [keyword or]',
+     '    Corcand cannot fit [keyword in] [keyword }]');
+
+  MT('let-test',
+     '[keyword {template] [def .name][keyword }]',
+     '  [keyword {let] [def $name]: [string "world"][keyword /}]',
+     '  [tag&bracket <][tag h1][tag&bracket >]',
+     '    Hello, [keyword {][variable-2 $name][keyword }]',
+     '  [tag&bracket </][tag h1][tag&bracket >]',
+     '[keyword {/template}]',
+     '');
+
+  MT('function-test',
+     '[keyword {] [callee&variable css]([string "MyClass"])[keyword }]',
+     '[tag&bracket <][tag input] [attribute value]=[string "]' +
+     '[keyword {] [callee&variable index]([variable-2&error $list])[keyword }]' +
+        '[string "][tag&bracket />]');
+
+  MT('soy-element-composition-test',
+     '[keyword <{][callee&variable foo]()[keyword }]',
+     '[keyword ></>]');
+
+  MT('soy-element-composition-attribute-test',
+     '[keyword <{][callee&variable foo]()[keyword }]',
+     '[attribute class]=[string "Foo"]',
+     '[keyword ></>]');
+
+  MT('namespace-test',
+     '[keyword {namespace] [variable namespace][keyword }]')
+
+  MT('namespace-with-attribute-test',
+     '[keyword {namespace] [variable my.namespace.templates] ' +
+         '[attribute requirecss]=[string "my.namespace"][keyword }]');
+
+  MT('operators-test',
+     '[keyword {] [atom 1] [operator ==] [atom 1] [keyword }]',
+     '[keyword {] [atom 1] [operator !=] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator +] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator -] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator *] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator /] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator %] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator <=] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator >=] [atom 2] [keyword }]',
+     '[keyword {] [atom 3] [operator >] [atom 2] [keyword }]',
+     '[keyword {] [atom 2] [operator >] [atom 3] [keyword }]',
+     '[keyword {] [atom null] [operator ?:] [string ""] [keyword }]',
+     '[keyword {] [variable-2&error $variable] [operator |] safeHtml [keyword }]')
+
+  MT('primitive-test',
+     '[keyword {] [atom true] [keyword }]',
+     '[keyword {] [atom false] [keyword }]',
+     '[keyword {] truethy [keyword }]',
+     '[keyword {] falsey [keyword }]',
+     '[keyword {] [atom 42] [keyword }]',
+     '[keyword {] [atom .42] [keyword }]',
+     '[keyword {] [atom 0.42] [keyword }]',
+     '[keyword {] [atom -0.42] [keyword }]',
+     '[keyword {] [atom -.2] [keyword }]',
+     '[keyword {] [atom 6.03e23] [keyword }]',
+     '[keyword {] [atom -0.03e0] [keyword }]',
+     '[keyword {] [atom 0x1F] [keyword }]',
+     '[keyword {] [atom 0x1F00BBEA] [keyword }]');
+
+  MT('param-type-record',
+     '[keyword {@param] [def record]: [[[property foo]: [type bool], [property bar]: [type int] ]][keyword }]'
+  );
+
+  MT('param-type-map',
+     '[keyword {@param] [def unknown]: [type map]<[type string], [type bool]>[keyword }]'
+  );
+
+  MT('param-type-list',
+     '[keyword {@param] [def list]: [type list]<[type ?]>[keyword }]'
+  );
+
+  MT('param-type-any',
+     '[keyword {@param] [def unknown]: [type ?][keyword }]'
+  );
+
+  MT('param-type-nested',
+     '[keyword {@param] [def a]: ' +
+         '[type list]<[[[property a]: [type int], ' +
+         '[property b]: [type map]<[type string], ' +
+         '[type bool]>]]>][keyword }]');
+
+  MT('undefined-var',
+     '[keyword {][variable-2&error $var]');
+
+  MT('param-scope-test',
+     '[keyword {template] [def .a][keyword }]',
+     '  [keyword {@param] [def x]: [type string][keyword }]',
+     '  [keyword {][variable-2 $x][keyword }]',
+     '[keyword {/template}]',
+     '',
+     '[keyword {template] [def .b][keyword }]',
+     '  [keyword {][variable-2&error $x][keyword }]',
+     '[keyword {/template}]',
+     '');
+
+  MT('if-variable-test',
+     '[keyword {if] [variable-2&error $showThing][keyword }]',
+     '  Yo!',
+     '[keyword {/if}]',
+     '');
+
+  MT('defined-if-variable-test',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@param?] [def showThing]: [type bool][keyword }]',
+     '  [keyword {if] [variable-2 $showThing][keyword }]',
+     '    Yo!',
+     '  [keyword {/if}]',
+     '[keyword {/template}]',
+     '');
+
+  MT('template-calls-test',
+     '[keyword {call] [variable-2 .foo][keyword /}]',
+     '[keyword {call] [variable foo][keyword /}]',
+     '[keyword {call] [variable foo][keyword }] [keyword {/call}]',
+     '[keyword {call] [variable first1.second.third_3][keyword /}]',
+     '[keyword {call] [variable first1.second.third_3] [keyword }] [keyword {/call}]',
+     '');
+
+  MT('foreach-scope-test',
+     '[keyword {@param] [def bar]: [type string][keyword }]',
+     '[keyword {foreach] [def $foo] [keyword in] [variable-2&error $foos][keyword }]',
+     '  [keyword {][variable-2 $foo][keyword }]',
+     '[keyword {/foreach}]',
+     '[keyword {][variable-2&error $foo][keyword }]',
+     '[keyword {][variable-2 $bar][keyword }]');
+
+  MT('foreach-ifempty-indent-test',
+     '[keyword {foreach] [def $foo] [keyword in] [variable-2&error $foos][keyword }]',
+     '  something',
+     '[keyword {ifempty}]',
+     '  nothing',
+     '[keyword {/foreach}]',
+     '');
+
+   MT('foreach-index',
+      '[keyword {foreach] [def $foo],[def $index] [keyword in] [[]] [keyword }]',
+      '  [keyword {][variable-2 $foo][keyword }] [keyword {][variable-2 $index][keyword }]',
+      '[keyword {/foreach}]');
+
+  MT('nested-kind-test',
+     '[keyword {template] [def .foo] [attribute kind]=[string "html"][keyword }]',
+     '  [tag&bracket <][tag div][tag&bracket >]',
+     '    [keyword {call] [variable-2 .bar][keyword }]',
+     '      [keyword {param] [property propertyName] [attribute kind]=[string "js"][keyword }]',
+     '        [keyword var] [def bar] [operator =] [number 5];',
+     '      [keyword {/param}]',
+     '    [keyword {/call}]',
+     '  [tag&bracket </][tag div][tag&bracket >]',
+     '[keyword {/template}]',
+     '');
+
+  MT('tag-starting-with-function-call-is-not-a-keyword',
+     '[keyword {][callee&variable index]([variable-2&error $foo])[keyword }]',
+     '[keyword {css] [string "some-class"][keyword }]',
+     '[keyword {][callee&variable css]([string "some-class"])[keyword }]',
+     '');
+
+  MT('allow-missing-colon-in-@param',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@param] [def showThing] [type bool][keyword }]',
+     '  [keyword {if] [variable-2 $showThing][keyword }]',
+     '    Yo!',
+     '  [keyword {/if}]',
+     '[keyword {/template}]',
+     '');
+
+  MT('param-type-and-default-value',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@param] [def bar]: [type bool] = [atom true][keyword }]',
+     '[keyword {/template}]',
+     '');
+
+  MT('attribute-type',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@attribute] [def bar]: [type string][keyword }]',
+     '[keyword {/template}]',
+     '');
+
+  MT('attribute-type-optional',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@attribute] [def bar]: [type string][keyword }]',
+     '[keyword {/template}]',
+     '');
+
+  MT('attribute-type-all',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@attribute] [type *][keyword }]',
+     '[keyword {/template}]',
+     '');
+
+   MT('state-variable-reference',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@param] [def bar]:= [atom true][keyword }]',
+     '  [keyword {@state] [def foobar]:= [variable-2 $bar][keyword }]',
+     '[keyword {/template}]',
+     '');
+
+   MT('param-type-template',
+     '[keyword {template] [def .foo][keyword }]',
+     '  [keyword {@param] [def renderer]: ([def s]:[type string])=>[type html][keyword }]',
+     '  [keyword {call] [variable-2 $renderer] [keyword /}]',
+     '[keyword {/template}]',
+     '');
+
+  MT('single-quote-strings',
+     '[keyword {][string "foo"] [string \'bar\'][keyword }]',
+     '');
+
+  MT('literal-comments',
+     '[keyword {literal}]/* comment */ // comment[keyword {/literal}]');
+
+  MT('highlight-command-at-eol',
+     '[keyword {msg]',
+     '    [keyword }]');
+
+  MT('switch-indent-test',
+     '[keyword {let] [def $marbles]: [atom 5] [keyword /}]',
+     '[keyword {switch] [variable-2 $marbles][keyword }]',
+     '  [keyword {case] [atom 0][keyword }]',
+     '    No marbles',
+     '  [keyword {default}]',
+     '    At least 1 marble',
+     '[keyword {/switch}]',
+     '');
+
+  MT('if-elseif-else-indent',
+     '[keyword {if] [atom true][keyword }]',
+     '  [keyword {let] [def $a]: [atom 5] [keyword /}]',
+     '[keyword {elseif] [atom false][keyword }]',
+     '  [keyword {let] [def $bar]: [atom 5] [keyword /}]',
+     '[keyword {else}]',
+     '  [keyword {let] [def $bar]: [atom 5] [keyword /}]',
+     '[keyword {/if}]');
+
+  MT('msg-fallbackmsg-indent',
+     '[keyword {msg] [attribute desc]=[string "A message"][keyword }]',
+     '  A message',
+     '[keyword {fallbackmsg] [attribute desc]=[string "A message"][keyword }]',
+     '  Old message',
+     '[keyword {/msg}]');
+
+  MT('literal-indent',
+     '[keyword {template] [def .name][keyword }]',
+     '  [keyword {literal}]',
+     '    Lerum',
+     '  [keyword {/literal}]',
+     '  Ipsum',
+     '[keyword {/template}]');
+
+  MT('special-chars',
+     '[keyword {sp}]',
+     '[keyword {nil}]',
+     '[keyword {\\r}]',
+     '[keyword {\\n}]',
+     '[keyword {\\t}]',
+     '[keyword {lb}]',
+     '[keyword {rb}]');
+
+  MT('let-list-literal',
+     '[keyword {let] [def $test]: [[[[[string \'a\'] ], [[[string \'b\'] ] ] [keyword /}]');
+
+  MT('let-record-literal',
+     '[keyword {let] [def $test]: [keyword record]([property test]: [callee&variable bidiGlobalDir](), ' +
+         '[property foo]: [atom 5]) [keyword /}]');
+
+  MT('let-map-literal',
+     '[keyword {let] [def $test]: [keyword map]([string \'outer\']: [keyword map]([atom 5]: [atom false]), ' +
+         '[string \'foo\']: [string \'bar\']) [keyword /}]');
+
+  MT('wrong-closing-tag',
+     '[keyword {if] [atom true][keyword }]',
+     '  Optional',
+     '[keyword&error {/badend][keyword }]');
+
+  MT('list-comprehension',
+     '[keyword {let] [def $myList]: [[[[[string \'a\'] ] ] [keyword /}] ' +
+     '[keyword {let] [def $test]: [[[variable $a] [operator +] [atom 1] [keyword for] ' +
+         '[def $a] [keyword in] [variable-2 $myList] [keyword if] [variable-2 $a] [operator >=] [atom 3] ] [keyword /}]');
+
+  MT('list-comprehension-index',
+     '[keyword {let] [def $test]: [[[variable $a] [operator +] [variable $index] [keyword for] ' +
+         '[def $a],[def $index] [keyword in] [[]] [keyword if] [variable-2 $a] [operator >=] [variable-2 $index] ] [keyword /}]');
+
+
+  MT('list-comprehension-variable-scope',
+     '[keyword {let] [def $name]: [string "world"][keyword /}]',
+     '[keyword {let] [def $test]: [[[variable $a] [operator +] [variable $index] [keyword for] ' +
+         '[def $a],[def $index] [keyword in] [[]] [keyword if] [variable-2 $a] [operator >=] [variable-2 $index] ] [keyword /}]',
+     '[keyword {][variable-2&error $a][keyword }]',
+     '[keyword {][variable-2&error $index][keyword }]',
+     '[keyword {][variable-2 $test][keyword }]',
+     '[keyword {][variable-2 $name][keyword }]');
+
+  MT('import',
+   '[keyword import] {[def Name], [variable Person] [keyword as] [def P]} [keyword from] [string \'examples/proto/example.proto\'];');
+
+  MT('velog',
+    '[keyword {velog] [variable-2&error $data][keyword }] Logged [keyword {/velog}]');
+
+  MT('extern', '[keyword {extern] [def renderer]: ([def s]:[type string])=>[type string][keyword }] [keyword {/extern}]');
+
+  MT('export extern', '[keyword {export] [keyword extern] [def renderer]: ([def s]:[type string])=>[type string][keyword }] [keyword {/extern}]');
+
+  MT('const',
+    '[keyword {const] [def FOO] = [atom 5] [keyword /}]',
+    '[keyword {export] [keyword const] [def FOO] = [atom 5] [keyword /}]');
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sparql/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: SPARQL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="sparql.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">SPARQL</a>
+  </ul>
+</div>
+
+<article>
+<h2>SPARQL mode</h2>
+<form><textarea id="code" name="code">
+PREFIX a: &lt;http://www.w3.org/2000/10/annotation-ns#>
+PREFIX dc: &lt;http://purl.org/dc/elements/1.1/>
+PREFIX foaf: &lt;http://xmlns.com/foaf/0.1/>
+PREFIX rdfs: &lt;http://www.w3.org/2000/01/rdf-schema#>
+
+# Comment!
+
+SELECT ?given ?family
+WHERE {
+  {
+    ?annot a:annotates &lt;http://www.w3.org/TR/rdf-sparql-query/> .
+    ?annot dc:creator ?c .
+    OPTIONAL {?c foaf:givenName ?given ;
+                 foaf:familyName ?family }
+  } UNION {
+    ?c !foaf:knows/foaf:knows? ?thing.
+    ?thing rdfs
+  } MINUS {
+    ?thing rdfs:label "剛柔流"@jp
+  }
+  FILTER isBlank(?c)
+}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "application/sparql-query",
+        matchBrackets: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>application/sparql-query</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sparql/sparql.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,184 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("sparql", function(config) {
+  var indentUnit = config.indentUnit;
+  var curPunc;
+
+  function wordRegexp(words) {
+    return new RegExp("^(?:" + words.join("|") + ")$", "i");
+  }
+  var ops = wordRegexp(["str", "lang", "langmatches", "datatype", "bound", "sameterm", "isiri", "isuri",
+                        "iri", "uri", "bnode", "count", "sum", "min", "max", "avg", "sample",
+                        "group_concat", "rand", "abs", "ceil", "floor", "round", "concat", "substr", "strlen",
+                        "replace", "ucase", "lcase", "encode_for_uri", "contains", "strstarts", "strends",
+                        "strbefore", "strafter", "year", "month", "day", "hours", "minutes", "seconds",
+                        "timezone", "tz", "now", "uuid", "struuid", "md5", "sha1", "sha256", "sha384",
+                        "sha512", "coalesce", "if", "strlang", "strdt", "isnumeric", "regex", "exists",
+                        "isblank", "isliteral", "a", "bind"]);
+  var keywords = wordRegexp(["base", "prefix", "select", "distinct", "reduced", "construct", "describe",
+                             "ask", "from", "named", "where", "order", "limit", "offset", "filter", "optional",
+                             "graph", "by", "asc", "desc", "as", "having", "undef", "values", "group",
+                             "minus", "in", "not", "service", "silent", "using", "insert", "delete", "union",
+                             "true", "false", "with",
+                             "data", "copy", "to", "move", "add", "create", "drop", "clear", "load", "into"]);
+  var operatorChars = /[*+\-<>=&|\^\/!\?]/;
+  var PN_CHARS = "[A-Za-z_\\-0-9]";
+  var PREFIX_START = new RegExp("[A-Za-z]");
+  var PREFIX_REMAINDER = new RegExp("((" + PN_CHARS + "|\\.)*(" + PN_CHARS + "))?:");
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    curPunc = null;
+    if (ch == "$" || ch == "?") {
+      if(ch == "?" && stream.match(/\s/, false)){
+        return "operator";
+      }
+      stream.match(/^[A-Za-z0-9_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][A-Za-z0-9_\u00B7\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u037D\u037F-\u1FFF\u200C-\u200D\u203F-\u2040\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]*/);
+      return "variable-2";
+    }
+    else if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
+      stream.match(/^[^\s\u00a0>]*>?/);
+      return "atom";
+    }
+    else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenLiteral(ch);
+      return state.tokenize(stream, state);
+    }
+    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
+      curPunc = ch;
+      return "bracket";
+    }
+    else if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    else if (operatorChars.test(ch)) {
+      return "operator";
+    }
+    else if (ch == ":") {
+      eatPnLocal(stream);
+      return "atom";
+    }
+    else if (ch == "@") {
+      stream.eatWhile(/[a-z\d\-]/i);
+      return "meta";
+    }
+    else if (PREFIX_START.test(ch) && stream.match(PREFIX_REMAINDER)) {
+        eatPnLocal(stream);
+        return "atom";
+    }
+    stream.eatWhile(/[_\w\d]/);
+    var word = stream.current();
+    if (ops.test(word))
+      return "builtin";
+    else if (keywords.test(word))
+      return "keyword";
+    else
+      return "variable";
+  }
+
+  function eatPnLocal(stream) {
+    stream.match(/(\.(?=[\w_\-\\%])|[:\w_-]|\\[-\\_~.!$&'()*+,;=/?#@%]|%[a-f\d][a-f\d])+/i);
+  }
+
+  function tokenLiteral(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      return "string";
+    };
+  }
+
+  function pushContext(state, type, col) {
+    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
+  }
+  function popContext(state) {
+    state.indent = state.context.indent;
+    state.context = state.context.prev;
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: tokenBase,
+              context: null,
+              indent: 0,
+              col: 0};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (state.context && state.context.align == null) state.context.align = false;
+        state.indent = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+
+      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
+        state.context.align = true;
+      }
+
+      if (curPunc == "(") pushContext(state, ")", stream.column());
+      else if (curPunc == "[") pushContext(state, "]", stream.column());
+      else if (curPunc == "{") pushContext(state, "}", stream.column());
+      else if (/[\]\}\)]/.test(curPunc)) {
+        while (state.context && state.context.type == "pattern") popContext(state);
+        if (state.context && curPunc == state.context.type) {
+          popContext(state);
+          if (curPunc == "}" && state.context && state.context.type == "pattern")
+            popContext(state);
+        }
+      }
+      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
+      else if (/atom|string|variable/.test(style) && state.context) {
+        if (/[\}\]]/.test(state.context.type))
+          pushContext(state, "pattern", stream.column());
+        else if (state.context.type == "pattern" && !state.context.align) {
+          state.context.align = true;
+          state.context.col = stream.column();
+        }
+      }
+
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var firstChar = textAfter && textAfter.charAt(0);
+      var context = state.context;
+      if (/[\]\}]/.test(firstChar))
+        while (context && context.type == "pattern") context = context.prev;
+
+      var closing = context && firstChar == context.type;
+      if (!context)
+        return 0;
+      else if (context.type == "pattern")
+        return context.col;
+      else if (context.align)
+        return context.col + (closing ? 0 : 1);
+      else
+        return context.indent + (closing ? 0 : indentUnit);
+    },
+
+    lineComment: "#"
+  };
+});
+
+CodeMirror.defineMIME("application/sparql-query", "sparql");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/spreadsheet/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,42 @@
+<!doctype html>
+
+<title>CodeMirror: Spreadsheet mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="spreadsheet.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Spreadsheet</a>
+  </ul>
+</div>
+
+<article>
+  <h2>Spreadsheet mode</h2>
+  <form><textarea id="code" name="code">=IF(A1:B2, TRUE, FALSE) / 100</textarea></form>
+
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      lineNumbers: true,
+      matchBrackets: true,
+      extraKeys: {"Tab":  "indentAuto"}
+    });
+  </script>
+
+  <p><strong>MIME types defined:</strong> <code>text/x-spreadsheet</code>.</p>
+  
+  <h3>The Spreadsheet Mode</h3>
+  <p> Created by <a href="https://github.com/robertleeplummerjr">Robert Plummer</a></p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/spreadsheet/spreadsheet.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,112 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("spreadsheet", function () {
+    return {
+      startState: function () {
+        return {
+          stringType: null,
+          stack: []
+        };
+      },
+      token: function (stream, state) {
+        if (!stream) return;
+
+        //check for state changes
+        if (state.stack.length === 0) {
+          //strings
+          if ((stream.peek() == '"') || (stream.peek() == "'")) {
+            state.stringType = stream.peek();
+            stream.next(); // Skip quote
+            state.stack.unshift("string");
+          }
+        }
+
+        //return state
+        //stack has
+        switch (state.stack[0]) {
+        case "string":
+          while (state.stack[0] === "string" && !stream.eol()) {
+            if (stream.peek() === state.stringType) {
+              stream.next(); // Skip quote
+              state.stack.shift(); // Clear flag
+            } else if (stream.peek() === "\\") {
+              stream.next();
+              stream.next();
+            } else {
+              stream.match(/^.[^\\\"\']*/);
+            }
+          }
+          return "string";
+
+        case "characterClass":
+          while (state.stack[0] === "characterClass" && !stream.eol()) {
+            if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./)))
+              state.stack.shift();
+          }
+          return "operator";
+        }
+
+        var peek = stream.peek();
+
+        //no stack
+        switch (peek) {
+        case "[":
+          stream.next();
+          state.stack.unshift("characterClass");
+          return "bracket";
+        case ":":
+          stream.next();
+          return "operator";
+        case "\\":
+          if (stream.match(/\\[a-z]+/)) return "string-2";
+          else {
+            stream.next();
+            return "atom";
+          }
+        case ".":
+        case ",":
+        case ";":
+        case "*":
+        case "-":
+        case "+":
+        case "^":
+        case "<":
+        case "/":
+        case "=":
+          stream.next();
+          return "atom";
+        case "$":
+          stream.next();
+          return "builtin";
+        }
+
+        if (stream.match(/\d+/)) {
+          if (stream.match(/^\w+/)) return "error";
+          return "number";
+        } else if (stream.match(/^[a-zA-Z_]\w*/)) {
+          if (stream.match(/(?=[\(.])/, false)) return "keyword";
+          return "variable-2";
+        } else if (["[", "]", "(", ")", "{", "}"].indexOf(peek) != -1) {
+          stream.next();
+          return "bracket";
+        } else if (!stream.eatSpace()) {
+          stream.next();
+        }
+        return null;
+      }
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-spreadsheet", "spreadsheet");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sql/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,92 @@
+<!doctype html>
+
+<title>CodeMirror: SQL Mode for CodeMirror</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css" />
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="sql.js"></script>
+<link rel="stylesheet" href="../../addon/hint/show-hint.css" />
+<script src="../../addon/hint/show-hint.js"></script>
+<script src="../../addon/hint/sql-hint.js"></script>
+<style>
+.CodeMirror {
+    border-top: 1px solid black;
+    border-bottom: 1px solid black;
+}
+        </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">SQL Mode for CodeMirror</a>
+  </ul>
+</div>
+
+<article>
+<h2>SQL Mode for CodeMirror</h2>
+<form>
+            <textarea id="code" name="code">-- SQL Mode for CodeMirror
+SELECT SQL_NO_CACHE DISTINCT
+		@var1 AS `val1`, @'val2', @global.'sql_mode',
+		1.1 AS `float_val`, .14 AS `another_float`, 0.09e3 AS `int_with_esp`,
+		0xFA5 AS `hex`, x'fa5' AS `hex2`, 0b101 AS `bin`, b'101' AS `bin2`,
+		DATE '1994-01-01' AS `sql_date`, { T "1994-01-01" } AS `odbc_date`,
+		'my string', _utf8'your string', N'her string',
+        TRUE, FALSE, UNKNOWN
+	FROM DUAL
+	-- space needed after '--'
+	# 1 line comment
+	/* multiline
+	comment! */
+	LIMIT 1 OFFSET 0;
+</textarea>
+            </form>
+            <p><strong>MIME types defined:</strong>
+            <code><a href="?mime=text/x-sql">text/x-sql</a></code>,
+            <code><a href="?mime=text/x-mysql">text/x-mysql</a></code>,
+            <code><a href="?mime=text/x-mariadb">text/x-mariadb</a></code>,
+            <code><a href="?mime=text/x-cassandra">text/x-cassandra</a></code>,
+            <code><a href="?mime=text/x-plsql">text/x-plsql</a></code>,
+            <code><a href="?mime=text/x-mssql">text/x-mssql</a></code>,
+            <code><a href="?mime=text/x-hive">text/x-hive</a></code>,
+            <code><a href="?mime=text/x-pgsql">text/x-pgsql</a></code>,
+            <code><a href="?mime=text/x-gql">text/x-gql</a></code>,
+            <code><a href="?mime=text/x-gpsql">text/x-gpsql</a></code>.
+            <code><a href="?mime=text/x-esper">text/x-esper</a></code>.
+            <code><a href="?mime=text/x-sqlite">text/x-sqlite</a></code>.
+            <code><a href="?mime=text/x-sparksql">text/x-sparksql</a></code>.
+            <code><a href="?mime=text/x-trino">text/x-trino</a></code>.
+        </p>
+<script>
+window.onload = function() {
+  var mime = 'text/x-mariadb';
+  // get mime type
+  if (window.location.href.indexOf('mime=') > -1) {
+    mime = window.location.href.substr(window.location.href.indexOf('mime=') + 5);
+  }
+  window.editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+    mode: mime,
+    indentWithTabs: true,
+    smartIndent: true,
+    lineNumbers: true,
+    matchBrackets : true,
+    autofocus: true,
+    extraKeys: {"Ctrl-Space": "autocomplete"},
+    hintOptions: {tables: {
+      users: ["name", "score", "birthDate"],
+      countries: ["name", "population", "size"]
+    }}
+  });
+};
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/sql/sql.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,525 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("sql", function(config, parserConfig) {
+  var client         = parserConfig.client || {},
+      atoms          = parserConfig.atoms || {"false": true, "true": true, "null": true},
+      builtin        = parserConfig.builtin || set(defaultBuiltin),
+      keywords       = parserConfig.keywords || set(sqlKeywords),
+      operatorChars  = parserConfig.operatorChars || /^[*+\-%<>!=&|~^\/]/,
+      support        = parserConfig.support || {},
+      hooks          = parserConfig.hooks || {},
+      dateSQL        = parserConfig.dateSQL || {"date" : true, "time" : true, "timestamp" : true},
+      backslashStringEscapes = parserConfig.backslashStringEscapes !== false,
+      brackets       = parserConfig.brackets || /^[\{}\(\)\[\]]/,
+      punctuation    = parserConfig.punctuation || /^[;.,:]/
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+
+    // call hooks from the mime type
+    if (hooks[ch]) {
+      var result = hooks[ch](stream, state);
+      if (result !== false) return result;
+    }
+
+    if (support.hexNumber &&
+      ((ch == "0" && stream.match(/^[xX][0-9a-fA-F]+/))
+      || (ch == "x" || ch == "X") && stream.match(/^'[0-9a-fA-F]*'/))) {
+      // hex
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/hexadecimal-literals.html
+      return "number";
+    } else if (support.binaryNumber &&
+      (((ch == "b" || ch == "B") && stream.match(/^'[01]*'/))
+      || (ch == "0" && stream.match(/^b[01]+/)))) {
+      // bitstring
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/bit-value-literals.html
+      return "number";
+    } else if (ch.charCodeAt(0) > 47 && ch.charCodeAt(0) < 58) {
+      // numbers
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/number-literals.html
+      stream.match(/^[0-9]*(\.[0-9]+)?([eE][-+]?[0-9]+)?/);
+      support.decimallessFloat && stream.match(/^\.(?!\.)/);
+      return "number";
+    } else if (ch == "?" && (stream.eatSpace() || stream.eol() || stream.eat(";"))) {
+      // placeholders
+      return "variable-3";
+    } else if (ch == "'" || (ch == '"' && support.doubleQuote)) {
+      // strings
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/string-literals.html
+      state.tokenize = tokenLiteral(ch);
+      return state.tokenize(stream, state);
+    } else if ((((support.nCharCast && (ch == "n" || ch == "N"))
+        || (support.charsetCast && ch == "_" && stream.match(/[a-z][a-z0-9]*/i)))
+        && (stream.peek() == "'" || stream.peek() == '"'))) {
+      // charset casting: _utf8'str', N'str', n'str'
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/string-literals.html
+      return "keyword";
+    } else if (support.escapeConstant && (ch == "e" || ch == "E")
+        && (stream.peek() == "'" || (stream.peek() == '"' && support.doubleQuote))) {
+      // escape constant: E'str', e'str'
+      // ref: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-SYNTAX-STRINGS-ESCAPE
+      state.tokenize = function(stream, state) {
+        return (state.tokenize = tokenLiteral(stream.next(), true))(stream, state);
+      }
+      return "keyword";
+    } else if (support.commentSlashSlash && ch == "/" && stream.eat("/")) {
+      // 1-line comment
+      stream.skipToEnd();
+      return "comment";
+    } else if ((support.commentHash && ch == "#")
+        || (ch == "-" && stream.eat("-") && (!support.commentSpaceRequired || stream.eat(" ")))) {
+      // 1-line comments
+      // ref: https://kb.askmonty.org/en/comment-syntax/
+      stream.skipToEnd();
+      return "comment";
+    } else if (ch == "/" && stream.eat("*")) {
+      // multi-line comments
+      // ref: https://kb.askmonty.org/en/comment-syntax/
+      state.tokenize = tokenComment(1);
+      return state.tokenize(stream, state);
+    } else if (ch == ".") {
+      // .1 for 0.1
+      if (support.zerolessFloat && stream.match(/^(?:\d+(?:e[+-]?\d+)?)/i))
+        return "number";
+      if (stream.match(/^\.+/))
+        return null
+      if (stream.match(/^[\w\d_$#]+/))
+        return "variable-2";
+    } else if (operatorChars.test(ch)) {
+      // operators
+      stream.eatWhile(operatorChars);
+      return "operator";
+    } else if (brackets.test(ch)) {
+      // brackets
+      return "bracket";
+    } else if (punctuation.test(ch)) {
+      // punctuation
+      stream.eatWhile(punctuation);
+      return "punctuation";
+    } else if (ch == '{' &&
+        (stream.match(/^( )*(d|D|t|T|ts|TS)( )*'[^']*'( )*}/) || stream.match(/^( )*(d|D|t|T|ts|TS)( )*"[^"]*"( )*}/))) {
+      // dates (weird ODBC syntax)
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html
+      return "number";
+    } else {
+      stream.eatWhile(/^[_\w\d]/);
+      var word = stream.current().toLowerCase();
+      // dates (standard SQL syntax)
+      // ref: https://dev.mysql.com/doc/refman/8.0/en/date-and-time-literals.html
+      if (dateSQL.hasOwnProperty(word) && (stream.match(/^( )+'[^']*'/) || stream.match(/^( )+"[^"]*"/)))
+        return "number";
+      if (atoms.hasOwnProperty(word)) return "atom";
+      if (builtin.hasOwnProperty(word)) return "type";
+      if (keywords.hasOwnProperty(word)) return "keyword";
+      if (client.hasOwnProperty(word)) return "builtin";
+      return null;
+    }
+  }
+
+  // 'string', with char specified in quote escaped by '\'
+  function tokenLiteral(quote, backslashEscapes) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        escaped = (backslashStringEscapes || backslashEscapes) && !escaped && ch == "\\";
+      }
+      return "string";
+    };
+  }
+  function tokenComment(depth) {
+    return function(stream, state) {
+      var m = stream.match(/^.*?(\/\*|\*\/)/)
+      if (!m) stream.skipToEnd()
+      else if (m[1] == "/*") state.tokenize = tokenComment(depth + 1)
+      else if (depth > 1) state.tokenize = tokenComment(depth - 1)
+      else state.tokenize = tokenBase
+      return "comment"
+    }
+  }
+
+  function pushContext(stream, state, type) {
+    state.context = {
+      prev: state.context,
+      indent: stream.indentation(),
+      col: stream.column(),
+      type: type
+    };
+  }
+
+  function popContext(state) {
+    state.indent = state.context.indent;
+    state.context = state.context.prev;
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: tokenBase, context: null};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (state.context && state.context.align == null)
+          state.context.align = false;
+      }
+      if (state.tokenize == tokenBase && stream.eatSpace()) return null;
+
+      var style = state.tokenize(stream, state);
+      if (style == "comment") return style;
+
+      if (state.context && state.context.align == null)
+        state.context.align = true;
+
+      var tok = stream.current();
+      if (tok == "(")
+        pushContext(stream, state, ")");
+      else if (tok == "[")
+        pushContext(stream, state, "]");
+      else if (state.context && state.context.type == tok)
+        popContext(state);
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var cx = state.context;
+      if (!cx) return CodeMirror.Pass;
+      var closing = textAfter.charAt(0) == cx.type;
+      if (cx.align) return cx.col + (closing ? 0 : 1);
+      else return cx.indent + (closing ? 0 : config.indentUnit);
+    },
+
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: support.commentSlashSlash ? "//" : support.commentHash ? "#" : "--",
+    closeBrackets: "()[]{}''\"\"``",
+    config: parserConfig
+  };
+});
+
+  // `identifier`
+  function hookIdentifier(stream) {
+    // MySQL/MariaDB identifiers
+    // ref: https://dev.mysql.com/doc/refman/8.0/en/identifier-qualifiers.html
+    var ch;
+    while ((ch = stream.next()) != null) {
+      if (ch == "`" && !stream.eat("`")) return "variable-2";
+    }
+    stream.backUp(stream.current().length - 1);
+    return stream.eatWhile(/\w/) ? "variable-2" : null;
+  }
+
+  // "identifier"
+  function hookIdentifierDoublequote(stream) {
+    // Standard SQL /SQLite identifiers
+    // ref: http://web.archive.org/web/20160813185132/http://savage.net.au/SQL/sql-99.bnf.html#delimited%20identifier
+    // ref: http://sqlite.org/lang_keywords.html
+    var ch;
+    while ((ch = stream.next()) != null) {
+      if (ch == "\"" && !stream.eat("\"")) return "variable-2";
+    }
+    stream.backUp(stream.current().length - 1);
+    return stream.eatWhile(/\w/) ? "variable-2" : null;
+  }
+
+  // variable token
+  function hookVar(stream) {
+    // variables
+    // @@prefix.varName @varName
+    // varName can be quoted with ` or ' or "
+    // ref: https://dev.mysql.com/doc/refman/8.0/en/user-variables.html
+    if (stream.eat("@")) {
+      stream.match('session.');
+      stream.match('local.');
+      stream.match('global.');
+    }
+
+    if (stream.eat("'")) {
+      stream.match(/^.*'/);
+      return "variable-2";
+    } else if (stream.eat('"')) {
+      stream.match(/^.*"/);
+      return "variable-2";
+    } else if (stream.eat("`")) {
+      stream.match(/^.*`/);
+      return "variable-2";
+    } else if (stream.match(/^[0-9a-zA-Z$\.\_]+/)) {
+      return "variable-2";
+    }
+    return null;
+  };
+
+  // short client keyword token
+  function hookClient(stream) {
+    // \N means NULL
+    // ref: https://dev.mysql.com/doc/refman/8.0/en/null-values.html
+    if (stream.eat("N")) {
+        return "atom";
+    }
+    // \g, etc
+    // ref: https://dev.mysql.com/doc/refman/8.0/en/mysql-commands.html
+    return stream.match(/^[a-zA-Z.#!?]/) ? "variable-2" : null;
+  }
+
+  // these keywords are used by all SQL dialects (however, a mode can still overwrite it)
+  var sqlKeywords = "alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit ";
+
+  // turn a space-separated list into an array
+  function set(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  var defaultBuiltin = "bool boolean bit blob enum long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision real date datetime year unsigned signed decimal numeric"
+
+  // A generic SQL Mode. It's not a standard, it just tries to support what is generally supported
+  CodeMirror.defineMIME("text/x-sql", {
+    name: "sql",
+    keywords: set(sqlKeywords + "begin"),
+    builtin: set(defaultBuiltin),
+    atoms: set("false true null unknown"),
+    dateSQL: set("date time timestamp"),
+    support: set("doubleQuote binaryNumber hexNumber")
+  });
+
+  CodeMirror.defineMIME("text/x-mssql", {
+    name: "sql",
+    client: set("$partition binary_checksum checksum connectionproperty context_info current_request_id error_line error_message error_number error_procedure error_severity error_state formatmessage get_filestream_transaction_context getansinull host_id host_name isnull isnumeric min_active_rowversion newid newsequentialid rowcount_big xact_state object_id"),
+    keywords: set(sqlKeywords + "begin trigger proc view index for add constraint key primary foreign collate clustered nonclustered declare exec go if use index holdlock nolock nowait paglock readcommitted readcommittedlock readpast readuncommitted repeatableread rowlock serializable snapshot tablock tablockx updlock with"),
+    builtin: set("bigint numeric bit smallint decimal smallmoney int tinyint money float real char varchar text nchar nvarchar ntext binary varbinary image cursor timestamp hierarchyid uniqueidentifier sql_variant xml table "),
+    atoms: set("is not null like and or in left right between inner outer join all any some cross unpivot pivot exists"),
+    operatorChars: /^[*+\-%<>!=^\&|\/]/,
+    brackets: /^[\{}\(\)]/,
+    punctuation: /^[;.,:/]/,
+    backslashStringEscapes: false,
+    dateSQL: set("date datetimeoffset datetime2 smalldatetime datetime time"),
+    hooks: {
+      "@":   hookVar
+    }
+  });
+
+  CodeMirror.defineMIME("text/x-mysql", {
+    name: "sql",
+    client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
+    keywords: set(sqlKeywords + "accessible action add after algorithm all analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general get global grant grants group group_concat handler hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show signal slave slow smallint snapshot soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
+    builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
+    atoms: set("false true null unknown"),
+    operatorChars: /^[*+\-%<>!=&|^]/,
+    dateSQL: set("date time timestamp"),
+    support: set("decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
+    hooks: {
+      "@":   hookVar,
+      "`":   hookIdentifier,
+      "\\":  hookClient
+    }
+  });
+
+  CodeMirror.defineMIME("text/x-mariadb", {
+    name: "sql",
+    client: set("charset clear connect edit ego exit go help nopager notee nowarning pager print prompt quit rehash source status system tee"),
+    keywords: set(sqlKeywords + "accessible action add after algorithm all always analyze asensitive at authors auto_increment autocommit avg avg_row_length before binary binlog both btree cache call cascade cascaded case catalog_name chain change changed character check checkpoint checksum class_origin client_statistics close coalesce code collate collation collations column columns comment commit committed completion concurrent condition connection consistent constraint contains continue contributors convert cross current current_date current_time current_timestamp current_user cursor data database databases day_hour day_microsecond day_minute day_second deallocate dec declare default delay_key_write delayed delimiter des_key_file describe deterministic dev_pop dev_samp deviance diagnostics directory disable discard distinctrow div dual dumpfile each elseif enable enclosed end ends engine engines enum errors escape escaped even event events every execute exists exit explain extended fast fetch field fields first flush for force foreign found_rows full fulltext function general generated get global grant grants group group_concat handler hard hash help high_priority hosts hour_microsecond hour_minute hour_second if ignore ignore_server_ids import index index_statistics infile inner innodb inout insensitive insert_method install interval invoker isolation iterate key keys kill language last leading leave left level limit linear lines list load local localtime localtimestamp lock logs low_priority master master_heartbeat_period master_ssl_verify_server_cert masters match max max_rows maxvalue message_text middleint migrate min min_rows minute_microsecond minute_second mod mode modifies modify mutex mysql_errno natural next no no_write_to_binlog offline offset one online open optimize option optionally out outer outfile pack_keys parser partition partitions password persistent phase plugin plugins prepare preserve prev primary privileges procedure processlist profile profiles purge query quick range read read_write reads real rebuild recover references regexp relaylog release remove rename reorganize repair repeatable replace require resignal restrict resume return returns revoke right rlike rollback rollup row row_format rtree savepoint schedule schema schema_name schemas second_microsecond security sensitive separator serializable server session share show shutdown signal slave slow smallint snapshot soft soname spatial specific sql sql_big_result sql_buffer_result sql_cache sql_calc_found_rows sql_no_cache sql_small_result sqlexception sqlstate sqlwarning ssl start starting starts status std stddev stddev_pop stddev_samp storage straight_join subclass_origin sum suspend table_name table_statistics tables tablespace temporary terminated to trailing transaction trigger triggers truncate uncommitted undo uninstall unique unlock upgrade usage use use_frm user user_resources user_statistics using utc_date utc_time utc_timestamp value variables varying view views virtual warnings when while with work write xa xor year_month zerofill begin do then else loop repeat"),
+    builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text bigint int int1 int2 int3 int4 int8 integer float float4 float8 double char varbinary varchar varcharacter precision date datetime year unsigned signed numeric"),
+    atoms: set("false true null unknown"),
+    operatorChars: /^[*+\-%<>!=&|^]/,
+    dateSQL: set("date time timestamp"),
+    support: set("decimallessFloat zerolessFloat binaryNumber hexNumber doubleQuote nCharCast charsetCast commentHash commentSpaceRequired"),
+    hooks: {
+      "@":   hookVar,
+      "`":   hookIdentifier,
+      "\\":  hookClient
+    }
+  });
+
+  // provided by the phpLiteAdmin project - phpliteadmin.org
+  CodeMirror.defineMIME("text/x-sqlite", {
+    name: "sql",
+    // commands of the official SQLite client, ref: https://www.sqlite.org/cli.html#dotcmd
+    client: set("auth backup bail binary changes check clone databases dbinfo dump echo eqp exit explain fullschema headers help import imposter indexes iotrace limit lint load log mode nullvalue once open output print prompt quit read restore save scanstats schema separator session shell show stats system tables testcase timeout timer trace vfsinfo vfslist vfsname width"),
+    // ref: http://sqlite.org/lang_keywords.html
+    keywords: set(sqlKeywords + "abort action add after all analyze attach autoincrement before begin cascade case cast check collate column commit conflict constraint cross current_date current_time current_timestamp database default deferrable deferred detach each else end escape except exclusive exists explain fail for foreign full glob if ignore immediate index indexed initially inner instead intersect isnull key left limit match natural no notnull null of offset outer plan pragma primary query raise recursive references regexp reindex release rename replace restrict right rollback row savepoint temp temporary then to transaction trigger unique using vacuum view virtual when with without"),
+    // SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
+    builtin: set("bool boolean bit blob decimal double float long longblob longtext medium mediumblob mediumint mediumtext time timestamp tinyblob tinyint tinytext text clob bigint int int2 int8 integer float double char varchar date datetime year unsigned signed numeric real"),
+    // ref: http://sqlite.org/syntax/literal-value.html
+    atoms: set("null current_date current_time current_timestamp"),
+    // ref: http://sqlite.org/lang_expr.html#binaryops
+    operatorChars: /^[*+\-%<>!=&|/~]/,
+    // SQLite is weakly typed, ref: http://sqlite.org/datatype3.html. This is just a list of some common types.
+    dateSQL: set("date time timestamp datetime"),
+    support: set("decimallessFloat zerolessFloat"),
+    identifierQuote: "\"",  //ref: http://sqlite.org/lang_keywords.html
+    hooks: {
+      // bind-parameters ref:http://sqlite.org/lang_expr.html#varparam
+      "@":   hookVar,
+      ":":   hookVar,
+      "?":   hookVar,
+      "$":   hookVar,
+      // The preferred way to escape Identifiers is using double quotes, ref: http://sqlite.org/lang_keywords.html
+      "\"":   hookIdentifierDoublequote,
+      // there is also support for backticks, ref: http://sqlite.org/lang_keywords.html
+      "`":   hookIdentifier
+    }
+  });
+
+  // the query language used by Apache Cassandra is called CQL, but this mime type
+  // is called Cassandra to avoid confusion with Contextual Query Language
+  CodeMirror.defineMIME("text/x-cassandra", {
+    name: "sql",
+    client: { },
+    keywords: set("add all allow alter and any apply as asc authorize batch begin by clustering columnfamily compact consistency count create custom delete desc distinct drop each_quorum exists filtering from grant if in index insert into key keyspace keyspaces level limit local_one local_quorum modify nan norecursive nosuperuser not of on one order password permission permissions primary quorum rename revoke schema select set storage superuser table three to token truncate ttl two type unlogged update use user users using values where with writetime"),
+    builtin: set("ascii bigint blob boolean counter decimal double float frozen inet int list map static text timestamp timeuuid tuple uuid varchar varint"),
+    atoms: set("false true infinity NaN"),
+    operatorChars: /^[<>=]/,
+    dateSQL: { },
+    support: set("commentSlashSlash decimallessFloat"),
+    hooks: { }
+  });
+
+  // this is based on Peter Raganitsch's 'plsql' mode
+  CodeMirror.defineMIME("text/x-plsql", {
+    name:       "sql",
+    client:     set("appinfo arraysize autocommit autoprint autorecovery autotrace blockterminator break btitle cmdsep colsep compatibility compute concat copycommit copytypecheck define describe echo editfile embedded escape exec execute feedback flagger flush heading headsep instance linesize lno loboffset logsource long longchunksize markup native newpage numformat numwidth pagesize pause pno recsep recsepchar release repfooter repheader serveroutput shiftinout show showmode size spool sqlblanklines sqlcase sqlcode sqlcontinue sqlnumber sqlpluscompatibility sqlprefix sqlprompt sqlterminator suffix tab term termout time timing trimout trimspool ttitle underline verify version wrap"),
+    keywords:   set("abort accept access add all alter and any array arraylen as asc assert assign at attributes audit authorization avg base_table begin between binary_integer body boolean by case cast char char_base check close cluster clusters colauth column comment commit compress connect connected constant constraint crash create current currval cursor data_base database date dba deallocate debugoff debugon decimal declare default definition delay delete desc digits dispose distinct do drop else elseif elsif enable end entry escape exception exception_init exchange exclusive exists exit external fast fetch file for force form from function generic goto grant group having identified if immediate in increment index indexes indicator initial initrans insert interface intersect into is key level library like limited local lock log logging long loop master maxextents maxtrans member minextents minus mislabel mode modify multiset new next no noaudit nocompress nologging noparallel not nowait number_base object of off offline on online only open option or order out package parallel partition pctfree pctincrease pctused pls_integer positive positiven pragma primary prior private privileges procedure public raise range raw read rebuild record ref references refresh release rename replace resource restrict return returning returns reverse revoke rollback row rowid rowlabel rownum rows run savepoint schema segment select separate session set share snapshot some space split sql start statement storage subtype successful synonym tabauth table tables tablespace task terminate then to trigger truncate type union unique unlimited unrecoverable unusable update use using validate value values variable view views when whenever where while with work"),
+    builtin:    set("abs acos add_months ascii asin atan atan2 average bfile bfilename bigserial bit blob ceil character chartorowid chr clob concat convert cos cosh count dec decode deref dual dump dup_val_on_index empty error exp false float floor found glb greatest hextoraw initcap instr instrb int integer isopen last_day least length lengthb ln lower lpad ltrim lub make_ref max min mlslabel mod months_between natural naturaln nchar nclob new_time next_day nextval nls_charset_decl_len nls_charset_id nls_charset_name nls_initcap nls_lower nls_sort nls_upper nlssort no_data_found notfound null number numeric nvarchar2 nvl others power rawtohex real reftohex round rowcount rowidtochar rowtype rpad rtrim serial sign signtype sin sinh smallint soundex sqlcode sqlerrm sqrt stddev string substr substrb sum sysdate tan tanh to_char text to_date to_label to_multi_byte to_number to_single_byte translate true trunc uid unlogged upper user userenv varchar varchar2 variance varying vsize xml"),
+    operatorChars: /^[*\/+\-%<>!=~]/,
+    dateSQL:    set("date time timestamp"),
+    support:    set("doubleQuote nCharCast zerolessFloat binaryNumber hexNumber")
+  });
+
+  // Created to support specific hive keywords
+  CodeMirror.defineMIME("text/x-hive", {
+    name: "sql",
+    keywords: set("select alter $elem$ $key$ $value$ add after all analyze and archive as asc before between binary both bucket buckets by cascade case cast change cluster clustered clusterstatus collection column columns comment compute concatenate continue create cross cursor data database databases dbproperties deferred delete delimited desc describe directory disable distinct distribute drop else enable end escaped exclusive exists explain export extended external fetch fields fileformat first format formatted from full function functions grant group having hold_ddltime idxproperties if import in index indexes inpath inputdriver inputformat insert intersect into is items join keys lateral left like limit lines load local location lock locks mapjoin materialized minus msck no_drop nocompress not of offline on option or order out outer outputdriver outputformat overwrite partition partitioned partitions percent plus preserve procedure purge range rcfile read readonly reads rebuild recordreader recordwriter recover reduce regexp rename repair replace restrict revoke right rlike row schema schemas semi sequencefile serde serdeproperties set shared show show_database sort sorted ssl statistics stored streamtable table tables tablesample tblproperties temporary terminated textfile then tmp to touch transform trigger unarchive undo union uniquejoin unlock update use using utc utc_tmestamp view when where while with admin authorization char compact compactions conf cube current current_date current_timestamp day decimal defined dependency directories elem_type exchange file following for grouping hour ignore inner interval jar less logical macro minute month more none noscan over owner partialscan preceding pretty principals protection reload rewrite role roles rollup rows second server sets skewed transactions truncate unbounded unset uri user values window year"),
+    builtin: set("bool boolean long timestamp tinyint smallint bigint int float double date datetime unsigned string array struct map uniontype key_type utctimestamp value_type varchar"),
+    atoms: set("false true null unknown"),
+    operatorChars: /^[*+\-%<>!=]/,
+    dateSQL: set("date timestamp"),
+    support: set("doubleQuote binaryNumber hexNumber")
+  });
+
+  CodeMirror.defineMIME("text/x-pgsql", {
+    name: "sql",
+    client: set("source"),
+    // For PostgreSQL - https://www.postgresql.org/docs/11/sql-keywords-appendix.html
+    // For pl/pgsql lang - https://github.com/postgres/postgres/blob/REL_11_2/src/pl/plpgsql/src/pl_scanner.c
+    keywords: set(sqlKeywords + "a abort abs absent absolute access according action ada add admin after aggregate alias all allocate also alter always analyse analyze and any are array array_agg array_max_cardinality as asc asensitive assert assertion assignment asymmetric at atomic attach attribute attributes authorization avg backward base64 before begin begin_frame begin_partition bernoulli between bigint binary bit bit_length blob blocked bom boolean both breadth by c cache call called cardinality cascade cascaded case cast catalog catalog_name ceil ceiling chain char char_length character character_length character_set_catalog character_set_name character_set_schema characteristics characters check checkpoint class class_origin clob close cluster coalesce cobol collate collation collation_catalog collation_name collation_schema collect column column_name columns command_function command_function_code comment comments commit committed concurrently condition condition_number configuration conflict connect connection connection_name constant constraint constraint_catalog constraint_name constraint_schema constraints constructor contains content continue control conversion convert copy corr corresponding cost count covar_pop covar_samp create cross csv cube cume_dist current current_catalog current_date current_default_transform_group current_path current_role current_row current_schema current_time current_timestamp current_transform_group_for_type current_user cursor cursor_name cycle data database datalink datatype date datetime_interval_code datetime_interval_precision day db deallocate debug dec decimal declare default defaults deferrable deferred defined definer degree delete delimiter delimiters dense_rank depends depth deref derived desc describe descriptor detach detail deterministic diagnostics dictionary disable discard disconnect dispatch distinct dlnewcopy dlpreviouscopy dlurlcomplete dlurlcompleteonly dlurlcompletewrite dlurlpath dlurlpathonly dlurlpathwrite dlurlscheme dlurlserver dlvalue do document domain double drop dump dynamic dynamic_function dynamic_function_code each element else elseif elsif empty enable encoding encrypted end end_frame end_partition endexec enforced enum equals errcode error escape event every except exception exclude excluding exclusive exec execute exists exit exp explain expression extension external extract false family fetch file filter final first first_value flag float floor following for force foreach foreign fortran forward found frame_row free freeze from fs full function functions fusion g general generated get global go goto grant granted greatest group grouping groups handler having header hex hierarchy hint hold hour id identity if ignore ilike immediate immediately immutable implementation implicit import in include including increment indent index indexes indicator info inherit inherits initially inline inner inout input insensitive insert instance instantiable instead int integer integrity intersect intersection interval into invoker is isnull isolation join k key key_member key_type label lag language large last last_value lateral lead leading leakproof least left length level library like like_regex limit link listen ln load local localtime localtimestamp location locator lock locked log logged loop lower m map mapping match matched materialized max max_cardinality maxvalue member merge message message_length message_octet_length message_text method min minute minvalue mod mode modifies module month more move multiset mumps name names namespace national natural nchar nclob nesting new next nfc nfd nfkc nfkd nil no none normalize normalized not nothing notice notify notnull nowait nth_value ntile null nullable nullif nulls number numeric object occurrences_regex octet_length octets of off offset oids old on only open operator option options or order ordering ordinality others out outer output over overlaps overlay overriding owned owner p pad parallel parameter parameter_mode parameter_name parameter_ordinal_position parameter_specific_catalog parameter_specific_name parameter_specific_schema parser partial partition pascal passing passthrough password path percent percent_rank percentile_cont percentile_disc perform period permission pg_context pg_datatype_name pg_exception_context pg_exception_detail pg_exception_hint placing plans pli policy portion position position_regex power precedes preceding precision prepare prepared preserve primary print_strict_params prior privileges procedural procedure procedures program public publication query quote raise range rank read reads real reassign recheck recovery recursive ref references referencing refresh regr_avgx regr_avgy regr_count regr_intercept regr_r2 regr_slope regr_sxx regr_sxy regr_syy reindex relative release rename repeatable replace replica requiring reset respect restart restore restrict result result_oid return returned_cardinality returned_length returned_octet_length returned_sqlstate returning returns reverse revoke right role rollback rollup routine routine_catalog routine_name routine_schema routines row row_count row_number rows rowtype rule savepoint scale schema schema_name schemas scope scope_catalog scope_name scope_schema scroll search second section security select selective self sensitive sequence sequences serializable server server_name session session_user set setof sets share show similar simple size skip slice smallint snapshot some source space specific specific_name specifictype sql sqlcode sqlerror sqlexception sqlstate sqlwarning sqrt stable stacked standalone start state statement static statistics stddev_pop stddev_samp stdin stdout storage strict strip structure style subclass_origin submultiset subscription substring substring_regex succeeds sum symmetric sysid system system_time system_user t table table_name tables tablesample tablespace temp template temporary text then ties time timestamp timezone_hour timezone_minute to token top_level_count trailing transaction transaction_active transactions_committed transactions_rolled_back transform transforms translate translate_regex translation treat trigger trigger_catalog trigger_name trigger_schema trim trim_array true truncate trusted type types uescape unbounded uncommitted under unencrypted union unique unknown unlink unlisten unlogged unnamed unnest until untyped update upper uri usage use_column use_variable user user_defined_type_catalog user_defined_type_code user_defined_type_name user_defined_type_schema using vacuum valid validate validator value value_of values var_pop var_samp varbinary varchar variable_conflict variadic varying verbose version versioning view views volatile warning when whenever where while whitespace width_bucket window with within without work wrapper write xml xmlagg xmlattributes xmlbinary xmlcast xmlcomment xmlconcat xmldeclaration xmldocument xmlelement xmlexists xmlforest xmliterate xmlnamespaces xmlparse xmlpi xmlquery xmlroot xmlschema xmlserialize xmltable xmltext xmlvalidate year yes zone"),
+    // https://www.postgresql.org/docs/11/datatype.html
+    builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time zone timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
+    atoms: set("false true null unknown"),
+    operatorChars: /^[*\/+\-%<>!=&|^\/#@?~]/,
+    backslashStringEscapes: false,
+    dateSQL: set("date time timestamp"),
+    support: set("decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast escapeConstant")
+  });
+
+  // Google's SQL-like query language, GQL
+  CodeMirror.defineMIME("text/x-gql", {
+    name: "sql",
+    keywords: set("ancestor and asc by contains desc descendant distinct from group has in is limit offset on order select superset where"),
+    atoms: set("false true"),
+    builtin: set("blob datetime first key __key__ string integer double boolean null"),
+    operatorChars: /^[*+\-%<>!=]/
+  });
+
+  // Greenplum
+  CodeMirror.defineMIME("text/x-gpsql", {
+    name: "sql",
+    client: set("source"),
+    //https://github.com/greenplum-db/gpdb/blob/master/src/include/parser/kwlist.h
+    keywords: set("abort absolute access action active add admin after aggregate all also alter always analyse analyze and any array as asc assertion assignment asymmetric at authorization backward before begin between bigint binary bit boolean both by cache called cascade cascaded case cast chain char character characteristics check checkpoint class close cluster coalesce codegen collate column comment commit committed concurrency concurrently configuration connection constraint constraints contains content continue conversion copy cost cpu_rate_limit create createdb createexttable createrole createuser cross csv cube current current_catalog current_date current_role current_schema current_time current_timestamp current_user cursor cycle data database day deallocate dec decimal declare decode default defaults deferrable deferred definer delete delimiter delimiters deny desc dictionary disable discard distinct distributed do document domain double drop dxl each else enable encoding encrypted end enum errors escape every except exchange exclude excluding exclusive execute exists explain extension external extract false family fetch fields filespace fill filter first float following for force foreign format forward freeze from full function global grant granted greatest group group_id grouping handler hash having header hold host hour identity if ignore ilike immediate immutable implicit in including inclusive increment index indexes inherit inherits initially inline inner inout input insensitive insert instead int integer intersect interval into invoker is isnull isolation join key language large last leading least left level like limit list listen load local localtime localtimestamp location lock log login mapping master match maxvalue median merge minute minvalue missing mode modifies modify month move name names national natural nchar new newline next no nocreatedb nocreateexttable nocreaterole nocreateuser noinherit nologin none noovercommit nosuperuser not nothing notify notnull nowait null nullif nulls numeric object of off offset oids old on only operator option options or order ordered others out outer over overcommit overlaps overlay owned owner parser partial partition partitions passing password percent percentile_cont percentile_disc placing plans position preceding precision prepare prepared preserve primary prior privileges procedural procedure protocol queue quote randomly range read readable reads real reassign recheck recursive ref references reindex reject relative release rename repeatable replace replica reset resource restart restrict returning returns revoke right role rollback rollup rootpartition row rows rule savepoint scatter schema scroll search second security segment select sequence serializable session session_user set setof sets share show similar simple smallint some split sql stable standalone start statement statistics stdin stdout storage strict strip subpartition subpartitions substring superuser symmetric sysid system table tablespace temp template temporary text then threshold ties time timestamp to trailing transaction treat trigger trim true truncate trusted type unbounded uncommitted unencrypted union unique unknown unlisten until update user using vacuum valid validation validator value values varchar variadic varying verbose version view volatile web when where whitespace window with within without work writable write xml xmlattributes xmlconcat xmlelement xmlexists xmlforest xmlparse xmlpi xmlroot xmlserialize year yes zone"),
+    builtin: set("bigint int8 bigserial serial8 bit varying varbit boolean bool box bytea character char varchar cidr circle date double precision float float8 inet integer int int4 interval json jsonb line lseg macaddr macaddr8 money numeric decimal path pg_lsn point polygon real float4 smallint int2 smallserial serial2 serial serial4 text time without zone with timetz timestamp timestamptz tsquery tsvector txid_snapshot uuid xml"),
+    atoms: set("false true null unknown"),
+    operatorChars: /^[*+\-%<>!=&|^\/#@?~]/,
+    dateSQL: set("date time timestamp"),
+    support: set("decimallessFloat zerolessFloat binaryNumber hexNumber nCharCast charsetCast")
+  });
+
+  // Spark SQL
+  CodeMirror.defineMIME("text/x-sparksql", {
+    name: "sql",
+    keywords: set("add after all alter analyze and anti archive array as asc at between bucket buckets by cache cascade case cast change clear cluster clustered codegen collection column columns comment commit compact compactions compute concatenate cost create cross cube current current_date current_timestamp database databases data dbproperties defined delete delimited deny desc describe dfs directories distinct distribute drop else end escaped except exchange exists explain export extended external false fields fileformat first following for format formatted from full function functions global grant group grouping having if ignore import in index indexes inner inpath inputformat insert intersect interval into is items join keys last lateral lazy left like limit lines list load local location lock locks logical macro map minus msck natural no not null nulls of on optimize option options or order out outer outputformat over overwrite partition partitioned partitions percent preceding principals purge range recordreader recordwriter recover reduce refresh regexp rename repair replace reset restrict revoke right rlike role roles rollback rollup row rows schema schemas select semi separated serde serdeproperties set sets show skewed sort sorted start statistics stored stratify struct table tables tablesample tblproperties temp temporary terminated then to touch transaction transactions transform true truncate unarchive unbounded uncache union unlock unset use using values view when where window with"),
+    builtin: set("abs acos acosh add_months aggregate and any approx_count_distinct approx_percentile array array_contains array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_repeat array_sort array_union arrays_overlap arrays_zip ascii asin asinh assert_true atan atan2 atanh avg base64 between bigint bin binary bit_and bit_count bit_get bit_length bit_or bit_xor bool_and bool_or boolean bround btrim cardinality case cast cbrt ceil ceiling char char_length character_length chr coalesce collect_list collect_set concat concat_ws conv corr cos cosh cot count count_if count_min_sketch covar_pop covar_samp crc32 cume_dist current_catalog current_database current_date current_timestamp current_timezone current_user date date_add date_format date_from_unix_date date_part date_sub date_trunc datediff day dayofmonth dayofweek dayofyear decimal decode degrees delimited dense_rank div double e element_at elt encode every exists exp explode explode_outer expm1 extract factorial filter find_in_set first first_value flatten float floor forall format_number format_string from_csv from_json from_unixtime from_utc_timestamp get_json_object getbit greatest grouping grouping_id hash hex hour hypot if ifnull in initcap inline inline_outer input_file_block_length input_file_block_start input_file_name inputformat instr int isnan isnotnull isnull java_method json_array_length json_object_keys json_tuple kurtosis lag last last_day last_value lcase lead least left length levenshtein like ln locate log log10 log1p log2 lower lpad ltrim make_date make_dt_interval make_interval make_timestamp make_ym_interval map map_concat map_entries map_filter map_from_arrays map_from_entries map_keys map_values map_zip_with max max_by md5 mean min min_by minute mod monotonically_increasing_id month months_between named_struct nanvl negative next_day not now nth_value ntile nullif nvl nvl2 octet_length or outputformat overlay parse_url percent_rank percentile percentile_approx pi pmod posexplode posexplode_outer position positive pow power printf quarter radians raise_error rand randn random rank rcfile reflect regexp regexp_extract regexp_extract_all regexp_like regexp_replace repeat replace reverse right rint rlike round row_number rpad rtrim schema_of_csv schema_of_json second sentences sequence sequencefile serde session_window sha sha1 sha2 shiftleft shiftright shiftrightunsigned shuffle sign signum sin sinh size skewness slice smallint some sort_array soundex space spark_partition_id split sqrt stack std stddev stddev_pop stddev_samp str_to_map string struct substr substring substring_index sum tan tanh textfile timestamp timestamp_micros timestamp_millis timestamp_seconds tinyint to_csv to_date to_json to_timestamp to_unix_timestamp to_utc_timestamp transform transform_keys transform_values translate trim trunc try_add try_divide typeof ucase unbase64 unhex uniontype unix_date unix_micros unix_millis unix_seconds unix_timestamp upper uuid var_pop var_samp variance version weekday weekofyear when width_bucket window xpath xpath_boolean xpath_double xpath_float xpath_int xpath_long xpath_number xpath_short xpath_string xxhash64 year zip_with"),
+    atoms: set("false true null"),
+    operatorChars: /^[*\/+\-%<>!=~&|^]/,
+    dateSQL: set("date time timestamp"),
+    support: set("doubleQuote zerolessFloat")
+  });
+
+  // Esper
+  CodeMirror.defineMIME("text/x-esper", {
+    name: "sql",
+    client: set("source"),
+    // http://www.espertech.com/esper/release-5.5.0/esper-reference/html/appendix_keywords.html
+    keywords: set("alter and as asc between by count create delete desc distinct drop from group having in insert into is join like not on or order select set table union update values where limit after all and as at asc avedev avg between by case cast coalesce count create current_timestamp day days delete define desc distinct else end escape events every exists false first from full group having hour hours in inner insert instanceof into irstream is istream join last lastweekday left limit like max match_recognize matches median measures metadatasql min minute minutes msec millisecond milliseconds not null offset on or order outer output partition pattern prev prior regexp retain-union retain-intersection right rstream sec second seconds select set some snapshot sql stddev sum then true unidirectional until update variable weekday when where window"),
+    builtin: {},
+    atoms: set("false true null"),
+    operatorChars: /^[*+\-%<>!=&|^\/#@?~]/,
+    dateSQL: set("time"),
+    support: set("decimallessFloat zerolessFloat binaryNumber hexNumber")
+  });
+
+  // Trino (formerly known as Presto)
+  CodeMirror.defineMIME("text/x-trino", {
+    name: "sql",
+    // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/core/trino-parser/src/main/antlr4/io/trino/sql/parser/SqlBase.g4#L859-L1129
+    // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/docs/src/main/sphinx/functions/list.rst
+    keywords: set("abs absent acos add admin after all all_match alter analyze and any any_match approx_distinct approx_most_frequent approx_percentile approx_set arbitrary array_agg array_distinct array_except array_intersect array_join array_max array_min array_position array_remove array_sort array_union arrays_overlap as asc asin at at_timezone atan atan2 authorization avg bar bernoulli beta_cdf between bing_tile bing_tile_at bing_tile_coordinates bing_tile_polygon bing_tile_quadkey bing_tile_zoom_level bing_tiles_around bit_count bitwise_and bitwise_and_agg bitwise_left_shift bitwise_not bitwise_or bitwise_or_agg bitwise_right_shift bitwise_right_shift_arithmetic bitwise_xor bool_and bool_or both by call cardinality cascade case cast catalogs cbrt ceil ceiling char2hexint checksum chr classify coalesce codepoint column columns combinations comment commit committed concat concat_ws conditional constraint contains contains_sequence convex_hull_agg copartition corr cos cosh cosine_similarity count count_if covar_pop covar_samp crc32 create cross cube cume_dist current current_catalog current_date current_groups current_path current_role current_schema current_time current_timestamp current_timezone current_user data date_add date_diff date_format date_parse date_trunc day day_of_month day_of_week day_of_year deallocate default define definer degrees delete dense_rank deny desc describe descriptor distinct distributed dow doy drop e element_at else empty empty_approx_set encoding end error escape evaluate_classifier_predictions every except excluding execute exists exp explain extract false features fetch filter final first first_value flatten floor following for format format_datetime format_number from from_base from_base32 from_base64 from_base64url from_big_endian_32 from_big_endian_64 from_encoded_polyline from_geojson_geometry from_hex from_ieee754_32 from_ieee754_64 from_iso8601_date from_iso8601_timestamp from_iso8601_timestamp_nanos from_unixtime from_unixtime_nanos from_utf8 full functions geometric_mean geometry_from_hadoop_shape geometry_invalid_reason geometry_nearest_points geometry_to_bing_tiles geometry_union geometry_union_agg grant granted grants graphviz great_circle_distance greatest group grouping groups hamming_distance hash_counts having histogram hmac_md5 hmac_sha1 hmac_sha256 hmac_sha512 hour human_readable_seconds if ignore in including index infinity initial inner input insert intersect intersection_cardinality into inverse_beta_cdf inverse_normal_cdf invoker io is is_finite is_infinite is_json_scalar is_nan isolation jaccard_index join json_array json_array_contains json_array_get json_array_length json_exists json_extract json_extract_scalar json_format json_object json_parse json_query json_size json_value keep key keys kurtosis lag last last_day_of_month last_value lateral lead leading learn_classifier learn_libsvm_classifier learn_libsvm_regressor learn_regressor least left length level levenshtein_distance like limit line_interpolate_point line_interpolate_points line_locate_point listagg ln local localtime localtimestamp log log10 log2 logical lower lpad ltrim luhn_check make_set_digest map_agg map_concat map_entries map_filter map_from_entries map_keys map_union map_values map_zip_with match match_recognize matched matches materialized max max_by md5 measures merge merge_set_digest millisecond min min_by minute mod month multimap_agg multimap_from_entries murmur3 nan natural next nfc nfd nfkc nfkd ngrams no none none_match normal_cdf normalize not now nth_value ntile null nullif nulls numeric_histogram object objectid_timestamp of offset omit on one only option or order ordinality outer output over overflow parse_data_size parse_datetime parse_duration partition partitions passing past path pattern per percent_rank permute pi position pow power preceding prepare privileges properties prune qdigest_agg quarter quotes radians rand random range rank read recursive reduce reduce_agg refresh regexp_count regexp_extract regexp_extract_all regexp_like regexp_position regexp_replace regexp_split regr_intercept regr_slope regress rename render repeat repeatable replace reset respect restrict returning reverse revoke rgb right role roles rollback rollup round row_number rows rpad rtrim running scalar schema schemas second security seek select sequence serializable session set sets sha1 sha256 sha512 show shuffle sign simplify_geometry sin skewness skip slice some soundex spatial_partitioning spatial_partitions split split_part split_to_map split_to_multimap spooky_hash_v2_32 spooky_hash_v2_64 sqrt st_area st_asbinary st_astext st_boundary st_buffer st_centroid st_contains st_convexhull st_coorddim st_crosses st_difference st_dimension st_disjoint st_distance st_endpoint st_envelope st_envelopeaspts st_equals st_exteriorring st_geometries st_geometryfromtext st_geometryn st_geometrytype st_geomfrombinary st_interiorringn st_interiorrings st_intersection st_intersects st_isclosed st_isempty st_isring st_issimple st_isvalid st_length st_linefromtext st_linestring st_multipoint st_numgeometries st_numinteriorring st_numpoints st_overlaps st_point st_pointn st_points st_polygon st_relate st_startpoint st_symdifference st_touches st_union st_within st_x st_xmax st_xmin st_y st_ymax st_ymin start starts_with stats stddev stddev_pop stddev_samp string strpos subset substr substring sum system table tables tablesample tan tanh tdigest_agg text then ties timestamp_objectid timezone_hour timezone_minute to to_base to_base32 to_base64 to_base64url to_big_endian_32 to_big_endian_64 to_char to_date to_encoded_polyline to_geojson_geometry to_geometry to_hex to_ieee754_32 to_ieee754_64 to_iso8601 to_milliseconds to_spherical_geography to_timestamp to_unixtime to_utf8 trailing transaction transform transform_keys transform_values translate trim trim_array true truncate try try_cast type typeof uescape unbounded uncommitted unconditional union unique unknown unmatched unnest update upper url_decode url_encode url_extract_fragment url_extract_host url_extract_parameter url_extract_path url_extract_port url_extract_protocol url_extract_query use user using utf16 utf32 utf8 validate value value_at_quantile values values_at_quantiles var_pop var_samp variance verbose version view week week_of_year when where width_bucket wilson_interval_lower wilson_interval_upper window with with_timezone within without word_stem work wrapper write xxhash64 year year_of_week yow zip zip_with"),
+    // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/core/trino-main/src/main/java/io/trino/metadata/TypeRegistry.java#L131-L168
+    // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-ml/src/main/java/io/trino/plugin/ml/MLPlugin.java#L35
+    // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoPlugin.java#L32
+    // https://github.com/trinodb/trino/blob/bc7a4eeedde28684c7ae6f74cefcaf7c6e782174/plugin/trino-geospatial/src/main/java/io/trino/plugin/geospatial/GeoPlugin.java#L37
+    builtin: set("array bigint bingtile boolean char codepoints color date decimal double function geometry hyperloglog int integer interval ipaddress joniregexp json json2016 jsonpath kdbtree likepattern map model objectid p4hyperloglog precision qdigest re2jregexp real regressor row setdigest smallint sphericalgeography tdigest time timestamp tinyint uuid varbinary varchar zone"),
+    atoms: set("false true null unknown"),
+    // https://trino.io/docs/current/functions/list.html#id1
+    operatorChars: /^[[\]|<>=!\-+*/%]/,
+    dateSQL: set("date time timestamp zone"),
+    // hexNumber is necessary for VARBINARY literals, e.g. X'65683F'
+    // but it also enables 0xFF hex numbers, which Trino doesn't support.
+    support: set("decimallessFloat zerolessFloat hexNumber")
+  });
+});
+
+/*
+  How Properties of Mime Types are used by SQL Mode
+  =================================================
+
+  keywords:
+    A list of keywords you want to be highlighted.
+  builtin:
+    A list of builtin types you want to be highlighted (if you want types to be of class "builtin" instead of "keyword").
+  operatorChars:
+    All characters that must be handled as operators.
+  client:
+    Commands parsed and executed by the client (not the server).
+  support:
+    A list of supported syntaxes which are not common, but are supported by more than 1 DBMS.
+    * zerolessFloat: .1
+    * decimallessFloat: 1.
+    * hexNumber: X'01AF' X'01af' x'01AF' x'01af' 0x01AF 0x01af
+    * binaryNumber: b'01' B'01' 0b01
+    * doubleQuote: "string"
+    * escapeConstant: E''
+    * nCharCast: N'string'
+    * charsetCast: _utf8'string'
+    * commentHash: use # char for comments
+    * commentSlashSlash: use // for comments
+    * commentSpaceRequired: require a space after -- for comments
+  atoms:
+    Keywords that must be highlighted as atoms,. Some DBMS's support more atoms than others:
+    UNKNOWN, INFINITY, UNDERFLOW, NaN...
+  dateSQL:
+    Used for date/time SQL standard syntax, because not all DBMS's support same temporal types.
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/stex/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,116 @@
+<!doctype html>
+
+<title>CodeMirror: sTeX mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="stex.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">sTeX</a>
+  </ul>
+</div>
+
+<article>
+<h2>sTeX mode</h2>
+<form><textarea id="code" name="code">
+\begin{module}[id=bbt-size]
+\importmodule[balanced-binary-trees]{balanced-binary-trees}
+\importmodule[\KWARCslides{dmath/en/cardinality}]{cardinality}
+
+\begin{frame}
+  \frametitle{Size Lemma for Balanced Trees}
+  \begin{itemize}
+  \item
+    \begin{assertion}[id=size-lemma,type=lemma] 
+    Let $G=\tup{V,E}$ be a \termref[cd=binary-trees]{balanced binary tree} 
+    of \termref[cd=graph-depth,name=vertex-depth]{depth}$n>i$, then the set
+     $\defeq{\livar{V}i}{\setst{\inset{v}{V}}{\gdepth{v} = i}}$ of
+    \termref[cd=graphs-intro,name=node]{nodes} at 
+    \termref[cd=graph-depth,name=vertex-depth]{depth} $i$ has
+    \termref[cd=cardinality,name=cardinality]{cardinality} $\power2i$.
+   \end{assertion}
+  \item
+    \begin{sproof}[id=size-lemma-pf,proofend=,for=size-lemma]{via induction over the depth $i$.}
+      \begin{spfcases}{We have to consider two cases}
+        \begin{spfcase}{$i=0$}
+          \begin{spfstep}[display=flow]
+            then $\livar{V}i=\set{\livar{v}r}$, where $\livar{v}r$ is the root, so
+            $\eq{\card{\livar{V}0},\card{\set{\livar{v}r}},1,\power20}$.
+          \end{spfstep}
+        \end{spfcase}
+        \begin{spfcase}{$i>0$}
+          \begin{spfstep}[display=flow]
+           then $\livar{V}{i-1}$ contains $\power2{i-1}$ vertexes 
+           \begin{justification}[method=byIH](IH)\end{justification}
+          \end{spfstep}
+          \begin{spfstep}
+           By the \begin{justification}[method=byDef]definition of a binary
+              tree\end{justification}, each $\inset{v}{\livar{V}{i-1}}$ is a leaf or has
+            two children that are at depth $i$.
+          \end{spfstep}
+          \begin{spfstep}
+           As $G$ is \termref[cd=balanced-binary-trees,name=balanced-binary-tree]{balanced} and $\gdepth{G}=n>i$, $\livar{V}{i-1}$ cannot contain
+            leaves.
+          \end{spfstep}
+          \begin{spfstep}[type=conclusion]
+           Thus $\eq{\card{\livar{V}i},{\atimes[cdot]{2,\card{\livar{V}{i-1}}}},{\atimes[cdot]{2,\power2{i-1}}},\power2i}$.
+          \end{spfstep}
+        \end{spfcase}
+      \end{spfcases}
+    \end{sproof}
+  \item 
+    \begin{assertion}[id=fbbt,type=corollary]	
+      A fully balanced tree of depth $d$ has $\power2{d+1}-1$ nodes.
+    \end{assertion}
+  \item
+      \begin{sproof}[for=fbbt,id=fbbt-pf]{}
+        \begin{spfstep}
+          Let $\defeq{G}{\tup{V,E}}$ be a fully balanced tree
+        \end{spfstep}
+        \begin{spfstep}
+          Then $\card{V}=\Sumfromto{i}1d{\power2i}= \power2{d+1}-1$.
+        \end{spfstep}
+      \end{sproof}
+    \end{itemize}
+  \end{frame}
+\begin{note}
+  \begin{omtext}[type=conclusion,for=binary-tree]
+    This shows that balanced binary trees grow in breadth very quickly, a consequence of
+    this is that they are very shallow (and this compute very fast), which is the essence of
+    the next result.
+  \end{omtext}
+\end{note}
+\end{module}
+
+%%% Local Variables: 
+%%% mode: LaTeX
+%%% TeX-master: "all"
+%%% End: \end{document}
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p>sTeX mode supports this option:</p>
+    <d1>
+      <dt><code>inMathMode: boolean</code></dt>
+      <dd>Whether to start parsing in math mode (default: <code>false</code>).</dd>
+    </d1>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-stex</code>.</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#stex_*">normal</a>,  <a href="../../test/index.html#verbose,stex_*">verbose</a>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/stex/stex.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,264 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+ * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
+ * Licence: MIT
+ */
+
+(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.defineMode("stex", function(_config, parserConfig) {
+    "use strict";
+
+    function pushCommand(state, command) {
+      state.cmdState.push(command);
+    }
+
+    function peekCommand(state) {
+      if (state.cmdState.length > 0) {
+        return state.cmdState[state.cmdState.length - 1];
+      } else {
+        return null;
+      }
+    }
+
+    function popCommand(state) {
+      var plug = state.cmdState.pop();
+      if (plug) {
+        plug.closeBracket();
+      }
+    }
+
+    // returns the non-default plugin closest to the end of the list
+    function getMostPowerful(state) {
+      var context = state.cmdState;
+      for (var i = context.length - 1; i >= 0; i--) {
+        var plug = context[i];
+        if (plug.name == "DEFAULT") {
+          continue;
+        }
+        return plug;
+      }
+      return { styleIdentifier: function() { return null; } };
+    }
+
+    function addPluginPattern(pluginName, cmdStyle, styles) {
+      return function () {
+        this.name = pluginName;
+        this.bracketNo = 0;
+        this.style = cmdStyle;
+        this.styles = styles;
+        this.argument = null;   // \begin and \end have arguments that follow. These are stored in the plugin
+
+        this.styleIdentifier = function() {
+          return this.styles[this.bracketNo - 1] || null;
+        };
+        this.openBracket = function() {
+          this.bracketNo++;
+          return "bracket";
+        };
+        this.closeBracket = function() {};
+      };
+    }
+
+    var plugins = {};
+
+    plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
+    plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
+    plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
+    plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
+    plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
+
+    plugins["label"    ] = addPluginPattern("label"    , "tag", ["atom"]);
+    plugins["ref"      ] = addPluginPattern("ref"      , "tag", ["atom"]);
+    plugins["eqref"    ] = addPluginPattern("eqref"    , "tag", ["atom"]);
+    plugins["cite"     ] = addPluginPattern("cite"     , "tag", ["atom"]);
+    plugins["bibitem"  ] = addPluginPattern("bibitem"  , "tag", ["atom"]);
+    plugins["Bibitem"  ] = addPluginPattern("Bibitem"  , "tag", ["atom"]);
+    plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
+
+    plugins["DEFAULT"] = function () {
+      this.name = "DEFAULT";
+      this.style = "tag";
+
+      this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
+    };
+
+    function setState(state, f) {
+      state.f = f;
+    }
+
+    // called when in a normal (no environment) context
+    function normal(source, state) {
+      var plug;
+      // Do we look like '\command' ?  If so, attempt to apply the plugin 'command'
+      if (source.match(/^\\[a-zA-Z@]+/)) {
+        var cmdName = source.current().slice(1);
+        plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
+        plug = new plug();
+        pushCommand(state, plug);
+        setState(state, beginParams);
+        return plug.style;
+      }
+
+      // escape characters
+      if (source.match(/^\\[$&%#{}_]/)) {
+        return "tag";
+      }
+
+      // white space control characters
+      if (source.match(/^\\[,;!\/\\]/)) {
+        return "tag";
+      }
+
+      // find if we're starting various math modes
+      if (source.match("\\[")) {
+        setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
+        return "keyword";
+      }
+      if (source.match("\\(")) {
+        setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
+        return "keyword";
+      }
+      if (source.match("$$")) {
+        setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
+        return "keyword";
+      }
+      if (source.match("$")) {
+        setState(state, function(source, state){ return inMathMode(source, state, "$"); });
+        return "keyword";
+      }
+
+      var ch = source.next();
+      if (ch == "%") {
+        source.skipToEnd();
+        return "comment";
+      } else if (ch == '}' || ch == ']') {
+        plug = peekCommand(state);
+        if (plug) {
+          plug.closeBracket(ch);
+          setState(state, beginParams);
+        } else {
+          return "error";
+        }
+        return "bracket";
+      } else if (ch == '{' || ch == '[') {
+        plug = plugins["DEFAULT"];
+        plug = new plug();
+        pushCommand(state, plug);
+        return "bracket";
+      } else if (/\d/.test(ch)) {
+        source.eatWhile(/[\w.%]/);
+        return "atom";
+      } else {
+        source.eatWhile(/[\w\-_]/);
+        plug = getMostPowerful(state);
+        if (plug.name == 'begin') {
+          plug.argument = source.current();
+        }
+        return plug.styleIdentifier();
+      }
+    }
+
+    function inMathMode(source, state, endModeSeq) {
+      if (source.eatSpace()) {
+        return null;
+      }
+      if (endModeSeq && source.match(endModeSeq)) {
+        setState(state, normal);
+        return "keyword";
+      }
+      if (source.match(/^\\[a-zA-Z@]+/)) {
+        return "tag";
+      }
+      if (source.match(/^[a-zA-Z]+/)) {
+        return "variable-2";
+      }
+      // escape characters
+      if (source.match(/^\\[$&%#{}_]/)) {
+        return "tag";
+      }
+      // white space control characters
+      if (source.match(/^\\[,;!\/]/)) {
+        return "tag";
+      }
+      // special math-mode characters
+      if (source.match(/^[\^_&]/)) {
+        return "tag";
+      }
+      // non-special characters
+      if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
+        return null;
+      }
+      if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
+        return "number";
+      }
+      var ch = source.next();
+      if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
+        return "bracket";
+      }
+
+      if (ch == "%") {
+        source.skipToEnd();
+        return "comment";
+      }
+      return "error";
+    }
+
+    function beginParams(source, state) {
+      var ch = source.peek(), lastPlug;
+      if (ch == '{' || ch == '[') {
+        lastPlug = peekCommand(state);
+        lastPlug.openBracket(ch);
+        source.eat(ch);
+        setState(state, normal);
+        return "bracket";
+      }
+      if (/[ \t\r]/.test(ch)) {
+        source.eat(ch);
+        return null;
+      }
+      setState(state, normal);
+      popCommand(state);
+
+      return normal(source, state);
+    }
+
+    return {
+      startState: function() {
+        var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal;
+        return {
+          cmdState: [],
+          f: f
+        };
+      },
+      copyState: function(s) {
+        return {
+          cmdState: s.cmdState.slice(),
+          f: s.f
+        };
+      },
+      token: function(stream, state) {
+        return state.f(stream, state);
+      },
+      blankLine: function(state) {
+        state.f = normal;
+        state.cmdState.length = 0;
+      },
+      lineComment: "%"
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-stex", "stex");
+  CodeMirror.defineMIME("text/x-latex", "stex");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/stex/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,132 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({tabSize: 4}, "stex");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("word",
+     "foo");
+
+  MT("twoWords",
+     "foo bar");
+
+  MT("beginEndDocument",
+     "[tag \\begin][bracket {][atom document][bracket }]",
+     "[tag \\end][bracket {][atom document][bracket }]");
+
+  MT("beginEndEquation",
+     "[tag \\begin][bracket {][atom equation][bracket }]",
+     "  E=mc^2",
+     "[tag \\end][bracket {][atom equation][bracket }]");
+
+  MT("beginModule",
+     "[tag \\begin][bracket {][atom module][bracket }[[]]]");
+
+  MT("beginModuleId",
+     "[tag \\begin][bracket {][atom module][bracket }[[]id=bbt-size[bracket ]]]");
+
+  MT("importModule",
+     "[tag \\importmodule][bracket [[][string b-b-t][bracket ]]{][builtin b-b-t][bracket }]");
+
+  MT("importModulePath",
+     "[tag \\importmodule][bracket [[][tag \\KWARCslides][bracket {][string dmath/en/cardinality][bracket }]]{][builtin card][bracket }]");
+
+  MT("psForPDF",
+     "[tag \\PSforPDF][bracket [[][atom 1][bracket ]]{]#1[bracket }]");
+
+  MT("comment",
+     "[comment % foo]");
+
+  MT("tagComment",
+     "[tag \\item][comment % bar]");
+
+  MT("commentTag",
+     " [comment % \\item]");
+
+  MT("commentLineBreak",
+     "[comment %]",
+     "foo");
+
+  MT("tagErrorCurly",
+     "[tag \\begin][error }][bracket {]");
+
+  MT("tagErrorSquare",
+     "[tag \\item][error ]]][bracket {]");
+
+  MT("commentCurly",
+     "[comment % }]");
+
+  MT("tagHash",
+     "the [tag \\#] key");
+
+  MT("tagNumber",
+     "a [tag \\$][atom 5] stetson");
+
+  MT("tagPercent",
+     "[atom 100][tag \\%] beef");
+
+  MT("tagAmpersand",
+     "L [tag \\&] N");
+
+  MT("tagUnderscore",
+     "foo[tag \\_]bar");
+
+  MT("tagBracketOpen",
+     "[tag \\emph][bracket {][tag \\{][bracket }]");
+
+  MT("tagBracketClose",
+     "[tag \\emph][bracket {][tag \\}][bracket }]");
+
+  MT("tagLetterNumber",
+     "section [tag \\S][atom 1]");
+
+  MT("textTagNumber",
+     "para [tag \\P][atom 2]");
+
+  MT("thinspace",
+     "x[tag \\,]y");
+
+  MT("thickspace",
+     "x[tag \\;]y");
+
+  MT("negativeThinspace",
+     "x[tag \\!]y");
+
+  MT("periodNotSentence",
+     "J.\\ L.\\ is");
+
+  MT("periodSentence",
+     "X[tag \\@]. The");
+
+  MT("italicCorrection",
+     "[bracket {][tag \\em] If[tag \\/][bracket }] I");
+
+  MT("tagBracket",
+     "[tag \\newcommand][bracket {][tag \\pop][bracket }]");
+
+  MT("inlineMathTagFollowedByNumber",
+     "[keyword $][tag \\pi][number 2][keyword $]");
+
+  MT("inlineMath",
+     "[keyword $][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword $] other text");
+
+  MT("inlineMathLatexStyle",
+     "[keyword \\(][number 3][variable-2 x][tag ^][number 2.45]-[tag \\sqrt][bracket {][tag \\$\\alpha][bracket }] = [number 2][keyword \\)] other text");
+
+  MT("displayMath",
+     "More [keyword $$]\t[variable-2 S][tag ^][variable-2 n][tag \\sum] [variable-2 i][keyword $$] other text");
+
+  MT("displayMath environment",
+     "[tag \\begin][bracket {][atom equation][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text");
+
+  MT("displayMath environment with label",
+     "[tag \\begin][bracket {][atom equation][bracket }][tag \\label][bracket {][atom eq1][bracket }] x [tag \\end][bracket {][atom equation][bracket }] other text~[tag \\ref][bracket {][atom eq1][bracket }]");
+
+  MT("mathWithComment",
+     "[keyword $][variable-2 x] [comment % $]",
+     "[variable-2 y][keyword $] other text");
+
+  MT("lineBreakArgument",
+    "[tag \\\\][bracket [[][atom 1cm][bracket ]]]");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/stylus/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,106 @@
+<!doctype html>
+
+<title>CodeMirror: Stylus mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../addon/hint/show-hint.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="stylus.js"></script>
+<script src="../../addon/hint/show-hint.js"></script>
+<script src="../../addon/hint/css-hint.js"></script>
+<style>.CodeMirror {background: #f8f8f8;} form{margin-bottom: .7em;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Stylus</a>
+  </ul>
+</div>
+
+<article>
+<h2>Stylus mode</h2>
+<form><textarea id="code" name="code">
+/* Stylus mode */
+
+#id,
+.class,
+article
+  font-family Arial, sans-serif
+
+#id,
+.class,
+article {
+  font-family: Arial, sans-serif;
+}
+
+// Variables
+font-size-base = 16px
+line-height-base = 1.5
+font-family-base = "Helvetica Neue", Helvetica, Arial, sans-serif
+text-color = lighten(#000, 20%)
+
+body
+  font font-size-base/line-height-base font-family-base
+  color text-color
+
+body {
+  font: 400 16px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
+  color: #333;
+}
+
+// Variables
+link-color = darken(#428bca, 6.5%)
+link-hover-color = darken(link-color, 15%)
+link-decoration = none
+link-hover-decoration = false
+
+// Mixin
+tab-focus()
+  outline thin dotted
+  outline 5px auto -webkit-focus-ring-color
+  outline-offset -2px
+
+a
+  color link-color
+  if link-decoration
+    text-decoration link-decoration
+  &:hover
+  &:focus
+    color link-hover-color
+    if link-hover-decoration
+      text-decoration link-hover-decoration
+  &:focus
+    tab-focus()
+
+a {
+  color: #3782c4;
+  text-decoration: none;
+}
+a:hover,
+a:focus {
+  color: #2f6ea7;
+}
+a:focus {
+  outline: thin dotted;
+  outline: 5px auto -webkit-focus-ring-color;
+  outline-offset: -2px;
+}
+</textarea>
+</form>
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    extraKeys: {"Ctrl-Space": "autocomplete"},
+    tabSize: 2
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-styl</code>.</p>
+<p>Created by <a href="https://github.com/dmitrykiselyov">Dmitry Kiselyov</a></p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/stylus/stylus.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,775 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Stylus mode created by Dmitry Kiselyov http://git.io/AaRB
+
+(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.defineMode("stylus", function(config) {
+    var indentUnit = config.indentUnit,
+        indentUnitString = '',
+        tagKeywords = keySet(tagKeywords_),
+        tagVariablesRegexp = /^(a|b|i|s|col|em)$/i,
+        propertyKeywords = keySet(propertyKeywords_),
+        nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_),
+        valueKeywords = keySet(valueKeywords_),
+        colorKeywords = keySet(colorKeywords_),
+        documentTypes = keySet(documentTypes_),
+        documentTypesRegexp = wordRegexp(documentTypes_),
+        mediaFeatures = keySet(mediaFeatures_),
+        mediaTypes = keySet(mediaTypes_),
+        fontProperties = keySet(fontProperties_),
+        operatorsRegexp = /^\s*([.]{2,3}|&&|\|\||\*\*|[?!=:]?=|[-+*\/%<>]=?|\?:|\~)/,
+        wordOperatorKeywordsRegexp = wordRegexp(wordOperatorKeywords_),
+        blockKeywords = keySet(blockKeywords_),
+        vendorPrefixesRegexp = new RegExp(/^\-(moz|ms|o|webkit)-/i),
+        commonAtoms = keySet(commonAtoms_),
+        firstWordMatch = "",
+        states = {},
+        ch,
+        style,
+        type,
+        override;
+
+    while (indentUnitString.length < indentUnit) indentUnitString += ' ';
+
+    /**
+     * Tokenizers
+     */
+    function tokenBase(stream, state) {
+      firstWordMatch = stream.string.match(/(^[\w-]+\s*=\s*$)|(^\s*[\w-]+\s*=\s*[\w-])|(^\s*(\.|#|@|\$|\&|\[|\d|\+|::?|\{|\>|~|\/)?\s*[\w-]*([a-z0-9-]|\*|\/\*)(\(|,)?)/);
+      state.context.line.firstWord = firstWordMatch ? firstWordMatch[0].replace(/^\s*/, "") : "";
+      state.context.line.indent = stream.indentation();
+      ch = stream.peek();
+
+      // Line comment
+      if (stream.match("//")) {
+        stream.skipToEnd();
+        return ["comment", "comment"];
+      }
+      // Block comment
+      if (stream.match("/*")) {
+        state.tokenize = tokenCComment;
+        return tokenCComment(stream, state);
+      }
+      // String
+      if (ch == "\"" || ch == "'") {
+        stream.next();
+        state.tokenize = tokenString(ch);
+        return state.tokenize(stream, state);
+      }
+      // Def
+      if (ch == "@") {
+        stream.next();
+        stream.eatWhile(/[\w\\-]/);
+        return ["def", stream.current()];
+      }
+      // ID selector or Hex color
+      if (ch == "#") {
+        stream.next();
+        // Hex color
+        if (stream.match(/^[0-9a-f]{3}([0-9a-f]([0-9a-f]{2}){0,2})?\b(?!-)/i)) {
+          return ["atom", "atom"];
+        }
+        // ID selector
+        if (stream.match(/^[a-z][\w-]*/i)) {
+          return ["builtin", "hash"];
+        }
+      }
+      // Vendor prefixes
+      if (stream.match(vendorPrefixesRegexp)) {
+        return ["meta", "vendor-prefixes"];
+      }
+      // Numbers
+      if (stream.match(/^-?[0-9]?\.?[0-9]/)) {
+        stream.eatWhile(/[a-z%]/i);
+        return ["number", "unit"];
+      }
+      // !important|optional
+      if (ch == "!") {
+        stream.next();
+        return [stream.match(/^(important|optional)/i) ? "keyword": "operator", "important"];
+      }
+      // Class
+      if (ch == "." && stream.match(/^\.[a-z][\w-]*/i)) {
+        return ["qualifier", "qualifier"];
+      }
+      // url url-prefix domain regexp
+      if (stream.match(documentTypesRegexp)) {
+        if (stream.peek() == "(") state.tokenize = tokenParenthesized;
+        return ["property", "word"];
+      }
+      // Mixins / Functions
+      if (stream.match(/^[a-z][\w-]*\(/i)) {
+        stream.backUp(1);
+        return ["keyword", "mixin"];
+      }
+      // Block mixins
+      if (stream.match(/^(\+|-)[a-z][\w-]*\(/i)) {
+        stream.backUp(1);
+        return ["keyword", "block-mixin"];
+      }
+      // Parent Reference BEM naming
+      if (stream.string.match(/^\s*&/) && stream.match(/^[-_]+[a-z][\w-]*/)) {
+        return ["qualifier", "qualifier"];
+      }
+      // / Root Reference & Parent Reference
+      if (stream.match(/^(\/|&)(-|_|:|\.|#|[a-z])/)) {
+        stream.backUp(1);
+        return ["variable-3", "reference"];
+      }
+      if (stream.match(/^&{1}\s*$/)) {
+        return ["variable-3", "reference"];
+      }
+      // Word operator
+      if (stream.match(wordOperatorKeywordsRegexp)) {
+        return ["operator", "operator"];
+      }
+      // Word
+      if (stream.match(/^\$?[-_]*[a-z0-9]+[\w-]*/i)) {
+        // Variable
+        if (stream.match(/^(\.|\[)[\w-\'\"\]]+/i, false)) {
+          if (!wordIsTag(stream.current())) {
+            stream.match('.');
+            return ["variable-2", "variable-name"];
+          }
+        }
+        return ["variable-2", "word"];
+      }
+      // Operators
+      if (stream.match(operatorsRegexp)) {
+        return ["operator", stream.current()];
+      }
+      // Delimiters
+      if (/[:;,{}\[\]\(\)]/.test(ch)) {
+        stream.next();
+        return [null, ch];
+      }
+      // Non-detected items
+      stream.next();
+      return [null, null];
+    }
+
+    /**
+     * Token comment
+     */
+    function tokenCComment(stream, state) {
+      var maybeEnd = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (maybeEnd && ch == "/") {
+          state.tokenize = null;
+          break;
+        }
+        maybeEnd = (ch == "*");
+      }
+      return ["comment", "comment"];
+    }
+
+    /**
+     * Token string
+     */
+    function tokenString(quote) {
+      return function(stream, state) {
+        var escaped = false, ch;
+        while ((ch = stream.next()) != null) {
+          if (ch == quote && !escaped) {
+            if (quote == ")") stream.backUp(1);
+            break;
+          }
+          escaped = !escaped && ch == "\\";
+        }
+        if (ch == quote || !escaped && quote != ")") state.tokenize = null;
+        return ["string", "string"];
+      };
+    }
+
+    /**
+     * Token parenthesized
+     */
+    function tokenParenthesized(stream, state) {
+      stream.next(); // Must be "("
+      if (!stream.match(/\s*[\"\')]/, false))
+        state.tokenize = tokenString(")");
+      else
+        state.tokenize = null;
+      return [null, "("];
+    }
+
+    /**
+     * Context management
+     */
+    function Context(type, indent, prev, line) {
+      this.type = type;
+      this.indent = indent;
+      this.prev = prev;
+      this.line = line || {firstWord: "", indent: 0};
+    }
+
+    function pushContext(state, stream, type, indent) {
+      indent = indent >= 0 ? indent : indentUnit;
+      state.context = new Context(type, stream.indentation() + indent, state.context);
+      return type;
+    }
+
+    function popContext(state, currentIndent) {
+      var contextIndent = state.context.indent - indentUnit;
+      currentIndent = currentIndent || false;
+      state.context = state.context.prev;
+      if (currentIndent) state.context.indent = contextIndent;
+      return state.context.type;
+    }
+
+    function pass(type, stream, state) {
+      return states[state.context.type](type, stream, state);
+    }
+
+    function popAndPass(type, stream, state, n) {
+      for (var i = n || 1; i > 0; i--)
+        state.context = state.context.prev;
+      return pass(type, stream, state);
+    }
+
+
+    /**
+     * Parser
+     */
+    function wordIsTag(word) {
+      return word.toLowerCase() in tagKeywords;
+    }
+
+    function wordIsProperty(word) {
+      word = word.toLowerCase();
+      return word in propertyKeywords || word in fontProperties;
+    }
+
+    function wordIsBlock(word) {
+      return word.toLowerCase() in blockKeywords;
+    }
+
+    function wordIsVendorPrefix(word) {
+      return word.toLowerCase().match(vendorPrefixesRegexp);
+    }
+
+    function wordAsValue(word) {
+      var wordLC = word.toLowerCase();
+      var override = "variable-2";
+      if (wordIsTag(word)) override = "tag";
+      else if (wordIsBlock(word)) override = "block-keyword";
+      else if (wordIsProperty(word)) override = "property";
+      else if (wordLC in valueKeywords || wordLC in commonAtoms) override = "atom";
+      else if (wordLC == "return" || wordLC in colorKeywords) override = "keyword";
+
+      // Font family
+      else if (word.match(/^[A-Z]/)) override = "string";
+      return override;
+    }
+
+    function typeIsBlock(type, stream) {
+      return ((endOfLine(stream) && (type == "{" || type == "]" || type == "hash" || type == "qualifier")) || type == "block-mixin");
+    }
+
+    function typeIsInterpolation(type, stream) {
+      return type == "{" && stream.match(/^\s*\$?[\w-]+/i, false);
+    }
+
+    function typeIsPseudo(type, stream) {
+      return type == ":" && stream.match(/^[a-z-]+/, false);
+    }
+
+    function startOfLine(stream) {
+      return stream.sol() || stream.string.match(new RegExp("^\\s*" + escapeRegExp(stream.current())));
+    }
+
+    function endOfLine(stream) {
+      return stream.eol() || stream.match(/^\s*$/, false);
+    }
+
+    function firstWordOfLine(line) {
+      var re = /^\s*[-_]*[a-z0-9]+[\w-]*/i;
+      var result = typeof line == "string" ? line.match(re) : line.string.match(re);
+      return result ? result[0].replace(/^\s*/, "") : "";
+    }
+
+
+    /**
+     * Block
+     */
+    states.block = function(type, stream, state) {
+      if ((type == "comment" && startOfLine(stream)) ||
+          (type == "," && endOfLine(stream)) ||
+          type == "mixin") {
+        return pushContext(state, stream, "block", 0);
+      }
+      if (typeIsInterpolation(type, stream)) {
+        return pushContext(state, stream, "interpolation");
+      }
+      if (endOfLine(stream) && type == "]") {
+        if (!/^\s*(\.|#|:|\[|\*|&)/.test(stream.string) && !wordIsTag(firstWordOfLine(stream))) {
+          return pushContext(state, stream, "block", 0);
+        }
+      }
+      if (typeIsBlock(type, stream)) {
+        return pushContext(state, stream, "block");
+      }
+      if (type == "}" && endOfLine(stream)) {
+        return pushContext(state, stream, "block", 0);
+      }
+      if (type == "variable-name") {
+        if (stream.string.match(/^\s?\$[\w-\.\[\]\'\"]+$/) || wordIsBlock(firstWordOfLine(stream))) {
+          return pushContext(state, stream, "variableName");
+        }
+        else {
+          return pushContext(state, stream, "variableName", 0);
+        }
+      }
+      if (type == "=") {
+        if (!endOfLine(stream) && !wordIsBlock(firstWordOfLine(stream))) {
+          return pushContext(state, stream, "block", 0);
+        }
+        return pushContext(state, stream, "block");
+      }
+      if (type == "*") {
+        if (endOfLine(stream) || stream.match(/\s*(,|\.|#|\[|:|{)/,false)) {
+          override = "tag";
+          return pushContext(state, stream, "block");
+        }
+      }
+      if (typeIsPseudo(type, stream)) {
+        return pushContext(state, stream, "pseudo");
+      }
+      if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
+        return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
+      }
+      if (/@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
+        return pushContext(state, stream, "keyframes");
+      }
+      if (/@extends?/.test(type)) {
+        return pushContext(state, stream, "extend", 0);
+      }
+      if (type && type.charAt(0) == "@") {
+
+        // Property Lookup
+        if (stream.indentation() > 0 && wordIsProperty(stream.current().slice(1))) {
+          override = "variable-2";
+          return "block";
+        }
+        if (/(@import|@require|@charset)/.test(type)) {
+          return pushContext(state, stream, "block", 0);
+        }
+        return pushContext(state, stream, "block");
+      }
+      if (type == "reference" && endOfLine(stream)) {
+        return pushContext(state, stream, "block");
+      }
+      if (type == "(") {
+        return pushContext(state, stream, "parens");
+      }
+
+      if (type == "vendor-prefixes") {
+        return pushContext(state, stream, "vendorPrefixes");
+      }
+      if (type == "word") {
+        var word = stream.current();
+        override = wordAsValue(word);
+
+        if (override == "property") {
+          if (startOfLine(stream)) {
+            return pushContext(state, stream, "block", 0);
+          } else {
+            override = "atom";
+            return "block";
+          }
+        }
+
+        if (override == "tag") {
+
+          // tag is a css value
+          if (/embed|menu|pre|progress|sub|table/.test(word)) {
+            if (wordIsProperty(firstWordOfLine(stream))) {
+              override = "atom";
+              return "block";
+            }
+          }
+
+          // tag is an attribute
+          if (stream.string.match(new RegExp("\\[\\s*" + word + "|" + word +"\\s*\\]"))) {
+            override = "atom";
+            return "block";
+          }
+
+          // tag is a variable
+          if (tagVariablesRegexp.test(word)) {
+            if ((startOfLine(stream) && stream.string.match(/=/)) ||
+                (!startOfLine(stream) &&
+                 !stream.string.match(/^(\s*\.|#|\&|\[|\/|>|\*)/) &&
+                 !wordIsTag(firstWordOfLine(stream)))) {
+              override = "variable-2";
+              if (wordIsBlock(firstWordOfLine(stream)))  return "block";
+              return pushContext(state, stream, "block", 0);
+            }
+          }
+
+          if (endOfLine(stream)) return pushContext(state, stream, "block");
+        }
+        if (override == "block-keyword") {
+          override = "keyword";
+
+          // Postfix conditionals
+          if (stream.current(/(if|unless)/) && !startOfLine(stream)) {
+            return "block";
+          }
+          return pushContext(state, stream, "block");
+        }
+        if (word == "return") return pushContext(state, stream, "block", 0);
+
+        // Placeholder selector
+        if (override == "variable-2" && stream.string.match(/^\s?\$[\w-\.\[\]\'\"]+$/)) {
+          return pushContext(state, stream, "block");
+        }
+      }
+      return state.context.type;
+    };
+
+
+    /**
+     * Parens
+     */
+    states.parens = function(type, stream, state) {
+      if (type == "(") return pushContext(state, stream, "parens");
+      if (type == ")") {
+        if (state.context.prev.type == "parens") {
+          return popContext(state);
+        }
+        if ((stream.string.match(/^[a-z][\w-]*\(/i) && endOfLine(stream)) ||
+            wordIsBlock(firstWordOfLine(stream)) ||
+            /(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(firstWordOfLine(stream)) ||
+            (!stream.string.match(/^-?[a-z][\w-\.\[\]\'\"]*\s*=/) &&
+             wordIsTag(firstWordOfLine(stream)))) {
+          return pushContext(state, stream, "block");
+        }
+        if (stream.string.match(/^[\$-]?[a-z][\w-\.\[\]\'\"]*\s*=/) ||
+            stream.string.match(/^\s*(\(|\)|[0-9])/) ||
+            stream.string.match(/^\s+[a-z][\w-]*\(/i) ||
+            stream.string.match(/^\s+[\$-]?[a-z]/i)) {
+          return pushContext(state, stream, "block", 0);
+        }
+        if (endOfLine(stream)) return pushContext(state, stream, "block");
+        else return pushContext(state, stream, "block", 0);
+      }
+      if (type && type.charAt(0) == "@" && wordIsProperty(stream.current().slice(1))) {
+        override = "variable-2";
+      }
+      if (type == "word") {
+        var word = stream.current();
+        override = wordAsValue(word);
+        if (override == "tag" && tagVariablesRegexp.test(word)) {
+          override = "variable-2";
+        }
+        if (override == "property" || word == "to") override = "atom";
+      }
+      if (type == "variable-name") {
+        return pushContext(state, stream, "variableName");
+      }
+      if (typeIsPseudo(type, stream)) {
+        return pushContext(state, stream, "pseudo");
+      }
+      return state.context.type;
+    };
+
+
+    /**
+     * Vendor prefixes
+     */
+    states.vendorPrefixes = function(type, stream, state) {
+      if (type == "word") {
+        override = "property";
+        return pushContext(state, stream, "block", 0);
+      }
+      return popContext(state);
+    };
+
+
+    /**
+     * Pseudo
+     */
+    states.pseudo = function(type, stream, state) {
+      if (!wordIsProperty(firstWordOfLine(stream.string))) {
+        stream.match(/^[a-z-]+/);
+        override = "variable-3";
+        if (endOfLine(stream)) return pushContext(state, stream, "block");
+        return popContext(state);
+      }
+      return popAndPass(type, stream, state);
+    };
+
+
+    /**
+     * atBlock
+     */
+    states.atBlock = function(type, stream, state) {
+      if (type == "(") return pushContext(state, stream, "atBlock_parens");
+      if (typeIsBlock(type, stream)) {
+        return pushContext(state, stream, "block");
+      }
+      if (typeIsInterpolation(type, stream)) {
+        return pushContext(state, stream, "interpolation");
+      }
+      if (type == "word") {
+        var word = stream.current().toLowerCase();
+        if (/^(only|not|and|or)$/.test(word))
+          override = "keyword";
+        else if (documentTypes.hasOwnProperty(word))
+          override = "tag";
+        else if (mediaTypes.hasOwnProperty(word))
+          override = "attribute";
+        else if (mediaFeatures.hasOwnProperty(word))
+          override = "property";
+        else if (nonStandardPropertyKeywords.hasOwnProperty(word))
+          override = "string-2";
+        else override = wordAsValue(stream.current());
+        if (override == "tag" && endOfLine(stream)) {
+          return pushContext(state, stream, "block");
+        }
+      }
+      if (type == "operator" && /^(not|and|or)$/.test(stream.current())) {
+        override = "keyword";
+      }
+      return state.context.type;
+    };
+
+    states.atBlock_parens = function(type, stream, state) {
+      if (type == "{" || type == "}") return state.context.type;
+      if (type == ")") {
+        if (endOfLine(stream)) return pushContext(state, stream, "block");
+        else return pushContext(state, stream, "atBlock");
+      }
+      if (type == "word") {
+        var word = stream.current().toLowerCase();
+        override = wordAsValue(word);
+        if (/^(max|min)/.test(word)) override = "property";
+        if (override == "tag") {
+          tagVariablesRegexp.test(word) ? override = "variable-2" : override = "atom";
+        }
+        return state.context.type;
+      }
+      return states.atBlock(type, stream, state);
+    };
+
+
+    /**
+     * Keyframes
+     */
+    states.keyframes = function(type, stream, state) {
+      if (stream.indentation() == "0" && ((type == "}" && startOfLine(stream)) || type == "]" || type == "hash"
+                                          || type == "qualifier" || wordIsTag(stream.current()))) {
+        return popAndPass(type, stream, state);
+      }
+      if (type == "{") return pushContext(state, stream, "keyframes");
+      if (type == "}") {
+        if (startOfLine(stream)) return popContext(state, true);
+        else return pushContext(state, stream, "keyframes");
+      }
+      if (type == "unit" && /^[0-9]+\%$/.test(stream.current())) {
+        return pushContext(state, stream, "keyframes");
+      }
+      if (type == "word") {
+        override = wordAsValue(stream.current());
+        if (override == "block-keyword") {
+          override = "keyword";
+          return pushContext(state, stream, "keyframes");
+        }
+      }
+      if (/@(font-face|media|supports|(-moz-)?document)/.test(type)) {
+        return pushContext(state, stream, endOfLine(stream) ? "block" : "atBlock");
+      }
+      if (type == "mixin") {
+        return pushContext(state, stream, "block", 0);
+      }
+      return state.context.type;
+    };
+
+
+    /**
+     * Interpolation
+     */
+    states.interpolation = function(type, stream, state) {
+      if (type == "{") popContext(state) && pushContext(state, stream, "block");
+      if (type == "}") {
+        if (stream.string.match(/^\s*(\.|#|:|\[|\*|&|>|~|\+|\/)/i) ||
+            (stream.string.match(/^\s*[a-z]/i) && wordIsTag(firstWordOfLine(stream)))) {
+          return pushContext(state, stream, "block");
+        }
+        if (!stream.string.match(/^(\{|\s*\&)/) ||
+            stream.match(/\s*[\w-]/,false)) {
+          return pushContext(state, stream, "block", 0);
+        }
+        return pushContext(state, stream, "block");
+      }
+      if (type == "variable-name") {
+        return pushContext(state, stream, "variableName", 0);
+      }
+      if (type == "word") {
+        override = wordAsValue(stream.current());
+        if (override == "tag") override = "atom";
+      }
+      return state.context.type;
+    };
+
+
+    /**
+     * Extend/s
+     */
+    states.extend = function(type, stream, state) {
+      if (type == "[" || type == "=") return "extend";
+      if (type == "]") return popContext(state);
+      if (type == "word") {
+        override = wordAsValue(stream.current());
+        return "extend";
+      }
+      return popContext(state);
+    };
+
+
+    /**
+     * Variable name
+     */
+    states.variableName = function(type, stream, state) {
+      if (type == "string" || type == "[" || type == "]" || stream.current().match(/^(\.|\$)/)) {
+        if (stream.current().match(/^\.[\w-]+/i)) override = "variable-2";
+        return "variableName";
+      }
+      return popAndPass(type, stream, state);
+    };
+
+
+    return {
+      startState: function(base) {
+        return {
+          tokenize: null,
+          state: "block",
+          context: new Context("block", base || 0, null)
+        };
+      },
+      token: function(stream, state) {
+        if (!state.tokenize && stream.eatSpace()) return null;
+        style = (state.tokenize || tokenBase)(stream, state);
+        if (style && typeof style == "object") {
+          type = style[1];
+          style = style[0];
+        }
+        override = style;
+        state.state = states[state.state](type, stream, state);
+        return override;
+      },
+      indent: function(state, textAfter, line) {
+
+        var cx = state.context,
+            ch = textAfter && textAfter.charAt(0),
+            indent = cx.indent,
+            lineFirstWord = firstWordOfLine(textAfter),
+            lineIndent = line.match(/^\s*/)[0].replace(/\t/g, indentUnitString).length,
+            prevLineFirstWord = state.context.prev ? state.context.prev.line.firstWord : "",
+            prevLineIndent = state.context.prev ? state.context.prev.line.indent : lineIndent;
+
+        if (cx.prev &&
+            (ch == "}" && (cx.type == "block" || cx.type == "atBlock" || cx.type == "keyframes") ||
+             ch == ")" && (cx.type == "parens" || cx.type == "atBlock_parens") ||
+             ch == "{" && (cx.type == "at"))) {
+          indent = cx.indent - indentUnit;
+        } else if (!(/(\})/.test(ch))) {
+          if (/@|\$|\d/.test(ch) ||
+              /^\{/.test(textAfter) ||
+/^\s*\/(\/|\*)/.test(textAfter) ||
+              /^\s*\/\*/.test(prevLineFirstWord) ||
+              /^\s*[\w-\.\[\]\'\"]+\s*(\?|:|\+)?=/i.test(textAfter) ||
+/^(\+|-)?[a-z][\w-]*\(/i.test(textAfter) ||
+/^return/.test(textAfter) ||
+              wordIsBlock(lineFirstWord)) {
+            indent = lineIndent;
+          } else if (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(ch) || wordIsTag(lineFirstWord)) {
+            if (/\,\s*$/.test(prevLineFirstWord)) {
+              indent = prevLineIndent;
+            } else if (/^\s+/.test(line) && (/(\.|#|:|\[|\*|&|>|~|\+|\/)/.test(prevLineFirstWord) || wordIsTag(prevLineFirstWord))) {
+              indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
+            } else {
+              indent = lineIndent;
+            }
+          } else if (!/,\s*$/.test(line) && (wordIsVendorPrefix(lineFirstWord) || wordIsProperty(lineFirstWord))) {
+            if (wordIsBlock(prevLineFirstWord)) {
+              indent = lineIndent <= prevLineIndent ? prevLineIndent : prevLineIndent + indentUnit;
+            } else if (/^\{/.test(prevLineFirstWord)) {
+              indent = lineIndent <= prevLineIndent ? lineIndent : prevLineIndent + indentUnit;
+            } else if (wordIsVendorPrefix(prevLineFirstWord) || wordIsProperty(prevLineFirstWord)) {
+              indent = lineIndent >= prevLineIndent ? prevLineIndent : lineIndent;
+            } else if (/^(\.|#|:|\[|\*|&|@|\+|\-|>|~|\/)/.test(prevLineFirstWord) ||
+                      /=\s*$/.test(prevLineFirstWord) ||
+                      wordIsTag(prevLineFirstWord) ||
+                      /^\$[\w-\.\[\]\'\"]/.test(prevLineFirstWord)) {
+              indent = prevLineIndent + indentUnit;
+            } else {
+              indent = lineIndent;
+            }
+          }
+        }
+        return indent;
+      },
+      electricChars: "}",
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/",
+      blockCommentContinue: " * ",
+      lineComment: "//",
+      fold: "indent"
+    };
+  });
+
+  // developer.mozilla.org/en-US/docs/Web/HTML/Element
+  var tagKeywords_ = ["a","abbr","address","area","article","aside","audio", "b", "base","bdi", "bdo","bgsound","blockquote","body","br","button","canvas","caption","cite", "code","col","colgroup","data","datalist","dd","del","details","dfn","div", "dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1", "h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe", "img","input","ins","kbd","keygen","label","legend","li","link","main","map", "mark","marquee","menu","menuitem","meta","meter","nav","nobr","noframes", "noscript","object","ol","optgroup","option","output","p","param","pre", "progress","q","rp","rt","ruby","s","samp","script","section","select", "small","source","span","strong","style","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","track", "u","ul","var","video"];
+
+  // github.com/codemirror/CodeMirror/blob/master/mode/css/css.js
+  // Note, "url-prefix" should precede "url" in order to match correctly in documentTypesRegexp
+  var documentTypes_ = ["domain", "regexp", "url-prefix", "url"];
+  var mediaTypes_ = ["all","aural","braille","handheld","print","projection","screen","tty","tv","embossed"];
+  var mediaFeatures_ = ["width","min-width","max-width","height","min-height","max-height","device-width","min-device-width","max-device-width","device-height","min-device-height","max-device-height","aspect-ratio","min-aspect-ratio","max-aspect-ratio","device-aspect-ratio","min-device-aspect-ratio","max-device-aspect-ratio","color","min-color","max-color","color-index","min-color-index","max-color-index","monochrome","min-monochrome","max-monochrome","resolution","min-resolution","max-resolution","scan","grid","dynamic-range","video-dynamic-range"];
+  var propertyKeywords_ = ["align-content","align-items","align-self","alignment-adjust","alignment-baseline","anchor-point","animation","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-timing-function","appearance","azimuth","backface-visibility","background","background-attachment","background-clip","background-color","background-image","background-origin","background-position","background-repeat","background-size","baseline-shift","binding","bleed","bookmark-label","bookmark-level","bookmark-state","bookmark-target","border","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-decoration-break","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","clear","clip","color","color-profile","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","content","counter-increment","counter-reset","crop","cue","cue-after","cue-before","cursor","direction","display","dominant-baseline","drop-initial-after-adjust","drop-initial-after-align","drop-initial-before-adjust","drop-initial-before-align","drop-initial-size","drop-initial-value","elevation","empty-cells","fit","fit-position","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","float-offset","flow-from","flow-into","font","font-feature-settings","font-family","font-kerning","font-language-override","font-size","font-size-adjust","font-stretch","font-style","font-synthesis","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-ligatures","font-variant-numeric","font-variant-position","font-weight","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-position","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphens","icon","image-orientation","image-rendering","image-resolution","inline-box-align","justify-content","left","letter-spacing","line-break","line-height","line-stacking","line-stacking-ruby","line-stacking-shift","line-stacking-strategy","list-style","list-style-image","list-style-position","list-style-type","margin","margin-bottom","margin-left","margin-right","margin-top","marker-offset","marks","marquee-direction","marquee-loop","marquee-play-count","marquee-speed","marquee-style","max-height","max-width","min-height","min-width","move-to","nav-down","nav-index","nav-left","nav-right","nav-up","object-fit","object-position","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-style","overflow-wrap","overflow-x","overflow-y","padding","padding-bottom","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","page-policy","pause","pause-after","pause-before","perspective","perspective-origin","pitch","pitch-range","play-during","position","presentation-level","punctuation-trim","quotes","region-break-after","region-break-before","region-break-inside","region-fragment","rendering-intent","resize","rest","rest-after","rest-before","richness","right","rotation","rotation-point","ruby-align","ruby-overhang","ruby-position","ruby-span","shape-image-threshold","shape-inside","shape-margin","shape-outside","size","speak","speak-as","speak-header","speak-numeral","speak-punctuation","speech-rate","stress","string-set","tab-size","table-layout","target","target-name","target-new","target-position","text-align","text-align-last","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-style","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-height","text-indent","text-justify","text-outline","text-overflow","text-shadow","text-size-adjust","text-space-collapse","text-transform","text-underline-position","text-wrap","top","transform","transform-origin","transform-style","transition","transition-delay","transition-duration","transition-property","transition-timing-function","unicode-bidi","vertical-align","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","volume","white-space","widows","width","will-change","word-break","word-spacing","word-wrap","z-index","clip-path","clip-rule","mask","enable-background","filter","flood-color","flood-opacity","lighting-color","stop-color","stop-opacity","pointer-events","color-interpolation","color-interpolation-filters","color-rendering","fill","fill-opacity","fill-rule","image-rendering","marker","marker-end","marker-mid","marker-start","shape-rendering","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","text-rendering","baseline-shift","dominant-baseline","glyph-orientation-horizontal","glyph-orientation-vertical","text-anchor","writing-mode","font-smoothing","osx-font-smoothing"];
+  var nonStandardPropertyKeywords_ = ["scrollbar-arrow-color","scrollbar-base-color","scrollbar-dark-shadow-color","scrollbar-face-color","scrollbar-highlight-color","scrollbar-shadow-color","scrollbar-3d-light-color","scrollbar-track-color","shape-inside","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","zoom"];
+  var fontProperties_ = ["font-family","src","unicode-range","font-variant","font-feature-settings","font-stretch","font-weight","font-style"];
+  var colorKeywords_ = ["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"];
+  var valueKeywords_ = ["above","absolute","activeborder","additive","activecaption","afar","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","amharic","amharic-abegede","antialiased","appworkspace","arabic-indic","armenian","asterisks","attr","auto","avoid","avoid-column","avoid-page","avoid-region","background","backwards","baseline","below","bidi-override","binary","bengali","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","buttonface","buttonhighlight","buttonshadow","buttontext","calc","cambodian","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","cjk-earthly-branch","cjk-heavenly-stem","cjk-ideographic","clear","clip","close-quote","col-resize","collapse","column","compact","condensed","conic-gradient","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","dashed","decimal","decimal-leading-zero","default","default-button","destination-atop","destination-in","destination-out","destination-over","devanagari","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic","ethiopic-abegede","ethiopic-abegede-am-et","ethiopic-abegede-gez","ethiopic-abegede-ti-er","ethiopic-abegede-ti-et","ethiopic-halehame-aa-er","ethiopic-halehame-aa-et","ethiopic-halehame-am-et","ethiopic-halehame-gez","ethiopic-halehame-om-et","ethiopic-halehame-sid-et","ethiopic-halehame-so-et","ethiopic-halehame-ti-er","ethiopic-halehame-ti-et","ethiopic-halehame-tig","ethiopic-numeric","ew-resize","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fixed","flat","flex","footnotes","forwards","from","geometricPrecision","georgian","graytext","groove","gujarati","gurmukhi","hand","hangul","hangul-consonant","hebrew","help","hidden","hide","high","higher","highlight","highlighttext","hiragana","hiragana-iroha","horizontal","hsl","hsla","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-table","inset","inside","intrinsic","invert","italic","japanese-formal","japanese-informal","justify","kannada","katakana","katakana-iroha","keep-all","khmer","korean-hangul-formal","korean-hanja-formal","korean-hanja-informal","landscape","lao","large","larger","left","level","lighter","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-alpha","lower-armenian","lower-greek","lower-hexadecimal","lower-latin","lower-norwegian","lower-roman","lowercase","ltr","malayalam","match","matrix","matrix3d","media-play-button","media-slider","media-sliderthumb","media-volume-slider","media-volume-sliderthumb","medium","menu","menulist","menulist-button","menutext","message-box","middle","min-intrinsic","mix","mongolian","monospace","move","multiple","myanmar","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","octal","open-quote","optimizeLegibility","optimizeSpeed","oriya","oromo","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","persian","perspective","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeating-conic-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row-resize","rtl","run-in","running","s-resize","sans-serif","scale","scale3d","scaleX","scaleY","scaleZ","scroll","scrollbar","scroll-position","se-resize","searchfield","searchfield-cancel-button","searchfield-decoration","searchfield-results-button","searchfield-results-decoration","semi-condensed","semi-expanded","separate","serif","show","sidama","simp-chinese-formal","simp-chinese-informal","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","solid","somali","source-atop","source-in","source-out","source-over","space","spell-out","square","square-button","standard","start","static","status-bar","stretch","stroke","sub","subpixel-antialiased","super","sw-resize","symbolic","symbols","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","tamil","telugu","text","text-bottom","text-top","textarea","textfield","thai","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","tibetan","tigre","tigrinya-er","tigrinya-er-abegede","tigrinya-et","tigrinya-et-abegede","to","top","trad-chinese-formal","trad-chinese-informal","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","up","upper-alpha","upper-armenian","upper-greek","upper-hexadecimal","upper-latin","upper-norwegian","upper-roman","uppercase","urdu","url","var","vertical","vertical-text","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","x-large","x-small","xor","xx-large","xx-small","bicubic","optimizespeed","grayscale","row","row-reverse","wrap","wrap-reverse","column-reverse","flex-start","flex-end","space-between","space-around", "unset"];
+
+  var wordOperatorKeywords_ = ["in","and","or","not","is not","is a","is","isnt","defined","if unless"],
+      blockKeywords_ = ["for","if","else","unless", "from", "to"],
+      commonAtoms_ = ["null","true","false","href","title","type","not-allowed","readonly","disabled"],
+      commonDef_ = ["@font-face", "@keyframes", "@media", "@viewport", "@page", "@host", "@supports", "@block", "@css"];
+
+  var hintWords = tagKeywords_.concat(documentTypes_,mediaTypes_,mediaFeatures_,
+                                      propertyKeywords_,nonStandardPropertyKeywords_,
+                                      colorKeywords_,valueKeywords_,fontProperties_,
+                                      wordOperatorKeywords_,blockKeywords_,
+                                      commonAtoms_,commonDef_);
+
+  function wordRegexp(words) {
+    words = words.sort(function(a,b){return b > a;});
+    return new RegExp("^((" + words.join(")|(") + "))\\b");
+  }
+
+  function keySet(array) {
+    var keys = {};
+    for (var i = 0; i < array.length; ++i) keys[array[i]] = true;
+    return keys;
+  }
+
+  function escapeRegExp(text) {
+    return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
+  }
+
+  CodeMirror.registerHelper("hintWords", "stylus", hintWords);
+  CodeMirror.defineMIME("text/x-styl", "stylus");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/swift/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,70 @@
+<!doctype html>
+
+<title>CodeMirror: Swift mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="./swift.js"></script>
+<style>
+	.CodeMirror { border: 2px inset #dee; }
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Swift</a>
+  </ul>
+</div>
+
+<article>
+<h2>Swift mode</h2>
+<form><textarea id="code" name="code">
+protocol HeaderViewProtocol {
+    func setTitle(_ string: String)
+}
+
+struct AnyHeaderView {
+    let view: UIView
+    let headerView: HeaderViewProtocol
+    init<T: UIView>(view: T) where T: HeaderViewProtocol {
+        self.view = view
+        self.headerView = view
+    }
+}
+
+let header = AnyHeaderView(view: myView)
+header.headerView.setTitle("hi")
+
+struct HeaderView {
+    let view: UIView
+    let setTitle: (String) -> ()
+}
+
+var label = UILabel()
+let header = HeaderView(view: label) { str in
+    label.text = str
+}
+header.setTitle("hello")
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-swift"
+      });
+    </script>
+
+    <p>A simple mode for Swift</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-swift</code> (Swift code)</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/swift/swift.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,221 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Swift mode created by Michael Kaminsky https://github.com/mkaminsky11
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object")
+    mod(require("../../lib/codemirror"))
+  else if (typeof define == "function" && define.amd)
+    define(["../../lib/codemirror"], mod)
+  else
+    mod(CodeMirror)
+})(function(CodeMirror) {
+  "use strict"
+
+  function wordSet(words) {
+    var set = {}
+    for (var i = 0; i < words.length; i++) set[words[i]] = true
+    return set
+  }
+
+  var keywords = wordSet(["_","var","let","actor","class","enum","extension","import","protocol","struct","func","typealias","associatedtype",
+                          "open","public","internal","fileprivate","private","deinit","init","new","override","self","subscript","super",
+                          "convenience","dynamic","final","indirect","lazy","required","static","unowned","unowned(safe)","unowned(unsafe)","weak","as","is",
+                          "break","case","continue","default","else","fallthrough","for","guard","if","in","repeat","switch","where","while",
+                          "defer","return","inout","mutating","nonmutating","isolated","nonisolated","catch","do","rethrows","throw","throws","async","await","try","didSet","get","set","willSet",
+                          "assignment","associativity","infix","left","none","operator","postfix","precedence","precedencegroup","prefix","right",
+                          "Any","AnyObject","Type","dynamicType","Self","Protocol","__COLUMN__","__FILE__","__FUNCTION__","__LINE__"])
+  var definingKeywords = wordSet(["var","let","actor","class","enum","extension","import","protocol","struct","func","typealias","associatedtype","for"])
+  var atoms = wordSet(["true","false","nil","self","super","_"])
+  var types = wordSet(["Array","Bool","Character","Dictionary","Double","Float","Int","Int8","Int16","Int32","Int64","Never","Optional","Set","String",
+                       "UInt8","UInt16","UInt32","UInt64","Void"])
+  var operators = "+-/*%=|&<>~^?!"
+  var punc = ":;,.(){}[]"
+  var binary = /^\-?0b[01][01_]*/
+  var octal = /^\-?0o[0-7][0-7_]*/
+  var hexadecimal = /^\-?0x[\dA-Fa-f][\dA-Fa-f_]*(?:(?:\.[\dA-Fa-f][\dA-Fa-f_]*)?[Pp]\-?\d[\d_]*)?/
+  var decimal = /^\-?\d[\d_]*(?:\.\d[\d_]*)?(?:[Ee]\-?\d[\d_]*)?/
+  var identifier = /^\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1/
+  var property = /^\.(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/
+  var instruction = /^\#[A-Za-z]+/
+  var attribute = /^@(?:\$\d+|(`?)[_A-Za-z][_A-Za-z$0-9]*\1)/
+  //var regexp = /^\/(?!\s)(?:\/\/)?(?:\\.|[^\/])+\//
+
+  function tokenBase(stream, state, prev) {
+    if (stream.sol()) state.indented = stream.indentation()
+    if (stream.eatSpace()) return null
+
+    var ch = stream.peek()
+    if (ch == "/") {
+      if (stream.match("//")) {
+        stream.skipToEnd()
+        return "comment"
+      }
+      if (stream.match("/*")) {
+        state.tokenize.push(tokenComment)
+        return tokenComment(stream, state)
+      }
+    }
+    if (stream.match(instruction)) return "builtin"
+    if (stream.match(attribute)) return "attribute"
+    if (stream.match(binary)) return "number"
+    if (stream.match(octal)) return "number"
+    if (stream.match(hexadecimal)) return "number"
+    if (stream.match(decimal)) return "number"
+    if (stream.match(property)) return "property"
+    if (operators.indexOf(ch) > -1) {
+      stream.next()
+      return "operator"
+    }
+    if (punc.indexOf(ch) > -1) {
+      stream.next()
+      stream.match("..")
+      return "punctuation"
+    }
+    var stringMatch
+    if (stringMatch = stream.match(/("""|"|')/)) {
+      var tokenize = tokenString.bind(null, stringMatch[0])
+      state.tokenize.push(tokenize)
+      return tokenize(stream, state)
+    }
+
+    if (stream.match(identifier)) {
+      var ident = stream.current()
+      if (types.hasOwnProperty(ident)) return "variable-2"
+      if (atoms.hasOwnProperty(ident)) return "atom"
+      if (keywords.hasOwnProperty(ident)) {
+        if (definingKeywords.hasOwnProperty(ident))
+          state.prev = "define"
+        return "keyword"
+      }
+      if (prev == "define") return "def"
+      return "variable"
+    }
+
+    stream.next()
+    return null
+  }
+
+  function tokenUntilClosingParen() {
+    var depth = 0
+    return function(stream, state, prev) {
+      var inner = tokenBase(stream, state, prev)
+      if (inner == "punctuation") {
+        if (stream.current() == "(") ++depth
+        else if (stream.current() == ")") {
+          if (depth == 0) {
+            stream.backUp(1)
+            state.tokenize.pop()
+            return state.tokenize[state.tokenize.length - 1](stream, state)
+          }
+          else --depth
+        }
+      }
+      return inner
+    }
+  }
+
+  function tokenString(openQuote, stream, state) {
+    var singleLine = openQuote.length == 1
+    var ch, escaped = false
+    while (ch = stream.peek()) {
+      if (escaped) {
+        stream.next()
+        if (ch == "(") {
+          state.tokenize.push(tokenUntilClosingParen())
+          return "string"
+        }
+        escaped = false
+      } else if (stream.match(openQuote)) {
+        state.tokenize.pop()
+        return "string"
+      } else {
+        stream.next()
+        escaped = ch == "\\"
+      }
+    }
+    if (singleLine) {
+      state.tokenize.pop()
+    }
+    return "string"
+  }
+
+  function tokenComment(stream, state) {
+    var ch
+    while (ch = stream.next()) {
+      if (ch === "/" && stream.eat("*")) {
+        state.tokenize.push(tokenComment)
+      } else if (ch === "*" && stream.eat("/")) {
+        state.tokenize.pop()
+        break
+      }
+    }
+    return "comment"
+  }
+
+  function Context(prev, align, indented) {
+    this.prev = prev
+    this.align = align
+    this.indented = indented
+  }
+
+  function pushContext(state, stream) {
+    var align = stream.match(/^\s*($|\/[\/\*])/, false) ? null : stream.column() + 1
+    state.context = new Context(state.context, align, state.indented)
+  }
+
+  function popContext(state) {
+    if (state.context) {
+      state.indented = state.context.indented
+      state.context = state.context.prev
+    }
+  }
+
+  CodeMirror.defineMode("swift", function(config) {
+    return {
+      startState: function() {
+        return {
+          prev: null,
+          context: null,
+          indented: 0,
+          tokenize: []
+        }
+      },
+
+      token: function(stream, state) {
+        var prev = state.prev
+        state.prev = null
+        var tokenize = state.tokenize[state.tokenize.length - 1] || tokenBase
+        var style = tokenize(stream, state, prev)
+        if (!style || style == "comment") state.prev = prev
+        else if (!state.prev) state.prev = style
+
+        if (style == "punctuation") {
+          var bracket = /[\(\[\{]|([\]\)\}])/.exec(stream.current())
+          if (bracket) (bracket[1] ? popContext : pushContext)(state, stream)
+        }
+
+        return style
+      },
+
+      indent: function(state, textAfter) {
+        var cx = state.context
+        if (!cx) return 0
+        var closing = /^[\]\}\)]/.test(textAfter)
+        if (cx.align != null) return cx.align - (closing ? 1 : 0)
+        return cx.indented + (closing ? 0 : config.indentUnit)
+      },
+
+      electricInput: /^\s*[\)\}\]]$/,
+
+      lineComment: "//",
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/",
+      fold: "brace",
+      closeBrackets: "()[]{}''\"\"``"
+    }
+  })
+
+  CodeMirror.defineMIME("text/x-swift","swift")
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/swift/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,162 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "swift");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  // Ensure all number types are properly represented.
+  MT("numbers",
+     "[keyword var] [def a] [operator =] [number 17]",
+     "[keyword var] [def b] [operator =] [number -0.5]",
+     "[keyword var] [def c] [operator =] [number 0.3456e-4]",
+     "[keyword var] [def d] [operator =] [number 345e2]",
+     "[keyword var] [def e] [operator =] [number 0o7324]",
+     "[keyword var] [def f] [operator =] [number 0b10010]",
+     "[keyword var] [def g] [operator =] [number -0x35ade]",
+     "[keyword var] [def h] [operator =] [number 0xaea.ep-13]",
+     "[keyword var] [def i] [operator =] [number 0x13ep6]");
+
+  // Variable/class/etc definition.
+  MT("definition",
+     "[keyword var] [def a] [operator =] [number 5]",
+     "[keyword let] [def b][punctuation :] [variable-2 Int] [operator =] [number 10]",
+     "[keyword class] [def C] [punctuation {] [punctuation }]",
+     "[keyword struct] [def D] [punctuation {] [punctuation }]",
+     "[keyword enum] [def E] [punctuation {] [punctuation }]",
+     "[keyword extension] [def F] [punctuation {] [punctuation }]",
+     "[keyword protocol] [def G] [punctuation {] [punctuation }]",
+     "[keyword func] [def h][punctuation ()] [punctuation {] [punctuation }]",
+     "[keyword import] [def Foundation]",
+     "[keyword typealias] [def NewString] [operator =] [variable-2 String]",
+     "[keyword associatedtype] [def I]",
+     "[keyword for] [def j] [keyword in] [number 0][punctuation ..][operator <][number 3] [punctuation {] [punctuation }]");
+
+  // Strings and string interpolation.
+  MT("strings",
+     "[keyword var] [def a][punctuation :] [variable-2 String] [operator =] [string \"test\"]",
+     "[keyword var] [def b][punctuation :] [variable-2 String] [operator =] [string \"\\(][variable a][string )\"]",
+     "[keyword var] [def c] [operator =] [string \"\"\"]",
+     "[string multi]",
+     "[string line]",
+     "[string \"test\"]",
+     "[string \"\"\"]",
+     "[variable print][punctuation (][string \"\"][punctuation )]");
+
+  // Comments.
+  MT("comments",
+     "[comment // This is a comment]",
+     "[comment /* This is another comment */]",
+     "[keyword var] [def a] [operator =] [number 5] [comment // Third comment]");
+
+  // Atoms.
+  MT("atoms",
+     "[keyword class] [def FooClass] [punctuation {]",
+     "  [keyword let] [def fooBool][punctuation :] [variable-2 Bool][operator ?]",
+     "  [keyword let] [def fooInt][punctuation :] [variable-2 Int][operator ?]",
+     "  [keyword func] [keyword init][punctuation (][variable fooBool][punctuation :] [variable-2 Bool][punctuation ,] [variable barBool][punctuation :] [variable-2 Bool][punctuation )] [punctuation {]",
+     "    [atom super][property .init][punctuation ()]",
+     "    [atom self][property .fooBool] [operator =] [variable fooBool]",
+     "    [variable fooInt] [operator =] [atom nil]",
+     "    [keyword if] [variable barBool] [operator ==] [atom true] [punctuation {]",
+     "      [variable print][punctuation (][string \"True!\"][punctuation )]",
+     "    [punctuation }] [keyword else] [keyword if] [variable barBool] [operator ==] [atom false] [punctuation {]",
+     "      [keyword for] [atom _] [keyword in] [number 0][punctuation ...][number 5] [punctuation {]",
+     "        [variable print][punctuation (][string \"False!\"][punctuation )]",
+     "      [punctuation }]",
+     "    [punctuation }]",
+     "  [punctuation }]",
+     "[punctuation }]");
+
+  // Types.
+  MT("types",
+     "[keyword var] [def a] [operator =] [variable-2 Array][operator <][variable-2 Int][operator >]",
+     "[keyword var] [def b] [operator =] [variable-2 Set][operator <][variable-2 Bool][operator >]",
+     "[keyword var] [def c] [operator =] [variable-2 Dictionary][operator <][variable-2 String][punctuation ,][variable-2 Character][operator >]",
+     "[keyword var] [def d][punctuation :] [variable-2 Int64][operator ?] [operator =] [variable-2 Optional][punctuation (][number 8][punctuation )]",
+     "[keyword func] [def e][punctuation ()] [operator ->] [variable-2 Void] [punctuation {]",
+     "  [keyword var] [def e1][punctuation :] [variable-2 Float] [operator =] [number 1.2]",
+     "[punctuation }]",
+     "[keyword func] [def f][punctuation ()] [operator ->] [variable-2 Never] [punctuation {]",
+     "  [keyword var] [def f1][punctuation :] [variable-2 Double] [operator =] [number 2.4]",
+     "[punctuation }]");
+
+  // Operators.
+  MT("operators",
+     "[keyword var] [def a] [operator =] [number 1] [operator +] [number 2]",
+     "[keyword var] [def b] [operator =] [number 1] [operator -] [number 2]",
+     "[keyword var] [def c] [operator =] [number 1] [operator *] [number 2]",
+     "[keyword var] [def d] [operator =] [number 1] [operator /] [number 2]",
+     "[keyword var] [def e] [operator =] [number 1] [operator %] [number 2]",
+     "[keyword var] [def f] [operator =] [number 1] [operator |] [number 2]",
+     "[keyword var] [def g] [operator =] [number 1] [operator &] [number 2]",
+     "[keyword var] [def h] [operator =] [number 1] [operator <<] [number 2]",
+     "[keyword var] [def i] [operator =] [number 1] [operator >>] [number 2]",
+     "[keyword var] [def j] [operator =] [number 1] [operator ^] [number 2]",
+     "[keyword var] [def k] [operator =] [operator ~][number 1]",
+     "[keyword var] [def l] [operator =] [variable foo] [operator ?] [number 1] [punctuation :] [number 2]",
+     "[keyword var] [def m][punctuation :] [variable-2 Int] [operator =] [variable-2 Optional][punctuation (][number 8][punctuation )][operator !]");
+
+  // Punctuation.
+  MT("punctuation",
+     "[keyword let] [def a] [operator =] [number 1][punctuation ;] [keyword let] [def b] [operator =] [number 2]",
+     "[keyword let] [def testArr][punctuation :] [punctuation [[][variable-2 Int][punctuation ]]] [operator =] [punctuation [[][variable a][punctuation ,] [variable b][punctuation ]]]",
+     "[keyword for] [def i] [keyword in] [number 0][punctuation ..][operator <][variable testArr][property .count] [punctuation {]",
+     "  [variable print][punctuation (][variable testArr][punctuation [[][variable i][punctuation ]])]",
+     "[punctuation }]");
+
+  // Identifiers.
+  MT("identifiers",
+     "[keyword let] [def abc] [operator =] [number 1]",
+     "[keyword let] [def ABC] [operator =] [number 2]",
+     "[keyword let] [def _123] [operator =] [number 3]",
+     "[keyword let] [def _$1$2$3] [operator =] [number 4]",
+     "[keyword let] [def A1$_c32_$_] [operator =] [number 5]",
+     "[keyword let] [def `var`] [operator =] [punctuation [[][number 1][punctuation ,] [number 2][punctuation ,] [number 3][punctuation ]]]",
+     "[keyword let] [def square$] [operator =] [variable `var`][property .map] [punctuation {][variable $0] [operator *] [variable $0][punctuation }]",
+     "$$ [number 1][variable a] $[atom _] [variable _$] [variable __] `[variable a] [variable b]`");
+
+  // Properties.
+  MT("properties",
+     "[variable print][punctuation (][variable foo][property .abc][punctuation )]",
+     "[variable print][punctuation (][variable foo][property .ABC][punctuation )]",
+     "[variable print][punctuation (][variable foo][property ._123][punctuation )]",
+     "[variable print][punctuation (][variable foo][property ._$1$2$3][punctuation )]",
+     "[variable print][punctuation (][variable foo][property .A1$_c32_$_][punctuation )]",
+     "[variable print][punctuation (][variable foo][property .`var`][punctuation )]",
+     "[variable print][punctuation (][variable foo][property .__][punctuation )]");
+
+  // Instructions or other things that start with #.
+  MT("instructions",
+     "[keyword if] [builtin #available][punctuation (][variable iOS] [number 9][punctuation ,] [operator *][punctuation )] [punctuation {}]",
+     "[variable print][punctuation (][builtin #file][punctuation ,] [builtin #function][punctuation )]",
+     "[variable print][punctuation (][builtin #line][punctuation ,] [builtin #column][punctuation )]",
+     "[builtin #if] [atom true]",
+     "[keyword import] [def A]",
+     "[builtin #elseif] [atom false]",
+     "[keyword import] [def B]",
+     "[builtin #endif]",
+     "[builtin #sourceLocation][punctuation (][variable file][punctuation :] [string \"file.swift\"][punctuation ,] [variable line][punctuation :] [number 2][punctuation )]");
+
+  // Attributes; things that start with @.
+  MT("attributes",
+     "[attribute @objc][punctuation (][variable objcFoo][punctuation :)]",
+     "[attribute @available][punctuation (][variable iOS][punctuation )]");
+
+  // Property/number edge case.
+  MT("property_number",
+     "[variable print][punctuation (][variable foo][property ._123][punctuation )]",
+     "[variable print][punctuation (]")
+
+  MT("nested_comments",
+     "[comment /*]",
+     "[comment But wait /* this is a nested comment */ for real]",
+     "[comment /**** let * me * show * you ****/]",
+     "[comment ///// let / me / show / you /////]",
+     "[comment */]");
+
+  // TODO: correctly identify when multiple variables are being declared
+  // by use of a comma-separated list.
+  // TODO: correctly identify when variables are being declared in a tuple.
+  // TODO: identify protocols as types when used before an extension?
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tcl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,142 @@
+<!doctype html>
+
+<title>CodeMirror: Tcl mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/night.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="tcl.js"></script>
+<script src="../../addon/scroll/scrollpastend.js"></script>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Tcl</a>
+  </ul>
+</div>
+
+<article>
+<h2>Tcl mode</h2>
+<form><textarea id="code" name="code">
+##############################################################################################
+##  ##     whois.tcl for eggdrop by Ford_Lawnmower irc.geekshed.net #Script-Help        ##  ##
+##############################################################################################
+## To use this script you must set channel flag +whois (ie .chanset #chan +whois)           ##
+##############################################################################################
+##      ____                __                 ###########################################  ##
+##     / __/___ _ ___ _ ___/ /____ ___   ___   ###########################################  ##
+##    / _/ / _ `// _ `// _  // __// _ \ / _ \  ###########################################  ##
+##   /___/ \_, / \_, / \_,_//_/   \___// .__/  ###########################################  ##
+##        /___/ /___/                 /_/      ###########################################  ##
+##                                             ###########################################  ##
+##############################################################################################
+##  ##                             Start Setup.                                         ##  ##
+##############################################################################################
+namespace eval whois {
+## change cmdchar to the trigger you want to use                                        ##  ##
+  variable cmdchar "!"
+## change command to the word trigger you would like to use.                            ##  ##
+## Keep in mind, This will also change the .chanset +/-command                          ##  ##
+  variable command "whois"
+## change textf to the colors you want for the text.                                    ##  ##
+  variable textf "\017\00304"
+## change tagf to the colors you want for tags:                                         ##  ##
+  variable tagf "\017\002"
+## Change logo to the logo you want at the start of the line.                           ##  ##
+  variable logo "\017\00304\002\[\00306W\003hois\00304\]\017"
+## Change lineout to the results you want. Valid results are channel users modes topic  ##  ##
+  variable lineout "channel users modes topic"
+##############################################################################################
+##  ##                           End Setup.                                              ## ##
+##############################################################################################
+  variable channel ""
+  setudef flag $whois::command
+  bind pub -|- [string trimleft $whois::cmdchar]${whois::command} whois::list
+  bind raw -|- "311" whois::311
+  bind raw -|- "312" whois::312
+  bind raw -|- "319" whois::319
+  bind raw -|- "317" whois::317
+  bind raw -|- "313" whois::multi
+  bind raw -|- "310" whois::multi
+  bind raw -|- "335" whois::multi
+  bind raw -|- "301" whois::301
+  bind raw -|- "671" whois::multi
+  bind raw -|- "320" whois::multi
+  bind raw -|- "401" whois::multi
+  bind raw -|- "318" whois::318
+  bind raw -|- "307" whois::307
+}
+proc whois::311 {from key text} {
+  if {[regexp -- {^[^\s]+\s(.+?)\s(.+?)\s(.+?)\s\*\s\:(.+)$} $text wholematch nick ident host realname]} {
+    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Host:${whois::textf} \
+        $nick \(${ident}@${host}\) ${whois::tagf}Realname:${whois::textf} $realname"
+  }
+}
+proc whois::multi {from key text} {
+  if {[regexp {\:(.*)$} $text match $key]} {
+    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Note:${whois::textf} [subst $$key]"
+        return 1
+  }
+}
+proc whois::312 {from key text} {
+  regexp {([^\s]+)\s\:} $text match server
+  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Server:${whois::textf} $server"
+}
+proc whois::319 {from key text} {
+  if {[regexp {.+\:(.+)$} $text match channels]} {
+    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Channels:${whois::textf} $channels"
+  }
+}
+proc whois::317 {from key text} {
+  if {[regexp -- {.*\s(\d+)\s(\d+)\s\:} $text wholematch idle signon]} {
+    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Connected:${whois::textf} \
+        [ctime $signon] ${whois::tagf}Idle:${whois::textf} [duration $idle]"
+  }
+}
+proc whois::301 {from key text} {
+  if {[regexp {^.+\s[^\s]+\s\:(.*)$} $text match awaymsg]} {
+    putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Away:${whois::textf} $awaymsg"
+  }
+}
+proc whois::318 {from key text} {
+  namespace eval whois {
+        variable channel ""
+  }
+  variable whois::channel ""
+}
+proc whois::307 {from key text} {
+  putserv "PRIVMSG $whois::channel :${whois::logo} ${whois::tagf}Services:${whois::textf} Registered Nick"
+}
+proc whois::list {nick host hand chan text} {
+  if {[lsearch -exact [channel info $chan] "+${whois::command}"] != -1} {
+    namespace eval whois {
+          variable channel ""
+        }
+    variable whois::channel $chan
+    putserv "WHOIS $text"
+  }
+}
+putlog "\002*Loaded* \017\00304\002\[\00306W\003hois\00304\]\017 \002by \
+Ford_Lawnmower irc.GeekShed.net #Script-Help"
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        theme: "night",
+        lineNumbers: true,
+        indentUnit: 2,
+        scrollPastEnd: true,
+        mode: "text/x-tcl"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-tcl</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tcl/tcl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,140 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+//tcl mode by Ford_Lawnmower :: Based on Velocity mode by Steve O'Hara
+
+(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.defineMode("tcl", function() {
+  function parseWords(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+  var keywords = parseWords("Tcl safe after append array auto_execok auto_import auto_load " +
+        "auto_mkindex auto_mkindex_old auto_qualify auto_reset bgerror " +
+        "binary break catch cd close concat continue dde eof encoding error " +
+        "eval exec exit expr fblocked fconfigure fcopy file fileevent filename " +
+        "filename flush for foreach format gets glob global history http if " +
+        "incr info interp join lappend lindex linsert list llength load lrange " +
+        "lreplace lsearch lset lsort memory msgcat namespace open package parray " +
+        "pid pkg::create pkg_mkIndex proc puts pwd re_syntax read regex regexp " +
+        "registry regsub rename resource return scan seek set socket source split " +
+        "string subst switch tcl_endOfWord tcl_findLibrary tcl_startOfNextWord " +
+        "tcl_wordBreakAfter tcl_startOfPreviousWord tcl_wordBreakBefore tcltest " +
+        "tclvars tell time trace unknown unset update uplevel upvar variable " +
+    "vwait");
+    var functions = parseWords("if elseif else and not or eq ne in ni for foreach while switch");
+    var isOperatorChar = /[+\-*&%=<>!?^\/\|]/;
+    function chain(stream, state, f) {
+      state.tokenize = f;
+      return f(stream, state);
+    }
+    function tokenBase(stream, state) {
+      var beforeParams = state.beforeParams;
+      state.beforeParams = false;
+      var ch = stream.next();
+      if ((ch == '"' || ch == "'") && state.inParams) {
+        return chain(stream, state, tokenString(ch));
+      } else if (/[\[\]{}\(\),;\.]/.test(ch)) {
+        if (ch == "(" && beforeParams) state.inParams = true;
+        else if (ch == ")") state.inParams = false;
+          return null;
+      } else if (/\d/.test(ch)) {
+        stream.eatWhile(/[\w\.]/);
+        return "number";
+      } else if (ch == "#") {
+        if (stream.eat("*"))
+          return chain(stream, state, tokenComment);
+        if (ch == "#" && stream.match(/ *\[ *\[/))
+          return chain(stream, state, tokenUnparsed);
+        stream.skipToEnd();
+        return "comment";
+      } else if (ch == '"') {
+        stream.skipTo(/"/);
+        return "comment";
+      } else if (ch == "$") {
+        stream.eatWhile(/[$_a-z0-9A-Z\.{:]/);
+        stream.eatWhile(/}/);
+        state.beforeParams = true;
+        return "builtin";
+      } else if (isOperatorChar.test(ch)) {
+        stream.eatWhile(isOperatorChar);
+        return "comment";
+      } else {
+        stream.eatWhile(/[\w\$_{}\xa1-\uffff]/);
+        var word = stream.current().toLowerCase();
+        if (keywords && keywords.propertyIsEnumerable(word))
+          return "keyword";
+        if (functions && functions.propertyIsEnumerable(word)) {
+          state.beforeParams = true;
+          return "keyword";
+        }
+        return null;
+      }
+    }
+    function tokenString(quote) {
+      return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {
+          end = true;
+          break;
+        }
+        escaped = !escaped && next == "\\";
+      }
+      if (end) state.tokenize = tokenBase;
+        return "string";
+      };
+    }
+    function tokenComment(stream, state) {
+      var maybeEnd = false, ch;
+      while (ch = stream.next()) {
+        if (ch == "#" && maybeEnd) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        maybeEnd = (ch == "*");
+      }
+      return "comment";
+    }
+    function tokenUnparsed(stream, state) {
+      var maybeEnd = 0, ch;
+      while (ch = stream.next()) {
+        if (ch == "#" && maybeEnd == 2) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        if (ch == "]")
+          maybeEnd++;
+        else if (ch != " ")
+          maybeEnd = 0;
+      }
+      return "meta";
+    }
+    return {
+      startState: function() {
+        return {
+          tokenize: tokenBase,
+          beforeParams: false,
+          inParams: false
+        };
+      },
+      token: function(stream, state) {
+        if (stream.eatSpace()) return null;
+        return state.tokenize(stream, state);
+      },
+      lineComment: "#"
+    };
+});
+CodeMirror.defineMIME("text/x-tcl", "tcl");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/textile/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,191 @@
+<!doctype html>
+
+<title>CodeMirror: Textile mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="textile.js"></script>
+<style>.CodeMirror {background: #f8f8f8;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/marijnh/codemirror">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class="active" href="#">Textile</a>
+  </ul>
+</div>
+
+<article>
+    <h2>Textile mode</h2>
+    <form><textarea id="code" name="code">
+h1. Textile Mode
+
+A paragraph without formatting.
+
+p. A simple Paragraph.
+
+
+h2. Phrase Modifiers
+
+Here are some simple phrase modifiers: *strong*, _emphasis_, **bold**, and __italic__.
+
+A ??citation??, -deleted text-, +inserted text+, some ^superscript^, and some ~subscript~.
+
+A %span element% and @code element@
+
+A "link":http://example.com, a "link with (alt text)":urlAlias
+
+[urlAlias]http://example.com/
+
+An image: !http://example.com/image.png! and an image with a link: !http://example.com/image.png!:http://example.com
+
+A sentence with a footnote.[123]
+
+fn123. The footnote is defined here.
+
+Registered(r), Trademark(tm), and Copyright(c)
+
+
+h2. Headers
+
+h1. Top level
+h2. Second level
+h3. Third level
+h4. Fourth level
+h5. Fifth level
+h6. Lowest level
+
+
+h2.  Lists
+
+* An unordered list
+** foo bar
+*** foo bar
+**** foo bar
+** foo bar
+
+# An ordered list
+## foo bar
+### foo bar
+#### foo bar
+## foo bar
+
+- definition list := description
+- another item    := foo bar
+- spanning ines   :=
+                     foo bar
+
+                     foo bar =:
+
+
+h2. Attributes
+
+Layouts and phrase modifiers can be modified with various kinds of attributes: alignment, CSS ID, CSS class names, language, padding, and CSS styles.
+
+h3. Alignment
+
+div<. left align
+div>. right align
+
+h3. CSS ID and class name
+
+You are a %(my-id#my-classname) rad% person.
+
+h3. Language
+
+p[en_CA]. Strange weather, eh?
+
+h3. Horizontal Padding
+
+p(())). 2em left padding, 3em right padding
+
+h3. CSS styling
+
+p{background: red}. Fire!
+
+
+h2. Table
+
+|_.              Header 1               |_.      Header 2        |
+|{background:#ddd}. Cell with background|         Normal         |
+|\2.         Cell spanning 2 columns                             |
+|/2.         Cell spanning 2 rows       |(cell-class). one       |
+|                                                two             |
+|>.                  Right aligned cell |<. Left aligned cell    |
+
+
+h3. A table with attributes:
+
+table(#prices).
+|Adults|$5|
+|Children|$2|
+
+
+h2. Code blocks
+
+bc.
+function factorial(n) {
+    if (n === 0) {
+        return 1;
+    }
+    return n * factorial(n - 1);
+}
+
+pre..
+                ,,,,,,
+            o#'9MMHb':'-,o,
+         .oH":HH$' "' ' -*R&o,
+        dMMM*""'`'      .oM"HM?.
+       ,MMM'          "HLbd< ?&H\
+      .:MH ."\          ` MM  MM&b
+     . "*H    -        &MMMMMMMMMH:
+     .    dboo        MMMMMMMMMMMM.
+     .   dMMMMMMb      *MMMMMMMMMP.
+     .    MMMMMMMP        *MMMMMP .
+          `#MMMMM           MM6P ,
+       '    `MMMP"           HM*`,
+        '    :MM             .- ,
+         '.   `#?..  .       ..'
+            -.   .         .-
+              ''-.oo,oo.-''
+
+\. _(9>
+ \==_)
+  -'=
+
+h2. Temporarily disabling textile markup
+
+notextile. Don't __touch this!__
+
+Surround text with double-equals to disable textile inline. Example: Use ==*asterisks*== for *strong* text.
+
+
+h2. HTML
+
+Some block layouts are simply textile versions of HTML tags with the same name, like @div@, @pre@, and @p@. HTML tags can also exist on their own line:
+
+<section>
+  <h1>Title</h1>
+  <p>Hello!</p>
+</section>
+
+</textarea></form>
+    <script>
+        var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+            lineNumbers: true,
+            mode: "text/x-textile"
+        });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-textile</code>.</p>
+
+    <p><strong>Parsing/Highlighting Tests:</strong> <a href="../../test/index.html#textile_*">normal</a>,  <a href="../../test/index.html#verbose,textile_*">verbose</a>.</p>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/textile/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,417 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({tabSize: 4}, 'textile');
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT('simpleParagraphs',
+      'Some text.',
+      '',
+      'Some more text.');
+
+  /*
+   * Phrase Modifiers
+   */
+
+  MT('em',
+      'foo [em _bar_]');
+
+  MT('emBoogus',
+      'code_mirror');
+
+  MT('strong',
+      'foo [strong *bar*]');
+
+  MT('strongBogus',
+      '3 * 3 = 9');
+
+  MT('italic',
+      'foo [em __bar__]');
+
+  MT('italicBogus',
+      'code__mirror');
+
+  MT('bold',
+      'foo [strong **bar**]');
+
+  MT('boldBogus',
+      '3 ** 3 = 27');
+
+  MT('simpleLink',
+      '[link "CodeMirror":https://codemirror.net]');
+
+  MT('referenceLink',
+      '[link "CodeMirror":code_mirror]',
+      'Normal Text.',
+      '[link [[code_mirror]]https://codemirror.net]');
+
+  MT('footCite',
+      'foo bar[qualifier [[1]]]');
+
+  MT('footCiteBogus',
+      'foo bar[[1a2]]');
+
+  MT('special-characters',
+          'Registered [tag (r)], ' +
+          'Trademark [tag (tm)], and ' +
+          'Copyright [tag (c)] 2008');
+
+  MT('cite',
+      "A book is [keyword ??The Count of Monte Cristo??] by Dumas.");
+
+  MT('additionAndDeletion',
+      'The news networks declared [negative -Al Gore-] ' +
+        '[positive +George W. Bush+] the winner in Florida.');
+
+  MT('subAndSup',
+      'f(x, n) = log [builtin ~4~] x [builtin ^n^]');
+
+  MT('spanAndCode',
+      'A [quote %span element%] and [atom @code element@]');
+
+  MT('spanBogus',
+      'Percentage 25% is not a span.');
+
+  MT('citeBogus',
+      'Question? is not a citation.');
+
+  MT('codeBogus',
+      'user@example.com');
+
+  MT('subBogus',
+      '~username');
+
+  MT('supBogus',
+      'foo ^ bar');
+
+  MT('deletionBogus',
+      '3 - 3 = 0');
+
+  MT('additionBogus',
+      '3 + 3 = 6');
+
+  MT('image',
+      'An image: [string !http://www.example.com/image.png!]');
+
+  MT('imageWithAltText',
+      'An image: [string !http://www.example.com/image.png (Alt Text)!]');
+
+  MT('imageWithUrl',
+      'An image: [string !http://www.example.com/image.png!:http://www.example.com/]');
+
+  /*
+   * Headers
+   */
+
+  MT('h1',
+      '[header&header-1 h1. foo]');
+
+  MT('h2',
+      '[header&header-2 h2. foo]');
+
+  MT('h3',
+      '[header&header-3 h3. foo]');
+
+  MT('h4',
+      '[header&header-4 h4. foo]');
+
+  MT('h5',
+      '[header&header-5 h5. foo]');
+
+  MT('h6',
+      '[header&header-6 h6. foo]');
+
+  MT('h7Bogus',
+      'h7. foo');
+
+  MT('multipleHeaders',
+      '[header&header-1 h1. Heading 1]',
+      '',
+      'Some text.',
+      '',
+      '[header&header-2 h2. Heading 2]',
+      '',
+      'More text.');
+
+  MT('h1inline',
+      '[header&header-1 h1. foo ][header&header-1&em _bar_][header&header-1  baz]');
+
+  /*
+   * Lists
+   */
+
+  MT('ul',
+      'foo',
+      'bar',
+      '',
+      '[variable-2 * foo]',
+      '[variable-2 * bar]');
+
+  MT('ulNoBlank',
+      'foo',
+      'bar',
+      '[variable-2 * foo]',
+      '[variable-2 * bar]');
+
+  MT('ol',
+      'foo',
+      'bar',
+      '',
+      '[variable-2 # foo]',
+      '[variable-2 # bar]');
+
+  MT('olNoBlank',
+      'foo',
+      'bar',
+      '[variable-2 # foo]',
+      '[variable-2 # bar]');
+
+  MT('ulFormatting',
+      '[variable-2 * ][variable-2&em _foo_][variable-2  bar]',
+      '[variable-2 * ][variable-2&strong *][variable-2&em&strong _foo_]' +
+        '[variable-2&strong *][variable-2  bar]',
+      '[variable-2 * ][variable-2&strong *foo*][variable-2  bar]');
+
+  MT('olFormatting',
+      '[variable-2 # ][variable-2&em _foo_][variable-2  bar]',
+      '[variable-2 # ][variable-2&strong *][variable-2&em&strong _foo_]' +
+        '[variable-2&strong *][variable-2  bar]',
+      '[variable-2 # ][variable-2&strong *foo*][variable-2  bar]');
+
+  MT('ulNested',
+      '[variable-2 * foo]',
+      '[variable-3 ** bar]',
+      '[keyword *** bar]',
+      '[variable-2 **** bar]',
+      '[variable-3 ** bar]');
+
+  MT('olNested',
+      '[variable-2 # foo]',
+      '[variable-3 ## bar]',
+      '[keyword ### bar]',
+      '[variable-2 #### bar]',
+      '[variable-3 ## bar]');
+
+  MT('ulNestedWithOl',
+      '[variable-2 * foo]',
+      '[variable-3 ## bar]',
+      '[keyword *** bar]',
+      '[variable-2 #### bar]',
+      '[variable-3 ** bar]');
+
+  MT('olNestedWithUl',
+      '[variable-2 # foo]',
+      '[variable-3 ** bar]',
+      '[keyword ### bar]',
+      '[variable-2 **** bar]',
+      '[variable-3 ## bar]');
+
+  MT('definitionList',
+      '[number - coffee := Hot ][number&em _and_][number  black]',
+      '',
+      'Normal text.');
+
+  MT('definitionListSpan',
+      '[number - coffee :=]',
+      '',
+      '[number Hot ][number&em _and_][number  black =:]',
+      '',
+      'Normal text.');
+
+  MT('boo',
+      '[number - dog := woof woof]',
+      '[number - cat := meow meow]',
+      '[number - whale :=]',
+      '[number Whale noises.]',
+      '',
+      '[number Also, ][number&em _splashing_][number . =:]');
+
+  /*
+   * Attributes
+   */
+
+  MT('divWithAttribute',
+      '[punctuation div][punctuation&attribute (#my-id)][punctuation . foo bar]');
+
+  MT('divWithAttributeAnd2emRightPadding',
+      '[punctuation div][punctuation&attribute (#my-id)((][punctuation . foo bar]');
+
+  MT('divWithClassAndId',
+      '[punctuation div][punctuation&attribute (my-class#my-id)][punctuation . foo bar]');
+
+  MT('paragraphWithCss',
+      'p[attribute {color:red;}]. foo bar');
+
+  MT('paragraphNestedStyles',
+      'p. [strong *foo ][strong&em _bar_][strong *]');
+
+  MT('paragraphWithLanguage',
+      'p[attribute [[fr]]]. Parlez-vous français?');
+
+  MT('paragraphLeftAlign',
+      'p[attribute <]. Left');
+
+  MT('paragraphRightAlign',
+      'p[attribute >]. Right');
+
+  MT('paragraphRightAlign',
+      'p[attribute =]. Center');
+
+  MT('paragraphJustified',
+      'p[attribute <>]. Justified');
+
+  MT('paragraphWithLeftIndent1em',
+      'p[attribute (]. Left');
+
+  MT('paragraphWithRightIndent1em',
+      'p[attribute )]. Right');
+
+  MT('paragraphWithLeftIndent2em',
+      'p[attribute ((]. Left');
+
+  MT('paragraphWithRightIndent2em',
+      'p[attribute ))]. Right');
+
+  MT('paragraphWithLeftIndent3emRightIndent2em',
+      'p[attribute ((())]. Right');
+
+  MT('divFormatting',
+      '[punctuation div. ][punctuation&strong *foo ]' +
+        '[punctuation&strong&em _bar_][punctuation&strong *]');
+
+  MT('phraseModifierAttributes',
+      'p[attribute (my-class)]. This is a paragraph that has a class and' +
+      ' this [em _][em&attribute (#special-phrase)][em emphasized phrase_]' +
+      ' has an id.');
+
+  MT('linkWithClass',
+      '[link "(my-class). This is a link with class":http://redcloth.org]');
+
+  /*
+   * Layouts
+   */
+
+  MT('paragraphLayouts',
+      'p. This is one paragraph.',
+      '',
+      'p. This is another.');
+
+  MT('div',
+      '[punctuation div. foo bar]');
+
+  MT('pre',
+      '[operator pre. Text]');
+
+  MT('bq.',
+      '[bracket bq. foo bar]',
+      '',
+      'Normal text.');
+
+  MT('footnote',
+      '[variable fn123. foo ][variable&strong *bar*]');
+
+  /*
+   * Spanning Layouts
+   */
+
+  MT('bq..ThenParagraph',
+      '[bracket bq.. foo bar]',
+      '',
+      '[bracket More quote.]',
+      'p. Normal Text');
+
+  MT('bq..ThenH1',
+      '[bracket bq.. foo bar]',
+      '',
+      '[bracket More quote.]',
+      '[header&header-1 h1. Header Text]');
+
+  MT('bc..ThenParagraph',
+      '[atom bc.. # Some ruby code]',
+      '[atom obj = {foo: :bar}]',
+      '[atom puts obj]',
+      '',
+      '[atom obj[[:love]] = "*love*"]',
+      '[atom puts obj.love.upcase]',
+      '',
+      'p. Normal text.');
+
+  MT('fn1..ThenParagraph',
+      '[variable fn1.. foo bar]',
+      '',
+      '[variable More.]',
+      'p. Normal Text');
+
+  MT('pre..ThenParagraph',
+      '[operator pre.. foo bar]',
+      '',
+      '[operator More.]',
+      'p. Normal Text');
+
+  /*
+   * Tables
+   */
+
+  MT('table',
+      '[variable-3&operator |_. name |_. age|]',
+      '[variable-3 |][variable-3&strong *Walter*][variable-3 |   5  |]',
+      '[variable-3 |Florence|   6  |]',
+      '',
+      'p. Normal text.');
+
+  MT('tableWithAttributes',
+      '[variable-3&operator |_. name |_. age|]',
+      '[variable-3 |][variable-3&attribute /2.][variable-3  Jim |]',
+      '[variable-3 |][variable-3&attribute \\2{color: red}.][variable-3  Sam |]');
+
+  /*
+   * HTML
+   */
+
+  MT('html',
+      '[comment <div id="wrapper">]',
+      '[comment <section id="introduction">]',
+      '',
+      '[header&header-1 h1. Welcome]',
+      '',
+      '[variable-2 * Item one]',
+      '[variable-2 * Item two]',
+      '',
+      '[comment <a href="http://example.com">Example</a>]',
+      '',
+      '[comment </section>]',
+      '[comment </div>]');
+
+  MT('inlineHtml',
+      'I can use HTML directly in my [comment <span class="youbetcha">Textile</span>].');
+
+  /*
+   * No-Textile
+   */
+
+  MT('notextile',
+    '[string-2 notextile. *No* formatting]');
+
+  MT('notextileInline',
+      'Use [string-2 ==*asterisks*==] for [strong *strong*] text.');
+
+  MT('notextileWithPre',
+      '[operator pre. *No* formatting]');
+
+  MT('notextileWithSpanningPre',
+      '[operator pre.. *No* formatting]',
+      '',
+      '[operator *No* formatting]');
+
+  /* Only toggling phrases between non-word chars. */
+
+  MT('phrase-in-word',
+     'foo_bar_baz');
+
+  MT('phrase-non-word',
+     '[negative -x-] aaa-bbb ccc-ddd [negative -eee-] fff [negative -ggg-]');
+
+  MT('phrase-lone-dash',
+     'foo - bar - baz');
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/textile/textile.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,469 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+  var TOKEN_STYLES = {
+    addition: "positive",
+    attributes: "attribute",
+    bold: "strong",
+    cite: "keyword",
+    code: "atom",
+    definitionList: "number",
+    deletion: "negative",
+    div: "punctuation",
+    em: "em",
+    footnote: "variable",
+    footCite: "qualifier",
+    header: "header",
+    html: "comment",
+    image: "string",
+    italic: "em",
+    link: "link",
+    linkDefinition: "link",
+    list1: "variable-2",
+    list2: "variable-3",
+    list3: "keyword",
+    notextile: "string-2",
+    pre: "operator",
+    p: "property",
+    quote: "bracket",
+    span: "quote",
+    specialChar: "tag",
+    strong: "strong",
+    sub: "builtin",
+    sup: "builtin",
+    table: "variable-3",
+    tableHeading: "operator"
+  };
+
+  function startNewLine(stream, state) {
+    state.mode = Modes.newLayout;
+    state.tableHeading = false;
+
+    if (state.layoutType === "definitionList" && state.spanningLayout &&
+        stream.match(RE("definitionListEnd"), false))
+      state.spanningLayout = false;
+  }
+
+  function handlePhraseModifier(stream, state, ch) {
+    if (ch === "_") {
+      if (stream.eat("_"))
+        return togglePhraseModifier(stream, state, "italic", /__/, 2);
+      else
+        return togglePhraseModifier(stream, state, "em", /_/, 1);
+    }
+
+    if (ch === "*") {
+      if (stream.eat("*")) {
+        return togglePhraseModifier(stream, state, "bold", /\*\*/, 2);
+      }
+      return togglePhraseModifier(stream, state, "strong", /\*/, 1);
+    }
+
+    if (ch === "[") {
+      if (stream.match(/\d+\]/)) state.footCite = true;
+      return tokenStyles(state);
+    }
+
+    if (ch === "(") {
+      var spec = stream.match(/^(r|tm|c)\)/);
+      if (spec)
+        return tokenStylesWith(state, TOKEN_STYLES.specialChar);
+    }
+
+    if (ch === "<" && stream.match(/(\w+)[^>]+>[^<]+<\/\1>/))
+      return tokenStylesWith(state, TOKEN_STYLES.html);
+
+    if (ch === "?" && stream.eat("?"))
+      return togglePhraseModifier(stream, state, "cite", /\?\?/, 2);
+
+    if (ch === "=" && stream.eat("="))
+      return togglePhraseModifier(stream, state, "notextile", /==/, 2);
+
+    if (ch === "-" && !stream.eat("-"))
+      return togglePhraseModifier(stream, state, "deletion", /-/, 1);
+
+    if (ch === "+")
+      return togglePhraseModifier(stream, state, "addition", /\+/, 1);
+
+    if (ch === "~")
+      return togglePhraseModifier(stream, state, "sub", /~/, 1);
+
+    if (ch === "^")
+      return togglePhraseModifier(stream, state, "sup", /\^/, 1);
+
+    if (ch === "%")
+      return togglePhraseModifier(stream, state, "span", /%/, 1);
+
+    if (ch === "@")
+      return togglePhraseModifier(stream, state, "code", /@/, 1);
+
+    if (ch === "!") {
+      var type = togglePhraseModifier(stream, state, "image", /(?:\([^\)]+\))?!/, 1);
+      stream.match(/^:\S+/); // optional Url portion
+      return type;
+    }
+    return tokenStyles(state);
+  }
+
+  function togglePhraseModifier(stream, state, phraseModifier, closeRE, openSize) {
+    var charBefore = stream.pos > openSize ? stream.string.charAt(stream.pos - openSize - 1) : null;
+    var charAfter = stream.peek();
+    if (state[phraseModifier]) {
+      if ((!charAfter || /\W/.test(charAfter)) && charBefore && /\S/.test(charBefore)) {
+        var type = tokenStyles(state);
+        state[phraseModifier] = false;
+        return type;
+      }
+    } else if ((!charBefore || /\W/.test(charBefore)) && charAfter && /\S/.test(charAfter) &&
+               stream.match(new RegExp("^.*\\S" + closeRE.source + "(?:\\W|$)"), false)) {
+      state[phraseModifier] = true;
+      state.mode = Modes.attributes;
+    }
+    return tokenStyles(state);
+  };
+
+  function tokenStyles(state) {
+    var disabled = textileDisabled(state);
+    if (disabled) return disabled;
+
+    var styles = [];
+    if (state.layoutType) styles.push(TOKEN_STYLES[state.layoutType]);
+
+    styles = styles.concat(activeStyles(
+      state, "addition", "bold", "cite", "code", "deletion", "em", "footCite",
+      "image", "italic", "link", "span", "strong", "sub", "sup", "table", "tableHeading"));
+
+    if (state.layoutType === "header")
+      styles.push(TOKEN_STYLES.header + "-" + state.header);
+
+    return styles.length ? styles.join(" ") : null;
+  }
+
+  function textileDisabled(state) {
+    var type = state.layoutType;
+
+    switch(type) {
+    case "notextile":
+    case "code":
+    case "pre":
+      return TOKEN_STYLES[type];
+    default:
+      if (state.notextile)
+        return TOKEN_STYLES.notextile + (type ? (" " + TOKEN_STYLES[type]) : "");
+      return null;
+    }
+  }
+
+  function tokenStylesWith(state, extraStyles) {
+    var disabled = textileDisabled(state);
+    if (disabled) return disabled;
+
+    var type = tokenStyles(state);
+    if (extraStyles)
+      return type ? (type + " " + extraStyles) : extraStyles;
+    else
+      return type;
+  }
+
+  function activeStyles(state) {
+    var styles = [];
+    for (var i = 1; i < arguments.length; ++i) {
+      if (state[arguments[i]])
+        styles.push(TOKEN_STYLES[arguments[i]]);
+    }
+    return styles;
+  }
+
+  function blankLine(state) {
+    var spanningLayout = state.spanningLayout, type = state.layoutType;
+
+    for (var key in state) if (state.hasOwnProperty(key))
+      delete state[key];
+
+    state.mode = Modes.newLayout;
+    if (spanningLayout) {
+      state.layoutType = type;
+      state.spanningLayout = true;
+    }
+  }
+
+  var REs = {
+    cache: {},
+    single: {
+      bc: "bc",
+      bq: "bq",
+      definitionList: /- .*?:=+/,
+      definitionListEnd: /.*=:\s*$/,
+      div: "div",
+      drawTable: /\|.*\|/,
+      foot: /fn\d+/,
+      header: /h[1-6]/,
+      html: /\s*<(?:\/)?(\w+)(?:[^>]+)?>(?:[^<]+<\/\1>)?/,
+      link: /[^"]+":\S/,
+      linkDefinition: /\[[^\s\]]+\]\S+/,
+      list: /(?:#+|\*+)/,
+      notextile: "notextile",
+      para: "p",
+      pre: "pre",
+      table: "table",
+      tableCellAttributes: /[\/\\]\d+/,
+      tableHeading: /\|_\./,
+      tableText: /[^"_\*\[\(\?\+~\^%@|-]+/,
+      text: /[^!"_=\*\[\(<\?\+~\^%@-]+/
+    },
+    attributes: {
+      align: /(?:<>|<|>|=)/,
+      selector: /\([^\(][^\)]+\)/,
+      lang: /\[[^\[\]]+\]/,
+      pad: /(?:\(+|\)+){1,2}/,
+      css: /\{[^\}]+\}/
+    },
+    createRe: function(name) {
+      switch (name) {
+      case "drawTable":
+        return REs.makeRe("^", REs.single.drawTable, "$");
+      case "html":
+        return REs.makeRe("^", REs.single.html, "(?:", REs.single.html, ")*", "$");
+      case "linkDefinition":
+        return REs.makeRe("^", REs.single.linkDefinition, "$");
+      case "listLayout":
+        return REs.makeRe("^", REs.single.list, RE("allAttributes"), "*\\s+");
+      case "tableCellAttributes":
+        return REs.makeRe("^", REs.choiceRe(REs.single.tableCellAttributes,
+                                            RE("allAttributes")), "+\\.");
+      case "type":
+        return REs.makeRe("^", RE("allTypes"));
+      case "typeLayout":
+        return REs.makeRe("^", RE("allTypes"), RE("allAttributes"),
+                          "*\\.\\.?", "(\\s+|$)");
+      case "attributes":
+        return REs.makeRe("^", RE("allAttributes"), "+");
+
+      case "allTypes":
+        return REs.choiceRe(REs.single.div, REs.single.foot,
+                            REs.single.header, REs.single.bc, REs.single.bq,
+                            REs.single.notextile, REs.single.pre, REs.single.table,
+                            REs.single.para);
+
+      case "allAttributes":
+        return REs.choiceRe(REs.attributes.selector, REs.attributes.css,
+                            REs.attributes.lang, REs.attributes.align, REs.attributes.pad);
+
+      default:
+        return REs.makeRe("^", REs.single[name]);
+      }
+    },
+    makeRe: function() {
+      var pattern = "";
+      for (var i = 0; i < arguments.length; ++i) {
+        var arg = arguments[i];
+        pattern += (typeof arg === "string") ? arg : arg.source;
+      }
+      return new RegExp(pattern);
+    },
+    choiceRe: function() {
+      var parts = [arguments[0]];
+      for (var i = 1; i < arguments.length; ++i) {
+        parts[i * 2 - 1] = "|";
+        parts[i * 2] = arguments[i];
+      }
+
+      parts.unshift("(?:");
+      parts.push(")");
+      return REs.makeRe.apply(null, parts);
+    }
+  };
+
+  function RE(name) {
+    return (REs.cache[name] || (REs.cache[name] = REs.createRe(name)));
+  }
+
+  var Modes = {
+    newLayout: function(stream, state) {
+      if (stream.match(RE("typeLayout"), false)) {
+        state.spanningLayout = false;
+        return (state.mode = Modes.blockType)(stream, state);
+      }
+      var newMode;
+      if (!textileDisabled(state)) {
+        if (stream.match(RE("listLayout"), false))
+          newMode = Modes.list;
+        else if (stream.match(RE("drawTable"), false))
+          newMode = Modes.table;
+        else if (stream.match(RE("linkDefinition"), false))
+          newMode = Modes.linkDefinition;
+        else if (stream.match(RE("definitionList")))
+          newMode = Modes.definitionList;
+        else if (stream.match(RE("html"), false))
+          newMode = Modes.html;
+      }
+      return (state.mode = (newMode || Modes.text))(stream, state);
+    },
+
+    blockType: function(stream, state) {
+      var match, type;
+      state.layoutType = null;
+
+      if (match = stream.match(RE("type")))
+        type = match[0];
+      else
+        return (state.mode = Modes.text)(stream, state);
+
+      if (match = type.match(RE("header"))) {
+        state.layoutType = "header";
+        state.header = parseInt(match[0][1]);
+      } else if (type.match(RE("bq"))) {
+        state.layoutType = "quote";
+      } else if (type.match(RE("bc"))) {
+        state.layoutType = "code";
+      } else if (type.match(RE("foot"))) {
+        state.layoutType = "footnote";
+      } else if (type.match(RE("notextile"))) {
+        state.layoutType = "notextile";
+      } else if (type.match(RE("pre"))) {
+        state.layoutType = "pre";
+      } else if (type.match(RE("div"))) {
+        state.layoutType = "div";
+      } else if (type.match(RE("table"))) {
+        state.layoutType = "table";
+      }
+
+      state.mode = Modes.attributes;
+      return tokenStyles(state);
+    },
+
+    text: function(stream, state) {
+      if (stream.match(RE("text"))) return tokenStyles(state);
+
+      var ch = stream.next();
+      if (ch === '"')
+        return (state.mode = Modes.link)(stream, state);
+      return handlePhraseModifier(stream, state, ch);
+    },
+
+    attributes: function(stream, state) {
+      state.mode = Modes.layoutLength;
+
+      if (stream.match(RE("attributes")))
+        return tokenStylesWith(state, TOKEN_STYLES.attributes);
+      else
+        return tokenStyles(state);
+    },
+
+    layoutLength: function(stream, state) {
+      if (stream.eat(".") && stream.eat("."))
+        state.spanningLayout = true;
+
+      state.mode = Modes.text;
+      return tokenStyles(state);
+    },
+
+    list: function(stream, state) {
+      var match = stream.match(RE("list"));
+      state.listDepth = match[0].length;
+      var listMod = (state.listDepth - 1) % 3;
+      if (!listMod)
+        state.layoutType = "list1";
+      else if (listMod === 1)
+        state.layoutType = "list2";
+      else
+        state.layoutType = "list3";
+
+      state.mode = Modes.attributes;
+      return tokenStyles(state);
+    },
+
+    link: function(stream, state) {
+      state.mode = Modes.text;
+      if (stream.match(RE("link"))) {
+        stream.match(/\S+/);
+        return tokenStylesWith(state, TOKEN_STYLES.link);
+      }
+      return tokenStyles(state);
+    },
+
+    linkDefinition: function(stream, state) {
+      stream.skipToEnd();
+      return tokenStylesWith(state, TOKEN_STYLES.linkDefinition);
+    },
+
+    definitionList: function(stream, state) {
+      stream.match(RE("definitionList"));
+
+      state.layoutType = "definitionList";
+
+      if (stream.match(/\s*$/))
+        state.spanningLayout = true;
+      else
+        state.mode = Modes.attributes;
+
+      return tokenStyles(state);
+    },
+
+    html: function(stream, state) {
+      stream.skipToEnd();
+      return tokenStylesWith(state, TOKEN_STYLES.html);
+    },
+
+    table: function(stream, state) {
+      state.layoutType = "table";
+      return (state.mode = Modes.tableCell)(stream, state);
+    },
+
+    tableCell: function(stream, state) {
+      if (stream.match(RE("tableHeading")))
+        state.tableHeading = true;
+      else
+        stream.eat("|");
+
+      state.mode = Modes.tableCellAttributes;
+      return tokenStyles(state);
+    },
+
+    tableCellAttributes: function(stream, state) {
+      state.mode = Modes.tableText;
+
+      if (stream.match(RE("tableCellAttributes")))
+        return tokenStylesWith(state, TOKEN_STYLES.attributes);
+      else
+        return tokenStyles(state);
+    },
+
+    tableText: function(stream, state) {
+      if (stream.match(RE("tableText")))
+        return tokenStyles(state);
+
+      if (stream.peek() === "|") { // end of cell
+        state.mode = Modes.tableCell;
+        return tokenStyles(state);
+      }
+      return handlePhraseModifier(stream, state, stream.next());
+    }
+  };
+
+  CodeMirror.defineMode("textile", function() {
+    return {
+      startState: function() {
+        return { mode: Modes.newLayout };
+      },
+      token: function(stream, state) {
+        if (stream.sol()) startNewLine(stream, state);
+        return state.mode(stream, state);
+      },
+      blankLine: blankLine
+    };
+  });
+
+  CodeMirror.defineMIME("text/x-textile", "textile");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tiddlywiki/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,154 @@
+<!doctype html>
+
+<title>CodeMirror: TiddlyWiki mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="tiddlywiki.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="tiddlywiki.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">TiddlyWiki</a>
+  </ul>
+</div>
+
+<article>
+<h2>TiddlyWiki mode</h2>
+
+
+<div><textarea id="code" name="code">
+!TiddlyWiki Formatting
+* Rendered versions can be found at: http://www.tiddlywiki.com/#Reference
+
+|!Option            | !Syntax            |
+|bold font          | ''bold''           |
+|italic type        | //italic//         |
+|underlined text    | __underlined__     |
+|strikethrough text | --strikethrough--  |
+|superscript text   | super^^script^^    |
+|subscript text     | sub~~script~~      |
+|highlighted text   | @@highlighted@@    |
+|preformatted text  | {{{preformatted}}} |
+
+!Block Elements
+<<<
+!Heading 1
+
+!!Heading 2
+
+!!!Heading 3
+
+!!!!Heading 4
+
+!!!!!Heading 5
+<<<
+
+!!Lists
+<<<
+* unordered list, level 1
+** unordered list, level 2
+*** unordered list, level 3
+
+# ordered list, level 1
+## ordered list, level 2
+### unordered list, level 3
+
+; definition list, term
+: definition list, description
+<<<
+
+!!Blockquotes
+<<<
+> blockquote, level 1
+>> blockquote, level 2
+>>> blockquote, level 3
+
+> blockquote
+<<<
+
+!!Preformatted Text
+<<<
+{{{
+preformatted (e.g. code)
+}}}
+<<<
+
+!!Code Sections
+<<<
+{{{
+Text style code
+}}}
+
+//{{{
+JS styled code. TiddlyWiki mixed mode should support highlighter switching in the future.
+//}}}
+
+<!--{{{-->
+XML styled code. TiddlyWiki mixed mode should support highlighter switching in the future.
+<!--}}}-->
+<<<
+
+!!Tables
+<<<
+|CssClass|k
+|!heading column 1|!heading column 2|
+|row 1, column 1|row 1, column 2|
+|row 2, column 1|row 2, column 2|
+|>|COLSPAN|
+|ROWSPAN| ... |
+|~| ... |
+|CssProperty:value;...| ... |
+|caption|c
+
+''Annotation:''
+* The {{{>}}} marker creates a "colspan", causing the current cell to merge with the one to the right.
+* The {{{~}}} marker creates a "rowspan", causing the current cell to merge with the one above.
+<<<
+!!Images /% TODO %/
+cf. [[TiddlyWiki.com|http://www.tiddlywiki.com/#EmbeddedImages]]
+
+!Hyperlinks
+* [[WikiWords|WikiWord]] are automatically transformed to hyperlinks to the respective tiddler
+** the automatic transformation can be suppressed by preceding the respective WikiWord with a tilde ({{{~}}}): {{{~WikiWord}}}
+* [[PrettyLinks]] are enclosed in square brackets and contain the desired tiddler name: {{{[[tiddler name]]}}}
+** optionally, a custom title or description can be added, separated by a pipe character ({{{|}}}): {{{[[title|target]]}}}<br>'''N.B.:''' In this case, the target can also be any website (i.e. URL).
+
+!Custom Styling
+* {{{@@CssProperty:value;CssProperty:value;...@@}}}<br>''N.B.:'' CSS color definitions should use lowercase letters to prevent the inadvertent creation of WikiWords.
+* <html><code>{{customCssClass{...}}}</code></html>
+* raw HTML can be inserted by enclosing the respective code in HTML tags: {{{<html> ... </html>}}}
+
+!Special Markers
+* {{{<br>}}} forces a manual line break
+* {{{----}}} creates a horizontal ruler
+* [[HTML entities|http://www.tiddlywiki.com/#HtmlEntities]]
+* [[HTML entities local|HtmlEntities]]
+* {{{<<macroName>>}}} calls the respective [[macro|Macros]]
+* To hide text within a tiddler so that it is not displayed, it can be wrapped in {{{/%}}} and {{{%/}}}.<br/>This can be a useful trick for hiding drafts or annotating complex markup.
+* To prevent wiki markup from taking effect for a particular section, that section can be enclosed in three double quotes: e.g. {{{"""WikiWord"""}}}.
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: 'tiddlywiki',      
+        lineNumbers: true,
+        matchBrackets: true
+      });
+    </script>
+
+    <p>TiddlyWiki mode supports a single configuration.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-tiddlywiki</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tiddlywiki/tiddlywiki.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,14 @@
+span.cm-underlined {
+  text-decoration: underline;
+}
+span.cm-strikethrough {
+  text-decoration: line-through;
+}
+span.cm-brace {
+  color: #170;
+  font-weight: bold;
+}
+span.cm-table {
+  color: blue;
+  font-weight: bold;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tiddlywiki/tiddlywiki.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,308 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/***
+    |''Name''|tiddlywiki.js|
+    |''Description''|Enables TiddlyWikiy syntax highlighting using CodeMirror|
+    |''Author''|PMario|
+    |''Version''|0.1.7|
+    |''Status''|''stable''|
+    |''Source''|[[GitHub|https://github.com/pmario/CodeMirror2/blob/tw-syntax/mode/tiddlywiki]]|
+    |''Documentation''|https://codemirror.tiddlyspace.com/|
+    |''License''|[[MIT License|http://www.opensource.org/licenses/mit-license.php]]|
+    |''CoreVersion''|2.5.0|
+    |''Requires''|codemirror.js|
+    |''Keywords''|syntax highlighting color code mirror codemirror|
+    ! Info
+    CoreVersion parameter is needed for TiddlyWiki only!
+***/
+
+(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.defineMode("tiddlywiki", function () {
+  // Tokenizer
+  var textwords = {};
+
+  var keywords = {
+    "allTags": true, "closeAll": true, "list": true,
+    "newJournal": true, "newTiddler": true,
+    "permaview": true, "saveChanges": true,
+    "search": true, "slider": true, "tabs": true,
+    "tag": true, "tagging": true, "tags": true,
+    "tiddler": true, "timeline": true,
+    "today": true, "version": true, "option": true,
+    "with": true, "filter": true
+  };
+
+  var isSpaceName = /[\w_\-]/i,
+      reHR = /^\-\-\-\-+$/,                                 // <hr>
+      reWikiCommentStart = /^\/\*\*\*$/,            // /***
+      reWikiCommentStop = /^\*\*\*\/$/,             // ***/
+      reBlockQuote = /^<<<$/,
+
+      reJsCodeStart = /^\/\/\{\{\{$/,                       // //{{{ js block start
+      reJsCodeStop = /^\/\/\}\}\}$/,                        // //}}} js stop
+      reXmlCodeStart = /^<!--\{\{\{-->$/,           // xml block start
+      reXmlCodeStop = /^<!--\}\}\}-->$/,            // xml stop
+
+      reCodeBlockStart = /^\{\{\{$/,                        // {{{ TW text div block start
+      reCodeBlockStop = /^\}\}\}$/,                 // }}} TW text stop
+
+      reUntilCodeStop = /.*?\}\}\}/;
+
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+
+  function tokenBase(stream, state) {
+    var sol = stream.sol(), ch = stream.peek();
+
+    state.block = false;        // indicates the start of a code block.
+
+    // check start of  blocks
+    if (sol && /[<\/\*{}\-]/.test(ch)) {
+      if (stream.match(reCodeBlockStart)) {
+        state.block = true;
+        return chain(stream, state, twTokenCode);
+      }
+      if (stream.match(reBlockQuote))
+        return 'quote';
+      if (stream.match(reWikiCommentStart) || stream.match(reWikiCommentStop))
+        return 'comment';
+      if (stream.match(reJsCodeStart) || stream.match(reJsCodeStop) || stream.match(reXmlCodeStart) || stream.match(reXmlCodeStop))
+        return 'comment';
+      if (stream.match(reHR))
+        return 'hr';
+    }
+
+    stream.next();
+    if (sol && /[\/\*!#;:>|]/.test(ch)) {
+      if (ch == "!") { // tw header
+        stream.skipToEnd();
+        return "header";
+      }
+      if (ch == "*") { // tw list
+        stream.eatWhile('*');
+        return "comment";
+      }
+      if (ch == "#") { // tw numbered list
+        stream.eatWhile('#');
+        return "comment";
+      }
+      if (ch == ";") { // definition list, term
+        stream.eatWhile(';');
+        return "comment";
+      }
+      if (ch == ":") { // definition list, description
+        stream.eatWhile(':');
+        return "comment";
+      }
+      if (ch == ">") { // single line quote
+        stream.eatWhile(">");
+        return "quote";
+      }
+      if (ch == '|')
+        return 'header';
+    }
+
+    if (ch == '{' && stream.match('{{'))
+      return chain(stream, state, twTokenCode);
+
+    // rudimentary html:// file:// link matching. TW knows much more ...
+    if (/[hf]/i.test(ch) &&
+        /[ti]/i.test(stream.peek()) &&
+        stream.match(/\b(ttps?|tp|ile):\/\/[\-A-Z0-9+&@#\/%?=~_|$!:,.;]*[A-Z0-9+&@#\/%=~_|$]/i))
+      return "link";
+
+    // just a little string indicator, don't want to have the whole string covered
+    if (ch == '"')
+      return 'string';
+
+    if (ch == '~')    // _no_ CamelCase indicator should be bold
+      return 'brace';
+
+    if (/[\[\]]/.test(ch) && stream.match(ch)) // check for [[..]]
+      return 'brace';
+
+    if (ch == "@") {    // check for space link. TODO fix @@...@@ highlighting
+      stream.eatWhile(isSpaceName);
+      return "link";
+    }
+
+    if (/\d/.test(ch)) {        // numbers
+      stream.eatWhile(/\d/);
+      return "number";
+    }
+
+    if (ch == "/") { // tw invisible comment
+      if (stream.eat("%")) {
+        return chain(stream, state, twTokenComment);
+      } else if (stream.eat("/")) { //
+        return chain(stream, state, twTokenEm);
+      }
+    }
+
+    if (ch == "_" && stream.eat("_")) // tw underline
+        return chain(stream, state, twTokenUnderline);
+
+    // strikethrough and mdash handling
+    if (ch == "-" && stream.eat("-")) {
+      // if strikethrough looks ugly, change CSS.
+      if (stream.peek() != ' ')
+        return chain(stream, state, twTokenStrike);
+      // mdash
+      if (stream.peek() == ' ')
+        return 'brace';
+    }
+
+    if (ch == "'" && stream.eat("'")) // tw bold
+      return chain(stream, state, twTokenStrong);
+
+    if (ch == "<" && stream.eat("<")) // tw macro
+      return chain(stream, state, twTokenMacro);
+
+    // core macro handling
+    stream.eatWhile(/[\w\$_]/);
+    return textwords.propertyIsEnumerable(stream.current()) ? "keyword" : null
+  }
+
+  // tw invisible comment
+  function twTokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "%");
+    }
+    return "comment";
+  }
+
+  // tw strong / bold
+  function twTokenStrong(stream, state) {
+    var maybeEnd = false,
+    ch;
+    while (ch = stream.next()) {
+      if (ch == "'" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "'");
+    }
+    return "strong";
+  }
+
+  // tw code
+  function twTokenCode(stream, state) {
+    var sb = state.block;
+
+    if (sb && stream.current()) {
+      return "comment";
+    }
+
+    if (!sb && stream.match(reUntilCodeStop)) {
+      state.tokenize = tokenBase;
+      return "comment";
+    }
+
+    if (sb && stream.sol() && stream.match(reCodeBlockStop)) {
+      state.tokenize = tokenBase;
+      return "comment";
+    }
+
+    stream.next();
+    return "comment";
+  }
+
+  // tw em / italic
+  function twTokenEm(stream, state) {
+    var maybeEnd = false,
+    ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "/");
+    }
+    return "em";
+  }
+
+  // tw underlined text
+  function twTokenUnderline(stream, state) {
+    var maybeEnd = false,
+    ch;
+    while (ch = stream.next()) {
+      if (ch == "_" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "_");
+    }
+    return "underlined";
+  }
+
+  // tw strike through text looks ugly
+  // change CSS if needed
+  function twTokenStrike(stream, state) {
+    var maybeEnd = false, ch;
+
+    while (ch = stream.next()) {
+      if (ch == "-" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "-");
+    }
+    return "strikethrough";
+  }
+
+  // macro
+  function twTokenMacro(stream, state) {
+    if (stream.current() == '<<') {
+      return 'macro';
+    }
+
+    var ch = stream.next();
+    if (!ch) {
+      state.tokenize = tokenBase;
+      return null;
+    }
+    if (ch == ">") {
+      if (stream.peek() == '>') {
+        stream.next();
+        state.tokenize = tokenBase;
+        return "macro";
+      }
+    }
+
+    stream.eatWhile(/[\w\$_]/);
+    return keywords.propertyIsEnumerable(stream.current()) ? "keyword" : null
+  }
+
+  // Interface
+  return {
+    startState: function () {
+      return {tokenize: tokenBase};
+    },
+
+    token: function (stream, state) {
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      return style;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-tiddlywiki", "tiddlywiki");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tiki/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+<!doctype html>
+
+<title>CodeMirror: Tiki wiki mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="tiki.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="tiki.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Tiki wiki</a>
+  </ul>
+</div>
+
+<article>
+<h2>Tiki wiki mode</h2>
+
+
+<div><textarea id="code" name="code">
+Headings
+!Header 1
+!!Header 2
+!!!Header 3
+!!!!Header 4
+!!!!!Header 5
+!!!!!!Header 6
+
+Styling
+-=titlebar=-
+^^ Box on multi
+lines
+of content^^
+__bold__
+''italic''
+===underline===
+::center::
+--Line Through--
+
+Operators
+~np~No parse~/np~
+
+Link
+[link|desc|nocache]
+
+Wiki
+((Wiki))
+((Wiki|desc))
+((Wiki|desc|timeout))
+
+Table
+||row1 col1|row1 col2|row1 col3
+row2 col1|row2 col2|row2 col3
+row3 col1|row3 col2|row3 col3||
+
+Lists:
+*bla
+**bla-1
+++continue-bla-1
+***bla-2
+++continue-bla-1
+*bla
++continue-bla
+#bla
+** tra-la-la
++continue-bla
+#bla
+
+Plugin (standard):
+{PLUGIN(attr="my attr")}
+Plugin Body
+{PLUGIN}
+
+Plugin (inline):
+{plugin attr="my attr"}
+</textarea></div>
+
+<script>
+	var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: 'tiki',      
+        lineNumbers: true
+    });
+</script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tiki/tiki.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,26 @@
+.cm-tw-syntaxerror {
+	color: #FFF;
+	background-color: #900;
+}
+
+.cm-tw-deleted {
+	text-decoration: line-through;
+}
+
+.cm-tw-header5 {
+	font-weight: bold;
+}
+.cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/
+	padding-left: 10px;
+}
+
+.cm-tw-box {
+	border-top-width: 0px !important;
+	border-style: solid;
+	border-width: 1px;
+	border-color: inherit;
+}
+
+.cm-tw-underline {
+	text-decoration: underline;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tiki/tiki.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,312 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode('tiki', function(config) {
+  function inBlock(style, terminator, returnTokenizer) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.match(terminator)) {
+          state.tokenize = inText;
+          break;
+        }
+        stream.next();
+      }
+
+      if (returnTokenizer) state.tokenize = returnTokenizer;
+
+      return style;
+    };
+  }
+
+  function inLine(style) {
+    return function(stream, state) {
+      while(!stream.eol()) {
+        stream.next();
+      }
+      state.tokenize = inText;
+      return style;
+    };
+  }
+
+  function inText(stream, state) {
+    function chain(parser) {
+      state.tokenize = parser;
+      return parser(stream, state);
+    }
+
+    var sol = stream.sol();
+    var ch = stream.next();
+
+    //non start of line
+    switch (ch) { //switch is generally much faster than if, so it is used here
+    case "{": //plugin
+      stream.eat("/");
+      stream.eatSpace();
+      stream.eatWhile(/[^\s\u00a0=\"\'\/?(}]/);
+      state.tokenize = inPlugin;
+      return "tag";
+    case "_": //bold
+      if (stream.eat("_"))
+        return chain(inBlock("strong", "__", inText));
+      break;
+    case "'": //italics
+      if (stream.eat("'"))
+        return chain(inBlock("em", "''", inText));
+      break;
+    case "(":// Wiki Link
+      if (stream.eat("("))
+        return chain(inBlock("variable-2", "))", inText));
+      break;
+    case "[":// Weblink
+      return chain(inBlock("variable-3", "]", inText));
+      break;
+    case "|": //table
+      if (stream.eat("|"))
+        return chain(inBlock("comment", "||"));
+      break;
+    case "-":
+      if (stream.eat("=")) {//titleBar
+        return chain(inBlock("header string", "=-", inText));
+      } else if (stream.eat("-")) {//deleted
+        return chain(inBlock("error tw-deleted", "--", inText));
+      }
+      break;
+    case "=": //underline
+      if (stream.match("=="))
+        return chain(inBlock("tw-underline", "===", inText));
+      break;
+    case ":":
+      if (stream.eat(":"))
+        return chain(inBlock("comment", "::"));
+      break;
+    case "^": //box
+      return chain(inBlock("tw-box", "^"));
+      break;
+    case "~": //np
+      if (stream.match("np~"))
+        return chain(inBlock("meta", "~/np~"));
+      break;
+    }
+
+    //start of line types
+    if (sol) {
+      switch (ch) {
+      case "!": //header at start of line
+        if (stream.match('!!!!!')) {
+          return chain(inLine("header string"));
+        } else if (stream.match('!!!!')) {
+          return chain(inLine("header string"));
+        } else if (stream.match('!!!')) {
+          return chain(inLine("header string"));
+        } else if (stream.match('!!')) {
+          return chain(inLine("header string"));
+        } else {
+          return chain(inLine("header string"));
+        }
+        break;
+      case "*": //unordered list line item, or <li /> at start of line
+      case "#": //ordered list line item, or <li /> at start of line
+      case "+": //ordered list line item, or <li /> at start of line
+        return chain(inLine("tw-listitem bracket"));
+        break;
+      }
+    }
+
+    //stream.eatWhile(/[&{]/); was eating up plugins, turned off to act less like html and more like tiki
+    return null;
+  }
+
+  var indentUnit = config.indentUnit;
+
+  // Return variables for tokenizers
+  var pluginName, type;
+  function inPlugin(stream, state) {
+    var ch = stream.next();
+    var peek = stream.peek();
+
+    if (ch == "}") {
+      state.tokenize = inText;
+      //type = ch == ")" ? "endPlugin" : "selfclosePlugin"; inPlugin
+      return "tag";
+    } else if (ch == "(" || ch == ")") {
+      return "bracket";
+    } else if (ch == "=") {
+      type = "equals";
+
+      if (peek == ">") {
+        stream.next();
+        peek = stream.peek();
+      }
+
+      //here we detect values directly after equal character with no quotes
+      if (!/[\'\"]/.test(peek)) {
+        state.tokenize = inAttributeNoQuote();
+      }
+      //end detect values
+
+      return "operator";
+    } else if (/[\'\"]/.test(ch)) {
+      state.tokenize = inAttribute(ch);
+      return state.tokenize(stream, state);
+    } else {
+      stream.eatWhile(/[^\s\u00a0=\"\'\/?]/);
+      return "keyword";
+    }
+  }
+
+  function inAttribute(quote) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.next() == quote) {
+          state.tokenize = inPlugin;
+          break;
+        }
+      }
+      return "string";
+    };
+  }
+
+  function inAttributeNoQuote() {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        var ch = stream.next();
+        var peek = stream.peek();
+        if (ch == " " || ch == "," || /[ )}]/.test(peek)) {
+      state.tokenize = inPlugin;
+      break;
+    }
+  }
+  return "string";
+};
+                     }
+
+var curState, setStyle;
+function pass() {
+  for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
+}
+
+function cont() {
+  pass.apply(null, arguments);
+  return true;
+}
+
+function pushContext(pluginName, startOfLine) {
+  var noIndent = curState.context && curState.context.noIndent;
+  curState.context = {
+    prev: curState.context,
+    pluginName: pluginName,
+    indent: curState.indented,
+    startOfLine: startOfLine,
+    noIndent: noIndent
+  };
+}
+
+function popContext() {
+  if (curState.context) curState.context = curState.context.prev;
+}
+
+function element(type) {
+  if (type == "openPlugin") {curState.pluginName = pluginName; return cont(attributes, endplugin(curState.startOfLine));}
+  else if (type == "closePlugin") {
+    var err = false;
+    if (curState.context) {
+      err = curState.context.pluginName != pluginName;
+      popContext();
+    } else {
+      err = true;
+    }
+    if (err) setStyle = "error";
+    return cont(endcloseplugin(err));
+  }
+  else if (type == "string") {
+    if (!curState.context || curState.context.name != "!cdata") pushContext("!cdata");
+    if (curState.tokenize == inText) popContext();
+    return cont();
+  }
+  else return cont();
+}
+
+function endplugin(startOfLine) {
+  return function(type) {
+    if (
+      type == "selfclosePlugin" ||
+        type == "endPlugin"
+    )
+      return cont();
+    if (type == "endPlugin") {pushContext(curState.pluginName, startOfLine); return cont();}
+    return cont();
+  };
+}
+
+function endcloseplugin(err) {
+  return function(type) {
+    if (err) setStyle = "error";
+    if (type == "endPlugin") return cont();
+    return pass();
+  };
+}
+
+function attributes(type) {
+  if (type == "keyword") {setStyle = "attribute"; return cont(attributes);}
+  if (type == "equals") return cont(attvalue, attributes);
+  return pass();
+}
+function attvalue(type) {
+  if (type == "keyword") {setStyle = "string"; return cont();}
+  if (type == "string") return cont(attvaluemaybe);
+  return pass();
+}
+function attvaluemaybe(type) {
+  if (type == "string") return cont(attvaluemaybe);
+  else return pass();
+}
+return {
+  startState: function() {
+    return {tokenize: inText, cc: [], indented: 0, startOfLine: true, pluginName: null, context: null};
+  },
+  token: function(stream, state) {
+    if (stream.sol()) {
+      state.startOfLine = true;
+      state.indented = stream.indentation();
+    }
+    if (stream.eatSpace()) return null;
+
+    setStyle = type = pluginName = null;
+    var style = state.tokenize(stream, state);
+    if ((style || type) && style != "comment") {
+      curState = state;
+      while (true) {
+        var comb = state.cc.pop() || element;
+        if (comb(type || style)) break;
+      }
+    }
+    state.startOfLine = false;
+    return setStyle || style;
+  },
+  indent: function(state, textAfter) {
+    var context = state.context;
+    if (context && context.noIndent) return 0;
+    if (context && /^{\//.test(textAfter))
+        context = context.prev;
+    while (context && !context.startOfLine)
+        context = context.prev;
+    if (context) return context.indent + indentUnit;
+    else return 0;
+  },
+  electricChars: "/"
+};
+});
+
+CodeMirror.defineMIME("text/tiki", "tiki");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/toml/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,73 @@
+<!doctype html>
+
+<title>CodeMirror: TOML Mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="toml.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">TOML Mode</a>
+  </ul>
+</div>
+
+<article>
+<h2>TOML Mode</h2>
+<form><textarea id="code" name="code">
+# This is a TOML document. Boom.
+
+title = "TOML Example"
+
+[owner]
+name = "Tom Preston-Werner"
+organization = "GitHub"
+bio = "GitHub Cofounder &amp; CEO\nLikes tater tots and beer."
+dob = 1979-05-27T07:32:00Z # First class dates? Why not?
+
+[database]
+server = "192.168.1.1"
+ports = [ 8001, 8001, 8002 ]
+connection_max = 5000
+enabled = true
+
+[servers]
+
+  # You can indent as you please. Tabs or spaces. TOML don't care.
+  [servers.alpha]
+  ip = "10.0.0.1"
+  dc = "eqdc10"
+  
+  [servers.beta]
+  ip = "10.0.0.2"
+  dc = "eqdc10"
+  
+[clients]
+data = [ ["gamma", "delta"], [1, 2] ]
+
+# Line breaks are OK when inside arrays
+hosts = [
+  "alpha",
+  "omega"
+]
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: {name: "toml"},
+        lineNumbers: true
+      });
+    </script>
+    <h3>The TOML Mode</h3>
+      <p> Created by Forbes Lindesay.</p>
+    <p><strong>MIME type defined:</strong> <code>text/x-toml</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/toml/toml.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,88 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("toml", function () {
+  return {
+    startState: function () {
+      return {
+        inString: false,
+        stringType: "",
+        lhs: true,
+        inArray: 0
+      };
+    },
+    token: function (stream, state) {
+      //check for state changes
+      if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
+        state.stringType = stream.peek();
+        stream.next(); // Skip quote
+        state.inString = true; // Update state
+      }
+      if (stream.sol() && state.inArray === 0) {
+        state.lhs = true;
+      }
+      //return state
+      if (state.inString) {
+        while (state.inString && !stream.eol()) {
+          if (stream.peek() === state.stringType) {
+            stream.next(); // Skip quote
+            state.inString = false; // Clear flag
+          } else if (stream.peek() === '\\') {
+            stream.next();
+            stream.next();
+          } else {
+            stream.match(/^.[^\\\"\']*/);
+          }
+        }
+        return state.lhs ? "property string" : "string"; // Token style
+      } else if (state.inArray && stream.peek() === ']') {
+        stream.next();
+        state.inArray--;
+        return 'bracket';
+      } else if (state.lhs && stream.peek() === '[' && stream.skipTo(']')) {
+        stream.next();//skip closing ]
+        // array of objects has an extra open & close []
+        if (stream.peek() === ']') stream.next();
+        return "atom";
+      } else if (stream.peek() === "#") {
+        stream.skipToEnd();
+        return "comment";
+      } else if (stream.eatSpace()) {
+        return null;
+      } else if (state.lhs && stream.eatWhile(function (c) { return c != '=' && c != ' '; })) {
+        return "property";
+      } else if (state.lhs && stream.peek() === "=") {
+        stream.next();
+        state.lhs = false;
+        return null;
+      } else if (!state.lhs && stream.match(/^\d\d\d\d[\d\-\:\.T]*Z/)) {
+        return 'atom'; //date
+      } else if (!state.lhs && (stream.match('true') || stream.match('false'))) {
+        return 'atom';
+      } else if (!state.lhs && stream.peek() === '[') {
+        state.inArray++;
+        stream.next();
+        return 'bracket';
+      } else if (!state.lhs && stream.match(/^\-?\d+(?:\.\d+)?/)) {
+        return 'number';
+      } else if (!stream.eatSpace()) {
+        stream.next();
+      }
+      return null;
+    }
+  };
+});
+
+CodeMirror.defineMIME('text/x-toml', 'toml');
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tornado/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,63 @@
+<!doctype html>
+
+<title>CodeMirror: Tornado template mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="tornado.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/marijnh/codemirror">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Tornado</a>
+  </ul>
+</div>
+
+<article>
+<h2>Tornado template mode</h2>
+<form><textarea id="code" name="code">
+<!doctype html>
+<html>
+    <head>
+        <title>My Tornado web application</title>
+    </head>
+    <body>
+        <h1>
+            {{ title }}
+        </h1>
+        <ul class="my-list">
+            {% for item in items %}
+                <li>{% item.name %}</li>
+            {% empty %}
+                <li>You have no items in your list.</li>
+            {% end %}
+        </ul>
+    </body>
+</html>
+</textarea></form>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        mode: "tornado",
+        indentUnit: 4,
+        indentWithTabs: true
+      });
+    </script>
+
+    <p>Mode for HTML with embedded Tornado template markup.</p>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-tornado</code></p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/tornado/tornado.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,68 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"),
+        require("../../addon/mode/overlay"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../htmlmixed/htmlmixed",
+            "../../addon/mode/overlay"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineMode("tornado:inner", function() {
+    var keywords = ["and","as","assert","autoescape","block","break","class","comment","context",
+                    "continue","datetime","def","del","elif","else","end","escape","except",
+                    "exec","extends","false","finally","for","from","global","if","import","in",
+                    "include","is","json_encode","lambda","length","linkify","load","module",
+                    "none","not","or","pass","print","put","raise","raw","return","self","set",
+                    "squeeze","super","true","try","url_escape","while","with","without","xhtml_escape","yield"];
+    keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
+
+    function tokenBase (stream, state) {
+      stream.eatWhile(/[^\{]/);
+      var ch = stream.next();
+      if (ch == "{") {
+        if (ch = stream.eat(/\{|%|#/)) {
+          state.tokenize = inTag(ch);
+          return "tag";
+        }
+      }
+    }
+    function inTag (close) {
+      if (close == "{") {
+        close = "}";
+      }
+      return function (stream, state) {
+        var ch = stream.next();
+        if ((ch == close) && stream.eat("}")) {
+          state.tokenize = tokenBase;
+          return "tag";
+        }
+        if (stream.match(keywords)) {
+          return "keyword";
+        }
+        return close == "#" ? "comment" : "string";
+      };
+    }
+    return {
+      startState: function () {
+        return {tokenize: tokenBase};
+      },
+      token: function (stream, state) {
+        return state.tokenize(stream, state);
+      }
+    };
+  });
+
+  CodeMirror.defineMode("tornado", function(config) {
+    var htmlBase = CodeMirror.getMode(config, "text/html");
+    var tornadoInner = CodeMirror.getMode(config, "tornado:inner");
+    return CodeMirror.overlayMode(htmlBase, tornadoInner);
+  });
+
+  CodeMirror.defineMIME("text/x-tornado", "tornado");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/troff/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,146 @@
+<!doctype html>
+
+<title>CodeMirror: troff mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src=troff.js></script>
+<style type=text/css>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">troff</a>
+  </ul>
+</div>
+
+<article>
+<h2>troff</h2>
+
+
+<textarea id=code>
+'\" t
+.\"     Title: mkvextract
+.TH "MKVEXTRACT" "1" "2015\-02\-28" "MKVToolNix 7\&.7\&.0" "User Commands"
+.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+.ie \n(.g .ds Aq \(aq
+.el       .ds Aq '
+.\" -----------------------------------------------------------------
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.SH "NAME"
+mkvextract \- extract tracks from Matroska(TM) files into other files
+.SH "SYNOPSIS"
+.HP \w'\fBmkvextract\fR\ 'u
+\fBmkvextract\fR {mode} {source\-filename} [options] [extraction\-spec]
+.SH "DESCRIPTION"
+.PP
+.B mkvextract
+extracts specific parts from a
+.I Matroska(TM)
+file to other useful formats\&. The first argument,
+\fBmode\fR, tells
+\fBmkvextract\fR(1)
+what to extract\&. Currently supported is the extraction of
+tracks,
+tags,
+attachments,
+chapters,
+CUE sheets,
+timecodes
+and
+cues\&. The second argument is the name of the source file\&. It must be a
+Matroska(TM)
+file\&. All following arguments are options and extraction specifications; both of which depend on the selected mode\&.
+.SS "Common options"
+.PP
+The following options are available in all modes and only described once in this section\&.
+.PP
+\fB\-f\fR, \fB\-\-parse\-fully\fR
+.RS 4
+Sets the parse mode to \*(Aqfull\*(Aq\&. The default mode does not parse the whole file but uses the meta seek elements for locating the required elements of a source file\&. In 99% of all cases this is enough\&. But for files that do not contain meta seek elements or which are damaged the user might have to use this mode\&. A full scan of a file can take a couple of minutes while a fast scan only takes seconds\&.
+.RE
+.PP
+\fB\-\-command\-line\-charset\fR \fIcharacter\-set\fR
+.RS 4
+Sets the character set to convert strings given on the command line from\&. It defaults to the character set given by system\*(Aqs current locale\&.
+.RE
+.PP
+\fB\-\-output\-charset\fR \fIcharacter\-set\fR
+.RS 4
+Sets the character set to which strings are converted that are to be output\&. It defaults to the character set given by system\*(Aqs current locale\&.
+.RE
+.PP
+\fB\-r\fR, \fB\-\-redirect\-output\fR \fIfile\-name\fR
+.RS 4
+Writes all messages to the file
+\fIfile\-name\fR
+instead of to the console\&. While this can be done easily with output redirection there are cases in which this option is needed: when the terminal reinterprets the output before writing it to a file\&. The character set set with
+\fB\-\-output\-charset\fR
+is honored\&.
+.RE
+.PP
+\fB\-\-ui\-language\fR \fIcode\fR
+.RS 4
+Forces the translations for the language
+\fIcode\fR
+to be used (e\&.g\&. \*(Aqde_DE\*(Aq for the German translations)\&. It is preferable to use the environment variables
+\fILANG\fR,
+\fILC_MESSAGES\fR
+and
+\fILC_ALL\fR
+though\&. Entering \*(Aqlist\*(Aq as the
+\fIcode\fR
+will cause
+\fBmkvextract\fR(1)
+to output a list of available translations\&.
+
+.\" [...]
+
+.SH "SEE ALSO"
+.PP
+\fBmkvmerge\fR(1),
+\fBmkvinfo\fR(1),
+\fBmkvpropedit\fR(1),
+\fBmmg\fR(1)
+.SH "WWW"
+.PP
+The latest version can always be found at
+\m[blue]\fBthe MKVToolNix homepage\fR\m[]\&\s-2\u[1]\d\s+2\&.
+.SH "AUTHOR"
+.PP
+\(co \fBMoritz Bunkus\fR <\&moritz@bunkus\&.org\&>
+.RS 4
+Developer
+.RE
+.SH "NOTES"
+.IP " 1." 4
+the MKVToolNix homepage
+.RS 4
+\%https://www.bunkus.org/videotools/mkvtoolnix/
+.RE
+</textarea>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById('code'), {
+    mode: 'troff',
+    lineNumbers: true,
+    matchBrackets: false
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>troff</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/troff/troff.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,84 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object")
+    mod(require("../../lib/codemirror"));
+  else if (typeof define == "function" && define.amd)
+    define(["../../lib/codemirror"], mod);
+  else
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+CodeMirror.defineMode('troff', function() {
+
+  var words = {};
+
+  function tokenBase(stream) {
+    if (stream.eatSpace()) return null;
+
+    var sol = stream.sol();
+    var ch = stream.next();
+
+    if (ch === '\\') {
+      if (stream.match('fB') || stream.match('fR') || stream.match('fI') ||
+          stream.match('u')  || stream.match('d')  ||
+          stream.match('%')  || stream.match('&')) {
+        return 'string';
+      }
+      if (stream.match('m[')) {
+        stream.skipTo(']');
+        stream.next();
+        return 'string';
+      }
+      if (stream.match('s+') || stream.match('s-')) {
+        stream.eatWhile(/[\d-]/);
+        return 'string';
+      }
+      if (stream.match('\(') || stream.match('*\(')) {
+        stream.eatWhile(/[\w-]/);
+        return 'string';
+      }
+      return 'string';
+    }
+    if (sol && (ch === '.' || ch === '\'')) {
+      if (stream.eat('\\') && stream.eat('\"')) {
+        stream.skipToEnd();
+        return 'comment';
+      }
+    }
+    if (sol && ch === '.') {
+      if (stream.match('B ') || stream.match('I ') || stream.match('R ')) {
+        return 'attribute';
+      }
+      if (stream.match('TH ') || stream.match('SH ') || stream.match('SS ') || stream.match('HP ')) {
+        stream.skipToEnd();
+        return 'quote';
+      }
+      if ((stream.match(/[A-Z]/) && stream.match(/[A-Z]/)) || (stream.match(/[a-z]/) && stream.match(/[a-z]/))) {
+        return 'attribute';
+      }
+    }
+    stream.eatWhile(/[\w-]/);
+    var cur = stream.current();
+    return words.hasOwnProperty(cur) ? words[cur] : null;
+  }
+
+  function tokenize(stream, state) {
+    return (state.tokens[0] || tokenBase) (stream, state);
+  };
+
+  return {
+    startState: function() {return {tokens:[]};},
+    token: function(stream, state) {
+      return tokenize(stream, state);
+    }
+  };
+});
+
+CodeMirror.defineMIME('text/troff', 'troff');
+CodeMirror.defineMIME('text/x-troff', 'troff');
+CodeMirror.defineMIME('application/x-troff', 'troff');
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ttcn-cfg/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,116 @@
+<!doctype html>
+
+<title>CodeMirror: TTCN-CFG mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="ttcn-cfg.js"></script>
+<style>
+    .CodeMirror {
+        border-top: 1px solid black;
+        border-bottom: 1px solid black;
+    }
+</style>
+<div id=nav>
+    <a href="https://codemirror.net/5"><h1>CodeMirror</h1>
+        <img id=logo src="../../doc/logo.png" alt="">
+    </a>
+
+    <ul>
+        <li><a href="../../index.html">Home</a>
+        <li><a href="../../doc/manual.html">Manual</a>
+        <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+    </ul>
+    <ul>
+        <li><a href="../index.html">Language modes</a>
+        <li><a class=active href="http://en.wikipedia.org/wiki/TTCN">TTCN-CFG</a>
+    </ul>
+</div>
+<article>
+    <h2>TTCN-CFG example</h2>
+    <div>
+        <textarea id="ttcn-cfg-code">
+[MODULE_PARAMETERS]
+# This section shall contain the values of all parameters that are defined in your TTCN-3 modules.
+
+[LOGGING]
+# In this section you can specify the name of the log file and the classes of events
+# you want to log into the file or display on console (standard error).
+
+LogFile := "logs/%e.%h-%r.%s"
+FileMask := LOG_ALL | DEBUG | MATCHING
+ConsoleMask := ERROR | WARNING | TESTCASE | STATISTICS | PORTEVENT
+
+LogSourceInfo := Yes
+AppendFile := No
+TimeStampFormat := DateTime
+LogEventTypes := Yes
+SourceInfoFormat := Single
+LogEntityName := Yes
+
+[TESTPORT_PARAMETERS]
+# In this section you can specify parameters that are passed to Test Ports.
+
+[DEFINE]
+# In this section you can create macro definitions,
+# that can be used in other configuration file sections except [INCLUDE].
+
+[INCLUDE]
+# To use configuration settings given in other configuration files,
+# the configuration files just need to be listed in this section, with their full or relative pathnames.
+
+[EXTERNAL_COMMANDS]
+# This section can define external commands (shell scripts) to be executed by the ETS
+# whenever a control part or test case is started or terminated.
+
+BeginTestCase := ""
+EndTestCase := ""
+BeginControlPart := ""
+EndControlPart := ""
+
+[EXECUTE]
+# In this section you can specify what parts of your test suite you want to execute.
+
+[GROUPS]
+# In this section you can specify groups of hosts. These groups can be used inside the
+# [COMPONENTS] section to restrict the creation of certain PTCs to a given set of hosts.
+
+[COMPONENTS]
+# This section consists of rules restricting the location of created PTCs.
+
+[MAIN_CONTROLLER]
+# The options herein control the behavior of MC.
+
+TCPPort := 0
+KillTimer := 10.0
+NumHCs := 0
+LocalAddress :=
+        </textarea>
+    </div>
+
+    <script> 
+      var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-cfg-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-ttcn-cfg"
+      });
+      ttcnEditor.setSize(600, 860);
+      var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+      CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+    </script>
+    <br/>
+    <p><strong>Language:</strong> Testing and Test Control Notation -
+        Configuration files
+        (<a href="http://en.wikipedia.org/wiki/TTCN">TTCN-CFG</a>)
+    </p>
+    <p><strong>MIME types defined:</strong> <code>text/x-ttcn-cfg</code>.</p>
+
+    <br/>
+    <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
+    </a>.</p>
+    <p>Coded by Asmelash Tsegay Gebretsadkan </p>
+</article>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ttcn-cfg/ttcn-cfg.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,214 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("ttcn-cfg", function(config, parserConfig) {
+    var indentUnit = config.indentUnit,
+        keywords = parserConfig.keywords || {},
+        fileNCtrlMaskOptions = parserConfig.fileNCtrlMaskOptions || {},
+        externalCommands = parserConfig.externalCommands || {},
+        multiLineStrings = parserConfig.multiLineStrings,
+        indentStatements = parserConfig.indentStatements !== false;
+    var isOperatorChar = /[\|]/;
+    var curPunc;
+
+    function tokenBase(stream, state) {
+      var ch = stream.next();
+      if (ch == '"' || ch == "'") {
+        state.tokenize = tokenString(ch);
+        return state.tokenize(stream, state);
+      }
+      if (/[:=]/.test(ch)) {
+        curPunc = ch;
+        return "punctuation";
+      }
+      if (ch == "#"){
+        stream.skipToEnd();
+        return "comment";
+      }
+      if (/\d/.test(ch)) {
+        stream.eatWhile(/[\w\.]/);
+        return "number";
+      }
+      if (isOperatorChar.test(ch)) {
+        stream.eatWhile(isOperatorChar);
+        return "operator";
+      }
+      if (ch == "["){
+        stream.eatWhile(/[\w_\]]/);
+        return "number sectionTitle";
+      }
+
+      stream.eatWhile(/[\w\$_]/);
+      var cur = stream.current();
+      if (keywords.propertyIsEnumerable(cur)) return "keyword";
+      if (fileNCtrlMaskOptions.propertyIsEnumerable(cur))
+        return "negative fileNCtrlMaskOptions";
+      if (externalCommands.propertyIsEnumerable(cur)) return "negative externalCommands";
+
+      return "variable";
+    }
+
+    function tokenString(quote) {
+      return function(stream, state) {
+        var escaped = false, next, end = false;
+        while ((next = stream.next()) != null) {
+          if (next == quote && !escaped){
+            var afterNext = stream.peek();
+            //look if the character if the quote is like the B in '10100010'B
+            if (afterNext){
+              afterNext = afterNext.toLowerCase();
+              if(afterNext == "b" || afterNext == "h" || afterNext == "o")
+                stream.next();
+            }
+            end = true; break;
+          }
+          escaped = !escaped && next == "\\";
+        }
+        if (end || !(escaped || multiLineStrings))
+          state.tokenize = null;
+        return "string";
+      };
+    }
+
+    function Context(indented, column, type, align, prev) {
+      this.indented = indented;
+      this.column = column;
+      this.type = type;
+      this.align = align;
+      this.prev = prev;
+    }
+    function pushContext(state, col, type) {
+      var indent = state.indented;
+      if (state.context && state.context.type == "statement")
+        indent = state.context.indented;
+      return state.context = new Context(indent, col, type, null, state.context);
+    }
+    function popContext(state) {
+      var t = state.context.type;
+      if (t == ")" || t == "]" || t == "}")
+        state.indented = state.context.indented;
+      return state.context = state.context.prev;
+    }
+
+    //Interface
+    return {
+      startState: function(basecolumn) {
+        return {
+          tokenize: null,
+          context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+          indented: 0,
+          startOfLine: true
+        };
+      },
+
+      token: function(stream, state) {
+        var ctx = state.context;
+        if (stream.sol()) {
+          if (ctx.align == null) ctx.align = false;
+          state.indented = stream.indentation();
+          state.startOfLine = true;
+        }
+        if (stream.eatSpace()) return null;
+        curPunc = null;
+        var style = (state.tokenize || tokenBase)(stream, state);
+        if (style == "comment") return style;
+        if (ctx.align == null) ctx.align = true;
+
+        if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
+            && ctx.type == "statement"){
+          popContext(state);
+        }
+        else if (curPunc == "{") pushContext(state, stream.column(), "}");
+        else if (curPunc == "[") pushContext(state, stream.column(), "]");
+        else if (curPunc == "(") pushContext(state, stream.column(), ")");
+        else if (curPunc == "}") {
+          while (ctx.type == "statement") ctx = popContext(state);
+          if (ctx.type == "}") ctx = popContext(state);
+          while (ctx.type == "statement") ctx = popContext(state);
+        }
+        else if (curPunc == ctx.type) popContext(state);
+        else if (indentStatements && (((ctx.type == "}" || ctx.type == "top")
+            && curPunc != ';') || (ctx.type == "statement"
+            && curPunc == "newstatement")))
+          pushContext(state, stream.column(), "statement");
+        state.startOfLine = false;
+        return style;
+      },
+
+      electricChars: "{}",
+      lineComment: "#",
+      fold: "brace"
+    };
+  });
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i)
+      obj[words[i]] = true;
+    return obj;
+  }
+
+  CodeMirror.defineMIME("text/x-ttcn-cfg", {
+    name: "ttcn-cfg",
+    keywords: words("Yes No LogFile FileMask ConsoleMask AppendFile" +
+    " TimeStampFormat LogEventTypes SourceInfoFormat" +
+    " LogEntityName LogSourceInfo DiskFullAction" +
+    " LogFileNumber LogFileSize MatchingHints Detailed" +
+    " Compact SubCategories Stack Single None Seconds" +
+    " DateTime Time Stop Error Retry Delete TCPPort KillTimer" +
+    " NumHCs UnixSocketsEnabled LocalAddress"),
+    fileNCtrlMaskOptions: words("TTCN_EXECUTOR TTCN_ERROR TTCN_WARNING" +
+    " TTCN_PORTEVENT TTCN_TIMEROP TTCN_VERDICTOP" +
+    " TTCN_DEFAULTOP TTCN_TESTCASE TTCN_ACTION" +
+    " TTCN_USER TTCN_FUNCTION TTCN_STATISTICS" +
+    " TTCN_PARALLEL TTCN_MATCHING TTCN_DEBUG" +
+    " EXECUTOR ERROR WARNING PORTEVENT TIMEROP" +
+    " VERDICTOP DEFAULTOP TESTCASE ACTION USER" +
+    " FUNCTION STATISTICS PARALLEL MATCHING DEBUG" +
+    " LOG_ALL LOG_NOTHING ACTION_UNQUALIFIED" +
+    " DEBUG_ENCDEC DEBUG_TESTPORT" +
+    " DEBUG_UNQUALIFIED DEFAULTOP_ACTIVATE" +
+    " DEFAULTOP_DEACTIVATE DEFAULTOP_EXIT" +
+    " DEFAULTOP_UNQUALIFIED ERROR_UNQUALIFIED" +
+    " EXECUTOR_COMPONENT EXECUTOR_CONFIGDATA" +
+    " EXECUTOR_EXTCOMMAND EXECUTOR_LOGOPTIONS" +
+    " EXECUTOR_RUNTIME EXECUTOR_UNQUALIFIED" +
+    " FUNCTION_RND FUNCTION_UNQUALIFIED" +
+    " MATCHING_DONE MATCHING_MCSUCCESS" +
+    " MATCHING_MCUNSUCC MATCHING_MMSUCCESS" +
+    " MATCHING_MMUNSUCC MATCHING_PCSUCCESS" +
+    " MATCHING_PCUNSUCC MATCHING_PMSUCCESS" +
+    " MATCHING_PMUNSUCC MATCHING_PROBLEM" +
+    " MATCHING_TIMEOUT MATCHING_UNQUALIFIED" +
+    " PARALLEL_PORTCONN PARALLEL_PORTMAP" +
+    " PARALLEL_PTC PARALLEL_UNQUALIFIED" +
+    " PORTEVENT_DUALRECV PORTEVENT_DUALSEND" +
+    " PORTEVENT_MCRECV PORTEVENT_MCSEND" +
+    " PORTEVENT_MMRECV PORTEVENT_MMSEND" +
+    " PORTEVENT_MQUEUE PORTEVENT_PCIN" +
+    " PORTEVENT_PCOUT PORTEVENT_PMIN" +
+    " PORTEVENT_PMOUT PORTEVENT_PQUEUE" +
+    " PORTEVENT_STATE PORTEVENT_UNQUALIFIED" +
+    " STATISTICS_UNQUALIFIED STATISTICS_VERDICT" +
+    " TESTCASE_FINISH TESTCASE_START" +
+    " TESTCASE_UNQUALIFIED TIMEROP_GUARD" +
+    " TIMEROP_READ TIMEROP_START TIMEROP_STOP" +
+    " TIMEROP_TIMEOUT TIMEROP_UNQUALIFIED" +
+    " USER_UNQUALIFIED VERDICTOP_FINAL" +
+    " VERDICTOP_GETVERDICT VERDICTOP_SETVERDICT" +
+    " VERDICTOP_UNQUALIFIED WARNING_UNQUALIFIED"),
+    externalCommands: words("BeginControlPart EndControlPart BeginTestCase" +
+    " EndTestCase"),
+    multiLineStrings: true
+  });
+});
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ttcn/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,119 @@
+<!doctype html>
+
+<title>CodeMirror: TTCN mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="ttcn.js"></script>
+<style>
+    .CodeMirror {
+        border-top: 1px solid black;
+        border-bottom: 1px solid black;
+    }
+</style>
+<div id=nav>
+    <a href="https://codemirror.net/5"><h1>CodeMirror</h1>
+        <img id=logo src="../../doc/logo.png" alt="">
+    </a>
+
+    <ul>
+        <li><a href="../../index.html">Home</a>
+        <li><a href="../../doc/manual.html">Manual</a>
+        <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+    </ul>
+    <ul>
+        <li><a href="../index.html">Language modes</a>
+        <li><a class=active href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>
+    </ul>
+</div>
+<article>
+    <h2>TTCN example</h2>
+    <div>
+        <textarea id="ttcn-code">
+module Templates {
+  /* import types from ASN.1 */
+  import from Types language "ASN.1:1997" all;
+
+  /* During the conversion phase from ASN.1 to TTCN-3 */
+  /* - the minus sign (Message-Type) within the identifiers will be replaced by underscore (Message_Type)*/
+  /* - the ASN.1 identifiers matching a TTCN-3 keyword (objid) will be postfixed with an underscore (objid_)*/
+
+  // simple types
+
+  template SenderID localObjid := objid {itu_t(0) identified_organization(4) etsi(0)};
+
+  // complex types
+
+  /* ASN.1 Message-Type mapped to TTCN-3 Message_Type */
+  template Message receiveMsg(template (present) Message_Type p_messageType) := {
+    header := p_messageType,
+    body := ?
+  }
+
+  /* ASN.1 objid mapped to TTCN-3 objid_ */
+  template Message sendInviteMsg := {
+      header := inviteType,
+      body := {
+        /* optional fields may be assigned by omit or may be ignored/skipped */
+        description := "Invite Message",
+        data := 'FF'O,
+        objid_ := localObjid
+      }
+  }
+
+  template Message sendAcceptMsg modifies sendInviteMsg := {
+      header := acceptType,
+      body := {
+        description := "Accept Message"
+      }
+    };
+
+  template Message sendErrorMsg modifies sendInviteMsg := {
+      header := errorType,
+      body := {
+        description := "Error Message"
+      }
+    };
+
+  template Message expectedErrorMsg := {
+      header := errorType,
+      body := ?
+    };
+
+  template Message expectedInviteMsg modifies expectedErrorMsg := {
+      header := inviteType
+    };
+
+  template Message expectedAcceptMsg modifies expectedErrorMsg := {
+      header := acceptType
+    };
+
+} with { encode "BER:1997" }
+        </textarea>
+    </div>
+
+    <script> 
+      var ttcnEditor = CodeMirror.fromTextArea(document.getElementById("ttcn-code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        mode: "text/x-ttcn"
+      });
+      ttcnEditor.setSize(600, 860);
+      var mac = CodeMirror.keyMap.default == CodeMirror.keyMap.macDefault;
+      CodeMirror.keyMap.default[(mac ? "Cmd" : "Ctrl") + "-Space"] = "autocomplete";
+    </script>
+    <br/>
+    <p><strong>Language:</strong> Testing and Test Control Notation
+        (<a href="http://en.wikipedia.org/wiki/TTCN">TTCN</a>)
+    </p>
+    <p><strong>MIME types defined:</strong> <code>text/x-ttcn,
+        text/x-ttcn3, text/x-ttcnpp</code>.</p>
+    <br/>
+    <p>The development of this mode has been sponsored by <a href="http://www.ericsson.com/">Ericsson
+    </a>.</p>
+    <p>Coded by Asmelash Tsegay Gebretsadkan </p>
+</article>
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/ttcn/ttcn.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,283 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("ttcn", function(config, parserConfig) {
+    var indentUnit = config.indentUnit,
+        keywords = parserConfig.keywords || {},
+        builtin = parserConfig.builtin || {},
+        timerOps = parserConfig.timerOps || {},
+        portOps  = parserConfig.portOps || {},
+        configOps = parserConfig.configOps || {},
+        verdictOps = parserConfig.verdictOps || {},
+        sutOps = parserConfig.sutOps || {},
+        functionOps = parserConfig.functionOps || {},
+
+        verdictConsts = parserConfig.verdictConsts || {},
+        booleanConsts = parserConfig.booleanConsts || {},
+        otherConsts   = parserConfig.otherConsts || {},
+
+        types = parserConfig.types || {},
+        visibilityModifiers = parserConfig.visibilityModifiers || {},
+        templateMatch = parserConfig.templateMatch || {},
+        multiLineStrings = parserConfig.multiLineStrings,
+        indentStatements = parserConfig.indentStatements !== false;
+    var isOperatorChar = /[+\-*&@=<>!\/]/;
+    var curPunc;
+
+    function tokenBase(stream, state) {
+      var ch = stream.next();
+
+      if (ch == '"' || ch == "'") {
+        state.tokenize = tokenString(ch);
+        return state.tokenize(stream, state);
+      }
+      if (/[\[\]{}\(\),;\\:\?\.]/.test(ch)) {
+        curPunc = ch;
+        return "punctuation";
+      }
+      if (ch == "#"){
+        stream.skipToEnd();
+        return "atom preprocessor";
+      }
+      if (ch == "%"){
+        stream.eatWhile(/\b/);
+        return "atom ttcn3Macros";
+      }
+      if (/\d/.test(ch)) {
+        stream.eatWhile(/[\w\.]/);
+        return "number";
+      }
+      if (ch == "/") {
+        if (stream.eat("*")) {
+          state.tokenize = tokenComment;
+          return tokenComment(stream, state);
+        }
+        if (stream.eat("/")) {
+          stream.skipToEnd();
+          return "comment";
+        }
+      }
+      if (isOperatorChar.test(ch)) {
+        if(ch == "@"){
+          if(stream.match("try") || stream.match("catch")
+              || stream.match("lazy")){
+            return "keyword";
+          }
+        }
+        stream.eatWhile(isOperatorChar);
+        return "operator";
+      }
+      stream.eatWhile(/[\w\$_\xa1-\uffff]/);
+      var cur = stream.current();
+
+      if (keywords.propertyIsEnumerable(cur)) return "keyword";
+      if (builtin.propertyIsEnumerable(cur)) return "builtin";
+
+      if (timerOps.propertyIsEnumerable(cur)) return "def timerOps";
+      if (configOps.propertyIsEnumerable(cur)) return "def configOps";
+      if (verdictOps.propertyIsEnumerable(cur)) return "def verdictOps";
+      if (portOps.propertyIsEnumerable(cur)) return "def portOps";
+      if (sutOps.propertyIsEnumerable(cur)) return "def sutOps";
+      if (functionOps.propertyIsEnumerable(cur)) return "def functionOps";
+
+      if (verdictConsts.propertyIsEnumerable(cur)) return "string verdictConsts";
+      if (booleanConsts.propertyIsEnumerable(cur)) return "string booleanConsts";
+      if (otherConsts.propertyIsEnumerable(cur)) return "string otherConsts";
+
+      if (types.propertyIsEnumerable(cur)) return "builtin types";
+      if (visibilityModifiers.propertyIsEnumerable(cur))
+        return "builtin visibilityModifiers";
+      if (templateMatch.propertyIsEnumerable(cur)) return "atom templateMatch";
+
+      return "variable";
+    }
+
+    function tokenString(quote) {
+      return function(stream, state) {
+        var escaped = false, next, end = false;
+        while ((next = stream.next()) != null) {
+          if (next == quote && !escaped){
+            var afterQuote = stream.peek();
+            //look if the character after the quote is like the B in '10100010'B
+            if (afterQuote){
+              afterQuote = afterQuote.toLowerCase();
+              if(afterQuote == "b" || afterQuote == "h" || afterQuote == "o")
+                stream.next();
+            }
+            end = true; break;
+          }
+          escaped = !escaped && next == "\\";
+        }
+        if (end || !(escaped || multiLineStrings))
+          state.tokenize = null;
+        return "string";
+      };
+    }
+
+    function tokenComment(stream, state) {
+      var maybeEnd = false, ch;
+      while (ch = stream.next()) {
+        if (ch == "/" && maybeEnd) {
+          state.tokenize = null;
+          break;
+        }
+        maybeEnd = (ch == "*");
+      }
+      return "comment";
+    }
+
+    function Context(indented, column, type, align, prev) {
+      this.indented = indented;
+      this.column = column;
+      this.type = type;
+      this.align = align;
+      this.prev = prev;
+    }
+
+    function pushContext(state, col, type) {
+      var indent = state.indented;
+      if (state.context && state.context.type == "statement")
+        indent = state.context.indented;
+      return state.context = new Context(indent, col, type, null, state.context);
+    }
+
+    function popContext(state) {
+      var t = state.context.type;
+      if (t == ")" || t == "]" || t == "}")
+        state.indented = state.context.indented;
+      return state.context = state.context.prev;
+    }
+
+    //Interface
+    return {
+      startState: function(basecolumn) {
+        return {
+          tokenize: null,
+          context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+          indented: 0,
+          startOfLine: true
+        };
+      },
+
+      token: function(stream, state) {
+        var ctx = state.context;
+        if (stream.sol()) {
+          if (ctx.align == null) ctx.align = false;
+          state.indented = stream.indentation();
+          state.startOfLine = true;
+        }
+        if (stream.eatSpace()) return null;
+        curPunc = null;
+        var style = (state.tokenize || tokenBase)(stream, state);
+        if (style == "comment") return style;
+        if (ctx.align == null) ctx.align = true;
+
+        if ((curPunc == ";" || curPunc == ":" || curPunc == ",")
+            && ctx.type == "statement"){
+          popContext(state);
+        }
+        else if (curPunc == "{") pushContext(state, stream.column(), "}");
+        else if (curPunc == "[") pushContext(state, stream.column(), "]");
+        else if (curPunc == "(") pushContext(state, stream.column(), ")");
+        else if (curPunc == "}") {
+          while (ctx.type == "statement") ctx = popContext(state);
+          if (ctx.type == "}") ctx = popContext(state);
+          while (ctx.type == "statement") ctx = popContext(state);
+        }
+        else if (curPunc == ctx.type) popContext(state);
+        else if (indentStatements &&
+            (((ctx.type == "}" || ctx.type == "top") && curPunc != ';') ||
+            (ctx.type == "statement" && curPunc == "newstatement")))
+          pushContext(state, stream.column(), "statement");
+
+        state.startOfLine = false;
+
+        return style;
+      },
+
+      electricChars: "{}",
+      blockCommentStart: "/*",
+      blockCommentEnd: "*/",
+      lineComment: "//",
+      fold: "brace"
+    };
+  });
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  function def(mimes, mode) {
+    if (typeof mimes == "string") mimes = [mimes];
+    var words = [];
+    function add(obj) {
+      if (obj) for (var prop in obj) if (obj.hasOwnProperty(prop))
+        words.push(prop);
+    }
+
+    add(mode.keywords);
+    add(mode.builtin);
+    add(mode.timerOps);
+    add(mode.portOps);
+
+    if (words.length) {
+      mode.helperType = mimes[0];
+      CodeMirror.registerHelper("hintWords", mimes[0], words);
+    }
+
+    for (var i = 0; i < mimes.length; ++i)
+      CodeMirror.defineMIME(mimes[i], mode);
+  }
+
+  def(["text/x-ttcn", "text/x-ttcn3", "text/x-ttcnpp"], {
+    name: "ttcn",
+    keywords: words("activate address alive all alt altstep and and4b any" +
+    " break case component const continue control deactivate" +
+    " display do else encode enumerated except exception" +
+    " execute extends extension external for from function" +
+    " goto group if import in infinity inout interleave" +
+    " label language length log match message mixed mod" +
+    " modifies module modulepar mtc noblock not not4b nowait" +
+    " of on optional or or4b out override param pattern port" +
+    " procedure record recursive rem repeat return runs select" +
+    " self sender set signature system template testcase to" +
+    " type union value valueof var variant while with xor xor4b"),
+    builtin: words("bit2hex bit2int bit2oct bit2str char2int char2oct encvalue" +
+    " decomp decvalue float2int float2str hex2bit hex2int" +
+    " hex2oct hex2str int2bit int2char int2float int2hex" +
+    " int2oct int2str int2unichar isbound ischosen ispresent" +
+    " isvalue lengthof log2str oct2bit oct2char oct2hex oct2int" +
+    " oct2str regexp replace rnd sizeof str2bit str2float" +
+    " str2hex str2int str2oct substr unichar2int unichar2char" +
+    " enum2int"),
+    types: words("anytype bitstring boolean char charstring default float" +
+    " hexstring integer objid octetstring universal verdicttype timer"),
+    timerOps: words("read running start stop timeout"),
+    portOps: words("call catch check clear getcall getreply halt raise receive" +
+    " reply send trigger"),
+    configOps: words("create connect disconnect done kill killed map unmap"),
+    verdictOps: words("getverdict setverdict"),
+    sutOps: words("action"),
+    functionOps: words("apply derefers refers"),
+
+    verdictConsts: words("error fail inconc none pass"),
+    booleanConsts: words("true false"),
+    otherConsts: words("null NULL omit"),
+
+    visibilityModifiers: words("private public friend"),
+    templateMatch: words("complement ifpresent subset superset permutation"),
+    multiLineStrings: true
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/turtle/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,51 @@
+<!doctype html>
+
+<title>CodeMirror: Turtle mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="turtle.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Turtle</a>
+  </ul>
+</div>
+
+<article>
+<h2>Turtle mode</h2>
+<form><textarea id="code" name="code">
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+
+<http://purl.org/net/bsletten> 
+    a foaf:Person;
+    foaf:interest <http://www.w3.org/2000/01/sw/>;
+    foaf:based_near [
+        geo:lat "34.0736111" ;
+        geo:lon "-118.3994444"
+   ]
+
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/turtle",
+        matchBrackets: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/turtle</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/turtle/turtle.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,162 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("turtle", function(config) {
+  var indentUnit = config.indentUnit;
+  var curPunc;
+
+  function wordRegexp(words) {
+    return new RegExp("^(?:" + words.join("|") + ")$", "i");
+  }
+  var ops = wordRegexp([]);
+  var keywords = wordRegexp(["@prefix", "@base", "a"]);
+  var operatorChars = /[*+\-<>=&|]/;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    curPunc = null;
+    if (ch == "<" && !stream.match(/^[\s\u00a0=]/, false)) {
+      stream.match(/^[^\s\u00a0>]*>?/);
+      return "atom";
+    }
+    else if (ch == "\"" || ch == "'") {
+      state.tokenize = tokenLiteral(ch);
+      return state.tokenize(stream, state);
+    }
+    else if (/[{}\(\),\.;\[\]]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    else if (ch == "#") {
+      stream.skipToEnd();
+      return "comment";
+    }
+    else if (operatorChars.test(ch)) {
+      stream.eatWhile(operatorChars);
+      return null;
+    }
+    else if (ch == ":") {
+          return "operator";
+        } else {
+      stream.eatWhile(/[_\w\d]/);
+      if(stream.peek() == ":") {
+        return "variable-3";
+      } else {
+             var word = stream.current();
+
+             if(keywords.test(word)) {
+                        return "meta";
+             }
+
+             if(ch >= "A" && ch <= "Z") {
+                    return "comment";
+                 } else {
+                        return "keyword";
+                 }
+      }
+      var word = stream.current();
+      if (ops.test(word))
+        return null;
+      else if (keywords.test(word))
+        return "meta";
+      else
+        return "variable";
+    }
+  }
+
+  function tokenLiteral(quote) {
+    return function(stream, state) {
+      var escaped = false, ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == quote && !escaped) {
+          state.tokenize = tokenBase;
+          break;
+        }
+        escaped = !escaped && ch == "\\";
+      }
+      return "string";
+    };
+  }
+
+  function pushContext(state, type, col) {
+    state.context = {prev: state.context, indent: state.indent, col: col, type: type};
+  }
+  function popContext(state) {
+    state.indent = state.context.indent;
+    state.context = state.context.prev;
+  }
+
+  return {
+    startState: function() {
+      return {tokenize: tokenBase,
+              context: null,
+              indent: 0,
+              col: 0};
+    },
+
+    token: function(stream, state) {
+      if (stream.sol()) {
+        if (state.context && state.context.align == null) state.context.align = false;
+        state.indent = stream.indentation();
+      }
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+
+      if (style != "comment" && state.context && state.context.align == null && state.context.type != "pattern") {
+        state.context.align = true;
+      }
+
+      if (curPunc == "(") pushContext(state, ")", stream.column());
+      else if (curPunc == "[") pushContext(state, "]", stream.column());
+      else if (curPunc == "{") pushContext(state, "}", stream.column());
+      else if (/[\]\}\)]/.test(curPunc)) {
+        while (state.context && state.context.type == "pattern") popContext(state);
+        if (state.context && curPunc == state.context.type) popContext(state);
+      }
+      else if (curPunc == "." && state.context && state.context.type == "pattern") popContext(state);
+      else if (/atom|string|variable/.test(style) && state.context) {
+        if (/[\}\]]/.test(state.context.type))
+          pushContext(state, "pattern", stream.column());
+        else if (state.context.type == "pattern" && !state.context.align) {
+          state.context.align = true;
+          state.context.col = stream.column();
+        }
+      }
+
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      var firstChar = textAfter && textAfter.charAt(0);
+      var context = state.context;
+      if (/[\]\}]/.test(firstChar))
+        while (context && context.type == "pattern") context = context.prev;
+
+      var closing = context && firstChar == context.type;
+      if (!context)
+        return 0;
+      else if (context.type == "pattern")
+        return context.col;
+      else if (context.align)
+        return context.col + (closing ? 0 : 1);
+      else
+        return context.indent + (closing ? 0 : indentUnit);
+    },
+
+    lineComment: "#"
+  };
+});
+
+CodeMirror.defineMIME("text/turtle", "turtle");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/twig/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,47 @@
+<!doctype html>
+
+<title>CodeMirror: Twig mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="twig.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../../addon/mode/multiplex.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Twig</a>
+  </ul>
+</div>
+
+<article>
+<h2>Twig mode</h2>
+<form><textarea id="code" name="code">
+{% extends "layout.twig" %}
+{% block title %}CodeMirror: Twig mode{% endblock %}
+{# this is a comment #}
+{% block content %}
+  {% for foo in bar if foo.baz is divisible by(3) %}
+    Hello {{ foo.world }}
+  {% else %}
+    {% set msg = "Result not found" %}
+    {% include "empty.twig" with { message: msg } %}
+  {% endfor %}
+{% endblock %}
+</textarea></form>
+    <script>
+      var editor =
+      CodeMirror.fromTextArea(document.getElementById("code"), {mode:
+        {name: "twig", base: "text/html"}});
+    </script>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/twig/twig.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,141 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"),  require("../../addon/mode/multiplex"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/multiplex"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+  "use strict";
+
+  CodeMirror.defineMode("twig:inner", function() {
+    var keywords = ["and", "as", "autoescape", "endautoescape", "block", "do", "endblock", "else", "elseif", "extends", "for", "endfor", "embed", "endembed", "filter", "endfilter", "flush", "from", "if", "endif", "in", "is", "include", "import", "not", "or", "set", "spaceless", "endspaceless", "with", "endwith", "trans", "endtrans", "blocktrans", "endblocktrans", "macro", "endmacro", "use", "verbatim", "endverbatim"],
+        operator = /^[+\-*&%=<>!?|~^]/,
+        sign = /^[:\[\(\{]/,
+        atom = ["true", "false", "null", "empty", "defined", "divisibleby", "divisible by", "even", "odd", "iterable", "sameas", "same as"],
+        number = /^(\d[+\-\*\/])?\d+(\.\d+)?/;
+
+    keywords = new RegExp("((" + keywords.join(")|(") + "))\\b");
+    atom = new RegExp("((" + atom.join(")|(") + "))\\b");
+
+    function tokenBase (stream, state) {
+      var ch = stream.peek();
+
+      //Comment
+      if (state.incomment) {
+        if (!stream.skipTo("#}")) {
+          stream.skipToEnd();
+        } else {
+          stream.eatWhile(/\#|}/);
+          state.incomment = false;
+        }
+        return "comment";
+      //Tag
+      } else if (state.intag) {
+        //After operator
+        if (state.operator) {
+          state.operator = false;
+          if (stream.match(atom)) {
+            return "atom";
+          }
+          if (stream.match(number)) {
+            return "number";
+          }
+        }
+        //After sign
+        if (state.sign) {
+          state.sign = false;
+          if (stream.match(atom)) {
+            return "atom";
+          }
+          if (stream.match(number)) {
+            return "number";
+          }
+        }
+
+        if (state.instring) {
+          if (ch == state.instring) {
+            state.instring = false;
+          }
+          stream.next();
+          return "string";
+        } else if (ch == "'" || ch == '"') {
+          state.instring = ch;
+          stream.next();
+          return "string";
+        } else if (stream.match(state.intag + "}") || stream.eat("-") && stream.match(state.intag + "}")) {
+          state.intag = false;
+          return "tag";
+        } else if (stream.match(operator)) {
+          state.operator = true;
+          return "operator";
+        } else if (stream.match(sign)) {
+          state.sign = true;
+        } else {
+          if (stream.eat(" ") || stream.sol()) {
+            if (stream.match(keywords)) {
+              return "keyword";
+            }
+            if (stream.match(atom)) {
+              return "atom";
+            }
+            if (stream.match(number)) {
+              return "number";
+            }
+            if (stream.sol()) {
+              stream.next();
+            }
+          } else {
+            stream.next();
+          }
+
+        }
+        return "variable";
+      } else if (stream.eat("{")) {
+        if (stream.eat("#")) {
+          state.incomment = true;
+          if (!stream.skipTo("#}")) {
+            stream.skipToEnd();
+          } else {
+            stream.eatWhile(/\#|}/);
+            state.incomment = false;
+          }
+          return "comment";
+        //Open tag
+        } else if (ch = stream.eat(/\{|%/)) {
+          //Cache close tag
+          state.intag = ch;
+          if (ch == "{") {
+            state.intag = "}";
+          }
+          stream.eat("-");
+          return "tag";
+        }
+      }
+      stream.next();
+    };
+
+    return {
+      startState: function () {
+        return {};
+      },
+      token: function (stream, state) {
+        return tokenBase(stream, state);
+      }
+    };
+  });
+
+  CodeMirror.defineMode("twig", function(config, parserConfig) {
+    var twigInner = CodeMirror.getMode(config, "twig:inner");
+    if (!parserConfig || !parserConfig.base) return twigInner;
+    return CodeMirror.multiplexingMode(
+      CodeMirror.getMode(config, parserConfig.base), {
+        open: /\{[{#%]/, close: /[}#%]\}/, mode: twigInner, parseDelimiters: true
+      }
+    );
+  });
+  CodeMirror.defineMIME("text/x-twig", "twig");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vb/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,49 @@
+<!doctype html>
+
+<title>CodeMirror: VB.NET mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link href="http://fonts.googleapis.com/css?family=Inconsolata" rel="stylesheet">
+<script src="../../lib/codemirror.js"></script>
+<script src="vb.js"></script>
+<script src="../../addon/runmode/runmode.js"></script>
+<style>
+      .CodeMirror {border: 1px solid #aaa; height:210px; height: auto;}
+      .CodeMirror-scroll { overflow-x: auto; overflow-y: hidden;}
+      .CodeMirror pre { font-family: Inconsolata; font-size: 14px}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">VB.NET</a>
+  </ul>
+</div>
+
+<article>
+<h2>VB.NET mode</h2>
+  <div id="edit">
+  <textarea name="code" id="code" >
+Class rocket
+  Private quality as Double
+  Public Sub launch() as String
+    If quality > 0.8
+      launch = "Successful"
+    Else
+      launch = "Failed"
+    End If
+  End sub
+End class
+</textarea>
+  </div>
+  <p>MIME type defined: <code>text/x-vb</code>.</p>
+<script>CodeMirror.fromTextArea(document.getElementById("code"))</script>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vb/vb.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,275 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("vb", function(conf, parserConf) {
+    var ERRORCLASS = 'error';
+
+    function wordRegexp(words) {
+        return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
+    }
+
+    var singleOperators = new RegExp("^[\\+\\-\\*/%&\\\\|\\^~<>!]");
+    var singleDelimiters = new RegExp('^[\\(\\)\\[\\]\\{\\}@,:`=;\\.]');
+    var doubleOperators = new RegExp("^((==)|(<>)|(<=)|(>=)|(<>)|(<<)|(>>)|(//)|(\\*\\*))");
+    var doubleDelimiters = new RegExp("^((\\+=)|(\\-=)|(\\*=)|(%=)|(/=)|(&=)|(\\|=)|(\\^=))");
+    var tripleDelimiters = new RegExp("^((//=)|(>>=)|(<<=)|(\\*\\*=))");
+    var identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
+
+    var openingKeywords = ['class','module', 'sub','enum','select','while','if','function', 'get','set','property', 'try', 'structure', 'synclock', 'using', 'with'];
+    var middleKeywords = ['else','elseif','case', 'catch', 'finally'];
+    var endKeywords = ['next','loop'];
+
+    var operatorKeywords = ['and', "andalso", 'or', 'orelse', 'xor', 'in', 'not', 'is', 'isnot', 'like'];
+    var wordOperators = wordRegexp(operatorKeywords);
+
+    var commonKeywords = ["#const", "#else", "#elseif", "#end", "#if", "#region", "addhandler", "addressof", "alias", "as", "byref", "byval", "cbool", "cbyte", "cchar", "cdate", "cdbl", "cdec", "cint", "clng", "cobj", "compare", "const", "continue", "csbyte", "cshort", "csng", "cstr", "cuint", "culng", "cushort", "declare", "default", "delegate", "dim", "directcast", "each", "erase", "error", "event", "exit", "explicit", "false", "for", "friend", "gettype", "goto", "handles", "implements", "imports", "infer", "inherits", "interface", "isfalse", "istrue", "lib", "me", "mod", "mustinherit", "mustoverride", "my", "mybase", "myclass", "namespace", "narrowing", "new", "nothing", "notinheritable", "notoverridable", "of", "off", "on", "operator", "option", "optional", "out", "overloads", "overridable", "overrides", "paramarray", "partial", "private", "protected", "public", "raiseevent", "readonly", "redim", "removehandler", "resume", "return", "shadows", "shared", "static", "step", "stop", "strict", "then", "throw", "to", "true", "trycast", "typeof", "until", "until", "when", "widening", "withevents", "writeonly"];
+
+    var commontypes = ['object', 'boolean', 'char', 'string', 'byte', 'sbyte', 'short', 'ushort', 'int16', 'uint16', 'integer', 'uinteger', 'int32', 'uint32', 'long', 'ulong', 'int64', 'uint64', 'decimal', 'single', 'double', 'float', 'date', 'datetime', 'intptr', 'uintptr'];
+
+    var keywords = wordRegexp(commonKeywords);
+    var types = wordRegexp(commontypes);
+    var stringPrefixes = '"';
+
+    var opening = wordRegexp(openingKeywords);
+    var middle = wordRegexp(middleKeywords);
+    var closing = wordRegexp(endKeywords);
+    var doubleClosing = wordRegexp(['end']);
+    var doOpening = wordRegexp(['do']);
+
+    var indentInfo = null;
+
+    CodeMirror.registerHelper("hintWords", "vb", openingKeywords.concat(middleKeywords).concat(endKeywords)
+                                .concat(operatorKeywords).concat(commonKeywords).concat(commontypes));
+
+    function indent(_stream, state) {
+      state.currentIndent++;
+    }
+
+    function dedent(_stream, state) {
+      state.currentIndent--;
+    }
+    // tokenizers
+    function tokenBase(stream, state) {
+        if (stream.eatSpace()) {
+            return null;
+        }
+
+        var ch = stream.peek();
+
+        // Handle Comments
+        if (ch === "'") {
+            stream.skipToEnd();
+            return 'comment';
+        }
+
+
+        // Handle Number Literals
+        if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) {
+            var floatLiteral = false;
+            // Floats
+            if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; }
+            else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; }
+            else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; }
+
+            if (floatLiteral) {
+                // Float literals may be "imaginary"
+                stream.eat(/J/i);
+                return 'number';
+            }
+            // Integers
+            var intLiteral = false;
+            // Hex
+            if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
+            // Octal
+            else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
+            // Decimal
+            else if (stream.match(/^[1-9]\d*F?/)) {
+                // Decimal literals may be "imaginary"
+                stream.eat(/J/i);
+                // TODO - Can you have imaginary longs?
+                intLiteral = true;
+            }
+            // Zero by itself with no other piece of number.
+            else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
+            if (intLiteral) {
+                // Integer literals may be "long"
+                stream.eat(/L/i);
+                return 'number';
+            }
+        }
+
+        // Handle Strings
+        if (stream.match(stringPrefixes)) {
+            state.tokenize = tokenStringFactory(stream.current());
+            return state.tokenize(stream, state);
+        }
+
+        // Handle operators and Delimiters
+        if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) {
+            return null;
+        }
+        if (stream.match(doubleOperators)
+            || stream.match(singleOperators)
+            || stream.match(wordOperators)) {
+            return 'operator';
+        }
+        if (stream.match(singleDelimiters)) {
+            return null;
+        }
+        if (stream.match(doOpening)) {
+            indent(stream,state);
+            state.doInCurrentLine = true;
+            return 'keyword';
+        }
+        if (stream.match(opening)) {
+            if (! state.doInCurrentLine)
+              indent(stream,state);
+            else
+              state.doInCurrentLine = false;
+            return 'keyword';
+        }
+        if (stream.match(middle)) {
+            return 'keyword';
+        }
+
+        if (stream.match(doubleClosing)) {
+            dedent(stream,state);
+            dedent(stream,state);
+            return 'keyword';
+        }
+        if (stream.match(closing)) {
+            dedent(stream,state);
+            return 'keyword';
+        }
+
+        if (stream.match(types)) {
+            return 'keyword';
+        }
+
+        if (stream.match(keywords)) {
+            return 'keyword';
+        }
+
+        if (stream.match(identifiers)) {
+            return 'variable';
+        }
+
+        // Handle non-detected items
+        stream.next();
+        return ERRORCLASS;
+    }
+
+    function tokenStringFactory(delimiter) {
+        var singleline = delimiter.length == 1;
+        var OUTCLASS = 'string';
+
+        return function(stream, state) {
+            while (!stream.eol()) {
+                stream.eatWhile(/[^'"]/);
+                if (stream.match(delimiter)) {
+                    state.tokenize = tokenBase;
+                    return OUTCLASS;
+                } else {
+                    stream.eat(/['"]/);
+                }
+            }
+            if (singleline) {
+                if (parserConf.singleLineStringErrors) {
+                    return ERRORCLASS;
+                } else {
+                    state.tokenize = tokenBase;
+                }
+            }
+            return OUTCLASS;
+        };
+    }
+
+
+    function tokenLexer(stream, state) {
+        var style = state.tokenize(stream, state);
+        var current = stream.current();
+
+        // Handle '.' connected identifiers
+        if (current === '.') {
+            style = state.tokenize(stream, state);
+            if (style === 'variable') {
+                return 'variable';
+            } else {
+                return ERRORCLASS;
+            }
+        }
+
+
+        var delimiter_index = '[({'.indexOf(current);
+        if (delimiter_index !== -1) {
+            indent(stream, state );
+        }
+        if (indentInfo === 'dedent') {
+            if (dedent(stream, state)) {
+                return ERRORCLASS;
+            }
+        }
+        delimiter_index = '])}'.indexOf(current);
+        if (delimiter_index !== -1) {
+            if (dedent(stream, state)) {
+                return ERRORCLASS;
+            }
+        }
+
+        return style;
+    }
+
+    var external = {
+        electricChars:"dDpPtTfFeE ",
+        startState: function() {
+            return {
+              tokenize: tokenBase,
+              lastToken: null,
+              currentIndent: 0,
+              nextLineIndent: 0,
+              doInCurrentLine: false
+
+
+          };
+        },
+
+        token: function(stream, state) {
+            if (stream.sol()) {
+              state.currentIndent += state.nextLineIndent;
+              state.nextLineIndent = 0;
+              state.doInCurrentLine = 0;
+            }
+            var style = tokenLexer(stream, state);
+
+            state.lastToken = {style:style, content: stream.current()};
+
+
+
+            return style;
+        },
+
+        indent: function(state, textAfter) {
+            var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
+            if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
+            if(state.currentIndent < 0) return 0;
+            return state.currentIndent * conf.indentUnit;
+        },
+
+        lineComment: "'"
+    };
+    return external;
+});
+
+CodeMirror.defineMIME("text/x-vb", "vb");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vbscript/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,55 @@
+<!doctype html>
+
+<title>CodeMirror: VBScript mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="vbscript.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">VBScript</a>
+  </ul>
+</div>
+
+<article>
+<h2>VBScript mode</h2>
+
+
+<div><textarea id="code" name="code">
+' Pete Guhl
+' 03-04-2012
+'
+' Basic VBScript support for codemirror2
+
+Const ForReading = 1, ForWriting = 2, ForAppending = 8
+
+Call Sub020_PostBroadcastToUrbanAirship(strUserName, strPassword, intTransmitID, strResponse)
+
+If Not IsNull(strResponse) AND Len(strResponse) = 0 Then
+	boolTransmitOkYN = False
+Else
+	' WScript.Echo "Oh Happy Day! Oh Happy DAY!"
+	boolTransmitOkYN = True
+End If
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        indentUnit: 4
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/vbscript</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vbscript/vbscript.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,350 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+/*
+For extra ASP classic objects, initialize CodeMirror instance with this option:
+    isASP: true
+
+E.G.:
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        isASP: true
+      });
+*/
+
+(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.defineMode("vbscript", function(conf, parserConf) {
+    var ERRORCLASS = 'error';
+
+    function wordRegexp(words) {
+        return new RegExp("^((" + words.join(")|(") + "))\\b", "i");
+    }
+
+    var singleOperators = new RegExp("^[\\+\\-\\*/&\\\\\\^<>=]");
+    var doubleOperators = new RegExp("^((<>)|(<=)|(>=))");
+    var singleDelimiters = new RegExp('^[\\.,]');
+    var brackets = new RegExp('^[\\(\\)]');
+    var identifiers = new RegExp("^[A-Za-z][_A-Za-z0-9]*");
+
+    var openingKeywords = ['class','sub','select','while','if','function', 'property', 'with', 'for'];
+    var middleKeywords = ['else','elseif','case'];
+    var endKeywords = ['next','loop','wend'];
+
+    var wordOperators = wordRegexp(['and', 'or', 'not', 'xor', 'is', 'mod', 'eqv', 'imp']);
+    var commonkeywords = ['dim', 'redim', 'then',  'until', 'randomize',
+                          'byval','byref','new','property', 'exit', 'in',
+                          'const','private', 'public',
+                          'get','set','let', 'stop', 'on error resume next', 'on error goto 0', 'option explicit', 'call', 'me'];
+
+    //This list was from: http://msdn.microsoft.com/en-us/library/f8tbc79x(v=vs.84).aspx
+    var atomWords = ['true', 'false', 'nothing', 'empty', 'null'];
+    //This list was from: http://msdn.microsoft.com/en-us/library/3ca8tfek(v=vs.84).aspx
+    var builtinFuncsWords = ['abs', 'array', 'asc', 'atn', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'chr', 'cint', 'clng', 'cos', 'csng', 'cstr', 'date', 'dateadd', 'datediff', 'datepart',
+                        'dateserial', 'datevalue', 'day', 'escape', 'eval', 'execute', 'exp', 'filter', 'formatcurrency', 'formatdatetime', 'formatnumber', 'formatpercent', 'getlocale', 'getobject',
+                        'getref', 'hex', 'hour', 'inputbox', 'instr', 'instrrev', 'int', 'fix', 'isarray', 'isdate', 'isempty', 'isnull', 'isnumeric', 'isobject', 'join', 'lbound', 'lcase', 'left',
+                        'len', 'loadpicture', 'log', 'ltrim', 'rtrim', 'trim', 'maths', 'mid', 'minute', 'month', 'monthname', 'msgbox', 'now', 'oct', 'replace', 'rgb', 'right', 'rnd', 'round',
+                        'scriptengine', 'scriptenginebuildversion', 'scriptenginemajorversion', 'scriptengineminorversion', 'second', 'setlocale', 'sgn', 'sin', 'space', 'split', 'sqr', 'strcomp',
+                        'string', 'strreverse', 'tan', 'time', 'timer', 'timeserial', 'timevalue', 'typename', 'ubound', 'ucase', 'unescape', 'vartype', 'weekday', 'weekdayname', 'year'];
+
+    //This list was from: http://msdn.microsoft.com/en-us/library/ydz4cfk3(v=vs.84).aspx
+    var builtinConsts = ['vbBlack', 'vbRed', 'vbGreen', 'vbYellow', 'vbBlue', 'vbMagenta', 'vbCyan', 'vbWhite', 'vbBinaryCompare', 'vbTextCompare',
+                         'vbSunday', 'vbMonday', 'vbTuesday', 'vbWednesday', 'vbThursday', 'vbFriday', 'vbSaturday', 'vbUseSystemDayOfWeek', 'vbFirstJan1', 'vbFirstFourDays', 'vbFirstFullWeek',
+                         'vbGeneralDate', 'vbLongDate', 'vbShortDate', 'vbLongTime', 'vbShortTime', 'vbObjectError',
+                         'vbOKOnly', 'vbOKCancel', 'vbAbortRetryIgnore', 'vbYesNoCancel', 'vbYesNo', 'vbRetryCancel', 'vbCritical', 'vbQuestion', 'vbExclamation', 'vbInformation', 'vbDefaultButton1', 'vbDefaultButton2',
+                         'vbDefaultButton3', 'vbDefaultButton4', 'vbApplicationModal', 'vbSystemModal', 'vbOK', 'vbCancel', 'vbAbort', 'vbRetry', 'vbIgnore', 'vbYes', 'vbNo',
+                         'vbCr', 'VbCrLf', 'vbFormFeed', 'vbLf', 'vbNewLine', 'vbNullChar', 'vbNullString', 'vbTab', 'vbVerticalTab', 'vbUseDefault', 'vbTrue', 'vbFalse',
+                         'vbEmpty', 'vbNull', 'vbInteger', 'vbLong', 'vbSingle', 'vbDouble', 'vbCurrency', 'vbDate', 'vbString', 'vbObject', 'vbError', 'vbBoolean', 'vbVariant', 'vbDataObject', 'vbDecimal', 'vbByte', 'vbArray'];
+    //This list was from: http://msdn.microsoft.com/en-us/library/hkc375ea(v=vs.84).aspx
+    var builtinObjsWords = ['WScript', 'err', 'debug', 'RegExp'];
+    var knownProperties = ['description', 'firstindex', 'global', 'helpcontext', 'helpfile', 'ignorecase', 'length', 'number', 'pattern', 'source', 'value', 'count'];
+    var knownMethods = ['clear', 'execute', 'raise', 'replace', 'test', 'write', 'writeline', 'close', 'open', 'state', 'eof', 'update', 'addnew', 'end', 'createobject', 'quit'];
+
+    var aspBuiltinObjsWords = ['server', 'response', 'request', 'session', 'application'];
+    var aspKnownProperties = ['buffer', 'cachecontrol', 'charset', 'contenttype', 'expires', 'expiresabsolute', 'isclientconnected', 'pics', 'status', //response
+                              'clientcertificate', 'cookies', 'form', 'querystring', 'servervariables', 'totalbytes', //request
+                              'contents', 'staticobjects', //application
+                              'codepage', 'lcid', 'sessionid', 'timeout', //session
+                              'scripttimeout']; //server
+    var aspKnownMethods = ['addheader', 'appendtolog', 'binarywrite', 'end', 'flush', 'redirect', //response
+                           'binaryread', //request
+                           'remove', 'removeall', 'lock', 'unlock', //application
+                           'abandon', //session
+                           'getlasterror', 'htmlencode', 'mappath', 'transfer', 'urlencode']; //server
+
+    var knownWords = knownMethods.concat(knownProperties);
+
+    builtinObjsWords = builtinObjsWords.concat(builtinConsts);
+
+    if (conf.isASP){
+        builtinObjsWords = builtinObjsWords.concat(aspBuiltinObjsWords);
+        knownWords = knownWords.concat(aspKnownMethods, aspKnownProperties);
+    };
+
+    var keywords = wordRegexp(commonkeywords);
+    var atoms = wordRegexp(atomWords);
+    var builtinFuncs = wordRegexp(builtinFuncsWords);
+    var builtinObjs = wordRegexp(builtinObjsWords);
+    var known = wordRegexp(knownWords);
+    var stringPrefixes = '"';
+
+    var opening = wordRegexp(openingKeywords);
+    var middle = wordRegexp(middleKeywords);
+    var closing = wordRegexp(endKeywords);
+    var doubleClosing = wordRegexp(['end']);
+    var doOpening = wordRegexp(['do']);
+    var noIndentWords = wordRegexp(['on error resume next', 'exit']);
+    var comment = wordRegexp(['rem']);
+
+
+    function indent(_stream, state) {
+      state.currentIndent++;
+    }
+
+    function dedent(_stream, state) {
+      state.currentIndent--;
+    }
+    // tokenizers
+    function tokenBase(stream, state) {
+        if (stream.eatSpace()) {
+            return 'space';
+            //return null;
+        }
+
+        var ch = stream.peek();
+
+        // Handle Comments
+        if (ch === "'") {
+            stream.skipToEnd();
+            return 'comment';
+        }
+        if (stream.match(comment)){
+            stream.skipToEnd();
+            return 'comment';
+        }
+
+
+        // Handle Number Literals
+        if (stream.match(/^((&H)|(&O))?[0-9\.]/i, false) && !stream.match(/^((&H)|(&O))?[0-9\.]+[a-z_]/i, false)) {
+            var floatLiteral = false;
+            // Floats
+            if (stream.match(/^\d*\.\d+/i)) { floatLiteral = true; }
+            else if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; }
+            else if (stream.match(/^\.\d+/)) { floatLiteral = true; }
+
+            if (floatLiteral) {
+                // Float literals may be "imaginary"
+                stream.eat(/J/i);
+                return 'number';
+            }
+            // Integers
+            var intLiteral = false;
+            // Hex
+            if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; }
+            // Octal
+            else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; }
+            // Decimal
+            else if (stream.match(/^[1-9]\d*F?/)) {
+                // Decimal literals may be "imaginary"
+                stream.eat(/J/i);
+                // TODO - Can you have imaginary longs?
+                intLiteral = true;
+            }
+            // Zero by itself with no other piece of number.
+            else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; }
+            if (intLiteral) {
+                // Integer literals may be "long"
+                stream.eat(/L/i);
+                return 'number';
+            }
+        }
+
+        // Handle Strings
+        if (stream.match(stringPrefixes)) {
+            state.tokenize = tokenStringFactory(stream.current());
+            return state.tokenize(stream, state);
+        }
+
+        // Handle operators and Delimiters
+        if (stream.match(doubleOperators)
+            || stream.match(singleOperators)
+            || stream.match(wordOperators)) {
+            return 'operator';
+        }
+        if (stream.match(singleDelimiters)) {
+            return null;
+        }
+
+        if (stream.match(brackets)) {
+            return "bracket";
+        }
+
+        if (stream.match(noIndentWords)) {
+            state.doInCurrentLine = true;
+
+            return 'keyword';
+        }
+
+        if (stream.match(doOpening)) {
+            indent(stream,state);
+            state.doInCurrentLine = true;
+
+            return 'keyword';
+        }
+        if (stream.match(opening)) {
+            if (! state.doInCurrentLine)
+              indent(stream,state);
+            else
+              state.doInCurrentLine = false;
+
+            return 'keyword';
+        }
+        if (stream.match(middle)) {
+            return 'keyword';
+        }
+
+
+        if (stream.match(doubleClosing)) {
+            dedent(stream,state);
+            dedent(stream,state);
+
+            return 'keyword';
+        }
+        if (stream.match(closing)) {
+            if (! state.doInCurrentLine)
+              dedent(stream,state);
+            else
+              state.doInCurrentLine = false;
+
+            return 'keyword';
+        }
+
+        if (stream.match(keywords)) {
+            return 'keyword';
+        }
+
+        if (stream.match(atoms)) {
+            return 'atom';
+        }
+
+        if (stream.match(known)) {
+            return 'variable-2';
+        }
+
+        if (stream.match(builtinFuncs)) {
+            return 'builtin';
+        }
+
+        if (stream.match(builtinObjs)){
+            return 'variable-2';
+        }
+
+        if (stream.match(identifiers)) {
+            return 'variable';
+        }
+
+        // Handle non-detected items
+        stream.next();
+        return ERRORCLASS;
+    }
+
+    function tokenStringFactory(delimiter) {
+        var singleline = delimiter.length == 1;
+        var OUTCLASS = 'string';
+
+        return function(stream, state) {
+            while (!stream.eol()) {
+                stream.eatWhile(/[^'"]/);
+                if (stream.match(delimiter)) {
+                    state.tokenize = tokenBase;
+                    return OUTCLASS;
+                } else {
+                    stream.eat(/['"]/);
+                }
+            }
+            if (singleline) {
+                if (parserConf.singleLineStringErrors) {
+                    return ERRORCLASS;
+                } else {
+                    state.tokenize = tokenBase;
+                }
+            }
+            return OUTCLASS;
+        };
+    }
+
+
+    function tokenLexer(stream, state) {
+        var style = state.tokenize(stream, state);
+        var current = stream.current();
+
+        // Handle '.' connected identifiers
+        if (current === '.') {
+            style = state.tokenize(stream, state);
+
+            current = stream.current();
+            if (style && (style.substr(0, 8) === 'variable' || style==='builtin' || style==='keyword')){//|| knownWords.indexOf(current.substring(1)) > -1) {
+                if (style === 'builtin' || style === 'keyword') style='variable';
+                if (knownWords.indexOf(current.substr(1)) > -1) style='variable-2';
+
+                return style;
+            } else {
+                return ERRORCLASS;
+            }
+        }
+
+        return style;
+    }
+
+    var external = {
+        electricChars:"dDpPtTfFeE ",
+        startState: function() {
+            return {
+              tokenize: tokenBase,
+              lastToken: null,
+              currentIndent: 0,
+              nextLineIndent: 0,
+              doInCurrentLine: false,
+              ignoreKeyword: false
+
+
+          };
+        },
+
+        token: function(stream, state) {
+            if (stream.sol()) {
+              state.currentIndent += state.nextLineIndent;
+              state.nextLineIndent = 0;
+              state.doInCurrentLine = 0;
+            }
+            var style = tokenLexer(stream, state);
+
+            state.lastToken = {style:style, content: stream.current()};
+
+            if (style==='space') style=null;
+
+            return style;
+        },
+
+        indent: function(state, textAfter) {
+            var trueText = textAfter.replace(/^\s+|\s+$/g, '') ;
+            if (trueText.match(closing) || trueText.match(doubleClosing) || trueText.match(middle)) return conf.indentUnit*(state.currentIndent-1);
+            if(state.currentIndent < 0) return 0;
+            return state.currentIndent * conf.indentUnit;
+        }
+
+    };
+    return external;
+});
+
+CodeMirror.defineMIME("text/vbscript", "vbscript");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/velocity/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,120 @@
+<!doctype html>
+
+<title>CodeMirror: Velocity mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/night.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="velocity.js"></script>
+<style>.CodeMirror {border: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Velocity</a>
+  </ul>
+</div>
+
+<article>
+<h2>Velocity mode</h2>
+<form><textarea id="code" name="code">
+## Velocity Code Demo
+#*
+   based on PL/SQL mode by Peter Raganitsch, adapted to Velocity by Steve O'Hara ( http://www.pivotal-solutions.co.uk )
+   August 2011
+*#
+
+#*
+   This is a multiline comment.
+   This is the second line
+*#
+
+#[[ hello steve
+   This has invalid syntax that would normally need "poor man's escaping" like:
+
+   #define()
+
+   ${blah
+]]#
+
+#include( "disclaimer.txt" "opinion.txt" )
+#include( $foo $bar )
+
+#parse( "lecorbusier.vm" )
+#parse( $foo )
+
+#evaluate( 'string with VTL #if(true)will be displayed#end' )
+
+#define( $hello ) Hello $who #end #set( $who = "World!") $hello ## displays Hello World!
+
+#foreach( $customer in $customerList )
+
+    $foreach.count $customer.Name
+
+    #if( $foo == ${bar})
+        it's true!
+        #break
+    #{else}
+        it's not!
+        #stop
+    #end
+
+    #if ($foreach.parent.hasNext)
+        $velocityCount
+    #end
+#end
+
+$someObject.getValues("this is a string split
+        across lines")
+
+$someObject("This plus $something in the middle").method(7567).property
+
+#set($something = "Parseable string with '$quotes'!")
+
+#macro( tablerows $color $somelist )
+    #foreach( $something in $somelist )
+        <tr><td bgcolor=$color>$something</td></tr>
+        <tr><td bgcolor=$color>$bodyContent</td></tr>
+    #end
+#end
+
+#tablerows("red" ["dadsdf","dsa"])
+#@tablerows("red" ["dadsdf","dsa"]) some body content #end
+
+   Variable reference: #set( $monkey = $bill )
+   String literal: #set( $monkey.Friend = 'monica' )
+   Property reference: #set( $monkey.Blame = $whitehouse.Leak )
+   Method reference: #set( $monkey.Plan = $spindoctor.weave($web) )
+   Number literal: #set( $monkey.Number = 123 )
+   Range operator: #set( $monkey.Numbers = [1..3] )
+   Object list: #set( $monkey.Say = ["Not", $my, "fault"] )
+   Object map: #set( $monkey.Map = {"banana" : "good", "roast beef" : "bad"})
+
+The RHS can also be a simple arithmetic expression, such as:
+Addition: #set( $value = $foo + 1 )
+   Subtraction: #set( $value = $bar - 1 )
+   Multiplication: #set( $value = $foo * $bar )
+   Division: #set( $value = $foo / $bar )
+   Remainder: #set( $value = $foo % $bar )
+
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        theme: "night",
+        lineNumbers: true,
+        indentUnit: 4,
+        mode: "text/velocity"
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/velocity</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/velocity/velocity.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,202 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("velocity", function() {
+    function parseWords(str) {
+        var obj = {}, words = str.split(" ");
+        for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+        return obj;
+    }
+
+    var keywords = parseWords("#end #else #break #stop #[[ #]] " +
+                              "#{end} #{else} #{break} #{stop}");
+    var functions = parseWords("#if #elseif #foreach #set #include #parse #macro #define #evaluate " +
+                               "#{if} #{elseif} #{foreach} #{set} #{include} #{parse} #{macro} #{define} #{evaluate}");
+    var specials = parseWords("$foreach.count $foreach.hasNext $foreach.first $foreach.last $foreach.topmost $foreach.parent.count $foreach.parent.hasNext $foreach.parent.first $foreach.parent.last $foreach.parent $velocityCount $!bodyContent $bodyContent");
+    var isOperatorChar = /[+\-*&%=<>!?:\/|]/;
+
+    function chain(stream, state, f) {
+        state.tokenize = f;
+        return f(stream, state);
+    }
+    function tokenBase(stream, state) {
+        var beforeParams = state.beforeParams;
+        state.beforeParams = false;
+        var ch = stream.next();
+        // start of unparsed string?
+        if ((ch == "'") && !state.inString && state.inParams) {
+            state.lastTokenWasBuiltin = false;
+            return chain(stream, state, tokenString(ch));
+        }
+        // start of parsed string?
+        else if ((ch == '"')) {
+            state.lastTokenWasBuiltin = false;
+            if (state.inString) {
+                state.inString = false;
+                return "string";
+            }
+            else if (state.inParams)
+                return chain(stream, state, tokenString(ch));
+        }
+        // is it one of the special signs []{}().,;? Separator?
+        else if (/[\[\]{}\(\),;\.]/.test(ch)) {
+            if (ch == "(" && beforeParams)
+                state.inParams = true;
+            else if (ch == ")") {
+                state.inParams = false;
+                state.lastTokenWasBuiltin = true;
+            }
+            return null;
+        }
+        // start of a number value?
+        else if (/\d/.test(ch)) {
+            state.lastTokenWasBuiltin = false;
+            stream.eatWhile(/[\w\.]/);
+            return "number";
+        }
+        // multi line comment?
+        else if (ch == "#" && stream.eat("*")) {
+            state.lastTokenWasBuiltin = false;
+            return chain(stream, state, tokenComment);
+        }
+        // unparsed content?
+        else if (ch == "#" && stream.match(/ *\[ *\[/)) {
+            state.lastTokenWasBuiltin = false;
+            return chain(stream, state, tokenUnparsed);
+        }
+        // single line comment?
+        else if (ch == "#" && stream.eat("#")) {
+            state.lastTokenWasBuiltin = false;
+            stream.skipToEnd();
+            return "comment";
+        }
+        // variable?
+        else if (ch == "$") {
+            stream.eat("!");
+            stream.eatWhile(/[\w\d\$_\.{}-]/);
+            // is it one of the specials?
+            if (specials && specials.propertyIsEnumerable(stream.current())) {
+                return "keyword";
+            }
+            else {
+                state.lastTokenWasBuiltin = true;
+                state.beforeParams = true;
+                return "builtin";
+            }
+        }
+        // is it a operator?
+        else if (isOperatorChar.test(ch)) {
+            state.lastTokenWasBuiltin = false;
+            stream.eatWhile(isOperatorChar);
+            return "operator";
+        }
+        else {
+            // get the whole word
+            stream.eatWhile(/[\w\$_{}@]/);
+            var word = stream.current();
+            // is it one of the listed keywords?
+            if (keywords && keywords.propertyIsEnumerable(word))
+                return "keyword";
+            // is it one of the listed functions?
+            if (functions && functions.propertyIsEnumerable(word) ||
+                    (stream.current().match(/^#@?[a-z0-9_]+ *$/i) && stream.peek()=="(") &&
+                     !(functions && functions.propertyIsEnumerable(word.toLowerCase()))) {
+                state.beforeParams = true;
+                state.lastTokenWasBuiltin = false;
+                return "keyword";
+            }
+            if (state.inString) {
+                state.lastTokenWasBuiltin = false;
+                return "string";
+            }
+            if (stream.pos > word.length && stream.string.charAt(stream.pos-word.length-1)=="." && state.lastTokenWasBuiltin)
+                return "builtin";
+            // default: just a "word"
+            state.lastTokenWasBuiltin = false;
+            return null;
+        }
+    }
+
+    function tokenString(quote) {
+        return function(stream, state) {
+            var escaped = false, next, end = false;
+            while ((next = stream.next()) != null) {
+                if ((next == quote) && !escaped) {
+                    end = true;
+                    break;
+                }
+                if (quote=='"' && stream.peek() == '$' && !escaped) {
+                    state.inString = true;
+                    end = true;
+                    break;
+                }
+                escaped = !escaped && next == "\\";
+            }
+            if (end) state.tokenize = tokenBase;
+            return "string";
+        };
+    }
+
+    function tokenComment(stream, state) {
+        var maybeEnd = false, ch;
+        while (ch = stream.next()) {
+            if (ch == "#" && maybeEnd) {
+                state.tokenize = tokenBase;
+                break;
+            }
+            maybeEnd = (ch == "*");
+        }
+        return "comment";
+    }
+
+    function tokenUnparsed(stream, state) {
+        var maybeEnd = 0, ch;
+        while (ch = stream.next()) {
+            if (ch == "#" && maybeEnd == 2) {
+                state.tokenize = tokenBase;
+                break;
+            }
+            if (ch == "]")
+                maybeEnd++;
+            else if (ch != " ")
+                maybeEnd = 0;
+        }
+        return "meta";
+    }
+    // Interface
+
+    return {
+        startState: function() {
+            return {
+                tokenize: tokenBase,
+                beforeParams: false,
+                inParams: false,
+                inString: false,
+                lastTokenWasBuiltin: false
+            };
+        },
+
+        token: function(stream, state) {
+            if (stream.eatSpace()) return null;
+            return state.tokenize(stream, state);
+        },
+        blockCommentStart: "#*",
+        blockCommentEnd: "*#",
+        lineComment: "##",
+        fold: "velocity"
+    };
+});
+
+CodeMirror.defineMIME("text/velocity", "velocity");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/verilog/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,120 @@
+<!doctype html>
+
+<title>CodeMirror: Verilog/SystemVerilog mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="verilog.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Verilog/SystemVerilog</a>
+  </ul>
+</div>
+
+<article>
+<h2>SystemVerilog mode</h2>
+
+<div><textarea id="code" name="code">
+// Literals
+1'b0
+1'bx
+1'bz
+16'hDC78
+'hdeadbeef
+'b0011xxzz
+1234
+32'd5678
+3.4e6
+-128.7
+
+// Macro definition
+`define BUS_WIDTH = 8;
+
+// Module definition
+module block(
+  input                   clk,
+  input                   rst_n,
+  input  [`BUS_WIDTH-1:0] data_in,
+  output [`BUS_WIDTH-1:0] data_out
+);
+  
+  always @(posedge clk or negedge rst_n) begin
+
+    if (~rst_n) begin
+      data_out <= 8'b0;
+    end else begin
+      data_out <= data_in;
+    end
+    
+    if (~rst_n)
+      data_out <= 8'b0;
+    else
+      data_out <= data_in;
+    
+    if (~rst_n)
+      begin
+        data_out <= 8'b0;
+      end
+    else
+      begin
+        data_out <= data_in;
+      end
+
+  end
+  
+endmodule
+
+// Class definition
+class test;
+
+  /**
+   * Sum two integers
+   */
+  function int sum(int a, int b);
+    int result = a + b;
+    string msg = $sformatf("%d + %d = %d", a, b, result);
+    $display(msg);
+    return result;
+  endfunction
+  
+  task delay(int num_cycles);
+    repeat(num_cycles) #1;
+  endtask
+  
+endclass
+
+</textarea></div>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    matchBrackets: true,
+    mode: {
+      name: "verilog",
+      noIndentKeywords: ["package"]
+    }
+  });
+</script>
+
+<p>
+Syntax highlighting and indentation for the Verilog and SystemVerilog languages (IEEE 1800).
+<h2>Configuration options:</h2>
+  <ul>
+    <li><strong>noIndentKeywords</strong> - List of keywords which should not cause indentation to increase. E.g. ["package", "module"]. Default: None</li>
+  </ul>
+</p>
+
+<p><strong>MIME types defined:</strong> <code>text/x-verilog</code> and <code>text/x-systemverilog</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/verilog/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,443 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 4}, "verilog");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("binary_literals",
+     "[number 1'b0]",
+     "[number 1'b1]",
+     "[number 1'bx]",
+     "[number 1'bz]",
+     "[number 1'bX]",
+     "[number 1'bZ]",
+     "[number 1'B0]",
+     "[number 1'B1]",
+     "[number 1'Bx]",
+     "[number 1'Bz]",
+     "[number 1'BX]",
+     "[number 1'BZ]",
+     "[number 1'b0]",
+     "[number 1'b1]",
+     "[number 2'b01]",
+     "[number 2'bxz]",
+     "[number 2'b11]",
+     "[number 2'b10]",
+     "[number 2'b1Z]",
+     "[number 12'b0101_0101_0101]",
+     "[number 1'b 0]",
+     "[number 'b0101]"
+  );
+
+  MT("octal_literals",
+     "[number 3'o7]",
+     "[number 3'O7]",
+     "[number 3'so7]",
+     "[number 3'SO7]"
+  );
+
+  MT("decimal_literals",
+     "[number 0]",
+     "[number 1]",
+     "[number 7]",
+     "[number 123_456]",
+     "[number 'd33]",
+     "[number 8'd255]",
+     "[number 8'D255]",
+     "[number 8'sd255]",
+     "[number 8'SD255]",
+     "[number 32'd123]",
+     "[number 32 'd123]",
+     "[number 32 'd 123]"
+  );
+
+  MT("hex_literals",
+     "[number 4'h0]",
+     "[number 4'ha]",
+     "[number 4'hF]",
+     "[number 4'hx]",
+     "[number 4'hz]",
+     "[number 4'hX]",
+     "[number 4'hZ]",
+     "[number 32'hdc78]",
+     "[number 32'hDC78]",
+     "[number 32 'hDC78]",
+     "[number 32'h DC78]",
+     "[number 32 'h DC78]",
+     "[number 32'h44x7]",
+     "[number 32'hFFF?]"
+  );
+
+  MT("real_number_literals",
+     "[number 1.2]",
+     "[number 0.1]",
+     "[number 2394.26331]",
+     "[number 1.2E12]",
+     "[number 1.2e12]",
+     "[number 1.30e-2]",
+     "[number 0.1e-0]",
+     "[number 23E10]",
+     "[number 29E-2]",
+     "[number 236.123_763_e-12]"
+  );
+
+  MT("operators",
+     "[meta ^]"
+  );
+
+  MT("keywords",
+     "[keyword logic]",
+     "[keyword logic] [variable foo]",
+     "[keyword reg] [variable abc]"
+  );
+
+  MT("variables",
+     "[variable _leading_underscore]",
+     "[variable _if]",
+     "[number 12] [variable foo]",
+     "[variable foo] [number 14]"
+  );
+
+  MT("tick_defines",
+     "[def `FOO]",
+     "[def `foo]",
+     "[def `FOO_bar]"
+  );
+
+  MT("system_calls",
+     "[meta $display]",
+     "[meta $vpi_printf]"
+  );
+
+  MT("line_comment", "[comment // Hello world]");
+
+  // Alignment tests
+  MT("align_port_map_style1",
+     /**
+      * mod mod(.a(a),
+      *         .b(b)
+      *        );
+      */
+     "[variable mod] [variable mod][bracket (].[variable a][bracket (][variable a][bracket )],",
+     "        .[variable b][bracket (][variable b][bracket )]",
+     "       [bracket )];",
+     ""
+  );
+
+  MT("align_port_map_style2",
+     /**
+      * mod mod(
+      *     .a(a),
+      *     .b(b)
+      * );
+      */
+     "[variable mod] [variable mod][bracket (]",
+     "    .[variable a][bracket (][variable a][bracket )],",
+     "    .[variable b][bracket (][variable b][bracket )]",
+     "[bracket )];",
+     ""
+  );
+
+  MT("align_assignments",
+     /**
+      * always @(posedge clk) begin
+      *    if (rst)
+      *       data_out <= 8'b0 +
+      *                   8'b1;
+      *    else
+      *       data_out = 8'b0 +
+      *                  8'b1;
+      *    data_out =
+      *       8'b0 + 8'b1;
+      * end
+      */
+     "[keyword always] [def @][bracket (][keyword posedge] [variable clk][bracket )] [keyword begin]",
+     "    [keyword if] [bracket (][variable rst][bracket )]",
+     "        [variable data_out] [meta <=] [number 8'b0] [meta +]",
+     "                    [number 8'b1];",
+     "    [keyword else]",
+     "        [variable data_out] [meta =] [number 8'b0] [meta +]",
+     "                   [number 8'b1];",
+     "    [variable data_out] [meta =] [number 8'b0] [meta +]",
+     "               [number 8'b1];",
+     "[keyword end]",
+     ""
+  );
+
+  // Indentation tests
+  MT("indent_single_statement_if",
+      "[keyword if] [bracket (][variable foo][bracket )]",
+      "    [keyword break];",
+      ""
+  );
+
+  MT("no_indent_after_single_line_if",
+      "[keyword if] [bracket (][variable foo][bracket )] [keyword break];",
+      ""
+  );
+
+  MT("indent_after_if_begin_same_line",
+      "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]",
+      "    [keyword break];",
+      "    [keyword break];",
+      "[keyword end]",
+      ""
+  );
+
+  MT("indent_after_if_begin_next_line",
+      "[keyword if] [bracket (][variable foo][bracket )]",
+      "    [keyword begin]",
+      "        [keyword break];",
+      "        [keyword break];",
+      "    [keyword end]",
+      ""
+  );
+
+  MT("indent_single_statement_if_else",
+      "[keyword if] [bracket (][variable foo][bracket )]",
+      "    [keyword break];",
+      "[keyword else]",
+      "    [keyword break];",
+      ""
+  );
+
+  MT("indent_if_else_begin_same_line",
+      "[keyword if] [bracket (][variable foo][bracket )] [keyword begin]",
+      "    [keyword break];",
+      "    [keyword break];",
+      "[keyword end] [keyword else] [keyword begin]",
+      "    [keyword break];",
+      "    [keyword break];",
+      "[keyword end]",
+      ""
+  );
+
+  MT("indent_if_else_begin_next_line",
+      "[keyword if] [bracket (][variable foo][bracket )]",
+      "    [keyword begin]",
+      "        [keyword break];",
+      "        [keyword break];",
+      "    [keyword end]",
+      "[keyword else]",
+      "    [keyword begin]",
+      "        [keyword break];",
+      "        [keyword break];",
+      "    [keyword end]",
+      ""
+  );
+
+  MT("indent_if_nested_without_begin",
+      "[keyword if] [bracket (][variable foo][bracket )]",
+      "    [keyword if] [bracket (][variable foo][bracket )]",
+      "        [keyword if] [bracket (][variable foo][bracket )]",
+      "            [keyword break];",
+      ""
+  );
+
+  MT("indent_case",
+      "[keyword case] [bracket (][variable state][bracket )]",
+      "    [variable FOO]:",
+      "        [keyword break];",
+      "    [variable BAR]:",
+      "        [keyword break];",
+      "[keyword endcase]",
+      ""
+  );
+
+  MT("unindent_after_end_with_preceding_text",
+      "[keyword begin]",
+      "    [keyword break]; [keyword end]",
+      ""
+  );
+
+  MT("export_function_one_line_does_not_indent",
+     "[keyword export] [string \"DPI-C\"] [keyword function] [variable helloFromSV];",
+     ""
+  );
+
+  MT("export_task_one_line_does_not_indent",
+     "[keyword export] [string \"DPI-C\"] [keyword task] [variable helloFromSV];",
+     ""
+  );
+
+  MT("export_function_two_lines_indents_properly",
+    "[keyword export]",
+    "    [string \"DPI-C\"] [keyword function] [variable helloFromSV];",
+    ""
+  );
+
+  MT("export_task_two_lines_indents_properly",
+    "[keyword export]",
+    "    [string \"DPI-C\"] [keyword task] [variable helloFromSV];",
+    ""
+  );
+
+  MT("import_function_one_line_does_not_indent",
+    "[keyword import] [string \"DPI-C\"] [keyword function] [variable helloFromC];",
+    ""
+  );
+
+  MT("import_task_one_line_does_not_indent",
+    "[keyword import] [string \"DPI-C\"] [keyword task] [variable helloFromC];",
+    ""
+  );
+
+  MT("import_package_single_line_does_not_indent",
+    "[keyword import] [variable p]::[variable x];",
+    "[keyword import] [variable p]::[variable y];",
+    ""
+  );
+
+  MT("covergroup_with_function_indents_properly",
+    "[keyword covergroup] [variable cg] [keyword with] [keyword function] [variable sample][bracket (][keyword bit] [variable b][bracket )];",
+    "    [variable c] : [keyword coverpoint] [variable c];",
+    "[keyword endgroup]: [variable cg]",
+    ""
+  );
+
+  MT("indent_uvm_macros",
+     /**
+      *  `uvm_object_utils_begin(foo)
+      *    `uvm_field_event(foo, UVM_ALL_ON)
+      *  `uvm_object_utils_end
+      */
+     "[def `uvm_object_utils_begin][bracket (][variable foo][bracket )]",
+     "    [def `uvm_field_event][bracket (][variable foo], [variable UVM_ALL_ON][bracket )]",
+     "[def `uvm_object_utils_end]",
+     ""
+  );
+
+  MT("indent_uvm_macros2",
+     /**
+      * `uvm_do_with(mem_read,{
+      *    bar_nb == 0;
+      * })
+      */
+     "[def `uvm_do_with][bracket (][variable mem_read],[bracket {]",
+     "    [variable bar_nb] [meta ==] [number 0];",
+     "[bracket })]",
+     ""
+  );
+
+  MT("indent_wait_disable_fork",
+     /**
+      * virtual task body();
+      *    repeat (20) begin
+      *       fork
+      *          `uvm_create_on(t,p_seq)
+      *       join_none
+      *    end
+      *    wait fork;
+      *    disable fork;
+      * endtask : body
+      */
+     "[keyword virtual] [keyword task] [variable body][bracket ()];",
+     "    [keyword repeat] [bracket (][number 20][bracket )] [keyword begin]",
+     "        [keyword fork]",
+     "            [def `uvm_create_on][bracket (][variable t],[variable p_seq][bracket )]",
+     "        [keyword join_none]",
+     "    [keyword end]",
+     "    [keyword wait] [keyword fork];",
+     "    [keyword disable] [keyword fork];",
+     "[keyword endtask] : [variable body]",
+     ""
+  );
+
+  MT("indent_typedef_class",
+     /**
+      * typedef class asdf;
+      * typedef p p_t[];
+      * typedef enum {
+      *    ASDF
+      * } t;
+      */
+     "[keyword typedef] [keyword class] [variable asdf];",
+     "[keyword typedef] [variable p] [variable p_t][bracket [[]]];",
+     "[keyword typedef] [keyword enum] [bracket {]",
+     "    [variable ASDF]",
+     "[bracket }] [variable t];",
+     ""
+  );
+
+  MT("indent_case_with_macro",
+     /**
+      * // It should be assumed that Macros can have ';' inside, or 'begin'/'end' blocks.
+      * // As such, 'case' statement should indent correctly with macros inside.
+      * case(foo)
+      *    ASDF : this.foo = seqNum;
+      *    ABCD : `update(f)
+      *    EFGH : `update(g)
+      * endcase
+      */
+     "[keyword case][bracket (][variable foo][bracket )]",
+     "    [variable ASDF] : [keyword this].[variable foo] [meta =] [variable seqNum];",
+     "    [variable ABCD] : [def `update][bracket (][variable f][bracket )]",
+     "    [variable EFGH] : [def `update][bracket (][variable g][bracket )]",
+     "[keyword endcase]",
+     ""
+  );
+
+  MT("indent_extern_function",
+     /**
+      * extern virtual function void do(ref packet trans);
+      * extern virtual function void do2(ref packet trans);
+      */
+     "[keyword extern] [keyword virtual] [keyword function] [keyword void] [variable do1][bracket (][keyword ref] [variable packet] [variable trans][bracket )];",
+     "[keyword extern] [keyword virtual] [keyword function] [keyword void] [variable do2][bracket (][keyword ref] [variable packet] [variable trans][bracket )];",
+     ""
+  );
+
+  MT("indent_assignment",
+     /**
+      * for (int i=1;i < fun;i++) begin
+      *    foo = 2 << asdf || 11'h35 >> abcd
+      *          && 8'h6 | 1'b1;
+      * end
+      */
+     "[keyword for] [bracket (][keyword int] [variable i][meta =][number 1];[variable i] [meta <] [variable fun];[variable i][meta ++][bracket )] [keyword begin]",
+     "    [variable foo] [meta =] [number 2] [meta <<] [variable asdf] [meta ||] [number 11'h35] [meta >>] [variable abcd]",
+     "          [meta &&] [number 8'h6] [meta |] [number 1'b1];",
+     "[keyword end]",
+     ""
+  );
+
+  MT("indent_foreach_constraint",
+     /**
+      * `uvm_rand_send_with(wrTlp, {
+      *    length ==1;
+      *    foreach (Data[i]) {
+      *       payload[i] == Data[i];
+      *    }
+      * })
+      */
+     "[def `uvm_rand_send_with][bracket (][variable wrTlp], [bracket {]",
+     "    [variable length] [meta ==][number 1];",
+     "    [keyword foreach] [bracket (][variable Data][bracket [[][variable i][bracket ]])] [bracket {]",
+     "        [variable payload][bracket [[][variable i][bracket ]]] [meta ==] [variable Data][bracket [[][variable i][bracket ]]];",
+     "    [bracket }]",
+     "[bracket })]",
+     ""
+  );
+
+  MT("indent_compiler_directives",
+     /**
+      * `ifdef DUT
+      * `else
+      *     `ifndef FOO
+      *         `define FOO
+      *     `endif
+      * `endif
+      * `timescale 1ns/1ns
+      */
+     "[def `ifdef] [variable DUT]",
+     "[def `else]",
+     "    [def `ifndef] [variable FOO]",
+     "        [def `define] [variable FOO]",
+     "    [def `endif]",
+     "[def `endif]",
+     "[def `timescale] [number 1][variable ns][meta /][number 1][variable ns]",
+     ""
+  );
+
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/verilog/verilog.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,781 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("verilog", function(config, parserConfig) {
+
+  var indentUnit = config.indentUnit,
+      statementIndentUnit = parserConfig.statementIndentUnit || indentUnit,
+      dontAlignCalls = parserConfig.dontAlignCalls,
+      // compilerDirectivesUseRegularIndentation - If set, Compiler directive
+      // indentation follows the same rules as everything else. Otherwise if
+      // false, compiler directives will track their own indentation.
+      // For example, `ifdef nested inside another `ifndef will be indented,
+      // but a `ifdef inside a function block may not be indented.
+      compilerDirectivesUseRegularIndentation = parserConfig.compilerDirectivesUseRegularIndentation,
+      noIndentKeywords = parserConfig.noIndentKeywords || [],
+      multiLineStrings = parserConfig.multiLineStrings,
+      hooks = parserConfig.hooks || {};
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  /**
+   * Keywords from IEEE 1800-2012
+   */
+  var keywords = words(
+    "accept_on alias always always_comb always_ff always_latch and assert assign assume automatic before begin bind " +
+    "bins binsof bit break buf bufif0 bufif1 byte case casex casez cell chandle checker class clocking cmos config " +
+    "const constraint context continue cover covergroup coverpoint cross deassign default defparam design disable " +
+    "dist do edge else end endcase endchecker endclass endclocking endconfig endfunction endgenerate endgroup " +
+    "endinterface endmodule endpackage endprimitive endprogram endproperty endspecify endsequence endtable endtask " +
+    "enum event eventually expect export extends extern final first_match for force foreach forever fork forkjoin " +
+    "function generate genvar global highz0 highz1 if iff ifnone ignore_bins illegal_bins implements implies import " +
+    "incdir include initial inout input inside instance int integer interconnect interface intersect join join_any " +
+    "join_none large let liblist library local localparam logic longint macromodule matches medium modport module " +
+    "nand negedge nettype new nexttime nmos nor noshowcancelled not notif0 notif1 null or output package packed " +
+    "parameter pmos posedge primitive priority program property protected pull0 pull1 pulldown pullup " +
+    "pulsestyle_ondetect pulsestyle_onevent pure rand randc randcase randsequence rcmos real realtime ref reg " +
+    "reject_on release repeat restrict return rnmos rpmos rtran rtranif0 rtranif1 s_always s_eventually s_nexttime " +
+    "s_until s_until_with scalared sequence shortint shortreal showcancelled signed small soft solve specify " +
+    "specparam static string strong strong0 strong1 struct super supply0 supply1 sync_accept_on sync_reject_on " +
+    "table tagged task this throughout time timeprecision timeunit tran tranif0 tranif1 tri tri0 tri1 triand trior " +
+    "trireg type typedef union unique unique0 unsigned until until_with untyped use uwire var vectored virtual void " +
+    "wait wait_order wand weak weak0 weak1 while wildcard wire with within wor xnor xor");
+
+  /** Operators from IEEE 1800-2012
+     unary_operator ::=
+       + | - | ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
+     binary_operator ::=
+       + | - | * | / | % | == | != | === | !== | ==? | !=? | && | || | **
+       | < | <= | > | >= | & | | | ^ | ^~ | ~^ | >> | << | >>> | <<<
+       | -> | <->
+     inc_or_dec_operator ::= ++ | --
+     unary_module_path_operator ::=
+       ! | ~ | & | ~& | | | ~| | ^ | ~^ | ^~
+     binary_module_path_operator ::=
+       == | != | && | || | & | | | ^ | ^~ | ~^
+  */
+  var isOperatorChar = /[\+\-\*\/!~&|^%=?:<>]/;
+  var isBracketChar = /[\[\]{}()]/;
+
+  var unsignedNumber = /\d[0-9_]*/;
+  var decimalLiteral = /\d*\s*'s?d\s*\d[0-9_]*/i;
+  var binaryLiteral = /\d*\s*'s?b\s*[xz01][xz01_]*/i;
+  var octLiteral = /\d*\s*'s?o\s*[xz0-7][xz0-7_]*/i;
+  var hexLiteral = /\d*\s*'s?h\s*[0-9a-fxz?][0-9a-fxz?_]*/i;
+  var realLiteral = /(\d[\d_]*(\.\d[\d_]*)?E-?[\d_]+)|(\d[\d_]*\.\d[\d_]*)/i;
+
+  var closingBracketOrWord = /^((`?\w+)|[)}\]])/;
+  var closingBracket = /[)}\]]/;
+  var compilerDirectiveRegex      = new RegExp(
+    "^(`(?:ifdef|ifndef|elsif|else|endif|undef|undefineall|define|include|begin_keywords|celldefine|default|" +
+    "nettype|end_keywords|endcelldefine|line|nounconnected_drive|pragma|resetall|timescale|unconnected_drive))\\b");
+  var compilerDirectiveBeginRegex = /^(`(?:ifdef|ifndef|elsif|else))\b/;
+  var compilerDirectiveEndRegex   = /^(`(?:elsif|else|endif))\b/;
+
+  var curPunc;
+  var curKeyword;
+
+  // Block openings which are closed by a matching keyword in the form of ("end" + keyword)
+  // E.g. "task" => "endtask"
+  var blockKeywords = words(
+    "case checker class clocking config function generate interface module package " +
+    "primitive program property specify sequence table task"
+  );
+
+  // Opening/closing pairs
+  var openClose = {};
+  for (var keyword in blockKeywords) {
+    openClose[keyword] = "end" + keyword;
+  }
+  openClose["begin"] = "end";
+  openClose["casex"] = "endcase";
+  openClose["casez"] = "endcase";
+  openClose["do"   ] = "while";
+  openClose["fork" ] = "join;join_any;join_none";
+  openClose["covergroup"] = "endgroup";
+  openClose["macro_begin"] = "macro_end";
+
+  for (var i in noIndentKeywords) {
+    var keyword = noIndentKeywords[i];
+    if (openClose[keyword]) {
+      openClose[keyword] = undefined;
+    }
+  }
+
+  // Keywords which open statements that are ended with a semi-colon
+  var statementKeywords = words("always always_comb always_ff always_latch assert assign assume else export for foreach forever if import initial repeat while extern typedef");
+
+  function tokenBase(stream, state) {
+    var ch = stream.peek(), style;
+    if (hooks[ch] && (style = hooks[ch](stream, state)) != false) return style;
+    if (hooks.tokenBase && (style = hooks.tokenBase(stream, state)) != false)
+      return style;
+
+    if (/[,;:\.]/.test(ch)) {
+      curPunc = stream.next();
+      return null;
+    }
+    if (isBracketChar.test(ch)) {
+      curPunc = stream.next();
+      return "bracket";
+    }
+    // Macros (tick-defines)
+    if (ch == '`') {
+      stream.next();
+      if (stream.eatWhile(/[\w\$_]/)) {
+        var cur = stream.current();
+        curKeyword = cur;
+        // Macros that end in _begin, are start of block and end with _end
+        if (cur.startsWith("`uvm_") && cur.endsWith("_begin")) {
+          var keywordClose = curKeyword.substr(0,curKeyword.length - 5) + "end";
+          openClose[cur] = keywordClose;
+          curPunc = "newblock";
+        } else {
+          stream.eatSpace();
+          if (stream.peek() == '(') {
+            // Check if this is a block
+            curPunc = "newmacro";
+          }
+          var withSpace = stream.current();
+          // Move the stream back before the spaces
+          stream.backUp(withSpace.length - cur.length);
+        }
+        return "def";
+      } else {
+        return null;
+      }
+    }
+    // System calls
+    if (ch == '$') {
+      stream.next();
+      if (stream.eatWhile(/[\w\$_]/)) {
+        return "meta";
+      } else {
+        return null;
+      }
+    }
+    // Time literals
+    if (ch == '#') {
+      stream.next();
+      stream.eatWhile(/[\d_.]/);
+      return "def";
+    }
+    // Event
+    if (ch == '@') {
+      stream.next();
+      stream.eatWhile(/[@]/);
+      return "def";
+    }
+    // Strings
+    if (ch == '"') {
+      stream.next();
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    // Comments
+    if (ch == "/") {
+      stream.next();
+      if (stream.eat("*")) {
+        state.tokenize = tokenComment;
+        return tokenComment(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+      stream.backUp(1);
+    }
+
+    // Numeric literals
+    if (stream.match(realLiteral) ||
+        stream.match(decimalLiteral) ||
+        stream.match(binaryLiteral) ||
+        stream.match(octLiteral) ||
+        stream.match(hexLiteral) ||
+        stream.match(unsignedNumber) ||
+        stream.match(realLiteral)) {
+      return "number";
+    }
+
+    // Operators
+    if (stream.eatWhile(isOperatorChar)) {
+      curPunc = stream.current();
+      return "meta";
+    }
+
+    // Keywords / plain variables
+    if (stream.eatWhile(/[\w\$_]/)) {
+      var cur = stream.current();
+      if (keywords[cur]) {
+        if (openClose[cur]) {
+          curPunc = "newblock";
+          if (cur === "fork") {
+            // Fork can be a statement instead of block in cases of:
+            // "disable fork;" and "wait fork;" (trailing semicolon)
+            stream.eatSpace()
+            if (stream.peek() == ';') {
+              curPunc = "newstatement";
+            }
+            stream.backUp(stream.current().length - cur.length);
+          }
+        }
+        if (statementKeywords[cur]) {
+          curPunc = "newstatement";
+        }
+        curKeyword = cur;
+        return "keyword";
+      }
+      return "variable";
+    }
+
+    stream.next();
+    return null;
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "\\";
+      }
+      if (end || !(escaped || multiLineStrings))
+        state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+
+  function tokenComment(stream, state) {
+    var maybeEnd = false, ch;
+    while (ch = stream.next()) {
+      if (ch == "/" && maybeEnd) {
+        state.tokenize = tokenBase;
+        break;
+      }
+      maybeEnd = (ch == "*");
+    }
+    return "comment";
+  }
+
+  function Context(indented, column, type, scopekind, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.scopekind = scopekind;
+    this.align = align;
+    this.prev = prev;
+  }
+  function pushContext(state, col, type, scopekind) {
+    var indent = state.indented;
+    var c = new Context(indent, col, type, scopekind ? scopekind : "", null, state.context);
+    return state.context = c;
+  }
+  function popContext(state) {
+    var t = state.context.type;
+    if (t == ")" || t == "]" || t == "}") {
+      state.indented = state.context.indented;
+    }
+    return state.context = state.context.prev;
+  }
+
+  function isClosing(text, contextClosing) {
+    if (text == contextClosing) {
+      return true;
+    } else {
+      // contextClosing may be multiple keywords separated by ;
+      var closingKeywords = contextClosing.split(";");
+      for (var i in closingKeywords) {
+        if (text == closingKeywords[i]) {
+          return true;
+        }
+      }
+      return false;
+    }
+  }
+
+  function isInsideScopeKind(ctx, scopekind) {
+    if (ctx == null) {
+      return false;
+    }
+    if (ctx.scopekind === scopekind) {
+      return true;
+    }
+    return isInsideScopeKind(ctx.prev, scopekind);
+  }
+
+  function buildElectricInputRegEx() {
+    // Reindentation should occur on any bracket char: {}()[]
+    // or on a match of any of the block closing keywords, at
+    // the end of a line
+    var allClosings = [];
+    for (var i in openClose) {
+      if (openClose[i]) {
+        var closings = openClose[i].split(";");
+        for (var j in closings) {
+          allClosings.push(closings[j]);
+        }
+      }
+    }
+    var re = new RegExp("[{}()\\[\\]]|(" + allClosings.join("|") + ")$");
+    return re;
+  }
+
+  // Interface
+  return {
+
+    // Regex to force current line to reindent
+    electricInput: buildElectricInputRegEx(),
+
+    startState: function(basecolumn) {
+      var state = {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", "top", false),
+        indented: 0,
+        compilerDirectiveIndented: 0,
+        startOfLine: true
+      };
+      if (hooks.startState) hooks.startState(state);
+      return state;
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+      }
+      if (hooks.token) {
+        // Call hook, with an optional return value of a style to override verilog styling.
+        var style = hooks.token(stream, state);
+        if (style !== undefined) {
+          return style;
+        }
+      }
+      if (stream.eatSpace()) return null;
+      curPunc = null;
+      curKeyword = null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta" || style == "variable") {
+        if (((curPunc === "=") || (curPunc === "<=")) && !isInsideScopeKind(ctx, "assignment")) {
+          // '<=' could be nonblocking assignment or lessthan-equals (which shouldn't cause indent)
+          //      Search through the context to see if we are already in an assignment.
+          // '=' could be inside port declaration with comma or ')' afterward, or inside for(;;) block.
+          pushContext(state, stream.column() + curPunc.length, "assignment", "assignment");
+          if (ctx.align == null) ctx.align = true;
+        }
+        return style;
+      }
+      if (ctx.align == null) ctx.align = true;
+
+      var isClosingAssignment = ctx.type == "assignment" &&
+        closingBracket.test(curPunc) && ctx.prev && ctx.prev.type === curPunc;
+      if (curPunc == ctx.type || isClosingAssignment) {
+        if (isClosingAssignment) {
+          ctx = popContext(state);
+        }
+        ctx = popContext(state);
+        if (curPunc == ")") {
+          // Handle closing macros, assuming they could have a semicolon or begin/end block inside.
+          if (ctx && (ctx.type === "macro")) {
+            ctx = popContext(state);
+            while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state);
+          }
+        } else if (curPunc == "}") {
+          // Handle closing statements like constraint block: "foreach () {}" which
+          // do not have semicolon at end.
+          if (ctx && (ctx.type === "statement")) {
+            while (ctx && (ctx.type == "statement")) ctx = popContext(state);
+          }
+        }
+      } else if (((curPunc == ";" || curPunc == ",") && (ctx.type == "statement" || ctx.type == "assignment")) ||
+               (ctx.type && isClosing(curKeyword, ctx.type))) {
+        ctx = popContext(state);
+        while (ctx && (ctx.type == "statement" || ctx.type == "assignment")) ctx = popContext(state);
+      } else if (curPunc == "{") {
+        pushContext(state, stream.column(), "}");
+      } else if (curPunc == "[") {
+        pushContext(state, stream.column(), "]");
+      } else if (curPunc == "(") {
+        pushContext(state, stream.column(), ")");
+      } else if (ctx && ctx.type == "endcase" && curPunc == ":") {
+        pushContext(state, stream.column(), "statement", "case");
+      } else if (curPunc == "newstatement") {
+        pushContext(state, stream.column(), "statement", curKeyword);
+      } else if (curPunc == "newblock") {
+        if (curKeyword == "function" && ctx && (ctx.type == "statement" || ctx.type == "endgroup")) {
+          // The 'function' keyword can appear in some other contexts where it actually does not
+          // indicate a function (import/export DPI and covergroup definitions).
+          // Do nothing in this case
+        } else if (curKeyword == "task" && ctx && ctx.type == "statement") {
+          // Same thing for task
+        } else if (curKeyword == "class" && ctx && ctx.type == "statement") {
+          // Same thing for class (e.g. typedef)
+        } else {
+          var close = openClose[curKeyword];
+          pushContext(state, stream.column(), close, curKeyword);
+        }
+      } else if (curPunc == "newmacro" || (curKeyword && curKeyword.match(compilerDirectiveRegex))) {
+        if (curPunc == "newmacro") {
+          // Macros (especially if they have parenthesis) potentially have a semicolon
+          // or complete statement/block inside, and should be treated as such.
+          pushContext(state, stream.column(), "macro", "macro");
+        }
+        if (curKeyword.match(compilerDirectiveEndRegex)) {
+          state.compilerDirectiveIndented -= statementIndentUnit;
+        }
+        if (curKeyword.match(compilerDirectiveBeginRegex)) {
+          state.compilerDirectiveIndented += statementIndentUnit;
+        }
+      }
+
+      state.startOfLine = false;
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null) return CodeMirror.Pass;
+      if (hooks.indent) {
+        var fromHook = hooks.indent(state);
+        if (fromHook >= 0) return fromHook;
+      }
+      var ctx = state.context, firstChar = textAfter && textAfter.charAt(0);
+      if (ctx.type == "statement" && firstChar == "}") ctx = ctx.prev;
+      var closing = false;
+      var possibleClosing = textAfter.match(closingBracketOrWord);
+      if (possibleClosing)
+        closing = isClosing(possibleClosing[0], ctx.type);
+      if (!compilerDirectivesUseRegularIndentation && textAfter.match(compilerDirectiveRegex)) {
+        if (textAfter.match(compilerDirectiveEndRegex)) {
+          return state.compilerDirectiveIndented - statementIndentUnit;
+        }
+        return state.compilerDirectiveIndented;
+      }
+      if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : statementIndentUnit);
+      else if ((closingBracket.test(ctx.type) || ctx.type == "assignment")
+        && ctx.align && !dontAlignCalls) return ctx.column + (closing ? 0 : 1);
+      else if (ctx.type == ")" && !closing) return ctx.indented + statementIndentUnit;
+      else return ctx.indented + (closing ? 0 : indentUnit);
+    },
+
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//",
+    fold: "indent"
+  };
+});
+
+  CodeMirror.defineMIME("text/x-verilog", {
+    name: "verilog"
+  });
+
+  CodeMirror.defineMIME("text/x-systemverilog", {
+    name: "verilog"
+  });
+
+
+
+  // TL-Verilog mode.
+  // See tl-x.org for language spec.
+  // See the mode in action at makerchip.com.
+  // Contact: steve.hoover@redwoodeda.com
+
+  // TLV Identifier prefixes.
+  // Note that sign is not treated separately, so "+/-" versions of numeric identifiers
+  // are included.
+  var tlvIdentifierStyle = {
+    "|": "link",
+    ">": "property",  // Should condition this off for > TLV 1c.
+    "$": "variable",
+    "$$": "variable",
+    "?$": "qualifier",
+    "?*": "qualifier",
+    "-": "hr",
+    "/": "property",
+    "/-": "property",
+    "@": "variable-3",
+    "@-": "variable-3",
+    "@++": "variable-3",
+    "@+=": "variable-3",
+    "@+=-": "variable-3",
+    "@--": "variable-3",
+    "@-=": "variable-3",
+    "%+": "tag",
+    "%-": "tag",
+    "%": "tag",
+    ">>": "tag",
+    "<<": "tag",
+    "<>": "tag",
+    "#": "tag",  // Need to choose a style for this.
+    "^": "attribute",
+    "^^": "attribute",
+    "^!": "attribute",
+    "*": "variable-2",
+    "**": "variable-2",
+    "\\": "keyword",
+    "\"": "comment"
+  };
+
+  // Lines starting with these characters define scope (result in indentation).
+  var tlvScopePrefixChars = {
+    "/": "beh-hier",
+    ">": "beh-hier",
+    "-": "phys-hier",
+    "|": "pipe",
+    "?": "when",
+    "@": "stage",
+    "\\": "keyword"
+  };
+  var tlvIndentUnit = 3;
+  var tlvTrackStatements = false;
+  var tlvIdentMatch = /^([~!@#\$%\^&\*-\+=\?\/\\\|'"<>]+)([\d\w_]*)/;  // Matches an identifier.
+  // Note that ':' is excluded, because of it's use in [:].
+  var tlvFirstLevelIndentMatch = /^[! ]  /;
+  var tlvLineIndentationMatch = /^[! ] */;
+  var tlvCommentMatch = /^\/[\/\*]/;
+
+
+  // Returns a style specific to the scope at the given indentation column.
+  // Type is one of: "indent", "scope-ident", "before-scope-ident".
+  function tlvScopeStyle(state, indentation, type) {
+    // Begin scope.
+    var depth = indentation / tlvIndentUnit;  // TODO: Pass this in instead.
+    return "tlv-" + state.tlvIndentationStyle[depth] + "-" + type;
+  }
+
+  // Return true if the next thing in the stream is an identifier with a mnemonic.
+  function tlvIdentNext(stream) {
+    var match;
+    return (match = stream.match(tlvIdentMatch, false)) && match[2].length > 0;
+  }
+
+  CodeMirror.defineMIME("text/x-tlv", {
+    name: "verilog",
+
+    hooks: {
+
+      electricInput: false,
+
+
+      // Return undefined for verilog tokenizing, or style for TLV token (null not used).
+      // Standard CM styles are used for most formatting, but some TL-Verilog-specific highlighting
+      // can be enabled with the definition of cm-tlv-* styles, including highlighting for:
+      //   - M4 tokens
+      //   - TLV scope indentation
+      //   - Statement delimitation (enabled by tlvTrackStatements)
+      token: function(stream, state) {
+        var style = undefined;
+        var match;  // Return value of pattern matches.
+
+        // Set highlighting mode based on code region (TLV or SV).
+        if (stream.sol() && ! state.tlvInBlockComment) {
+          // Process region.
+          if (stream.peek() == '\\') {
+            style = "def";
+            stream.skipToEnd();
+            if (stream.string.match(/\\SV/)) {
+              state.tlvCodeActive = false;
+            } else if (stream.string.match(/\\TLV/)){
+              state.tlvCodeActive = true;
+            }
+          }
+          // Correct indentation in the face of a line prefix char.
+          if (state.tlvCodeActive && stream.pos == 0 &&
+              (state.indented == 0) && (match = stream.match(tlvLineIndentationMatch, false))) {
+            state.indented = match[0].length;
+          }
+
+          // Compute indentation state:
+          //   o Auto indentation on next line
+          //   o Indentation scope styles
+          var indented = state.indented;
+          var depth = indented / tlvIndentUnit;
+          if (depth <= state.tlvIndentationStyle.length) {
+            // not deeper than current scope
+
+            var blankline = stream.string.length == indented;
+            var chPos = depth * tlvIndentUnit;
+            if (chPos < stream.string.length) {
+              var bodyString = stream.string.slice(chPos);
+              var ch = bodyString[0];
+              if (tlvScopePrefixChars[ch] && ((match = bodyString.match(tlvIdentMatch)) &&
+                  tlvIdentifierStyle[match[1]])) {
+                // This line begins scope.
+                // Next line gets indented one level.
+                indented += tlvIndentUnit;
+                // Style the next level of indentation (except non-region keyword identifiers,
+                //   which are statements themselves)
+                if (!(ch == "\\" && chPos > 0)) {
+                  state.tlvIndentationStyle[depth] = tlvScopePrefixChars[ch];
+                  if (tlvTrackStatements) {state.statementComment = false;}
+                  depth++;
+                }
+              }
+            }
+            // Clear out deeper indentation levels unless line is blank.
+            if (!blankline) {
+              while (state.tlvIndentationStyle.length > depth) {
+                state.tlvIndentationStyle.pop();
+              }
+            }
+          }
+          // Set next level of indentation.
+          state.tlvNextIndent = indented;
+        }
+
+        if (state.tlvCodeActive) {
+          // Highlight as TLV.
+
+          var beginStatement = false;
+          if (tlvTrackStatements) {
+            // This starts a statement if the position is at the scope level
+            // and we're not within a statement leading comment.
+            beginStatement =
+                   (stream.peek() != " ") &&   // not a space
+                   (style === undefined) &&    // not a region identifier
+                   !state.tlvInBlockComment && // not in block comment
+                   //!stream.match(tlvCommentMatch, false) && // not comment start
+                   (stream.column() == state.tlvIndentationStyle.length * tlvIndentUnit);  // at scope level
+            if (beginStatement) {
+              if (state.statementComment) {
+                // statement already started by comment
+                beginStatement = false;
+              }
+              state.statementComment =
+                   stream.match(tlvCommentMatch, false); // comment start
+            }
+          }
+
+          var match;
+          if (style !== undefined) {
+            // Region line.
+            style += " " + tlvScopeStyle(state, 0, "scope-ident")
+          } else if (((stream.pos / tlvIndentUnit) < state.tlvIndentationStyle.length) &&
+                     (match = stream.match(stream.sol() ? tlvFirstLevelIndentMatch : /^   /))) {
+            // Indentation
+            style = // make this style distinct from the previous one to prevent
+                    // codemirror from combining spans
+                    "tlv-indent-" + (((stream.pos % 2) == 0) ? "even" : "odd") +
+                    // and style it
+                    " " + tlvScopeStyle(state, stream.pos - tlvIndentUnit, "indent");
+            // Style the line prefix character.
+            if (match[0].charAt(0) == "!") {
+              style += " tlv-alert-line-prefix";
+            }
+            // Place a class before a scope identifier.
+            if (tlvIdentNext(stream)) {
+              style += " " + tlvScopeStyle(state, stream.pos, "before-scope-ident");
+            }
+          } else if (state.tlvInBlockComment) {
+            // In a block comment.
+            if (stream.match(/^.*?\*\//)) {
+              // Exit block comment.
+              state.tlvInBlockComment = false;
+              if (tlvTrackStatements && !stream.eol()) {
+                // Anything after comment is assumed to be real statement content.
+                state.statementComment = false;
+              }
+            } else {
+              stream.skipToEnd();
+            }
+            style = "comment";
+          } else if ((match = stream.match(tlvCommentMatch)) && !state.tlvInBlockComment) {
+            // Start comment.
+            if (match[0] == "//") {
+              // Line comment.
+              stream.skipToEnd();
+            } else {
+              // Block comment.
+              state.tlvInBlockComment = true;
+            }
+            style = "comment";
+          } else if (match = stream.match(tlvIdentMatch)) {
+            // looks like an identifier (or identifier prefix)
+            var prefix = match[1];
+            var mnemonic = match[2];
+            if (// is identifier prefix
+                tlvIdentifierStyle.hasOwnProperty(prefix) &&
+                // has mnemonic or we're at the end of the line (maybe it hasn't been typed yet)
+                (mnemonic.length > 0 || stream.eol())) {
+              style = tlvIdentifierStyle[prefix];
+              if (stream.column() == state.indented) {
+                // Begin scope.
+                style += " " + tlvScopeStyle(state, stream.column(), "scope-ident")
+              }
+            } else {
+              // Just swallow one character and try again.
+              // This enables subsequent identifier match with preceding symbol character, which
+              //   is legal within a statement.  (E.g., !$reset).  It also enables detection of
+              //   comment start with preceding symbols.
+              stream.backUp(stream.current().length - 1);
+              style = "tlv-default";
+            }
+          } else if (stream.match(/^\t+/)) {
+            // Highlight tabs, which are illegal.
+            style = "tlv-tab";
+          } else if (stream.match(/^[\[\]{}\(\);\:]+/)) {
+            // [:], (), {}, ;.
+            style = "meta";
+          } else if (match = stream.match(/^[mM]4([\+_])?[\w\d_]*/)) {
+            // m4 pre proc
+            style = (match[1] == "+") ? "tlv-m4-plus" : "tlv-m4";
+          } else if (stream.match(/^ +/)){
+            // Skip over spaces.
+            if (stream.eol()) {
+              // Trailing spaces.
+              style = "error";
+            } else {
+              // Non-trailing spaces.
+              style = "tlv-default";
+            }
+          } else if (stream.match(/^[\w\d_]+/)) {
+            // alpha-numeric token.
+            style = "number";
+          } else {
+            // Eat the next char w/ no formatting.
+            stream.next();
+            style = "tlv-default";
+          }
+          if (beginStatement) {
+            style += " tlv-statement";
+          }
+        } else {
+          if (stream.match(/^[mM]4([\w\d_]*)/)) {
+            // m4 pre proc
+            style = "tlv-m4";
+          }
+        }
+        return style;
+      },
+
+      indent: function(state) {
+        return (state.tlvCodeActive == true) ? state.tlvNextIndent : -1;
+      },
+
+      startState: function(state) {
+        state.tlvIndentationStyle = [];  // Styles to use for each level of indentation.
+        state.tlvCodeActive = true;  // True when we're in a TLV region (and at beginning of file).
+        state.tlvNextIndent = -1;    // The number of spaces to autoindent the next line if tlvCodeActive.
+        state.tlvInBlockComment = false;  // True inside /**/ comment.
+        if (tlvTrackStatements) {
+          state.statementComment = false;  // True inside a statement's header comment.
+        }
+      }
+
+    }
+  });
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vhdl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+<!doctype html>
+
+<title>CodeMirror: VHDL mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="vhdl.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">VHDL</a>
+  </ul>
+</div>
+
+<article>
+<h2>VHDL mode</h2>
+
+<div><textarea id="code" name="code">
+LIBRARY ieee;
+USE ieee.std_logic_1164.ALL;
+USE ieee.numeric_std.ALL;
+
+ENTITY tb IS
+END tb;
+
+ARCHITECTURE behavior OF tb IS
+   --Inputs
+   signal a : unsigned(2 downto 0) := (others => '0');
+   signal b : unsigned(2 downto 0) := (others => '0');
+    --Outputs
+   signal a_eq_b : std_logic;
+   signal a_le_b : std_logic;
+   signal a_gt_b : std_logic;
+
+    signal i,j : integer;
+
+BEGIN
+
+    -- Instantiate the Unit Under Test (UUT)
+   uut: entity work.comparator PORT MAP (
+          a => a,
+          b => b,
+          a_eq_b => a_eq_b,
+          a_le_b => a_le_b,
+          a_gt_b => a_gt_b
+        );
+
+   -- Stimulus process
+   stim_proc: process
+   begin
+        for i in 0 to 8 loop
+            for j in 0 to 8 loop
+                a <= to_unsigned(i,3); --integer to unsigned type conversion
+                b <= to_unsigned(j,3);
+                wait for 10 ns;
+            end loop;
+        end loop;
+   end process;
+
+END;
+</textarea></div>
+
+<script>
+  var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+    lineNumbers: true,
+    matchBrackets: true,
+    mode: {
+      name: "vhdl",
+    }
+  });
+</script>
+
+<p>
+Syntax highlighting and indentation for the VHDL language.
+<h2>Configuration options:</h2>
+  <ul>
+    <li><strong>atoms</strong> - List of atom words. Default: "null"</li>
+    <li><strong>hooks</strong> - List of meta hooks. Default: ["`", "$"]</li>
+    <li><strong>multiLineStrings</strong> - Whether multi-line strings are accepted. Default: false</li>
+  </ul>
+</p>
+
+<p><strong>MIME types defined:</strong> <code>text/x-vhdl</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vhdl/vhdl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,189 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Originally written by Alf Nielsen, re-written by Michael Zhou
+(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";
+
+function words(str) {
+  var obj = {}, words = str.split(",");
+  for (var i = 0; i < words.length; ++i) {
+    var allCaps = words[i].toUpperCase();
+    var firstCap = words[i].charAt(0).toUpperCase() + words[i].slice(1);
+    obj[words[i]] = true;
+    obj[allCaps] = true;
+    obj[firstCap] = true;
+  }
+  return obj;
+}
+
+function metaHook(stream) {
+  stream.eatWhile(/[\w\$_]/);
+  return "meta";
+}
+
+CodeMirror.defineMode("vhdl", function(config, parserConfig) {
+  var indentUnit = config.indentUnit,
+      atoms = parserConfig.atoms || words("null"),
+      hooks = parserConfig.hooks || {"`": metaHook, "$": metaHook},
+      multiLineStrings = parserConfig.multiLineStrings;
+
+  var keywords = words("abs,access,after,alias,all,and,architecture,array,assert,attribute,begin,block," +
+      "body,buffer,bus,case,component,configuration,constant,disconnect,downto,else,elsif,end,end block,end case," +
+      "end component,end for,end generate,end if,end loop,end process,end record,end units,entity,exit,file,for," +
+      "function,generate,generic,generic map,group,guarded,if,impure,in,inertial,inout,is,label,library,linkage," +
+      "literal,loop,map,mod,nand,new,next,nor,null,of,on,open,or,others,out,package,package body,port,port map," +
+      "postponed,procedure,process,pure,range,record,register,reject,rem,report,return,rol,ror,select,severity,signal," +
+      "sla,sll,sra,srl,subtype,then,to,transport,type,unaffected,units,until,use,variable,wait,when,while,with,xnor,xor");
+
+  var blockKeywords = words("architecture,entity,begin,case,port,else,elsif,end,for,function,if");
+
+  var isOperatorChar = /[&|~><!\)\(*#%@+\/=?\:;}{,\.\^\-\[\]]/;
+  var curPunc;
+
+  function tokenBase(stream, state) {
+    var ch = stream.next();
+    if (hooks[ch]) {
+      var result = hooks[ch](stream, state);
+      if (result !== false) return result;
+    }
+    if (ch == '"') {
+      state.tokenize = tokenString2(ch);
+      return state.tokenize(stream, state);
+    }
+    if (ch == "'") {
+      state.tokenize = tokenString(ch);
+      return state.tokenize(stream, state);
+    }
+    if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
+      curPunc = ch;
+      return null;
+    }
+    if (/[\d']/.test(ch)) {
+      stream.eatWhile(/[\w\.']/);
+      return "number";
+    }
+    if (ch == "-") {
+      if (stream.eat("-")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+    if (isOperatorChar.test(ch)) {
+      stream.eatWhile(isOperatorChar);
+      return "operator";
+    }
+    stream.eatWhile(/[\w\$_]/);
+    var cur = stream.current();
+    if (keywords.propertyIsEnumerable(cur.toLowerCase())) {
+      if (blockKeywords.propertyIsEnumerable(cur)) curPunc = "newstatement";
+      return "keyword";
+    }
+    if (atoms.propertyIsEnumerable(cur)) return "atom";
+    return "variable";
+  }
+
+  function tokenString(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "--";
+      }
+      if (end || !(escaped || multiLineStrings))
+        state.tokenize = tokenBase;
+      return "string";
+    };
+  }
+  function tokenString2(quote) {
+    return function(stream, state) {
+      var escaped = false, next, end = false;
+      while ((next = stream.next()) != null) {
+        if (next == quote && !escaped) {end = true; break;}
+        escaped = !escaped && next == "--";
+      }
+      if (end || !(escaped || multiLineStrings))
+        state.tokenize = tokenBase;
+      return "string-2";
+    };
+  }
+
+  function Context(indented, column, type, align, prev) {
+    this.indented = indented;
+    this.column = column;
+    this.type = type;
+    this.align = align;
+    this.prev = prev;
+  }
+  function pushContext(state, col, type) {
+    return state.context = new Context(state.indented, col, type, null, state.context);
+  }
+  function popContext(state) {
+    var t = state.context.type;
+    if (t == ")" || t == "]" || t == "}")
+      state.indented = state.context.indented;
+    return state.context = state.context.prev;
+  }
+
+  // Interface
+  return {
+    startState: function(basecolumn) {
+      return {
+        tokenize: null,
+        context: new Context((basecolumn || 0) - indentUnit, 0, "top", false),
+        indented: 0,
+        startOfLine: true
+      };
+    },
+
+    token: function(stream, state) {
+      var ctx = state.context;
+      if (stream.sol()) {
+        if (ctx.align == null) ctx.align = false;
+        state.indented = stream.indentation();
+        state.startOfLine = true;
+      }
+      if (stream.eatSpace()) return null;
+      curPunc = null;
+      var style = (state.tokenize || tokenBase)(stream, state);
+      if (style == "comment" || style == "meta") return style;
+      if (ctx.align == null) ctx.align = true;
+
+      if ((curPunc == ";" || curPunc == ":") && ctx.type == "statement") popContext(state);
+      else if (curPunc == "{") pushContext(state, stream.column(), "}");
+      else if (curPunc == "[") pushContext(state, stream.column(), "]");
+      else if (curPunc == "(") pushContext(state, stream.column(), ")");
+      else if (curPunc == "}") {
+        while (ctx.type == "statement") ctx = popContext(state);
+        if (ctx.type == "}") ctx = popContext(state);
+        while (ctx.type == "statement") ctx = popContext(state);
+      }
+      else if (curPunc == ctx.type) popContext(state);
+      else if (ctx.type == "}" || ctx.type == "top" || (ctx.type == "statement" && curPunc == "newstatement"))
+        pushContext(state, stream.column(), "statement");
+      state.startOfLine = false;
+      return style;
+    },
+
+    indent: function(state, textAfter) {
+      if (state.tokenize != tokenBase && state.tokenize != null) return 0;
+      var firstChar = textAfter && textAfter.charAt(0), ctx = state.context, closing = firstChar == ctx.type;
+      if (ctx.type == "statement") return ctx.indented + (firstChar == "{" ? 0 : indentUnit);
+      else if (ctx.align) return ctx.column + (closing ? 0 : 1);
+      else return ctx.indented + (closing ? 0 : indentUnit);
+    },
+
+    electricChars: "{}"
+  };
+});
+
+CodeMirror.defineMIME("text/x-vhdl", "vhdl");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vue/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,69 @@
+<!doctype html>
+
+<title>CodeMirror: Vue.js mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="../../addon/selection/selection-pointer.js"></script>
+<script src="../xml/xml.js"></script>
+<script src="../javascript/javascript.js"></script>
+<script src="../css/css.js"></script>
+<script src="../coffeescript/coffeescript.js"></script>
+<script src="../sass/sass.js"></script>
+<script src="../pug/pug.js"></script>
+
+<script src="../handlebars/handlebars.js"></script>
+<script src="../htmlmixed/htmlmixed.js"></script>
+<script src="vue.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Vue.js mode</a>
+  </ul>
+</div>
+
+<article>
+<h2>Vue.js mode</h2>
+<form><textarea id="code" name="code">
+<template>
+  <div class="sass">I'm a {{mustache-like}} template</div>
+</template>
+
+<script lang="coffee">
+  module.exports =
+    props: ['one', 'two', 'three']
+</script>
+
+<style lang="sass">
+.sass
+  font-size: 18px
+</style>
+
+</textarea></form>
+    <script>
+      // Define an extended mixed-mode that understands vbscript and
+      // leaves mustache/handlebars embedded templates in html mode
+      var mixedMode = {
+        name: "vue"
+      };
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: mixedMode,
+        selectionPointer: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-vue</code></p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/vue/vue.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,77 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function (mod) {
+  "use strict";
+  if (typeof exports === "object" && typeof module === "object") {// CommonJS
+    mod(require("../../lib/codemirror"),
+        require("../../addon/mode/overlay"),
+        require("../xml/xml"),
+        require("../javascript/javascript"),
+        require("../coffeescript/coffeescript"),
+        require("../css/css"),
+        require("../sass/sass"),
+        require("../stylus/stylus"),
+        require("../pug/pug"),
+        require("../handlebars/handlebars"));
+  } else if (typeof define === "function" && define.amd) { // AMD
+    define(["../../lib/codemirror",
+            "../../addon/mode/overlay",
+            "../xml/xml",
+            "../javascript/javascript",
+            "../coffeescript/coffeescript",
+            "../css/css",
+            "../sass/sass",
+            "../stylus/stylus",
+            "../pug/pug",
+            "../handlebars/handlebars"], mod);
+  } else { // Plain browser env
+    mod(CodeMirror);
+  }
+})(function (CodeMirror) {
+  var tagLanguages = {
+    script: [
+      ["lang", /coffee(script)?/, "coffeescript"],
+      ["type", /^(?:text|application)\/(?:x-)?coffee(?:script)?$/, "coffeescript"],
+      ["lang", /^babel$/, "javascript"],
+      ["type", /^text\/babel$/, "javascript"],
+      ["type", /^text\/ecmascript-\d+$/, "javascript"]
+    ],
+    style: [
+      ["lang", /^stylus$/i, "stylus"],
+      ["lang", /^sass$/i, "sass"],
+      ["lang", /^less$/i, "text/x-less"],
+      ["lang", /^scss$/i, "text/x-scss"],
+      ["type", /^(text\/)?(x-)?styl(us)?$/i, "stylus"],
+      ["type", /^text\/sass/i, "sass"],
+      ["type", /^(text\/)?(x-)?scss$/i, "text/x-scss"],
+      ["type", /^(text\/)?(x-)?less$/i, "text/x-less"]
+    ],
+    template: [
+      ["lang", /^vue-template$/i, "vue"],
+      ["lang", /^pug$/i, "pug"],
+      ["lang", /^handlebars$/i, "handlebars"],
+      ["type", /^(text\/)?(x-)?pug$/i, "pug"],
+      ["type", /^text\/x-handlebars-template$/i, "handlebars"],
+      [null, null, "vue-template"]
+    ]
+  };
+
+  CodeMirror.defineMode("vue-template", function (config, parserConfig) {
+    var mustacheOverlay = {
+      token: function (stream) {
+        if (stream.match(/^\{\{.*?\}\}/)) return "meta mustache";
+        while (stream.next() && !stream.match("{{", false)) {}
+        return null;
+      }
+    };
+    return CodeMirror.overlayMode(CodeMirror.getMode(config, parserConfig.backdrop || "text/html"), mustacheOverlay);
+  });
+
+  CodeMirror.defineMode("vue", function (config) {
+    return CodeMirror.getMode(config, {name: "htmlmixed", tags: tagLanguages});
+  }, "htmlmixed", "xml", "javascript", "coffeescript", "css", "sass", "stylus", "pug", "handlebars");
+
+  CodeMirror.defineMIME("script/x-vue", "vue");
+  CodeMirror.defineMIME("text/x-vue", "vue");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/wast/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,73 @@
+<!DOCTYPE html>
+
+<title>CodeMirror: WebAssembly mode</title>
+<meta charset="utf-8" />
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/simple.js"></script>
+<script src="wast.js"></script>
+<style>
+  .CodeMirror {
+    border-top: 1px solid black;
+    border-bottom: 1px solid black;
+  }
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5">
+    <h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt="">
+  </a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">WebAssembly</a>
+  </ul>
+</div>
+
+<article>
+  <h2>WebAssembly mode</h2>
+
+
+  <div><textarea id="code" name="code">
+/* Example WebAssembly */
+(module $foo
+ (export "fac" (func $fac))
+ (export "plus" (func $plus))
+
+ (func $fac (type $t0) (param $p0 i64) (result i64)
+    (if $I0 (result i64)
+      (i64.lt_s
+        (local.get $p0)
+        (i64.const 1))
+      (then
+        (i64.const 1))
+      (else
+        (i64.mul
+          (local.get $p0)
+          (call $fac
+            (i64.sub
+              (local.get $p0)
+              (i64.const 1)))))))
+
+ (func $plus (param $x i32) (param $y i32) (result i32)
+  (i32.add
+   (local.get $x)
+   (local.get $y))))</textarea></div>
+
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      lineNumbers: true,
+      lineWrapping: true,
+      indentUnit: 4,
+      mode: "wast"
+    });
+  </script>
+
+  <p><strong>MIME types defined:</strong> <code>text/webassembly</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/wast/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,424 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 4}, "wast");
+  function MT(name) {test.mode(name, mode, Array.prototype.slice.call(arguments, 1));}
+
+  MT('number-test',
+     '[number 0]',
+     '[number 123]',
+     '[number nan]',
+     '[number inf]',
+     '[number infinity]',
+     '[number 0.1]',
+     '[number 123.0]',
+     '[number 12E+99]');
+
+  MT('string-literals-test',
+     '[string "foo"]',
+     '[string "\\"foo\\""]',
+     '[string "foo #\\"# bar"]');
+
+  MT('atom-test',
+     '[atom funcref]',
+     '[atom externref]',
+     '[atom i32]',
+     '[atom i64]',
+     '[atom f32]',
+     '[atom f64]');
+
+  MT('keyword-test',
+     '[keyword br]',
+     '[keyword if]',
+     '[keyword loop]',
+     '[keyword i32.add]',
+     '[keyword local.get]');
+
+  MT('control-instructions',
+     '[keyword unreachable]',
+     '[keyword nop]',
+     '[keyword br] [variable-2 $label0]',
+     '[keyword br_if] [variable-2 $label0]',
+     '[keyword br_table] [variable-2 $label0] [variable-2 $label1] [variable-2 $label3]',
+     '[keyword return]',
+     '[keyword call] [variable-2 $func0]',
+     '[keyword call_indirect] [variable-2 $table] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])',
+     '[keyword return_call] [variable-2 $func0]',
+     '[keyword return_call_indirect] ([keyword param] [atom f32] [atom f64]) ([keyword result] [atom i32] [atom i64])',
+     '[keyword select] ([keyword local.get] [number 1]) ([keyword local.get] [number 2]) ([keyword local.get] [number 3])',
+     '[keyword try] ([keyword result] [atom i32])',
+     '[keyword throw] [number 0]',
+     '[keyword rethrow] [number 0]',
+     '[keyword catch] [number 0]',
+     '[keyword catch_all]',
+     '[keyword delegate] [number 0]',
+     '[keyword unwind]');
+
+
+  MT('memory-instructions',
+     '[keyword i32.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.load8_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.load8_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.load16_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.load16_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.store] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.store8] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i32.store16] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.store] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load8_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load8_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load16_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load16_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load32_s] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.load32_u] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.store8] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.store16] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword i64.store32] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword f32.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword f32.store] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword f64.load] [keyword offset]=[number 4] [keyword align]=[number 4]',
+     '[keyword f64.store] [keyword offset]=[number 4] [keyword align]=[number 4]');
+
+  MT('atomic-memory-instructions',
+     '[keyword memory.atomic.notify] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword memory.atomic.wait32] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword memory.atomic.wait64] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.load] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.load8_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.load16_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.store] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.store8] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.store16] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.load] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.load8_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.load16_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.load32_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.store] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.store8] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.store16] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.store32] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.add] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.add] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.add_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.sub] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.sub] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.sub_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.and] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.and] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.and_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.or] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.or] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.or_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.xor] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.xor] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.xor_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.xchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.xchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.xchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw.cmpxchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw8.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i32.atomic.rmw16.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw.cmpxchg] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw8.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw16.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword i64.atomic.rmw32.cmpxchg_u] [keyword offset]=[number 32] [keyword align]=[number 4]');
+
+  MT('simd-instructions',
+     '[keyword v128.load] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword v128.load8x8_s] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load8x8_u] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load16x4_s] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load16x4_u] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load32x2_s] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load32x2_u] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load8_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load16_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load32_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load64_splat] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.store] [keyword offset]=[number 32] [keyword align]=[number 4]',
+     '[keyword v128.const] [number 0] [number 1] [number 2] [number 3] [number 4] [number 5] [number 6] [number 7] [number 8] [number 9] [number 10] [number 11] [number 12] [number 13] [number 14] [number 15]',
+     '[keyword i8x16.shuffle] [number 0] [number 1] [number 2] [number 3] [number 4] [number 5] [number 6] [number 7] [number 8] [number 9] [number 10] [number 11] [number 12] [number 13] [number 14] [number 15]',
+     '[keyword i8x16.swizzle]',
+     '[keyword i8x16.splat]',
+     '[keyword i16x8.splat]',
+     '[keyword i32x4.splat]',
+     '[keyword i64x2.splat]',
+     '[keyword f32x4.splat]',
+     '[keyword f64x2.splat]',
+     '[keyword i8x16.extract_lane_s] [number 1]',
+     '[keyword i8x16.extract_lane_u] [number 1]',
+     '[keyword i8x16.replace_lane] [number 1]',
+     '[keyword i16x8.extract_lane_s] [number 1]',
+     '[keyword i16x8.extract_lane_u] [number 1]',
+     '[keyword i16x8.replace_lane] [number 1]',
+     '[keyword i32x4.extract_lane] [number 1]',
+     '[keyword i32x4.replace_lane] [number 1]',
+     '[keyword i64x2.extract_lane] [number 1]',
+     '[keyword i64x2.replace_lane] [number 1]',
+     '[keyword f32x4.extract_lane] [number 1]',
+     '[keyword f32x4.replace_lane] [number 1]',
+     '[keyword f64x2.extract_lane] [number 1]',
+     '[keyword f64x2.replace_lane] [number 1]',
+     '[keyword i8x16.eq]',
+     '[keyword i8x16.ne]',
+     '[keyword i8x16.lt_s]',
+     '[keyword i8x16.lt_u]',
+     '[keyword i8x16.gt_s]',
+     '[keyword i8x16.gt_u]',
+     '[keyword i8x16.le_s]',
+     '[keyword i8x16.le_u]',
+     '[keyword i8x16.ge_s]',
+     '[keyword i8x16.ge_u]',
+     '[keyword i16x8.eq]',
+     '[keyword i16x8.ne]',
+     '[keyword i16x8.lt_s]',
+     '[keyword i16x8.lt_u]',
+     '[keyword i16x8.gt_s]',
+     '[keyword i16x8.gt_u]',
+     '[keyword i16x8.le_s]',
+     '[keyword i16x8.le_u]',
+     '[keyword i16x8.ge_s]',
+     '[keyword i16x8.ge_u]',
+     '[keyword i32x4.eq]',
+     '[keyword i32x4.ne]',
+     '[keyword i32x4.lt_s]',
+     '[keyword i32x4.lt_u]',
+     '[keyword i32x4.gt_s]',
+     '[keyword i32x4.gt_u]',
+     '[keyword i32x4.le_s]',
+     '[keyword i32x4.le_u]',
+     '[keyword i32x4.ge_s]',
+     '[keyword i32x4.ge_u]',
+     '[keyword f32x4.eq]',
+     '[keyword f32x4.ne]',
+     '[keyword f32x4.lt]',
+     '[keyword f32x4.gt]',
+     '[keyword f32x4.le]',
+     '[keyword f32x4.ge]',
+     '[keyword f64x2.eq]',
+     '[keyword f64x2.ne]',
+     '[keyword f64x2.lt]',
+     '[keyword f64x2.gt]',
+     '[keyword f64x2.le]',
+     '[keyword f64x2.ge]',
+     '[keyword v128.not]',
+     '[keyword v128.and]',
+     '[keyword v128.andnot]',
+     '[keyword v128.or]',
+     '[keyword v128.xor]',
+     '[keyword v128.bitselect]',
+     '[keyword v128.any_true]',
+     '[keyword v128.load8_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.load16_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.load32_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.load64_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.store8_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.store16_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.store32_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.store64_lane] [keyword offset]=[number 64] [keyword align]=[number 0] [number 1]',
+     '[keyword v128.load32_zero] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword v128.load64_zero] [keyword offset]=[number 64] [keyword align]=[number 0]',
+     '[keyword f32x4.demote_f64x2_zero]',
+     '[keyword f64x2.promote_low_f32x4]',
+     '[keyword i8x16.abs]',
+     '[keyword i8x16.neg]',
+     '[keyword i8x16.popcnt]',
+     '[keyword i8x16.all_true]',
+     '[keyword i8x16.bitmask]',
+     '[keyword i8x16.narrow_i16x8_s]',
+     '[keyword i8x16.narrow_i16x8_u]',
+     '[keyword f32x4.ceil]',
+     '[keyword f32x4.floor]',
+     '[keyword f32x4.trunc]',
+     '[keyword f32x4.nearest]',
+     '[keyword i8x16.shl]',
+     '[keyword i8x16.shr_s]',
+     '[keyword i8x16.shr_u]',
+     '[keyword i8x16.add]',
+     '[keyword i8x16.add_sat_s]',
+     '[keyword i8x16.add_sat_u]',
+     '[keyword i8x16.sub]',
+     '[keyword i8x16.sub_sat_s]',
+     '[keyword i8x16.sub_sat_u]',
+     '[keyword f64x2.ceil]',
+     '[keyword f64x2.floor]',
+     '[keyword i8x16.min_s]',
+     '[keyword i8x16.min_u]',
+     '[keyword i8x16.max_s]',
+     '[keyword i8x16.max_u]',
+     '[keyword f64x2.trunc]',
+     '[keyword i8x16.avgr_u]',
+     '[keyword i16x8.extadd_pairwise_i8x16_s]',
+     '[keyword i16x8.extadd_pairwise_i8x16_u]',
+     '[keyword i32x4.extadd_pairwise_i16x8_s]',
+     '[keyword i32x4.extadd_pairwise_i16x8_u]',
+     '[keyword i16x8.abs]',
+     '[keyword i16x8.neg]',
+     '[keyword i16x8.q15mulr_sat_s]',
+     '[keyword i16x8.all_true]',
+     '[keyword i16x8.bitmask]',
+     '[keyword i16x8.narrow_i32x4_s]',
+     '[keyword i16x8.narrow_i32x4_u]',
+     '[keyword i16x8.extend_low_i8x16_s]',
+     '[keyword i16x8.extend_high_i8x16_s]',
+     '[keyword i16x8.extend_low_i8x16_u]',
+     '[keyword i16x8.extend_high_i8x16_u]',
+     '[keyword i16x8.shl]',
+     '[keyword i16x8.shr_s]',
+     '[keyword i16x8.shr_u]',
+     '[keyword i16x8.add]',
+     '[keyword i16x8.add_sat_s]',
+     '[keyword i16x8.add_sat_u]',
+     '[keyword i16x8.sub]',
+     '[keyword i16x8.sub_sat_s]',
+     '[keyword i16x8.sub_sat_u]',
+     '[keyword f64x2.nearest]',
+     '[keyword i16x8.mul]',
+     '[keyword i16x8.min_s]',
+     '[keyword i16x8.min_u]',
+     '[keyword i16x8.max_s]',
+     '[keyword i16x8.max_u]',
+     '[keyword i16x8.avgr_u]',
+     '[keyword i16x8.extmul_low_i8x16_s]',
+     '[keyword i16x8.extmul_high_i8x16_s]',
+     '[keyword i16x8.extmul_low_i8x16_u]',
+     '[keyword i16x8.extmul_high_i8x16_u]',
+     '[keyword i32x4.abs]',
+     '[keyword i32x4.neg]',
+     '[keyword i32x4.all_true]',
+     '[keyword i32x4.bitmask]',
+     '[keyword i32x4.extend_low_i16x8_s]',
+     '[keyword i32x4.extend_high_i16x8_s]',
+     '[keyword i32x4.extend_low_i16x8_u]',
+     '[keyword i32x4.extend_high_i16x8_u]',
+     '[keyword i32x4.shl]',
+     '[keyword i32x4.shr_s]',
+     '[keyword i32x4.shr_u]',
+     '[keyword i32x4.add]',
+     '[keyword i32x4.sub]',
+     '[keyword i32x4.mul]',
+     '[keyword i32x4.min_s]',
+     '[keyword i32x4.min_u]',
+     '[keyword i32x4.max_s]',
+     '[keyword i32x4.max_u]',
+     '[keyword i32x4.dot_i16x8_s]',
+     '[keyword i32x4.extmul_low_i16x8_s]',
+     '[keyword i32x4.extmul_high_i16x8_s]',
+     '[keyword i32x4.extmul_low_i16x8_u]',
+     '[keyword i32x4.extmul_high_i16x8_u]',
+     '[keyword i64x2.abs]',
+     '[keyword i64x2.neg]',
+     '[keyword i64x2.all_true]',
+     '[keyword i64x2.bitmask]',
+     '[keyword i64x2.extend_low_i32x4_s]',
+     '[keyword i64x2.extend_high_i32x4_s]',
+     '[keyword i64x2.extend_low_i32x4_u]',
+     '[keyword i64x2.extend_high_i32x4_u]',
+     '[keyword i64x2.shl]',
+     '[keyword i64x2.shr_s]',
+     '[keyword i64x2.shr_u]',
+     '[keyword i64x2.add]',
+     '[keyword i64x2.sub]',
+     '[keyword i64x2.mul]',
+     '[keyword i64x2.eq]',
+     '[keyword i64x2.ne]',
+     '[keyword i64x2.lt_s]',
+     '[keyword i64x2.gt_s]',
+     '[keyword i64x2.le_s]',
+     '[keyword i64x2.ge_s]',
+     '[keyword i64x2.extmul_low_i32x4_s]',
+     '[keyword i64x2.extmul_high_i32x4_s]',
+     '[keyword i64x2.extmul_low_i32x4_u]',
+     '[keyword i64x2.extmul_high_i32x4_u]',
+     '[keyword f32x4.abs]',
+     '[keyword f32x4.neg]',
+     '[keyword f32x4.sqrt]',
+     '[keyword f32x4.add]',
+     '[keyword f32x4.sub]',
+     '[keyword f32x4.mul]',
+     '[keyword f32x4.div]',
+     '[keyword f32x4.min]',
+     '[keyword f32x4.max]',
+     '[keyword f64x2.abs]',
+     '[keyword f64x2.neg]',
+     '[keyword f64x2.sqrt]',
+     '[keyword f64x2.add]',
+     '[keyword f64x2.sub]',
+     '[keyword f64x2.mul]',
+     '[keyword f64x2.div]',
+     '[keyword f64x2.min]',
+     '[keyword f64x2.max]',
+     '[keyword i32x4.trunc_sat_f32x4_s]',
+     '[keyword i32x4.trunc_sat_f32x4_u]',
+     '[keyword f32x4.convert_i32x4_s]',
+     '[keyword f32x4.convert_i32x4_u]',
+     '[keyword i32x4.trunc_sat_f64x2_s_zero]',
+     '[keyword i32x4.trunc_sat_f64x2_u_zero]',
+     '[keyword f64x2.convert_low_i32x4_s]',
+     '[keyword f64x2.convert_low_i32x4_u]');
+
+     MT('reference-type-instructions',
+     '[keyword ref.null] [keyword extern]',
+     '[keyword ref.null] [keyword func]',
+     '[keyword ref.is_null] ([keyword ref.func] [variable-2 $f])',
+     '[keyword ref.func] [variable-2 $f]');
+
+     MT('table-instructions',
+     '[keyword table.get] [variable-2 $t] ([keyword i32.const] [number 5])',
+     '[keyword table.set] [variable-2 $t] ([keyword i32.const] [number 5]) ([keyword ref.func] [variable-2 $f])',
+     '[keyword table.size] [variable-2 $t]',
+     '[keyword table.grow] [variable-2 $t] ([keyword ref.null] [keyword extern]) ([keyword i32.const] [number 5])',
+     '[keyword table.fill] [variable-2 $t] ([keyword i32.const] [number 5]) ([keyword param] [variable-2 $r] [atom externref]) ([keyword i32.const] [number 5])',
+     '[keyword table.init] [variable-2 $t] [number 1] ([keyword i32.const] [number 5]) ([keyword i32.const] [number 10]) ([keyword i32.const] [number 15])',
+     '[keyword table.copy] [variable-2 $t] [variable-2 $t2] ([keyword i32.const] [number 5]) ([keyword i32.const] [number 10]) ([keyword i32.const] [number 15])'
+     );
+     MT('gc-proposal',
+     '[keyword call_ref] [keyword return_call_ref]',
+     '[keyword ref.as_non_null] [keyword br_on_null] [keyword ref.eq]');
+     MT('gc-proposal-structs',
+     '[keyword struct.new_with_rtt] [keyword struct.new_default_with_rtt]',
+     '[keyword struct.get] [keyword struct.get_s] [keyword struct.get_u]',
+     '[keyword struct.set]');
+     MT('gc-proposal-arrays',
+     '[keyword array.new_with_rtt] [keyword array.new_default_with_rtt]',
+     '[keyword array.get] [keyword array.get_s] [keyword array.get_u]',
+     '[keyword array.len] [keyword array.set]');
+     MT('gc-proposal-i31',
+     '[keyword i31.new] [keyword i31.get_s] [keyword i31.get_u]');
+     MT('gc-proposal-rtt',
+     '[keyword rtt.canon] [keyword rtt.sub]');
+     MT('gc-proposal-typechecks',
+     '[keyword ref.test] [keyword ref.cast] [keyword br_on_cast]',
+     '[keyword ref.is_func] [keyword ref.is_data] [keyword ref.is_i31]',
+     '[keyword ref.as_func] [keyword ref.as_data] [keyword ref.as_i31]',
+     '[keyword br_on_func] [keyword br_on_data] [keyword br_on_i31]');
+     MT('gc-proposal-types',
+     '[atom i8] [atom i16]',
+     '[atom anyref] [atom dataref] [atom eqref] [atom i31ref]');
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/wast/wast.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,132 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function(mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../../addon/mode/simple"));
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../../addon/mode/simple"], mod);
+  else // Plain browser env
+    mod(CodeMirror);
+})(function(CodeMirror) {
+"use strict";
+
+var kKeywords = [
+    "align",
+    "block",
+    "br(_if|_table|_on_(cast|data|func|i31|null))?",
+    "call(_indirect|_ref)?",
+    "current_memory",
+    "\\bdata\\b",
+    "catch(_all)?",
+    "delegate",
+    "drop",
+    "elem",
+    "else",
+    "end",
+    "export",
+    "\\bextern\\b",
+    "\\bfunc\\b",
+    "global(\\.(get|set))?",
+    "if",
+    "import",
+    "local(\\.(get|set|tee))?",
+    "loop",
+    "module",
+    "mut",
+    "nop",
+    "offset",
+    "param",
+    "result",
+    "rethrow",
+    "return(_call(_indirect|_ref)?)?",
+    "select",
+    "start",
+    "table(\\.(size|get|set|size|grow|fill|init|copy))?",
+    "then",
+    "throw",
+    "try",
+    "type",
+    "unreachable",
+    "unwind",
+
+    // Numeric opcodes.
+    "i(32|64)\\.(store(8|16)|(load(8|16)_[su]))",
+    "i64\\.(load32_[su]|store32)",
+    "[fi](32|64)\\.(const|load|store)",
+    "f(32|64)\\.(abs|add|ceil|copysign|div|eq|floor|[gl][et]|max|min|mul|nearest|neg?|sqrt|sub|trunc)",
+    "i(32|64)\\.(a[dn]d|c[lt]z|(div|rem)_[su]|eqz?|[gl][te]_[su]|mul|ne|popcnt|rot[lr]|sh(l|r_[su])|sub|x?or)",
+    "i64\\.extend_[su]_i32",
+    "i32\\.wrap_i64",
+    "i(32|64)\\.trunc_f(32|64)_[su]",
+    "f(32|64)\\.convert_i(32|64)_[su]",
+    "f64\\.promote_f32",
+    "f32\\.demote_f64",
+    "f32\\.reinterpret_i32",
+    "i32\\.reinterpret_f32",
+    "f64\\.reinterpret_i64",
+    "i64\\.reinterpret_f64",
+    // Atomics.
+    "memory(\\.((atomic\\.(notify|wait(32|64)))|grow|size))?",
+    "i64\.atomic\\.(load32_u|store32|rmw32\\.(a[dn]d|sub|x?or|(cmp)?xchg)_u)",
+    "i(32|64)\\.atomic\\.(load((8|16)_u)?|store(8|16)?|rmw(\\.(a[dn]d|sub|x?or|(cmp)?xchg)|(8|16)\\.(a[dn]d|sub|x?or|(cmp)?xchg)_u))",
+    // SIMD.
+    "v128\\.load(8x8|16x4|32x2)_[su]",
+    "v128\\.load(8|16|32|64)_splat",
+    "v128\\.(load|store)(8|16|32|64)_lane",
+    "v128\\.load(32|64)_zero",
+    "v128\.(load|store|const|not|andnot|and|or|xor|bitselect|any_true)",
+    "i(8x16|16x8)\\.(extract_lane_[su]|(add|sub)_sat_[su]|avgr_u)",
+    "i(8x16|16x8|32x4|64x2)\\.(neg|add|sub|abs|shl|shr_[su]|all_true|bitmask|eq|ne|[lg][te]_s)",
+    "(i(8x16|16x8|32x4|64x2)|f(32x4|64x2))\.(splat|replace_lane)",
+    "i(8x16|16x8|32x4)\\.(([lg][te]_u)|((min|max)_[su]))",
+    "f(32x4|64x2)\\.(neg|add|sub|abs|nearest|eq|ne|[lg][te]|sqrt|mul|div|min|max|ceil|floor|trunc)",
+    "[fi](32x4|64x2)\\.extract_lane",
+    "i8x16\\.(shuffle|swizzle|popcnt|narrow_i16x8_[su])",
+    "i16x8\\.(narrow_i32x4_[su]|mul|extadd_pairwise_i8x16_[su]|q15mulr_sat_s)",
+    "i16x8\\.(extend|extmul)_(low|high)_i8x16_[su]",
+    "i32x4\\.(mul|dot_i16x8_s|trunc_sat_f64x2_[su]_zero)",
+    "i32x4\\.((extend|extmul)_(low|high)_i16x8_|trunc_sat_f32x4_|extadd_pairwise_i16x8_)[su]",
+    "i64x2\\.(mul|(extend|extmul)_(low|high)_i32x4_[su])",
+    "f32x4\\.(convert_i32x4_[su]|demote_f64x2_zero)",
+    "f64x2\\.(promote_low_f32x4|convert_low_i32x4_[su])",
+    // Reference types, function references, and GC.
+    "\\bany\\b",
+    "array\\.len",
+    "(array|struct)(\\.(new_(default_)?with_rtt|get(_[su])?|set))?",
+    "\\beq\\b",
+    "field",
+    "i31\\.(new|get_[su])",
+    "\\bnull\\b",
+    "ref(\\.(([ai]s_(data|func|i31))|cast|eq|func|(is_|as_non_)?null|test))?",
+    "rtt(\\.(canon|sub))?",
+];
+
+CodeMirror.defineSimpleMode('wast', {
+  start: [
+    {regex: /[+\-]?(?:nan(?::0x[0-9a-fA-F]+)?|infinity|inf|0x[0-9a-fA-F]+\.?[0-9a-fA-F]*p[+\/-]?\d+|\d+(?:\.\d*)?[eE][+\-]?\d*|\d+\.\d*|0x[0-9a-fA-F]+|\d+)/, token: "number"},
+    {regex: new RegExp(kKeywords.join('|')), token: "keyword"},
+    {regex: /\b((any|data|eq|extern|i31|func)ref|[fi](32|64)|i(8|16))\b/, token: "atom"},
+    {regex: /\$([a-zA-Z0-9_`\+\-\*\/\\\^~=<>!\?@#$%&|:\.]+)/, token: "variable-2"},
+    {regex: /"(?:[^"\\\x00-\x1f\x7f]|\\[nt\\'"]|\\[0-9a-fA-F][0-9a-fA-F])*"/, token: "string"},
+    {regex: /\(;.*?/, token: "comment", next: "comment"},
+    {regex: /;;.*$/, token: "comment"},
+    {regex: /\(/, indent: true},
+    {regex: /\)/, dedent: true},
+  ],
+
+  comment: [
+    {regex: /.*?;\)/, token: "comment", next: "start"},
+    {regex: /.*/, token: "comment"},
+  ],
+
+  meta: {
+    dontIndentStates: ['comment'],
+  },
+});
+
+// https://github.com/WebAssembly/design/issues/981 mentions text/webassembly,
+// which seems like a reasonable choice, although it's not standard right now.
+CodeMirror.defineMIME("text/webassembly", "wast");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/webidl/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,71 @@
+<!doctype html>
+
+<title>CodeMirror: Web IDL mode</title>
+<meta charset="utf-8">
+<link rel="stylesheet" href="../../doc/docs.css">
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="webidl.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+
+<div id="nav">
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id="logo" src="../../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class="active" href="#">Web IDL</a>
+  </ul>
+</div>
+
+<article>
+  <h2>Web IDL mode</h2>
+
+  <div>
+<textarea id="code" name="code">
+[NamedConstructor=Image(optional unsigned long width, optional unsigned long height)]
+interface HTMLImageElement : HTMLElement {
+           attribute DOMString alt;
+           attribute DOMString src;
+           attribute DOMString srcset;
+           attribute DOMString sizes;
+           attribute DOMString? crossOrigin;
+           attribute DOMString useMap;
+           attribute boolean isMap;
+           attribute unsigned long width;
+           attribute unsigned long height;
+  readonly attribute unsigned long naturalWidth;
+  readonly attribute unsigned long naturalHeight;
+  readonly attribute boolean complete;
+  readonly attribute DOMString currentSrc;
+
+  // also has obsolete members
+};
+
+partial interface HTMLImageElement {
+  attribute DOMString name;
+  attribute DOMString lowsrc;
+  attribute DOMString align;
+  attribute unsigned long hspace;
+  attribute unsigned long vspace;
+  attribute DOMString longDesc;
+
+  [TreatNullAs=EmptyString] attribute DOMString border;
+};
+</textarea>
+  </div>
+
+  <script>
+    var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+      lineNumbers: true,
+      matchBrackets: true
+    });
+  </script>
+
+  <p><strong>MIME type defined:</strong> <code>text/x-webidl</code>.</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/webidl/webidl.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,195 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+function wordRegexp(words) {
+  return new RegExp("^((" + words.join(")|(") + "))\\b");
+};
+
+var builtinArray = [
+  "Clamp",
+  "Constructor",
+  "EnforceRange",
+  "Exposed",
+  "ImplicitThis",
+  "Global", "PrimaryGlobal",
+  "LegacyArrayClass",
+  "LegacyUnenumerableNamedProperties",
+  "LenientThis",
+  "NamedConstructor",
+  "NewObject",
+  "NoInterfaceObject",
+  "OverrideBuiltins",
+  "PutForwards",
+  "Replaceable",
+  "SameObject",
+  "TreatNonObjectAsNull",
+  "TreatNullAs",
+    "EmptyString",
+  "Unforgeable",
+  "Unscopeable"
+];
+var builtins = wordRegexp(builtinArray);
+
+var typeArray = [
+  "unsigned", "short", "long",                  // UnsignedIntegerType
+  "unrestricted", "float", "double",            // UnrestrictedFloatType
+  "boolean", "byte", "octet",                   // Rest of PrimitiveType
+  "Promise",                                    // PromiseType
+  "ArrayBuffer", "DataView", "Int8Array", "Int16Array", "Int32Array",
+  "Uint8Array", "Uint16Array", "Uint32Array", "Uint8ClampedArray",
+  "Float32Array", "Float64Array",               // BufferRelatedType
+  "ByteString", "DOMString", "USVString", "sequence", "object", "RegExp",
+  "Error", "DOMException", "FrozenArray",       // Rest of NonAnyType
+  "any",                                        // Rest of SingleType
+  "void"                                        // Rest of ReturnType
+];
+var types = wordRegexp(typeArray);
+
+var keywordArray = [
+  "attribute", "callback", "const", "deleter", "dictionary", "enum", "getter",
+  "implements", "inherit", "interface", "iterable", "legacycaller", "maplike",
+  "partial", "required", "serializer", "setlike", "setter", "static",
+  "stringifier", "typedef",                     // ArgumentNameKeyword except
+                                                // "unrestricted"
+  "optional", "readonly", "or"
+];
+var keywords = wordRegexp(keywordArray);
+
+var atomArray = [
+  "true", "false",                              // BooleanLiteral
+  "Infinity", "NaN",                            // FloatLiteral
+  "null"                                        // Rest of ConstValue
+];
+var atoms = wordRegexp(atomArray);
+
+CodeMirror.registerHelper("hintWords", "webidl",
+    builtinArray.concat(typeArray).concat(keywordArray).concat(atomArray));
+
+var startDefArray = ["callback", "dictionary", "enum", "interface"];
+var startDefs = wordRegexp(startDefArray);
+
+var endDefArray = ["typedef"];
+var endDefs = wordRegexp(endDefArray);
+
+var singleOperators = /^[:<=>?]/;
+var integers = /^-?([1-9][0-9]*|0[Xx][0-9A-Fa-f]+|0[0-7]*)/;
+var floats = /^-?(([0-9]+\.[0-9]*|[0-9]*\.[0-9]+)([Ee][+-]?[0-9]+)?|[0-9]+[Ee][+-]?[0-9]+)/;
+var identifiers = /^_?[A-Za-z][0-9A-Z_a-z-]*/;
+var identifiersEnd = /^_?[A-Za-z][0-9A-Z_a-z-]*(?=\s*;)/;
+var strings = /^"[^"]*"/;
+var multilineComments = /^\/\*.*?\*\//;
+var multilineCommentsStart = /^\/\*.*/;
+var multilineCommentsEnd = /^.*?\*\//;
+
+function readToken(stream, state) {
+  // whitespace
+  if (stream.eatSpace()) return null;
+
+  // comment
+  if (state.inComment) {
+    if (stream.match(multilineCommentsEnd)) {
+      state.inComment = false;
+      return "comment";
+    }
+    stream.skipToEnd();
+    return "comment";
+  }
+  if (stream.match("//")) {
+    stream.skipToEnd();
+    return "comment";
+  }
+  if (stream.match(multilineComments)) return "comment";
+  if (stream.match(multilineCommentsStart)) {
+    state.inComment = true;
+    return "comment";
+  }
+
+  // integer and float
+  if (stream.match(/^-?[0-9\.]/, false)) {
+    if (stream.match(integers) || stream.match(floats)) return "number";
+  }
+
+  // string
+  if (stream.match(strings)) return "string";
+
+  // identifier
+  if (state.startDef && stream.match(identifiers)) return "def";
+
+  if (state.endDef && stream.match(identifiersEnd)) {
+    state.endDef = false;
+    return "def";
+  }
+
+  if (stream.match(keywords)) return "keyword";
+
+  if (stream.match(types)) {
+    var lastToken = state.lastToken;
+    var nextToken = (stream.match(/^\s*(.+?)\b/, false) || [])[1];
+
+    if (lastToken === ":" || lastToken === "implements" ||
+        nextToken === "implements" || nextToken === "=") {
+      // Used as identifier
+      return "builtin";
+    } else {
+      // Used as type
+      return "variable-3";
+    }
+  }
+
+  if (stream.match(builtins)) return "builtin";
+  if (stream.match(atoms)) return "atom";
+  if (stream.match(identifiers)) return "variable";
+
+  // other
+  if (stream.match(singleOperators)) return "operator";
+
+  // unrecognized
+  stream.next();
+  return null;
+};
+
+CodeMirror.defineMode("webidl", function() {
+  return {
+    startState: function() {
+      return {
+        // Is in multiline comment
+        inComment: false,
+        // Last non-whitespace, matched token
+        lastToken: "",
+        // Next token is a definition
+        startDef: false,
+        // Last token of the statement is a definition
+        endDef: false
+      };
+    },
+    token: function(stream, state) {
+      var style = readToken(stream, state);
+
+      if (style) {
+        var cur = stream.current();
+        state.lastToken = cur;
+        if (style === "keyword") {
+          state.startDef = startDefs.test(cur);
+          state.endDef = state.endDef || endDefs.test(cur);
+        } else {
+          state.startDef = false;
+        }
+      }
+
+      return style;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-webidl", "webidl");
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/xml/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+<!doctype html>
+
+<title>CodeMirror: XML mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="xml.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">XML</a>
+  </ul>
+</div>
+
+<article>
+<h2>XML mode</h2>
+<form><textarea id="code" name="code">
+&lt;html style="color: green"&gt;
+  &lt;!-- this is a comment --&gt;
+  &lt;head&gt;
+    &lt;title&gt;HTML Example&lt;/title&gt;
+  &lt;/head&gt;
+  &lt;body&gt;
+    The indentation tries to be &lt;em&gt;somewhat &amp;quot;do what
+    I mean&amp;quot;&lt;/em&gt;... but might not match your style.
+  &lt;/body&gt;
+&lt;/html&gt;
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        mode: "text/html",
+        lineNumbers: true
+      });
+    </script>
+    <p>The XML mode supports these configuration parameters:</p>
+    <dl>
+      <dt><code>htmlMode (boolean)</code></dt>
+      <dd>This switches the mode to parse HTML instead of XML. This
+      means attributes do not have to be quoted, and some elements
+      (such as <code>br</code>) do not require a closing tag.</dd>
+      <dt><code>matchClosing (boolean)</code></dt>
+      <dd>Controls whether the mode checks that close tags match the
+      corresponding opening tag, and highlights mismatches as errors.
+      Defaults to true.</dd>
+      <dt><code>alignCDATA (boolean)</code></dt>
+      <dd>Setting this to true will force the opening tag of CDATA
+      blocks to not be indented.</dd>
+    </dl>
+
+    <p><strong>MIME types defined:</strong> <code>application/xml</code>, <code>text/html</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/xml/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,51 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var mode = CodeMirror.getMode({indentUnit: 2}, "xml"), mname = "xml";
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1), mname); }
+
+  MT("matching",
+     "[tag&bracket <][tag top][tag&bracket >]",
+     "  text",
+     "  [tag&bracket <][tag inner][tag&bracket />]",
+     "[tag&bracket </][tag top][tag&bracket >]");
+
+  MT("nonmatching",
+     "[tag&bracket <][tag top][tag&bracket >]",
+     "  [tag&bracket <][tag inner][tag&bracket />]",
+     "  [tag&bracket </][tag&error tip][tag&bracket&error >]");
+
+  MT("doctype",
+     "[meta <!doctype foobar>]",
+     "[tag&bracket <][tag top][tag&bracket />]");
+
+  MT("cdata",
+     "[tag&bracket <][tag top][tag&bracket >]",
+     "  [atom <![CDATA[foo]",
+     "[atom barbazguh]]]]>]",
+     "[tag&bracket </][tag top][tag&bracket >]");
+
+  // HTML tests
+  mode = CodeMirror.getMode({indentUnit: 2}, "text/html");
+
+  MT("selfclose",
+     "[tag&bracket <][tag html][tag&bracket >]",
+     "  [tag&bracket <][tag link] [attribute rel]=[string stylesheet] [attribute href]=[string \"/foobar\"][tag&bracket >]",
+     "[tag&bracket </][tag html][tag&bracket >]");
+
+  MT("list",
+     "[tag&bracket <][tag ol][tag&bracket >]",
+     "  [tag&bracket <][tag li][tag&bracket >]one",
+     "  [tag&bracket <][tag li][tag&bracket >]two",
+     "[tag&bracket </][tag ol][tag&bracket >]");
+
+  MT("valueless",
+     "[tag&bracket <][tag input] [attribute type]=[string checkbox] [attribute checked][tag&bracket />]");
+
+  MT("pThenArticle",
+     "[tag&bracket <][tag p][tag&bracket >]",
+     "  foo",
+     "[tag&bracket <][tag article][tag&bracket >]bar");
+
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/xml/xml.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,417 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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";
+
+var htmlConfig = {
+  autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
+                    'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
+                    'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
+                    'track': true, 'wbr': true, 'menuitem': true},
+  implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
+                     'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
+                     'th': true, 'tr': true},
+  contextGrabbers: {
+    'dd': {'dd': true, 'dt': true},
+    'dt': {'dd': true, 'dt': true},
+    'li': {'li': true},
+    'option': {'option': true, 'optgroup': true},
+    'optgroup': {'optgroup': true},
+    'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
+          'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
+          'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
+          'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
+          'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
+    'rp': {'rp': true, 'rt': true},
+    'rt': {'rp': true, 'rt': true},
+    'tbody': {'tbody': true, 'tfoot': true},
+    'td': {'td': true, 'th': true},
+    'tfoot': {'tbody': true},
+    'th': {'td': true, 'th': true},
+    'thead': {'tbody': true, 'tfoot': true},
+    'tr': {'tr': true}
+  },
+  doNotIndent: {"pre": true},
+  allowUnquoted: true,
+  allowMissing: true,
+  caseFold: true
+}
+
+var xmlConfig = {
+  autoSelfClosers: {},
+  implicitlyClosed: {},
+  contextGrabbers: {},
+  doNotIndent: {},
+  allowUnquoted: false,
+  allowMissing: false,
+  allowMissingTagName: false,
+  caseFold: false
+}
+
+CodeMirror.defineMode("xml", function(editorConf, config_) {
+  var indentUnit = editorConf.indentUnit
+  var config = {}
+  var defaults = config_.htmlMode ? htmlConfig : xmlConfig
+  for (var prop in defaults) config[prop] = defaults[prop]
+  for (var prop in config_) config[prop] = config_[prop]
+
+  // Return variables for tokenizers
+  var type, setStyle;
+
+  function inText(stream, state) {
+    function chain(parser) {
+      state.tokenize = parser;
+      return parser(stream, state);
+    }
+
+    var ch = stream.next();
+    if (ch == "<") {
+      if (stream.eat("!")) {
+        if (stream.eat("[")) {
+          if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
+          else return null;
+        } else if (stream.match("--")) {
+          return chain(inBlock("comment", "-->"));
+        } else if (stream.match("DOCTYPE", true, true)) {
+          stream.eatWhile(/[\w\._\-]/);
+          return chain(doctype(1));
+        } else {
+          return null;
+        }
+      } else if (stream.eat("?")) {
+        stream.eatWhile(/[\w\._\-]/);
+        state.tokenize = inBlock("meta", "?>");
+        return "meta";
+      } else {
+        type = stream.eat("/") ? "closeTag" : "openTag";
+        state.tokenize = inTag;
+        return "tag bracket";
+      }
+    } else if (ch == "&") {
+      var ok;
+      if (stream.eat("#")) {
+        if (stream.eat("x")) {
+          ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
+        } else {
+          ok = stream.eatWhile(/[\d]/) && stream.eat(";");
+        }
+      } else {
+        ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
+      }
+      return ok ? "atom" : "error";
+    } else {
+      stream.eatWhile(/[^&<]/);
+      return null;
+    }
+  }
+  inText.isInText = true;
+
+  function inTag(stream, state) {
+    var ch = stream.next();
+    if (ch == ">" || (ch == "/" && stream.eat(">"))) {
+      state.tokenize = inText;
+      type = ch == ">" ? "endTag" : "selfcloseTag";
+      return "tag bracket";
+    } else if (ch == "=") {
+      type = "equals";
+      return null;
+    } else if (ch == "<") {
+      state.tokenize = inText;
+      state.state = baseState;
+      state.tagName = state.tagStart = null;
+      var next = state.tokenize(stream, state);
+      return next ? next + " tag error" : "tag error";
+    } else if (/[\'\"]/.test(ch)) {
+      state.tokenize = inAttribute(ch);
+      state.stringStartCol = stream.column();
+      return state.tokenize(stream, state);
+    } else {
+      stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
+      return "word";
+    }
+  }
+
+  function inAttribute(quote) {
+    var closure = function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.next() == quote) {
+          state.tokenize = inTag;
+          break;
+        }
+      }
+      return "string";
+    };
+    closure.isInAttribute = true;
+    return closure;
+  }
+
+  function inBlock(style, terminator) {
+    return function(stream, state) {
+      while (!stream.eol()) {
+        if (stream.match(terminator)) {
+          state.tokenize = inText;
+          break;
+        }
+        stream.next();
+      }
+      return style;
+    }
+  }
+
+  function doctype(depth) {
+    return function(stream, state) {
+      var ch;
+      while ((ch = stream.next()) != null) {
+        if (ch == "<") {
+          state.tokenize = doctype(depth + 1);
+          return state.tokenize(stream, state);
+        } else if (ch == ">") {
+          if (depth == 1) {
+            state.tokenize = inText;
+            break;
+          } else {
+            state.tokenize = doctype(depth - 1);
+            return state.tokenize(stream, state);
+          }
+        }
+      }
+      return "meta";
+    };
+  }
+
+  function lower(tagName) {
+    return tagName && tagName.toLowerCase();
+  }
+
+  function Context(state, tagName, startOfLine) {
+    this.prev = state.context;
+    this.tagName = tagName || "";
+    this.indent = state.indented;
+    this.startOfLine = startOfLine;
+    if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
+      this.noIndent = true;
+  }
+  function popContext(state) {
+    if (state.context) state.context = state.context.prev;
+  }
+  function maybePopContext(state, nextTagName) {
+    var parentTagName;
+    while (true) {
+      if (!state.context) {
+        return;
+      }
+      parentTagName = state.context.tagName;
+      if (!config.contextGrabbers.hasOwnProperty(lower(parentTagName)) ||
+          !config.contextGrabbers[lower(parentTagName)].hasOwnProperty(lower(nextTagName))) {
+        return;
+      }
+      popContext(state);
+    }
+  }
+
+  function baseState(type, stream, state) {
+    if (type == "openTag") {
+      state.tagStart = stream.column();
+      return tagNameState;
+    } else if (type == "closeTag") {
+      return closeTagNameState;
+    } else {
+      return baseState;
+    }
+  }
+  function tagNameState(type, stream, state) {
+    if (type == "word") {
+      state.tagName = stream.current();
+      setStyle = "tag";
+      return attrState;
+    } else if (config.allowMissingTagName && type == "endTag") {
+      setStyle = "tag bracket";
+      return attrState(type, stream, state);
+    } else {
+      setStyle = "error";
+      return tagNameState;
+    }
+  }
+  function closeTagNameState(type, stream, state) {
+    if (type == "word") {
+      var tagName = stream.current();
+      if (state.context && state.context.tagName != tagName &&
+          config.implicitlyClosed.hasOwnProperty(lower(state.context.tagName)))
+        popContext(state);
+      if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
+        setStyle = "tag";
+        return closeState;
+      } else {
+        setStyle = "tag error";
+        return closeStateErr;
+      }
+    } else if (config.allowMissingTagName && type == "endTag") {
+      setStyle = "tag bracket";
+      return closeState(type, stream, state);
+    } else {
+      setStyle = "error";
+      return closeStateErr;
+    }
+  }
+
+  function closeState(type, _stream, state) {
+    if (type != "endTag") {
+      setStyle = "error";
+      return closeState;
+    }
+    popContext(state);
+    return baseState;
+  }
+  function closeStateErr(type, stream, state) {
+    setStyle = "error";
+    return closeState(type, stream, state);
+  }
+
+  function attrState(type, _stream, state) {
+    if (type == "word") {
+      setStyle = "attribute";
+      return attrEqState;
+    } else if (type == "endTag" || type == "selfcloseTag") {
+      var tagName = state.tagName, tagStart = state.tagStart;
+      state.tagName = state.tagStart = null;
+      if (type == "selfcloseTag" ||
+          config.autoSelfClosers.hasOwnProperty(lower(tagName))) {
+        maybePopContext(state, tagName);
+      } else {
+        maybePopContext(state, tagName);
+        state.context = new Context(state, tagName, tagStart == state.indented);
+      }
+      return baseState;
+    }
+    setStyle = "error";
+    return attrState;
+  }
+  function attrEqState(type, stream, state) {
+    if (type == "equals") return attrValueState;
+    if (!config.allowMissing) setStyle = "error";
+    return attrState(type, stream, state);
+  }
+  function attrValueState(type, stream, state) {
+    if (type == "string") return attrContinuedState;
+    if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
+    setStyle = "error";
+    return attrState(type, stream, state);
+  }
+  function attrContinuedState(type, stream, state) {
+    if (type == "string") return attrContinuedState;
+    return attrState(type, stream, state);
+  }
+
+  return {
+    startState: function(baseIndent) {
+      var state = {tokenize: inText,
+                   state: baseState,
+                   indented: baseIndent || 0,
+                   tagName: null, tagStart: null,
+                   context: null}
+      if (baseIndent != null) state.baseIndent = baseIndent
+      return state
+    },
+
+    token: function(stream, state) {
+      if (!state.tagName && stream.sol())
+        state.indented = stream.indentation();
+
+      if (stream.eatSpace()) return null;
+      type = null;
+      var style = state.tokenize(stream, state);
+      if ((style || type) && style != "comment") {
+        setStyle = null;
+        state.state = state.state(type || style, stream, state);
+        if (setStyle)
+          style = setStyle == "error" ? style + " error" : setStyle;
+      }
+      return style;
+    },
+
+    indent: function(state, textAfter, fullLine) {
+      var context = state.context;
+      // Indent multi-line strings (e.g. css).
+      if (state.tokenize.isInAttribute) {
+        if (state.tagStart == state.indented)
+          return state.stringStartCol + 1;
+        else
+          return state.indented + indentUnit;
+      }
+      if (context && context.noIndent) return CodeMirror.Pass;
+      if (state.tokenize != inTag && state.tokenize != inText)
+        return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
+      // Indent the starts of attribute names.
+      if (state.tagName) {
+        if (config.multilineTagIndentPastTag !== false)
+          return state.tagStart + state.tagName.length + 2;
+        else
+          return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
+      }
+      if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
+      var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
+      if (tagAfter && tagAfter[1]) { // Closing tag spotted
+        while (context) {
+          if (context.tagName == tagAfter[2]) {
+            context = context.prev;
+            break;
+          } else if (config.implicitlyClosed.hasOwnProperty(lower(context.tagName))) {
+            context = context.prev;
+          } else {
+            break;
+          }
+        }
+      } else if (tagAfter) { // Opening tag spotted
+        while (context) {
+          var grabbers = config.contextGrabbers[lower(context.tagName)];
+          if (grabbers && grabbers.hasOwnProperty(lower(tagAfter[2])))
+            context = context.prev;
+          else
+            break;
+        }
+      }
+      while (context && context.prev && !context.startOfLine)
+        context = context.prev;
+      if (context) return context.indent + indentUnit;
+      else return state.baseIndent || 0;
+    },
+
+    electricInput: /<\/[\s\w:]+>$/,
+    blockCommentStart: "<!--",
+    blockCommentEnd: "-->",
+
+    configuration: config.htmlMode ? "html" : "xml",
+    helperType: config.htmlMode ? "html" : "xml",
+
+    skipAttribute: function(state) {
+      if (state.state == attrValueState)
+        state.state = attrState
+    },
+
+    xmlCurrentTag: function(state) {
+      return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
+    },
+
+    xmlCurrentContext: function(state) {
+      var context = []
+      for (var cx = state.context; cx; cx = cx.prev)
+        context.push(cx.tagName)
+      return context.reverse()
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/xml", "xml");
+CodeMirror.defineMIME("application/xml", "xml");
+if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
+  CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/xquery/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,211 @@
+<!doctype html>
+
+<title>CodeMirror: XQuery mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<link rel="stylesheet" href="../../theme/xq-dark.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/edit/matchbrackets.js"></script>
+<script src="xquery.js"></script>
+<style>
+	.CodeMirror {
+	  border-top: 1px solid black; border-bottom: 1px solid black;
+	  height:400px;
+	}
+    </style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">XQuery</a>
+  </ul>
+</div>
+
+<article>
+<h2>XQuery mode</h2>
+ 
+ 
+<div class="cm-s-default"> 
+	<textarea id="code" name="code"> 
+xquery version &quot;1.0-ml&quot;;
+(: this is
+ : a 
+   "comment" :)
+let $let := &lt;x attr=&quot;value&quot;&gt;&quot;test&quot;&lt;func&gt;function() $var {function()} {$var}&lt;/func&gt;&lt;/x&gt;
+let $joe:=1
+return element element {
+	attribute attribute { 1 },
+	element test { &#39;a&#39; }, 
+	attribute foo { &quot;bar&quot; },
+	fn:doc()[ foo/@bar eq $let ],
+	//x }    
+ 
+(: a more 'evil' test :)
+(: Modified Blakeley example (: with nested comment :) ... :)
+declare private function local:declare() {()};
+declare private function local:private() {()};
+declare private function local:function() {()};
+declare private function local:local() {()};
+let $let := &lt;let&gt;let $let := &quot;let&quot;&lt;/let&gt;
+return element element {
+	attribute attribute { try { xdmp:version() } catch($e) { xdmp:log($e) } },
+	attribute fn:doc { &quot;bar&quot; castable as xs:string },
+	element text { text { &quot;text&quot; } },
+	fn:doc()[ child::eq/(@bar | attribute::attribute) eq $let ],
+	//fn:doc
+}
+
+
+
+xquery version &quot;1.0-ml&quot;;
+
+(: Copyright 2006-2010 Mark Logic Corporation. :)
+
+(:
+ : Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);
+ : you may not use this file except in compliance with the License.
+ : You may obtain a copy of the License at
+ :
+ :     http://www.apache.org/licenses/LICENSE-2.0
+ :
+ : Unless required by applicable law or agreed to in writing, software
+ : distributed under the License is distributed on an &quot;AS IS&quot; BASIS,
+ : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ : See the License for the specific language governing permissions and
+ : limitations under the License.
+ :)
+
+module namespace json = &quot;http://marklogic.com/json&quot;;
+declare default function namespace &quot;http://www.w3.org/2005/xpath-functions&quot;;
+
+(: Need to backslash escape any double quotes, backslashes, and newlines :)
+declare function json:escape($s as xs:string) as xs:string {
+  let $s := replace($s, &quot;\\&quot;, &quot;\\\\&quot;)
+  let $s := replace($s, &quot;&quot;&quot;&quot;, &quot;\\&quot;&quot;&quot;)
+  let $s := replace($s, codepoints-to-string((13, 10)), &quot;\\n&quot;)
+  let $s := replace($s, codepoints-to-string(13), &quot;\\n&quot;)
+  let $s := replace($s, codepoints-to-string(10), &quot;\\n&quot;)
+  return $s
+};
+
+declare function json:atomize($x as element()) as xs:string {
+  if (count($x/node()) = 0) then 'null'
+  else if ($x/@type = &quot;number&quot;) then
+    let $castable := $x castable as xs:float or
+                     $x castable as xs:double or
+                     $x castable as xs:decimal
+    return
+    if ($castable) then xs:string($x)
+    else error(concat(&quot;Not a number: &quot;, xdmp:describe($x)))
+  else if ($x/@type = &quot;boolean&quot;) then
+    let $castable := $x castable as xs:boolean
+    return
+    if ($castable) then xs:string(xs:boolean($x))
+    else error(concat(&quot;Not a boolean: &quot;, xdmp:describe($x)))
+  else concat('&quot;', json:escape($x), '&quot;')
+};
+
+(: Print the thing that comes after the colon :)
+declare function json:print-value($x as element()) as xs:string {
+  if (count($x/*) = 0) then
+    json:atomize($x)
+  else if ($x/@quote = &quot;true&quot;) then
+    concat('&quot;', json:escape(xdmp:quote($x/node())), '&quot;')
+  else
+    string-join(('{',
+      string-join(for $i in $x/* return json:print-name-value($i), &quot;,&quot;),
+    '}'), &quot;&quot;)
+};
+
+(: Print the name and value both :)
+declare function json:print-name-value($x as element()) as xs:string? {
+  let $name := name($x)
+  let $first-in-array :=
+    count($x/preceding-sibling::*[name(.) = $name]) = 0 and
+    (count($x/following-sibling::*[name(.) = $name]) &gt; 0 or $x/@array = &quot;true&quot;)
+  let $later-in-array := count($x/preceding-sibling::*[name(.) = $name]) &gt; 0
+  return
+
+  if ($later-in-array) then
+    ()  (: I was handled previously :)
+  else if ($first-in-array) then
+    string-join(('&quot;', json:escape($name), '&quot;:[',
+      string-join((for $i in ($x, $x/following-sibling::*[name(.) = $name]) return json:print-value($i)), &quot;,&quot;),
+    ']'), &quot;&quot;)
+   else
+     string-join(('&quot;', json:escape($name), '&quot;:', json:print-value($x)), &quot;&quot;)
+};
+
+(:~
+  Transforms an XML element into a JSON string representation.  See http://json.org.
+  &lt;p/&gt;
+  Sample usage:
+  &lt;pre&gt;
+    xquery version &quot;1.0-ml&quot;;
+    import module namespace json=&quot;http://marklogic.com/json&quot; at &quot;json.xqy&quot;;
+    json:serialize(&amp;lt;foo&amp;gt;&amp;lt;bar&amp;gt;kid&amp;lt;/bar&amp;gt;&amp;lt;/foo&amp;gt;)
+  &lt;/pre&gt;
+  Sample transformations:
+  &lt;pre&gt;
+  &amp;lt;e/&amp;gt; becomes {&quot;e&quot;:null}
+  &amp;lt;e&amp;gt;text&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;text&quot;}
+  &amp;lt;e&amp;gt;quote &quot; escaping&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;quote \&quot; escaping&quot;}
+  &amp;lt;e&amp;gt;backslash \ escaping&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;backslash \\ escaping&quot;}
+  &amp;lt;e&amp;gt;&amp;lt;a&amp;gt;text1&amp;lt;/a&amp;gt;&amp;lt;b&amp;gt;text2&amp;lt;/b&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:&quot;text1&quot;,&quot;b&quot;:&quot;text2&quot;}}
+  &amp;lt;e&amp;gt;&amp;lt;a&amp;gt;text1&amp;lt;/a&amp;gt;&amp;lt;a&amp;gt;text2&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:[&quot;text1&quot;,&quot;text2&quot;]}}
+  &amp;lt;e&amp;gt;&amp;lt;a array=&quot;true&quot;&amp;gt;text1&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:[&quot;text1&quot;]}}
+  &amp;lt;e&amp;gt;&amp;lt;a type=&quot;boolean&quot;&amp;gt;false&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:false}}
+  &amp;lt;e&amp;gt;&amp;lt;a type=&quot;number&quot;&amp;gt;123.5&amp;lt;/a&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:{&quot;a&quot;:123.5}}
+  &amp;lt;e quote=&quot;true&quot;&amp;gt;&amp;lt;div attrib=&quot;value&quot;/&amp;gt;&amp;lt;/e&amp;gt; becomes {&quot;e&quot;:&quot;&amp;lt;div attrib=\&quot;value\&quot;/&amp;gt;&quot;}
+  &lt;/pre&gt;
+  &lt;p/&gt;
+  Namespace URIs are ignored.  Namespace prefixes are included in the JSON name.
+  &lt;p/&gt;
+  Attributes are ignored, except for the special attribute @array=&quot;true&quot; that
+  indicates the JSON serialization should write the node, even if single, as an
+  array, and the attribute @type that can be set to &quot;boolean&quot; or &quot;number&quot; to
+  dictate the value should be written as that type (unquoted).  There's also
+  an @quote attribute that when set to true writes the inner content as text
+  rather than as structured JSON, useful for sending some XHTML over the
+  wire.
+  &lt;p/&gt;
+  Text nodes within mixed content are ignored.
+
+  @param $x Element node to convert
+  @return String holding JSON serialized representation of $x
+
+  @author Jason Hunter
+  @version 1.0.1
+  
+  Ported to xquery 1.0-ml; double escaped backslashes in json:escape
+:)
+declare function json:serialize($x as element())  as xs:string {
+  string-join(('{', json:print-name-value($x), '}'), &quot;&quot;)
+};
+  </textarea> 
+</div> 
+ 
+    <script> 
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true,
+        matchBrackets: true,
+        theme: "xq-dark"
+      });
+    </script> 
+ 
+    <p><strong>MIME types defined:</strong> <code>application/xquery</code>.</p> 
+ 
+    <p>Development of the CodeMirror XQuery mode was sponsored by 
+      <a href="http://marklogic.com">MarkLogic</a> and developed by 
+      <a href="https://twitter.com/mbrevoort">Mike Brevoort</a>.
+    </p>
+ 
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/xquery/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,67 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Don't take these too seriously -- the expected results appear to be
+// based on the results of actual runs without any serious manual
+// verification. If a change you made causes them to fail, the test is
+// as likely to wrong as the code.
+
+(function() {
+  var mode = CodeMirror.getMode({tabSize: 4}, "xquery");
+  function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); }
+
+  MT("eviltest",
+     "[keyword xquery] [keyword version] [variable &quot;1][keyword .][atom 0][keyword -][variable ml&quot;][def&variable ;]      [comment (: this is       : a          \"comment\" :)]",
+     "      [keyword let] [variable $let] [keyword :=] [variable &lt;x] [variable attr][keyword =][variable &quot;value&quot;&gt;&quot;test&quot;&lt;func&gt][def&variable ;function]() [variable $var] {[keyword function]()} {[variable $var]}[variable &lt;][keyword /][variable func&gt;&lt;][keyword /][variable x&gt;]",
+     "      [keyword let] [variable $joe][keyword :=][atom 1]",
+     "      [keyword return] [keyword element] [variable element] {",
+     "          [keyword attribute] [variable attribute] { [atom 1] },",
+     "          [keyword element] [variable test] { [variable &#39;a&#39;] },           [keyword attribute] [variable foo] { [variable &quot;bar&quot;] },",
+     "          [def&variable fn:doc]()[[ [variable foo][keyword /][variable @bar] [keyword eq] [variable $let] ]],",
+     "          [keyword //][variable x] }                 [comment (: a more 'evil' test :)]",
+     "      [comment (: Modified Blakeley example (: with nested comment :) ... :)]",
+     "      [keyword declare] [variable private] [keyword function] [def&variable local:declare]() {()}[variable ;]",
+     "      [keyword declare] [variable private] [keyword function] [def&variable local:private]() {()}[variable ;]",
+     "      [keyword declare] [variable private] [keyword function] [def&variable local:function]() {()}[variable ;]",
+     "      [keyword declare] [variable private] [keyword function] [def&variable local:local]() {()}[variable ;]",
+     "      [keyword let] [variable $let] [keyword :=] [variable &lt;let&gt;let] [variable $let] [keyword :=] [variable &quot;let&quot;&lt;][keyword /let][variable &gt;]",
+     "      [keyword return] [keyword element] [variable element] {",
+     "          [keyword attribute] [variable attribute] { [keyword try] { [def&variable xdmp:version]() } [keyword catch]([variable $e]) { [def&variable xdmp:log]([variable $e]) } },",
+     "          [keyword attribute] [variable fn:doc] { [variable &quot;bar&quot;] [keyword castable] [keyword as] [atom xs:string] },",
+     "          [keyword element] [variable text] { [keyword text] { [variable &quot;text&quot;] } },",
+     "          [def&variable fn:doc]()[[ [qualifier child::][variable eq][keyword /]([variable @bar] [keyword |] [qualifier attribute::][variable attribute]) [keyword eq] [variable $let] ]],",
+     "          [keyword //][variable fn:doc]",
+     "      }");
+
+  MT("testEmptySequenceKeyword",
+     "[string \"foo\"] [keyword instance] [keyword of] [keyword empty-sequence]()");
+
+  MT("testMultiAttr",
+     "[tag <p ][attribute a1]=[string \"foo\"] [attribute a2]=[string \"bar\"][tag >][variable hello] [variable world][tag </p>]");
+
+  MT("test namespaced variable",
+     "[keyword declare] [keyword namespace] [variable e] [keyword =] [string \"http://example.com/ANamespace\"][variable ;declare] [keyword variable] [variable $e:exampleComThisVarIsNotRecognized] [keyword as] [keyword element]([keyword *]) [variable external;]");
+
+  MT("test EQName variable",
+     "[keyword declare] [keyword variable] [variable $\"http://www.example.com/ns/my\":var] [keyword :=] [atom 12][variable ;]",
+     "[tag <out>]{[variable $\"http://www.example.com/ns/my\":var]}[tag </out>]");
+
+  MT("test EQName function",
+     "[keyword declare] [keyword function] [def&variable \"http://www.example.com/ns/my\":fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
+     "   [variable $a] [keyword +] [atom 2]",
+     "}[variable ;]",
+     "[tag <out>]{[def&variable \"http://www.example.com/ns/my\":fn]([atom 12])}[tag </out>]");
+
+  MT("test EQName function with single quotes",
+     "[keyword declare] [keyword function] [def&variable 'http://www.example.com/ns/my':fn] ([variable $a] [keyword as] [atom xs:integer]) [keyword as] [atom xs:integer] {",
+     "   [variable $a] [keyword +] [atom 2]",
+     "}[variable ;]",
+     "[tag <out>]{[def&variable 'http://www.example.com/ns/my':fn]([atom 12])}[tag </out>]");
+
+  MT("testProcessingInstructions",
+     "[def&variable data]([comment&meta <?target content?>]) [keyword instance] [keyword of] [atom xs:string]");
+
+  MT("testQuoteEscapeDouble",
+     "[keyword let] [variable $rootfolder] [keyword :=] [string \"c:\\builds\\winnt\\HEAD\\qa\\scripts\\\"]",
+     "[keyword let] [variable $keysfolder] [keyword :=] [def&variable concat]([variable $rootfolder], [string \"keys\\\"])");
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/xquery/xquery.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,448 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("xquery", function() {
+
+  // The keywords object is set to the result of this self executing
+  // function. Each keyword is a property of the keywords object whose
+  // value is {type: atype, style: astyle}
+  var keywords = function(){
+    // convenience functions used to build keywords object
+    function kw(type) {return {type: type, style: "keyword"};}
+    var operator = kw("operator")
+      , atom = {type: "atom", style: "atom"}
+      , punctuation = {type: "punctuation", style: null}
+      , qualifier = {type: "axis_specifier", style: "qualifier"};
+
+    // kwObj is what is return from this function at the end
+    var kwObj = {
+      ',': punctuation
+    };
+
+    // a list of 'basic' keywords. For each add a property to kwObj with the value of
+    // {type: basic[i], style: "keyword"} e.g. 'after' --> {type: "after", style: "keyword"}
+    var basic = ['after', 'all', 'allowing', 'ancestor', 'ancestor-or-self', 'any', 'array', 'as',
+    'ascending', 'at', 'attribute', 'base-uri', 'before', 'boundary-space', 'by', 'case', 'cast',
+    'castable', 'catch', 'child', 'collation', 'comment', 'construction', 'contains', 'content',
+    'context', 'copy', 'copy-namespaces', 'count', 'decimal-format', 'declare', 'default', 'delete',
+    'descendant', 'descendant-or-self', 'descending', 'diacritics', 'different', 'distance',
+    'document', 'document-node', 'element', 'else', 'empty', 'empty-sequence', 'encoding', 'end',
+    'entire', 'every', 'exactly', 'except', 'external', 'first', 'following', 'following-sibling',
+    'for', 'from', 'ftand', 'ftnot', 'ft-option', 'ftor', 'function', 'fuzzy', 'greatest', 'group',
+    'if', 'import', 'in', 'inherit', 'insensitive', 'insert', 'instance', 'intersect', 'into',
+    'invoke', 'is', 'item', 'language', 'last', 'lax', 'least', 'let', 'levels', 'lowercase', 'map',
+    'modify', 'module', 'most', 'namespace', 'next', 'no', 'node', 'nodes', 'no-inherit',
+    'no-preserve', 'not', 'occurs', 'of', 'only', 'option', 'order', 'ordered', 'ordering',
+    'paragraph', 'paragraphs', 'parent', 'phrase', 'preceding', 'preceding-sibling', 'preserve',
+    'previous', 'processing-instruction', 'relationship', 'rename', 'replace', 'return',
+    'revalidation', 'same', 'satisfies', 'schema', 'schema-attribute', 'schema-element', 'score',
+    'self', 'sensitive', 'sentence', 'sentences', 'sequence', 'skip', 'sliding', 'some', 'stable',
+    'start', 'stemming', 'stop', 'strict', 'strip', 'switch', 'text', 'then', 'thesaurus', 'times',
+    'to', 'transform', 'treat', 'try', 'tumbling', 'type', 'typeswitch', 'union', 'unordered',
+    'update', 'updating', 'uppercase', 'using', 'validate', 'value', 'variable', 'version',
+    'weight', 'when', 'where', 'wildcards', 'window', 'with', 'without', 'word', 'words', 'xquery'];
+    for(var i=0, l=basic.length; i < l; i++) { kwObj[basic[i]] = kw(basic[i]);};
+
+    // a list of types. For each add a property to kwObj with the value of
+    // {type: "atom", style: "atom"}
+    var types = ['xs:anyAtomicType', 'xs:anySimpleType', 'xs:anyType', 'xs:anyURI',
+    'xs:base64Binary', 'xs:boolean', 'xs:byte', 'xs:date', 'xs:dateTime', 'xs:dateTimeStamp',
+    'xs:dayTimeDuration', 'xs:decimal', 'xs:double', 'xs:duration', 'xs:ENTITIES', 'xs:ENTITY',
+    'xs:float', 'xs:gDay', 'xs:gMonth', 'xs:gMonthDay', 'xs:gYear', 'xs:gYearMonth', 'xs:hexBinary',
+    'xs:ID', 'xs:IDREF', 'xs:IDREFS', 'xs:int', 'xs:integer', 'xs:item', 'xs:java', 'xs:language',
+    'xs:long', 'xs:Name', 'xs:NCName', 'xs:negativeInteger', 'xs:NMTOKEN', 'xs:NMTOKENS',
+    'xs:nonNegativeInteger', 'xs:nonPositiveInteger', 'xs:normalizedString', 'xs:NOTATION',
+    'xs:numeric', 'xs:positiveInteger', 'xs:precisionDecimal', 'xs:QName', 'xs:short', 'xs:string',
+    'xs:time', 'xs:token', 'xs:unsignedByte', 'xs:unsignedInt', 'xs:unsignedLong',
+    'xs:unsignedShort', 'xs:untyped', 'xs:untypedAtomic', 'xs:yearMonthDuration'];
+    for(var i=0, l=types.length; i < l; i++) { kwObj[types[i]] = atom;};
+
+    // each operator will add a property to kwObj with value of {type: "operator", style: "keyword"}
+    var operators = ['eq', 'ne', 'lt', 'le', 'gt', 'ge', ':=', '=', '>', '>=', '<', '<=', '.', '|', '?', 'and', 'or', 'div', 'idiv', 'mod', '*', '/', '+', '-'];
+    for(var i=0, l=operators.length; i < l; i++) { kwObj[operators[i]] = operator;};
+
+    // each axis_specifiers will add a property to kwObj with value of {type: "axis_specifier", style: "qualifier"}
+    var axis_specifiers = ["self::", "attribute::", "child::", "descendant::", "descendant-or-self::", "parent::",
+    "ancestor::", "ancestor-or-self::", "following::", "preceding::", "following-sibling::", "preceding-sibling::"];
+    for(var i=0, l=axis_specifiers.length; i < l; i++) { kwObj[axis_specifiers[i]] = qualifier; };
+
+    return kwObj;
+  }();
+
+  function chain(stream, state, f) {
+    state.tokenize = f;
+    return f(stream, state);
+  }
+
+  // the primary mode tokenizer
+  function tokenBase(stream, state) {
+    var ch = stream.next(),
+        mightBeFunction = false,
+        isEQName = isEQNameAhead(stream);
+
+    // an XML tag (if not in some sub, chained tokenizer)
+    if (ch == "<") {
+      if(stream.match("!--", true))
+        return chain(stream, state, tokenXMLComment);
+
+      if(stream.match("![CDATA", false)) {
+        state.tokenize = tokenCDATA;
+        return "tag";
+      }
+
+      if(stream.match("?", false)) {
+        return chain(stream, state, tokenPreProcessing);
+      }
+
+      var isclose = stream.eat("/");
+      stream.eatSpace();
+      var tagName = "", c;
+      while ((c = stream.eat(/[^\s\u00a0=<>\"\'\/?]/))) tagName += c;
+
+      return chain(stream, state, tokenTag(tagName, isclose));
+    }
+    // start code block
+    else if(ch == "{") {
+      pushStateStack(state, { type: "codeblock"});
+      return null;
+    }
+    // end code block
+    else if(ch == "}") {
+      popStateStack(state);
+      return null;
+    }
+    // if we're in an XML block
+    else if(isInXmlBlock(state)) {
+      if(ch == ">")
+        return "tag";
+      else if(ch == "/" && stream.eat(">")) {
+        popStateStack(state);
+        return "tag";
+      }
+      else
+        return "variable";
+    }
+    // if a number
+    else if (/\d/.test(ch)) {
+      stream.match(/^\d*(?:\.\d*)?(?:E[+\-]?\d+)?/);
+      return "atom";
+    }
+    // comment start
+    else if (ch === "(" && stream.eat(":")) {
+      pushStateStack(state, { type: "comment"});
+      return chain(stream, state, tokenComment);
+    }
+    // quoted string
+    else if (!isEQName && (ch === '"' || ch === "'"))
+      return chain(stream, state, tokenString(ch));
+    // variable
+    else if(ch === "$") {
+      return chain(stream, state, tokenVariable);
+    }
+    // assignment
+    else if(ch ===":" && stream.eat("=")) {
+      return "keyword";
+    }
+    // open paren
+    else if(ch === "(") {
+      pushStateStack(state, { type: "paren"});
+      return null;
+    }
+    // close paren
+    else if(ch === ")") {
+      popStateStack(state);
+      return null;
+    }
+    // open paren
+    else if(ch === "[") {
+      pushStateStack(state, { type: "bracket"});
+      return null;
+    }
+    // close paren
+    else if(ch === "]") {
+      popStateStack(state);
+      return null;
+    }
+    else {
+      var known = keywords.propertyIsEnumerable(ch) && keywords[ch];
+
+      // if there's a EQName ahead, consume the rest of the string portion, it's likely a function
+      if(isEQName && ch === '\"') while(stream.next() !== '"'){}
+      if(isEQName && ch === '\'') while(stream.next() !== '\''){}
+
+      // gobble up a word if the character is not known
+      if(!known) stream.eatWhile(/[\w\$_-]/);
+
+      // gobble a colon in the case that is a lib func type call fn:doc
+      var foundColon = stream.eat(":");
+
+      // if there's not a second colon, gobble another word. Otherwise, it's probably an axis specifier
+      // which should get matched as a keyword
+      if(!stream.eat(":") && foundColon) {
+        stream.eatWhile(/[\w\$_-]/);
+      }
+      // if the next non whitespace character is an open paren, this is probably a function (if not a keyword of other sort)
+      if(stream.match(/^[ \t]*\(/, false)) {
+        mightBeFunction = true;
+      }
+      // is the word a keyword?
+      var word = stream.current();
+      known = keywords.propertyIsEnumerable(word) && keywords[word];
+
+      // if we think it's a function call but not yet known,
+      // set style to variable for now for lack of something better
+      if(mightBeFunction && !known) known = {type: "function_call", style: "variable def"};
+
+      // if the previous word was element, attribute, axis specifier, this word should be the name of that
+      if(isInXmlConstructor(state)) {
+        popStateStack(state);
+        return "variable";
+      }
+      // as previously checked, if the word is element,attribute, axis specifier, call it an "xmlconstructor" and
+      // push the stack so we know to look for it on the next word
+      if(word == "element" || word == "attribute" || known.type == "axis_specifier") pushStateStack(state, {type: "xmlconstructor"});
+
+      // if the word is known, return the details of that else just call this a generic 'word'
+      return known ? known.style : "variable";
+    }
+  }
+
+  // handle comments, including nested
+  function tokenComment(stream, state) {
+    var maybeEnd = false, maybeNested = false, nestedCount = 0, ch;
+    while (ch = stream.next()) {
+      if (ch == ")" && maybeEnd) {
+        if(nestedCount > 0)
+          nestedCount--;
+        else {
+          popStateStack(state);
+          break;
+        }
+      }
+      else if(ch == ":" && maybeNested) {
+        nestedCount++;
+      }
+      maybeEnd = (ch == ":");
+      maybeNested = (ch == "(");
+    }
+
+    return "comment";
+  }
+
+  // tokenizer for string literals
+  // optionally pass a tokenizer function to set state.tokenize back to when finished
+  function tokenString(quote, f) {
+    return function(stream, state) {
+      var ch;
+
+      if(isInString(state) && stream.current() == quote) {
+        popStateStack(state);
+        if(f) state.tokenize = f;
+        return "string";
+      }
+
+      pushStateStack(state, { type: "string", name: quote, tokenize: tokenString(quote, f) });
+
+      // if we're in a string and in an XML block, allow an embedded code block
+      if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
+        state.tokenize = tokenBase;
+        return "string";
+      }
+
+
+      while (ch = stream.next()) {
+        if (ch ==  quote) {
+          popStateStack(state);
+          if(f) state.tokenize = f;
+          break;
+        }
+        else {
+          // if we're in a string and in an XML block, allow an embedded code block in an attribute
+          if(stream.match("{", false) && isInXmlAttributeBlock(state)) {
+            state.tokenize = tokenBase;
+            return "string";
+          }
+
+        }
+      }
+
+      return "string";
+    };
+  }
+
+  // tokenizer for variables
+  function tokenVariable(stream, state) {
+    var isVariableChar = /[\w\$_-]/;
+
+    // a variable may start with a quoted EQName so if the next character is quote, consume to the next quote
+    if(stream.eat("\"")) {
+      while(stream.next() !== '\"'){};
+      stream.eat(":");
+    } else {
+      stream.eatWhile(isVariableChar);
+      if(!stream.match(":=", false)) stream.eat(":");
+    }
+    stream.eatWhile(isVariableChar);
+    state.tokenize = tokenBase;
+    return "variable";
+  }
+
+  // tokenizer for XML tags
+  function tokenTag(name, isclose) {
+    return function(stream, state) {
+      stream.eatSpace();
+      if(isclose && stream.eat(">")) {
+        popStateStack(state);
+        state.tokenize = tokenBase;
+        return "tag";
+      }
+      // self closing tag without attributes?
+      if(!stream.eat("/"))
+        pushStateStack(state, { type: "tag", name: name, tokenize: tokenBase});
+      if(!stream.eat(">")) {
+        state.tokenize = tokenAttribute;
+        return "tag";
+      }
+      else {
+        state.tokenize = tokenBase;
+      }
+      return "tag";
+    };
+  }
+
+  // tokenizer for XML attributes
+  function tokenAttribute(stream, state) {
+    var ch = stream.next();
+
+    if(ch == "/" && stream.eat(">")) {
+      if(isInXmlAttributeBlock(state)) popStateStack(state);
+      if(isInXmlBlock(state)) popStateStack(state);
+      return "tag";
+    }
+    if(ch == ">") {
+      if(isInXmlAttributeBlock(state)) popStateStack(state);
+      return "tag";
+    }
+    if(ch == "=")
+      return null;
+    // quoted string
+    if (ch == '"' || ch == "'")
+      return chain(stream, state, tokenString(ch, tokenAttribute));
+
+    if(!isInXmlAttributeBlock(state))
+      pushStateStack(state, { type: "attribute", tokenize: tokenAttribute});
+
+    stream.eat(/[a-zA-Z_:]/);
+    stream.eatWhile(/[-a-zA-Z0-9_:.]/);
+    stream.eatSpace();
+
+    // the case where the attribute has not value and the tag was closed
+    if(stream.match(">", false) || stream.match("/", false)) {
+      popStateStack(state);
+      state.tokenize = tokenBase;
+    }
+
+    return "attribute";
+  }
+
+  // handle comments, including nested
+  function tokenXMLComment(stream, state) {
+    var ch;
+    while (ch = stream.next()) {
+      if (ch == "-" && stream.match("->", true)) {
+        state.tokenize = tokenBase;
+        return "comment";
+      }
+    }
+  }
+
+
+  // handle CDATA
+  function tokenCDATA(stream, state) {
+    var ch;
+    while (ch = stream.next()) {
+      if (ch == "]" && stream.match("]", true)) {
+        state.tokenize = tokenBase;
+        return "comment";
+      }
+    }
+  }
+
+  // handle preprocessing instructions
+  function tokenPreProcessing(stream, state) {
+    var ch;
+    while (ch = stream.next()) {
+      if (ch == "?" && stream.match(">", true)) {
+        state.tokenize = tokenBase;
+        return "comment meta";
+      }
+    }
+  }
+
+
+  // functions to test the current context of the state
+  function isInXmlBlock(state) { return isIn(state, "tag"); }
+  function isInXmlAttributeBlock(state) { return isIn(state, "attribute"); }
+  function isInXmlConstructor(state) { return isIn(state, "xmlconstructor"); }
+  function isInString(state) { return isIn(state, "string"); }
+
+  function isEQNameAhead(stream) {
+    // assume we've already eaten a quote (")
+    if(stream.current() === '"')
+      return stream.match(/^[^\"]+\"\:/, false);
+    else if(stream.current() === '\'')
+      return stream.match(/^[^\"]+\'\:/, false);
+    else
+      return false;
+  }
+
+  function isIn(state, type) {
+    return (state.stack.length && state.stack[state.stack.length - 1].type == type);
+  }
+
+  function pushStateStack(state, newState) {
+    state.stack.push(newState);
+  }
+
+  function popStateStack(state) {
+    state.stack.pop();
+    var reinstateTokenize = state.stack.length && state.stack[state.stack.length-1].tokenize;
+    state.tokenize = reinstateTokenize || tokenBase;
+  }
+
+  // the interface for the mode API
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase,
+        cc: [],
+        stack: []
+      };
+    },
+
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      var style = state.tokenize(stream, state);
+      return style;
+    },
+
+    blockCommentStart: "(:",
+    blockCommentEnd: ":)"
+
+  };
+
+});
+
+CodeMirror.defineMIME("application/xquery", "xquery");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/yacas/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,87 @@
+<!doctype html>
+
+<title>CodeMirror: yacas mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel=stylesheet href=../../lib/codemirror.css>
+<script src=../../lib/codemirror.js></script>
+<script src=../../addon/edit/matchbrackets.js></script>
+<script src=yacas.js></script>
+<style type=text/css>
+  .CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}
+</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">yacas</a>
+  </ul>
+</div>
+
+<article>
+<h2>yacas mode</h2>
+
+
+<textarea id="yacasCode">
+// example yacas code
+Graph(edges_IsList) <-- [
+    Local(v, e, f, t);
+
+    vertices := {};
+
+    ForEach (e, edges) [
+        If (IsList(e), e := Head(e));
+        {f, t} := Tail(Listify(e));
+
+        DestructiveAppend(vertices, f);
+        DestructiveAppend(vertices, t);
+    ];
+
+    Graph(RemoveDuplicates(vertices), edges);
+];
+
+10 # IsGraph(Graph(vertices_IsList, edges_IsList)) <-- True;
+20 # IsGraph(_x) <-- False;
+
+Edges(Graph(vertices_IsList, edges_IsList)) <-- edges;
+Vertices(Graph(vertices_IsList, edges_IsList)) <-- vertices;
+
+AdjacencyList(g_IsGraph) <-- [
+    Local(l, vertices, edges, e, op, f, t);
+
+    l := Association'Create();
+
+    vertices := Vertices(g);
+    ForEach (v, vertices)
+        Association'Set(l, v, {});
+
+    edges := Edges(g);
+
+    ForEach(e, edges) [
+        If (IsList(e), e := Head(e));
+        {op, f, t} := Listify(e);
+        DestructiveAppend(Association'Get(l, f), t);
+        If (String(op) = "<->", DestructiveAppend(Association'Get(l, t), f));
+    ];
+
+    l;
+];
+</textarea>
+
+<script>
+  var yacasEditor = CodeMirror.fromTextArea(document.getElementById('yacasCode'), {
+    mode: 'text/x-yacas',
+    lineNumbers: true,
+    matchBrackets: true
+  });
+</script>
+
+<p><strong>MIME types defined:</strong> <code>text/x-yacas</code> (yacas).</p>
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/yacas/yacas.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,204 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// Yacas mode copyright (c) 2015 by Grzegorz Mazur
+// Loosely based on mathematica mode by Calin Barbat
+
+(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.defineMode('yacas', function(_config, _parserConfig) {
+
+  function words(str) {
+    var obj = {}, words = str.split(" ");
+    for (var i = 0; i < words.length; ++i) obj[words[i]] = true;
+    return obj;
+  }
+
+  var bodiedOps = words("Assert BackQuote D Defun Deriv For ForEach FromFile " +
+                        "FromString Function Integrate InverseTaylor Limit " +
+                        "LocalSymbols Macro MacroRule MacroRulePattern " +
+                        "NIntegrate Rule RulePattern Subst TD TExplicitSum " +
+                        "TSum Taylor Taylor1 Taylor2 Taylor3 ToFile " +
+                        "ToStdout ToString TraceRule Until While");
+
+  // patterns
+  var pFloatForm  = "(?:(?:\\.\\d+|\\d+\\.\\d*|\\d+)(?:[eE][+-]?\\d+)?)";
+  var pIdentifier = "(?:[a-zA-Z\\$'][a-zA-Z0-9\\$']*)";
+
+  // regular expressions
+  var reFloatForm    = new RegExp(pFloatForm);
+  var reIdentifier   = new RegExp(pIdentifier);
+  var rePattern      = new RegExp(pIdentifier + "?_" + pIdentifier);
+  var reFunctionLike = new RegExp(pIdentifier + "\\s*\\(");
+
+  function tokenBase(stream, state) {
+    var ch;
+
+    // get next character
+    ch = stream.next();
+
+    // string
+    if (ch === '"') {
+      state.tokenize = tokenString;
+      return state.tokenize(stream, state);
+    }
+
+    // comment
+    if (ch === '/') {
+      if (stream.eat('*')) {
+        state.tokenize = tokenComment;
+        return state.tokenize(stream, state);
+      }
+      if (stream.eat("/")) {
+        stream.skipToEnd();
+        return "comment";
+      }
+    }
+
+    // go back one character
+    stream.backUp(1);
+
+    // update scope info
+    var m = stream.match(/^(\w+)\s*\(/, false);
+    if (m !== null && bodiedOps.hasOwnProperty(m[1]))
+      state.scopes.push('bodied');
+
+    var scope = currentScope(state);
+
+    if (scope === 'bodied' && ch === '[')
+      state.scopes.pop();
+
+    if (ch === '[' || ch === '{' || ch === '(')
+      state.scopes.push(ch);
+
+    scope = currentScope(state);
+
+    if (scope === '[' && ch === ']' ||
+        scope === '{' && ch === '}' ||
+        scope === '(' && ch === ')')
+      state.scopes.pop();
+
+    if (ch === ';') {
+      while (scope === 'bodied') {
+        state.scopes.pop();
+        scope = currentScope(state);
+      }
+    }
+
+    // look for ordered rules
+    if (stream.match(/\d+ *#/, true, false)) {
+      return 'qualifier';
+    }
+
+    // look for numbers
+    if (stream.match(reFloatForm, true, false)) {
+      return 'number';
+    }
+
+    // look for placeholders
+    if (stream.match(rePattern, true, false)) {
+      return 'variable-3';
+    }
+
+    // match all braces separately
+    if (stream.match(/(?:\[|\]|{|}|\(|\))/, true, false)) {
+      return 'bracket';
+    }
+
+    // literals looking like function calls
+    if (stream.match(reFunctionLike, true, false)) {
+      stream.backUp(1);
+      return 'variable';
+    }
+
+    // all other identifiers
+    if (stream.match(reIdentifier, true, false)) {
+      return 'variable-2';
+    }
+
+    // operators; note that operators like @@ or /; are matched separately for each symbol.
+    if (stream.match(/(?:\\|\+|\-|\*|\/|,|;|\.|:|@|~|=|>|<|&|\||_|`|'|\^|\?|!|%|#)/, true, false)) {
+      return 'operator';
+    }
+
+    // everything else is an error
+    return 'error';
+  }
+
+  function tokenString(stream, state) {
+    var next, end = false, escaped = false;
+    while ((next = stream.next()) != null) {
+      if (next === '"' && !escaped) {
+        end = true;
+        break;
+      }
+      escaped = !escaped && next === '\\';
+    }
+    if (end && !escaped) {
+      state.tokenize = tokenBase;
+    }
+    return 'string';
+  };
+
+  function tokenComment(stream, state) {
+    var prev, next;
+    while((next = stream.next()) != null) {
+      if (prev === '*' && next === '/') {
+        state.tokenize = tokenBase;
+        break;
+      }
+      prev = next;
+    }
+    return 'comment';
+  }
+
+  function currentScope(state) {
+    var scope = null;
+    if (state.scopes.length > 0)
+      scope = state.scopes[state.scopes.length - 1];
+    return scope;
+  }
+
+  return {
+    startState: function() {
+      return {
+        tokenize: tokenBase,
+        scopes: []
+      };
+    },
+    token: function(stream, state) {
+      if (stream.eatSpace()) return null;
+      return state.tokenize(stream, state);
+    },
+    indent: function(state, textAfter) {
+      if (state.tokenize !== tokenBase && state.tokenize !== null)
+        return CodeMirror.Pass;
+
+      var delta = 0;
+      if (textAfter === ']' || textAfter === '];' ||
+          textAfter === '}' || textAfter === '};' ||
+          textAfter === ');')
+        delta = -1;
+
+      return (state.scopes.length + delta) * _config.indentUnit;
+    },
+    electricChars: "{}[]();",
+    blockCommentStart: "/*",
+    blockCommentEnd: "*/",
+    lineComment: "//"
+  };
+});
+
+CodeMirror.defineMIME('text/x-yacas', {
+  name: 'yacas'
+});
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/yaml-frontmatter/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,121 @@
+<!doctype html>
+
+<title>CodeMirror: YAML front matter mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="../../addon/mode/overlay.js"></script>
+<script src="../markdown/markdown.js"></script>
+<script src="../gfm/gfm.js"></script>
+<script src="../yaml/yaml.js"></script>
+<script src="yaml-frontmatter.js"></script>
+<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">YAML-Frontmatter</a>
+  </ul>
+</div>
+
+<article>
+<h2>YAML front matter mode</h2>
+<form><textarea id="code" name="code">
+---
+receipt:     Oz-Ware Purchase Invoice
+date:        2007-08-06
+customer:
+    given:   Dorothy
+    family:  Gale
+
+items:
+    - part_no:   A4786
+      descrip:   Water Bucket (Filled)
+      price:     1.47
+      quantity:  4
+
+    - part_no:   E1628
+      descrip:   High Heeled "Ruby" Slippers
+      size:       8
+      price:     100.27
+      quantity:  1
+
+bill-to:  &id001
+    street: |
+            123 Tornado Alley
+            Suite 16
+    city:   East Centerville
+    state:  KS
+
+ship-to:  *id001
+
+specialDelivery:  >
+    Follow the Yellow Brick
+    Road to the Emerald City.
+    Pay no attention to the
+    man behind the curtain.
+---
+
+GitHub Flavored Markdown
+========================
+
+Everything from markdown plus GFM features:
+
+## URL autolinking
+
+Underscores_are_allowed_between_words.
+
+## Strikethrough text
+
+GFM adds syntax to strikethrough text, which is missing from standard Markdown.
+
+~~Mistaken text.~~
+~~**works with other formatting**~~
+
+~~spans across
+lines~~
+
+## Fenced code blocks (and syntax highlighting)
+
+```javascript
+for (var i = 0; i &lt; items.length; i++) {
+    console.log(items[i], i); // log them
+}
+```
+
+## Task Lists
+
+- [ ] Incomplete task list item
+- [x] **Completed** task list item
+
+## A bit of GitHub spice
+
+* SHA: be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* User@SHA ref: mojombo@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* User/Project@SHA: mojombo/god@be6a8cc1c1ecfe9489fb51e4869af15a13fc2cd2
+* \#Num: #1
+* User/#Num: mojombo#1
+* User/Project#Num: mojombo/god#1
+
+See http://github.github.com/github-flavored-markdown/.
+</textarea></form>
+
+<p>Defines a mode that parses
+a <a href="http://jekyllrb.com/docs/frontmatter/">YAML frontmatter</a>
+at the start of a file, switching to a base mode at the end of that.
+Takes a mode configuration option <code>base</code> to configure the
+base mode, which defaults to <code>"gfm"</code>.</p>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {mode: "yaml-frontmatter"});
+    </script>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function (mod) {
+  if (typeof exports == "object" && typeof module == "object") // CommonJS
+    mod(require("../../lib/codemirror"), require("../yaml/yaml"))
+  else if (typeof define == "function" && define.amd) // AMD
+    define(["../../lib/codemirror", "../yaml/yaml"], mod)
+  else // Plain browser env
+    mod(CodeMirror)
+})(function (CodeMirror) {
+
+  var START = 0, FRONTMATTER = 1, BODY = 2
+
+  // a mixed mode for Markdown text with an optional YAML front matter
+  CodeMirror.defineMode("yaml-frontmatter", function (config, parserConfig) {
+    var yamlMode = CodeMirror.getMode(config, "yaml")
+    var innerMode = CodeMirror.getMode(config, parserConfig && parserConfig.base || "gfm")
+
+    function localMode(state) {
+      return state.state == FRONTMATTER ? {mode: yamlMode, state: state.yaml} : {mode: innerMode, state: state.inner}
+    }
+
+    return {
+      startState: function () {
+        return {
+          state: START,
+          yaml: null,
+          inner: CodeMirror.startState(innerMode)
+        }
+      },
+      copyState: function (state) {
+        return {
+          state: state.state,
+          yaml: state.yaml && CodeMirror.copyState(yamlMode, state.yaml),
+          inner: CodeMirror.copyState(innerMode, state.inner)
+        }
+      },
+      token: function (stream, state) {
+        if (state.state == START) {
+          if (stream.match('---', false)) {
+            state.state = FRONTMATTER
+            state.yaml = CodeMirror.startState(yamlMode)
+            return yamlMode.token(stream, state.yaml)
+          } else {
+            state.state = BODY
+            return innerMode.token(stream, state.inner)
+          }
+        } else if (state.state == FRONTMATTER) {
+          var end = stream.sol() && stream.match(/(---|\.\.\.)/, false)
+          var style = yamlMode.token(stream, state.yaml)
+          if (end) {
+            state.state = BODY
+            state.yaml = null
+          }
+          return style
+        } else {
+          return innerMode.token(stream, state.inner)
+        }
+      },
+      innerMode: localMode,
+      indent: function(state, a, b) {
+        var m = localMode(state)
+        return m.mode.indent ? m.mode.indent(m.state, a, b) : CodeMirror.Pass
+      },
+      blankLine: function (state) {
+        var m = localMode(state)
+        if (m.mode.blankLine) return m.mode.blankLine(m.state)
+      }
+    }
+  })
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/yaml/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,80 @@
+<!doctype html>
+
+<title>CodeMirror: YAML mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="yaml.js"></script>
+<style>.CodeMirror { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; }</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">YAML</a>
+  </ul>
+</div>
+
+<article>
+<h2>YAML mode</h2>
+<form><textarea id="code" name="code">
+--- # Favorite movies
+- Casablanca
+- North by Northwest
+- The Man Who Wasn't There
+--- # Shopping list
+[milk, pumpkin pie, eggs, juice]
+--- # Indented Blocks, common in YAML data files, use indentation and new lines to separate the key: value pairs
+  name: John Smith
+  age: 33
+--- # Inline Blocks, common in YAML data streams, use commas to separate the key: value pairs between braces
+{name: John Smith, age: 33}
+---
+receipt:     Oz-Ware Purchase Invoice
+date:        2007-08-06
+customer:
+    given:   Dorothy
+    family:  Gale
+
+items:
+    - part_no:   A4786
+      descrip:   Water Bucket (Filled)
+      price:     1.47
+      quantity:  4
+
+    - part_no:   E1628
+      descrip:   High Heeled "Ruby" Slippers
+      size:       8
+      price:     100.27
+      quantity:  1
+
+bill-to:  &id001
+    street: |
+            123 Tornado Alley
+            Suite 16
+    city:   East Centerville
+    state:  KS
+
+ship-to:  *id001
+
+specialDelivery:  >
+    Follow the Yellow Brick
+    Road to the Emerald City.
+    Pay no attention to the
+    man behind the curtain.
+...
+</textarea></form>
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-yaml</code>.</p>
+
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/yaml/yaml.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,120 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode("yaml", function() {
+
+  var cons = ['true', 'false', 'on', 'off', 'yes', 'no'];
+  var keywordRegex = new RegExp("\\b(("+cons.join(")|(")+"))$", 'i');
+
+  return {
+    token: function(stream, state) {
+      var ch = stream.peek();
+      var esc = state.escaped;
+      state.escaped = false;
+      /* comments */
+      if (ch == "#" && (stream.pos == 0 || /\s/.test(stream.string.charAt(stream.pos - 1)))) {
+        stream.skipToEnd();
+        return "comment";
+      }
+
+      if (stream.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))
+        return "string";
+
+      if (state.literal && stream.indentation() > state.keyCol) {
+        stream.skipToEnd(); return "string";
+      } else if (state.literal) { state.literal = false; }
+      if (stream.sol()) {
+        state.keyCol = 0;
+        state.pair = false;
+        state.pairStart = false;
+        /* document start */
+        if(stream.match('---')) { return "def"; }
+        /* document end */
+        if (stream.match('...')) { return "def"; }
+        /* array list item */
+        if (stream.match(/\s*-\s+/)) { return 'meta'; }
+      }
+      /* inline pairs/lists */
+      if (stream.match(/^(\{|\}|\[|\])/)) {
+        if (ch == '{')
+          state.inlinePairs++;
+        else if (ch == '}')
+          state.inlinePairs--;
+        else if (ch == '[')
+          state.inlineList++;
+        else
+          state.inlineList--;
+        return 'meta';
+      }
+
+      /* list separator */
+      if (state.inlineList > 0 && !esc && ch == ',') {
+        stream.next();
+        return 'meta';
+      }
+      /* pairs separator */
+      if (state.inlinePairs > 0 && !esc && ch == ',') {
+        state.keyCol = 0;
+        state.pair = false;
+        state.pairStart = false;
+        stream.next();
+        return 'meta';
+      }
+
+      /* start of value of a pair */
+      if (state.pairStart) {
+        /* block literals */
+        if (stream.match(/^\s*(\||\>)\s*/)) { state.literal = true; return 'meta'; };
+        /* references */
+        if (stream.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i)) { return 'variable-2'; }
+        /* numbers */
+        if (state.inlinePairs == 0 && stream.match(/^\s*-?[0-9\.\,]+\s?$/)) { return 'number'; }
+        if (state.inlinePairs > 0 && stream.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/)) { return 'number'; }
+        /* keywords */
+        if (stream.match(keywordRegex)) { return 'keyword'; }
+      }
+
+      /* pairs (associative arrays) -> key */
+      if (!state.pair && stream.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^\s,\[\]{}#&*!|>'"%@`])[^#:]*(?=:($|\s))/)) {
+        state.pair = true;
+        state.keyCol = stream.indentation();
+        return "atom";
+      }
+      if (state.pair && stream.match(/^:\s*/)) { state.pairStart = true; return 'meta'; }
+
+      /* nothing found, continue */
+      state.pairStart = false;
+      state.escaped = (ch == '\\');
+      stream.next();
+      return null;
+    },
+    startState: function() {
+      return {
+        pair: false,
+        pairStart: false,
+        keyCol: 0,
+        inlinePairs: 0,
+        inlineList: 0,
+        literal: false,
+        escaped: false
+      };
+    },
+    lineComment: "#",
+    fold: "indent"
+  };
+});
+
+CodeMirror.defineMIME("text/x-yaml", "yaml");
+CodeMirror.defineMIME("text/yaml", "yaml");
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/z80/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,53 @@
+<!doctype html>
+
+<title>CodeMirror: Z80 assembly mode</title>
+<meta charset="utf-8"/>
+<link rel=stylesheet href="../../doc/docs.css">
+
+<link rel="stylesheet" href="../../lib/codemirror.css">
+<script src="../../lib/codemirror.js"></script>
+<script src="z80.js"></script>
+<style>.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../../doc/logo.png" alt=""></a>
+
+  <ul>
+    <li><a href="../../index.html">Home</a>
+    <li><a href="../../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a href="../index.html">Language modes</a>
+    <li><a class=active href="#">Z80 assembly</a>
+  </ul>
+</div>
+
+<article>
+<h2>Z80 assembly mode</h2>
+
+
+<div><textarea id="code" name="code">
+#include    "ti83plus.inc"
+#define     progStart   $9D95
+    .org progStart-2
+    .db $BB,$6D
+
+    bcall(_ClrLCDFull)
+    ld hl,0
+    ld (CurCol),hl
+    ld hl,Message
+    bcall(_PutS) ; Displays the string
+    bcall(_NewLine)
+    ret
+Message:
+    .db "Hello world!",0
+</textarea></div>
+
+    <script>
+      var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
+        lineNumbers: true
+      });
+    </script>
+
+    <p><strong>MIME types defined:</strong> <code>text/x-z80</code>, <code>text/x-ez80</code>.</p>
+  </article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/mode/z80/z80.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,116 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/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.defineMode('z80', function(_config, parserConfig) {
+  var ez80 = parserConfig.ez80;
+  var keywords1, keywords2;
+  if (ez80) {
+    keywords1 = /^(exx?|(ld|cp)([di]r?)?|[lp]ea|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|[de]i|halt|im|in([di]mr?|ir?|irx|2r?)|ot(dmr?|[id]rx|imr?)|out(0?|[di]r?|[di]2r?)|tst(io)?|slp)(\.([sl]?i)?[sl])?\b/i;
+    keywords2 = /^(((call|j[pr]|rst|ret[in]?)(\.([sl]?i)?[sl])?)|(rs|st)mix)\b/i;
+  } else {
+    keywords1 = /^(exx?|(ld|cp|in)([di]r?)?|pop|push|ad[cd]|cpl|daa|dec|inc|neg|sbc|sub|and|bit|[cs]cf|x?or|res|set|r[lr]c?a?|r[lr]d|s[lr]a|srl|djnz|nop|rst|[de]i|halt|im|ot[di]r|out[di]?)\b/i;
+    keywords2 = /^(call|j[pr]|ret[in]?|b_?(call|jump))\b/i;
+  }
+
+  var variables1 = /^(af?|bc?|c|de?|e|hl?|l|i[xy]?|r|sp)\b/i;
+  var variables2 = /^(n?[zc]|p[oe]?|m)\b/i;
+  var errors = /^([hl][xy]|i[xy][hl]|slia|sll)\b/i;
+  var numbers = /^([\da-f]+h|[0-7]+o|[01]+b|\d+d?)\b/i;
+
+  return {
+    startState: function() {
+      return {
+        context: 0
+      };
+    },
+    token: function(stream, state) {
+      if (!stream.column())
+        state.context = 0;
+
+      if (stream.eatSpace())
+        return null;
+
+      var w;
+
+      if (stream.eatWhile(/\w/)) {
+        if (ez80 && stream.eat('.')) {
+          stream.eatWhile(/\w/);
+        }
+        w = stream.current();
+
+        if (stream.indentation()) {
+          if ((state.context == 1 || state.context == 4) && variables1.test(w)) {
+            state.context = 4;
+            return 'var2';
+          }
+
+          if (state.context == 2 && variables2.test(w)) {
+            state.context = 4;
+            return 'var3';
+          }
+
+          if (keywords1.test(w)) {
+            state.context = 1;
+            return 'keyword';
+          } else if (keywords2.test(w)) {
+            state.context = 2;
+            return 'keyword';
+          } else if (state.context == 4 && numbers.test(w)) {
+            return 'number';
+          }
+
+          if (errors.test(w))
+            return 'error';
+        } else if (stream.match(numbers)) {
+          return 'number';
+        } else {
+          return null;
+        }
+      } else if (stream.eat(';')) {
+        stream.skipToEnd();
+        return 'comment';
+      } else if (stream.eat('"')) {
+        while (w = stream.next()) {
+          if (w == '"')
+            break;
+
+          if (w == '\\')
+            stream.next();
+        }
+        return 'string';
+      } else if (stream.eat('\'')) {
+        if (stream.match(/\\?.'/))
+          return 'number';
+      } else if (stream.eat('.') || stream.sol() && stream.eat('#')) {
+        state.context = 5;
+
+        if (stream.eatWhile(/\w/))
+          return 'def';
+      } else if (stream.eat('$')) {
+        if (stream.eatWhile(/[\da-f]/i))
+          return 'number';
+      } else if (stream.eat('%')) {
+        if (stream.eatWhile(/[01]/))
+          return 'number';
+      } else {
+        stream.next();
+      }
+      return null;
+    }
+  };
+});
+
+CodeMirror.defineMIME("text/x-z80", "z80");
+CodeMirror.defineMIME("text/x-ez80", { name: "z80", ez80: true });
+
+});
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/package.json	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+{
+  "name": "codemirror",
+  "version": "5.65.18",
+  "main": "lib/codemirror.js",
+  "style": "lib/codemirror.css",
+  "author": {
+    "name": "Marijn Haverbeke",
+    "email": "marijn@haverbeke.berlin",
+    "url": "http://marijnhaverbeke.nl"
+  },
+  "description": "Full-featured in-browser code editor",
+  "license": "MIT",
+  "directories": {
+    "lib": "./lib"
+  },
+  "scripts": {
+    "build": "rollup -c",
+    "watch": "rollup -w -c",
+    "prepare": "npm run-script build",
+    "test": "node ./test/run.js",
+    "lint": "bin/lint"
+  },
+  "devDependencies": {
+    "@rollup/plugin-buble": "^0.21.3",
+    "blint": "^1.1.2",
+    "cm5-vim": "^0.0.5",
+    "node-static": "0.7.11",
+    "puppeteer": "^1.20.0",
+    "rollup": "^1.26.3",
+    "rollup-plugin-copy": "^3.4.0"
+  },
+  "bugs": "http://github.com/codemirror/CodeMirror/issues",
+  "keywords": [
+    "JavaScript",
+    "CodeMirror",
+    "Editor"
+  ],
+  "homepage": "https://codemirror.net/5/",
+  "repository": {
+    "type": "git",
+    "url": "https://github.com/codemirror/CodeMirror.git"
+  },
+  "jspm": {
+    "directories": {},
+    "dependencies": {},
+    "devDependencies": {}
+  },
+  "dependencies": {},
+  "publishConfig": {
+    "tag": "version5"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/rollup.config.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+import buble from '@rollup/plugin-buble';
+import copy from 'rollup-plugin-copy'
+
+let copyVim = copy({
+  targets: [
+    { 
+      src: require.resolve("cm5-vim/vim.js").replace(/\\/g,  "/"), 
+      dest: "./keymap" 
+    }
+  ]
+});
+
+export default [
+  {
+    input: "src/codemirror.js",
+    output: {
+      banner: `// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+// This is CodeMirror (https://codemirror.net/5), a code editor
+// implemented in JavaScript on top of the browser's DOM.
+//
+// You can find some technical background for some of the code below
+// at http://marijnhaverbeke.nl/blog/#cm-internals .
+`,
+      format: "umd",
+      file: "lib/codemirror.js",
+      name: "CodeMirror"
+    },
+    plugins: [ buble({namedFunctionExpressions: false}), copyVim ]
+  },
+  {
+    input: ["src/addon/runmode/runmode-standalone.js"],
+    output: {
+      format: "iife",
+      file: "addon/runmode/runmode-standalone.js",
+      name: "CodeMirror",
+      freeze: false, // IE8 doesn't support Object.freeze.
+    },
+    plugins: [ buble({namedFunctionExpressions: false}) ]
+  },
+  {
+    input: ["src/addon/runmode/runmode.node.js"],
+    output: {
+      format: "cjs",
+      file: "addon/runmode/runmode.node.js",
+      name: "CodeMirror",
+      freeze: false, // IE8 doesn't support Object.freeze.
+    },
+    plugins: [ buble({namedFunctionExpressions: false}) ]
+  },
+];
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/addon/runmode/codemirror-standalone.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,24 @@
+import StringStream from "../../util/StringStream.js"
+import { countColumn } from "../../util/misc.js"
+import * as modeMethods from "../../modes.js"
+
+// declare global: globalThis, CodeMirror
+
+// Create a minimal CodeMirror needed to use runMode, and assign to root.
+var root = typeof globalThis !== 'undefined' ? globalThis : window
+root.CodeMirror = {}
+
+// Copy StringStream and mode methods into CodeMirror object.
+CodeMirror.StringStream = StringStream
+for (var exported in modeMethods) CodeMirror[exported] = modeMethods[exported]
+
+// Minimal default mode.
+CodeMirror.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
+CodeMirror.defineMIME("text/plain", "null")
+
+CodeMirror.registerHelper = CodeMirror.registerGlobalHelper = Math.min
+CodeMirror.splitLines = function(string) { return string.split(/\r?\n|\r/) }
+CodeMirror.countColumn = countColumn
+
+CodeMirror.defaults = { indentUnit: 2 }
+export default CodeMirror
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/addon/runmode/codemirror.node.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,21 @@
+import StringStream from "../../util/StringStream.js"
+import * as modeMethods from "../../modes.js"
+import {countColumn} from "../../util/misc.js"
+
+// Copy StringStream and mode methods into exports (CodeMirror) object.
+exports.StringStream = StringStream
+exports.countColumn = countColumn
+for (var exported in modeMethods) exports[exported] = modeMethods[exported]
+
+// Shim library CodeMirror with the minimal CodeMirror defined above.
+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")]
+
+// Minimal default mode.
+exports.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
+exports.defineMIME("text/plain", "null")
+
+exports.registerHelper = exports.registerGlobalHelper = Math.min
+exports.splitLines = function(string) { return string.split(/\r?\n|\r/) }
+
+exports.defaults = { indentUnit: 2 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/addon/runmode/runmode-standalone.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,2 @@
+import "./codemirror-standalone.js"
+import "../../../addon/runmode/runmode.js"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/addon/runmode/runmode.node.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,2 @@
+import "./codemirror.node.js"
+import "../../../addon/runmode/runmode.js"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/codemirror.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,3 @@
+import { CodeMirror } from "./edit/main.js"
+
+export default CodeMirror
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/Display.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,116 @@
+import { gecko, ie, ie_version, mobile, webkit, chrome, chrome_version } from "../util/browser.js"
+import { elt, eltP } from "../util/dom.js"
+import { scrollerGap } from "../util/misc.js"
+import { getGutters, renderGutters } from "./gutters.js"
+
+// The display handles the DOM integration, both for input reading
+// and content drawing. It holds references to DOM nodes and
+// display-related state.
+
+export function Display(place, doc, input, options) {
+  let d = this
+  this.input = input
+
+  // Covers bottom-right square when both scrollbars are present.
+  d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
+  d.scrollbarFiller.setAttribute("cm-not-content", "true")
+  // Covers bottom of gutter when coverGutterNextToScrollbar is on
+  // and h scrollbar is present.
+  d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
+  d.gutterFiller.setAttribute("cm-not-content", "true")
+  // Will contain the actual code, positioned to cover the viewport.
+  d.lineDiv = eltP("div", null, "CodeMirror-code")
+  // Elements are added to these to represent selection and cursors.
+  d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
+  d.cursorDiv = elt("div", null, "CodeMirror-cursors")
+  // A visibility: hidden element used to find the size of things.
+  d.measure = elt("div", null, "CodeMirror-measure")
+  // When lines outside of the viewport are measured, they are drawn in this.
+  d.lineMeasure = elt("div", null, "CodeMirror-measure")
+  // Wraps everything that needs to exist inside the vertically-padded coordinate system
+  d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
+                    null, "position: relative; outline: none")
+  let lines = eltP("div", [d.lineSpace], "CodeMirror-lines")
+  // Moved around its parent to cover visible view.
+  d.mover = elt("div", [lines], null, "position: relative")
+  // Set to the height of the document, allowing scrolling.
+  d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
+  d.sizerWidth = null
+  // Behavior of elts with overflow: auto and padding is
+  // inconsistent across browsers. This is used to ensure the
+  // scrollable area is big enough.
+  d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
+  // Will contain the gutters, if any.
+  d.gutters = elt("div", null, "CodeMirror-gutters")
+  d.lineGutter = null
+  // Actual scrollable element.
+  d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
+  d.scroller.setAttribute("tabIndex", "-1")
+  // The element in which the editor lives.
+  d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
+  // See #6982. FIXME remove when this has been fixed for a while in Chrome
+  if (chrome && chrome_version >= 105) d.wrapper.style.clipPath = "inset(0px)"
+
+  // This attribute is respected by automatic translation systems such as Google Translate,
+  // and may also be respected by tools used by human translators.
+  d.wrapper.setAttribute('translate', 'no')
+
+  // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
+  if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
+  if (!webkit && !(gecko && mobile)) d.scroller.draggable = true
+
+  if (place) {
+    if (place.appendChild) place.appendChild(d.wrapper)
+    else place(d.wrapper)
+  }
+
+  // Current rendered range (may be bigger than the view window).
+  d.viewFrom = d.viewTo = doc.first
+  d.reportedViewFrom = d.reportedViewTo = doc.first
+  // Information about the rendered lines.
+  d.view = []
+  d.renderedView = null
+  // Holds info about a single rendered line when it was rendered
+  // for measurement, while not in view.
+  d.externalMeasured = null
+  // Empty space (in pixels) above the view
+  d.viewOffset = 0
+  d.lastWrapHeight = d.lastWrapWidth = 0
+  d.updateLineNumbers = null
+
+  d.nativeBarWidth = d.barHeight = d.barWidth = 0
+  d.scrollbarsClipped = false
+
+  // Used to only resize the line number gutter when necessary (when
+  // the amount of lines crosses a boundary that makes its width change)
+  d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
+  // Set to true when a non-horizontal-scrolling line widget is
+  // added. As an optimization, line widget aligning is skipped when
+  // this is false.
+  d.alignWidgets = false
+
+  d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
+
+  // Tracks the maximum line length so that the horizontal scrollbar
+  // can be kept static when scrolling.
+  d.maxLine = null
+  d.maxLineLength = 0
+  d.maxLineChanged = false
+
+  // Used for measuring wheel scrolling granularity
+  d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
+
+  // True when shift is held down.
+  d.shift = false
+
+  // Used to track whether anything happened since the context menu
+  // was opened.
+  d.selForContextMenu = null
+
+  d.activeTouch = null
+
+  d.gutterSpecs = getGutters(options.gutters, options.lineNumbers)
+  renderGutters(d)
+
+  input.init(d)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/focus.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,50 @@
+import { restartBlink } from "./selection.js"
+import { webkit } from "../util/browser.js"
+import { addClass, rmClass } from "../util/dom.js"
+import { signal } from "../util/event.js"
+
+export function ensureFocus(cm) {
+  if (!cm.hasFocus()) {
+    cm.display.input.focus()
+    if (!cm.state.focused) onFocus(cm)
+  }
+}
+
+export function delayBlurEvent(cm) {
+  cm.state.delayingBlurEvent = true
+  setTimeout(() => { if (cm.state.delayingBlurEvent) {
+    cm.state.delayingBlurEvent = false
+    if (cm.state.focused) onBlur(cm)
+  } }, 100)
+}
+
+export function onFocus(cm, e) {
+  if (cm.state.delayingBlurEvent && !cm.state.draggingText) cm.state.delayingBlurEvent = false
+
+  if (cm.options.readOnly == "nocursor") return
+  if (!cm.state.focused) {
+    signal(cm, "focus", cm, e)
+    cm.state.focused = true
+    addClass(cm.display.wrapper, "CodeMirror-focused")
+    // This test prevents this from firing when a context
+    // menu is closed (since the input reset would kill the
+    // select-all detection hack)
+    if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
+      cm.display.input.reset()
+      if (webkit) setTimeout(() => cm.display.input.reset(true), 20) // Issue #1730
+    }
+    cm.display.input.receivedFocus()
+  }
+  restartBlink(cm)
+}
+export function onBlur(cm, e) {
+  if (cm.state.delayingBlurEvent) return
+
+  if (cm.state.focused) {
+    signal(cm, "blur", cm, e)
+    cm.state.focused = false
+    rmClass(cm.display.wrapper, "CodeMirror-focused")
+  }
+  clearInterval(cm.display.blinker)
+  setTimeout(() => { if (!cm.state.focused) cm.display.shift = false }, 150)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/gutters.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+import { elt, removeChildren } from "../util/dom.js"
+import { regChange } from "./view_tracking.js"
+import { alignHorizontally } from "./line_numbers.js"
+import { updateGutterSpace } from "./update_display.js"
+
+export function getGutters(gutters, lineNumbers) {
+  let result = [], sawLineNumbers = false
+  for (let i = 0; i < gutters.length; i++) {
+    let name = gutters[i], style = null
+    if (typeof name != "string") { style = name.style; name = name.className }
+    if (name == "CodeMirror-linenumbers") {
+      if (!lineNumbers) continue
+      else sawLineNumbers = true
+    }
+    result.push({className: name, style})
+  }
+  if (lineNumbers && !sawLineNumbers) result.push({className: "CodeMirror-linenumbers", style: null})
+  return result
+}
+
+// Rebuild the gutter elements, ensure the margin to the left of the
+// code matches their width.
+export function renderGutters(display) {
+  let gutters = display.gutters, specs = display.gutterSpecs
+  removeChildren(gutters)
+  display.lineGutter = null
+  for (let i = 0; i < specs.length; ++i) {
+    let {className, style} = specs[i]
+    let gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className))
+    if (style) gElt.style.cssText = style
+    if (className == "CodeMirror-linenumbers") {
+      display.lineGutter = gElt
+      gElt.style.width = (display.lineNumWidth || 1) + "px"
+    }
+  }
+  gutters.style.display = specs.length ? "" : "none"
+  updateGutterSpace(display)
+}
+
+export function updateGutters(cm) {
+  renderGutters(cm.display)
+  regChange(cm)
+  alignHorizontally(cm)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/highlight_worker.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,55 @@
+import { getContextBefore, highlightLine, processLine } from "../line/highlight.js"
+import { copyState } from "../modes.js"
+import { bind } from "../util/misc.js"
+
+import { runInOp } from "./operations.js"
+import { regLineChange } from "./view_tracking.js"
+
+// HIGHLIGHT WORKER
+
+export function startWorker(cm, time) {
+  if (cm.doc.highlightFrontier < cm.display.viewTo)
+    cm.state.highlight.set(time, bind(highlightWorker, cm))
+}
+
+function highlightWorker(cm) {
+  let doc = cm.doc
+  if (doc.highlightFrontier >= cm.display.viewTo) return
+  let end = +new Date + cm.options.workTime
+  let context = getContextBefore(cm, doc.highlightFrontier)
+  let changedLines = []
+
+  doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), line => {
+    if (context.line >= cm.display.viewFrom) { // Visible
+      let oldStyles = line.styles
+      let resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null
+      let highlighted = highlightLine(cm, line, context, true)
+      if (resetState) context.state = resetState
+      line.styles = highlighted.styles
+      let oldCls = line.styleClasses, newCls = highlighted.classes
+      if (newCls) line.styleClasses = newCls
+      else if (oldCls) line.styleClasses = null
+      let ischange = !oldStyles || oldStyles.length != line.styles.length ||
+        oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
+      for (let i = 0; !ischange && i < oldStyles.length; ++i) ischange = oldStyles[i] != line.styles[i]
+      if (ischange) changedLines.push(context.line)
+      line.stateAfter = context.save()
+      context.nextLine()
+    } else {
+      if (line.text.length <= cm.options.maxHighlightLength)
+        processLine(cm, line.text, context)
+      line.stateAfter = context.line % 5 == 0 ? context.save() : null
+      context.nextLine()
+    }
+    if (+new Date > end) {
+      startWorker(cm, cm.options.workDelay)
+      return true
+    }
+  })
+  doc.highlightFrontier = context.line
+  doc.modeFrontier = Math.max(doc.modeFrontier, context.line)
+  if (changedLines.length) runInOp(cm, () => {
+    for (let i = 0; i < changedLines.length; i++)
+      regLineChange(cm, changedLines[i], "text")
+  })
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/line_numbers.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,48 @@
+import { lineNumberFor } from "../line/utils_line.js"
+import { compensateForHScroll } from "../measurement/position_measurement.js"
+import { elt } from "../util/dom.js"
+
+import { updateGutterSpace } from "./update_display.js"
+
+// Re-align line numbers and gutter marks to compensate for
+// horizontal scrolling.
+export function alignHorizontally(cm) {
+  let display = cm.display, view = display.view
+  if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) return
+  let comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
+  let gutterW = display.gutters.offsetWidth, left = comp + "px"
+  for (let i = 0; i < view.length; i++) if (!view[i].hidden) {
+    if (cm.options.fixedGutter) {
+      if (view[i].gutter)
+        view[i].gutter.style.left = left
+      if (view[i].gutterBackground)
+        view[i].gutterBackground.style.left = left
+    }
+    let align = view[i].alignable
+    if (align) for (let j = 0; j < align.length; j++)
+      align[j].style.left = left
+  }
+  if (cm.options.fixedGutter)
+    display.gutters.style.left = (comp + gutterW) + "px"
+}
+
+// Used to ensure that the line number gutter is still the right
+// size for the current document size. Returns true when an update
+// is needed.
+export function maybeUpdateLineNumberWidth(cm) {
+  if (!cm.options.lineNumbers) return false
+  let doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
+  if (last.length != display.lineNumChars) {
+    let test = display.measure.appendChild(elt("div", [elt("div", last)],
+                                               "CodeMirror-linenumber CodeMirror-gutter-elt"))
+    let innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
+    display.lineGutter.style.width = ""
+    display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
+    display.lineNumWidth = display.lineNumInnerWidth + padding
+    display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
+    display.lineGutter.style.width = display.lineNumWidth + "px"
+    updateGutterSpace(cm.display)
+    return true
+  }
+  return false
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/mode_state.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,22 @@
+import { getMode } from "../modes.js"
+
+import { startWorker } from "./highlight_worker.js"
+import { regChange } from "./view_tracking.js"
+
+// Used to get the editor into a consistent state again when options change.
+
+export function loadMode(cm) {
+  cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
+  resetModeState(cm)
+}
+
+export function resetModeState(cm) {
+  cm.doc.iter(line => {
+    if (line.stateAfter) line.stateAfter = null
+    if (line.styles) line.styles = null
+  })
+  cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first
+  startWorker(cm, 100)
+  cm.state.modeGen++
+  if (cm.curOp) regChange(cm)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/operations.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,206 @@
+import { clipPos } from "../line/pos.js"
+import { findMaxLine } from "../line/spans.js"
+import { displayWidth, measureChar, scrollGap } from "../measurement/position_measurement.js"
+import { signal } from "../util/event.js"
+import { activeElt, root } from "../util/dom.js"
+import { finishOperation, pushOperation } from "../util/operation_group.js"
+
+import { ensureFocus } from "./focus.js"
+import { measureForScrollbars, updateScrollbars } from "./scrollbars.js"
+import { restartBlink } from "./selection.js"
+import { maybeScrollWindow, scrollPosIntoView, setScrollLeft, setScrollTop } from "./scrolling.js"
+import { DisplayUpdate, maybeClipScrollbars, postUpdateDisplay, setDocumentHeight, updateDisplayIfNeeded } from "./update_display.js"
+import { updateHeightsInViewport } from "./update_lines.js"
+
+// Operations are used to wrap a series of changes to the editor
+// state in such a way that each change won't have to update the
+// cursor and display (which would be awkward, slow, and
+// error-prone). Instead, display updates are batched and then all
+// combined and executed at once.
+
+let nextOpId = 0
+// Start a new operation.
+export function startOperation(cm) {
+  cm.curOp = {
+    cm: cm,
+    viewChanged: false,      // Flag that indicates that lines might need to be redrawn
+    startHeight: cm.doc.height, // Used to detect need to update scrollbar
+    forceUpdate: false,      // Used to force a redraw
+    updateInput: 0,       // Whether to reset the input textarea
+    typing: false,           // Whether this reset should be careful to leave existing text (for compositing)
+    changeObjs: null,        // Accumulated changes, for firing change events
+    cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
+    cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
+    selectionChanged: false, // Whether the selection needs to be redrawn
+    updateMaxLine: false,    // Set when the widest line needs to be determined anew
+    scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
+    scrollToPos: null,       // Used to scroll to a specific position
+    focus: false,
+    id: ++nextOpId,          // Unique ID
+    markArrays: null         // Used by addMarkedSpan
+  }
+  pushOperation(cm.curOp)
+}
+
+// Finish an operation, updating the display and signalling delayed events
+export function endOperation(cm) {
+  let op = cm.curOp
+  if (op) finishOperation(op, group => {
+    for (let i = 0; i < group.ops.length; i++)
+      group.ops[i].cm.curOp = null
+    endOperations(group)
+  })
+}
+
+// The DOM updates done when an operation finishes are batched so
+// that the minimum number of relayouts are required.
+function endOperations(group) {
+  let ops = group.ops
+  for (let i = 0; i < ops.length; i++) // Read DOM
+    endOperation_R1(ops[i])
+  for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
+    endOperation_W1(ops[i])
+  for (let i = 0; i < ops.length; i++) // Read DOM
+    endOperation_R2(ops[i])
+  for (let i = 0; i < ops.length; i++) // Write DOM (maybe)
+    endOperation_W2(ops[i])
+  for (let i = 0; i < ops.length; i++) // Read DOM
+    endOperation_finish(ops[i])
+}
+
+function endOperation_R1(op) {
+  let cm = op.cm, display = cm.display
+  maybeClipScrollbars(cm)
+  if (op.updateMaxLine) findMaxLine(cm)
+
+  op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
+    op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
+                       op.scrollToPos.to.line >= display.viewTo) ||
+    display.maxLineChanged && cm.options.lineWrapping
+  op.update = op.mustUpdate &&
+    new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate)
+}
+
+function endOperation_W1(op) {
+  op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)
+}
+
+function endOperation_R2(op) {
+  let cm = op.cm, display = cm.display
+  if (op.updatedDisplay) updateHeightsInViewport(cm)
+
+  op.barMeasure = measureForScrollbars(cm)
+
+  // If the max line changed since it was last measured, measure it,
+  // and ensure the document's width matches it.
+  // updateDisplay_W2 will use these properties to do the actual resizing
+  if (display.maxLineChanged && !cm.options.lineWrapping) {
+    op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3
+    cm.display.sizerWidth = op.adjustWidthTo
+    op.barMeasure.scrollWidth =
+      Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth)
+    op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))
+  }
+
+  if (op.updatedDisplay || op.selectionChanged)
+    op.preparedSelection = display.input.prepareSelection()
+}
+
+function endOperation_W2(op) {
+  let cm = op.cm
+
+  if (op.adjustWidthTo != null) {
+    cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"
+    if (op.maxScrollLeft < cm.doc.scrollLeft)
+      setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true)
+    cm.display.maxLineChanged = false
+  }
+
+  let takeFocus = op.focus && op.focus == activeElt(root(cm))
+  if (op.preparedSelection)
+    cm.display.input.showSelection(op.preparedSelection, takeFocus)
+  if (op.updatedDisplay || op.startHeight != cm.doc.height)
+    updateScrollbars(cm, op.barMeasure)
+  if (op.updatedDisplay)
+    setDocumentHeight(cm, op.barMeasure)
+
+  if (op.selectionChanged) restartBlink(cm)
+
+  if (cm.state.focused && op.updateInput)
+    cm.display.input.reset(op.typing)
+  if (takeFocus) ensureFocus(op.cm)
+}
+
+function endOperation_finish(op) {
+  let cm = op.cm, display = cm.display, doc = cm.doc
+
+  if (op.updatedDisplay) postUpdateDisplay(cm, op.update)
+
+  // Abort mouse wheel delta measurement, when scrolling explicitly
+  if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
+    display.wheelStartX = display.wheelStartY = null
+
+  // Propagate the scroll position to the actual DOM scroller
+  if (op.scrollTop != null) setScrollTop(cm, op.scrollTop, op.forceScroll)
+
+  if (op.scrollLeft != null) setScrollLeft(cm, op.scrollLeft, true, true)
+  // If we need to scroll a specific position into view, do so.
+  if (op.scrollToPos) {
+    let rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
+                                 clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin)
+    maybeScrollWindow(cm, rect)
+  }
+
+  // Fire events for markers that are hidden/unidden by editing or
+  // undoing
+  let hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers
+  if (hidden) for (let i = 0; i < hidden.length; ++i)
+    if (!hidden[i].lines.length) signal(hidden[i], "hide")
+  if (unhidden) for (let i = 0; i < unhidden.length; ++i)
+    if (unhidden[i].lines.length) signal(unhidden[i], "unhide")
+
+  if (display.wrapper.offsetHeight)
+    doc.scrollTop = cm.display.scroller.scrollTop
+
+  // Fire change events, and delayed event handlers
+  if (op.changeObjs)
+    signal(cm, "changes", cm, op.changeObjs)
+  if (op.update)
+    op.update.finish()
+}
+
+// Run the given function in an operation
+export function runInOp(cm, f) {
+  if (cm.curOp) return f()
+  startOperation(cm)
+  try { return f() }
+  finally { endOperation(cm) }
+}
+// Wraps a function in an operation. Returns the wrapped function.
+export function operation(cm, f) {
+  return function() {
+    if (cm.curOp) return f.apply(cm, arguments)
+    startOperation(cm)
+    try { return f.apply(cm, arguments) }
+    finally { endOperation(cm) }
+  }
+}
+// Used to add methods to editor and doc instances, wrapping them in
+// operations.
+export function methodOp(f) {
+  return function() {
+    if (this.curOp) return f.apply(this, arguments)
+    startOperation(this)
+    try { return f.apply(this, arguments) }
+    finally { endOperation(this) }
+  }
+}
+export function docMethodOp(f) {
+  return function() {
+    let cm = this.cm
+    if (!cm || cm.curOp) return f.apply(this, arguments)
+    startOperation(cm)
+    try { return f.apply(this, arguments) }
+    finally { endOperation(cm) }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/scroll_events.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,132 @@
+import { chrome, chrome_version, gecko, ie, mac, presto, safari, webkit } from "../util/browser.js"
+import { e_preventDefault } from "../util/event.js"
+
+import { updateDisplaySimple } from "./update_display.js"
+import { setScrollLeft, updateScrollTop } from "./scrolling.js"
+
+// Since the delta values reported on mouse wheel events are
+// unstandardized between browsers and even browser versions, and
+// generally horribly unpredictable, this code starts by measuring
+// the scroll effect that the first few mouse wheel events have,
+// and, from that, detects the way it can convert deltas to pixel
+// offsets afterwards.
+//
+// The reason we want to know the amount a wheel event will scroll
+// is that it gives us a chance to update the display before the
+// actual scrolling happens, reducing flickering.
+
+let wheelSamples = 0, wheelPixelsPerUnit = null
+// Fill in a browser-detected starting value on browsers where we
+// know one. These don't have to be accurate -- the result of them
+// being wrong would just be a slight flicker on the first wheel
+// scroll (if it is large enough).
+if (ie) wheelPixelsPerUnit = -.53
+else if (gecko) wheelPixelsPerUnit = 15
+else if (chrome) wheelPixelsPerUnit = -.7
+else if (safari) wheelPixelsPerUnit = -1/3
+
+function wheelEventDelta(e) {
+  let dx = e.wheelDeltaX, dy = e.wheelDeltaY
+  if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail
+  if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail
+  else if (dy == null) dy = e.wheelDelta
+  return {x: dx, y: dy}
+}
+export function wheelEventPixels(e) {
+  let delta = wheelEventDelta(e)
+  delta.x *= wheelPixelsPerUnit
+  delta.y *= wheelPixelsPerUnit
+  return delta
+}
+
+export function onScrollWheel(cm, e) {
+  // On Chrome 102, viewport updates somehow stop wheel-based
+  // scrolling. Turning off pointer events during the scroll seems
+  // to avoid the issue.
+  if (chrome && chrome_version == 102) {
+    if (cm.display.chromeScrollHack == null) cm.display.sizer.style.pointerEvents = "none"
+    else clearTimeout(cm.display.chromeScrollHack)
+    cm.display.chromeScrollHack = setTimeout(() => {
+      cm.display.chromeScrollHack = null
+      cm.display.sizer.style.pointerEvents = ""
+    }, 100)
+  }
+  let delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
+  let pixelsPerUnit = wheelPixelsPerUnit
+  if (e.deltaMode === 0) {
+    dx = e.deltaX
+    dy = e.deltaY
+    pixelsPerUnit = 1
+  }
+
+  let display = cm.display, scroll = display.scroller
+  // Quit if there's nothing to scroll here
+  let canScrollX = scroll.scrollWidth > scroll.clientWidth
+  let canScrollY = scroll.scrollHeight > scroll.clientHeight
+  if (!(dx && canScrollX || dy && canScrollY)) return
+
+  // Webkit browsers on OS X abort momentum scrolls when the target
+  // of the scroll event is removed from the scrollable element.
+  // This hack (see related code in patchDisplay) makes sure the
+  // element is kept around.
+  if (dy && mac && webkit) {
+    outer: for (let cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
+      for (let i = 0; i < view.length; i++) {
+        if (view[i].node == cur) {
+          cm.display.currentWheelTarget = cur
+          break outer
+        }
+      }
+    }
+  }
+
+  // On some browsers, horizontal scrolling will cause redraws to
+  // happen before the gutter has been realigned, causing it to
+  // wriggle around in a most unseemly way. When we have an
+  // estimated pixels/delta value, we just handle horizontal
+  // scrolling entirely here. It'll be slightly off from native, but
+  // better than glitching out.
+  if (dx && !gecko && !presto && pixelsPerUnit != null) {
+    if (dy && canScrollY)
+      updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit))
+    setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit))
+    // Only prevent default scrolling if vertical scrolling is
+    // actually possible. Otherwise, it causes vertical scroll
+    // jitter on OSX trackpads when deltaX is small and deltaY
+    // is large (issue #3579)
+    if (!dy || (dy && canScrollY))
+      e_preventDefault(e)
+    display.wheelStartX = null // Abort measurement, if in progress
+    return
+  }
+
+  // 'Project' the visible viewport to cover the area that is being
+  // scrolled into view (if we know enough to estimate it).
+  if (dy && pixelsPerUnit != null) {
+    let pixels = dy * pixelsPerUnit
+    let top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight
+    if (pixels < 0) top = Math.max(0, top + pixels - 50)
+    else bot = Math.min(cm.doc.height, bot + pixels + 50)
+    updateDisplaySimple(cm, {top: top, bottom: bot})
+  }
+
+  if (wheelSamples < 20 && e.deltaMode !== 0) {
+    if (display.wheelStartX == null) {
+      display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop
+      display.wheelDX = dx; display.wheelDY = dy
+      setTimeout(() => {
+        if (display.wheelStartX == null) return
+        let movedX = scroll.scrollLeft - display.wheelStartX
+        let movedY = scroll.scrollTop - display.wheelStartY
+        let sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
+          (movedX && display.wheelDX && movedX / display.wheelDX)
+        display.wheelStartX = display.wheelStartY = null
+        if (!sample) return
+        wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1)
+        ++wheelSamples
+      }, 200)
+    } else {
+      display.wheelDX += dx; display.wheelDY += dy
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/scrollbars.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,194 @@
+import { addClass, elt, rmClass } from "../util/dom.js"
+import { on } from "../util/event.js"
+import { scrollGap, paddingVert } from "../measurement/position_measurement.js"
+import { ie, ie_version, mac, mac_geMountainLion } from "../util/browser.js"
+import { updateHeightsInViewport } from "./update_lines.js"
+import { Delayed } from "../util/misc.js"
+
+import { setScrollLeft, updateScrollTop } from "./scrolling.js"
+
+// SCROLLBARS
+
+// Prepare DOM reads needed to update the scrollbars. Done in one
+// shot to minimize update/measure roundtrips.
+export function measureForScrollbars(cm) {
+  let d = cm.display, gutterW = d.gutters.offsetWidth
+  let docH = Math.round(cm.doc.height + paddingVert(cm.display))
+  return {
+    clientHeight: d.scroller.clientHeight,
+    viewHeight: d.wrapper.clientHeight,
+    scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
+    viewWidth: d.wrapper.clientWidth,
+    barLeft: cm.options.fixedGutter ? gutterW : 0,
+    docHeight: docH,
+    scrollHeight: docH + scrollGap(cm) + d.barHeight,
+    nativeBarWidth: d.nativeBarWidth,
+    gutterWidth: gutterW
+  }
+}
+
+class NativeScrollbars {
+  constructor(place, scroll, cm) {
+    this.cm = cm
+    let vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar")
+    let horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar")
+    vert.tabIndex = horiz.tabIndex = -1
+    place(vert); place(horiz)
+
+    on(vert, "scroll", () => {
+      if (vert.clientHeight) scroll(vert.scrollTop, "vertical")
+    })
+    on(horiz, "scroll", () => {
+      if (horiz.clientWidth) scroll(horiz.scrollLeft, "horizontal")
+    })
+
+    this.checkedZeroWidth = false
+    // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
+    if (ie && ie_version < 8) this.horiz.style.minHeight = this.vert.style.minWidth = "18px"
+  }
+
+  update(measure) {
+    let needsH = measure.scrollWidth > measure.clientWidth + 1
+    let needsV = measure.scrollHeight > measure.clientHeight + 1
+    let sWidth = measure.nativeBarWidth
+
+    if (needsV) {
+      this.vert.style.display = "block"
+      this.vert.style.bottom = needsH ? sWidth + "px" : "0"
+      let totalHeight = measure.viewHeight - (needsH ? sWidth : 0)
+      // A bug in IE8 can cause this value to be negative, so guard it.
+      this.vert.firstChild.style.height =
+        Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"
+    } else {
+      this.vert.scrollTop = 0
+      this.vert.style.display = ""
+      this.vert.firstChild.style.height = "0"
+    }
+
+    if (needsH) {
+      this.horiz.style.display = "block"
+      this.horiz.style.right = needsV ? sWidth + "px" : "0"
+      this.horiz.style.left = measure.barLeft + "px"
+      let totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0)
+      this.horiz.firstChild.style.width =
+        Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"
+    } else {
+      this.horiz.style.display = ""
+      this.horiz.firstChild.style.width = "0"
+    }
+
+    if (!this.checkedZeroWidth && measure.clientHeight > 0) {
+      if (sWidth == 0) this.zeroWidthHack()
+      this.checkedZeroWidth = true
+    }
+
+    return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
+  }
+
+  setScrollLeft(pos) {
+    if (this.horiz.scrollLeft != pos) this.horiz.scrollLeft = pos
+    if (this.disableHoriz) this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz")
+  }
+
+  setScrollTop(pos) {
+    if (this.vert.scrollTop != pos) this.vert.scrollTop = pos
+    if (this.disableVert) this.enableZeroWidthBar(this.vert, this.disableVert, "vert")
+  }
+
+  zeroWidthHack() {
+    let w = mac && !mac_geMountainLion ? "12px" : "18px"
+    this.horiz.style.height = this.vert.style.width = w
+    this.horiz.style.visibility = this.vert.style.visibility = "hidden"
+    this.disableHoriz = new Delayed
+    this.disableVert = new Delayed
+  }
+
+  enableZeroWidthBar(bar, delay, type) {
+    bar.style.visibility = ""
+    function maybeDisable() {
+      // To find out whether the scrollbar is still visible, we
+      // check whether the element under the pixel in the bottom
+      // right corner of the scrollbar box is the scrollbar box
+      // itself (when the bar is still visible) or its filler child
+      // (when the bar is hidden). If it is still visible, we keep
+      // it enabled, if it's hidden, we disable pointer events.
+      let box = bar.getBoundingClientRect()
+      let elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
+          : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1)
+      if (elt != bar) bar.style.visibility = "hidden"
+      else delay.set(1000, maybeDisable)
+    }
+    delay.set(1000, maybeDisable)
+  }
+
+  clear() {
+    let parent = this.horiz.parentNode
+    parent.removeChild(this.horiz)
+    parent.removeChild(this.vert)
+  }
+}
+
+class NullScrollbars {
+  update() { return {bottom: 0, right: 0} }
+  setScrollLeft() {}
+  setScrollTop() {}
+  clear() {}
+}
+
+export function updateScrollbars(cm, measure) {
+  if (!measure) measure = measureForScrollbars(cm)
+  let startWidth = cm.display.barWidth, startHeight = cm.display.barHeight
+  updateScrollbarsInner(cm, measure)
+  for (let i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
+    if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
+      updateHeightsInViewport(cm)
+    updateScrollbarsInner(cm, measureForScrollbars(cm))
+    startWidth = cm.display.barWidth; startHeight = cm.display.barHeight
+  }
+}
+
+// Re-synchronize the fake scrollbars with the actual size of the
+// content.
+function updateScrollbarsInner(cm, measure) {
+  let d = cm.display
+  let sizes = d.scrollbars.update(measure)
+
+  d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"
+  d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"
+  d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
+
+  if (sizes.right && sizes.bottom) {
+    d.scrollbarFiller.style.display = "block"
+    d.scrollbarFiller.style.height = sizes.bottom + "px"
+    d.scrollbarFiller.style.width = sizes.right + "px"
+  } else d.scrollbarFiller.style.display = ""
+  if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
+    d.gutterFiller.style.display = "block"
+    d.gutterFiller.style.height = sizes.bottom + "px"
+    d.gutterFiller.style.width = measure.gutterWidth + "px"
+  } else d.gutterFiller.style.display = ""
+}
+
+export let scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}
+
+export function initScrollbars(cm) {
+  if (cm.display.scrollbars) {
+    cm.display.scrollbars.clear()
+    if (cm.display.scrollbars.addClass)
+      rmClass(cm.display.wrapper, cm.display.scrollbars.addClass)
+  }
+
+  cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](node => {
+    cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller)
+    // Prevent clicks in the scrollbars from killing focus
+    on(node, "mousedown", () => {
+      if (cm.state.focused) setTimeout(() => cm.display.input.focus(), 0)
+    })
+    node.setAttribute("cm-not-content", "true")
+  }, (pos, axis) => {
+    if (axis == "horizontal") setScrollLeft(cm, pos)
+    else updateScrollTop(cm, pos)
+  }, cm)
+  if (cm.display.scrollbars.addClass)
+    addClass(cm.display.wrapper, cm.display.scrollbars.addClass)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/scrolling.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,186 @@
+import { Pos } from "../line/pos.js"
+import { cursorCoords, displayHeight, displayWidth, estimateCoords, paddingTop, paddingVert, scrollGap, textHeight } from "../measurement/position_measurement.js"
+import { gecko, phantom } from "../util/browser.js"
+import { elt } from "../util/dom.js"
+import { signalDOMEvent } from "../util/event.js"
+
+import { startWorker } from "./highlight_worker.js"
+import { alignHorizontally } from "./line_numbers.js"
+import { updateDisplaySimple } from "./update_display.js"
+
+// SCROLLING THINGS INTO VIEW
+
+// If an editor sits on the top or bottom of the window, partially
+// scrolled out of view, this ensures that the cursor is visible.
+export function maybeScrollWindow(cm, rect) {
+  if (signalDOMEvent(cm, "scrollCursorIntoView")) return
+
+  let display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null
+  let doc = display.wrapper.ownerDocument
+  if (rect.top + box.top < 0) doScroll = true
+  else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) doScroll = false
+  if (doScroll != null && !phantom) {
+    let scrollNode = elt("div", "\u200b", null, `position: absolute;
+                         top: ${rect.top - display.viewOffset - paddingTop(cm.display)}px;
+                         height: ${rect.bottom - rect.top + scrollGap(cm) + display.barHeight}px;
+                         left: ${rect.left}px; width: ${Math.max(2, rect.right - rect.left)}px;`)
+    cm.display.lineSpace.appendChild(scrollNode)
+    scrollNode.scrollIntoView(doScroll)
+    cm.display.lineSpace.removeChild(scrollNode)
+  }
+}
+
+// Scroll a given position into view (immediately), verifying that
+// it actually became visible (as line heights are accurately
+// measured, the position of something may 'drift' during drawing).
+export function scrollPosIntoView(cm, pos, end, margin) {
+  if (margin == null) margin = 0
+  let rect
+  if (!cm.options.lineWrapping && pos == end) {
+    // Set pos and end to the cursor positions around the character pos sticks to
+    // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
+    // If pos == Pos(_, 0, "before"), pos and end are unchanged
+    end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos
+    pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos
+  }
+  for (let limit = 0; limit < 5; limit++) {
+    let changed = false
+    let coords = cursorCoords(cm, pos)
+    let endCoords = !end || end == pos ? coords : cursorCoords(cm, end)
+    rect = {left: Math.min(coords.left, endCoords.left),
+            top: Math.min(coords.top, endCoords.top) - margin,
+            right: Math.max(coords.left, endCoords.left),
+            bottom: Math.max(coords.bottom, endCoords.bottom) + margin}
+    let scrollPos = calculateScrollPos(cm, rect)
+    let startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft
+    if (scrollPos.scrollTop != null) {
+      updateScrollTop(cm, scrollPos.scrollTop)
+      if (Math.abs(cm.doc.scrollTop - startTop) > 1) changed = true
+    }
+    if (scrollPos.scrollLeft != null) {
+      setScrollLeft(cm, scrollPos.scrollLeft)
+      if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) changed = true
+    }
+    if (!changed) break
+  }
+  return rect
+}
+
+// Scroll a given set of coordinates into view (immediately).
+export function scrollIntoView(cm, rect) {
+  let scrollPos = calculateScrollPos(cm, rect)
+  if (scrollPos.scrollTop != null) updateScrollTop(cm, scrollPos.scrollTop)
+  if (scrollPos.scrollLeft != null) setScrollLeft(cm, scrollPos.scrollLeft)
+}
+
+// Calculate a new scroll position needed to scroll the given
+// rectangle into view. Returns an object with scrollTop and
+// scrollLeft properties. When these are undefined, the
+// vertical/horizontal position does not need to be adjusted.
+function calculateScrollPos(cm, rect) {
+  let display = cm.display, snapMargin = textHeight(cm.display)
+  if (rect.top < 0) rect.top = 0
+  let screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop
+  let screen = displayHeight(cm), result = {}
+  if (rect.bottom - rect.top > screen) rect.bottom = rect.top + screen
+  let docBottom = cm.doc.height + paddingVert(display)
+  let atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin
+  if (rect.top < screentop) {
+    result.scrollTop = atTop ? 0 : rect.top
+  } else if (rect.bottom > screentop + screen) {
+    let newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)
+    if (newTop != screentop) result.scrollTop = newTop
+  }
+
+  let gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth
+  let screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace
+  let screenw = displayWidth(cm) - display.gutters.offsetWidth
+  let tooWide = rect.right - rect.left > screenw
+  if (tooWide) rect.right = rect.left + screenw
+  if (rect.left < 10)
+    result.scrollLeft = 0
+  else if (rect.left < screenleft)
+    result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10))
+  else if (rect.right > screenw + screenleft - 3)
+    result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw
+  return result
+}
+
+// Store a relative adjustment to the scroll position in the current
+// operation (to be applied when the operation finishes).
+export function addToScrollTop(cm, top) {
+  if (top == null) return
+  resolveScrollToPos(cm)
+  cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top
+}
+
+// Make sure that at the end of the operation the current cursor is
+// shown.
+export function ensureCursorVisible(cm) {
+  resolveScrollToPos(cm)
+  let cur = cm.getCursor()
+  cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin}
+}
+
+export function scrollToCoords(cm, x, y) {
+  if (x != null || y != null) resolveScrollToPos(cm)
+  if (x != null) cm.curOp.scrollLeft = x
+  if (y != null) cm.curOp.scrollTop = y
+}
+
+export function scrollToRange(cm, range) {
+  resolveScrollToPos(cm)
+  cm.curOp.scrollToPos = range
+}
+
+// When an operation has its scrollToPos property set, and another
+// scroll action is applied before the end of the operation, this
+// 'simulates' scrolling that position into view in a cheap way, so
+// that the effect of intermediate scroll commands is not ignored.
+function resolveScrollToPos(cm) {
+  let range = cm.curOp.scrollToPos
+  if (range) {
+    cm.curOp.scrollToPos = null
+    let from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)
+    scrollToCoordsRange(cm, from, to, range.margin)
+  }
+}
+
+export function scrollToCoordsRange(cm, from, to, margin) {
+  let sPos = calculateScrollPos(cm, {
+    left: Math.min(from.left, to.left),
+    top: Math.min(from.top, to.top) - margin,
+    right: Math.max(from.right, to.right),
+    bottom: Math.max(from.bottom, to.bottom) + margin
+  })
+  scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop)
+}
+
+// Sync the scrollable area and scrollbars, ensure the viewport
+// covers the visible area.
+export function updateScrollTop(cm, val) {
+  if (Math.abs(cm.doc.scrollTop - val) < 2) return
+  if (!gecko) updateDisplaySimple(cm, {top: val})
+  setScrollTop(cm, val, true)
+  if (gecko) updateDisplaySimple(cm)
+  startWorker(cm, 100)
+}
+
+export function setScrollTop(cm, val, forceScroll) {
+  val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val))
+  if (cm.display.scroller.scrollTop == val && !forceScroll) return
+  cm.doc.scrollTop = val
+  cm.display.scrollbars.setScrollTop(val)
+  if (cm.display.scroller.scrollTop != val) cm.display.scroller.scrollTop = val
+}
+
+// Sync scroller and scrollbar, ensure the gutter elements are
+// aligned.
+export function setScrollLeft(cm, val, isScroller, forceScroll) {
+  val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth))
+  if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) return
+  cm.doc.scrollLeft = val
+  alignHorizontally(cm)
+  if (cm.display.scroller.scrollLeft != val) cm.display.scroller.scrollLeft = val
+  cm.display.scrollbars.setScrollLeft(val)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/selection.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,173 @@
+import { Pos } from "../line/pos.js"
+import { visualLine } from "../line/spans.js"
+import { getLine } from "../line/utils_line.js"
+import { charCoords, cursorCoords, displayWidth, paddingH, wrappedLineExtentChar } from "../measurement/position_measurement.js"
+import { getOrder, iterateBidiSections } from "../util/bidi.js"
+import { elt } from "../util/dom.js"
+import { onBlur } from "./focus.js"
+
+export function updateSelection(cm) {
+  cm.display.input.showSelection(cm.display.input.prepareSelection())
+}
+
+export function prepareSelection(cm, primary = true) {
+  let doc = cm.doc, result = {}
+  let curFragment = result.cursors = document.createDocumentFragment()
+  let selFragment = result.selection = document.createDocumentFragment()
+
+  let customCursor = cm.options.$customCursor
+  if (customCursor) primary = true
+  for (let i = 0; i < doc.sel.ranges.length; i++) {
+    if (!primary && i == doc.sel.primIndex) continue
+    let range = doc.sel.ranges[i]
+    if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) continue
+    let collapsed = range.empty()
+    if (customCursor) {
+      let head = customCursor(cm, range)
+      if (head) drawSelectionCursor(cm, head, curFragment)
+    } else if (collapsed || cm.options.showCursorWhenSelecting) {
+      drawSelectionCursor(cm, range.head, curFragment)
+    }
+    if (!collapsed)
+      drawSelectionRange(cm, range, selFragment)
+  }
+  return result
+}
+
+// Draws a cursor for the given range
+export function drawSelectionCursor(cm, head, output) {
+  let pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine)
+
+  let cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"))
+  cursor.style.left = pos.left + "px"
+  cursor.style.top = pos.top + "px"
+  cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
+
+  if (/\bcm-fat-cursor\b/.test(cm.getWrapperElement().className)) {
+    let charPos = charCoords(cm, head, "div", null, null)
+    let width = charPos.right - charPos.left
+    cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + "px"
+  }
+
+  if (pos.other) {
+    // Secondary cursor, shown when on a 'jump' in bi-directional text
+    let otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))
+    otherCursor.style.display = ""
+    otherCursor.style.left = pos.other.left + "px"
+    otherCursor.style.top = pos.other.top + "px"
+    otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"
+  }
+}
+
+function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
+
+// Draws the given range as a highlighted selection
+function drawSelectionRange(cm, range, output) {
+  let display = cm.display, doc = cm.doc
+  let fragment = document.createDocumentFragment()
+  let padding = paddingH(cm.display), leftSide = padding.left
+  let rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right
+  let docLTR = doc.direction == "ltr"
+
+  function add(left, top, width, bottom) {
+    if (top < 0) top = 0
+    top = Math.round(top)
+    bottom = Math.round(bottom)
+    fragment.appendChild(elt("div", null, "CodeMirror-selected", `position: absolute; left: ${left}px;
+                             top: ${top}px; width: ${width == null ? rightSide - left : width}px;
+                             height: ${bottom - top}px`))
+  }
+
+  function drawForLine(line, fromArg, toArg) {
+    let lineObj = getLine(doc, line)
+    let lineLen = lineObj.text.length
+    let start, end
+    function coords(ch, bias) {
+      return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
+    }
+
+    function wrapX(pos, dir, side) {
+      let extent = wrappedLineExtentChar(cm, lineObj, null, pos)
+      let prop = (dir == "ltr") == (side == "after") ? "left" : "right"
+      let ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1)
+      return coords(ch, prop)[prop]
+    }
+
+    let order = getOrder(lineObj, doc.direction)
+    iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, (from, to, dir, i) => {
+      let ltr = dir == "ltr"
+      let fromPos = coords(from, ltr ? "left" : "right")
+      let toPos = coords(to - 1, ltr ? "right" : "left")
+
+      let openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen
+      let first = i == 0, last = !order || i == order.length - 1
+      if (toPos.top - fromPos.top <= 3) { // Single line
+        let openLeft = (docLTR ? openStart : openEnd) && first
+        let openRight = (docLTR ? openEnd : openStart) && last
+        let left = openLeft ? leftSide : (ltr ? fromPos : toPos).left
+        let right = openRight ? rightSide : (ltr ? toPos : fromPos).right
+        add(left, fromPos.top, right - left, fromPos.bottom)
+      } else { // Multiple lines
+        let topLeft, topRight, botLeft, botRight
+        if (ltr) {
+          topLeft = docLTR && openStart && first ? leftSide : fromPos.left
+          topRight = docLTR ? rightSide : wrapX(from, dir, "before")
+          botLeft = docLTR ? leftSide : wrapX(to, dir, "after")
+          botRight = docLTR && openEnd && last ? rightSide : toPos.right
+        } else {
+          topLeft = !docLTR ? leftSide : wrapX(from, dir, "before")
+          topRight = !docLTR && openStart && first ? rightSide : fromPos.right
+          botLeft = !docLTR && openEnd && last ? leftSide : toPos.left
+          botRight = !docLTR ? rightSide : wrapX(to, dir, "after")
+        }
+        add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom)
+        if (fromPos.bottom < toPos.top) add(leftSide, fromPos.bottom, null, toPos.top)
+        add(botLeft, toPos.top, botRight - botLeft, toPos.bottom)
+      }
+
+      if (!start || cmpCoords(fromPos, start) < 0) start = fromPos
+      if (cmpCoords(toPos, start) < 0) start = toPos
+      if (!end || cmpCoords(fromPos, end) < 0) end = fromPos
+      if (cmpCoords(toPos, end) < 0) end = toPos
+    })
+    return {start: start, end: end}
+  }
+
+  let sFrom = range.from(), sTo = range.to()
+  if (sFrom.line == sTo.line) {
+    drawForLine(sFrom.line, sFrom.ch, sTo.ch)
+  } else {
+    let fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)
+    let singleVLine = visualLine(fromLine) == visualLine(toLine)
+    let leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end
+    let rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start
+    if (singleVLine) {
+      if (leftEnd.top < rightStart.top - 2) {
+        add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)
+        add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)
+      } else {
+        add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)
+      }
+    }
+    if (leftEnd.bottom < rightStart.top)
+      add(leftSide, leftEnd.bottom, null, rightStart.top)
+  }
+
+  output.appendChild(fragment)
+}
+
+// Cursor-blinking
+export function restartBlink(cm) {
+  if (!cm.state.focused) return
+  let display = cm.display
+  clearInterval(display.blinker)
+  let on = true
+  display.cursorDiv.style.visibility = ""
+  if (cm.options.cursorBlinkRate > 0)
+    display.blinker = setInterval(() => {
+      if (!cm.hasFocus()) onBlur(cm)
+      display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"
+    }, cm.options.cursorBlinkRate)
+  else if (cm.options.cursorBlinkRate < 0)
+    display.cursorDiv.style.visibility = "hidden"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/update_display.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,267 @@
+import { sawCollapsedSpans } from "../line/saw_special_spans.js"
+import { heightAtLine, visualLineEndNo, visualLineNo } from "../line/spans.js"
+import { getLine, lineNumberFor } from "../line/utils_line.js"
+import { displayHeight, displayWidth, getDimensions, paddingVert, scrollGap } from "../measurement/position_measurement.js"
+import { mac, webkit } from "../util/browser.js"
+import { activeElt, removeChildren, contains, win, root, rootNode } from "../util/dom.js"
+import { hasHandler, signal } from "../util/event.js"
+import { signalLater } from "../util/operation_group.js"
+import { indexOf } from "../util/misc.js"
+
+import { buildLineElement, updateLineForChanges } from "./update_line.js"
+import { startWorker } from "./highlight_worker.js"
+import { maybeUpdateLineNumberWidth } from "./line_numbers.js"
+import { measureForScrollbars, updateScrollbars } from "./scrollbars.js"
+import { updateSelection } from "./selection.js"
+import { updateHeightsInViewport, visibleLines } from "./update_lines.js"
+import { adjustView, countDirtyView, resetView } from "./view_tracking.js"
+
+// DISPLAY DRAWING
+
+export class DisplayUpdate {
+  constructor(cm, viewport, force) {
+    let display = cm.display
+
+    this.viewport = viewport
+    // Store some values that we'll need later (but don't want to force a relayout for)
+    this.visible = visibleLines(display, cm.doc, viewport)
+    this.editorIsHidden = !display.wrapper.offsetWidth
+    this.wrapperHeight = display.wrapper.clientHeight
+    this.wrapperWidth = display.wrapper.clientWidth
+    this.oldDisplayWidth = displayWidth(cm)
+    this.force = force
+    this.dims = getDimensions(cm)
+    this.events = []
+  }
+
+  signal(emitter, type) {
+    if (hasHandler(emitter, type))
+      this.events.push(arguments)
+  }
+  finish() {
+    for (let i = 0; i < this.events.length; i++)
+      signal.apply(null, this.events[i])
+  }
+}
+
+export function maybeClipScrollbars(cm) {
+  let display = cm.display
+  if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
+    display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth
+    display.heightForcer.style.height = scrollGap(cm) + "px"
+    display.sizer.style.marginBottom = -display.nativeBarWidth + "px"
+    display.sizer.style.borderRightWidth = scrollGap(cm) + "px"
+    display.scrollbarsClipped = true
+  }
+}
+
+function selectionSnapshot(cm) {
+  if (cm.hasFocus()) return null
+  let active = activeElt(root(cm))
+  if (!active || !contains(cm.display.lineDiv, active)) return null
+  let result = {activeElt: active}
+  if (window.getSelection) {
+    let sel = win(cm).getSelection()
+    if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
+      result.anchorNode = sel.anchorNode
+      result.anchorOffset = sel.anchorOffset
+      result.focusNode = sel.focusNode
+      result.focusOffset = sel.focusOffset
+    }
+  }
+  return result
+}
+
+function restoreSelection(snapshot) {
+  if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(rootNode(snapshot.activeElt))) return
+  snapshot.activeElt.focus()
+  if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
+      snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
+    let doc = snapshot.activeElt.ownerDocument
+    let sel = doc.defaultView.getSelection(), range = doc.createRange()
+    range.setEnd(snapshot.anchorNode, snapshot.anchorOffset)
+    range.collapse(false)
+    sel.removeAllRanges()
+    sel.addRange(range)
+    sel.extend(snapshot.focusNode, snapshot.focusOffset)
+  }
+}
+
+// Does the actual updating of the line display. Bails out
+// (returning false) when there is nothing to be done and forced is
+// false.
+export function updateDisplayIfNeeded(cm, update) {
+  let display = cm.display, doc = cm.doc
+
+  if (update.editorIsHidden) {
+    resetView(cm)
+    return false
+  }
+
+  // Bail out if the visible area is already rendered and nothing changed.
+  if (!update.force &&
+      update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
+      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
+      display.renderedView == display.view && countDirtyView(cm) == 0)
+    return false
+
+  if (maybeUpdateLineNumberWidth(cm)) {
+    resetView(cm)
+    update.dims = getDimensions(cm)
+  }
+
+  // Compute a suitable new viewport (from & to)
+  let end = doc.first + doc.size
+  let from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)
+  let to = Math.min(end, update.visible.to + cm.options.viewportMargin)
+  if (display.viewFrom < from && from - display.viewFrom < 20) from = Math.max(doc.first, display.viewFrom)
+  if (display.viewTo > to && display.viewTo - to < 20) to = Math.min(end, display.viewTo)
+  if (sawCollapsedSpans) {
+    from = visualLineNo(cm.doc, from)
+    to = visualLineEndNo(cm.doc, to)
+  }
+
+  let different = from != display.viewFrom || to != display.viewTo ||
+    display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth
+  adjustView(cm, from, to)
+
+  display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))
+  // Position the mover div to align with the current scroll position
+  cm.display.mover.style.top = display.viewOffset + "px"
+
+  let toUpdate = countDirtyView(cm)
+  if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
+      (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
+    return false
+
+  // For big changes, we hide the enclosing element during the
+  // update, since that speeds up the operations on most browsers.
+  let selSnapshot = selectionSnapshot(cm)
+  if (toUpdate > 4) display.lineDiv.style.display = "none"
+  patchDisplay(cm, display.updateLineNumbers, update.dims)
+  if (toUpdate > 4) display.lineDiv.style.display = ""
+  display.renderedView = display.view
+  // There might have been a widget with a focused element that got
+  // hidden or updated, if so re-focus it.
+  restoreSelection(selSnapshot)
+
+  // Prevent selection and cursors from interfering with the scroll
+  // width and height.
+  removeChildren(display.cursorDiv)
+  removeChildren(display.selectionDiv)
+  display.gutters.style.height = display.sizer.style.minHeight = 0
+
+  if (different) {
+    display.lastWrapHeight = update.wrapperHeight
+    display.lastWrapWidth = update.wrapperWidth
+    startWorker(cm, 400)
+  }
+
+  display.updateLineNumbers = null
+
+  return true
+}
+
+export function postUpdateDisplay(cm, update) {
+  let viewport = update.viewport
+
+  for (let first = true;; first = false) {
+    if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
+      // Clip forced viewport to actual scrollable area.
+      if (viewport && viewport.top != null)
+        viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}
+      // Updated line heights might result in the drawn area not
+      // actually covering the viewport. Keep looping until it does.
+      update.visible = visibleLines(cm.display, cm.doc, viewport)
+      if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
+        break
+    } else if (first) {
+      update.visible = visibleLines(cm.display, cm.doc, viewport)
+    }
+    if (!updateDisplayIfNeeded(cm, update)) break
+    updateHeightsInViewport(cm)
+    let barMeasure = measureForScrollbars(cm)
+    updateSelection(cm)
+    updateScrollbars(cm, barMeasure)
+    setDocumentHeight(cm, barMeasure)
+    update.force = false
+  }
+
+  update.signal(cm, "update", cm)
+  if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
+    update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo)
+    cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo
+  }
+}
+
+export function updateDisplaySimple(cm, viewport) {
+  let update = new DisplayUpdate(cm, viewport)
+  if (updateDisplayIfNeeded(cm, update)) {
+    updateHeightsInViewport(cm)
+    postUpdateDisplay(cm, update)
+    let barMeasure = measureForScrollbars(cm)
+    updateSelection(cm)
+    updateScrollbars(cm, barMeasure)
+    setDocumentHeight(cm, barMeasure)
+    update.finish()
+  }
+}
+
+// Sync the actual display DOM structure with display.view, removing
+// nodes for lines that are no longer in view, and creating the ones
+// that are not there yet, and updating the ones that are out of
+// date.
+function patchDisplay(cm, updateNumbersFrom, dims) {
+  let display = cm.display, lineNumbers = cm.options.lineNumbers
+  let container = display.lineDiv, cur = container.firstChild
+
+  function rm(node) {
+    let next = node.nextSibling
+    // Works around a throw-scroll bug in OS X Webkit
+    if (webkit && mac && cm.display.currentWheelTarget == node)
+      node.style.display = "none"
+    else
+      node.parentNode.removeChild(node)
+    return next
+  }
+
+  let view = display.view, lineN = display.viewFrom
+  // Loop over the elements in the view, syncing cur (the DOM nodes
+  // in display.lineDiv) with the view as we go.
+  for (let i = 0; i < view.length; i++) {
+    let lineView = view[i]
+    if (lineView.hidden) {
+    } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
+      let node = buildLineElement(cm, lineView, lineN, dims)
+      container.insertBefore(node, cur)
+    } else { // Already drawn
+      while (cur != lineView.node) cur = rm(cur)
+      let updateNumber = lineNumbers && updateNumbersFrom != null &&
+        updateNumbersFrom <= lineN && lineView.lineNumber
+      if (lineView.changes) {
+        if (indexOf(lineView.changes, "gutter") > -1) updateNumber = false
+        updateLineForChanges(cm, lineView, lineN, dims)
+      }
+      if (updateNumber) {
+        removeChildren(lineView.lineNumber)
+        lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))
+      }
+      cur = lineView.node.nextSibling
+    }
+    lineN += lineView.size
+  }
+  while (cur) cur = rm(cur)
+}
+
+export function updateGutterSpace(display) {
+  let width = display.gutters.offsetWidth
+  display.sizer.style.marginLeft = width + "px"
+  // Send an event to consumers responding to changes in gutter width.
+  signalLater(display, "gutterChanged", display)
+}
+
+export function setDocumentHeight(cm, measure) {
+  cm.display.sizer.style.minHeight = measure.docHeight + "px"
+  cm.display.heightForcer.style.top = measure.docHeight + "px"
+  cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/update_line.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,189 @@
+import { buildLineContent } from "../line/line_data.js"
+import { lineNumberFor } from "../line/utils_line.js"
+import { ie, ie_version } from "../util/browser.js"
+import { elt, classTest } from "../util/dom.js"
+import { signalLater } from "../util/operation_group.js"
+
+// When an aspect of a line changes, a string is added to
+// lineView.changes. This updates the relevant part of the line's
+// DOM structure.
+export function updateLineForChanges(cm, lineView, lineN, dims) {
+  for (let j = 0; j < lineView.changes.length; j++) {
+    let type = lineView.changes[j]
+    if (type == "text") updateLineText(cm, lineView)
+    else if (type == "gutter") updateLineGutter(cm, lineView, lineN, dims)
+    else if (type == "class") updateLineClasses(cm, lineView)
+    else if (type == "widget") updateLineWidgets(cm, lineView, dims)
+  }
+  lineView.changes = null
+}
+
+// Lines with gutter elements, widgets or a background class need to
+// be wrapped, and have the extra elements added to the wrapper div
+function ensureLineWrapped(lineView) {
+  if (lineView.node == lineView.text) {
+    lineView.node = elt("div", null, null, "position: relative")
+    if (lineView.text.parentNode)
+      lineView.text.parentNode.replaceChild(lineView.node, lineView.text)
+    lineView.node.appendChild(lineView.text)
+    if (ie && ie_version < 8) lineView.node.style.zIndex = 2
+  }
+  return lineView.node
+}
+
+function updateLineBackground(cm, lineView) {
+  let cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass
+  if (cls) cls += " CodeMirror-linebackground"
+  if (lineView.background) {
+    if (cls) lineView.background.className = cls
+    else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null }
+  } else if (cls) {
+    let wrap = ensureLineWrapped(lineView)
+    lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild)
+    cm.display.input.setUneditable(lineView.background)
+  }
+}
+
+// Wrapper around buildLineContent which will reuse the structure
+// in display.externalMeasured when possible.
+function getLineContent(cm, lineView) {
+  let ext = cm.display.externalMeasured
+  if (ext && ext.line == lineView.line) {
+    cm.display.externalMeasured = null
+    lineView.measure = ext.measure
+    return ext.built
+  }
+  return buildLineContent(cm, lineView)
+}
+
+// Redraw the line's text. Interacts with the background and text
+// classes because the mode may output tokens that influence these
+// classes.
+function updateLineText(cm, lineView) {
+  let cls = lineView.text.className
+  let built = getLineContent(cm, lineView)
+  if (lineView.text == lineView.node) lineView.node = built.pre
+  lineView.text.parentNode.replaceChild(built.pre, lineView.text)
+  lineView.text = built.pre
+  if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
+    lineView.bgClass = built.bgClass
+    lineView.textClass = built.textClass
+    updateLineClasses(cm, lineView)
+  } else if (cls) {
+    lineView.text.className = cls
+  }
+}
+
+function updateLineClasses(cm, lineView) {
+  updateLineBackground(cm, lineView)
+  if (lineView.line.wrapClass)
+    ensureLineWrapped(lineView).className = lineView.line.wrapClass
+  else if (lineView.node != lineView.text)
+    lineView.node.className = ""
+  let textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass
+  lineView.text.className = textClass || ""
+}
+
+function updateLineGutter(cm, lineView, lineN, dims) {
+  if (lineView.gutter) {
+    lineView.node.removeChild(lineView.gutter)
+    lineView.gutter = null
+  }
+  if (lineView.gutterBackground) {
+    lineView.node.removeChild(lineView.gutterBackground)
+    lineView.gutterBackground = null
+  }
+  if (lineView.line.gutterClass) {
+    let wrap = ensureLineWrapped(lineView)
+    lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
+                                    `left: ${cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth}px; width: ${dims.gutterTotalWidth}px`)
+    cm.display.input.setUneditable(lineView.gutterBackground)
+    wrap.insertBefore(lineView.gutterBackground, lineView.text)
+  }
+  let markers = lineView.line.gutterMarkers
+  if (cm.options.lineNumbers || markers) {
+    let wrap = ensureLineWrapped(lineView)
+    let gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", `left: ${cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth}px`)
+    gutterWrap.setAttribute("aria-hidden", "true")
+    cm.display.input.setUneditable(gutterWrap)
+    wrap.insertBefore(gutterWrap, lineView.text)
+    if (lineView.line.gutterClass)
+      gutterWrap.className += " " + lineView.line.gutterClass
+    if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
+      lineView.lineNumber = gutterWrap.appendChild(
+        elt("div", lineNumberFor(cm.options, lineN),
+            "CodeMirror-linenumber CodeMirror-gutter-elt",
+            `left: ${dims.gutterLeft["CodeMirror-linenumbers"]}px; width: ${cm.display.lineNumInnerWidth}px`))
+    if (markers) for (let k = 0; k < cm.display.gutterSpecs.length; ++k) {
+      let id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id]
+      if (found)
+        gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
+                                   `left: ${dims.gutterLeft[id]}px; width: ${dims.gutterWidth[id]}px`))
+    }
+  }
+}
+
+function updateLineWidgets(cm, lineView, dims) {
+  if (lineView.alignable) lineView.alignable = null
+  let isWidget = classTest("CodeMirror-linewidget")
+  for (let node = lineView.node.firstChild, next; node; node = next) {
+    next = node.nextSibling
+    if (isWidget.test(node.className)) lineView.node.removeChild(node)
+  }
+  insertLineWidgets(cm, lineView, dims)
+}
+
+// Build a line's DOM representation from scratch
+export function buildLineElement(cm, lineView, lineN, dims) {
+  let built = getLineContent(cm, lineView)
+  lineView.text = lineView.node = built.pre
+  if (built.bgClass) lineView.bgClass = built.bgClass
+  if (built.textClass) lineView.textClass = built.textClass
+
+  updateLineClasses(cm, lineView)
+  updateLineGutter(cm, lineView, lineN, dims)
+  insertLineWidgets(cm, lineView, dims)
+  return lineView.node
+}
+
+// A lineView may contain multiple logical lines (when merged by
+// collapsed spans). The widgets for all of them need to be drawn.
+function insertLineWidgets(cm, lineView, dims) {
+  insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)
+  if (lineView.rest) for (let i = 0; i < lineView.rest.length; i++)
+    insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false)
+}
+
+function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
+  if (!line.widgets) return
+  let wrap = ensureLineWrapped(lineView)
+  for (let i = 0, ws = line.widgets; i < ws.length; ++i) {
+    let widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""))
+    if (!widget.handleMouseEvents) node.setAttribute("cm-ignore-events", "true")
+    positionLineWidget(widget, node, lineView, dims)
+    cm.display.input.setUneditable(node)
+    if (allowAbove && widget.above)
+      wrap.insertBefore(node, lineView.gutter || lineView.text)
+    else
+      wrap.appendChild(node)
+    signalLater(widget, "redraw")
+  }
+}
+
+function positionLineWidget(widget, node, lineView, dims) {
+  if (widget.noHScroll) {
+    ;(lineView.alignable || (lineView.alignable = [])).push(node)
+    let width = dims.wrapperWidth
+    node.style.left = dims.fixedPos + "px"
+    if (!widget.coverGutter) {
+      width -= dims.gutterTotalWidth
+      node.style.paddingLeft = dims.gutterTotalWidth + "px"
+    }
+    node.style.width = width + "px"
+  }
+  if (widget.coverGutter) {
+    node.style.zIndex = 5
+    node.style.position = "relative"
+    if (!widget.noHScroll) node.style.marginLeft = -dims.gutterTotalWidth + "px"
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/update_lines.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,82 @@
+import { heightAtLine } from "../line/spans.js"
+import { getLine, lineAtHeight, updateLineHeight } from "../line/utils_line.js"
+import { paddingTop, charWidth } from "../measurement/position_measurement.js"
+import { ie, ie_version } from "../util/browser.js"
+
+// Read the actual heights of the rendered lines, and update their
+// stored heights to match.
+export function updateHeightsInViewport(cm) {
+  let display = cm.display
+  let prevBottom = display.lineDiv.offsetTop
+  let viewTop = Math.max(0, display.scroller.getBoundingClientRect().top)
+  let oldHeight = display.lineDiv.getBoundingClientRect().top
+  let mustScroll = 0
+  for (let i = 0; i < display.view.length; i++) {
+    let cur = display.view[i], wrapping = cm.options.lineWrapping
+    let height, width = 0
+    if (cur.hidden) continue
+    oldHeight += cur.line.height
+    if (ie && ie_version < 8) {
+      let bot = cur.node.offsetTop + cur.node.offsetHeight
+      height = bot - prevBottom
+      prevBottom = bot
+    } else {
+      let box = cur.node.getBoundingClientRect()
+      height = box.bottom - box.top
+      // Check that lines don't extend past the right of the current
+      // editor width
+      if (!wrapping && cur.text.firstChild)
+        width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1
+    }
+    let diff = cur.line.height - height
+    if (diff > .005 || diff < -.005) {
+      if (oldHeight < viewTop) mustScroll -= diff
+      updateLineHeight(cur.line, height)
+      updateWidgetHeight(cur.line)
+      if (cur.rest) for (let j = 0; j < cur.rest.length; j++)
+        updateWidgetHeight(cur.rest[j])
+    }
+    if (width > cm.display.sizerWidth) {
+      let chWidth = Math.ceil(width / charWidth(cm.display))
+      if (chWidth > cm.display.maxLineLength) {
+        cm.display.maxLineLength = chWidth
+        cm.display.maxLine = cur.line
+        cm.display.maxLineChanged = true
+      }
+    }
+  }
+  if (Math.abs(mustScroll) > 2) display.scroller.scrollTop += mustScroll
+}
+
+// Read and store the height of line widgets associated with the
+// given line.
+function updateWidgetHeight(line) {
+  if (line.widgets) for (let i = 0; i < line.widgets.length; ++i) {
+    let w = line.widgets[i], parent = w.node.parentNode
+    if (parent) w.height = parent.offsetHeight
+  }
+}
+
+// Compute the lines that are visible in a given viewport (defaults
+// the current scroll position). viewport may contain top,
+// height, and ensure (see op.scrollToPos) properties.
+export function visibleLines(display, doc, viewport) {
+  let top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
+  top = Math.floor(top - paddingTop(display))
+  let bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
+
+  let from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
+  // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
+  // forces those lines into the viewport (if possible).
+  if (viewport && viewport.ensure) {
+    let ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
+    if (ensureFrom < from) {
+      from = ensureFrom
+      to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
+    } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
+      from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
+      to = ensureTo
+    }
+  }
+  return {from: from, to: Math.max(to, from + 1)}
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/display/view_tracking.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,153 @@
+import { buildViewArray } from "../line/line_data.js"
+import { sawCollapsedSpans } from "../line/saw_special_spans.js"
+import { visualLineEndNo, visualLineNo } from "../line/spans.js"
+import { findViewIndex } from "../measurement/position_measurement.js"
+import { indexOf } from "../util/misc.js"
+
+// Updates the display.view data structure for a given change to the
+// document. From and to are in pre-change coordinates. Lendiff is
+// the amount of lines added or subtracted by the change. This is
+// used for changes that span multiple lines, or change the way
+// lines are divided into visual lines. regLineChange (below)
+// registers single-line changes.
+export function regChange(cm, from, to, lendiff) {
+  if (from == null) from = cm.doc.first
+  if (to == null) to = cm.doc.first + cm.doc.size
+  if (!lendiff) lendiff = 0
+
+  let display = cm.display
+  if (lendiff && to < display.viewTo &&
+      (display.updateLineNumbers == null || display.updateLineNumbers > from))
+    display.updateLineNumbers = from
+
+  cm.curOp.viewChanged = true
+
+  if (from >= display.viewTo) { // Change after
+    if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
+      resetView(cm)
+  } else if (to <= display.viewFrom) { // Change before
+    if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
+      resetView(cm)
+    } else {
+      display.viewFrom += lendiff
+      display.viewTo += lendiff
+    }
+  } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
+    resetView(cm)
+  } else if (from <= display.viewFrom) { // Top overlap
+    let cut = viewCuttingPoint(cm, to, to + lendiff, 1)
+    if (cut) {
+      display.view = display.view.slice(cut.index)
+      display.viewFrom = cut.lineN
+      display.viewTo += lendiff
+    } else {
+      resetView(cm)
+    }
+  } else if (to >= display.viewTo) { // Bottom overlap
+    let cut = viewCuttingPoint(cm, from, from, -1)
+    if (cut) {
+      display.view = display.view.slice(0, cut.index)
+      display.viewTo = cut.lineN
+    } else {
+      resetView(cm)
+    }
+  } else { // Gap in the middle
+    let cutTop = viewCuttingPoint(cm, from, from, -1)
+    let cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)
+    if (cutTop && cutBot) {
+      display.view = display.view.slice(0, cutTop.index)
+        .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
+        .concat(display.view.slice(cutBot.index))
+      display.viewTo += lendiff
+    } else {
+      resetView(cm)
+    }
+  }
+
+  let ext = display.externalMeasured
+  if (ext) {
+    if (to < ext.lineN)
+      ext.lineN += lendiff
+    else if (from < ext.lineN + ext.size)
+      display.externalMeasured = null
+  }
+}
+
+// Register a change to a single line. Type must be one of "text",
+// "gutter", "class", "widget"
+export function regLineChange(cm, line, type) {
+  cm.curOp.viewChanged = true
+  let display = cm.display, ext = cm.display.externalMeasured
+  if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
+    display.externalMeasured = null
+
+  if (line < display.viewFrom || line >= display.viewTo) return
+  let lineView = display.view[findViewIndex(cm, line)]
+  if (lineView.node == null) return
+  let arr = lineView.changes || (lineView.changes = [])
+  if (indexOf(arr, type) == -1) arr.push(type)
+}
+
+// Clear the view.
+export function resetView(cm) {
+  cm.display.viewFrom = cm.display.viewTo = cm.doc.first
+  cm.display.view = []
+  cm.display.viewOffset = 0
+}
+
+function viewCuttingPoint(cm, oldN, newN, dir) {
+  let index = findViewIndex(cm, oldN), diff, view = cm.display.view
+  if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
+    return {index: index, lineN: newN}
+  let n = cm.display.viewFrom
+  for (let i = 0; i < index; i++)
+    n += view[i].size
+  if (n != oldN) {
+    if (dir > 0) {
+      if (index == view.length - 1) return null
+      diff = (n + view[index].size) - oldN
+      index++
+    } else {
+      diff = n - oldN
+    }
+    oldN += diff; newN += diff
+  }
+  while (visualLineNo(cm.doc, newN) != newN) {
+    if (index == (dir < 0 ? 0 : view.length - 1)) return null
+    newN += dir * view[index - (dir < 0 ? 1 : 0)].size
+    index += dir
+  }
+  return {index: index, lineN: newN}
+}
+
+// Force the view to cover a given range, adding empty view element
+// or clipping off existing ones as needed.
+export function adjustView(cm, from, to) {
+  let display = cm.display, view = display.view
+  if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
+    display.view = buildViewArray(cm, from, to)
+    display.viewFrom = from
+  } else {
+    if (display.viewFrom > from)
+      display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view)
+    else if (display.viewFrom < from)
+      display.view = display.view.slice(findViewIndex(cm, from))
+    display.viewFrom = from
+    if (display.viewTo < to)
+      display.view = display.view.concat(buildViewArray(cm, display.viewTo, to))
+    else if (display.viewTo > to)
+      display.view = display.view.slice(0, findViewIndex(cm, to))
+  }
+  display.viewTo = to
+}
+
+// Count the number of lines in the view whose DOM representation is
+// out of date (or nonexistent).
+export function countDirtyView(cm) {
+  let view = cm.display.view, dirty = 0
+  for (let i = 0; i < view.length; i++) {
+    let lineView = view[i]
+    if (!lineView.hidden && (!lineView.node || lineView.changes)) ++dirty
+  }
+  return dirty
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/CodeMirror.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,217 @@
+import { Display } from "../display/Display.js"
+import { onFocus, onBlur } from "../display/focus.js"
+import { maybeUpdateLineNumberWidth } from "../display/line_numbers.js"
+import { endOperation, operation, startOperation } from "../display/operations.js"
+import { initScrollbars } from "../display/scrollbars.js"
+import { onScrollWheel } from "../display/scroll_events.js"
+import { setScrollLeft, updateScrollTop } from "../display/scrolling.js"
+import { clipPos, Pos } from "../line/pos.js"
+import { posFromMouse } from "../measurement/position_measurement.js"
+import { eventInWidget } from "../measurement/widgets.js"
+import Doc from "../model/Doc.js"
+import { attachDoc } from "../model/document_data.js"
+import { Range } from "../model/selection.js"
+import { extendSelection } from "../model/selection_updates.js"
+import { ie, ie_version, mobile, webkit } from "../util/browser.js"
+import { e_preventDefault, e_stop, on, signal, signalDOMEvent } from "../util/event.js"
+import { copyObj, Delayed } from "../util/misc.js"
+
+import { clearDragCursor, onDragOver, onDragStart, onDrop } from "./drop_events.js"
+import { ensureGlobalHandlers } from "./global_events.js"
+import { onKeyDown, onKeyPress, onKeyUp } from "./key_events.js"
+import { clickInGutter, onContextMenu, onMouseDown } from "./mouse_events.js"
+import { themeChanged } from "./utils.js"
+import { defaults, optionHandlers, Init } from "./options.js"
+
+// A CodeMirror instance represents an editor. This is the object
+// that user code is usually dealing with.
+
+export function CodeMirror(place, options) {
+  if (!(this instanceof CodeMirror)) return new CodeMirror(place, options)
+
+  this.options = options = options ? copyObj(options) : {}
+  // Determine effective options based on given values and defaults.
+  copyObj(defaults, options, false)
+
+  let doc = options.value
+  if (typeof doc == "string") doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction)
+  else if (options.mode) doc.modeOption = options.mode
+  this.doc = doc
+
+  let input = new CodeMirror.inputStyles[options.inputStyle](this)
+  let display = this.display = new Display(place, doc, input, options)
+  display.wrapper.CodeMirror = this
+  themeChanged(this)
+  if (options.lineWrapping)
+    this.display.wrapper.className += " CodeMirror-wrap"
+  initScrollbars(this)
+
+  this.state = {
+    keyMaps: [],  // stores maps added by addKeyMap
+    overlays: [], // highlighting overlays, as added by addOverlay
+    modeGen: 0,   // bumped when mode/overlay changes, used to invalidate highlighting info
+    overwrite: false,
+    delayingBlurEvent: false,
+    focused: false,
+    suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
+    pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
+    selectingText: false,
+    draggingText: false,
+    highlight: new Delayed(), // stores highlight worker timeout
+    keySeq: null,  // Unfinished key sequence
+    specialChars: null
+  }
+
+  if (options.autofocus && !mobile) display.input.focus()
+
+  // Override magic textarea content restore that IE sometimes does
+  // on our hidden textarea on reload
+  if (ie && ie_version < 11) setTimeout(() => this.display.input.reset(true), 20)
+
+  registerEventHandlers(this)
+  ensureGlobalHandlers()
+
+  startOperation(this)
+  this.curOp.forceUpdate = true
+  attachDoc(this, doc)
+
+  if ((options.autofocus && !mobile) || this.hasFocus())
+    setTimeout(() => {
+      if (this.hasFocus() && !this.state.focused) onFocus(this)
+    }, 20)
+  else
+    onBlur(this)
+
+  for (let opt in optionHandlers) if (optionHandlers.hasOwnProperty(opt))
+    optionHandlers[opt](this, options[opt], Init)
+  maybeUpdateLineNumberWidth(this)
+  if (options.finishInit) options.finishInit(this)
+  for (let i = 0; i < initHooks.length; ++i) initHooks[i](this)
+  endOperation(this)
+  // Suppress optimizelegibility in Webkit, since it breaks text
+  // measuring on line wrapping boundaries.
+  if (webkit && options.lineWrapping &&
+      getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
+    display.lineDiv.style.textRendering = "auto"
+}
+
+// The default configuration options.
+CodeMirror.defaults = defaults
+// Functions to run when options are changed.
+CodeMirror.optionHandlers = optionHandlers
+
+export default CodeMirror
+
+// Attach the necessary event handlers when initializing the editor
+function registerEventHandlers(cm) {
+  let d = cm.display
+  on(d.scroller, "mousedown", operation(cm, onMouseDown))
+  // Older IE's will not fire a second mousedown for a double click
+  if (ie && ie_version < 11)
+    on(d.scroller, "dblclick", operation(cm, e => {
+      if (signalDOMEvent(cm, e)) return
+      let pos = posFromMouse(cm, e)
+      if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) return
+      e_preventDefault(e)
+      let word = cm.findWordAt(pos)
+      extendSelection(cm.doc, word.anchor, word.head)
+    }))
+  else
+    on(d.scroller, "dblclick", e => signalDOMEvent(cm, e) || e_preventDefault(e))
+  // Some browsers fire contextmenu *after* opening the menu, at
+  // which point we can't mess with it anymore. Context menu is
+  // handled in onMouseDown for these browsers.
+  on(d.scroller, "contextmenu", e => onContextMenu(cm, e))
+  on(d.input.getField(), "contextmenu", e => {
+    if (!d.scroller.contains(e.target)) onContextMenu(cm, e)
+  })
+
+  // Used to suppress mouse event handling when a touch happens
+  let touchFinished, prevTouch = {end: 0}
+  function finishTouch() {
+    if (d.activeTouch) {
+      touchFinished = setTimeout(() => d.activeTouch = null, 1000)
+      prevTouch = d.activeTouch
+      prevTouch.end = +new Date
+    }
+  }
+  function isMouseLikeTouchEvent(e) {
+    if (e.touches.length != 1) return false
+    let touch = e.touches[0]
+    return touch.radiusX <= 1 && touch.radiusY <= 1
+  }
+  function farAway(touch, other) {
+    if (other.left == null) return true
+    let dx = other.left - touch.left, dy = other.top - touch.top
+    return dx * dx + dy * dy > 20 * 20
+  }
+  on(d.scroller, "touchstart", e => {
+    if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
+      d.input.ensurePolled()
+      clearTimeout(touchFinished)
+      let now = +new Date
+      d.activeTouch = {start: now, moved: false,
+                       prev: now - prevTouch.end <= 300 ? prevTouch : null}
+      if (e.touches.length == 1) {
+        d.activeTouch.left = e.touches[0].pageX
+        d.activeTouch.top = e.touches[0].pageY
+      }
+    }
+  })
+  on(d.scroller, "touchmove", () => {
+    if (d.activeTouch) d.activeTouch.moved = true
+  })
+  on(d.scroller, "touchend", e => {
+    let touch = d.activeTouch
+    if (touch && !eventInWidget(d, e) && touch.left != null &&
+        !touch.moved && new Date - touch.start < 300) {
+      let pos = cm.coordsChar(d.activeTouch, "page"), range
+      if (!touch.prev || farAway(touch, touch.prev)) // Single tap
+        range = new Range(pos, pos)
+      else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
+        range = cm.findWordAt(pos)
+      else // Triple tap
+        range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))
+      cm.setSelection(range.anchor, range.head)
+      cm.focus()
+      e_preventDefault(e)
+    }
+    finishTouch()
+  })
+  on(d.scroller, "touchcancel", finishTouch)
+
+  // Sync scrolling between fake scrollbars and real scrollable
+  // area, ensure viewport is updated when scrolling.
+  on(d.scroller, "scroll", () => {
+    if (d.scroller.clientHeight) {
+      updateScrollTop(cm, d.scroller.scrollTop)
+      setScrollLeft(cm, d.scroller.scrollLeft, true)
+      signal(cm, "scroll", cm)
+    }
+  })
+
+  // Listen to wheel events in order to try and update the viewport on time.
+  on(d.scroller, "mousewheel", e => onScrollWheel(cm, e))
+  on(d.scroller, "DOMMouseScroll", e => onScrollWheel(cm, e))
+
+  // Prevent wrapper from ever scrolling
+  on(d.wrapper, "scroll", () => d.wrapper.scrollTop = d.wrapper.scrollLeft = 0)
+
+  d.dragFunctions = {
+    enter: e => {if (!signalDOMEvent(cm, e)) e_stop(e)},
+    over: e => {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e) }},
+    start: e => onDragStart(cm, e),
+    drop: operation(cm, onDrop),
+    leave: e => {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm) }}
+  }
+
+  let inp = d.input.getField()
+  on(inp, "keyup", e => onKeyUp.call(cm, e))
+  on(inp, "keydown", operation(cm, onKeyDown))
+  on(inp, "keypress", operation(cm, onKeyPress))
+  on(inp, "focus", e => onFocus(cm, e))
+  on(inp, "blur", e => onBlur(cm, e))
+}
+
+let initHooks = []
+CodeMirror.defineInitHook = f => initHooks.push(f)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/commands.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,178 @@
+import { deleteNearSelection } from "./deleteNearSelection.js"
+import { runInOp } from "../display/operations.js"
+import { ensureCursorVisible } from "../display/scrolling.js"
+import { endOfLine } from "../input/movement.js"
+import { clipPos, Pos } from "../line/pos.js"
+import { visualLine, visualLineEnd } from "../line/spans.js"
+import { getLine, lineNo } from "../line/utils_line.js"
+import { Range } from "../model/selection.js"
+import { selectAll } from "../model/selection_updates.js"
+import { countColumn, sel_dontScroll, sel_move, spaceStr } from "../util/misc.js"
+import { getOrder } from "../util/bidi.js"
+
+// Commands are parameter-less actions that can be performed on an
+// editor, mostly used for keybindings.
+export let commands = {
+  selectAll: selectAll,
+  singleSelection: cm => cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll),
+  killLine: cm => deleteNearSelection(cm, range => {
+    if (range.empty()) {
+      let len = getLine(cm.doc, range.head.line).text.length
+      if (range.head.ch == len && range.head.line < cm.lastLine())
+        return {from: range.head, to: Pos(range.head.line + 1, 0)}
+      else
+        return {from: range.head, to: Pos(range.head.line, len)}
+    } else {
+      return {from: range.from(), to: range.to()}
+    }
+  }),
+  deleteLine: cm => deleteNearSelection(cm, range => ({
+    from: Pos(range.from().line, 0),
+    to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
+  })),
+  delLineLeft: cm => deleteNearSelection(cm, range => ({
+    from: Pos(range.from().line, 0), to: range.from()
+  })),
+  delWrappedLineLeft: cm => deleteNearSelection(cm, range => {
+    let top = cm.charCoords(range.head, "div").top + 5
+    let leftPos = cm.coordsChar({left: 0, top: top}, "div")
+    return {from: leftPos, to: range.from()}
+  }),
+  delWrappedLineRight: cm => deleteNearSelection(cm, range => {
+    let top = cm.charCoords(range.head, "div").top + 5
+    let rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
+    return {from: range.from(), to: rightPos }
+  }),
+  undo: cm => cm.undo(),
+  redo: cm => cm.redo(),
+  undoSelection: cm => cm.undoSelection(),
+  redoSelection: cm => cm.redoSelection(),
+  goDocStart: cm => cm.extendSelection(Pos(cm.firstLine(), 0)),
+  goDocEnd: cm => cm.extendSelection(Pos(cm.lastLine())),
+  goLineStart: cm => cm.extendSelectionsBy(range => lineStart(cm, range.head.line),
+    {origin: "+move", bias: 1}
+  ),
+  goLineStartSmart: cm => cm.extendSelectionsBy(range => lineStartSmart(cm, range.head),
+    {origin: "+move", bias: 1}
+  ),
+  goLineEnd: cm => cm.extendSelectionsBy(range => lineEnd(cm, range.head.line),
+    {origin: "+move", bias: -1}
+  ),
+  goLineRight: cm => cm.extendSelectionsBy(range => {
+    let top = cm.cursorCoords(range.head, "div").top + 5
+    return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
+  }, sel_move),
+  goLineLeft: cm => cm.extendSelectionsBy(range => {
+    let top = cm.cursorCoords(range.head, "div").top + 5
+    return cm.coordsChar({left: 0, top: top}, "div")
+  }, sel_move),
+  goLineLeftSmart: cm => cm.extendSelectionsBy(range => {
+    let top = cm.cursorCoords(range.head, "div").top + 5
+    let pos = cm.coordsChar({left: 0, top: top}, "div")
+    if (pos.ch < cm.getLine(pos.line).search(/\S/)) return lineStartSmart(cm, range.head)
+    return pos
+  }, sel_move),
+  goLineUp: cm => cm.moveV(-1, "line"),
+  goLineDown: cm => cm.moveV(1, "line"),
+  goPageUp: cm => cm.moveV(-1, "page"),
+  goPageDown: cm => cm.moveV(1, "page"),
+  goCharLeft: cm => cm.moveH(-1, "char"),
+  goCharRight: cm => cm.moveH(1, "char"),
+  goColumnLeft: cm => cm.moveH(-1, "column"),
+  goColumnRight: cm => cm.moveH(1, "column"),
+  goWordLeft: cm => cm.moveH(-1, "word"),
+  goGroupRight: cm => cm.moveH(1, "group"),
+  goGroupLeft: cm => cm.moveH(-1, "group"),
+  goWordRight: cm => cm.moveH(1, "word"),
+  delCharBefore: cm => cm.deleteH(-1, "codepoint"),
+  delCharAfter: cm => cm.deleteH(1, "char"),
+  delWordBefore: cm => cm.deleteH(-1, "word"),
+  delWordAfter: cm => cm.deleteH(1, "word"),
+  delGroupBefore: cm => cm.deleteH(-1, "group"),
+  delGroupAfter: cm => cm.deleteH(1, "group"),
+  indentAuto: cm => cm.indentSelection("smart"),
+  indentMore: cm => cm.indentSelection("add"),
+  indentLess: cm => cm.indentSelection("subtract"),
+  insertTab: cm => cm.replaceSelection("\t"),
+  insertSoftTab: cm => {
+    let spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize
+    for (let i = 0; i < ranges.length; i++) {
+      let pos = ranges[i].from()
+      let col = countColumn(cm.getLine(pos.line), pos.ch, tabSize)
+      spaces.push(spaceStr(tabSize - col % tabSize))
+    }
+    cm.replaceSelections(spaces)
+  },
+  defaultTab: cm => {
+    if (cm.somethingSelected()) cm.indentSelection("add")
+    else cm.execCommand("insertTab")
+  },
+  // Swap the two chars left and right of each selection's head.
+  // Move cursor behind the two swapped characters afterwards.
+  //
+  // Doesn't consider line feeds a character.
+  // Doesn't scan more than one line above to find a character.
+  // Doesn't do anything on an empty line.
+  // Doesn't do anything with non-empty selections.
+  transposeChars: cm => runInOp(cm, () => {
+    let ranges = cm.listSelections(), newSel = []
+    for (let i = 0; i < ranges.length; i++) {
+      if (!ranges[i].empty()) continue
+      let cur = ranges[i].head, line = getLine(cm.doc, cur.line).text
+      if (line) {
+        if (cur.ch == line.length) cur = new Pos(cur.line, cur.ch - 1)
+        if (cur.ch > 0) {
+          cur = new Pos(cur.line, cur.ch + 1)
+          cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
+                          Pos(cur.line, cur.ch - 2), cur, "+transpose")
+        } else if (cur.line > cm.doc.first) {
+          let prev = getLine(cm.doc, cur.line - 1).text
+          if (prev) {
+            cur = new Pos(cur.line, 1)
+            cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
+                            prev.charAt(prev.length - 1),
+                            Pos(cur.line - 1, prev.length - 1), cur, "+transpose")
+          }
+        }
+      }
+      newSel.push(new Range(cur, cur))
+    }
+    cm.setSelections(newSel)
+  }),
+  newlineAndIndent: cm => runInOp(cm, () => {
+    let sels = cm.listSelections()
+    for (let i = sels.length - 1; i >= 0; i--)
+      cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input")
+    sels = cm.listSelections()
+    for (let i = 0; i < sels.length; i++)
+      cm.indentLine(sels[i].from().line, null, true)
+    ensureCursorVisible(cm)
+  }),
+  openLine: cm => cm.replaceSelection("\n", "start"),
+  toggleOverwrite: cm => cm.toggleOverwrite()
+}
+
+
+function lineStart(cm, lineN) {
+  let line = getLine(cm.doc, lineN)
+  let visual = visualLine(line)
+  if (visual != line) lineN = lineNo(visual)
+  return endOfLine(true, cm, visual, lineN, 1)
+}
+function lineEnd(cm, lineN) {
+  let line = getLine(cm.doc, lineN)
+  let visual = visualLineEnd(line)
+  if (visual != line) lineN = lineNo(visual)
+  return endOfLine(true, cm, line, lineN, -1)
+}
+function lineStartSmart(cm, pos) {
+  let start = lineStart(cm, pos.line)
+  let line = getLine(cm.doc, start.line)
+  let order = getOrder(line, cm.doc.direction)
+  if (!order || order[0].level == 0) {
+    let firstNonWS = Math.max(start.ch, line.text.search(/\S/))
+    let inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch
+    return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
+  }
+  return start
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/deleteNearSelection.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,30 @@
+import { runInOp } from "../display/operations.js"
+import { ensureCursorVisible } from "../display/scrolling.js"
+import { cmp } from "../line/pos.js"
+import { replaceRange } from "../model/changes.js"
+import { lst } from "../util/misc.js"
+
+// Helper for deleting text near the selection(s), used to implement
+// backspace, delete, and similar functionality.
+export function deleteNearSelection(cm, compute) {
+  let ranges = cm.doc.sel.ranges, kill = []
+  // Build up a set of ranges to kill first, merging overlapping
+  // ranges.
+  for (let i = 0; i < ranges.length; i++) {
+    let toKill = compute(ranges[i])
+    while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
+      let replaced = kill.pop()
+      if (cmp(replaced.from, toKill.from) < 0) {
+        toKill.from = replaced.from
+        break
+      }
+    }
+    kill.push(toKill)
+  }
+  // Next, remove those actual ranges.
+  runInOp(cm, () => {
+    for (let i = kill.length - 1; i >= 0; i--)
+      replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete")
+    ensureCursorVisible(cm)
+  })
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/drop_events.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,130 @@
+import { drawSelectionCursor } from "../display/selection.js"
+import { operation } from "../display/operations.js"
+import { clipPos } from "../line/pos.js"
+import { posFromMouse } from "../measurement/position_measurement.js"
+import { eventInWidget } from "../measurement/widgets.js"
+import { makeChange, replaceRange } from "../model/changes.js"
+import { changeEnd } from "../model/change_measurement.js"
+import { simpleSelection } from "../model/selection.js"
+import { setSelectionNoUndo, setSelectionReplaceHistory } from "../model/selection_updates.js"
+import { ie, presto, safari } from "../util/browser.js"
+import { elt, removeChildrenAndAdd } from "../util/dom.js"
+import { e_preventDefault, e_stop, signalDOMEvent } from "../util/event.js"
+import { indexOf } from "../util/misc.js"
+
+// Kludge to work around strange IE behavior where it'll sometimes
+// re-fire a series of drag-related events right after the drop (#1551)
+let lastDrop = 0
+
+export function onDrop(e) {
+  let cm = this
+  clearDragCursor(cm)
+  if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
+    return
+  e_preventDefault(e)
+  if (ie) lastDrop = +new Date
+  let pos = posFromMouse(cm, e, true), files = e.dataTransfer.files
+  if (!pos || cm.isReadOnly()) return
+  // Might be a file drop, in which case we simply extract the text
+  // and insert it.
+  if (files && files.length && window.FileReader && window.File) {
+    let n = files.length, text = Array(n), read = 0
+    const markAsReadAndPasteIfAllFilesAreRead = () => {
+      if (++read == n) {
+        operation(cm, () => {
+          pos = clipPos(cm.doc, pos)
+          let change = {from: pos, to: pos,
+                        text: cm.doc.splitLines(
+                            text.filter(t => t != null).join(cm.doc.lineSeparator())),
+                        origin: "paste"}
+          makeChange(cm.doc, change)
+          setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))))
+        })()
+      }
+    }
+    const readTextFromFile = (file, i) => {
+      if (cm.options.allowDropFileTypes &&
+          indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
+        markAsReadAndPasteIfAllFilesAreRead()
+        return
+      }
+      let reader = new FileReader
+      reader.onerror = () => markAsReadAndPasteIfAllFilesAreRead()
+      reader.onload = () => {
+        let content = reader.result
+        if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
+          markAsReadAndPasteIfAllFilesAreRead()
+          return
+        }
+        text[i] = content
+        markAsReadAndPasteIfAllFilesAreRead()
+      }
+      reader.readAsText(file)
+    }
+    for (let i = 0; i < files.length; i++) readTextFromFile(files[i], i)
+  } else { // Normal drop
+    // Don't do a replace if the drop happened inside of the selected text.
+    if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
+      cm.state.draggingText(e)
+      // Ensure the editor is re-focused
+      setTimeout(() => cm.display.input.focus(), 20)
+      return
+    }
+    try {
+      let text = e.dataTransfer.getData("Text")
+      if (text) {
+        let selected
+        if (cm.state.draggingText && !cm.state.draggingText.copy)
+          selected = cm.listSelections()
+        setSelectionNoUndo(cm.doc, simpleSelection(pos, pos))
+        if (selected) for (let i = 0; i < selected.length; ++i)
+          replaceRange(cm.doc, "", selected[i].anchor, selected[i].head, "drag")
+        cm.replaceSelection(text, "around", "paste")
+        cm.display.input.focus()
+      }
+    }
+    catch(e){}
+  }
+}
+
+export function onDragStart(cm, e) {
+  if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
+  if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) return
+
+  e.dataTransfer.setData("Text", cm.getSelection())
+  e.dataTransfer.effectAllowed = "copyMove"
+
+  // Use dummy image instead of default browsers image.
+  // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
+  if (e.dataTransfer.setDragImage && !safari) {
+    let img = elt("img", null, null, "position: fixed; left: 0; top: 0;")
+    img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="
+    if (presto) {
+      img.width = img.height = 1
+      cm.display.wrapper.appendChild(img)
+      // Force a relayout, or Opera won't use our image for some obscure reason
+      img._top = img.offsetTop
+    }
+    e.dataTransfer.setDragImage(img, 0, 0)
+    if (presto) img.parentNode.removeChild(img)
+  }
+}
+
+export function onDragOver(cm, e) {
+  let pos = posFromMouse(cm, e)
+  if (!pos) return
+  let frag = document.createDocumentFragment()
+  drawSelectionCursor(cm, pos, frag)
+  if (!cm.display.dragCursor) {
+    cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors")
+    cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv)
+  }
+  removeChildrenAndAdd(cm.display.dragCursor, frag)
+}
+
+export function clearDragCursor(cm) {
+  if (cm.display.dragCursor) {
+    cm.display.lineSpace.removeChild(cm.display.dragCursor)
+    cm.display.dragCursor = null
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/fromTextArea.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+import { CodeMirror } from "./CodeMirror.js"
+import { activeElt, rootNode } from "../util/dom.js"
+import { off, on } from "../util/event.js"
+import { copyObj } from "../util/misc.js"
+
+export function fromTextArea(textarea, options) {
+  options = options ? copyObj(options) : {}
+  options.value = textarea.value
+  if (!options.tabindex && textarea.tabIndex)
+    options.tabindex = textarea.tabIndex
+  if (!options.placeholder && textarea.placeholder)
+    options.placeholder = textarea.placeholder
+  // Set autofocus to true if this textarea is focused, or if it has
+  // autofocus and no other element is focused.
+  if (options.autofocus == null) {
+    let hasFocus = activeElt(rootNode(textarea))
+    options.autofocus = hasFocus == textarea ||
+      textarea.getAttribute("autofocus") != null && hasFocus == document.body
+  }
+
+  function save() {textarea.value = cm.getValue()}
+
+  let realSubmit
+  if (textarea.form) {
+    on(textarea.form, "submit", save)
+    // Deplorable hack to make the submit method do the right thing.
+    if (!options.leaveSubmitMethodAlone) {
+      let form = textarea.form
+      realSubmit = form.submit
+      try {
+        let wrappedSubmit = form.submit = () => {
+          save()
+          form.submit = realSubmit
+          form.submit()
+          form.submit = wrappedSubmit
+        }
+      } catch(e) {}
+    }
+  }
+
+  options.finishInit = cm => {
+    cm.save = save
+    cm.getTextArea = () => textarea
+    cm.toTextArea = () => {
+      cm.toTextArea = isNaN // Prevent this from being ran twice
+      save()
+      textarea.parentNode.removeChild(cm.getWrapperElement())
+      textarea.style.display = ""
+      if (textarea.form) {
+        off(textarea.form, "submit", save)
+        if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
+          textarea.form.submit = realSubmit
+      }
+    }
+  }
+
+  textarea.style.display = "none"
+  let cm = CodeMirror(node => textarea.parentNode.insertBefore(node, textarea.nextSibling),
+    options)
+  return cm
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/global_events.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,45 @@
+import { onBlur } from "../display/focus.js"
+import { on } from "../util/event.js"
+
+// These must be handled carefully, because naively registering a
+// handler for each editor will cause the editors to never be
+// garbage collected.
+
+function forEachCodeMirror(f) {
+  if (!document.getElementsByClassName) return
+  let byClass = document.getElementsByClassName("CodeMirror"), editors = []
+  for (let i = 0; i < byClass.length; i++) {
+    let cm = byClass[i].CodeMirror
+    if (cm) editors.push(cm)
+  }
+  if (editors.length) editors[0].operation(() => {
+    for (let i = 0; i < editors.length; i++) f(editors[i])
+  })
+}
+
+let globalsRegistered = false
+export function ensureGlobalHandlers() {
+  if (globalsRegistered) return
+  registerGlobalHandlers()
+  globalsRegistered = true
+}
+function registerGlobalHandlers() {
+  // When the window resizes, we need to refresh active editors.
+  let resizeTimer
+  on(window, "resize", () => {
+    if (resizeTimer == null) resizeTimer = setTimeout(() => {
+      resizeTimer = null
+      forEachCodeMirror(onResize)
+    }, 100)
+  })
+  // When the window loses focus, we want to show the editor as blurred
+  on(window, "blur", () => forEachCodeMirror(onBlur))
+}
+// Called when the window resizes
+function onResize(cm) {
+  let d = cm.display
+  // Might be a text scaling operation, clear size caches.
+  d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
+  d.scrollbarsClipped = false
+  cm.setSize()
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/key_events.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,163 @@
+import { signalLater } from "../util/operation_group.js"
+import { restartBlink } from "../display/selection.js"
+import { isModifierKey, keyName, lookupKey } from "../input/keymap.js"
+import { eventInWidget } from "../measurement/widgets.js"
+import { ie, ie_version, mac, presto, gecko } from "../util/browser.js"
+import { activeElt, addClass, rmClass, root } from "../util/dom.js"
+import { e_preventDefault, off, on, signalDOMEvent } from "../util/event.js"
+import { hasCopyEvent } from "../util/feature_detection.js"
+import { Delayed, Pass } from "../util/misc.js"
+
+import { commands } from "./commands.js"
+
+// Run a handler that was bound to a key.
+function doHandleBinding(cm, bound, dropShift) {
+  if (typeof bound == "string") {
+    bound = commands[bound]
+    if (!bound) return false
+  }
+  // Ensure previous input has been read, so that the handler sees a
+  // consistent view of the document
+  cm.display.input.ensurePolled()
+  let prevShift = cm.display.shift, done = false
+  try {
+    if (cm.isReadOnly()) cm.state.suppressEdits = true
+    if (dropShift) cm.display.shift = false
+    done = bound(cm) != Pass
+  } finally {
+    cm.display.shift = prevShift
+    cm.state.suppressEdits = false
+  }
+  return done
+}
+
+function lookupKeyForEditor(cm, name, handle) {
+  for (let i = 0; i < cm.state.keyMaps.length; i++) {
+    let result = lookupKey(name, cm.state.keyMaps[i], handle, cm)
+    if (result) return result
+  }
+  return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
+    || lookupKey(name, cm.options.keyMap, handle, cm)
+}
+
+// Note that, despite the name, this function is also used to check
+// for bound mouse clicks.
+
+let stopSeq = new Delayed
+
+export function dispatchKey(cm, name, e, handle) {
+  let seq = cm.state.keySeq
+  if (seq) {
+    if (isModifierKey(name)) return "handled"
+    if (/\'$/.test(name))
+      cm.state.keySeq = null
+    else
+      stopSeq.set(50, () => {
+        if (cm.state.keySeq == seq) {
+          cm.state.keySeq = null
+          cm.display.input.reset()
+        }
+      })
+    if (dispatchKeyInner(cm, seq + " " + name, e, handle)) return true
+  }
+  return dispatchKeyInner(cm, name, e, handle)
+}
+
+function dispatchKeyInner(cm, name, e, handle) {
+  let result = lookupKeyForEditor(cm, name, handle)
+
+  if (result == "multi")
+    cm.state.keySeq = name
+  if (result == "handled")
+    signalLater(cm, "keyHandled", cm, name, e)
+
+  if (result == "handled" || result == "multi") {
+    e_preventDefault(e)
+    restartBlink(cm)
+  }
+
+  return !!result
+}
+
+// Handle a key from the keydown event.
+function handleKeyBinding(cm, e) {
+  let name = keyName(e, true)
+  if (!name) return false
+
+  if (e.shiftKey && !cm.state.keySeq) {
+    // First try to resolve full name (including 'Shift-'). Failing
+    // that, see if there is a cursor-motion command (starting with
+    // 'go') bound to the keyname without 'Shift-'.
+    return dispatchKey(cm, "Shift-" + name, e, b => doHandleBinding(cm, b, true))
+        || dispatchKey(cm, name, e, b => {
+             if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
+               return doHandleBinding(cm, b)
+           })
+  } else {
+    return dispatchKey(cm, name, e, b => doHandleBinding(cm, b))
+  }
+}
+
+// Handle a key from the keypress event
+function handleCharBinding(cm, e, ch) {
+  return dispatchKey(cm, "'" + ch + "'", e, b => doHandleBinding(cm, b, true))
+}
+
+let lastStoppedKey = null
+export function onKeyDown(e) {
+  let cm = this
+  if (e.target && e.target != cm.display.input.getField()) return
+  cm.curOp.focus = activeElt(root(cm))
+  if (signalDOMEvent(cm, e)) return
+  // IE does strange things with escape.
+  if (ie && ie_version < 11 && e.keyCode == 27) e.returnValue = false
+  let code = e.keyCode
+  cm.display.shift = code == 16 || e.shiftKey
+  let handled = handleKeyBinding(cm, e)
+  if (presto) {
+    lastStoppedKey = handled ? code : null
+    // Opera has no cut event... we try to at least catch the key combo
+    if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
+      cm.replaceSelection("", null, "cut")
+  }
+  if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
+    document.execCommand("cut")
+
+  // Turn mouse into crosshair when Alt is held on Mac.
+  if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
+    showCrossHair(cm)
+}
+
+function showCrossHair(cm) {
+  let lineDiv = cm.display.lineDiv
+  addClass(lineDiv, "CodeMirror-crosshair")
+
+  function up(e) {
+    if (e.keyCode == 18 || !e.altKey) {
+      rmClass(lineDiv, "CodeMirror-crosshair")
+      off(document, "keyup", up)
+      off(document, "mouseover", up)
+    }
+  }
+  on(document, "keyup", up)
+  on(document, "mouseover", up)
+}
+
+export function onKeyUp(e) {
+  if (e.keyCode == 16) this.doc.sel.shift = false
+  signalDOMEvent(this, e)
+}
+
+export function onKeyPress(e) {
+  let cm = this
+  if (e.target && e.target != cm.display.input.getField()) return
+  if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) return
+  let keyCode = e.keyCode, charCode = e.charCode
+  if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
+  if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) return
+  let ch = String.fromCharCode(charCode == null ? keyCode : charCode)
+  // Some browsers fire keypress events for backspace
+  if (ch == "\x08") return
+  if (handleCharBinding(cm, e, ch)) return
+  cm.display.input.onKeyPress(e)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/legacy.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,62 @@
+import { scrollbarModel } from "../display/scrollbars.js"
+import { wheelEventPixels } from "../display/scroll_events.js"
+import { keyMap, keyName, isModifierKey, lookupKey, normalizeKeyMap } from "../input/keymap.js"
+import { keyNames } from "../input/keynames.js"
+import { Line } from "../line/line_data.js"
+import { cmp, Pos } from "../line/pos.js"
+import { changeEnd } from "../model/change_measurement.js"
+import Doc from "../model/Doc.js"
+import { LineWidget } from "../model/line_widget.js"
+import { SharedTextMarker, TextMarker } from "../model/mark_text.js"
+import { copyState, extendMode, getMode, innerMode, mimeModes, modeExtensions, modes, resolveMode, startState } from "../modes.js"
+import { addClass, contains, rmClass } from "../util/dom.js"
+import { e_preventDefault, e_stop, e_stopPropagation, off, on, signal } from "../util/event.js"
+import { splitLinesAuto } from "../util/feature_detection.js"
+import { countColumn, findColumn, isWordCharBasic, Pass } from "../util/misc.js"
+import StringStream from "../util/StringStream.js"
+
+import { commands } from "./commands.js"
+
+export function addLegacyProps(CodeMirror) {
+  CodeMirror.off = off
+  CodeMirror.on = on
+  CodeMirror.wheelEventPixels = wheelEventPixels
+  CodeMirror.Doc = Doc
+  CodeMirror.splitLines = splitLinesAuto
+  CodeMirror.countColumn = countColumn
+  CodeMirror.findColumn = findColumn
+  CodeMirror.isWordChar = isWordCharBasic
+  CodeMirror.Pass = Pass
+  CodeMirror.signal = signal
+  CodeMirror.Line = Line
+  CodeMirror.changeEnd = changeEnd
+  CodeMirror.scrollbarModel = scrollbarModel
+  CodeMirror.Pos = Pos
+  CodeMirror.cmpPos = cmp
+  CodeMirror.modes = modes
+  CodeMirror.mimeModes = mimeModes
+  CodeMirror.resolveMode = resolveMode
+  CodeMirror.getMode = getMode
+  CodeMirror.modeExtensions = modeExtensions
+  CodeMirror.extendMode = extendMode
+  CodeMirror.copyState = copyState
+  CodeMirror.startState = startState
+  CodeMirror.innerMode = innerMode
+  CodeMirror.commands = commands
+  CodeMirror.keyMap = keyMap
+  CodeMirror.keyName = keyName
+  CodeMirror.isModifierKey = isModifierKey
+  CodeMirror.lookupKey = lookupKey
+  CodeMirror.normalizeKeyMap = normalizeKeyMap
+  CodeMirror.StringStream = StringStream
+  CodeMirror.SharedTextMarker = SharedTextMarker
+  CodeMirror.TextMarker = TextMarker
+  CodeMirror.LineWidget = LineWidget
+  CodeMirror.e_preventDefault = e_preventDefault
+  CodeMirror.e_stopPropagation = e_stopPropagation
+  CodeMirror.e_stop = e_stop
+  CodeMirror.addClass = addClass
+  CodeMirror.contains = contains
+  CodeMirror.rmClass = rmClass
+  CodeMirror.keyNames = keyNames
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/main.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,69 @@
+// EDITOR CONSTRUCTOR
+
+import { CodeMirror } from "./CodeMirror.js"
+export { CodeMirror } from "./CodeMirror.js"
+
+import { eventMixin } from "../util/event.js"
+import { indexOf } from "../util/misc.js"
+
+import { defineOptions } from "./options.js"
+
+defineOptions(CodeMirror)
+
+import addEditorMethods from "./methods.js"
+
+addEditorMethods(CodeMirror)
+
+import Doc from "../model/Doc.js"
+
+// Set up methods on CodeMirror's prototype to redirect to the editor's document.
+let dontDelegate = "iter insert remove copy getEditor constructor".split(" ")
+for (let prop in Doc.prototype) if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
+  CodeMirror.prototype[prop] = (function(method) {
+    return function() {return method.apply(this.doc, arguments)}
+  })(Doc.prototype[prop])
+
+eventMixin(Doc)
+
+// INPUT HANDLING
+
+import ContentEditableInput from "../input/ContentEditableInput.js"
+import TextareaInput from "../input/TextareaInput.js"
+CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput}
+
+// MODE DEFINITION AND QUERYING
+
+import { defineMIME, defineMode } from "../modes.js"
+
+// Extra arguments are stored as the mode's dependencies, which is
+// used by (legacy) mechanisms like loadmode.js to automatically
+// load a mode. (Preferred mechanism is the require/define calls.)
+CodeMirror.defineMode = function(name/*, mode, …*/) {
+  if (!CodeMirror.defaults.mode && name != "null") CodeMirror.defaults.mode = name
+  defineMode.apply(this, arguments)
+}
+
+CodeMirror.defineMIME = defineMIME
+
+// Minimal default mode.
+CodeMirror.defineMode("null", () => ({token: stream => stream.skipToEnd()}))
+CodeMirror.defineMIME("text/plain", "null")
+
+// EXTENSIONS
+
+CodeMirror.defineExtension = (name, func) => {
+  CodeMirror.prototype[name] = func
+}
+CodeMirror.defineDocExtension = (name, func) => {
+  Doc.prototype[name] = func
+}
+
+import { fromTextArea } from "./fromTextArea.js"
+
+CodeMirror.fromTextArea = fromTextArea
+
+import { addLegacyProps } from "./legacy.js"
+
+addLegacyProps(CodeMirror)
+
+CodeMirror.version = "5.65.18"
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/methods.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,555 @@
+import { deleteNearSelection } from "./deleteNearSelection.js"
+import { commands } from "./commands.js"
+import { attachDoc } from "../model/document_data.js"
+import { activeElt, addClass, rmClass, root, win } from "../util/dom.js"
+import { eventMixin, signal } from "../util/event.js"
+import { getLineStyles, getContextBefore, takeToken } from "../line/highlight.js"
+import { indentLine } from "../input/indent.js"
+import { triggerElectric } from "../input/input.js"
+import { onKeyDown, onKeyPress, onKeyUp } from "./key_events.js"
+import { onMouseDown } from "./mouse_events.js"
+import { getKeyMap } from "../input/keymap.js"
+import { endOfLine, moveLogically, moveVisually } from "../input/movement.js"
+import { endOperation, methodOp, operation, runInOp, startOperation } from "../display/operations.js"
+import { clipLine, clipPos, equalCursorPos, Pos } from "../line/pos.js"
+import { charCoords, charWidth, clearCaches, clearLineMeasurementCache, coordsChar, cursorCoords, displayHeight, displayWidth, estimateLineHeights, fromCoordSystem, intoCoordSystem, scrollGap, textHeight } from "../measurement/position_measurement.js"
+import { Range } from "../model/selection.js"
+import { replaceOneSelection, skipAtomic } from "../model/selection_updates.js"
+import { addToScrollTop, ensureCursorVisible, scrollIntoView, scrollToCoords, scrollToCoordsRange, scrollToRange } from "../display/scrolling.js"
+import { heightAtLine } from "../line/spans.js"
+import { updateGutterSpace } from "../display/update_display.js"
+import { indexOf, insertSorted, isWordChar, sel_dontScroll, sel_move } from "../util/misc.js"
+import { signalLater } from "../util/operation_group.js"
+import { getLine, isLine, lineAtHeight } from "../line/utils_line.js"
+import { regChange, regLineChange } from "../display/view_tracking.js"
+
+// The publicly visible API. Note that methodOp(f) means
+// 'wrap f in an operation, performed on its `this` parameter'.
+
+// This is not the complete set of editor methods. Most of the
+// methods defined on the Doc type are also injected into
+// CodeMirror.prototype, for backwards compatibility and
+// convenience.
+
+export default function(CodeMirror) {
+  let optionHandlers = CodeMirror.optionHandlers
+
+  let helpers = CodeMirror.helpers = {}
+
+  CodeMirror.prototype = {
+    constructor: CodeMirror,
+    focus: function(){win(this).focus(); this.display.input.focus()},
+
+    setOption: function(option, value) {
+      let options = this.options, old = options[option]
+      if (options[option] == value && option != "mode") return
+      options[option] = value
+      if (optionHandlers.hasOwnProperty(option))
+        operation(this, optionHandlers[option])(this, value, old)
+      signal(this, "optionChange", this, option)
+    },
+
+    getOption: function(option) {return this.options[option]},
+    getDoc: function() {return this.doc},
+
+    addKeyMap: function(map, bottom) {
+      this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map))
+    },
+    removeKeyMap: function(map) {
+      let maps = this.state.keyMaps
+      for (let i = 0; i < maps.length; ++i)
+        if (maps[i] == map || maps[i].name == map) {
+          maps.splice(i, 1)
+          return true
+        }
+    },
+
+    addOverlay: methodOp(function(spec, options) {
+      let mode = spec.token ? spec : CodeMirror.getMode(this.options, spec)
+      if (mode.startState) throw new Error("Overlays may not be stateful.")
+      insertSorted(this.state.overlays,
+                   {mode: mode, modeSpec: spec, opaque: options && options.opaque,
+                    priority: (options && options.priority) || 0},
+                   overlay => overlay.priority)
+      this.state.modeGen++
+      regChange(this)
+    }),
+    removeOverlay: methodOp(function(spec) {
+      let overlays = this.state.overlays
+      for (let i = 0; i < overlays.length; ++i) {
+        let cur = overlays[i].modeSpec
+        if (cur == spec || typeof spec == "string" && cur.name == spec) {
+          overlays.splice(i, 1)
+          this.state.modeGen++
+          regChange(this)
+          return
+        }
+      }
+    }),
+
+    indentLine: methodOp(function(n, dir, aggressive) {
+      if (typeof dir != "string" && typeof dir != "number") {
+        if (dir == null) dir = this.options.smartIndent ? "smart" : "prev"
+        else dir = dir ? "add" : "subtract"
+      }
+      if (isLine(this.doc, n)) indentLine(this, n, dir, aggressive)
+    }),
+    indentSelection: methodOp(function(how) {
+      let ranges = this.doc.sel.ranges, end = -1
+      for (let i = 0; i < ranges.length; i++) {
+        let range = ranges[i]
+        if (!range.empty()) {
+          let from = range.from(), to = range.to()
+          let start = Math.max(end, from.line)
+          end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1
+          for (let j = start; j < end; ++j)
+            indentLine(this, j, how)
+          let newRanges = this.doc.sel.ranges
+          if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
+            replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll)
+        } else if (range.head.line > end) {
+          indentLine(this, range.head.line, how, true)
+          end = range.head.line
+          if (i == this.doc.sel.primIndex) ensureCursorVisible(this)
+        }
+      }
+    }),
+
+    // Fetch the parser token for a given character. Useful for hacks
+    // that want to inspect the mode state (say, for completion).
+    getTokenAt: function(pos, precise) {
+      return takeToken(this, pos, precise)
+    },
+
+    getLineTokens: function(line, precise) {
+      return takeToken(this, Pos(line), precise, true)
+    },
+
+    getTokenTypeAt: function(pos) {
+      pos = clipPos(this.doc, pos)
+      let styles = getLineStyles(this, getLine(this.doc, pos.line))
+      let before = 0, after = (styles.length - 1) / 2, ch = pos.ch
+      let type
+      if (ch == 0) type = styles[2]
+      else for (;;) {
+        let mid = (before + after) >> 1
+        if ((mid ? styles[mid * 2 - 1] : 0) >= ch) after = mid
+        else if (styles[mid * 2 + 1] < ch) before = mid + 1
+        else { type = styles[mid * 2 + 2]; break }
+      }
+      let cut = type ? type.indexOf("overlay ") : -1
+      return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
+    },
+
+    getModeAt: function(pos) {
+      let mode = this.doc.mode
+      if (!mode.innerMode) return mode
+      return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
+    },
+
+    getHelper: function(pos, type) {
+      return this.getHelpers(pos, type)[0]
+    },
+
+    getHelpers: function(pos, type) {
+      let found = []
+      if (!helpers.hasOwnProperty(type)) return found
+      let help = helpers[type], mode = this.getModeAt(pos)
+      if (typeof mode[type] == "string") {
+        if (help[mode[type]]) found.push(help[mode[type]])
+      } else if (mode[type]) {
+        for (let i = 0; i < mode[type].length; i++) {
+          let val = help[mode[type][i]]
+          if (val) found.push(val)
+        }
+      } else if (mode.helperType && help[mode.helperType]) {
+        found.push(help[mode.helperType])
+      } else if (help[mode.name]) {
+        found.push(help[mode.name])
+      }
+      for (let i = 0; i < help._global.length; i++) {
+        let cur = help._global[i]
+        if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
+          found.push(cur.val)
+      }
+      return found
+    },
+
+    getStateAfter: function(line, precise) {
+      let doc = this.doc
+      line = clipLine(doc, line == null ? doc.first + doc.size - 1: line)
+      return getContextBefore(this, line + 1, precise).state
+    },
+
+    cursorCoords: function(start, mode) {
+      let pos, range = this.doc.sel.primary()
+      if (start == null) pos = range.head
+      else if (typeof start == "object") pos = clipPos(this.doc, start)
+      else pos = start ? range.from() : range.to()
+      return cursorCoords(this, pos, mode || "page")
+    },
+
+    charCoords: function(pos, mode) {
+      return charCoords(this, clipPos(this.doc, pos), mode || "page")
+    },
+
+    coordsChar: function(coords, mode) {
+      coords = fromCoordSystem(this, coords, mode || "page")
+      return coordsChar(this, coords.left, coords.top)
+    },
+
+    lineAtHeight: function(height, mode) {
+      height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top
+      return lineAtHeight(this.doc, height + this.display.viewOffset)
+    },
+    heightAtLine: function(line, mode, includeWidgets) {
+      let end = false, lineObj
+      if (typeof line == "number") {
+        let last = this.doc.first + this.doc.size - 1
+        if (line < this.doc.first) line = this.doc.first
+        else if (line > last) { line = last; end = true }
+        lineObj = getLine(this.doc, line)
+      } else {
+        lineObj = line
+      }
+      return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
+        (end ? this.doc.height - heightAtLine(lineObj) : 0)
+    },
+
+    defaultTextHeight: function() { return textHeight(this.display) },
+    defaultCharWidth: function() { return charWidth(this.display) },
+
+    getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
+
+    addWidget: function(pos, node, scroll, vert, horiz) {
+      let display = this.display
+      pos = cursorCoords(this, clipPos(this.doc, pos))
+      let top = pos.bottom, left = pos.left
+      node.style.position = "absolute"
+      node.setAttribute("cm-ignore-events", "true")
+      this.display.input.setUneditable(node)
+      display.sizer.appendChild(node)
+      if (vert == "over") {
+        top = pos.top
+      } else if (vert == "above" || vert == "near") {
+        let vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
+        hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth)
+        // Default to positioning above (if specified and possible); otherwise default to positioning below
+        if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
+          top = pos.top - node.offsetHeight
+        else if (pos.bottom + node.offsetHeight <= vspace)
+          top = pos.bottom
+        if (left + node.offsetWidth > hspace)
+          left = hspace - node.offsetWidth
+      }
+      node.style.top = top + "px"
+      node.style.left = node.style.right = ""
+      if (horiz == "right") {
+        left = display.sizer.clientWidth - node.offsetWidth
+        node.style.right = "0px"
+      } else {
+        if (horiz == "left") left = 0
+        else if (horiz == "middle") left = (display.sizer.clientWidth - node.offsetWidth) / 2
+        node.style.left = left + "px"
+      }
+      if (scroll)
+        scrollIntoView(this, {left, top, right: left + node.offsetWidth, bottom: top + node.offsetHeight})
+    },
+
+    triggerOnKeyDown: methodOp(onKeyDown),
+    triggerOnKeyPress: methodOp(onKeyPress),
+    triggerOnKeyUp: onKeyUp,
+    triggerOnMouseDown: methodOp(onMouseDown),
+
+    execCommand: function(cmd) {
+      if (commands.hasOwnProperty(cmd))
+        return commands[cmd].call(null, this)
+    },
+
+    triggerElectric: methodOp(function(text) { triggerElectric(this, text) }),
+
+    findPosH: function(from, amount, unit, visually) {
+      let dir = 1
+      if (amount < 0) { dir = -1; amount = -amount }
+      let cur = clipPos(this.doc, from)
+      for (let i = 0; i < amount; ++i) {
+        cur = findPosH(this.doc, cur, dir, unit, visually)
+        if (cur.hitSide) break
+      }
+      return cur
+    },
+
+    moveH: methodOp(function(dir, unit) {
+      this.extendSelectionsBy(range => {
+        if (this.display.shift || this.doc.extend || range.empty())
+          return findPosH(this.doc, range.head, dir, unit, this.options.rtlMoveVisually)
+        else
+          return dir < 0 ? range.from() : range.to()
+      }, sel_move)
+    }),
+
+    deleteH: methodOp(function(dir, unit) {
+      let sel = this.doc.sel, doc = this.doc
+      if (sel.somethingSelected())
+        doc.replaceSelection("", null, "+delete")
+      else
+        deleteNearSelection(this, range => {
+          let other = findPosH(doc, range.head, dir, unit, false)
+          return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
+        })
+    }),
+
+    findPosV: function(from, amount, unit, goalColumn) {
+      let dir = 1, x = goalColumn
+      if (amount < 0) { dir = -1; amount = -amount }
+      let cur = clipPos(this.doc, from)
+      for (let i = 0; i < amount; ++i) {
+        let coords = cursorCoords(this, cur, "div")
+        if (x == null) x = coords.left
+        else coords.left = x
+        cur = findPosV(this, coords, dir, unit)
+        if (cur.hitSide) break
+      }
+      return cur
+    },
+
+    moveV: methodOp(function(dir, unit) {
+      let doc = this.doc, goals = []
+      let collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected()
+      doc.extendSelectionsBy(range => {
+        if (collapse)
+          return dir < 0 ? range.from() : range.to()
+        let headPos = cursorCoords(this, range.head, "div")
+        if (range.goalColumn != null) headPos.left = range.goalColumn
+        goals.push(headPos.left)
+        let pos = findPosV(this, headPos, dir, unit)
+        if (unit == "page" && range == doc.sel.primary())
+          addToScrollTop(this, charCoords(this, pos, "div").top - headPos.top)
+        return pos
+      }, sel_move)
+      if (goals.length) for (let i = 0; i < doc.sel.ranges.length; i++)
+        doc.sel.ranges[i].goalColumn = goals[i]
+    }),
+
+    // Find the word at the given position (as returned by coordsChar).
+    findWordAt: function(pos) {
+      let doc = this.doc, line = getLine(doc, pos.line).text
+      let start = pos.ch, end = pos.ch
+      if (line) {
+        let helper = this.getHelper(pos, "wordChars")
+        if ((pos.sticky == "before" || end == line.length) && start) --start; else ++end
+        let startChar = line.charAt(start)
+        let check = isWordChar(startChar, helper)
+          ? ch => isWordChar(ch, helper)
+          : /\s/.test(startChar) ? ch => /\s/.test(ch)
+          : ch => (!/\s/.test(ch) && !isWordChar(ch))
+        while (start > 0 && check(line.charAt(start - 1))) --start
+        while (end < line.length && check(line.charAt(end))) ++end
+      }
+      return new Range(Pos(pos.line, start), Pos(pos.line, end))
+    },
+
+    toggleOverwrite: function(value) {
+      if (value != null && value == this.state.overwrite) return
+      if (this.state.overwrite = !this.state.overwrite)
+        addClass(this.display.cursorDiv, "CodeMirror-overwrite")
+      else
+        rmClass(this.display.cursorDiv, "CodeMirror-overwrite")
+
+      signal(this, "overwriteToggle", this, this.state.overwrite)
+    },
+    hasFocus: function() { return this.display.input.getField() == activeElt(root(this)) },
+    isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
+
+    scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y) }),
+    getScrollInfo: function() {
+      let scroller = this.display.scroller
+      return {left: scroller.scrollLeft, top: scroller.scrollTop,
+              height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
+              width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
+              clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
+    },
+
+    scrollIntoView: methodOp(function(range, margin) {
+      if (range == null) {
+        range = {from: this.doc.sel.primary().head, to: null}
+        if (margin == null) margin = this.options.cursorScrollMargin
+      } else if (typeof range == "number") {
+        range = {from: Pos(range, 0), to: null}
+      } else if (range.from == null) {
+        range = {from: range, to: null}
+      }
+      if (!range.to) range.to = range.from
+      range.margin = margin || 0
+
+      if (range.from.line != null) {
+        scrollToRange(this, range)
+      } else {
+        scrollToCoordsRange(this, range.from, range.to, range.margin)
+      }
+    }),
+
+    setSize: methodOp(function(width, height) {
+      let interpret = val => typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val
+      if (width != null) this.display.wrapper.style.width = interpret(width)
+      if (height != null) this.display.wrapper.style.height = interpret(height)
+      if (this.options.lineWrapping) clearLineMeasurementCache(this)
+      let lineNo = this.display.viewFrom
+      this.doc.iter(lineNo, this.display.viewTo, line => {
+        if (line.widgets) for (let i = 0; i < line.widgets.length; i++)
+          if (line.widgets[i].noHScroll) { regLineChange(this, lineNo, "widget"); break }
+        ++lineNo
+      })
+      this.curOp.forceUpdate = true
+      signal(this, "refresh", this)
+    }),
+
+    operation: function(f){return runInOp(this, f)},
+    startOperation: function(){return startOperation(this)},
+    endOperation: function(){return endOperation(this)},
+
+    refresh: methodOp(function() {
+      let oldHeight = this.display.cachedTextHeight
+      regChange(this)
+      this.curOp.forceUpdate = true
+      clearCaches(this)
+      scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop)
+      updateGutterSpace(this.display)
+      if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)
+        estimateLineHeights(this)
+      signal(this, "refresh", this)
+    }),
+
+    swapDoc: methodOp(function(doc) {
+      let old = this.doc
+      old.cm = null
+      // Cancel the current text selection if any (#5821)
+      if (this.state.selectingText) this.state.selectingText()
+      attachDoc(this, doc)
+      clearCaches(this)
+      this.display.input.reset()
+      scrollToCoords(this, doc.scrollLeft, doc.scrollTop)
+      this.curOp.forceScroll = true
+      signalLater(this, "swapDoc", this, old)
+      return old
+    }),
+
+    phrase: function(phraseText) {
+      let phrases = this.options.phrases
+      return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
+    },
+
+    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}
+  }
+  eventMixin(CodeMirror)
+
+  CodeMirror.registerHelper = function(type, name, value) {
+    if (!helpers.hasOwnProperty(type)) helpers[type] = CodeMirror[type] = {_global: []}
+    helpers[type][name] = value
+  }
+  CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
+    CodeMirror.registerHelper(type, name, value)
+    helpers[type]._global.push({pred: predicate, val: value})
+  }
+}
+
+// Used for horizontal relative motion. Dir is -1 or 1 (left or
+// right), unit can be "codepoint", "char", "column" (like char, but
+// doesn't cross line boundaries), "word" (across next word), or
+// "group" (to the start of next group of word or
+// non-word-non-whitespace chars). The visually param controls
+// whether, in right-to-left text, direction 1 means to move towards
+// the next index in the string, or towards the character to the right
+// of the current position. The resulting position will have a
+// hitSide=true property if it reached the end of the document.
+function findPosH(doc, pos, dir, unit, visually) {
+  let oldPos = pos
+  let origDir = dir
+  let lineObj = getLine(doc, pos.line)
+  let lineDir = visually && doc.direction == "rtl" ? -dir : dir
+  function findNextLine() {
+    let l = pos.line + lineDir
+    if (l < doc.first || l >= doc.first + doc.size) return false
+    pos = new Pos(l, pos.ch, pos.sticky)
+    return lineObj = getLine(doc, l)
+  }
+  function moveOnce(boundToLine) {
+    let next
+    if (unit == "codepoint") {
+      let ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1))
+      if (isNaN(ch)) {
+        next = null
+      } else {
+        let astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF
+        next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir)
+      }
+    } else if (visually) {
+      next = moveVisually(doc.cm, lineObj, pos, dir)
+    } else {
+      next = moveLogically(lineObj, pos, dir)
+    }
+    if (next == null) {
+      if (!boundToLine && findNextLine())
+        pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir)
+      else
+        return false
+    } else {
+      pos = next
+    }
+    return true
+  }
+
+  if (unit == "char" || unit == "codepoint") {
+    moveOnce()
+  } else if (unit == "column") {
+    moveOnce(true)
+  } else if (unit == "word" || unit == "group") {
+    let sawType = null, group = unit == "group"
+    let helper = doc.cm && doc.cm.getHelper(pos, "wordChars")
+    for (let first = true;; first = false) {
+      if (dir < 0 && !moveOnce(!first)) break
+      let cur = lineObj.text.charAt(pos.ch) || "\n"
+      let type = isWordChar(cur, helper) ? "w"
+        : group && cur == "\n" ? "n"
+        : !group || /\s/.test(cur) ? null
+        : "p"
+      if (group && !first && !type) type = "s"
+      if (sawType && sawType != type) {
+        if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after"}
+        break
+      }
+
+      if (type) sawType = type
+      if (dir > 0 && !moveOnce(!first)) break
+    }
+  }
+  let result = skipAtomic(doc, pos, oldPos, origDir, true)
+  if (equalCursorPos(oldPos, result)) result.hitSide = true
+  return result
+}
+
+// For relative vertical movement. Dir may be -1 or 1. Unit can be
+// "page" or "line". The resulting position will have a hitSide=true
+// property if it reached the end of the document.
+function findPosV(cm, pos, dir, unit) {
+  let doc = cm.doc, x = pos.left, y
+  if (unit == "page") {
+    let pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight)
+    let moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3)
+    y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount
+
+  } else if (unit == "line") {
+    y = dir > 0 ? pos.bottom + 3 : pos.top - 3
+  }
+  let target
+  for (;;) {
+    target = coordsChar(cm, x, y)
+    if (!target.outside) break
+    if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
+    y += dir * 5
+  }
+  return target
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/mouse_events.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,417 @@
+import { delayBlurEvent, ensureFocus } from "../display/focus.js"
+import { operation } from "../display/operations.js"
+import { visibleLines } from "../display/update_lines.js"
+import { clipPos, cmp, maxPos, minPos, Pos } from "../line/pos.js"
+import { getLine, lineAtHeight } from "../line/utils_line.js"
+import { posFromMouse } from "../measurement/position_measurement.js"
+import { eventInWidget } from "../measurement/widgets.js"
+import { normalizeSelection, Range, Selection } from "../model/selection.js"
+import { extendRange, extendSelection, replaceOneSelection, setSelection } from "../model/selection_updates.js"
+import { captureRightClick, chromeOS, ie, ie_version, mac, webkit, safari } from "../util/browser.js"
+import { getOrder, getBidiPartAt } from "../util/bidi.js"
+import { activeElt, root, win } from "../util/dom.js"
+import { e_button, e_defaultPrevented, e_preventDefault, e_target, hasHandler, off, on, signal, signalDOMEvent } from "../util/event.js"
+import { dragAndDrop } from "../util/feature_detection.js"
+import { bind, countColumn, findColumn, sel_mouse } from "../util/misc.js"
+import { addModifierNames } from "../input/keymap.js"
+import { Pass } from "../util/misc.js"
+
+import { dispatchKey } from "./key_events.js"
+import { commands } from "./commands.js"
+
+const DOUBLECLICK_DELAY = 400
+
+class PastClick {
+  constructor(time, pos, button) {
+    this.time = time
+    this.pos = pos
+    this.button = button
+  }
+
+  compare(time, pos, button) {
+    return this.time + DOUBLECLICK_DELAY > time &&
+      cmp(pos, this.pos) == 0 && button == this.button
+  }
+}
+
+let lastClick, lastDoubleClick
+function clickRepeat(pos, button) {
+  let now = +new Date
+  if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
+    lastClick = lastDoubleClick = null
+    return "triple"
+  } else if (lastClick && lastClick.compare(now, pos, button)) {
+    lastDoubleClick = new PastClick(now, pos, button)
+    lastClick = null
+    return "double"
+  } else {
+    lastClick = new PastClick(now, pos, button)
+    lastDoubleClick = null
+    return "single"
+  }
+}
+
+// A mouse down can be a single click, double click, triple click,
+// start of selection drag, start of text drag, new cursor
+// (ctrl-click), rectangle drag (alt-drag), or xwin
+// middle-click-paste. Or it might be a click on something we should
+// not interfere with, such as a scrollbar or widget.
+export function onMouseDown(e) {
+  let cm = this, display = cm.display
+  if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) return
+  display.input.ensurePolled()
+  display.shift = e.shiftKey
+
+  if (eventInWidget(display, e)) {
+    if (!webkit) {
+      // Briefly turn off draggability, to allow widgets to do
+      // normal dragging things.
+      display.scroller.draggable = false
+      setTimeout(() => display.scroller.draggable = true, 100)
+    }
+    return
+  }
+  if (clickInGutter(cm, e)) return
+  let pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single"
+  win(cm).focus()
+
+  // #3261: make sure, that we're not starting a second selection
+  if (button == 1 && cm.state.selectingText)
+    cm.state.selectingText(e)
+
+  if (pos && handleMappedButton(cm, button, pos, repeat, e)) return
+
+  if (button == 1) {
+    if (pos) leftButtonDown(cm, pos, repeat, e)
+    else if (e_target(e) == display.scroller) e_preventDefault(e)
+  } else if (button == 2) {
+    if (pos) extendSelection(cm.doc, pos)
+    setTimeout(() => display.input.focus(), 20)
+  } else if (button == 3) {
+    if (captureRightClick) cm.display.input.onContextMenu(e)
+    else delayBlurEvent(cm)
+  }
+}
+
+function handleMappedButton(cm, button, pos, repeat, event) {
+  let name = "Click"
+  if (repeat == "double") name = "Double" + name
+  else if (repeat == "triple") name = "Triple" + name
+  name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name
+
+  return dispatchKey(cm,  addModifierNames(name, event), event, bound => {
+    if (typeof bound == "string") bound = commands[bound]
+    if (!bound) return false
+    let done = false
+    try {
+      if (cm.isReadOnly()) cm.state.suppressEdits = true
+      done = bound(cm, pos) != Pass
+    } finally {
+      cm.state.suppressEdits = false
+    }
+    return done
+  })
+}
+
+function configureMouse(cm, repeat, event) {
+  let option = cm.getOption("configureMouse")
+  let value = option ? option(cm, repeat, event) : {}
+  if (value.unit == null) {
+    let rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey
+    value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line"
+  }
+  if (value.extend == null || cm.doc.extend) value.extend = cm.doc.extend || event.shiftKey
+  if (value.addNew == null) value.addNew = mac ? event.metaKey : event.ctrlKey
+  if (value.moveOnDrag == null) value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey)
+  return value
+}
+
+function leftButtonDown(cm, pos, repeat, event) {
+  if (ie) setTimeout(bind(ensureFocus, cm), 0)
+  else cm.curOp.focus = activeElt(root(cm))
+
+  let behavior = configureMouse(cm, repeat, event)
+
+  let sel = cm.doc.sel, contained
+  if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
+      repeat == "single" && (contained = sel.contains(pos)) > -1 &&
+      (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
+      (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
+    leftButtonStartDrag(cm, event, pos, behavior)
+  else
+    leftButtonSelect(cm, event, pos, behavior)
+}
+
+// Start a text drag. When it ends, see if any dragging actually
+// happen, and treat as a click if it didn't.
+function leftButtonStartDrag(cm, event, pos, behavior) {
+  let display = cm.display, moved = false
+  let dragEnd = operation(cm, e => {
+    if (webkit) display.scroller.draggable = false
+    cm.state.draggingText = false
+    if (cm.state.delayingBlurEvent) {
+      if (cm.hasFocus()) cm.state.delayingBlurEvent = false
+      else delayBlurEvent(cm)
+    }
+    off(display.wrapper.ownerDocument, "mouseup", dragEnd)
+    off(display.wrapper.ownerDocument, "mousemove", mouseMove)
+    off(display.scroller, "dragstart", dragStart)
+    off(display.scroller, "drop", dragEnd)
+    if (!moved) {
+      e_preventDefault(e)
+      if (!behavior.addNew)
+        extendSelection(cm.doc, pos, null, null, behavior.extend)
+      // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
+      if ((webkit && !safari) || ie && ie_version == 9)
+        setTimeout(() => {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus()}, 20)
+      else
+        display.input.focus()
+    }
+  })
+  let mouseMove = function(e2) {
+    moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10
+  }
+  let dragStart = () => moved = true
+  // Let the drag handler handle this.
+  if (webkit) display.scroller.draggable = true
+  cm.state.draggingText = dragEnd
+  dragEnd.copy = !behavior.moveOnDrag
+  on(display.wrapper.ownerDocument, "mouseup", dragEnd)
+  on(display.wrapper.ownerDocument, "mousemove", mouseMove)
+  on(display.scroller, "dragstart", dragStart)
+  on(display.scroller, "drop", dragEnd)
+
+  cm.state.delayingBlurEvent = true
+  setTimeout(() => display.input.focus(), 20)
+  // IE's approach to draggable
+  if (display.scroller.dragDrop) display.scroller.dragDrop()
+}
+
+function rangeForUnit(cm, pos, unit) {
+  if (unit == "char") return new Range(pos, pos)
+  if (unit == "word") return cm.findWordAt(pos)
+  if (unit == "line") return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))
+  let result = unit(cm, pos)
+  return new Range(result.from, result.to)
+}
+
+// Normal selection, as opposed to text dragging.
+function leftButtonSelect(cm, event, start, behavior) {
+  if (ie) delayBlurEvent(cm)
+  let display = cm.display, doc = cm.doc
+  e_preventDefault(event)
+
+  let ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges
+  if (behavior.addNew && !behavior.extend) {
+    ourIndex = doc.sel.contains(start)
+    if (ourIndex > -1)
+      ourRange = ranges[ourIndex]
+    else
+      ourRange = new Range(start, start)
+  } else {
+    ourRange = doc.sel.primary()
+    ourIndex = doc.sel.primIndex
+  }
+
+  if (behavior.unit == "rectangle") {
+    if (!behavior.addNew) ourRange = new Range(start, start)
+    start = posFromMouse(cm, event, true, true)
+    ourIndex = -1
+  } else {
+    let range = rangeForUnit(cm, start, behavior.unit)
+    if (behavior.extend)
+      ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend)
+    else
+      ourRange = range
+  }
+
+  if (!behavior.addNew) {
+    ourIndex = 0
+    setSelection(doc, new Selection([ourRange], 0), sel_mouse)
+    startSel = doc.sel
+  } else if (ourIndex == -1) {
+    ourIndex = ranges.length
+    setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
+                 {scroll: false, origin: "*mouse"})
+  } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
+    setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
+                 {scroll: false, origin: "*mouse"})
+    startSel = doc.sel
+  } else {
+    replaceOneSelection(doc, ourIndex, ourRange, sel_mouse)
+  }
+
+  let lastPos = start
+  function extendTo(pos) {
+    if (cmp(lastPos, pos) == 0) return
+    lastPos = pos
+
+    if (behavior.unit == "rectangle") {
+      let ranges = [], tabSize = cm.options.tabSize
+      let startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize)
+      let posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize)
+      let left = Math.min(startCol, posCol), right = Math.max(startCol, posCol)
+      for (let line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
+           line <= end; line++) {
+        let text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize)
+        if (left == right)
+          ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)))
+        else if (text.length > leftPos)
+          ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))))
+      }
+      if (!ranges.length) ranges.push(new Range(start, start))
+      setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
+                   {origin: "*mouse", scroll: false})
+      cm.scrollIntoView(pos)
+    } else {
+      let oldRange = ourRange
+      let range = rangeForUnit(cm, pos, behavior.unit)
+      let anchor = oldRange.anchor, head
+      if (cmp(range.anchor, anchor) > 0) {
+        head = range.head
+        anchor = minPos(oldRange.from(), range.anchor)
+      } else {
+        head = range.anchor
+        anchor = maxPos(oldRange.to(), range.head)
+      }
+      let ranges = startSel.ranges.slice(0)
+      ranges[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head))
+      setSelection(doc, normalizeSelection(cm, ranges, ourIndex), sel_mouse)
+    }
+  }
+
+  let editorSize = display.wrapper.getBoundingClientRect()
+  // Used to ensure timeout re-tries don't fire when another extend
+  // happened in the meantime (clearTimeout isn't reliable -- at
+  // least on Chrome, the timeouts still happen even when cleared,
+  // if the clear happens after their scheduled firing time).
+  let counter = 0
+
+  function extend(e) {
+    let curCount = ++counter
+    let cur = posFromMouse(cm, e, true, behavior.unit == "rectangle")
+    if (!cur) return
+    if (cmp(cur, lastPos) != 0) {
+      cm.curOp.focus = activeElt(root(cm))
+      extendTo(cur)
+      let visible = visibleLines(display, doc)
+      if (cur.line >= visible.to || cur.line < visible.from)
+        setTimeout(operation(cm, () => {if (counter == curCount) extend(e)}), 150)
+    } else {
+      let outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0
+      if (outside) setTimeout(operation(cm, () => {
+        if (counter != curCount) return
+        display.scroller.scrollTop += outside
+        extend(e)
+      }), 50)
+    }
+  }
+
+  function done(e) {
+    cm.state.selectingText = false
+    counter = Infinity
+    // If e is null or undefined we interpret this as someone trying
+    // to explicitly cancel the selection rather than the user
+    // letting go of the mouse button.
+    if (e) {
+      e_preventDefault(e)
+      display.input.focus()
+    }
+    off(display.wrapper.ownerDocument, "mousemove", move)
+    off(display.wrapper.ownerDocument, "mouseup", up)
+    doc.history.lastSelOrigin = null
+  }
+
+  let move = operation(cm, e => {
+    if (e.buttons === 0 || !e_button(e)) done(e)
+    else extend(e)
+  })
+  let up = operation(cm, done)
+  cm.state.selectingText = up
+  on(display.wrapper.ownerDocument, "mousemove", move)
+  on(display.wrapper.ownerDocument, "mouseup", up)
+}
+
+// Used when mouse-selecting to adjust the anchor to the proper side
+// of a bidi jump depending on the visual position of the head.
+function bidiSimplify(cm, range) {
+  let {anchor, head} = range, anchorLine = getLine(cm.doc, anchor.line)
+  if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) return range
+  let order = getOrder(anchorLine)
+  if (!order) return range
+  let index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index]
+  if (part.from != anchor.ch && part.to != anchor.ch) return range
+  let boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1)
+  if (boundary == 0 || boundary == order.length) return range
+
+  // Compute the relative visual position of the head compared to the
+  // anchor (<0 is to the left, >0 to the right)
+  let leftSide
+  if (head.line != anchor.line) {
+    leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0
+  } else {
+    let headIndex = getBidiPartAt(order, head.ch, head.sticky)
+    let dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1)
+    if (headIndex == boundary - 1 || headIndex == boundary)
+      leftSide = dir < 0
+    else
+      leftSide = dir > 0
+  }
+
+  let usePart = order[boundary + (leftSide ? -1 : 0)]
+  let from = leftSide == (usePart.level == 1)
+  let ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before"
+  return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
+}
+
+
+// Determines whether an event happened in the gutter, and fires the
+// handlers for the corresponding event.
+function gutterEvent(cm, e, type, prevent) {
+  let mX, mY
+  if (e.touches) {
+    mX = e.touches[0].clientX
+    mY = e.touches[0].clientY
+  } else {
+    try { mX = e.clientX; mY = e.clientY }
+    catch(e) { return false }
+  }
+  if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) return false
+  if (prevent) e_preventDefault(e)
+
+  let display = cm.display
+  let lineBox = display.lineDiv.getBoundingClientRect()
+
+  if (mY > lineBox.bottom || !hasHandler(cm, type)) return e_defaultPrevented(e)
+  mY -= lineBox.top - display.viewOffset
+
+  for (let i = 0; i < cm.display.gutterSpecs.length; ++i) {
+    let g = display.gutters.childNodes[i]
+    if (g && g.getBoundingClientRect().right >= mX) {
+      let line = lineAtHeight(cm.doc, mY)
+      let gutter = cm.display.gutterSpecs[i]
+      signal(cm, type, cm, line, gutter.className, e)
+      return e_defaultPrevented(e)
+    }
+  }
+}
+
+export function clickInGutter(cm, e) {
+  return gutterEvent(cm, e, "gutterClick", true)
+}
+
+// CONTEXT MENU HANDLING
+
+// To make the context menu work, we need to briefly unhide the
+// textarea (making it as unobtrusive as possible) to let the
+// right-click take effect on it.
+export function onContextMenu(cm, e) {
+  if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) return
+  if (signalDOMEvent(cm, e, "contextmenu")) return
+  if (!captureRightClick) cm.display.input.onContextMenu(e)
+}
+
+function contextMenuInGutter(cm, e) {
+  if (!hasHandler(cm, "gutterContextMenu")) return false
+  return gutterEvent(cm, e, "gutterContextMenu", false)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/options.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,194 @@
+import { onBlur } from "../display/focus.js"
+import { getGutters, updateGutters } from "../display/gutters.js"
+import { loadMode, resetModeState } from "../display/mode_state.js"
+import { initScrollbars, updateScrollbars } from "../display/scrollbars.js"
+import { updateSelection } from "../display/selection.js"
+import { regChange } from "../display/view_tracking.js"
+import { getKeyMap } from "../input/keymap.js"
+import { defaultSpecialCharPlaceholder } from "../line/line_data.js"
+import { Pos } from "../line/pos.js"
+import { findMaxLine } from "../line/spans.js"
+import { clearCaches, compensateForHScroll, estimateLineHeights } from "../measurement/position_measurement.js"
+import { replaceRange } from "../model/changes.js"
+import { mobile, windows } from "../util/browser.js"
+import { addClass, rmClass } from "../util/dom.js"
+import { off, on } from "../util/event.js"
+
+import { themeChanged } from "./utils.js"
+
+export let Init = {toString: function(){return "CodeMirror.Init"}}
+
+export let defaults = {}
+export let optionHandlers = {}
+
+export function defineOptions(CodeMirror) {
+  let optionHandlers = CodeMirror.optionHandlers
+
+  function option(name, deflt, handle, notOnInit) {
+    CodeMirror.defaults[name] = deflt
+    if (handle) optionHandlers[name] =
+      notOnInit ? (cm, val, old) => {if (old != Init) handle(cm, val, old)} : handle
+  }
+
+  CodeMirror.defineOption = option
+
+  // Passed to option handlers when there is no old value.
+  CodeMirror.Init = Init
+
+  // These two are, on init, called from the constructor because they
+  // have to be initialized before the editor can start at all.
+  option("value", "", (cm, val) => cm.setValue(val), true)
+  option("mode", null, (cm, val) => {
+    cm.doc.modeOption = val
+    loadMode(cm)
+  }, true)
+
+  option("indentUnit", 2, loadMode, true)
+  option("indentWithTabs", false)
+  option("smartIndent", true)
+  option("tabSize", 4, cm => {
+    resetModeState(cm)
+    clearCaches(cm)
+    regChange(cm)
+  }, true)
+
+  option("lineSeparator", null, (cm, val) => {
+    cm.doc.lineSep = val
+    if (!val) return
+    let newBreaks = [], lineNo = cm.doc.first
+    cm.doc.iter(line => {
+      for (let pos = 0;;) {
+        let found = line.text.indexOf(val, pos)
+        if (found == -1) break
+        pos = found + val.length
+        newBreaks.push(Pos(lineNo, found))
+      }
+      lineNo++
+    })
+    for (let i = newBreaks.length - 1; i >= 0; i--)
+      replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length))
+  })
+  option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g, (cm, val, old) => {
+    cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g")
+    if (old != Init) cm.refresh()
+  })
+  option("specialCharPlaceholder", defaultSpecialCharPlaceholder, cm => cm.refresh(), true)
+  option("electricChars", true)
+  option("inputStyle", mobile ? "contenteditable" : "textarea", () => {
+    throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
+  }, true)
+  option("spellcheck", false, (cm, val) => cm.getInputField().spellcheck = val, true)
+  option("autocorrect", false, (cm, val) => cm.getInputField().autocorrect = val, true)
+  option("autocapitalize", false, (cm, val) => cm.getInputField().autocapitalize = val, true)
+  option("rtlMoveVisually", !windows)
+  option("wholeLineUpdateBefore", true)
+
+  option("theme", "default", cm => {
+    themeChanged(cm)
+    updateGutters(cm)
+  }, true)
+  option("keyMap", "default", (cm, val, old) => {
+    let next = getKeyMap(val)
+    let prev = old != Init && getKeyMap(old)
+    if (prev && prev.detach) prev.detach(cm, next)
+    if (next.attach) next.attach(cm, prev || null)
+  })
+  option("extraKeys", null)
+  option("configureMouse", null)
+
+  option("lineWrapping", false, wrappingChanged, true)
+  option("gutters", [], (cm, val) => {
+    cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers)
+    updateGutters(cm)
+  }, true)
+  option("fixedGutter", true, (cm, val) => {
+    cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0"
+    cm.refresh()
+  }, true)
+  option("coverGutterNextToScrollbar", false, cm => updateScrollbars(cm), true)
+  option("scrollbarStyle", "native", cm => {
+    initScrollbars(cm)
+    updateScrollbars(cm)
+    cm.display.scrollbars.setScrollTop(cm.doc.scrollTop)
+    cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)
+  }, true)
+  option("lineNumbers", false, (cm, val) => {
+    cm.display.gutterSpecs = getGutters(cm.options.gutters, val)
+    updateGutters(cm)
+  }, true)
+  option("firstLineNumber", 1, updateGutters, true)
+  option("lineNumberFormatter", integer => integer, updateGutters, true)
+  option("showCursorWhenSelecting", false, updateSelection, true)
+
+  option("resetSelectionOnContextMenu", true)
+  option("lineWiseCopyCut", true)
+  option("pasteLinesPerSelection", true)
+  option("selectionsMayTouch", false)
+
+  option("readOnly", false, (cm, val) => {
+    if (val == "nocursor") {
+      onBlur(cm)
+      cm.display.input.blur()
+    }
+    cm.display.input.readOnlyChanged(val)
+  })
+
+  option("screenReaderLabel", null, (cm, val) => {
+    val = (val === '') ? null : val
+    cm.display.input.screenReaderLabelChanged(val)
+  })
+
+  option("disableInput", false, (cm, val) => {if (!val) cm.display.input.reset()}, true)
+  option("dragDrop", true, dragDropChanged)
+  option("allowDropFileTypes", null)
+
+  option("cursorBlinkRate", 530)
+  option("cursorScrollMargin", 0)
+  option("cursorHeight", 1, updateSelection, true)
+  option("singleCursorHeightPerLine", true, updateSelection, true)
+  option("workTime", 100)
+  option("workDelay", 100)
+  option("flattenSpans", true, resetModeState, true)
+  option("addModeClass", false, resetModeState, true)
+  option("pollInterval", 100)
+  option("undoDepth", 200, (cm, val) => cm.doc.history.undoDepth = val)
+  option("historyEventDelay", 1250)
+  option("viewportMargin", 10, cm => cm.refresh(), true)
+  option("maxHighlightLength", 10000, resetModeState, true)
+  option("moveInputWithCursor", true, (cm, val) => {
+    if (!val) cm.display.input.resetPosition()
+  })
+
+  option("tabindex", null, (cm, val) => cm.display.input.getField().tabIndex = val || "")
+  option("autofocus", null)
+  option("direction", "ltr", (cm, val) => cm.doc.setDirection(val), true)
+  option("phrases", null)
+}
+
+function dragDropChanged(cm, value, old) {
+  let wasOn = old && old != Init
+  if (!value != !wasOn) {
+    let funcs = cm.display.dragFunctions
+    let toggle = value ? on : off
+    toggle(cm.display.scroller, "dragstart", funcs.start)
+    toggle(cm.display.scroller, "dragenter", funcs.enter)
+    toggle(cm.display.scroller, "dragover", funcs.over)
+    toggle(cm.display.scroller, "dragleave", funcs.leave)
+    toggle(cm.display.scroller, "drop", funcs.drop)
+  }
+}
+
+function wrappingChanged(cm) {
+  if (cm.options.lineWrapping) {
+    addClass(cm.display.wrapper, "CodeMirror-wrap")
+    cm.display.sizer.style.minWidth = ""
+    cm.display.sizerWidth = null
+  } else {
+    rmClass(cm.display.wrapper, "CodeMirror-wrap")
+    findMaxLine(cm)
+  }
+  estimateLineHeights(cm)
+  regChange(cm)
+  clearCaches(cm)
+  setTimeout(() => updateScrollbars(cm), 100)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/edit/utils.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,7 @@
+import { clearCaches } from "../measurement/position_measurement.js"
+
+export function themeChanged(cm) {
+  cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
+    cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-")
+  clearCaches(cm)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/ContentEditableInput.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,546 @@
+import { operation, runInOp } from "../display/operations.js"
+import { prepareSelection } from "../display/selection.js"
+import { regChange } from "../display/view_tracking.js"
+import { applyTextInput, copyableRanges, disableBrowserMagic, handlePaste, hiddenTextarea, lastCopied, setLastCopied } from "./input.js"
+import { cmp, maxPos, minPos, Pos } from "../line/pos.js"
+import { getBetween, getLine, lineNo } from "../line/utils_line.js"
+import { findViewForLine, findViewIndex, mapFromLineView, nodeAndOffsetInLineMap } from "../measurement/position_measurement.js"
+import { replaceRange } from "../model/changes.js"
+import { simpleSelection } from "../model/selection.js"
+import { setSelection } from "../model/selection_updates.js"
+import { getBidiPartAt, getOrder } from "../util/bidi.js"
+import { android, chrome, gecko, ie_version } from "../util/browser.js"
+import { activeElt, contains, range, removeChildrenAndAdd, selectInput, rootNode } from "../util/dom.js"
+import { on, signalDOMEvent } from "../util/event.js"
+import { Delayed, lst, sel_dontScroll } from "../util/misc.js"
+
+// CONTENTEDITABLE INPUT STYLE
+
+export default class ContentEditableInput {
+  constructor(cm) {
+    this.cm = cm
+    this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null
+    this.polling = new Delayed()
+    this.composing = null
+    this.gracePeriod = false
+    this.readDOMTimeout = null
+  }
+
+  init(display) {
+    let input = this, cm = input.cm
+    let div = input.div = display.lineDiv
+    div.contentEditable = true
+    disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize)
+
+    function belongsToInput(e) {
+      for (let t = e.target; t; t = t.parentNode) {
+        if (t == div) return true
+        if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) break
+      }
+      return false
+    }
+
+    on(div, "paste", e => {
+      if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) return
+      // IE doesn't fire input events, so we schedule a read for the pasted content in this way
+      if (ie_version <= 11) setTimeout(operation(cm, () => this.updateFromDOM()), 20)
+    })
+
+    on(div, "compositionstart", e => {
+      this.composing = {data: e.data, done: false}
+    })
+    on(div, "compositionupdate", e => {
+      if (!this.composing) this.composing = {data: e.data, done: false}
+    })
+    on(div, "compositionend", e => {
+      if (this.composing) {
+        if (e.data != this.composing.data) this.readFromDOMSoon()
+        this.composing.done = true
+      }
+    })
+
+    on(div, "touchstart", () => input.forceCompositionEnd())
+
+    on(div, "input", () => {
+      if (!this.composing) this.readFromDOMSoon()
+    })
+
+    function onCopyCut(e) {
+      if (!belongsToInput(e) || signalDOMEvent(cm, e)) return
+      if (cm.somethingSelected()) {
+        setLastCopied({lineWise: false, text: cm.getSelections()})
+        if (e.type == "cut") cm.replaceSelection("", null, "cut")
+      } else if (!cm.options.lineWiseCopyCut) {
+        return
+      } else {
+        let ranges = copyableRanges(cm)
+        setLastCopied({lineWise: true, text: ranges.text})
+        if (e.type == "cut") {
+          cm.operation(() => {
+            cm.setSelections(ranges.ranges, 0, sel_dontScroll)
+            cm.replaceSelection("", null, "cut")
+          })
+        }
+      }
+      if (e.clipboardData) {
+        e.clipboardData.clearData()
+        let content = lastCopied.text.join("\n")
+        // iOS exposes the clipboard API, but seems to discard content inserted into it
+        e.clipboardData.setData("Text", content)
+        if (e.clipboardData.getData("Text") == content) {
+          e.preventDefault()
+          return
+        }
+      }
+      // Old-fashioned briefly-focus-a-textarea hack
+      let kludge = hiddenTextarea(), te = kludge.firstChild
+      disableBrowserMagic(te)
+      cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild)
+      te.value = lastCopied.text.join("\n")
+      let hadFocus = activeElt(rootNode(div))
+      selectInput(te)
+      setTimeout(() => {
+        cm.display.lineSpace.removeChild(kludge)
+        hadFocus.focus()
+        if (hadFocus == div) input.showPrimarySelection()
+      }, 50)
+    }
+    on(div, "copy", onCopyCut)
+    on(div, "cut", onCopyCut)
+  }
+
+  screenReaderLabelChanged(label) {
+    // Label for screenreaders, accessibility
+    if(label) {
+      this.div.setAttribute('aria-label', label)
+    } else {
+      this.div.removeAttribute('aria-label')
+    }
+  }
+
+  prepareSelection() {
+    let result = prepareSelection(this.cm, false)
+    result.focus = activeElt(rootNode(this.div)) == this.div
+    return result
+  }
+
+  showSelection(info, takeFocus) {
+    if (!info || !this.cm.display.view.length) return
+    if (info.focus || takeFocus) this.showPrimarySelection()
+    this.showMultipleSelections(info)
+  }
+
+  getSelection() {
+    return this.cm.display.wrapper.ownerDocument.getSelection()
+  }
+
+  showPrimarySelection() {
+    let sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary()
+    let from = prim.from(), to = prim.to()
+
+    if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
+      sel.removeAllRanges()
+      return
+    }
+
+    let curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)
+    let curFocus = domToPos(cm, sel.focusNode, sel.focusOffset)
+    if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
+        cmp(minPos(curAnchor, curFocus), from) == 0 &&
+        cmp(maxPos(curAnchor, curFocus), to) == 0)
+      return
+
+    let view = cm.display.view
+    let start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
+        {node: view[0].measure.map[2], offset: 0}
+    let end = to.line < cm.display.viewTo && posToDOM(cm, to)
+    if (!end) {
+      let measure = view[view.length - 1].measure
+      let map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map
+      end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]}
+    }
+
+    if (!start || !end) {
+      sel.removeAllRanges()
+      return
+    }
+
+    let old = sel.rangeCount && sel.getRangeAt(0), rng
+    try { rng = range(start.node, start.offset, end.offset, end.node) }
+    catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
+    if (rng) {
+      if (!gecko && cm.state.focused) {
+        sel.collapse(start.node, start.offset)
+        if (!rng.collapsed) {
+          sel.removeAllRanges()
+          sel.addRange(rng)
+        }
+      } else {
+        sel.removeAllRanges()
+        sel.addRange(rng)
+      }
+      if (old && sel.anchorNode == null) sel.addRange(old)
+      else if (gecko) this.startGracePeriod()
+    }
+    this.rememberSelection()
+  }
+
+  startGracePeriod() {
+    clearTimeout(this.gracePeriod)
+    this.gracePeriod = setTimeout(() => {
+      this.gracePeriod = false
+      if (this.selectionChanged())
+        this.cm.operation(() => this.cm.curOp.selectionChanged = true)
+    }, 20)
+  }
+
+  showMultipleSelections(info) {
+    removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors)
+    removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection)
+  }
+
+  rememberSelection() {
+    let sel = this.getSelection()
+    this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset
+    this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset
+  }
+
+  selectionInEditor() {
+    let sel = this.getSelection()
+    if (!sel.rangeCount) return false
+    let node = sel.getRangeAt(0).commonAncestorContainer
+    return contains(this.div, node)
+  }
+
+  focus() {
+    if (this.cm.options.readOnly != "nocursor") {
+      if (!this.selectionInEditor() || activeElt(rootNode(this.div)) != this.div)
+        this.showSelection(this.prepareSelection(), true)
+      this.div.focus()
+    }
+  }
+  blur() { this.div.blur() }
+  getField() { return this.div }
+
+  supportsTouch() { return true }
+
+  receivedFocus() {
+    let input = this
+    if (this.selectionInEditor())
+      setTimeout(() => this.pollSelection(), 20)
+    else
+      runInOp(this.cm, () => input.cm.curOp.selectionChanged = true)
+
+    function poll() {
+      if (input.cm.state.focused) {
+        input.pollSelection()
+        input.polling.set(input.cm.options.pollInterval, poll)
+      }
+    }
+    this.polling.set(this.cm.options.pollInterval, poll)
+  }
+
+  selectionChanged() {
+    let sel = this.getSelection()
+    return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
+      sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
+  }
+
+  pollSelection() {
+    if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) return
+    let sel = this.getSelection(), cm = this.cm
+    // On Android Chrome (version 56, at least), backspacing into an
+    // uneditable block element will put the cursor in that element,
+    // and then, because it's not editable, hide the virtual keyboard.
+    // Because Android doesn't allow us to actually detect backspace
+    // presses in a sane way, this code checks for when that happens
+    // and simulates a backspace press in this case.
+    if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {
+      this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs})
+      this.blur()
+      this.focus()
+      return
+    }
+    if (this.composing) return
+    this.rememberSelection()
+    let anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset)
+    let head = domToPos(cm, sel.focusNode, sel.focusOffset)
+    if (anchor && head) runInOp(cm, () => {
+      setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll)
+      if (anchor.bad || head.bad) cm.curOp.selectionChanged = true
+    })
+  }
+
+  pollContent() {
+    if (this.readDOMTimeout != null) {
+      clearTimeout(this.readDOMTimeout)
+      this.readDOMTimeout = null
+    }
+
+    let cm = this.cm, display = cm.display, sel = cm.doc.sel.primary()
+    let from = sel.from(), to = sel.to()
+    if (from.ch == 0 && from.line > cm.firstLine())
+      from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length)
+    if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
+      to = Pos(to.line + 1, 0)
+    if (from.line < display.viewFrom || to.line > display.viewTo - 1) return false
+
+    let fromIndex, fromLine, fromNode
+    if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
+      fromLine = lineNo(display.view[0].line)
+      fromNode = display.view[0].node
+    } else {
+      fromLine = lineNo(display.view[fromIndex].line)
+      fromNode = display.view[fromIndex - 1].node.nextSibling
+    }
+    let toIndex = findViewIndex(cm, to.line)
+    let toLine, toNode
+    if (toIndex == display.view.length - 1) {
+      toLine = display.viewTo - 1
+      toNode = display.lineDiv.lastChild
+    } else {
+      toLine = lineNo(display.view[toIndex + 1].line) - 1
+      toNode = display.view[toIndex + 1].node.previousSibling
+    }
+
+    if (!fromNode) return false
+    let newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine))
+    let oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length))
+    while (newText.length > 1 && oldText.length > 1) {
+      if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine-- }
+      else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++ }
+      else break
+    }
+
+    let cutFront = 0, cutEnd = 0
+    let newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length)
+    while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
+      ++cutFront
+    let newBot = lst(newText), oldBot = lst(oldText)
+    let maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
+                             oldBot.length - (oldText.length == 1 ? cutFront : 0))
+    while (cutEnd < maxCutEnd &&
+           newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
+      ++cutEnd
+    // Try to move start of change to start of selection if ambiguous
+    if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
+      while (cutFront && cutFront > from.ch &&
+             newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
+        cutFront--
+        cutEnd++
+      }
+    }
+
+    newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "")
+    newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "")
+
+    let chFrom = Pos(fromLine, cutFront)
+    let chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0)
+    if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
+      replaceRange(cm.doc, newText, chFrom, chTo, "+input")
+      return true
+    }
+  }
+
+  ensurePolled() {
+    this.forceCompositionEnd()
+  }
+  reset() {
+    this.forceCompositionEnd()
+  }
+  forceCompositionEnd() {
+    if (!this.composing) return
+    clearTimeout(this.readDOMTimeout)
+    this.composing = null
+    this.updateFromDOM()
+    this.div.blur()
+    this.div.focus()
+  }
+  readFromDOMSoon() {
+    if (this.readDOMTimeout != null) return
+    this.readDOMTimeout = setTimeout(() => {
+      this.readDOMTimeout = null
+      if (this.composing) {
+        if (this.composing.done) this.composing = null
+        else return
+      }
+      this.updateFromDOM()
+    }, 80)
+  }
+
+  updateFromDOM() {
+    if (this.cm.isReadOnly() || !this.pollContent())
+      runInOp(this.cm, () => regChange(this.cm))
+  }
+
+  setUneditable(node) {
+    node.contentEditable = "false"
+  }
+
+  onKeyPress(e) {
+    if (e.charCode == 0 || this.composing) return
+    e.preventDefault()
+    if (!this.cm.isReadOnly())
+      operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0)
+  }
+
+  readOnlyChanged(val) {
+    this.div.contentEditable = String(val != "nocursor")
+  }
+
+  onContextMenu() {}
+  resetPosition() {}
+}
+
+ContentEditableInput.prototype.needsContentAttribute = true
+
+function posToDOM(cm, pos) {
+  let view = findViewForLine(cm, pos.line)
+  if (!view || view.hidden) return null
+  let line = getLine(cm.doc, pos.line)
+  let info = mapFromLineView(view, line, pos.line)
+
+  let order = getOrder(line, cm.doc.direction), side = "left"
+  if (order) {
+    let partPos = getBidiPartAt(order, pos.ch)
+    side = partPos % 2 ? "right" : "left"
+  }
+  let result = nodeAndOffsetInLineMap(info.map, pos.ch, side)
+  result.offset = result.collapse == "right" ? result.end : result.start
+  return result
+}
+
+function isInGutter(node) {
+  for (let scan = node; scan; scan = scan.parentNode)
+    if (/CodeMirror-gutter-wrapper/.test(scan.className)) return true
+  return false
+}
+
+function badPos(pos, bad) { if (bad) pos.bad = true; return pos }
+
+function domTextBetween(cm, from, to, fromLine, toLine) {
+  let text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false
+  function recognizeMarker(id) { return marker => marker.id == id }
+  function close() {
+    if (closing) {
+      text += lineSep
+      if (extraLinebreak) text += lineSep
+      closing = extraLinebreak = false
+    }
+  }
+  function addText(str) {
+    if (str) {
+      close()
+      text += str
+    }
+  }
+  function walk(node) {
+    if (node.nodeType == 1) {
+      let cmText = node.getAttribute("cm-text")
+      if (cmText) {
+        addText(cmText)
+        return
+      }
+      let markerID = node.getAttribute("cm-marker"), range
+      if (markerID) {
+        let found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID))
+        if (found.length && (range = found[0].find(0)))
+          addText(getBetween(cm.doc, range.from, range.to).join(lineSep))
+        return
+      }
+      if (node.getAttribute("contenteditable") == "false") return
+      let isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName)
+      if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) return
+
+      if (isBlock) close()
+      for (let i = 0; i < node.childNodes.length; i++)
+        walk(node.childNodes[i])
+
+      if (/^(pre|p)$/i.test(node.nodeName)) extraLinebreak = true
+      if (isBlock) closing = true
+    } else if (node.nodeType == 3) {
+      addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "))
+    }
+  }
+  for (;;) {
+    walk(from)
+    if (from == to) break
+    from = from.nextSibling
+    extraLinebreak = false
+  }
+  return text
+}
+
+function domToPos(cm, node, offset) {
+  let lineNode
+  if (node == cm.display.lineDiv) {
+    lineNode = cm.display.lineDiv.childNodes[offset]
+    if (!lineNode) return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true)
+    node = null; offset = 0
+  } else {
+    for (lineNode = node;; lineNode = lineNode.parentNode) {
+      if (!lineNode || lineNode == cm.display.lineDiv) return null
+      if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) break
+    }
+  }
+  for (let i = 0; i < cm.display.view.length; i++) {
+    let lineView = cm.display.view[i]
+    if (lineView.node == lineNode)
+      return locateNodeInLineView(lineView, node, offset)
+  }
+}
+
+function locateNodeInLineView(lineView, node, offset) {
+  let wrapper = lineView.text.firstChild, bad = false
+  if (!node || !contains(wrapper, node)) return badPos(Pos(lineNo(lineView.line), 0), true)
+  if (node == wrapper) {
+    bad = true
+    node = wrapper.childNodes[offset]
+    offset = 0
+    if (!node) {
+      let line = lineView.rest ? lst(lineView.rest) : lineView.line
+      return badPos(Pos(lineNo(line), line.text.length), bad)
+    }
+  }
+
+  let textNode = node.nodeType == 3 ? node : null, topNode = node
+  if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
+    textNode = node.firstChild
+    if (offset) offset = textNode.nodeValue.length
+  }
+  while (topNode.parentNode != wrapper) topNode = topNode.parentNode
+  let measure = lineView.measure, maps = measure.maps
+
+  function find(textNode, topNode, offset) {
+    for (let i = -1; i < (maps ? maps.length : 0); i++) {
+      let map = i < 0 ? measure.map : maps[i]
+      for (let j = 0; j < map.length; j += 3) {
+        let curNode = map[j + 2]
+        if (curNode == textNode || curNode == topNode) {
+          let line = lineNo(i < 0 ? lineView.line : lineView.rest[i])
+          let ch = map[j] + offset
+          if (offset < 0 || curNode != textNode) ch = map[j + (offset ? 1 : 0)]
+          return Pos(line, ch)
+        }
+      }
+    }
+  }
+  let found = find(textNode, topNode, offset)
+  if (found) return badPos(found, bad)
+
+  // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
+  for (let after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
+    found = find(after, after.firstChild, 0)
+    if (found)
+      return badPos(Pos(found.line, found.ch - dist), bad)
+    else
+      dist += after.textContent.length
+  }
+  for (let before = topNode.previousSibling, dist = offset; before; before = before.previousSibling) {
+    found = find(before, before.firstChild, -1)
+    if (found)
+      return badPos(Pos(found.line, found.ch + dist), bad)
+    else
+      dist += before.textContent.length
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/TextareaInput.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,380 @@
+import { operation, runInOp } from "../display/operations.js"
+import { prepareSelection } from "../display/selection.js"
+import { applyTextInput, copyableRanges, handlePaste, hiddenTextarea, disableBrowserMagic, setLastCopied } from "./input.js"
+import { cursorCoords, posFromMouse } from "../measurement/position_measurement.js"
+import { eventInWidget } from "../measurement/widgets.js"
+import { simpleSelection } from "../model/selection.js"
+import { selectAll, setSelection } from "../model/selection_updates.js"
+import { captureRightClick, ie, ie_version, ios, mac, mobile, presto, webkit } from "../util/browser.js"
+import { activeElt, removeChildrenAndAdd, selectInput, rootNode } from "../util/dom.js"
+import { e_preventDefault, e_stop, off, on, signalDOMEvent } from "../util/event.js"
+import { hasSelection } from "../util/feature_detection.js"
+import { Delayed, sel_dontScroll } from "../util/misc.js"
+
+// TEXTAREA INPUT STYLE
+
+export default class TextareaInput {
+  constructor(cm) {
+    this.cm = cm
+    // See input.poll and input.reset
+    this.prevInput = ""
+
+    // Flag that indicates whether we expect input to appear real soon
+    // now (after some event like 'keypress' or 'input') and are
+    // polling intensively.
+    this.pollingFast = false
+    // Self-resetting timeout for the poller
+    this.polling = new Delayed()
+    // Used to work around IE issue with selection being forgotten when focus moves away from textarea
+    this.hasSelection = false
+    this.composing = null
+    this.resetting = false
+  }
+
+  init(display) {
+    let input = this, cm = this.cm
+    this.createField(display)
+    const te = this.textarea
+
+    display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild)
+
+    // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
+    if (ios) te.style.width = "0px"
+
+    on(te, "input", () => {
+      if (ie && ie_version >= 9 && this.hasSelection) this.hasSelection = null
+      input.poll()
+    })
+
+    on(te, "paste", e => {
+      if (signalDOMEvent(cm, e) || handlePaste(e, cm)) return
+
+      cm.state.pasteIncoming = +new Date
+      input.fastPoll()
+    })
+
+    function prepareCopyCut(e) {
+      if (signalDOMEvent(cm, e)) return
+      if (cm.somethingSelected()) {
+        setLastCopied({lineWise: false, text: cm.getSelections()})
+      } else if (!cm.options.lineWiseCopyCut) {
+        return
+      } else {
+        let ranges = copyableRanges(cm)
+        setLastCopied({lineWise: true, text: ranges.text})
+        if (e.type == "cut") {
+          cm.setSelections(ranges.ranges, null, sel_dontScroll)
+        } else {
+          input.prevInput = ""
+          te.value = ranges.text.join("\n")
+          selectInput(te)
+        }
+      }
+      if (e.type == "cut") cm.state.cutIncoming = +new Date
+    }
+    on(te, "cut", prepareCopyCut)
+    on(te, "copy", prepareCopyCut)
+
+    on(display.scroller, "paste", e => {
+      if (eventInWidget(display, e) || signalDOMEvent(cm, e)) return
+      if (!te.dispatchEvent) {
+        cm.state.pasteIncoming = +new Date
+        input.focus()
+        return
+      }
+
+      // Pass the `paste` event to the textarea so it's handled by its event listener.
+      const event = new Event("paste")
+      event.clipboardData = e.clipboardData
+      te.dispatchEvent(event)
+    })
+
+    // Prevent normal selection in the editor (we handle our own)
+    on(display.lineSpace, "selectstart", e => {
+      if (!eventInWidget(display, e)) e_preventDefault(e)
+    })
+
+    on(te, "compositionstart", () => {
+      let start = cm.getCursor("from")
+      if (input.composing) input.composing.range.clear()
+      input.composing = {
+        start: start,
+        range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
+      }
+    })
+    on(te, "compositionend", () => {
+      if (input.composing) {
+        input.poll()
+        input.composing.range.clear()
+        input.composing = null
+      }
+    })
+  }
+
+  createField(_display) {
+    // Wraps and hides input textarea
+    this.wrapper = hiddenTextarea()
+    // The semihidden textarea that is focused when the editor is
+    // focused, and receives input.
+    this.textarea = this.wrapper.firstChild
+    let opts = this.cm.options
+    disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize)
+  }
+
+  screenReaderLabelChanged(label) {
+    // Label for screenreaders, accessibility
+    if(label) {
+      this.textarea.setAttribute('aria-label', label)
+    } else {
+      this.textarea.removeAttribute('aria-label')
+    }
+  }
+
+  prepareSelection() {
+    // Redraw the selection and/or cursor
+    let cm = this.cm, display = cm.display, doc = cm.doc
+    let result = prepareSelection(cm)
+
+    // Move the hidden textarea near the cursor to prevent scrolling artifacts
+    if (cm.options.moveInputWithCursor) {
+      let headPos = cursorCoords(cm, doc.sel.primary().head, "div")
+      let wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect()
+      result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
+                                          headPos.top + lineOff.top - wrapOff.top))
+      result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
+                                           headPos.left + lineOff.left - wrapOff.left))
+    }
+
+    return result
+  }
+
+  showSelection(drawn) {
+    let cm = this.cm, display = cm.display
+    removeChildrenAndAdd(display.cursorDiv, drawn.cursors)
+    removeChildrenAndAdd(display.selectionDiv, drawn.selection)
+    if (drawn.teTop != null) {
+      this.wrapper.style.top = drawn.teTop + "px"
+      this.wrapper.style.left = drawn.teLeft + "px"
+    }
+  }
+
+  // Reset the input to correspond to the selection (or to be empty,
+  // when not typing and nothing is selected)
+  reset(typing) {
+    if (this.contextMenuPending || this.composing && typing) return
+    let cm = this.cm
+    this.resetting = true
+    if (cm.somethingSelected()) {
+      this.prevInput = ""
+      let content = cm.getSelection()
+      this.textarea.value = content
+      if (cm.state.focused) selectInput(this.textarea)
+      if (ie && ie_version >= 9) this.hasSelection = content
+    } else if (!typing) {
+      this.prevInput = this.textarea.value = ""
+      if (ie && ie_version >= 9) this.hasSelection = null
+    }
+    this.resetting = false
+  }
+
+  getField() { return this.textarea }
+
+  supportsTouch() { return false }
+
+  focus() {
+    if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt(rootNode(this.textarea)) != this.textarea)) {
+      try { this.textarea.focus() }
+      catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
+    }
+  }
+
+  blur() { this.textarea.blur() }
+
+  resetPosition() {
+    this.wrapper.style.top = this.wrapper.style.left = 0
+  }
+
+  receivedFocus() { this.slowPoll() }
+
+  // Poll for input changes, using the normal rate of polling. This
+  // runs as long as the editor is focused.
+  slowPoll() {
+    if (this.pollingFast) return
+    this.polling.set(this.cm.options.pollInterval, () => {
+      this.poll()
+      if (this.cm.state.focused) this.slowPoll()
+    })
+  }
+
+  // When an event has just come in that is likely to add or change
+  // something in the input textarea, we poll faster, to ensure that
+  // the change appears on the screen quickly.
+  fastPoll() {
+    let missed = false, input = this
+    input.pollingFast = true
+    function p() {
+      let changed = input.poll()
+      if (!changed && !missed) {missed = true; input.polling.set(60, p)}
+      else {input.pollingFast = false; input.slowPoll()}
+    }
+    input.polling.set(20, p)
+  }
+
+  // Read input from the textarea, and update the document to match.
+  // When something is selected, it is present in the textarea, and
+  // selected (unless it is huge, in which case a placeholder is
+  // used). When nothing is selected, the cursor sits after previously
+  // seen text (can be empty), which is stored in prevInput (we must
+  // not reset the textarea when typing, because that breaks IME).
+  poll() {
+    let cm = this.cm, input = this.textarea, prevInput = this.prevInput
+    // Since this is called a *lot*, try to bail out as cheaply as
+    // possible when it is clear that nothing happened. hasSelection
+    // will be the case when there is a lot of text in the textarea,
+    // in which case reading its value would be expensive.
+    if (this.contextMenuPending || this.resetting || !cm.state.focused ||
+        (hasSelection(input) && !prevInput && !this.composing) ||
+        cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
+      return false
+
+    let text = input.value
+    // If nothing changed, bail.
+    if (text == prevInput && !cm.somethingSelected()) return false
+    // Work around nonsensical selection resetting in IE9/10, and
+    // inexplicable appearance of private area unicode characters on
+    // some key combos in Mac (#2689).
+    if (ie && ie_version >= 9 && this.hasSelection === text ||
+        mac && /[\uf700-\uf7ff]/.test(text)) {
+      cm.display.input.reset()
+      return false
+    }
+
+    if (cm.doc.sel == cm.display.selForContextMenu) {
+      let first = text.charCodeAt(0)
+      if (first == 0x200b && !prevInput) prevInput = "\u200b"
+      if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
+    }
+    // Find the part of the input that is actually new
+    let same = 0, l = Math.min(prevInput.length, text.length)
+    while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) ++same
+
+    runInOp(cm, () => {
+      applyTextInput(cm, text.slice(same), prevInput.length - same,
+                     null, this.composing ? "*compose" : null)
+
+      // Don't leave long text in the textarea, since it makes further polling slow
+      if (text.length > 1000 || text.indexOf("\n") > -1) input.value = this.prevInput = ""
+      else this.prevInput = text
+
+      if (this.composing) {
+        this.composing.range.clear()
+        this.composing.range = cm.markText(this.composing.start, cm.getCursor("to"),
+                                           {className: "CodeMirror-composing"})
+      }
+    })
+    return true
+  }
+
+  ensurePolled() {
+    if (this.pollingFast && this.poll()) this.pollingFast = false
+  }
+
+  onKeyPress() {
+    if (ie && ie_version >= 9) this.hasSelection = null
+    this.fastPoll()
+  }
+
+  onContextMenu(e) {
+    let input = this, cm = input.cm, display = cm.display, te = input.textarea
+    if (input.contextMenuPending) input.contextMenuPending()
+    let pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop
+    if (!pos || presto) return // Opera is difficult.
+
+    // Reset the current text selection only if the click is done outside of the selection
+    // and 'resetSelectionOnContextMenu' option is true.
+    let reset = cm.options.resetSelectionOnContextMenu
+    if (reset && cm.doc.sel.contains(pos) == -1)
+      operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll)
+
+    let oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText
+    let wrapperBox = input.wrapper.offsetParent.getBoundingClientRect()
+    input.wrapper.style.cssText = "position: static"
+    te.style.cssText = `position: absolute; width: 30px; height: 30px;
+      top: ${e.clientY - wrapperBox.top - 5}px; left: ${e.clientX - wrapperBox.left - 5}px;
+      z-index: 1000; background: ${ie ? "rgba(255, 255, 255, .05)" : "transparent"};
+      outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);`
+    let oldScrollY
+    if (webkit) oldScrollY = te.ownerDocument.defaultView.scrollY // Work around Chrome issue (#2712)
+    display.input.focus()
+    if (webkit) te.ownerDocument.defaultView.scrollTo(null, oldScrollY)
+    display.input.reset()
+    // Adds "Select all" to context menu in FF
+    if (!cm.somethingSelected()) te.value = input.prevInput = " "
+    input.contextMenuPending = rehide
+    display.selForContextMenu = cm.doc.sel
+    clearTimeout(display.detectingSelectAll)
+
+    // Select-all will be greyed out if there's nothing to select, so
+    // this adds a zero-width space so that we can later check whether
+    // it got selected.
+    function prepareSelectAllHack() {
+      if (te.selectionStart != null) {
+        let selected = cm.somethingSelected()
+        let extval = "\u200b" + (selected ? te.value : "")
+        te.value = "\u21da" // Used to catch context-menu undo
+        te.value = extval
+        input.prevInput = selected ? "" : "\u200b"
+        te.selectionStart = 1; te.selectionEnd = extval.length
+        // Re-set this, in case some other handler touched the
+        // selection in the meantime.
+        display.selForContextMenu = cm.doc.sel
+      }
+    }
+    function rehide() {
+      if (input.contextMenuPending != rehide) return
+      input.contextMenuPending = false
+      input.wrapper.style.cssText = oldWrapperCSS
+      te.style.cssText = oldCSS
+      if (ie && ie_version < 9) display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos)
+
+      // Try to detect the user choosing select-all
+      if (te.selectionStart != null) {
+        if (!ie || (ie && ie_version < 9)) prepareSelectAllHack()
+        let i = 0, poll = () => {
+          if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
+              te.selectionEnd > 0 && input.prevInput == "\u200b") {
+            operation(cm, selectAll)(cm)
+          } else if (i++ < 10) {
+            display.detectingSelectAll = setTimeout(poll, 500)
+          } else {
+            display.selForContextMenu = null
+            display.input.reset()
+          }
+        }
+        display.detectingSelectAll = setTimeout(poll, 200)
+      }
+    }
+
+    if (ie && ie_version >= 9) prepareSelectAllHack()
+    if (captureRightClick) {
+      e_stop(e)
+      let mouseup = () => {
+        off(window, "mouseup", mouseup)
+        setTimeout(rehide, 20)
+      }
+      on(window, "mouseup", mouseup)
+    } else {
+      setTimeout(rehide, 50)
+    }
+  }
+
+  readOnlyChanged(val) {
+    if (!val) this.reset()
+    this.textarea.disabled = val == "nocursor"
+    this.textarea.readOnly = !!val
+  }
+
+  setUneditable() {}
+}
+
+TextareaInput.prototype.needsContentAttribute = false
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/indent.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,71 @@
+import { getContextBefore } from "../line/highlight.js"
+import { Pos } from "../line/pos.js"
+import { getLine } from "../line/utils_line.js"
+import { replaceRange } from "../model/changes.js"
+import { Range } from "../model/selection.js"
+import { replaceOneSelection } from "../model/selection_updates.js"
+import { countColumn, Pass, spaceStr } from "../util/misc.js"
+
+// Indent the given line. The how parameter can be "smart",
+// "add"/null, "subtract", or "prev". When aggressive is false
+// (typically set to true for forced single-line indents), empty
+// lines are not indented, and places where the mode returns Pass
+// are left alone.
+export function indentLine(cm, n, how, aggressive) {
+  let doc = cm.doc, state
+  if (how == null) how = "add"
+  if (how == "smart") {
+    // Fall back to "prev" when the mode doesn't have an indentation
+    // method.
+    if (!doc.mode.indent) how = "prev"
+    else state = getContextBefore(cm, n).state
+  }
+
+  let tabSize = cm.options.tabSize
+  let line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize)
+  if (line.stateAfter) line.stateAfter = null
+  let curSpaceString = line.text.match(/^\s*/)[0], indentation
+  if (!aggressive && !/\S/.test(line.text)) {
+    indentation = 0
+    how = "not"
+  } else if (how == "smart") {
+    indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text)
+    if (indentation == Pass || indentation > 150) {
+      if (!aggressive) return
+      how = "prev"
+    }
+  }
+  if (how == "prev") {
+    if (n > doc.first) indentation = countColumn(getLine(doc, n-1).text, null, tabSize)
+    else indentation = 0
+  } else if (how == "add") {
+    indentation = curSpace + cm.options.indentUnit
+  } else if (how == "subtract") {
+    indentation = curSpace - cm.options.indentUnit
+  } else if (typeof how == "number") {
+    indentation = curSpace + how
+  }
+  indentation = Math.max(0, indentation)
+
+  let indentString = "", pos = 0
+  if (cm.options.indentWithTabs)
+    for (let i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t"}
+  if (pos < indentation) indentString += spaceStr(indentation - pos)
+
+  if (indentString != curSpaceString) {
+    replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input")
+    line.stateAfter = null
+    return true
+  } else {
+    // Ensure that, if the cursor was in the whitespace at the start
+    // of the line, it is moved to the end of that space.
+    for (let i = 0; i < doc.sel.ranges.length; i++) {
+      let range = doc.sel.ranges[i]
+      if (range.head.line == n && range.head.ch < curSpaceString.length) {
+        let pos = Pos(n, curSpaceString.length)
+        replaceOneSelection(doc, i, new Range(pos, pos))
+        break
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/input.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,134 @@
+import { runInOp } from "../display/operations.js"
+import { ensureCursorVisible } from "../display/scrolling.js"
+import { Pos } from "../line/pos.js"
+import { getLine } from "../line/utils_line.js"
+import { makeChange } from "../model/changes.js"
+import { ios, webkit } from "../util/browser.js"
+import { elt } from "../util/dom.js"
+import { lst, map } from "../util/misc.js"
+import { signalLater } from "../util/operation_group.js"
+import { splitLinesAuto } from "../util/feature_detection.js"
+
+import { indentLine } from "./indent.js"
+
+// This will be set to a {lineWise: bool, text: [string]} object, so
+// that, when pasting, we know what kind of selections the copied
+// text was made out of.
+export let lastCopied = null
+
+export function setLastCopied(newLastCopied) {
+  lastCopied = newLastCopied
+}
+
+export function applyTextInput(cm, inserted, deleted, sel, origin) {
+  let doc = cm.doc
+  cm.display.shift = false
+  if (!sel) sel = doc.sel
+
+  let recent = +new Date - 200
+  let paste = origin == "paste" || cm.state.pasteIncoming > recent
+  let textLines = splitLinesAuto(inserted), multiPaste = null
+  // When pasting N lines into N selections, insert one line per selection
+  if (paste && sel.ranges.length > 1) {
+    if (lastCopied && lastCopied.text.join("\n") == inserted) {
+      if (sel.ranges.length % lastCopied.text.length == 0) {
+        multiPaste = []
+        for (let i = 0; i < lastCopied.text.length; i++)
+          multiPaste.push(doc.splitLines(lastCopied.text[i]))
+      }
+    } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
+      multiPaste = map(textLines, l => [l])
+    }
+  }
+
+  let updateInput = cm.curOp.updateInput
+  // Normal behavior is to insert the new text into every selection
+  for (let i = sel.ranges.length - 1; i >= 0; i--) {
+    let range = sel.ranges[i]
+    let from = range.from(), to = range.to()
+    if (range.empty()) {
+      if (deleted && deleted > 0) // Handle deletion
+        from = Pos(from.line, from.ch - deleted)
+      else if (cm.state.overwrite && !paste) // Handle overwrite
+        to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length))
+      else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
+        from = to = Pos(from.line, 0)
+    }
+    let changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i % multiPaste.length] : textLines,
+                       origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")}
+    makeChange(cm.doc, changeEvent)
+    signalLater(cm, "inputRead", cm, changeEvent)
+  }
+  if (inserted && !paste)
+    triggerElectric(cm, inserted)
+
+  ensureCursorVisible(cm)
+  if (cm.curOp.updateInput < 2) cm.curOp.updateInput = updateInput
+  cm.curOp.typing = true
+  cm.state.pasteIncoming = cm.state.cutIncoming = -1
+}
+
+export function handlePaste(e, cm) {
+  let pasted = e.clipboardData && e.clipboardData.getData("Text")
+  if (pasted) {
+    e.preventDefault()
+    if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())
+      runInOp(cm, () => applyTextInput(cm, pasted, 0, null, "paste"))
+    return true
+  }
+}
+
+export function triggerElectric(cm, inserted) {
+  // When an 'electric' character is inserted, immediately trigger a reindent
+  if (!cm.options.electricChars || !cm.options.smartIndent) return
+  let sel = cm.doc.sel
+
+  for (let i = sel.ranges.length - 1; i >= 0; i--) {
+    let range = sel.ranges[i]
+    if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) continue
+    let mode = cm.getModeAt(range.head)
+    let indented = false
+    if (mode.electricChars) {
+      for (let j = 0; j < mode.electricChars.length; j++)
+        if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
+          indented = indentLine(cm, range.head.line, "smart")
+          break
+        }
+    } else if (mode.electricInput) {
+      if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
+        indented = indentLine(cm, range.head.line, "smart")
+    }
+    if (indented) signalLater(cm, "electricInput", cm, range.head.line)
+  }
+}
+
+export function copyableRanges(cm) {
+  let text = [], ranges = []
+  for (let i = 0; i < cm.doc.sel.ranges.length; i++) {
+    let line = cm.doc.sel.ranges[i].head.line
+    let lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)}
+    ranges.push(lineRange)
+    text.push(cm.getRange(lineRange.anchor, lineRange.head))
+  }
+  return {text: text, ranges: ranges}
+}
+
+export function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
+  field.setAttribute("autocorrect", autocorrect ? "on" : "off")
+  field.setAttribute("autocapitalize", autocapitalize ? "on" : "off")
+  field.setAttribute("spellcheck", !!spellcheck)
+}
+
+export function hiddenTextarea() {
+  let te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none")
+  let div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;")
+  // The textarea is kept positioned near the cursor to prevent the
+  // fact that it'll be scrolled into view on input from scrolling
+  // our fake cursor out of view. On webkit, when wrap=off, paste is
+  // very slow. So make the area wide instead.
+  if (webkit) te.style.width = "1000px"
+  else te.setAttribute("wrap", "off")
+  // If border: 0; -- iOS fails to open keyboard (issue #1287)
+  if (ios) te.style.border = "1px solid black"
+  return div
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/keymap.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,147 @@
+import { flipCtrlCmd, mac, presto } from "../util/browser.js"
+import { map } from "../util/misc.js"
+
+import { keyNames } from "./keynames.js"
+
+export let keyMap = {}
+
+keyMap.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"
+}
+// Note that the save and find-related commands aren't defined by
+// default. User code or addons can define them. Unknown commands
+// are simply ignored.
+keyMap.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"
+}
+// Very basic readline/emacs-style bindings, which are standard on Mac.
+keyMap.emacsy = {
+  "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
+  "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd", "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp",
+  "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine",
+  "Ctrl-T": "transposeChars", "Ctrl-O": "openLine"
+}
+keyMap.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"]
+}
+keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault
+
+// KEYMAP DISPATCH
+
+function normalizeKeyName(name) {
+  let parts = name.split(/-(?!$)/)
+  name = parts[parts.length - 1]
+  let alt, ctrl, shift, cmd
+  for (let i = 0; i < parts.length - 1; i++) {
+    let mod = parts[i]
+    if (/^(cmd|meta|m)$/i.test(mod)) cmd = true
+    else if (/^a(lt)?$/i.test(mod)) alt = true
+    else if (/^(c|ctrl|control)$/i.test(mod)) ctrl = true
+    else if (/^s(hift)?$/i.test(mod)) shift = true
+    else throw new Error("Unrecognized modifier name: " + mod)
+  }
+  if (alt) name = "Alt-" + name
+  if (ctrl) name = "Ctrl-" + name
+  if (cmd) name = "Cmd-" + name
+  if (shift) name = "Shift-" + name
+  return name
+}
+
+// This is a kludge to keep keymaps mostly working as raw objects
+// (backwards compatibility) while at the same time support features
+// like normalization and multi-stroke key bindings. It compiles a
+// new normalized keymap, and then updates the old object to reflect
+// this.
+export function normalizeKeyMap(keymap) {
+  let copy = {}
+  for (let keyname in keymap) if (keymap.hasOwnProperty(keyname)) {
+    let value = keymap[keyname]
+    if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) continue
+    if (value == "...") { delete keymap[keyname]; continue }
+
+    let keys = map(keyname.split(" "), normalizeKeyName)
+    for (let i = 0; i < keys.length; i++) {
+      let val, name
+      if (i == keys.length - 1) {
+        name = keys.join(" ")
+        val = value
+      } else {
+        name = keys.slice(0, i + 1).join(" ")
+        val = "..."
+      }
+      let prev = copy[name]
+      if (!prev) copy[name] = val
+      else if (prev != val) throw new Error("Inconsistent bindings for " + name)
+    }
+    delete keymap[keyname]
+  }
+  for (let prop in copy) keymap[prop] = copy[prop]
+  return keymap
+}
+
+export function lookupKey(key, map, handle, context) {
+  map = getKeyMap(map)
+  let found = map.call ? map.call(key, context) : map[key]
+  if (found === false) return "nothing"
+  if (found === "...") return "multi"
+  if (found != null && handle(found)) return "handled"
+
+  if (map.fallthrough) {
+    if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
+      return lookupKey(key, map.fallthrough, handle, context)
+    for (let i = 0; i < map.fallthrough.length; i++) {
+      let result = lookupKey(key, map.fallthrough[i], handle, context)
+      if (result) return result
+    }
+  }
+}
+
+// Modifier key presses don't count as 'real' key presses for the
+// purpose of keymap fallthrough.
+export function isModifierKey(value) {
+  let name = typeof value == "string" ? value : keyNames[value.keyCode]
+  return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
+}
+
+export function addModifierNames(name, event, noShift) {
+  let base = name
+  if (event.altKey && base != "Alt") name = "Alt-" + name
+  if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") name = "Ctrl-" + name
+  if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") name = "Cmd-" + name
+  if (!noShift && event.shiftKey && base != "Shift") name = "Shift-" + name
+  return name
+}
+
+// Look up the name of a key as indicated by an event object.
+export function keyName(event, noShift) {
+  if (presto && event.keyCode == 34 && event["char"]) return false
+  let name = keyNames[event.keyCode]
+  if (name == null || event.altGraphKey) return false
+  // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
+  // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
+  if (event.keyCode == 3 && event.code) name = event.code
+  return addModifierNames(name, event, noShift)
+}
+
+export function getKeyMap(val) {
+  return typeof val == "string" ? keyMap[val] : val
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/keynames.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,17 @@
+export let keyNames = {
+  3: "Pause", 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: "/", 145: "ScrollLock",
+  173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
+  221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
+  63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
+}
+
+// Number keys
+for (let i = 0; i < 10; i++) keyNames[i + 48] = keyNames[i + 96] = String(i)
+// Alphabetic keys
+for (let i = 65; i <= 90; i++) keyNames[i] = String.fromCharCode(i)
+// Function keys
+for (let i = 1; i <= 12; i++) keyNames[i + 111] = keyNames[i + 63235] = "F" + i
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/input/movement.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,111 @@
+import { Pos } from "../line/pos.js"
+import { prepareMeasureForLine, measureCharPrepared, wrappedLineExtentChar } from "../measurement/position_measurement.js"
+import { getBidiPartAt, getOrder } from "../util/bidi.js"
+import { findFirst, lst, skipExtendingChars } from "../util/misc.js"
+
+function moveCharLogically(line, ch, dir) {
+  let target = skipExtendingChars(line.text, ch + dir, dir)
+  return target < 0 || target > line.text.length ? null : target
+}
+
+export function moveLogically(line, start, dir) {
+  let ch = moveCharLogically(line, start.ch, dir)
+  return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
+}
+
+export function endOfLine(visually, cm, lineObj, lineNo, dir) {
+  if (visually) {
+    if (cm.doc.direction == "rtl") dir = -dir
+    let order = getOrder(lineObj, cm.doc.direction)
+    if (order) {
+      let part = dir < 0 ? lst(order) : order[0]
+      let moveInStorageOrder = (dir < 0) == (part.level == 1)
+      let sticky = moveInStorageOrder ? "after" : "before"
+      let ch
+      // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
+      // it could be that the last bidi part is not on the last visual line,
+      // since visual lines contain content order-consecutive chunks.
+      // Thus, in rtl, we are looking for the first (content-order) character
+      // in the rtl chunk that is on the last line (that is, the same line
+      // as the last (content-order) character).
+      if (part.level > 0 || cm.doc.direction == "rtl") {
+        let prep = prepareMeasureForLine(cm, lineObj)
+        ch = dir < 0 ? lineObj.text.length - 1 : 0
+        let targetTop = measureCharPrepared(cm, prep, ch).top
+        ch = findFirst(ch => measureCharPrepared(cm, prep, ch).top == targetTop, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch)
+        if (sticky == "before") ch = moveCharLogically(lineObj, ch, 1)
+      } else ch = dir < 0 ? part.to : part.from
+      return new Pos(lineNo, ch, sticky)
+    }
+  }
+  return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
+}
+
+export function moveVisually(cm, line, start, dir) {
+  let bidi = getOrder(line, cm.doc.direction)
+  if (!bidi) return moveLogically(line, start, dir)
+  if (start.ch >= line.text.length) {
+    start.ch = line.text.length
+    start.sticky = "before"
+  } else if (start.ch <= 0) {
+    start.ch = 0
+    start.sticky = "after"
+  }
+  let partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]
+  if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
+    // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
+    // nothing interesting happens.
+    return moveLogically(line, start, dir)
+  }
+
+  let mv = (pos, dir) => moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir)
+  let prep
+  let getWrappedLineExtent = ch => {
+    if (!cm.options.lineWrapping) return {begin: 0, end: line.text.length}
+    prep = prep || prepareMeasureForLine(cm, line)
+    return wrappedLineExtentChar(cm, line, prep, ch)
+  }
+  let wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch)
+
+  if (cm.doc.direction == "rtl" || part.level == 1) {
+    let moveInStorageOrder = (part.level == 1) == (dir < 0)
+    let ch = mv(start, moveInStorageOrder ? 1 : -1)
+    if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
+      // Case 2: We move within an rtl part or in an rtl editor on the same visual line
+      let sticky = moveInStorageOrder ? "before" : "after"
+      return new Pos(start.line, ch, sticky)
+    }
+  }
+
+  // Case 3: Could not move within this bidi part in this visual line, so leave
+  // the current bidi part
+
+  let searchInVisualLine = (partPos, dir, wrappedLineExtent) => {
+    let getRes = (ch, moveInStorageOrder) => moveInStorageOrder
+      ? new Pos(start.line, mv(ch, 1), "before")
+      : new Pos(start.line, ch, "after")
+
+    for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
+      let part = bidi[partPos]
+      let moveInStorageOrder = (dir > 0) == (part.level != 1)
+      let ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1)
+      if (part.from <= ch && ch < part.to) return getRes(ch, moveInStorageOrder)
+      ch = moveInStorageOrder ? part.from : mv(part.to, -1)
+      if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) return getRes(ch, moveInStorageOrder)
+    }
+  }
+
+  // Case 3a: Look for other bidi parts on the same visual line
+  let res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent)
+  if (res) return res
+
+  // Case 3b: Look for other bidi parts on the next visual line
+  let nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1)
+  if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
+    res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh))
+    if (res) return res
+  }
+
+  // Case 4: Nowhere to move
+  return null
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/line/highlight.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,284 @@
+import { countColumn } from "../util/misc.js"
+import { copyState, innerMode, startState } from "../modes.js"
+import StringStream from "../util/StringStream.js"
+
+import { getLine, lineNo } from "./utils_line.js"
+import { clipPos } from "./pos.js"
+
+class SavedContext {
+  constructor(state, lookAhead) {
+    this.state = state
+    this.lookAhead = lookAhead
+  }
+}
+
+class Context {
+  constructor(doc, state, line, lookAhead) {
+    this.state = state
+    this.doc = doc
+    this.line = line
+    this.maxLookAhead = lookAhead || 0
+    this.baseTokens = null
+    this.baseTokenPos = 1
+  }
+
+  lookAhead(n) {
+    let line = this.doc.getLine(this.line + n)
+    if (line != null && n > this.maxLookAhead) this.maxLookAhead = n
+    return line
+  }
+
+  baseToken(n) {
+    if (!this.baseTokens) return null
+    while (this.baseTokens[this.baseTokenPos] <= n)
+      this.baseTokenPos += 2
+    let type = this.baseTokens[this.baseTokenPos + 1]
+    return {type: type && type.replace(/( |^)overlay .*/, ""),
+            size: this.baseTokens[this.baseTokenPos] - n}
+  }
+
+  nextLine() {
+    this.line++
+    if (this.maxLookAhead > 0) this.maxLookAhead--
+  }
+
+  static fromSaved(doc, saved, line) {
+    if (saved instanceof SavedContext)
+      return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead)
+    else
+      return new Context(doc, copyState(doc.mode, saved), line)
+  }
+
+  save(copy) {
+    let state = copy !== false ? copyState(this.doc.mode, this.state) : this.state
+    return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
+  }
+}
+
+
+// Compute a style array (an array starting with a mode generation
+// -- for invalidation -- followed by pairs of end positions and
+// style strings), which is used to highlight the tokens on the
+// line.
+export function highlightLine(cm, line, context, forceToEnd) {
+  // A styles array always starts with a number identifying the
+  // mode/overlays that it is based on (for easy invalidation).
+  let st = [cm.state.modeGen], lineClasses = {}
+  // Compute the base array of styles
+  runMode(cm, line.text, cm.doc.mode, context, (end, style) => st.push(end, style),
+          lineClasses, forceToEnd)
+  let state = context.state
+
+  // Run overlays, adjust style array.
+  for (let o = 0; o < cm.state.overlays.length; ++o) {
+    context.baseTokens = st
+    let overlay = cm.state.overlays[o], i = 1, at = 0
+    context.state = true
+    runMode(cm, line.text, overlay.mode, context, (end, style) => {
+      let start = i
+      // Ensure there's a token end at the current position, and that i points at it
+      while (at < end) {
+        let i_end = st[i]
+        if (i_end > end)
+          st.splice(i, 1, end, st[i+1], i_end)
+        i += 2
+        at = Math.min(end, i_end)
+      }
+      if (!style) return
+      if (overlay.opaque) {
+        st.splice(start, i - start, end, "overlay " + style)
+        i = start + 2
+      } else {
+        for (; start < i; start += 2) {
+          let cur = st[start+1]
+          st[start+1] = (cur ? cur + " " : "") + "overlay " + style
+        }
+      }
+    }, lineClasses)
+    context.state = state
+    context.baseTokens = null
+    context.baseTokenPos = 1
+  }
+
+  return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
+}
+
+export function getLineStyles(cm, line, updateFrontier) {
+  if (!line.styles || line.styles[0] != cm.state.modeGen) {
+    let context = getContextBefore(cm, lineNo(line))
+    let resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state)
+    let result = highlightLine(cm, line, context)
+    if (resetState) context.state = resetState
+    line.stateAfter = context.save(!resetState)
+    line.styles = result.styles
+    if (result.classes) line.styleClasses = result.classes
+    else if (line.styleClasses) line.styleClasses = null
+    if (updateFrontier === cm.doc.highlightFrontier)
+      cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier)
+  }
+  return line.styles
+}
+
+export function getContextBefore(cm, n, precise) {
+  let doc = cm.doc, display = cm.display
+  if (!doc.mode.startState) return new Context(doc, true, n)
+  let start = findStartLine(cm, n, precise)
+  let saved = start > doc.first && getLine(doc, start - 1).stateAfter
+  let context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start)
+
+  doc.iter(start, n, line => {
+    processLine(cm, line.text, context)
+    let pos = context.line
+    line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null
+    context.nextLine()
+  })
+  if (precise) doc.modeFrontier = context.line
+  return context
+}
+
+// Lightweight form of highlight -- proceed over this line and
+// update state, but don't save a style array. Used for lines that
+// aren't currently visible.
+export function processLine(cm, text, context, startAt) {
+  let mode = cm.doc.mode
+  let stream = new StringStream(text, cm.options.tabSize, context)
+  stream.start = stream.pos = startAt || 0
+  if (text == "") callBlankLine(mode, context.state)
+  while (!stream.eol()) {
+    readToken(mode, stream, context.state)
+    stream.start = stream.pos
+  }
+}
+
+function callBlankLine(mode, state) {
+  if (mode.blankLine) return mode.blankLine(state)
+  if (!mode.innerMode) return
+  let inner = innerMode(mode, state)
+  if (inner.mode.blankLine) return inner.mode.blankLine(inner.state)
+}
+
+function readToken(mode, stream, state, inner) {
+  for (let i = 0; i < 10; i++) {
+    if (inner) inner[0] = innerMode(mode, state).mode
+    let style = mode.token(stream, state)
+    if (stream.pos > stream.start) return style
+  }
+  throw new Error("Mode " + mode.name + " failed to advance stream.")
+}
+
+class Token {
+  constructor(stream, type, state) {
+    this.start = stream.start; this.end = stream.pos
+    this.string = stream.current()
+    this.type = type || null
+    this.state = state
+  }
+}
+
+// Utility for getTokenAt and getLineTokens
+export function takeToken(cm, pos, precise, asArray) {
+  let doc = cm.doc, mode = doc.mode, style
+  pos = clipPos(doc, pos)
+  let line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise)
+  let stream = new StringStream(line.text, cm.options.tabSize, context), tokens
+  if (asArray) tokens = []
+  while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
+    stream.start = stream.pos
+    style = readToken(mode, stream, context.state)
+    if (asArray) tokens.push(new Token(stream, style, copyState(doc.mode, context.state)))
+  }
+  return asArray ? tokens : new Token(stream, style, context.state)
+}
+
+function extractLineClasses(type, output) {
+  if (type) for (;;) {
+    let lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/)
+    if (!lineClass) break
+    type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length)
+    let prop = lineClass[1] ? "bgClass" : "textClass"
+    if (output[prop] == null)
+      output[prop] = lineClass[2]
+    else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
+      output[prop] += " " + lineClass[2]
+  }
+  return type
+}
+
+// Run the given mode's parser over a line, calling f for each token.
+function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
+  let flattenSpans = mode.flattenSpans
+  if (flattenSpans == null) flattenSpans = cm.options.flattenSpans
+  let curStart = 0, curStyle = null
+  let stream = new StringStream(text, cm.options.tabSize, context), style
+  let inner = cm.options.addModeClass && [null]
+  if (text == "") extractLineClasses(callBlankLine(mode, context.state), lineClasses)
+  while (!stream.eol()) {
+    if (stream.pos > cm.options.maxHighlightLength) {
+      flattenSpans = false
+      if (forceToEnd) processLine(cm, text, context, stream.pos)
+      stream.pos = text.length
+      style = null
+    } else {
+      style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses)
+    }
+    if (inner) {
+      let mName = inner[0].name
+      if (mName) style = "m-" + (style ? mName + " " + style : mName)
+    }
+    if (!flattenSpans || curStyle != style) {
+      while (curStart < stream.start) {
+        curStart = Math.min(stream.start, curStart + 5000)
+        f(curStart, curStyle)
+      }
+      curStyle = style
+    }
+    stream.start = stream.pos
+  }
+  while (curStart < stream.pos) {
+    // Webkit seems to refuse to render text nodes longer than 57444
+    // characters, and returns inaccurate measurements in nodes
+    // starting around 5000 chars.
+    let pos = Math.min(stream.pos, curStart + 5000)
+    f(pos, curStyle)
+    curStart = pos
+  }
+}
+
+// Finds the line to start with when starting a parse. Tries to
+// find a line with a stateAfter, so that it can start with a
+// valid state. If that fails, it returns the line with the
+// smallest indentation, which tends to need the least context to
+// parse correctly.
+function findStartLine(cm, n, precise) {
+  let minindent, minline, doc = cm.doc
+  let lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)
+  for (let search = n; search > lim; --search) {
+    if (search <= doc.first) return doc.first
+    let line = getLine(doc, search - 1), after = line.stateAfter
+    if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
+      return search
+    let indented = countColumn(line.text, null, cm.options.tabSize)
+    if (minline == null || minindent > indented) {
+      minline = search - 1
+      minindent = indented
+    }
+  }
+  return minline
+}
+
+export function retreatFrontier(doc, n) {
+  doc.modeFrontier = Math.min(doc.modeFrontier, n)
+  if (doc.highlightFrontier < n - 10) return
+  let start = doc.first
+  for (let line = n - 1; line > start; line--) {
+    let saved = getLine(doc, line).stateAfter
+    // change is on 3
+    // state on line 1 looked ahead 2 -- so saw 3
+    // test 1 + 2 < 3 should cover this
+    if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
+      start = line + 1
+      break
+    }
+  }
+  doc.highlightFrontier = Math.min(doc.highlightFrontier, start)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/line/line_data.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,349 @@
+import { getOrder } from "../util/bidi.js"
+import { ie, ie_version, webkit } from "../util/browser.js"
+import { elt, eltP, joinClasses } from "../util/dom.js"
+import { eventMixin, signal } from "../util/event.js"
+import { hasBadBidiRects, zeroWidthElement } from "../util/feature_detection.js"
+import { lst, spaceStr } from "../util/misc.js"
+
+import { getLineStyles } from "./highlight.js"
+import { attachMarkedSpans, compareCollapsedMarkers, detachMarkedSpans, lineIsHidden, visualLineContinued } from "./spans.js"
+import { getLine, lineNo, updateLineHeight } from "./utils_line.js"
+
+// LINE DATA STRUCTURE
+
+// Line objects. These hold state related to a line, including
+// highlighting info (the styles array).
+export class Line {
+  constructor(text, markedSpans, estimateHeight) {
+    this.text = text
+    attachMarkedSpans(this, markedSpans)
+    this.height = estimateHeight ? estimateHeight(this) : 1
+  }
+
+  lineNo() { return lineNo(this) }
+}
+eventMixin(Line)
+
+// Change the content (text, markers) of a line. Automatically
+// invalidates cached information and tries to re-estimate the
+// line's height.
+export function updateLine(line, text, markedSpans, estimateHeight) {
+  line.text = text
+  if (line.stateAfter) line.stateAfter = null
+  if (line.styles) line.styles = null
+  if (line.order != null) line.order = null
+  detachMarkedSpans(line)
+  attachMarkedSpans(line, markedSpans)
+  let estHeight = estimateHeight ? estimateHeight(line) : 1
+  if (estHeight != line.height) updateLineHeight(line, estHeight)
+}
+
+// Detach a line from the document tree and its markers.
+export function cleanUpLine(line) {
+  line.parent = null
+  detachMarkedSpans(line)
+}
+
+// Convert a style as returned by a mode (either null, or a string
+// containing one or more styles) to a CSS style. This is cached,
+// and also looks for line-wide styles.
+let styleToClassCache = {}, styleToClassCacheWithMode = {}
+function interpretTokenStyle(style, options) {
+  if (!style || /^\s*$/.test(style)) return null
+  let cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache
+  return cache[style] ||
+    (cache[style] = style.replace(/\S+/g, "cm-$&"))
+}
+
+// Render the DOM representation of the text of a line. Also builds
+// up a 'line map', which points at the DOM nodes that represent
+// specific stretches of text, and is used by the measuring code.
+// The returned object contains the DOM node, this map, and
+// information about line-wide styles that were set by the mode.
+export function buildLineContent(cm, lineView) {
+  // The padding-right forces the element to have a 'border', which
+  // is needed on Webkit to be able to get line-level bounding
+  // rectangles for it (in measureChar).
+  let content = eltP("span", null, null, webkit ? "padding-right: .1px" : null)
+  let builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
+                 col: 0, pos: 0, cm: cm,
+                 trailingSpace: false,
+                 splitSpaces: cm.getOption("lineWrapping")}
+  lineView.measure = {}
+
+  // Iterate over the logical lines that make up this visual line.
+  for (let i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
+    let line = i ? lineView.rest[i - 1] : lineView.line, order
+    builder.pos = 0
+    builder.addToken = buildToken
+    // Optionally wire in some hacks into the token-rendering
+    // algorithm, to deal with browser quirks.
+    if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
+      builder.addToken = buildTokenBadBidi(builder.addToken, order)
+    builder.map = []
+    let allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)
+    insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))
+    if (line.styleClasses) {
+      if (line.styleClasses.bgClass)
+        builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "")
+      if (line.styleClasses.textClass)
+        builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "")
+    }
+
+    // Ensure at least a single node is present, for measuring.
+    if (builder.map.length == 0)
+      builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)))
+
+    // Store the map and a cache object for the current logical line
+    if (i == 0) {
+      lineView.measure.map = builder.map
+      lineView.measure.cache = {}
+    } else {
+      ;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
+      ;(lineView.measure.caches || (lineView.measure.caches = [])).push({})
+    }
+  }
+
+  // See issue #2901
+  if (webkit) {
+    let last = builder.content.lastChild
+    if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
+      builder.content.className = "cm-tab-wrap-hack"
+  }
+
+  signal(cm, "renderLine", cm, lineView.line, builder.pre)
+  if (builder.pre.className)
+    builder.textClass = joinClasses(builder.pre.className, builder.textClass || "")
+
+  return builder
+}
+
+export function defaultSpecialCharPlaceholder(ch) {
+  let token = elt("span", "\u2022", "cm-invalidchar")
+  token.title = "\\u" + ch.charCodeAt(0).toString(16)
+  token.setAttribute("aria-label", token.title)
+  return token
+}
+
+// Build up the DOM representation for a single token, and add it to
+// the line map. Takes care to render special characters separately.
+function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
+  if (!text) return
+  let displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
+  let special = builder.cm.state.specialChars, mustWrap = false
+  let content
+  if (!special.test(text)) {
+    builder.col += text.length
+    content = document.createTextNode(displayText)
+    builder.map.push(builder.pos, builder.pos + text.length, content)
+    if (ie && ie_version < 9) mustWrap = true
+    builder.pos += text.length
+  } else {
+    content = document.createDocumentFragment()
+    let pos = 0
+    while (true) {
+      special.lastIndex = pos
+      let m = special.exec(text)
+      let skipped = m ? m.index - pos : text.length - pos
+      if (skipped) {
+        let txt = document.createTextNode(displayText.slice(pos, pos + skipped))
+        if (ie && ie_version < 9) content.appendChild(elt("span", [txt]))
+        else content.appendChild(txt)
+        builder.map.push(builder.pos, builder.pos + skipped, txt)
+        builder.col += skipped
+        builder.pos += skipped
+      }
+      if (!m) break
+      pos += skipped + 1
+      let txt
+      if (m[0] == "\t") {
+        let tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize
+        txt = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"))
+        txt.setAttribute("role", "presentation")
+        txt.setAttribute("cm-text", "\t")
+        builder.col += tabWidth
+      } else if (m[0] == "\r" || m[0] == "\n") {
+        txt = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"))
+        txt.setAttribute("cm-text", m[0])
+        builder.col += 1
+      } else {
+        txt = builder.cm.options.specialCharPlaceholder(m[0])
+        txt.setAttribute("cm-text", m[0])
+        if (ie && ie_version < 9) content.appendChild(elt("span", [txt]))
+        else content.appendChild(txt)
+        builder.col += 1
+      }
+      builder.map.push(builder.pos, builder.pos + 1, txt)
+      builder.pos++
+    }
+  }
+  builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
+  if (style || startStyle || endStyle || mustWrap || css || attributes) {
+    let fullStyle = style || ""
+    if (startStyle) fullStyle += startStyle
+    if (endStyle) fullStyle += endStyle
+    let token = elt("span", [content], fullStyle, css)
+    if (attributes) {
+      for (let attr in attributes) if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
+        token.setAttribute(attr, attributes[attr])
+    }
+    return builder.content.appendChild(token)
+  }
+  builder.content.appendChild(content)
+}
+
+// Change some spaces to NBSP to prevent the browser from collapsing
+// trailing spaces at the end of a line when rendering text (issue #1362).
+function splitSpaces(text, trailingBefore) {
+  if (text.length > 1 && !/  /.test(text)) return text
+  let spaceBefore = trailingBefore, result = ""
+  for (let i = 0; i < text.length; i++) {
+    let ch = text.charAt(i)
+    if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
+      ch = "\u00a0"
+    result += ch
+    spaceBefore = ch == " "
+  }
+  return result
+}
+
+// Work around nonsense dimensions being reported for stretches of
+// right-to-left text.
+function buildTokenBadBidi(inner, order) {
+  return (builder, text, style, startStyle, endStyle, css, attributes) => {
+    style = style ? style + " cm-force-border" : "cm-force-border"
+    let start = builder.pos, end = start + text.length
+    for (;;) {
+      // Find the part that overlaps with the start of this text
+      let part
+      for (let i = 0; i < order.length; i++) {
+        part = order[i]
+        if (part.to > start && part.from <= start) break
+      }
+      if (part.to >= end) return inner(builder, text, style, startStyle, endStyle, css, attributes)
+      inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes)
+      startStyle = null
+      text = text.slice(part.to - start)
+      start = part.to
+    }
+  }
+}
+
+function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
+  let widget = !ignoreWidget && marker.widgetNode
+  if (widget) builder.map.push(builder.pos, builder.pos + size, widget)
+  if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
+    if (!widget)
+      widget = builder.content.appendChild(document.createElement("span"))
+    widget.setAttribute("cm-marker", marker.id)
+  }
+  if (widget) {
+    builder.cm.display.input.setUneditable(widget)
+    builder.content.appendChild(widget)
+  }
+  builder.pos += size
+  builder.trailingSpace = false
+}
+
+// Outputs a number of spans to make up a line, taking highlighting
+// and marked text into account.
+function insertLineContent(line, builder, styles) {
+  let spans = line.markedSpans, allText = line.text, at = 0
+  if (!spans) {
+    for (let i = 1; i < styles.length; i+=2)
+      builder.addToken(builder, allText.slice(at, at = styles[i]), interpretTokenStyle(styles[i+1], builder.cm.options))
+    return
+  }
+
+  let len = allText.length, pos = 0, i = 1, text = "", style, css
+  let nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes
+  for (;;) {
+    if (nextChange == pos) { // Update current marker set
+      spanStyle = spanEndStyle = spanStartStyle = css = ""
+      attributes = null
+      collapsed = null; nextChange = Infinity
+      let foundBookmarks = [], endStyles
+      for (let j = 0; j < spans.length; ++j) {
+        let sp = spans[j], m = sp.marker
+        if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
+          foundBookmarks.push(m)
+        } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
+          if (sp.to != null && sp.to != pos && nextChange > sp.to) {
+            nextChange = sp.to
+            spanEndStyle = ""
+          }
+          if (m.className) spanStyle += " " + m.className
+          if (m.css) css = (css ? css + ";" : "") + m.css
+          if (m.startStyle && sp.from == pos) spanStartStyle += " " + m.startStyle
+          if (m.endStyle && sp.to == nextChange) (endStyles || (endStyles = [])).push(m.endStyle, sp.to)
+          // support for the old title property
+          // https://github.com/codemirror/CodeMirror/pull/5673
+          if (m.title) (attributes || (attributes = {})).title = m.title
+          if (m.attributes) {
+            for (let attr in m.attributes)
+              (attributes || (attributes = {}))[attr] = m.attributes[attr]
+          }
+          if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
+            collapsed = sp
+        } else if (sp.from > pos && nextChange > sp.from) {
+          nextChange = sp.from
+        }
+      }
+      if (endStyles) for (let j = 0; j < endStyles.length; j += 2)
+        if (endStyles[j + 1] == nextChange) spanEndStyle += " " + endStyles[j]
+
+      if (!collapsed || collapsed.from == pos) for (let j = 0; j < foundBookmarks.length; ++j)
+        buildCollapsedSpan(builder, 0, foundBookmarks[j])
+      if (collapsed && (collapsed.from || 0) == pos) {
+        buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
+                           collapsed.marker, collapsed.from == null)
+        if (collapsed.to == null) return
+        if (collapsed.to == pos) collapsed = false
+      }
+    }
+    if (pos >= len) break
+
+    let upto = Math.min(len, nextChange)
+    while (true) {
+      if (text) {
+        let end = pos + text.length
+        if (!collapsed) {
+          let tokenText = end > upto ? text.slice(0, upto - pos) : text
+          builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
+                           spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes)
+        }
+        if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
+        pos = end
+        spanStartStyle = ""
+      }
+      text = allText.slice(at, at = styles[i++])
+      style = interpretTokenStyle(styles[i++], builder.cm.options)
+    }
+  }
+}
+
+
+// These objects are used to represent the visible (currently drawn)
+// part of the document. A LineView may correspond to multiple
+// logical lines, if those are connected by collapsed ranges.
+export function LineView(doc, line, lineN) {
+  // The starting line
+  this.line = line
+  // Continuing lines, if any
+  this.rest = visualLineContinued(line)
+  // Number of logical lines in this visual line
+  this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1
+  this.node = this.text = null
+  this.hidden = lineIsHidden(doc, line)
+}
+
+// Create a range of LineView objects for the given lines.
+export function buildViewArray(cm, from, to) {
+  let array = [], nextPos
+  for (let pos = from; pos < to; pos = nextPos) {
+    let view = new LineView(cm.doc, getLine(cm.doc, pos), pos)
+    nextPos = pos + view.size
+    array.push(view)
+  }
+  return array
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/line/pos.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,40 @@
+import { getLine } from "./utils_line.js"
+
+// A Pos instance represents a position within the text.
+export function Pos(line, ch, sticky = null) {
+  if (!(this instanceof Pos)) return new Pos(line, ch, sticky)
+  this.line = line
+  this.ch = ch
+  this.sticky = sticky
+}
+
+// Compare two positions, return 0 if they are the same, a negative
+// number when a is less, and a positive number otherwise.
+export function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
+
+export function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
+
+export function copyPos(x) {return Pos(x.line, x.ch)}
+export function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
+export function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
+
+// Most of the external API clips given positions to make sure they
+// actually exist within the document.
+export function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
+export function clipPos(doc, pos) {
+  if (pos.line < doc.first) return Pos(doc.first, 0)
+  let last = doc.first + doc.size - 1
+  if (pos.line > last) return Pos(last, getLine(doc, last).text.length)
+  return clipToLen(pos, getLine(doc, pos.line).text.length)
+}
+function clipToLen(pos, linelen) {
+  let ch = pos.ch
+  if (ch == null || ch > linelen) return Pos(pos.line, linelen)
+  else if (ch < 0) return Pos(pos.line, 0)
+  else return pos
+}
+export function clipPosArray(doc, array) {
+  let out = []
+  for (let i = 0; i < array.length; i++) out[i] = clipPos(doc, array[i])
+  return out
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/line/saw_special_spans.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,10 @@
+// Optimize some code when these features are not used.
+export let sawReadOnlySpans = false, sawCollapsedSpans = false
+
+export function seeReadOnlySpans() {
+  sawReadOnlySpans = true
+}
+
+export function seeCollapsedSpans() {
+  sawCollapsedSpans = true
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/line/spans.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,390 @@
+import { indexOf, lst } from "../util/misc.js"
+
+import { cmp } from "./pos.js"
+import { sawCollapsedSpans } from "./saw_special_spans.js"
+import { getLine, isLine, lineNo } from "./utils_line.js"
+
+// TEXTMARKER SPANS
+
+export function MarkedSpan(marker, from, to) {
+  this.marker = marker
+  this.from = from; this.to = to
+}
+
+// Search an array of spans for a span matching the given marker.
+export function getMarkedSpanFor(spans, marker) {
+  if (spans) for (let i = 0; i < spans.length; ++i) {
+    let span = spans[i]
+    if (span.marker == marker) return span
+  }
+}
+
+// Remove a span from an array, returning undefined if no spans are
+// left (we don't store arrays for lines without spans).
+export function removeMarkedSpan(spans, span) {
+  let r
+  for (let i = 0; i < spans.length; ++i)
+    if (spans[i] != span) (r || (r = [])).push(spans[i])
+  return r
+}
+
+// Add a span to a line.
+export function addMarkedSpan(line, span, op) {
+  let inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet))
+  if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {
+    line.markedSpans.push(span)
+  } else {
+    line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]
+    if (inThisOp) inThisOp.add(line.markedSpans)
+  }
+  span.marker.attachLine(line)
+}
+
+// Used for the algorithm that adjusts markers for a change in the
+// document. These functions cut an array of spans at a given
+// character position, returning an array of remaining chunks (or
+// undefined if nothing remains).
+function markedSpansBefore(old, startCh, isInsert) {
+  let nw
+  if (old) for (let i = 0; i < old.length; ++i) {
+    let span = old[i], marker = span.marker
+    let startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
+    if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
+      let endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
+      ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
+    }
+  }
+  return nw
+}
+function markedSpansAfter(old, endCh, isInsert) {
+  let nw
+  if (old) for (let i = 0; i < old.length; ++i) {
+    let span = old[i], marker = span.marker
+    let endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
+    if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
+      let startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
+      ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
+                                            span.to == null ? null : span.to - endCh))
+    }
+  }
+  return nw
+}
+
+// Given a change object, compute the new set of marker spans that
+// cover the line in which the change took place. Removes spans
+// entirely within the change, reconnects spans belonging to the
+// same marker that appear on both sides of the change, and cuts off
+// spans partially within the change. Returns an array of span
+// arrays with one element for each line in (after) the change.
+export function stretchSpansOverChange(doc, change) {
+  if (change.full) return null
+  let oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
+  let oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
+  if (!oldFirst && !oldLast) return null
+
+  let startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0
+  // Get the spans that 'stick out' on both sides
+  let first = markedSpansBefore(oldFirst, startCh, isInsert)
+  let last = markedSpansAfter(oldLast, endCh, isInsert)
+
+  // Next, merge those two ends
+  let sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0)
+  if (first) {
+    // Fix up .to properties of first
+    for (let i = 0; i < first.length; ++i) {
+      let span = first[i]
+      if (span.to == null) {
+        let found = getMarkedSpanFor(last, span.marker)
+        if (!found) span.to = startCh
+        else if (sameLine) span.to = found.to == null ? null : found.to + offset
+      }
+    }
+  }
+  if (last) {
+    // Fix up .from in last (or move them into first in case of sameLine)
+    for (let i = 0; i < last.length; ++i) {
+      let span = last[i]
+      if (span.to != null) span.to += offset
+      if (span.from == null) {
+        let found = getMarkedSpanFor(first, span.marker)
+        if (!found) {
+          span.from = offset
+          if (sameLine) (first || (first = [])).push(span)
+        }
+      } else {
+        span.from += offset
+        if (sameLine) (first || (first = [])).push(span)
+      }
+    }
+  }
+  // Make sure we didn't create any zero-length spans
+  if (first) first = clearEmptySpans(first)
+  if (last && last != first) last = clearEmptySpans(last)
+
+  let newMarkers = [first]
+  if (!sameLine) {
+    // Fill gap with whole-line-spans
+    let gap = change.text.length - 2, gapMarkers
+    if (gap > 0 && first)
+      for (let i = 0; i < first.length; ++i)
+        if (first[i].to == null)
+          (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i].marker, null, null))
+    for (let i = 0; i < gap; ++i)
+      newMarkers.push(gapMarkers)
+    newMarkers.push(last)
+  }
+  return newMarkers
+}
+
+// Remove spans that are empty and don't have a clearWhenEmpty
+// option of false.
+function clearEmptySpans(spans) {
+  for (let i = 0; i < spans.length; ++i) {
+    let span = spans[i]
+    if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
+      spans.splice(i--, 1)
+  }
+  if (!spans.length) return null
+  return spans
+}
+
+// Used to 'clip' out readOnly ranges when making a change.
+export function removeReadOnlyRanges(doc, from, to) {
+  let markers = null
+  doc.iter(from.line, to.line + 1, line => {
+    if (line.markedSpans) for (let i = 0; i < line.markedSpans.length; ++i) {
+      let mark = line.markedSpans[i].marker
+      if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
+        (markers || (markers = [])).push(mark)
+    }
+  })
+  if (!markers) return null
+  let parts = [{from: from, to: to}]
+  for (let i = 0; i < markers.length; ++i) {
+    let mk = markers[i], m = mk.find(0)
+    for (let j = 0; j < parts.length; ++j) {
+      let p = parts[j]
+      if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) continue
+      let newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to)
+      if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
+        newParts.push({from: p.from, to: m.from})
+      if (dto > 0 || !mk.inclusiveRight && !dto)
+        newParts.push({from: m.to, to: p.to})
+      parts.splice.apply(parts, newParts)
+      j += newParts.length - 3
+    }
+  }
+  return parts
+}
+
+// Connect or disconnect spans from a line.
+export function detachMarkedSpans(line) {
+  let spans = line.markedSpans
+  if (!spans) return
+  for (let i = 0; i < spans.length; ++i)
+    spans[i].marker.detachLine(line)
+  line.markedSpans = null
+}
+export function attachMarkedSpans(line, spans) {
+  if (!spans) return
+  for (let i = 0; i < spans.length; ++i)
+    spans[i].marker.attachLine(line)
+  line.markedSpans = spans
+}
+
+// Helpers used when computing which overlapping collapsed span
+// counts as the larger one.
+function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
+function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
+
+// Returns a number indicating which of two overlapping collapsed
+// spans is larger (and thus includes the other). Falls back to
+// comparing ids when the spans cover exactly the same range.
+export function compareCollapsedMarkers(a, b) {
+  let lenDiff = a.lines.length - b.lines.length
+  if (lenDiff != 0) return lenDiff
+  let aPos = a.find(), bPos = b.find()
+  let fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)
+  if (fromCmp) return -fromCmp
+  let toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)
+  if (toCmp) return toCmp
+  return b.id - a.id
+}
+
+// Find out whether a line ends or starts in a collapsed span. If
+// so, return the marker for that span.
+function collapsedSpanAtSide(line, start) {
+  let sps = sawCollapsedSpans && line.markedSpans, found
+  if (sps) for (let sp, i = 0; i < sps.length; ++i) {
+    sp = sps[i]
+    if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
+        (!found || compareCollapsedMarkers(found, sp.marker) < 0))
+      found = sp.marker
+  }
+  return found
+}
+export function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
+export function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
+
+export function collapsedSpanAround(line, ch) {
+  let sps = sawCollapsedSpans && line.markedSpans, found
+  if (sps) for (let i = 0; i < sps.length; ++i) {
+    let sp = sps[i]
+    if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
+        (!found || compareCollapsedMarkers(found, sp.marker) < 0)) found = sp.marker
+  }
+  return found
+}
+
+// Test whether there exists a collapsed span that partially
+// overlaps (covers the start or end, but not both) of a new span.
+// Such overlap is not allowed.
+export function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
+  let line = getLine(doc, lineNo)
+  let sps = sawCollapsedSpans && line.markedSpans
+  if (sps) for (let i = 0; i < sps.length; ++i) {
+    let sp = sps[i]
+    if (!sp.marker.collapsed) continue
+    let found = sp.marker.find(0)
+    let fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)
+    let toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)
+    if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) continue
+    if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
+        fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
+      return true
+  }
+}
+
+// A visual line is a line as drawn on the screen. Folding, for
+// example, can cause multiple logical lines to appear on the same
+// visual line. This finds the start of the visual line that the
+// given line is part of (usually that is the line itself).
+export function visualLine(line) {
+  let merged
+  while (merged = collapsedSpanAtStart(line))
+    line = merged.find(-1, true).line
+  return line
+}
+
+export function visualLineEnd(line) {
+  let merged
+  while (merged = collapsedSpanAtEnd(line))
+    line = merged.find(1, true).line
+  return line
+}
+
+// Returns an array of logical lines that continue the visual line
+// started by the argument, or undefined if there are no such lines.
+export function visualLineContinued(line) {
+  let merged, lines
+  while (merged = collapsedSpanAtEnd(line)) {
+    line = merged.find(1, true).line
+    ;(lines || (lines = [])).push(line)
+  }
+  return lines
+}
+
+// Get the line number of the start of the visual line that the
+// given line number is part of.
+export function visualLineNo(doc, lineN) {
+  let line = getLine(doc, lineN), vis = visualLine(line)
+  if (line == vis) return lineN
+  return lineNo(vis)
+}
+
+// Get the line number of the start of the next visual line after
+// the given line.
+export function visualLineEndNo(doc, lineN) {
+  if (lineN > doc.lastLine()) return lineN
+  let line = getLine(doc, lineN), merged
+  if (!lineIsHidden(doc, line)) return lineN
+  while (merged = collapsedSpanAtEnd(line))
+    line = merged.find(1, true).line
+  return lineNo(line) + 1
+}
+
+// Compute whether a line is hidden. Lines count as hidden when they
+// are part of a visual line that starts with another line, or when
+// they are entirely covered by collapsed, non-widget span.
+export function lineIsHidden(doc, line) {
+  let sps = sawCollapsedSpans && line.markedSpans
+  if (sps) for (let sp, i = 0; i < sps.length; ++i) {
+    sp = sps[i]
+    if (!sp.marker.collapsed) continue
+    if (sp.from == null) return true
+    if (sp.marker.widgetNode) continue
+    if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
+      return true
+  }
+}
+function lineIsHiddenInner(doc, line, span) {
+  if (span.to == null) {
+    let end = span.marker.find(1, true)
+    return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
+  }
+  if (span.marker.inclusiveRight && span.to == line.text.length)
+    return true
+  for (let sp, i = 0; i < line.markedSpans.length; ++i) {
+    sp = line.markedSpans[i]
+    if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
+        (sp.to == null || sp.to != span.from) &&
+        (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
+        lineIsHiddenInner(doc, line, sp)) return true
+  }
+}
+
+// Find the height above the given line.
+export function heightAtLine(lineObj) {
+  lineObj = visualLine(lineObj)
+
+  let h = 0, chunk = lineObj.parent
+  for (let i = 0; i < chunk.lines.length; ++i) {
+    let line = chunk.lines[i]
+    if (line == lineObj) break
+    else h += line.height
+  }
+  for (let p = chunk.parent; p; chunk = p, p = chunk.parent) {
+    for (let i = 0; i < p.children.length; ++i) {
+      let cur = p.children[i]
+      if (cur == chunk) break
+      else h += cur.height
+    }
+  }
+  return h
+}
+
+// Compute the character length of a line, taking into account
+// collapsed ranges (see markText) that might hide parts, and join
+// other lines onto it.
+export function lineLength(line) {
+  if (line.height == 0) return 0
+  let len = line.text.length, merged, cur = line
+  while (merged = collapsedSpanAtStart(cur)) {
+    let found = merged.find(0, true)
+    cur = found.from.line
+    len += found.from.ch - found.to.ch
+  }
+  cur = line
+  while (merged = collapsedSpanAtEnd(cur)) {
+    let found = merged.find(0, true)
+    len -= cur.text.length - found.from.ch
+    cur = found.to.line
+    len += cur.text.length - found.to.ch
+  }
+  return len
+}
+
+// Find the longest line in the document.
+export function findMaxLine(cm) {
+  let d = cm.display, doc = cm.doc
+  d.maxLine = getLine(doc, doc.first)
+  d.maxLineLength = lineLength(d.maxLine)
+  d.maxLineChanged = true
+  doc.iter(line => {
+    let len = lineLength(line)
+    if (len > d.maxLineLength) {
+      d.maxLineLength = len
+      d.maxLine = line
+    }
+  })
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/line/utils_line.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+import { indexOf } from "../util/misc.js"
+
+// Find the line object corresponding to the given line number.
+export function getLine(doc, n) {
+  n -= doc.first
+  if (n < 0 || n >= doc.size) throw new Error("There is no line " + (n + doc.first) + " in the document.")
+  let chunk = doc
+  while (!chunk.lines) {
+    for (let i = 0;; ++i) {
+      let child = chunk.children[i], sz = child.chunkSize()
+      if (n < sz) { chunk = child; break }
+      n -= sz
+    }
+  }
+  return chunk.lines[n]
+}
+
+// Get the part of a document between two positions, as an array of
+// strings.
+export function getBetween(doc, start, end) {
+  let out = [], n = start.line
+  doc.iter(start.line, end.line + 1, line => {
+    let text = line.text
+    if (n == end.line) text = text.slice(0, end.ch)
+    if (n == start.line) text = text.slice(start.ch)
+    out.push(text)
+    ++n
+  })
+  return out
+}
+// Get the lines between from and to, as array of strings.
+export function getLines(doc, from, to) {
+  let out = []
+  doc.iter(from, to, line => { out.push(line.text) }) // iter aborts when callback returns truthy value
+  return out
+}
+
+// Update the height of a line, propagating the height change
+// upwards to parent nodes.
+export function updateLineHeight(line, height) {
+  let diff = height - line.height
+  if (diff) for (let n = line; n; n = n.parent) n.height += diff
+}
+
+// Given a line object, find its line number by walking up through
+// its parent links.
+export function lineNo(line) {
+  if (line.parent == null) return null
+  let cur = line.parent, no = indexOf(cur.lines, line)
+  for (let chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
+    for (let i = 0;; ++i) {
+      if (chunk.children[i] == cur) break
+      no += chunk.children[i].chunkSize()
+    }
+  }
+  return no + cur.first
+}
+
+// Find the line at the given vertical position, using the height
+// information in the document tree.
+export function lineAtHeight(chunk, h) {
+  let n = chunk.first
+  outer: do {
+    for (let i = 0; i < chunk.children.length; ++i) {
+      let child = chunk.children[i], ch = child.height
+      if (h < ch) { chunk = child; continue outer }
+      h -= ch
+      n += child.chunkSize()
+    }
+    return n
+  } while (!chunk.lines)
+  let i = 0
+  for (; i < chunk.lines.length; ++i) {
+    let line = chunk.lines[i], lh = line.height
+    if (h < lh) break
+    h -= lh
+  }
+  return n + i
+}
+
+export function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
+
+export function lineNumberFor(options, i) {
+  return String(options.lineNumberFormatter(i + options.firstLineNumber))
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/measurement/position_measurement.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,702 @@
+import { buildLineContent, LineView } from "../line/line_data.js"
+import { clipPos, Pos } from "../line/pos.js"
+import { collapsedSpanAround, heightAtLine, lineIsHidden, visualLine } from "../line/spans.js"
+import { getLine, lineAtHeight, lineNo, updateLineHeight } from "../line/utils_line.js"
+import { bidiOther, getBidiPartAt, getOrder } from "../util/bidi.js"
+import { chrome, android, ie, ie_version } from "../util/browser.js"
+import { elt, removeChildren, range, removeChildrenAndAdd, doc } from "../util/dom.js"
+import { e_target } from "../util/event.js"
+import { hasBadZoomedRects } from "../util/feature_detection.js"
+import { countColumn, findFirst, isExtendingChar, scrollerGap, skipExtendingChars } from "../util/misc.js"
+import { updateLineForChanges } from "../display/update_line.js"
+
+import { widgetHeight } from "./widgets.js"
+
+// POSITION MEASUREMENT
+
+export function paddingTop(display) {return display.lineSpace.offsetTop}
+export function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
+export function paddingH(display) {
+  if (display.cachedPaddingH) return display.cachedPaddingH
+  let e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"))
+  let style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle
+  let data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}
+  if (!isNaN(data.left) && !isNaN(data.right)) display.cachedPaddingH = data
+  return data
+}
+
+export function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
+export function displayWidth(cm) {
+  return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
+}
+export function displayHeight(cm) {
+  return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
+}
+
+// Ensure the lineView.wrapping.heights array is populated. This is
+// an array of bottom offsets for the lines that make up a drawn
+// line. When lineWrapping is on, there might be more than one
+// height.
+function ensureLineHeights(cm, lineView, rect) {
+  let wrapping = cm.options.lineWrapping
+  let curWidth = wrapping && displayWidth(cm)
+  if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
+    let heights = lineView.measure.heights = []
+    if (wrapping) {
+      lineView.measure.width = curWidth
+      let rects = lineView.text.firstChild.getClientRects()
+      for (let i = 0; i < rects.length - 1; i++) {
+        let cur = rects[i], next = rects[i + 1]
+        if (Math.abs(cur.bottom - next.bottom) > 2)
+          heights.push((cur.bottom + next.top) / 2 - rect.top)
+      }
+    }
+    heights.push(rect.bottom - rect.top)
+  }
+}
+
+// Find a line map (mapping character offsets to text nodes) and a
+// measurement cache for the given line number. (A line view might
+// contain multiple lines when collapsed ranges are present.)
+export function mapFromLineView(lineView, line, lineN) {
+  if (lineView.line == line)
+    return {map: lineView.measure.map, cache: lineView.measure.cache}
+  if (lineView.rest) {
+    for (let i = 0; i < lineView.rest.length; i++)
+      if (lineView.rest[i] == line)
+        return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}
+    for (let i = 0; i < lineView.rest.length; i++)
+      if (lineNo(lineView.rest[i]) > lineN)
+        return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i], before: true}
+  }
+}
+
+// Render a line into the hidden node display.externalMeasured. Used
+// when measurement is needed for a line that's not in the viewport.
+function updateExternalMeasurement(cm, line) {
+  line = visualLine(line)
+  let lineN = lineNo(line)
+  let view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)
+  view.lineN = lineN
+  let built = view.built = buildLineContent(cm, view)
+  view.text = built.pre
+  removeChildrenAndAdd(cm.display.lineMeasure, built.pre)
+  return view
+}
+
+// Get a {top, bottom, left, right} box (in line-local coordinates)
+// for a given character.
+export function measureChar(cm, line, ch, bias) {
+  return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
+}
+
+// Find a line view that corresponds to the given line number.
+export function findViewForLine(cm, lineN) {
+  if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
+    return cm.display.view[findViewIndex(cm, lineN)]
+  let ext = cm.display.externalMeasured
+  if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
+    return ext
+}
+
+// Measurement can be split in two steps, the set-up work that
+// applies to the whole line, and the measurement of the actual
+// character. Functions like coordsChar, that need to do a lot of
+// measurements in a row, can thus ensure that the set-up work is
+// only done once.
+export function prepareMeasureForLine(cm, line) {
+  let lineN = lineNo(line)
+  let view = findViewForLine(cm, lineN)
+  if (view && !view.text) {
+    view = null
+  } else if (view && view.changes) {
+    updateLineForChanges(cm, view, lineN, getDimensions(cm))
+    cm.curOp.forceUpdate = true
+  }
+  if (!view)
+    view = updateExternalMeasurement(cm, line)
+
+  let info = mapFromLineView(view, line, lineN)
+  return {
+    line: line, view: view, rect: null,
+    map: info.map, cache: info.cache, before: info.before,
+    hasHeights: false
+  }
+}
+
+// Given a prepared measurement object, measures the position of an
+// actual character (or fetches it from the cache).
+export function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
+  if (prepared.before) ch = -1
+  let key = ch + (bias || ""), found
+  if (prepared.cache.hasOwnProperty(key)) {
+    found = prepared.cache[key]
+  } else {
+    if (!prepared.rect)
+      prepared.rect = prepared.view.text.getBoundingClientRect()
+    if (!prepared.hasHeights) {
+      ensureLineHeights(cm, prepared.view, prepared.rect)
+      prepared.hasHeights = true
+    }
+    found = measureCharInner(cm, prepared, ch, bias)
+    if (!found.bogus) prepared.cache[key] = found
+  }
+  return {left: found.left, right: found.right,
+          top: varHeight ? found.rtop : found.top,
+          bottom: varHeight ? found.rbottom : found.bottom}
+}
+
+let nullRect = {left: 0, right: 0, top: 0, bottom: 0}
+
+export function nodeAndOffsetInLineMap(map, ch, bias) {
+  let node, start, end, collapse, mStart, mEnd
+  // First, search the line map for the text node corresponding to,
+  // or closest to, the target character.
+  for (let i = 0; i < map.length; i += 3) {
+    mStart = map[i]
+    mEnd = map[i + 1]
+    if (ch < mStart) {
+      start = 0; end = 1
+      collapse = "left"
+    } else if (ch < mEnd) {
+      start = ch - mStart
+      end = start + 1
+    } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
+      end = mEnd - mStart
+      start = end - 1
+      if (ch >= mEnd) collapse = "right"
+    }
+    if (start != null) {
+      node = map[i + 2]
+      if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
+        collapse = bias
+      if (bias == "left" && start == 0)
+        while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
+          node = map[(i -= 3) + 2]
+          collapse = "left"
+        }
+      if (bias == "right" && start == mEnd - mStart)
+        while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
+          node = map[(i += 3) + 2]
+          collapse = "right"
+        }
+      break
+    }
+  }
+  return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
+}
+
+function getUsefulRect(rects, bias) {
+  let rect = nullRect
+  if (bias == "left") for (let i = 0; i < rects.length; i++) {
+    if ((rect = rects[i]).left != rect.right) break
+  } else for (let i = rects.length - 1; i >= 0; i--) {
+    if ((rect = rects[i]).left != rect.right) break
+  }
+  return rect
+}
+
+function measureCharInner(cm, prepared, ch, bias) {
+  let place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
+  let node = place.node, start = place.start, end = place.end, collapse = place.collapse
+
+  let rect
+  if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
+    for (let i = 0; i < 4; i++) { // Retry a maximum of 4 times when nonsense rectangles are returned
+      while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) --start
+      while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) ++end
+      if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
+        rect = node.parentNode.getBoundingClientRect()
+      else
+        rect = getUsefulRect(range(node, start, end).getClientRects(), bias)
+      if (rect.left || rect.right || start == 0) break
+      end = start
+      start = start - 1
+      collapse = "right"
+    }
+    if (ie && ie_version < 11) rect = maybeUpdateRectForZooming(cm.display.measure, rect)
+  } else { // If it is a widget, simply get the box for the whole widget.
+    if (start > 0) collapse = bias = "right"
+    let rects
+    if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
+      rect = rects[bias == "right" ? rects.length - 1 : 0]
+    else
+      rect = node.getBoundingClientRect()
+  }
+  if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
+    let rSpan = node.parentNode.getClientRects()[0]
+    if (rSpan)
+      rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}
+    else
+      rect = nullRect
+  }
+
+  let rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top
+  let mid = (rtop + rbot) / 2
+  let heights = prepared.view.measure.heights
+  let i = 0
+  for (; i < heights.length - 1; i++)
+    if (mid < heights[i]) break
+  let top = i ? heights[i - 1] : 0, bot = heights[i]
+  let result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
+                right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
+                top: top, bottom: bot}
+  if (!rect.left && !rect.right) result.bogus = true
+  if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot }
+
+  return result
+}
+
+// Work around problem with bounding client rects on ranges being
+// returned incorrectly when zoomed on IE10 and below.
+function maybeUpdateRectForZooming(measure, rect) {
+  if (!window.screen || screen.logicalXDPI == null ||
+      screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
+    return rect
+  let scaleX = screen.logicalXDPI / screen.deviceXDPI
+  let scaleY = screen.logicalYDPI / screen.deviceYDPI
+  return {left: rect.left * scaleX, right: rect.right * scaleX,
+          top: rect.top * scaleY, bottom: rect.bottom * scaleY}
+}
+
+export function clearLineMeasurementCacheFor(lineView) {
+  if (lineView.measure) {
+    lineView.measure.cache = {}
+    lineView.measure.heights = null
+    if (lineView.rest) for (let i = 0; i < lineView.rest.length; i++)
+      lineView.measure.caches[i] = {}
+  }
+}
+
+export function clearLineMeasurementCache(cm) {
+  cm.display.externalMeasure = null
+  removeChildren(cm.display.lineMeasure)
+  for (let i = 0; i < cm.display.view.length; i++)
+    clearLineMeasurementCacheFor(cm.display.view[i])
+}
+
+export function clearCaches(cm) {
+  clearLineMeasurementCache(cm)
+  cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null
+  if (!cm.options.lineWrapping) cm.display.maxLineChanged = true
+  cm.display.lineNumChars = null
+}
+
+function pageScrollX(doc) {
+  // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
+  // which causes page_Offset and bounding client rects to use
+  // different reference viewports and invalidate our calculations.
+  if (chrome && android) return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft))
+  return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft
+}
+function pageScrollY(doc) {
+  if (chrome && android) return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop))
+  return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop
+}
+
+function widgetTopHeight(lineObj) {
+  let {widgets} = visualLine(lineObj), height = 0
+  if (widgets) for (let i = 0; i < widgets.length; ++i) if (widgets[i].above)
+    height += widgetHeight(widgets[i])
+  return height
+}
+
+// Converts a {top, bottom, left, right} box from line-local
+// coordinates into another coordinate system. Context may be one of
+// "line", "div" (display.lineDiv), "local"./null (editor), "window",
+// or "page".
+export function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
+  if (!includeWidgets) {
+    let height = widgetTopHeight(lineObj)
+    rect.top += height; rect.bottom += height
+  }
+  if (context == "line") return rect
+  if (!context) context = "local"
+  let yOff = heightAtLine(lineObj)
+  if (context == "local") yOff += paddingTop(cm.display)
+  else yOff -= cm.display.viewOffset
+  if (context == "page" || context == "window") {
+    let lOff = cm.display.lineSpace.getBoundingClientRect()
+    yOff += lOff.top + (context == "window" ? 0 : pageScrollY(doc(cm)))
+    let xOff = lOff.left + (context == "window" ? 0 : pageScrollX(doc(cm)))
+    rect.left += xOff; rect.right += xOff
+  }
+  rect.top += yOff; rect.bottom += yOff
+  return rect
+}
+
+// Coverts a box from "div" coords to another coordinate system.
+// Context may be "window", "page", "div", or "local"./null.
+export function fromCoordSystem(cm, coords, context) {
+  if (context == "div") return coords
+  let left = coords.left, top = coords.top
+  // First move into "page" coordinate system
+  if (context == "page") {
+    left -= pageScrollX(doc(cm))
+    top -= pageScrollY(doc(cm))
+  } else if (context == "local" || !context) {
+    let localBox = cm.display.sizer.getBoundingClientRect()
+    left += localBox.left
+    top += localBox.top
+  }
+
+  let lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()
+  return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
+}
+
+export function charCoords(cm, pos, context, lineObj, bias) {
+  if (!lineObj) lineObj = getLine(cm.doc, pos.line)
+  return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
+}
+
+// Returns a box for a given cursor position, which may have an
+// 'other' property containing the position of the secondary cursor
+// on a bidi boundary.
+// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
+// and after `char - 1` in writing order of `char - 1`
+// A cursor Pos(line, char, "after") is on the same visual line as `char`
+// and before `char` in writing order of `char`
+// Examples (upper-case letters are RTL, lower-case are LTR):
+//     Pos(0, 1, ...)
+//     before   after
+// ab     a|b     a|b
+// aB     a|B     aB|
+// Ab     |Ab     A|b
+// AB     B|A     B|A
+// Every position after the last character on a line is considered to stick
+// to the last character on the line.
+export function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
+  lineObj = lineObj || getLine(cm.doc, pos.line)
+  if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj)
+  function get(ch, right) {
+    let m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight)
+    if (right) m.left = m.right; else m.right = m.left
+    return intoCoordSystem(cm, lineObj, m, context)
+  }
+  let order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky
+  if (ch >= lineObj.text.length) {
+    ch = lineObj.text.length
+    sticky = "before"
+  } else if (ch <= 0) {
+    ch = 0
+    sticky = "after"
+  }
+  if (!order) return get(sticky == "before" ? ch - 1 : ch, sticky == "before")
+
+  function getBidi(ch, partPos, invert) {
+    let part = order[partPos], right = part.level == 1
+    return get(invert ? ch - 1 : ch, right != invert)
+  }
+  let partPos = getBidiPartAt(order, ch, sticky)
+  let other = bidiOther
+  let val = getBidi(ch, partPos, sticky == "before")
+  if (other != null) val.other = getBidi(ch, other, sticky != "before")
+  return val
+}
+
+// Used to cheaply estimate the coordinates for a position. Used for
+// intermediate scroll updates.
+export function estimateCoords(cm, pos) {
+  let left = 0
+  pos = clipPos(cm.doc, pos)
+  if (!cm.options.lineWrapping) left = charWidth(cm.display) * pos.ch
+  let lineObj = getLine(cm.doc, pos.line)
+  let top = heightAtLine(lineObj) + paddingTop(cm.display)
+  return {left: left, right: left, top: top, bottom: top + lineObj.height}
+}
+
+// Positions returned by coordsChar contain some extra information.
+// xRel is the relative x position of the input coordinates compared
+// to the found position (so xRel > 0 means the coordinates are to
+// the right of the character position, for example). When outside
+// is true, that means the coordinates lie outside the line's
+// vertical range.
+function PosWithInfo(line, ch, sticky, outside, xRel) {
+  let pos = Pos(line, ch, sticky)
+  pos.xRel = xRel
+  if (outside) pos.outside = outside
+  return pos
+}
+
+// Compute the character position closest to the given coordinates.
+// Input must be lineSpace-local ("div" coordinate system).
+export function coordsChar(cm, x, y) {
+  let doc = cm.doc
+  y += cm.display.viewOffset
+  if (y < 0) return PosWithInfo(doc.first, 0, null, -1, -1)
+  let lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1
+  if (lineN > last)
+    return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1)
+  if (x < 0) x = 0
+
+  let lineObj = getLine(doc, lineN)
+  for (;;) {
+    let found = coordsCharInner(cm, lineObj, lineN, x, y)
+    let collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0))
+    if (!collapsed) return found
+    let rangeEnd = collapsed.find(1)
+    if (rangeEnd.line == lineN) return rangeEnd
+    lineObj = getLine(doc, lineN = rangeEnd.line)
+  }
+}
+
+function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
+  y -= widgetTopHeight(lineObj)
+  let end = lineObj.text.length
+  let begin = findFirst(ch => measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y, end, 0)
+  end = findFirst(ch => measureCharPrepared(cm, preparedMeasure, ch).top > y, begin, end)
+  return {begin, end}
+}
+
+export function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
+  if (!preparedMeasure) preparedMeasure = prepareMeasureForLine(cm, lineObj)
+  let targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top
+  return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
+}
+
+// Returns true if the given side of a box is after the given
+// coordinates, in top-to-bottom, left-to-right order.
+function boxIsAfter(box, x, y, left) {
+  return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
+}
+
+function coordsCharInner(cm, lineObj, lineNo, x, y) {
+  // Move y into line-local coordinate space
+  y -= heightAtLine(lineObj)
+  let preparedMeasure = prepareMeasureForLine(cm, lineObj)
+  // When directly calling `measureCharPrepared`, we have to adjust
+  // for the widgets at this line.
+  let widgetHeight = widgetTopHeight(lineObj)
+  let begin = 0, end = lineObj.text.length, ltr = true
+
+  let order = getOrder(lineObj, cm.doc.direction)
+  // If the line isn't plain left-to-right text, first figure out
+  // which bidi section the coordinates fall into.
+  if (order) {
+    let part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
+                 (cm, lineObj, lineNo, preparedMeasure, order, x, y)
+    ltr = part.level != 1
+    // The awkward -1 offsets are needed because findFirst (called
+    // on these below) will treat its first bound as inclusive,
+    // second as exclusive, but we want to actually address the
+    // characters in the part's range
+    begin = ltr ? part.from : part.to - 1
+    end = ltr ? part.to : part.from - 1
+  }
+
+  // A binary search to find the first character whose bounding box
+  // starts after the coordinates. If we run across any whose box wrap
+  // the coordinates, store that.
+  let chAround = null, boxAround = null
+  let ch = findFirst(ch => {
+    let box = measureCharPrepared(cm, preparedMeasure, ch)
+    box.top += widgetHeight; box.bottom += widgetHeight
+    if (!boxIsAfter(box, x, y, false)) return false
+    if (box.top <= y && box.left <= x) {
+      chAround = ch
+      boxAround = box
+    }
+    return true
+  }, begin, end)
+
+  let baseX, sticky, outside = false
+  // If a box around the coordinates was found, use that
+  if (boxAround) {
+    // Distinguish coordinates nearer to the left or right side of the box
+    let atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr
+    ch = chAround + (atStart ? 0 : 1)
+    sticky = atStart ? "after" : "before"
+    baseX = atLeft ? boxAround.left : boxAround.right
+  } else {
+    // (Adjust for extended bound, if necessary.)
+    if (!ltr && (ch == end || ch == begin)) ch++
+    // To determine which side to associate with, get the box to the
+    // left of the character and compare it's vertical position to the
+    // coordinates
+    sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
+      (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
+      "after" : "before"
+    // Now get accurate coordinates for this place, in order to get a
+    // base X position
+    let coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure)
+    baseX = coords.left
+    outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0
+  }
+
+  ch = skipExtendingChars(lineObj.text, ch, 1)
+  return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
+}
+
+function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
+  // Bidi parts are sorted left-to-right, and in a non-line-wrapping
+  // situation, we can take this ordering to correspond to the visual
+  // ordering. This finds the first part whose end is after the given
+  // coordinates.
+  let index = findFirst(i => {
+    let part = order[i], ltr = part.level != 1
+    return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
+                                   "line", lineObj, preparedMeasure), x, y, true)
+  }, 0, order.length - 1)
+  let part = order[index]
+  // If this isn't the first part, the part's start is also after
+  // the coordinates, and the coordinates aren't on the same line as
+  // that start, move one part back.
+  if (index > 0) {
+    let ltr = part.level != 1
+    let start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
+                             "line", lineObj, preparedMeasure)
+    if (boxIsAfter(start, x, y, true) && start.top > y)
+      part = order[index - 1]
+  }
+  return part
+}
+
+function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
+  // In a wrapped line, rtl text on wrapping boundaries can do things
+  // that don't correspond to the ordering in our `order` array at
+  // all, so a binary search doesn't work, and we want to return a
+  // part that only spans one line so that the binary search in
+  // coordsCharInner is safe. As such, we first find the extent of the
+  // wrapped line, and then do a flat search in which we discard any
+  // spans that aren't on the line.
+  let {begin, end} = wrappedLineExtent(cm, lineObj, preparedMeasure, y)
+  if (/\s/.test(lineObj.text.charAt(end - 1))) end--
+  let part = null, closestDist = null
+  for (let i = 0; i < order.length; i++) {
+    let p = order[i]
+    if (p.from >= end || p.to <= begin) continue
+    let ltr = p.level != 1
+    let endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right
+    // Weigh against spans ending before this, so that they are only
+    // picked if nothing ends after
+    let dist = endX < x ? x - endX + 1e9 : endX - x
+    if (!part || closestDist > dist) {
+      part = p
+      closestDist = dist
+    }
+  }
+  if (!part) part = order[order.length - 1]
+  // Clip the part to the wrapped line.
+  if (part.from < begin) part = {from: begin, to: part.to, level: part.level}
+  if (part.to > end) part = {from: part.from, to: end, level: part.level}
+  return part
+}
+
+let measureText
+// Compute the default text height.
+export function textHeight(display) {
+  if (display.cachedTextHeight != null) return display.cachedTextHeight
+  if (measureText == null) {
+    measureText = elt("pre", null, "CodeMirror-line-like")
+    // Measure a bunch of lines, for browsers that compute
+    // fractional heights.
+    for (let i = 0; i < 49; ++i) {
+      measureText.appendChild(document.createTextNode("x"))
+      measureText.appendChild(elt("br"))
+    }
+    measureText.appendChild(document.createTextNode("x"))
+  }
+  removeChildrenAndAdd(display.measure, measureText)
+  let height = measureText.offsetHeight / 50
+  if (height > 3) display.cachedTextHeight = height
+  removeChildren(display.measure)
+  return height || 1
+}
+
+// Compute the default character width.
+export function charWidth(display) {
+  if (display.cachedCharWidth != null) return display.cachedCharWidth
+  let anchor = elt("span", "xxxxxxxxxx")
+  let pre = elt("pre", [anchor], "CodeMirror-line-like")
+  removeChildrenAndAdd(display.measure, pre)
+  let rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10
+  if (width > 2) display.cachedCharWidth = width
+  return width || 10
+}
+
+// Do a bulk-read of the DOM positions and sizes needed to draw the
+// view, so that we don't interleave reading and writing to the DOM.
+export function getDimensions(cm) {
+  let d = cm.display, left = {}, width = {}
+  let gutterLeft = d.gutters.clientLeft
+  for (let n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
+    let id = cm.display.gutterSpecs[i].className
+    left[id] = n.offsetLeft + n.clientLeft + gutterLeft
+    width[id] = n.clientWidth
+  }
+  return {fixedPos: compensateForHScroll(d),
+          gutterTotalWidth: d.gutters.offsetWidth,
+          gutterLeft: left,
+          gutterWidth: width,
+          wrapperWidth: d.wrapper.clientWidth}
+}
+
+// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
+// but using getBoundingClientRect to get a sub-pixel-accurate
+// result.
+export function compensateForHScroll(display) {
+  return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
+}
+
+// Returns a function that estimates the height of a line, to use as
+// first approximation until the line becomes visible (and is thus
+// properly measurable).
+export function estimateHeight(cm) {
+  let th = textHeight(cm.display), wrapping = cm.options.lineWrapping
+  let perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)
+  return line => {
+    if (lineIsHidden(cm.doc, line)) return 0
+
+    let widgetsHeight = 0
+    if (line.widgets) for (let i = 0; i < line.widgets.length; i++) {
+      if (line.widgets[i].height) widgetsHeight += line.widgets[i].height
+    }
+
+    if (wrapping)
+      return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th
+    else
+      return widgetsHeight + th
+  }
+}
+
+export function estimateLineHeights(cm) {
+  let doc = cm.doc, est = estimateHeight(cm)
+  doc.iter(line => {
+    let estHeight = est(line)
+    if (estHeight != line.height) updateLineHeight(line, estHeight)
+  })
+}
+
+// Given a mouse event, find the corresponding position. If liberal
+// is false, it checks whether a gutter or scrollbar was clicked,
+// and returns null if it was. forRect is used by rectangular
+// selections, and tries to estimate a character position even for
+// coordinates beyond the right of the text.
+export function posFromMouse(cm, e, liberal, forRect) {
+  let display = cm.display
+  if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") return null
+
+  let x, y, space = display.lineSpace.getBoundingClientRect()
+  // Fails unpredictably on IE[67] when mouse is dragged around quickly.
+  try { x = e.clientX - space.left; y = e.clientY - space.top }
+  catch (e) { return null }
+  let coords = coordsChar(cm, x, y), line
+  if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
+    let colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length
+    coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))
+  }
+  return coords
+}
+
+// Find the view element corresponding to a given line. Return null
+// when the line isn't visible.
+export function findViewIndex(cm, n) {
+  if (n >= cm.display.viewTo) return null
+  n -= cm.display.viewFrom
+  if (n < 0) return null
+  let view = cm.display.view
+  for (let i = 0; i < view.length; i++) {
+    n -= view[i].size
+    if (n < 0) return i
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/measurement/widgets.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,26 @@
+import { contains, elt, removeChildrenAndAdd } from "../util/dom.js"
+import { e_target } from "../util/event.js"
+
+export function widgetHeight(widget) {
+  if (widget.height != null) return widget.height
+  let cm = widget.doc.cm
+  if (!cm) return 0
+  if (!contains(document.body, widget.node)) {
+    let parentStyle = "position: relative;"
+    if (widget.coverGutter)
+      parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"
+    if (widget.noHScroll)
+      parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"
+    removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle))
+  }
+  return widget.height = widget.node.parentNode.offsetHeight
+}
+
+// Return true when the given mouse event happened in a widget
+export function eventInWidget(display, e) {
+  for (let n = e_target(e); n != display.wrapper; n = n.parentNode) {
+    if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
+        (n.parentNode == display.sizer && n != display.mover))
+      return true
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/Doc.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,436 @@
+import CodeMirror from "../edit/CodeMirror.js"
+import { docMethodOp } from "../display/operations.js"
+import { Line } from "../line/line_data.js"
+import { clipPos, clipPosArray, Pos } from "../line/pos.js"
+import { visualLine } from "../line/spans.js"
+import { getBetween, getLine, getLines, isLine, lineNo } from "../line/utils_line.js"
+import { classTest } from "../util/dom.js"
+import { splitLinesAuto } from "../util/feature_detection.js"
+import { createObj, map, isEmpty, sel_dontScroll } from "../util/misc.js"
+import { ensureCursorVisible, scrollToCoords } from "../display/scrolling.js"
+
+import { changeLine, makeChange, makeChangeFromHistory, replaceRange } from "./changes.js"
+import { computeReplacedSel } from "./change_measurement.js"
+import { BranchChunk, LeafChunk } from "./chunk.js"
+import { directionChanged, linkedDocs, updateDoc } from "./document_data.js"
+import { copyHistoryArray, History } from "./history.js"
+import { addLineWidget } from "./line_widget.js"
+import { copySharedMarkers, detachSharedMarkers, findSharedMarkers, markText } from "./mark_text.js"
+import { normalizeSelection, Range, simpleSelection } from "./selection.js"
+import { extendSelection, extendSelections, setSelection, setSelectionReplaceHistory, setSimpleSelection } from "./selection_updates.js"
+
+let nextDocId = 0
+let Doc = function(text, mode, firstLine, lineSep, direction) {
+  if (!(this instanceof Doc)) return new Doc(text, mode, firstLine, lineSep, direction)
+  if (firstLine == null) firstLine = 0
+
+  BranchChunk.call(this, [new LeafChunk([new Line("", null)])])
+  this.first = firstLine
+  this.scrollTop = this.scrollLeft = 0
+  this.cantEdit = false
+  this.cleanGeneration = 1
+  this.modeFrontier = this.highlightFrontier = firstLine
+  let start = Pos(firstLine, 0)
+  this.sel = simpleSelection(start)
+  this.history = new History(null)
+  this.id = ++nextDocId
+  this.modeOption = mode
+  this.lineSep = lineSep
+  this.direction = (direction == "rtl") ? "rtl" : "ltr"
+  this.extend = false
+
+  if (typeof text == "string") text = this.splitLines(text)
+  updateDoc(this, {from: start, to: start, text: text})
+  setSelection(this, simpleSelection(start), sel_dontScroll)
+}
+
+Doc.prototype = createObj(BranchChunk.prototype, {
+  constructor: Doc,
+  // Iterate over the document. Supports two forms -- with only one
+  // argument, it calls that for each line in the document. With
+  // three, it iterates over the range given by the first two (with
+  // the second being non-inclusive).
+  iter: function(from, to, op) {
+    if (op) this.iterN(from - this.first, to - from, op)
+    else this.iterN(this.first, this.first + this.size, from)
+  },
+
+  // Non-public interface for adding and removing lines.
+  insert: function(at, lines) {
+    let height = 0
+    for (let i = 0; i < lines.length; ++i) height += lines[i].height
+    this.insertInner(at - this.first, lines, height)
+  },
+  remove: function(at, n) { this.removeInner(at - this.first, n) },
+
+  // From here, the methods are part of the public interface. Most
+  // are also available from CodeMirror (editor) instances.
+
+  getValue: function(lineSep) {
+    let lines = getLines(this, this.first, this.first + this.size)
+    if (lineSep === false) return lines
+    return lines.join(lineSep || this.lineSeparator())
+  },
+  setValue: docMethodOp(function(code) {
+    let top = Pos(this.first, 0), last = this.first + this.size - 1
+    makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
+                      text: this.splitLines(code), origin: "setValue", full: true}, true)
+    if (this.cm) scrollToCoords(this.cm, 0, 0)
+    setSelection(this, simpleSelection(top), sel_dontScroll)
+  }),
+  replaceRange: function(code, from, to, origin) {
+    from = clipPos(this, from)
+    to = to ? clipPos(this, to) : from
+    replaceRange(this, code, from, to, origin)
+  },
+  getRange: function(from, to, lineSep) {
+    let lines = getBetween(this, clipPos(this, from), clipPos(this, to))
+    if (lineSep === false) return lines
+    if (lineSep === '') return lines.join('')
+    return lines.join(lineSep || this.lineSeparator())
+  },
+
+  getLine: function(line) {let l = this.getLineHandle(line); return l && l.text},
+
+  getLineHandle: function(line) {if (isLine(this, line)) return getLine(this, line)},
+  getLineNumber: function(line) {return lineNo(line)},
+
+  getLineHandleVisualStart: function(line) {
+    if (typeof line == "number") line = getLine(this, line)
+    return visualLine(line)
+  },
+
+  lineCount: function() {return this.size},
+  firstLine: function() {return this.first},
+  lastLine: function() {return this.first + this.size - 1},
+
+  clipPos: function(pos) {return clipPos(this, pos)},
+
+  getCursor: function(start) {
+    let range = this.sel.primary(), pos
+    if (start == null || start == "head") pos = range.head
+    else if (start == "anchor") pos = range.anchor
+    else if (start == "end" || start == "to" || start === false) pos = range.to()
+    else pos = range.from()
+    return pos
+  },
+  listSelections: function() { return this.sel.ranges },
+  somethingSelected: function() {return this.sel.somethingSelected()},
+
+  setCursor: docMethodOp(function(line, ch, options) {
+    setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options)
+  }),
+  setSelection: docMethodOp(function(anchor, head, options) {
+    setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options)
+  }),
+  extendSelection: docMethodOp(function(head, other, options) {
+    extendSelection(this, clipPos(this, head), other && clipPos(this, other), options)
+  }),
+  extendSelections: docMethodOp(function(heads, options) {
+    extendSelections(this, clipPosArray(this, heads), options)
+  }),
+  extendSelectionsBy: docMethodOp(function(f, options) {
+    let heads = map(this.sel.ranges, f)
+    extendSelections(this, clipPosArray(this, heads), options)
+  }),
+  setSelections: docMethodOp(function(ranges, primary, options) {
+    if (!ranges.length) return
+    let out = []
+    for (let i = 0; i < ranges.length; i++)
+      out[i] = new Range(clipPos(this, ranges[i].anchor),
+                         clipPos(this, ranges[i].head || ranges[i].anchor))
+    if (primary == null) primary = Math.min(ranges.length - 1, this.sel.primIndex)
+    setSelection(this, normalizeSelection(this.cm, out, primary), options)
+  }),
+  addSelection: docMethodOp(function(anchor, head, options) {
+    let ranges = this.sel.ranges.slice(0)
+    ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)))
+    setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options)
+  }),
+
+  getSelection: function(lineSep) {
+    let ranges = this.sel.ranges, lines
+    for (let i = 0; i < ranges.length; i++) {
+      let sel = getBetween(this, ranges[i].from(), ranges[i].to())
+      lines = lines ? lines.concat(sel) : sel
+    }
+    if (lineSep === false) return lines
+    else return lines.join(lineSep || this.lineSeparator())
+  },
+  getSelections: function(lineSep) {
+    let parts = [], ranges = this.sel.ranges
+    for (let i = 0; i < ranges.length; i++) {
+      let sel = getBetween(this, ranges[i].from(), ranges[i].to())
+      if (lineSep !== false) sel = sel.join(lineSep || this.lineSeparator())
+      parts[i] = sel
+    }
+    return parts
+  },
+  replaceSelection: function(code, collapse, origin) {
+    let dup = []
+    for (let i = 0; i < this.sel.ranges.length; i++)
+      dup[i] = code
+    this.replaceSelections(dup, collapse, origin || "+input")
+  },
+  replaceSelections: docMethodOp(function(code, collapse, origin) {
+    let changes = [], sel = this.sel
+    for (let i = 0; i < sel.ranges.length; i++) {
+      let range = sel.ranges[i]
+      changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin}
+    }
+    let newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse)
+    for (let i = changes.length - 1; i >= 0; i--)
+      makeChange(this, changes[i])
+    if (newSel) setSelectionReplaceHistory(this, newSel)
+    else if (this.cm) ensureCursorVisible(this.cm)
+  }),
+  undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}),
+  redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}),
+  undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}),
+  redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}),
+
+  setExtending: function(val) {this.extend = val},
+  getExtending: function() {return this.extend},
+
+  historySize: function() {
+    let hist = this.history, done = 0, undone = 0
+    for (let i = 0; i < hist.done.length; i++) if (!hist.done[i].ranges) ++done
+    for (let i = 0; i < hist.undone.length; i++) if (!hist.undone[i].ranges) ++undone
+    return {undo: done, redo: undone}
+  },
+  clearHistory: function() {
+    this.history = new History(this.history)
+    linkedDocs(this, doc => doc.history = this.history, true)
+  },
+
+  markClean: function() {
+    this.cleanGeneration = this.changeGeneration(true)
+  },
+  changeGeneration: function(forceSplit) {
+    if (forceSplit)
+      this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null
+    return this.history.generation
+  },
+  isClean: function (gen) {
+    return this.history.generation == (gen || this.cleanGeneration)
+  },
+
+  getHistory: function() {
+    return {done: copyHistoryArray(this.history.done),
+            undone: copyHistoryArray(this.history.undone)}
+  },
+  setHistory: function(histData) {
+    let hist = this.history = new History(this.history)
+    hist.done = copyHistoryArray(histData.done.slice(0), null, true)
+    hist.undone = copyHistoryArray(histData.undone.slice(0), null, true)
+  },
+
+  setGutterMarker: docMethodOp(function(line, gutterID, value) {
+    return changeLine(this, line, "gutter", line => {
+      let markers = line.gutterMarkers || (line.gutterMarkers = {})
+      markers[gutterID] = value
+      if (!value && isEmpty(markers)) line.gutterMarkers = null
+      return true
+    })
+  }),
+
+  clearGutter: docMethodOp(function(gutterID) {
+    this.iter(line => {
+      if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
+        changeLine(this, line, "gutter", () => {
+          line.gutterMarkers[gutterID] = null
+          if (isEmpty(line.gutterMarkers)) line.gutterMarkers = null
+          return true
+        })
+      }
+    })
+  }),
+
+  lineInfo: function(line) {
+    let n
+    if (typeof line == "number") {
+      if (!isLine(this, line)) return null
+      n = line
+      line = getLine(this, line)
+      if (!line) return null
+    } else {
+      n = lineNo(line)
+      if (n == null) return null
+    }
+    return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
+            textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
+            widgets: line.widgets}
+  },
+
+  addLineClass: docMethodOp(function(handle, where, cls) {
+    return changeLine(this, handle, where == "gutter" ? "gutter" : "class", line => {
+      let prop = where == "text" ? "textClass"
+               : where == "background" ? "bgClass"
+               : where == "gutter" ? "gutterClass" : "wrapClass"
+      if (!line[prop]) line[prop] = cls
+      else if (classTest(cls).test(line[prop])) return false
+      else line[prop] += " " + cls
+      return true
+    })
+  }),
+  removeLineClass: docMethodOp(function(handle, where, cls) {
+    return changeLine(this, handle, where == "gutter" ? "gutter" : "class", line => {
+      let prop = where == "text" ? "textClass"
+               : where == "background" ? "bgClass"
+               : where == "gutter" ? "gutterClass" : "wrapClass"
+      let cur = line[prop]
+      if (!cur) return false
+      else if (cls == null) line[prop] = null
+      else {
+        let found = cur.match(classTest(cls))
+        if (!found) return false
+        let end = found.index + found[0].length
+        line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null
+      }
+      return true
+    })
+  }),
+
+  addLineWidget: docMethodOp(function(handle, node, options) {
+    return addLineWidget(this, handle, node, options)
+  }),
+  removeLineWidget: function(widget) { widget.clear() },
+
+  markText: function(from, to, options) {
+    return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
+  },
+  setBookmark: function(pos, options) {
+    let realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
+                    insertLeft: options && options.insertLeft,
+                    clearWhenEmpty: false, shared: options && options.shared,
+                    handleMouseEvents: options && options.handleMouseEvents}
+    pos = clipPos(this, pos)
+    return markText(this, pos, pos, realOpts, "bookmark")
+  },
+  findMarksAt: function(pos) {
+    pos = clipPos(this, pos)
+    let markers = [], spans = getLine(this, pos.line).markedSpans
+    if (spans) for (let i = 0; i < spans.length; ++i) {
+      let span = spans[i]
+      if ((span.from == null || span.from <= pos.ch) &&
+          (span.to == null || span.to >= pos.ch))
+        markers.push(span.marker.parent || span.marker)
+    }
+    return markers
+  },
+  findMarks: function(from, to, filter) {
+    from = clipPos(this, from); to = clipPos(this, to)
+    let found = [], lineNo = from.line
+    this.iter(from.line, to.line + 1, line => {
+      let spans = line.markedSpans
+      if (spans) for (let i = 0; i < spans.length; i++) {
+        let span = spans[i]
+        if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
+              span.from == null && lineNo != from.line ||
+              span.from != null && lineNo == to.line && span.from >= to.ch) &&
+            (!filter || filter(span.marker)))
+          found.push(span.marker.parent || span.marker)
+      }
+      ++lineNo
+    })
+    return found
+  },
+  getAllMarks: function() {
+    let markers = []
+    this.iter(line => {
+      let sps = line.markedSpans
+      if (sps) for (let i = 0; i < sps.length; ++i)
+        if (sps[i].from != null) markers.push(sps[i].marker)
+    })
+    return markers
+  },
+
+  posFromIndex: function(off) {
+    let ch, lineNo = this.first, sepSize = this.lineSeparator().length
+    this.iter(line => {
+      let sz = line.text.length + sepSize
+      if (sz > off) { ch = off; return true }
+      off -= sz
+      ++lineNo
+    })
+    return clipPos(this, Pos(lineNo, ch))
+  },
+  indexFromPos: function (coords) {
+    coords = clipPos(this, coords)
+    let index = coords.ch
+    if (coords.line < this.first || coords.ch < 0) return 0
+    let sepSize = this.lineSeparator().length
+    this.iter(this.first, coords.line, line => { // iter aborts when callback returns a truthy value
+      index += line.text.length + sepSize
+    })
+    return index
+  },
+
+  copy: function(copyHistory) {
+    let doc = new Doc(getLines(this, this.first, this.first + this.size),
+                      this.modeOption, this.first, this.lineSep, this.direction)
+    doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft
+    doc.sel = this.sel
+    doc.extend = false
+    if (copyHistory) {
+      doc.history.undoDepth = this.history.undoDepth
+      doc.setHistory(this.getHistory())
+    }
+    return doc
+  },
+
+  linkedDoc: function(options) {
+    if (!options) options = {}
+    let from = this.first, to = this.first + this.size
+    if (options.from != null && options.from > from) from = options.from
+    if (options.to != null && options.to < to) to = options.to
+    let copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction)
+    if (options.sharedHist) copy.history = this.history
+    ;(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist})
+    copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}]
+    copySharedMarkers(copy, findSharedMarkers(this))
+    return copy
+  },
+  unlinkDoc: function(other) {
+    if (other instanceof CodeMirror) other = other.doc
+    if (this.linked) for (let i = 0; i < this.linked.length; ++i) {
+      let link = this.linked[i]
+      if (link.doc != other) continue
+      this.linked.splice(i, 1)
+      other.unlinkDoc(this)
+      detachSharedMarkers(findSharedMarkers(this))
+      break
+    }
+    // If the histories were shared, split them again
+    if (other.history == this.history) {
+      let splitIds = [other.id]
+      linkedDocs(other, doc => splitIds.push(doc.id), true)
+      other.history = new History(null)
+      other.history.done = copyHistoryArray(this.history.done, splitIds)
+      other.history.undone = copyHistoryArray(this.history.undone, splitIds)
+    }
+  },
+  iterLinkedDocs: function(f) {linkedDocs(this, f)},
+
+  getMode: function() {return this.mode},
+  getEditor: function() {return this.cm},
+
+  splitLines: function(str) {
+    if (this.lineSep) return str.split(this.lineSep)
+    return splitLinesAuto(str)
+  },
+  lineSeparator: function() { return this.lineSep || "\n" },
+
+  setDirection: docMethodOp(function (dir) {
+    if (dir != "rtl") dir = "ltr"
+    if (dir == this.direction) return
+    this.direction = dir
+    this.iter(line => line.order = null)
+    if (this.cm) directionChanged(this.cm)
+  })
+})
+
+// Public alias.
+Doc.prototype.eachLine = Doc.prototype.iter
+
+export default Doc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/change_measurement.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,61 @@
+import { cmp, Pos } from "../line/pos.js"
+import { lst } from "../util/misc.js"
+
+import { normalizeSelection, Range, Selection } from "./selection.js"
+
+// Compute the position of the end of a change (its 'to' property
+// refers to the pre-change end).
+export function changeEnd(change) {
+  if (!change.text) return change.to
+  return Pos(change.from.line + change.text.length - 1,
+             lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
+}
+
+// Adjust a position to refer to the post-change position of the
+// same text, or the end of the change if the change covers it.
+function adjustForChange(pos, change) {
+  if (cmp(pos, change.from) < 0) return pos
+  if (cmp(pos, change.to) <= 0) return changeEnd(change)
+
+  let line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch
+  if (pos.line == change.to.line) ch += changeEnd(change).ch - change.to.ch
+  return Pos(line, ch)
+}
+
+export function computeSelAfterChange(doc, change) {
+  let out = []
+  for (let i = 0; i < doc.sel.ranges.length; i++) {
+    let range = doc.sel.ranges[i]
+    out.push(new Range(adjustForChange(range.anchor, change),
+                       adjustForChange(range.head, change)))
+  }
+  return normalizeSelection(doc.cm, out, doc.sel.primIndex)
+}
+
+function offsetPos(pos, old, nw) {
+  if (pos.line == old.line)
+    return Pos(nw.line, pos.ch - old.ch + nw.ch)
+  else
+    return Pos(nw.line + (pos.line - old.line), pos.ch)
+}
+
+// Used by replaceSelections to allow moving the selection to the
+// start or around the replaced test. Hint may be "start" or "around".
+export function computeReplacedSel(doc, changes, hint) {
+  let out = []
+  let oldPrev = Pos(doc.first, 0), newPrev = oldPrev
+  for (let i = 0; i < changes.length; i++) {
+    let change = changes[i]
+    let from = offsetPos(change.from, oldPrev, newPrev)
+    let to = offsetPos(changeEnd(change), oldPrev, newPrev)
+    oldPrev = change.to
+    newPrev = to
+    if (hint == "around") {
+      let range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0
+      out[i] = new Range(inv ? to : from, inv ? from : to)
+    } else {
+      out[i] = new Range(from, from)
+    }
+  }
+  return new Selection(out, doc.sel.primIndex)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/changes.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,339 @@
+import { retreatFrontier } from "../line/highlight.js"
+import { startWorker } from "../display/highlight_worker.js"
+import { operation } from "../display/operations.js"
+import { regChange, regLineChange } from "../display/view_tracking.js"
+import { clipLine, clipPos, cmp, Pos } from "../line/pos.js"
+import { sawReadOnlySpans } from "../line/saw_special_spans.js"
+import { lineLength, removeReadOnlyRanges, stretchSpansOverChange, visualLine } from "../line/spans.js"
+import { getBetween, getLine, lineNo } from "../line/utils_line.js"
+import { estimateHeight } from "../measurement/position_measurement.js"
+import { hasHandler, signal, signalCursorActivity } from "../util/event.js"
+import { indexOf, lst, map, sel_dontScroll } from "../util/misc.js"
+import { signalLater } from "../util/operation_group.js"
+
+import { changeEnd, computeSelAfterChange } from "./change_measurement.js"
+import { isWholeLineUpdate, linkedDocs, updateDoc } from "./document_data.js"
+import { addChangeToHistory, historyChangeFromChange, mergeOldSpans, pushSelectionToHistory } from "./history.js"
+import { Range, Selection } from "./selection.js"
+import { setSelection, setSelectionNoUndo, skipAtomic } from "./selection_updates.js"
+
+// UPDATING
+
+// Allow "beforeChange" event handlers to influence a change
+function filterChange(doc, change, update) {
+  let obj = {
+    canceled: false,
+    from: change.from,
+    to: change.to,
+    text: change.text,
+    origin: change.origin,
+    cancel: () => obj.canceled = true
+  }
+  if (update) obj.update = (from, to, text, origin) => {
+    if (from) obj.from = clipPos(doc, from)
+    if (to) obj.to = clipPos(doc, to)
+    if (text) obj.text = text
+    if (origin !== undefined) obj.origin = origin
+  }
+  signal(doc, "beforeChange", doc, obj)
+  if (doc.cm) signal(doc.cm, "beforeChange", doc.cm, obj)
+
+  if (obj.canceled) {
+    if (doc.cm) doc.cm.curOp.updateInput = 2
+    return null
+  }
+  return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
+}
+
+// Apply a change to a document, and add it to the document's
+// history, and propagating it to all linked documents.
+export function makeChange(doc, change, ignoreReadOnly) {
+  if (doc.cm) {
+    if (!doc.cm.curOp) return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly)
+    if (doc.cm.state.suppressEdits) return
+  }
+
+  if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
+    change = filterChange(doc, change, true)
+    if (!change) return
+  }
+
+  // Possibly split or suppress the update based on the presence
+  // of read-only spans in its range.
+  let split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)
+  if (split) {
+    for (let i = split.length - 1; i >= 0; --i)
+      makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin})
+  } else {
+    makeChangeInner(doc, change)
+  }
+}
+
+function makeChangeInner(doc, change) {
+  if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) return
+  let selAfter = computeSelAfterChange(doc, change)
+  addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN)
+
+  makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change))
+  let rebased = []
+
+  linkedDocs(doc, (doc, sharedHist) => {
+    if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+      rebaseHist(doc.history, change)
+      rebased.push(doc.history)
+    }
+    makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change))
+  })
+}
+
+// Revert a change stored in a document's history.
+export function makeChangeFromHistory(doc, type, allowSelectionOnly) {
+  let suppress = doc.cm && doc.cm.state.suppressEdits
+  if (suppress && !allowSelectionOnly) return
+
+  let hist = doc.history, event, selAfter = doc.sel
+  let source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done
+
+  // Verify that there is a useable event (so that ctrl-z won't
+  // needlessly clear selection events)
+  let i = 0
+  for (; i < source.length; i++) {
+    event = source[i]
+    if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
+      break
+  }
+  if (i == source.length) return
+  hist.lastOrigin = hist.lastSelOrigin = null
+
+  for (;;) {
+    event = source.pop()
+    if (event.ranges) {
+      pushSelectionToHistory(event, dest)
+      if (allowSelectionOnly && !event.equals(doc.sel)) {
+        setSelection(doc, event, {clearRedo: false})
+        return
+      }
+      selAfter = event
+    } else if (suppress) {
+      source.push(event)
+      return
+    } else break
+  }
+
+  // Build up a reverse change object to add to the opposite history
+  // stack (redo when undoing, and vice versa).
+  let antiChanges = []
+  pushSelectionToHistory(selAfter, dest)
+  dest.push({changes: antiChanges, generation: hist.generation})
+  hist.generation = event.generation || ++hist.maxGeneration
+
+  let filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")
+
+  for (let i = event.changes.length - 1; i >= 0; --i) {
+    let change = event.changes[i]
+    change.origin = type
+    if (filter && !filterChange(doc, change, false)) {
+      source.length = 0
+      return
+    }
+
+    antiChanges.push(historyChangeFromChange(doc, change))
+
+    let after = i ? computeSelAfterChange(doc, change) : lst(source)
+    makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change))
+    if (!i && doc.cm) doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)})
+    let rebased = []
+
+    // Propagate to the linked documents
+    linkedDocs(doc, (doc, sharedHist) => {
+      if (!sharedHist && indexOf(rebased, doc.history) == -1) {
+        rebaseHist(doc.history, change)
+        rebased.push(doc.history)
+      }
+      makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change))
+    })
+  }
+}
+
+// Sub-views need their line numbers shifted when text is added
+// above or below them in the parent document.
+function shiftDoc(doc, distance) {
+  if (distance == 0) return
+  doc.first += distance
+  doc.sel = new Selection(map(doc.sel.ranges, range => new Range(
+    Pos(range.anchor.line + distance, range.anchor.ch),
+    Pos(range.head.line + distance, range.head.ch)
+  )), doc.sel.primIndex)
+  if (doc.cm) {
+    regChange(doc.cm, doc.first, doc.first - distance, distance)
+    for (let d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
+      regLineChange(doc.cm, l, "gutter")
+  }
+}
+
+// More lower-level change function, handling only a single document
+// (not linked ones).
+function makeChangeSingleDoc(doc, change, selAfter, spans) {
+  if (doc.cm && !doc.cm.curOp)
+    return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans)
+
+  if (change.to.line < doc.first) {
+    shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))
+    return
+  }
+  if (change.from.line > doc.lastLine()) return
+
+  // Clip the change to the size of this doc
+  if (change.from.line < doc.first) {
+    let shift = change.text.length - 1 - (doc.first - change.from.line)
+    shiftDoc(doc, shift)
+    change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
+              text: [lst(change.text)], origin: change.origin}
+  }
+  let last = doc.lastLine()
+  if (change.to.line > last) {
+    change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
+              text: [change.text[0]], origin: change.origin}
+  }
+
+  change.removed = getBetween(doc, change.from, change.to)
+
+  if (!selAfter) selAfter = computeSelAfterChange(doc, change)
+  if (doc.cm) makeChangeSingleDocInEditor(doc.cm, change, spans)
+  else updateDoc(doc, change, spans)
+  setSelectionNoUndo(doc, selAfter, sel_dontScroll)
+
+  if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
+    doc.cantEdit = false
+}
+
+// Handle the interaction of a change to a document with the editor
+// that this document is part of.
+function makeChangeSingleDocInEditor(cm, change, spans) {
+  let doc = cm.doc, display = cm.display, from = change.from, to = change.to
+
+  let recomputeMaxLength = false, checkWidthStart = from.line
+  if (!cm.options.lineWrapping) {
+    checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))
+    doc.iter(checkWidthStart, to.line + 1, line => {
+      if (line == display.maxLine) {
+        recomputeMaxLength = true
+        return true
+      }
+    })
+  }
+
+  if (doc.sel.contains(change.from, change.to) > -1)
+    signalCursorActivity(cm)
+
+  updateDoc(doc, change, spans, estimateHeight(cm))
+
+  if (!cm.options.lineWrapping) {
+    doc.iter(checkWidthStart, from.line + change.text.length, line => {
+      let len = lineLength(line)
+      if (len > display.maxLineLength) {
+        display.maxLine = line
+        display.maxLineLength = len
+        display.maxLineChanged = true
+        recomputeMaxLength = false
+      }
+    })
+    if (recomputeMaxLength) cm.curOp.updateMaxLine = true
+  }
+
+  retreatFrontier(doc, from.line)
+  startWorker(cm, 400)
+
+  let lendiff = change.text.length - (to.line - from.line) - 1
+  // Remember that these lines changed, for updating the display
+  if (change.full)
+    regChange(cm)
+  else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
+    regLineChange(cm, from.line, "text")
+  else
+    regChange(cm, from.line, to.line + 1, lendiff)
+
+  let changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change")
+  if (changeHandler || changesHandler) {
+    let obj = {
+      from: from, to: to,
+      text: change.text,
+      removed: change.removed,
+      origin: change.origin
+    }
+    if (changeHandler) signalLater(cm, "change", cm, obj)
+    if (changesHandler) (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj)
+  }
+  cm.display.selForContextMenu = null
+}
+
+export function replaceRange(doc, code, from, to, origin) {
+  if (!to) to = from
+  if (cmp(to, from) < 0) [from, to] = [to, from]
+  if (typeof code == "string") code = doc.splitLines(code)
+  makeChange(doc, {from, to, text: code, origin})
+}
+
+// Rebasing/resetting history to deal with externally-sourced changes
+
+function rebaseHistSelSingle(pos, from, to, diff) {
+  if (to < pos.line) {
+    pos.line += diff
+  } else if (from < pos.line) {
+    pos.line = from
+    pos.ch = 0
+  }
+}
+
+// Tries to rebase an array of history events given a change in the
+// document. If the change touches the same lines as the event, the
+// event, and everything 'behind' it, is discarded. If the change is
+// before the event, the event's positions are updated. Uses a
+// copy-on-write scheme for the positions, to avoid having to
+// reallocate them all on every rebase, but also avoid problems with
+// shared position objects being unsafely updated.
+function rebaseHistArray(array, from, to, diff) {
+  for (let i = 0; i < array.length; ++i) {
+    let sub = array[i], ok = true
+    if (sub.ranges) {
+      if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }
+      for (let j = 0; j < sub.ranges.length; j++) {
+        rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)
+        rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)
+      }
+      continue
+    }
+    for (let j = 0; j < sub.changes.length; ++j) {
+      let cur = sub.changes[j]
+      if (to < cur.from.line) {
+        cur.from = Pos(cur.from.line + diff, cur.from.ch)
+        cur.to = Pos(cur.to.line + diff, cur.to.ch)
+      } else if (from <= cur.to.line) {
+        ok = false
+        break
+      }
+    }
+    if (!ok) {
+      array.splice(0, i + 1)
+      i = 0
+    }
+  }
+}
+
+function rebaseHist(hist, change) {
+  let from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1
+  rebaseHistArray(hist.done, from, to, diff)
+  rebaseHistArray(hist.undone, from, to, diff)
+}
+
+// Utility for applying a change to a line by handle or number,
+// returning the number and optionally registering the line as
+// changed.
+export function changeLine(doc, handle, changeType, op) {
+  let no = handle, line = handle
+  if (typeof handle == "number") line = getLine(doc, clipLine(doc, handle))
+  else no = lineNo(handle)
+  if (no == null) return null
+  if (op(line, no) && doc.cm) regLineChange(doc.cm, no, changeType)
+  return line
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/chunk.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,167 @@
+import { cleanUpLine } from "../line/line_data.js"
+import { indexOf } from "../util/misc.js"
+import { signalLater } from "../util/operation_group.js"
+
+// The document is represented as a BTree consisting of leaves, with
+// chunk of lines in them, and branches, with up to ten leaves or
+// other branch nodes below them. The top node is always a branch
+// node, and is the document object itself (meaning it has
+// additional methods and properties).
+//
+// All nodes have parent links. The tree is used both to go from
+// line numbers to line objects, and to go from objects to numbers.
+// It also indexes by height, and is used to convert between height
+// and line object, and to find the total height of the document.
+//
+// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
+
+export function LeafChunk(lines) {
+  this.lines = lines
+  this.parent = null
+  let height = 0
+  for (let i = 0; i < lines.length; ++i) {
+    lines[i].parent = this
+    height += lines[i].height
+  }
+  this.height = height
+}
+
+LeafChunk.prototype = {
+  chunkSize() { return this.lines.length },
+
+  // Remove the n lines at offset 'at'.
+  removeInner(at, n) {
+    for (let i = at, e = at + n; i < e; ++i) {
+      let line = this.lines[i]
+      this.height -= line.height
+      cleanUpLine(line)
+      signalLater(line, "delete")
+    }
+    this.lines.splice(at, n)
+  },
+
+  // Helper used to collapse a small branch into a single leaf.
+  collapse(lines) {
+    lines.push.apply(lines, this.lines)
+  },
+
+  // Insert the given array of lines at offset 'at', count them as
+  // having the given height.
+  insertInner(at, lines, height) {
+    this.height += height
+    this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at))
+    for (let i = 0; i < lines.length; ++i) lines[i].parent = this
+  },
+
+  // Used to iterate over a part of the tree.
+  iterN(at, n, op) {
+    for (let e = at + n; at < e; ++at)
+      if (op(this.lines[at])) return true
+  }
+}
+
+export function BranchChunk(children) {
+  this.children = children
+  let size = 0, height = 0
+  for (let i = 0; i < children.length; ++i) {
+    let ch = children[i]
+    size += ch.chunkSize(); height += ch.height
+    ch.parent = this
+  }
+  this.size = size
+  this.height = height
+  this.parent = null
+}
+
+BranchChunk.prototype = {
+  chunkSize() { return this.size },
+
+  removeInner(at, n) {
+    this.size -= n
+    for (let i = 0; i < this.children.length; ++i) {
+      let child = this.children[i], sz = child.chunkSize()
+      if (at < sz) {
+        let rm = Math.min(n, sz - at), oldHeight = child.height
+        child.removeInner(at, rm)
+        this.height -= oldHeight - child.height
+        if (sz == rm) { this.children.splice(i--, 1); child.parent = null }
+        if ((n -= rm) == 0) break
+        at = 0
+      } else at -= sz
+    }
+    // If the result is smaller than 25 lines, ensure that it is a
+    // single leaf node.
+    if (this.size - n < 25 &&
+        (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
+      let lines = []
+      this.collapse(lines)
+      this.children = [new LeafChunk(lines)]
+      this.children[0].parent = this
+    }
+  },
+
+  collapse(lines) {
+    for (let i = 0; i < this.children.length; ++i) this.children[i].collapse(lines)
+  },
+
+  insertInner(at, lines, height) {
+    this.size += lines.length
+    this.height += height
+    for (let i = 0; i < this.children.length; ++i) {
+      let child = this.children[i], sz = child.chunkSize()
+      if (at <= sz) {
+        child.insertInner(at, lines, height)
+        if (child.lines && child.lines.length > 50) {
+          // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
+          // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
+          let remaining = child.lines.length % 25 + 25
+          for (let pos = remaining; pos < child.lines.length;) {
+            let leaf = new LeafChunk(child.lines.slice(pos, pos += 25))
+            child.height -= leaf.height
+            this.children.splice(++i, 0, leaf)
+            leaf.parent = this
+          }
+          child.lines = child.lines.slice(0, remaining)
+          this.maybeSpill()
+        }
+        break
+      }
+      at -= sz
+    }
+  },
+
+  // When a node has grown, check whether it should be split.
+  maybeSpill() {
+    if (this.children.length <= 10) return
+    let me = this
+    do {
+      let spilled = me.children.splice(me.children.length - 5, 5)
+      let sibling = new BranchChunk(spilled)
+      if (!me.parent) { // Become the parent node
+        let copy = new BranchChunk(me.children)
+        copy.parent = me
+        me.children = [copy, sibling]
+        me = copy
+     } else {
+        me.size -= sibling.size
+        me.height -= sibling.height
+        let myIndex = indexOf(me.parent.children, me)
+        me.parent.children.splice(myIndex + 1, 0, sibling)
+      }
+      sibling.parent = me.parent
+    } while (me.children.length > 10)
+    me.parent.maybeSpill()
+  },
+
+  iterN(at, n, op) {
+    for (let i = 0; i < this.children.length; ++i) {
+      let child = this.children[i], sz = child.chunkSize()
+      if (at < sz) {
+        let used = Math.min(n, sz - at)
+        if (child.iterN(at, used, op)) return true
+        if ((n -= used) == 0) break
+        at = 0
+      } else at -= sz
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/document_data.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,112 @@
+import { loadMode } from "../display/mode_state.js"
+import { runInOp } from "../display/operations.js"
+import { regChange } from "../display/view_tracking.js"
+import { Line, updateLine } from "../line/line_data.js"
+import { findMaxLine } from "../line/spans.js"
+import { getLine } from "../line/utils_line.js"
+import { estimateLineHeights } from "../measurement/position_measurement.js"
+import { addClass, rmClass } from "../util/dom.js"
+import { lst } from "../util/misc.js"
+import { signalLater } from "../util/operation_group.js"
+
+// DOCUMENT DATA STRUCTURE
+
+// By default, updates that start and end at the beginning of a line
+// are treated specially, in order to make the association of line
+// widgets and marker elements with the text behave more intuitive.
+export function isWholeLineUpdate(doc, change) {
+  return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
+    (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
+}
+
+// Perform a change on the document data structure.
+export function updateDoc(doc, change, markedSpans, estimateHeight) {
+  function spansFor(n) {return markedSpans ? markedSpans[n] : null}
+  function update(line, text, spans) {
+    updateLine(line, text, spans, estimateHeight)
+    signalLater(line, "change", line, change)
+  }
+  function linesFor(start, end) {
+    let result = []
+    for (let i = start; i < end; ++i)
+      result.push(new Line(text[i], spansFor(i), estimateHeight))
+    return result
+  }
+
+  let from = change.from, to = change.to, text = change.text
+  let firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line)
+  let lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line
+
+  // Adjust the line structure
+  if (change.full) {
+    doc.insert(0, linesFor(0, text.length))
+    doc.remove(text.length, doc.size - text.length)
+  } else if (isWholeLineUpdate(doc, change)) {
+    // This is a whole-line replace. Treated specially to make
+    // sure line objects move the way they are supposed to.
+    let added = linesFor(0, text.length - 1)
+    update(lastLine, lastLine.text, lastSpans)
+    if (nlines) doc.remove(from.line, nlines)
+    if (added.length) doc.insert(from.line, added)
+  } else if (firstLine == lastLine) {
+    if (text.length == 1) {
+      update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)
+    } else {
+      let added = linesFor(1, text.length - 1)
+      added.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))
+      update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
+      doc.insert(from.line + 1, added)
+    }
+  } else if (text.length == 1) {
+    update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))
+    doc.remove(from.line + 1, nlines)
+  } else {
+    update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
+    update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)
+    let added = linesFor(1, text.length - 1)
+    if (nlines > 1) doc.remove(from.line + 1, nlines - 1)
+    doc.insert(from.line + 1, added)
+  }
+
+  signalLater(doc, "change", doc, change)
+}
+
+// Call f for all linked documents.
+export function linkedDocs(doc, f, sharedHistOnly) {
+  function propagate(doc, skip, sharedHist) {
+    if (doc.linked) for (let i = 0; i < doc.linked.length; ++i) {
+      let rel = doc.linked[i]
+      if (rel.doc == skip) continue
+      let shared = sharedHist && rel.sharedHist
+      if (sharedHistOnly && !shared) continue
+      f(rel.doc, shared)
+      propagate(rel.doc, doc, shared)
+    }
+  }
+  propagate(doc, null, true)
+}
+
+// Attach a document to an editor.
+export function attachDoc(cm, doc) {
+  if (doc.cm) throw new Error("This document is already in use.")
+  cm.doc = doc
+  doc.cm = cm
+  estimateLineHeights(cm)
+  loadMode(cm)
+  setDirectionClass(cm)
+  cm.options.direction = doc.direction
+  if (!cm.options.lineWrapping) findMaxLine(cm)
+  cm.options.mode = doc.modeOption
+  regChange(cm)
+}
+
+function setDirectionClass(cm) {
+  ;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")
+}
+
+export function directionChanged(cm) {
+  runInOp(cm, () => {
+    setDirectionClass(cm)
+    regChange(cm)
+  })
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/history.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,228 @@
+import { cmp, copyPos } from "../line/pos.js"
+import { stretchSpansOverChange } from "../line/spans.js"
+import { getBetween } from "../line/utils_line.js"
+import { signal } from "../util/event.js"
+import { indexOf, lst } from "../util/misc.js"
+
+import { changeEnd } from "./change_measurement.js"
+import { linkedDocs } from "./document_data.js"
+import { Selection } from "./selection.js"
+
+export function History(prev) {
+  // Arrays of change events and selections. Doing something adds an
+  // event to done and clears undo. Undoing moves events from done
+  // to undone, redoing moves them in the other direction.
+  this.done = []; this.undone = []
+  this.undoDepth = prev ? prev.undoDepth : Infinity
+  // Used to track when changes can be merged into a single undo
+  // event
+  this.lastModTime = this.lastSelTime = 0
+  this.lastOp = this.lastSelOp = null
+  this.lastOrigin = this.lastSelOrigin = null
+  // Used by the isClean() method
+  this.generation = this.maxGeneration = prev ? prev.maxGeneration : 1
+}
+
+// Create a history change event from an updateDoc-style change
+// object.
+export function historyChangeFromChange(doc, change) {
+  let histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}
+  attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)
+  linkedDocs(doc, doc => attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1), true)
+  return histChange
+}
+
+// Pop all selection events off the end of a history array. Stop at
+// a change event.
+function clearSelectionEvents(array) {
+  while (array.length) {
+    let last = lst(array)
+    if (last.ranges) array.pop()
+    else break
+  }
+}
+
+// Find the top change event in the history. Pop off selection
+// events that are in the way.
+function lastChangeEvent(hist, force) {
+  if (force) {
+    clearSelectionEvents(hist.done)
+    return lst(hist.done)
+  } else if (hist.done.length && !lst(hist.done).ranges) {
+    return lst(hist.done)
+  } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
+    hist.done.pop()
+    return lst(hist.done)
+  }
+}
+
+// Register a change in the history. Merges changes that are within
+// a single operation, or are close together with an origin that
+// allows merging (starting with "+") into a single event.
+export function addChangeToHistory(doc, change, selAfter, opId) {
+  let hist = doc.history
+  hist.undone.length = 0
+  let time = +new Date, cur
+  let last
+
+  if ((hist.lastOp == opId ||
+       hist.lastOrigin == change.origin && change.origin &&
+       ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
+        change.origin.charAt(0) == "*")) &&
+      (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
+    // Merge this change into the last event
+    last = lst(cur.changes)
+    if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
+      // Optimized case for simple insertion -- don't want to add
+      // new changesets for every character typed
+      last.to = changeEnd(change)
+    } else {
+      // Add new sub-event
+      cur.changes.push(historyChangeFromChange(doc, change))
+    }
+  } else {
+    // Can not be merged, start a new event.
+    let before = lst(hist.done)
+    if (!before || !before.ranges)
+      pushSelectionToHistory(doc.sel, hist.done)
+    cur = {changes: [historyChangeFromChange(doc, change)],
+           generation: hist.generation}
+    hist.done.push(cur)
+    while (hist.done.length > hist.undoDepth) {
+      hist.done.shift()
+      if (!hist.done[0].ranges) hist.done.shift()
+    }
+  }
+  hist.done.push(selAfter)
+  hist.generation = ++hist.maxGeneration
+  hist.lastModTime = hist.lastSelTime = time
+  hist.lastOp = hist.lastSelOp = opId
+  hist.lastOrigin = hist.lastSelOrigin = change.origin
+
+  if (!last) signal(doc, "historyAdded")
+}
+
+function selectionEventCanBeMerged(doc, origin, prev, sel) {
+  let ch = origin.charAt(0)
+  return ch == "*" ||
+    ch == "+" &&
+    prev.ranges.length == sel.ranges.length &&
+    prev.somethingSelected() == sel.somethingSelected() &&
+    new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
+}
+
+// Called whenever the selection changes, sets the new selection as
+// the pending selection in the history, and pushes the old pending
+// selection into the 'done' array when it was significantly
+// different (in number of selected ranges, emptiness, or time).
+export function addSelectionToHistory(doc, sel, opId, options) {
+  let hist = doc.history, origin = options && options.origin
+
+  // A new event is started when the previous origin does not match
+  // the current, or the origins don't allow matching. Origins
+  // starting with * are always merged, those starting with + are
+  // merged when similar and close together in time.
+  if (opId == hist.lastSelOp ||
+      (origin && hist.lastSelOrigin == origin &&
+       (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
+        selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
+    hist.done[hist.done.length - 1] = sel
+  else
+    pushSelectionToHistory(sel, hist.done)
+
+  hist.lastSelTime = +new Date
+  hist.lastSelOrigin = origin
+  hist.lastSelOp = opId
+  if (options && options.clearRedo !== false)
+    clearSelectionEvents(hist.undone)
+}
+
+export function pushSelectionToHistory(sel, dest) {
+  let top = lst(dest)
+  if (!(top && top.ranges && top.equals(sel)))
+    dest.push(sel)
+}
+
+// Used to store marked span information in the history.
+function attachLocalSpans(doc, change, from, to) {
+  let existing = change["spans_" + doc.id], n = 0
+  doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), line => {
+    if (line.markedSpans)
+      (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans
+    ++n
+  })
+}
+
+// When un/re-doing restores text containing marked spans, those
+// that have been explicitly cleared should not be restored.
+function removeClearedSpans(spans) {
+  if (!spans) return null
+  let out
+  for (let i = 0; i < spans.length; ++i) {
+    if (spans[i].marker.explicitlyCleared) { if (!out) out = spans.slice(0, i) }
+    else if (out) out.push(spans[i])
+  }
+  return !out ? spans : out.length ? out : null
+}
+
+// Retrieve and filter the old marked spans stored in a change event.
+function getOldSpans(doc, change) {
+  let found = change["spans_" + doc.id]
+  if (!found) return null
+  let nw = []
+  for (let i = 0; i < change.text.length; ++i)
+    nw.push(removeClearedSpans(found[i]))
+  return nw
+}
+
+// Used for un/re-doing changes from the history. Combines the
+// result of computing the existing spans with the set of spans that
+// existed in the history (so that deleting around a span and then
+// undoing brings back the span).
+export function mergeOldSpans(doc, change) {
+  let old = getOldSpans(doc, change)
+  let stretched = stretchSpansOverChange(doc, change)
+  if (!old) return stretched
+  if (!stretched) return old
+
+  for (let i = 0; i < old.length; ++i) {
+    let oldCur = old[i], stretchCur = stretched[i]
+    if (oldCur && stretchCur) {
+      spans: for (let j = 0; j < stretchCur.length; ++j) {
+        let span = stretchCur[j]
+        for (let k = 0; k < oldCur.length; ++k)
+          if (oldCur[k].marker == span.marker) continue spans
+        oldCur.push(span)
+      }
+    } else if (stretchCur) {
+      old[i] = stretchCur
+    }
+  }
+  return old
+}
+
+// Used both to provide a JSON-safe object in .getHistory, and, when
+// detaching a document, to split the history in two
+export function copyHistoryArray(events, newGroup, instantiateSel) {
+  let copy = []
+  for (let i = 0; i < events.length; ++i) {
+    let event = events[i]
+    if (event.ranges) {
+      copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event)
+      continue
+    }
+    let changes = event.changes, newChanges = []
+    copy.push({changes: newChanges})
+    for (let j = 0; j < changes.length; ++j) {
+      let change = changes[j], m
+      newChanges.push({from: change.from, to: change.to, text: change.text})
+      if (newGroup) for (var prop in change) if (m = prop.match(/^spans_(\d+)$/)) {
+        if (indexOf(newGroup, Number(m[1])) > -1) {
+          lst(newChanges)[prop] = change[prop]
+          delete change[prop]
+        }
+      }
+    }
+  }
+  return copy
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/line_widget.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,78 @@
+import { runInOp } from "../display/operations.js"
+import { addToScrollTop } from "../display/scrolling.js"
+import { regLineChange } from "../display/view_tracking.js"
+import { heightAtLine, lineIsHidden } from "../line/spans.js"
+import { lineNo, updateLineHeight } from "../line/utils_line.js"
+import { widgetHeight } from "../measurement/widgets.js"
+import { changeLine } from "./changes.js"
+import { eventMixin } from "../util/event.js"
+import { signalLater } from "../util/operation_group.js"
+
+// Line widgets are block elements displayed above or below a line.
+
+export class LineWidget {
+  constructor(doc, node, options) {
+    if (options) for (let opt in options) if (options.hasOwnProperty(opt))
+      this[opt] = options[opt]
+    this.doc = doc
+    this.node = node
+  }
+
+  clear() {
+    let cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line)
+    if (no == null || !ws) return
+    for (let i = 0; i < ws.length; ++i) if (ws[i] == this) ws.splice(i--, 1)
+    if (!ws.length) line.widgets = null
+    let height = widgetHeight(this)
+    updateLineHeight(line, Math.max(0, line.height - height))
+    if (cm) {
+      runInOp(cm, () => {
+        adjustScrollWhenAboveVisible(cm, line, -height)
+        regLineChange(cm, no, "widget")
+      })
+      signalLater(cm, "lineWidgetCleared", cm, this, no)
+    }
+  }
+
+  changed() {
+    let oldH = this.height, cm = this.doc.cm, line = this.line
+    this.height = null
+    let diff = widgetHeight(this) - oldH
+    if (!diff) return
+    if (!lineIsHidden(this.doc, line)) updateLineHeight(line, line.height + diff)
+    if (cm) {
+      runInOp(cm, () => {
+        cm.curOp.forceUpdate = true
+        adjustScrollWhenAboveVisible(cm, line, diff)
+        signalLater(cm, "lineWidgetChanged", cm, this, lineNo(line))
+      })
+    }
+  }
+}
+eventMixin(LineWidget)
+
+function adjustScrollWhenAboveVisible(cm, line, diff) {
+  if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
+    addToScrollTop(cm, diff)
+}
+
+export function addLineWidget(doc, handle, node, options) {
+  let widget = new LineWidget(doc, node, options)
+  let cm = doc.cm
+  if (cm && widget.noHScroll) cm.display.alignWidgets = true
+  changeLine(doc, handle, "widget", line => {
+    let widgets = line.widgets || (line.widgets = [])
+    if (widget.insertAt == null) widgets.push(widget)
+    else widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget)
+    widget.line = line
+    if (cm && !lineIsHidden(doc, line)) {
+      let aboveVisible = heightAtLine(line) < doc.scrollTop
+      updateLineHeight(line, line.height + widgetHeight(widget))
+      if (aboveVisible) addToScrollTop(cm, widget.height)
+      cm.curOp.forceUpdate = true
+    }
+    return true
+  })
+  if (cm) signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle))
+  return widget
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/mark_text.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,293 @@
+import { eltP } from "../util/dom.js"
+import { eventMixin, hasHandler, on } from "../util/event.js"
+import { endOperation, operation, runInOp, startOperation } from "../display/operations.js"
+import { clipPos, cmp, Pos } from "../line/pos.js"
+import { lineNo, updateLineHeight } from "../line/utils_line.js"
+import { clearLineMeasurementCacheFor, findViewForLine, textHeight } from "../measurement/position_measurement.js"
+import { seeReadOnlySpans, seeCollapsedSpans } from "../line/saw_special_spans.js"
+import { addMarkedSpan, conflictingCollapsedRange, getMarkedSpanFor, lineIsHidden, lineLength, MarkedSpan, removeMarkedSpan, visualLine } from "../line/spans.js"
+import { copyObj, indexOf, lst } from "../util/misc.js"
+import { signalLater } from "../util/operation_group.js"
+import { widgetHeight } from "../measurement/widgets.js"
+import { regChange, regLineChange } from "../display/view_tracking.js"
+
+import { linkedDocs } from "./document_data.js"
+import { addChangeToHistory } from "./history.js"
+import { reCheckSelection } from "./selection_updates.js"
+
+// TEXTMARKERS
+
+// Created with markText and setBookmark methods. A TextMarker is a
+// handle that can be used to clear or find a marked position in the
+// document. Line objects hold arrays (markedSpans) containing
+// {from, to, marker} object pointing to such marker objects, and
+// indicating that such a marker is present on that line. Multiple
+// lines may point to the same marker when it spans across lines.
+// The spans will have null for their from/to properties when the
+// marker continues beyond the start/end of the line. Markers have
+// links back to the lines they currently touch.
+
+// Collapsed markers have unique ids, in order to be able to order
+// them, which is needed for uniquely determining an outer marker
+// when they overlap (they may nest, but not partially overlap).
+let nextMarkerId = 0
+
+export class TextMarker {
+  constructor(doc, type) {
+    this.lines = []
+    this.type = type
+    this.doc = doc
+    this.id = ++nextMarkerId
+  }
+
+  // Clear the marker.
+  clear() {
+    if (this.explicitlyCleared) return
+    let cm = this.doc.cm, withOp = cm && !cm.curOp
+    if (withOp) startOperation(cm)
+    if (hasHandler(this, "clear")) {
+      let found = this.find()
+      if (found) signalLater(this, "clear", found.from, found.to)
+    }
+    let min = null, max = null
+    for (let i = 0; i < this.lines.length; ++i) {
+      let line = this.lines[i]
+      let span = getMarkedSpanFor(line.markedSpans, this)
+      if (cm && !this.collapsed) regLineChange(cm, lineNo(line), "text")
+      else if (cm) {
+        if (span.to != null) max = lineNo(line)
+        if (span.from != null) min = lineNo(line)
+      }
+      line.markedSpans = removeMarkedSpan(line.markedSpans, span)
+      if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
+        updateLineHeight(line, textHeight(cm.display))
+    }
+    if (cm && this.collapsed && !cm.options.lineWrapping) for (let i = 0; i < this.lines.length; ++i) {
+      let visual = visualLine(this.lines[i]), len = lineLength(visual)
+      if (len > cm.display.maxLineLength) {
+        cm.display.maxLine = visual
+        cm.display.maxLineLength = len
+        cm.display.maxLineChanged = true
+      }
+    }
+
+    if (min != null && cm && this.collapsed) regChange(cm, min, max + 1)
+    this.lines.length = 0
+    this.explicitlyCleared = true
+    if (this.atomic && this.doc.cantEdit) {
+      this.doc.cantEdit = false
+      if (cm) reCheckSelection(cm.doc)
+    }
+    if (cm) signalLater(cm, "markerCleared", cm, this, min, max)
+    if (withOp) endOperation(cm)
+    if (this.parent) this.parent.clear()
+  }
+
+  // Find the position of the marker in the document. Returns a {from,
+  // to} object by default. Side can be passed to get a specific side
+  // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
+  // Pos objects returned contain a line object, rather than a line
+  // number (used to prevent looking up the same line twice).
+  find(side, lineObj) {
+    if (side == null && this.type == "bookmark") side = 1
+    let from, to
+    for (let i = 0; i < this.lines.length; ++i) {
+      let line = this.lines[i]
+      let span = getMarkedSpanFor(line.markedSpans, this)
+      if (span.from != null) {
+        from = Pos(lineObj ? line : lineNo(line), span.from)
+        if (side == -1) return from
+      }
+      if (span.to != null) {
+        to = Pos(lineObj ? line : lineNo(line), span.to)
+        if (side == 1) return to
+      }
+    }
+    return from && {from: from, to: to}
+  }
+
+  // Signals that the marker's widget changed, and surrounding layout
+  // should be recomputed.
+  changed() {
+    let pos = this.find(-1, true), widget = this, cm = this.doc.cm
+    if (!pos || !cm) return
+    runInOp(cm, () => {
+      let line = pos.line, lineN = lineNo(pos.line)
+      let view = findViewForLine(cm, lineN)
+      if (view) {
+        clearLineMeasurementCacheFor(view)
+        cm.curOp.selectionChanged = cm.curOp.forceUpdate = true
+      }
+      cm.curOp.updateMaxLine = true
+      if (!lineIsHidden(widget.doc, line) && widget.height != null) {
+        let oldHeight = widget.height
+        widget.height = null
+        let dHeight = widgetHeight(widget) - oldHeight
+        if (dHeight)
+          updateLineHeight(line, line.height + dHeight)
+      }
+      signalLater(cm, "markerChanged", cm, this)
+    })
+  }
+
+  attachLine(line) {
+    if (!this.lines.length && this.doc.cm) {
+      let op = this.doc.cm.curOp
+      if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
+        (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this)
+    }
+    this.lines.push(line)
+  }
+
+  detachLine(line) {
+    this.lines.splice(indexOf(this.lines, line), 1)
+    if (!this.lines.length && this.doc.cm) {
+      let op = this.doc.cm.curOp
+      ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this)
+    }
+  }
+}
+eventMixin(TextMarker)
+
+// Create a marker, wire it up to the right lines, and
+export function markText(doc, from, to, options, type) {
+  // Shared markers (across linked documents) are handled separately
+  // (markTextShared will call out to this again, once per
+  // document).
+  if (options && options.shared) return markTextShared(doc, from, to, options, type)
+  // Ensure we are in an operation.
+  if (doc.cm && !doc.cm.curOp) return operation(doc.cm, markText)(doc, from, to, options, type)
+
+  let marker = new TextMarker(doc, type), diff = cmp(from, to)
+  if (options) copyObj(options, marker, false)
+  // Don't connect empty markers unless clearWhenEmpty is false
+  if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
+    return marker
+  if (marker.replacedWith) {
+    // Showing up as a widget implies collapsed (widget replaces text)
+    marker.collapsed = true
+    marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget")
+    if (!options.handleMouseEvents) marker.widgetNode.setAttribute("cm-ignore-events", "true")
+    if (options.insertLeft) marker.widgetNode.insertLeft = true
+  }
+  if (marker.collapsed) {
+    if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
+        from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
+      throw new Error("Inserting collapsed marker partially overlapping an existing one")
+    seeCollapsedSpans()
+  }
+
+  if (marker.addToHistory)
+    addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN)
+
+  let curLine = from.line, cm = doc.cm, updateMaxLine
+  doc.iter(curLine, to.line + 1, line => {
+    if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
+      updateMaxLine = true
+    if (marker.collapsed && curLine != from.line) updateLineHeight(line, 0)
+    addMarkedSpan(line, new MarkedSpan(marker,
+                                       curLine == from.line ? from.ch : null,
+                                       curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp)
+    ++curLine
+  })
+  // lineIsHidden depends on the presence of the spans, so needs a second pass
+  if (marker.collapsed) doc.iter(from.line, to.line + 1, line => {
+    if (lineIsHidden(doc, line)) updateLineHeight(line, 0)
+  })
+
+  if (marker.clearOnEnter) on(marker, "beforeCursorEnter", () => marker.clear())
+
+  if (marker.readOnly) {
+    seeReadOnlySpans()
+    if (doc.history.done.length || doc.history.undone.length)
+      doc.clearHistory()
+  }
+  if (marker.collapsed) {
+    marker.id = ++nextMarkerId
+    marker.atomic = true
+  }
+  if (cm) {
+    // Sync editor state
+    if (updateMaxLine) cm.curOp.updateMaxLine = true
+    if (marker.collapsed)
+      regChange(cm, from.line, to.line + 1)
+    else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
+             marker.attributes || marker.title)
+      for (let i = from.line; i <= to.line; i++) regLineChange(cm, i, "text")
+    if (marker.atomic) reCheckSelection(cm.doc)
+    signalLater(cm, "markerAdded", cm, marker)
+  }
+  return marker
+}
+
+// SHARED TEXTMARKERS
+
+// A shared marker spans multiple linked documents. It is
+// implemented as a meta-marker-object controlling multiple normal
+// markers.
+export class SharedTextMarker {
+  constructor(markers, primary) {
+    this.markers = markers
+    this.primary = primary
+    for (let i = 0; i < markers.length; ++i)
+      markers[i].parent = this
+  }
+
+  clear() {
+    if (this.explicitlyCleared) return
+    this.explicitlyCleared = true
+    for (let i = 0; i < this.markers.length; ++i)
+      this.markers[i].clear()
+    signalLater(this, "clear")
+  }
+
+  find(side, lineObj) {
+    return this.primary.find(side, lineObj)
+  }
+}
+eventMixin(SharedTextMarker)
+
+function markTextShared(doc, from, to, options, type) {
+  options = copyObj(options)
+  options.shared = false
+  let markers = [markText(doc, from, to, options, type)], primary = markers[0]
+  let widget = options.widgetNode
+  linkedDocs(doc, doc => {
+    if (widget) options.widgetNode = widget.cloneNode(true)
+    markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type))
+    for (let i = 0; i < doc.linked.length; ++i)
+      if (doc.linked[i].isParent) return
+    primary = lst(markers)
+  })
+  return new SharedTextMarker(markers, primary)
+}
+
+export function findSharedMarkers(doc) {
+  return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), m => m.parent)
+}
+
+export function copySharedMarkers(doc, markers) {
+  for (let i = 0; i < markers.length; i++) {
+    let marker = markers[i], pos = marker.find()
+    let mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to)
+    if (cmp(mFrom, mTo)) {
+      let subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type)
+      marker.markers.push(subMark)
+      subMark.parent = marker
+    }
+  }
+}
+
+export function detachSharedMarkers(markers) {
+  for (let i = 0; i < markers.length; i++) {
+    let marker = markers[i], linked = [marker.primary.doc]
+    linkedDocs(marker.primary.doc, d => linked.push(d))
+    for (let j = 0; j < marker.markers.length; j++) {
+      let subMarker = marker.markers[j]
+      if (indexOf(linked, subMarker.doc) == -1) {
+        subMarker.parent = null
+        marker.markers.splice(j--, 1)
+      }
+    }
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/selection.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,84 @@
+import { cmp, copyPos, equalCursorPos, maxPos, minPos } from "../line/pos.js"
+import { indexOf } from "../util/misc.js"
+
+// Selection objects are immutable. A new one is created every time
+// the selection changes. A selection is one or more non-overlapping
+// (and non-touching) ranges, sorted, and an integer that indicates
+// which one is the primary selection (the one that's scrolled into
+// view, that getCursor returns, etc).
+export class Selection {
+  constructor(ranges, primIndex) {
+    this.ranges = ranges
+    this.primIndex = primIndex
+  }
+
+  primary() { return this.ranges[this.primIndex] }
+
+  equals(other) {
+    if (other == this) return true
+    if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) return false
+    for (let i = 0; i < this.ranges.length; i++) {
+      let here = this.ranges[i], there = other.ranges[i]
+      if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) return false
+    }
+    return true
+  }
+
+  deepCopy() {
+    let out = []
+    for (let i = 0; i < this.ranges.length; i++)
+      out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head))
+    return new Selection(out, this.primIndex)
+  }
+
+  somethingSelected() {
+    for (let i = 0; i < this.ranges.length; i++)
+      if (!this.ranges[i].empty()) return true
+    return false
+  }
+
+  contains(pos, end) {
+    if (!end) end = pos
+    for (let i = 0; i < this.ranges.length; i++) {
+      let range = this.ranges[i]
+      if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
+        return i
+    }
+    return -1
+  }
+}
+
+export class Range {
+  constructor(anchor, head) {
+    this.anchor = anchor; this.head = head
+  }
+
+  from() { return minPos(this.anchor, this.head) }
+  to() { return maxPos(this.anchor, this.head) }
+  empty() { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch }
+}
+
+// Take an unsorted, potentially overlapping set of ranges, and
+// build a selection out of it. 'Consumes' ranges array (modifying
+// it).
+export function normalizeSelection(cm, ranges, primIndex) {
+  let mayTouch = cm && cm.options.selectionsMayTouch
+  let prim = ranges[primIndex]
+  ranges.sort((a, b) => cmp(a.from(), b.from()))
+  primIndex = indexOf(ranges, prim)
+  for (let i = 1; i < ranges.length; i++) {
+    let cur = ranges[i], prev = ranges[i - 1]
+    let diff = cmp(prev.to(), cur.from())
+    if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
+      let from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
+      let inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
+      if (i <= primIndex) --primIndex
+      ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
+    }
+  }
+  return new Selection(ranges, primIndex)
+}
+
+export function simpleSelection(anchor, head) {
+  return new Selection([new Range(anchor, head || anchor)], 0)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/model/selection_updates.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,216 @@
+import { signalLater } from "../util/operation_group.js"
+import { ensureCursorVisible } from "../display/scrolling.js"
+import { clipPos, cmp, Pos } from "../line/pos.js"
+import { getLine } from "../line/utils_line.js"
+import { hasHandler, signal, signalCursorActivity } from "../util/event.js"
+import { lst, sel_dontScroll } from "../util/misc.js"
+
+import { addSelectionToHistory } from "./history.js"
+import { normalizeSelection, Range, Selection, simpleSelection } from "./selection.js"
+
+// The 'scroll' parameter given to many of these indicated whether
+// the new cursor position should be scrolled into view after
+// modifying the selection.
+
+// If shift is held or the extend flag is set, extends a range to
+// include a given position (and optionally a second position).
+// Otherwise, simply returns the range between the given positions.
+// Used for cursor motion and such.
+export function extendRange(range, head, other, extend) {
+  if (extend) {
+    let anchor = range.anchor
+    if (other) {
+      let posBefore = cmp(head, anchor) < 0
+      if (posBefore != (cmp(other, anchor) < 0)) {
+        anchor = head
+        head = other
+      } else if (posBefore != (cmp(head, other) < 0)) {
+        head = other
+      }
+    }
+    return new Range(anchor, head)
+  } else {
+    return new Range(other || head, head)
+  }
+}
+
+// Extend the primary selection range, discard the rest.
+export function extendSelection(doc, head, other, options, extend) {
+  if (extend == null) extend = doc.cm && (doc.cm.display.shift || doc.extend)
+  setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options)
+}
+
+// Extend all selections (pos is an array of selections with length
+// equal the number of selections)
+export function extendSelections(doc, heads, options) {
+  let out = []
+  let extend = doc.cm && (doc.cm.display.shift || doc.extend)
+  for (let i = 0; i < doc.sel.ranges.length; i++)
+    out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend)
+  let newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex)
+  setSelection(doc, newSel, options)
+}
+
+// Updates a single range in the selection.
+export function replaceOneSelection(doc, i, range, options) {
+  let ranges = doc.sel.ranges.slice(0)
+  ranges[i] = range
+  setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options)
+}
+
+// Reset the selection to a single range.
+export function setSimpleSelection(doc, anchor, head, options) {
+  setSelection(doc, simpleSelection(anchor, head), options)
+}
+
+// Give beforeSelectionChange handlers a change to influence a
+// selection update.
+function filterSelectionChange(doc, sel, options) {
+  let obj = {
+    ranges: sel.ranges,
+    update: function(ranges) {
+      this.ranges = []
+      for (let i = 0; i < ranges.length; i++)
+        this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
+                                   clipPos(doc, ranges[i].head))
+    },
+    origin: options && options.origin
+  }
+  signal(doc, "beforeSelectionChange", doc, obj)
+  if (doc.cm) signal(doc.cm, "beforeSelectionChange", doc.cm, obj)
+  if (obj.ranges != sel.ranges) return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1)
+  else return sel
+}
+
+export function setSelectionReplaceHistory(doc, sel, options) {
+  let done = doc.history.done, last = lst(done)
+  if (last && last.ranges) {
+    done[done.length - 1] = sel
+    setSelectionNoUndo(doc, sel, options)
+  } else {
+    setSelection(doc, sel, options)
+  }
+}
+
+// Set a new selection.
+export function setSelection(doc, sel, options) {
+  setSelectionNoUndo(doc, sel, options)
+  addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
+}
+
+export function setSelectionNoUndo(doc, sel, options) {
+  if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
+    sel = filterSelectionChange(doc, sel, options)
+
+  let bias = options && options.bias ||
+    (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
+  setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
+
+  if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption("readOnly") != "nocursor")
+    ensureCursorVisible(doc.cm)
+}
+
+function setSelectionInner(doc, sel) {
+  if (sel.equals(doc.sel)) return
+
+  doc.sel = sel
+
+  if (doc.cm) {
+    doc.cm.curOp.updateInput = 1
+    doc.cm.curOp.selectionChanged = true
+    signalCursorActivity(doc.cm)
+  }
+  signalLater(doc, "cursorActivity", doc)
+}
+
+// Verify that the selection does not partially select any atomic
+// marked ranges.
+export function reCheckSelection(doc) {
+  setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false))
+}
+
+// Return a selection that does not partially select any atomic
+// ranges.
+function skipAtomicInSelection(doc, sel, bias, mayClear) {
+  let out
+  for (let i = 0; i < sel.ranges.length; i++) {
+    let range = sel.ranges[i]
+    let old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
+    let newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
+    let newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear)
+    if (out || newAnchor != range.anchor || newHead != range.head) {
+      if (!out) out = sel.ranges.slice(0, i)
+      out[i] = new Range(newAnchor, newHead)
+    }
+  }
+  return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
+}
+
+function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
+  let line = getLine(doc, pos.line)
+  if (line.markedSpans) for (let i = 0; i < line.markedSpans.length; ++i) {
+    let sp = line.markedSpans[i], m = sp.marker
+
+    // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
+    // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
+    // is with selectLeft/Right
+    let preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft
+    let preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight
+
+    if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
+        (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
+      if (mayClear) {
+        signal(m, "beforeCursorEnter")
+        if (m.explicitlyCleared) {
+          if (!line.markedSpans) break
+          else {--i; continue}
+        }
+      }
+      if (!m.atomic) continue
+
+      if (oldPos) {
+        let near = m.find(dir < 0 ? 1 : -1), diff
+        if (dir < 0 ? preventCursorRight : preventCursorLeft)
+          near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null)
+        if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
+          return skipAtomicInner(doc, near, pos, dir, mayClear)
+      }
+
+      let far = m.find(dir < 0 ? -1 : 1)
+      if (dir < 0 ? preventCursorLeft : preventCursorRight)
+        far = movePos(doc, far, dir, far.line == pos.line ? line : null)
+      return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
+    }
+  }
+  return pos
+}
+
+// Ensure a given position is not inside an atomic range.
+export function skipAtomic(doc, pos, oldPos, bias, mayClear) {
+  let dir = bias || 1
+  let found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
+      (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
+      skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
+      (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
+  if (!found) {
+    doc.cantEdit = true
+    return Pos(doc.first, 0)
+  }
+  return found
+}
+
+function movePos(doc, pos, dir, line) {
+  if (dir < 0 && pos.ch == 0) {
+    if (pos.line > doc.first) return clipPos(doc, Pos(pos.line - 1))
+    else return null
+  } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
+    if (pos.line < doc.first + doc.size - 1) return Pos(pos.line + 1, 0)
+    else return null
+  } else {
+    return new Pos(pos.line, pos.ch + dir)
+  }
+}
+
+export function selectAll(cm) {
+  cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/modes.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,96 @@
+import { copyObj, createObj } from "./util/misc.js"
+
+// Known modes, by name and by MIME
+export let modes = {}, mimeModes = {}
+
+// Extra arguments are stored as the mode's dependencies, which is
+// used by (legacy) mechanisms like loadmode.js to automatically
+// load a mode. (Preferred mechanism is the require/define calls.)
+export function defineMode(name, mode) {
+  if (arguments.length > 2)
+    mode.dependencies = Array.prototype.slice.call(arguments, 2)
+  modes[name] = mode
+}
+
+export function defineMIME(mime, spec) {
+  mimeModes[mime] = spec
+}
+
+// Given a MIME type, a {name, ...options} config object, or a name
+// string, return a mode config object.
+export function resolveMode(spec) {
+  if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
+    spec = mimeModes[spec]
+  } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
+    let found = mimeModes[spec.name]
+    if (typeof found == "string") found = {name: found}
+    spec = createObj(found, spec)
+    spec.name = found.name
+  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
+    return resolveMode("application/xml")
+  } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
+    return resolveMode("application/json")
+  }
+  if (typeof spec == "string") return {name: spec}
+  else return spec || {name: "null"}
+}
+
+// Given a mode spec (anything that resolveMode accepts), find and
+// initialize an actual mode object.
+export function getMode(options, spec) {
+  spec = resolveMode(spec)
+  let mfactory = modes[spec.name]
+  if (!mfactory) return getMode(options, "text/plain")
+  let modeObj = mfactory(options, spec)
+  if (modeExtensions.hasOwnProperty(spec.name)) {
+    let exts = modeExtensions[spec.name]
+    for (let prop in exts) {
+      if (!exts.hasOwnProperty(prop)) continue
+      if (modeObj.hasOwnProperty(prop)) modeObj["_" + prop] = modeObj[prop]
+      modeObj[prop] = exts[prop]
+    }
+  }
+  modeObj.name = spec.name
+  if (spec.helperType) modeObj.helperType = spec.helperType
+  if (spec.modeProps) for (let prop in spec.modeProps)
+    modeObj[prop] = spec.modeProps[prop]
+
+  return modeObj
+}
+
+// This can be used to attach properties to mode objects from
+// outside the actual mode definition.
+export let modeExtensions = {}
+export function extendMode(mode, properties) {
+  let exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
+  copyObj(properties, exts)
+}
+
+export function copyState(mode, state) {
+  if (state === true) return state
+  if (mode.copyState) return mode.copyState(state)
+  let nstate = {}
+  for (let n in state) {
+    let val = state[n]
+    if (val instanceof Array) val = val.concat([])
+    nstate[n] = val
+  }
+  return nstate
+}
+
+// Given a mode and a state (for that mode), find the inner mode and
+// state at the position that the state refers to.
+export function innerMode(mode, state) {
+  let info
+  while (mode.innerMode) {
+    info = mode.innerMode(state)
+    if (!info || info.mode == mode) break
+    state = info.state
+    mode = info.mode
+  }
+  return info || {mode: mode, state: state}
+}
+
+export function startState(mode, a1, a2) {
+  return mode.startState ? mode.startState(a1, a2) : true
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/StringStream.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,90 @@
+import { countColumn } from "./misc.js"
+
+// STRING STREAM
+
+// Fed to the mode parsers, provides helper functions to make
+// parsers more succinct.
+
+class StringStream {
+  constructor(string, tabSize, lineOracle) {
+    this.pos = this.start = 0
+    this.string = string
+    this.tabSize = tabSize || 8
+    this.lastColumnPos = this.lastColumnValue = 0
+    this.lineStart = 0
+    this.lineOracle = lineOracle
+  }
+
+  eol() {return this.pos >= this.string.length}
+  sol() {return this.pos == this.lineStart}
+  peek() {return this.string.charAt(this.pos) || undefined}
+  next() {
+    if (this.pos < this.string.length)
+      return this.string.charAt(this.pos++)
+  }
+  eat(match) {
+    let ch = this.string.charAt(this.pos)
+    let ok
+    if (typeof match == "string") ok = ch == match
+    else ok = ch && (match.test ? match.test(ch) : match(ch))
+    if (ok) {++this.pos; return ch}
+  }
+  eatWhile(match) {
+    let start = this.pos
+    while (this.eat(match)){}
+    return this.pos > start
+  }
+  eatSpace() {
+    let start = this.pos
+    while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos
+    return this.pos > start
+  }
+  skipToEnd() {this.pos = this.string.length}
+  skipTo(ch) {
+    let found = this.string.indexOf(ch, this.pos)
+    if (found > -1) {this.pos = found; return true}
+  }
+  backUp(n) {this.pos -= n}
+  column() {
+    if (this.lastColumnPos < this.start) {
+      this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
+      this.lastColumnPos = this.start
+    }
+    return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+  }
+  indentation() {
+    return countColumn(this.string, null, this.tabSize) -
+      (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
+  }
+  match(pattern, consume, caseInsensitive) {
+    if (typeof pattern == "string") {
+      let cased = str => caseInsensitive ? str.toLowerCase() : str
+      let substr = this.string.substr(this.pos, pattern.length)
+      if (cased(substr) == cased(pattern)) {
+        if (consume !== false) this.pos += pattern.length
+        return true
+      }
+    } else {
+      let match = this.string.slice(this.pos).match(pattern)
+      if (match && match.index > 0) return null
+      if (match && consume !== false) this.pos += match[0].length
+      return match
+    }
+  }
+  current(){return this.string.slice(this.start, this.pos)}
+  hideFirstChars(n, inner) {
+    this.lineStart += n
+    try { return inner() }
+    finally { this.lineStart -= n }
+  }
+  lookAhead(n) {
+    let oracle = this.lineOracle
+    return oracle && oracle.lookAhead(n)
+  }
+  baseToken() {
+    let oracle = this.lineOracle
+    return oracle && oracle.baseToken(this.pos)
+  }
+}
+
+export default StringStream
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/bidi.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,215 @@
+import { lst } from "./misc.js"
+
+// BIDI HELPERS
+
+export function iterateBidiSections(order, from, to, f) {
+  if (!order) return f(from, to, "ltr", 0)
+  let found = false
+  for (let i = 0; i < order.length; ++i) {
+    let part = order[i]
+    if (part.from < to && part.to > from || from == to && part.to == from) {
+      f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i)
+      found = true
+    }
+  }
+  if (!found) f(from, to, "ltr")
+}
+
+export let bidiOther = null
+export function getBidiPartAt(order, ch, sticky) {
+  let found
+  bidiOther = null
+  for (let i = 0; i < order.length; ++i) {
+    let cur = order[i]
+    if (cur.from < ch && cur.to > ch) return i
+    if (cur.to == ch) {
+      if (cur.from != cur.to && sticky == "before") found = i
+      else bidiOther = i
+    }
+    if (cur.from == ch) {
+      if (cur.from != cur.to && sticky != "before") found = i
+      else bidiOther = i
+    }
+  }
+  return found != null ? found : bidiOther
+}
+
+// Bidirectional ordering algorithm
+// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
+// that this (partially) implements.
+
+// One-char codes used for character types:
+// L (L):   Left-to-Right
+// R (R):   Right-to-Left
+// r (AL):  Right-to-Left Arabic
+// 1 (EN):  European Number
+// + (ES):  European Number Separator
+// % (ET):  European Number Terminator
+// n (AN):  Arabic Number
+// , (CS):  Common Number Separator
+// m (NSM): Non-Spacing Mark
+// b (BN):  Boundary Neutral
+// s (B):   Paragraph Separator
+// t (S):   Segment Separator
+// w (WS):  Whitespace
+// N (ON):  Other Neutrals
+
+// Returns null if characters are ordered as they appear
+// (left-to-right), or an array of sections ({from, to, level}
+// objects) in the order in which they occur visually.
+let bidiOrdering = (function() {
+  // Character types for codepoints 0 to 0xff
+  let lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
+  // Character types for codepoints 0x600 to 0x6f9
+  let arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"
+  function charType(code) {
+    if (code <= 0xf7) return lowTypes.charAt(code)
+    else if (0x590 <= code && code <= 0x5f4) return "R"
+    else if (0x600 <= code && code <= 0x6f9) return arabicTypes.charAt(code - 0x600)
+    else if (0x6ee <= code && code <= 0x8ac) return "r"
+    else if (0x2000 <= code && code <= 0x200b) return "w"
+    else if (code == 0x200c) return "b"
+    else return "L"
+  }
+
+  let bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/
+  let isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/
+
+  function BidiSpan(level, from, to) {
+    this.level = level
+    this.from = from; this.to = to
+  }
+
+  return function(str, direction) {
+    let outerType = direction == "ltr" ? "L" : "R"
+
+    if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) return false
+    let len = str.length, types = []
+    for (let i = 0; i < len; ++i)
+      types.push(charType(str.charCodeAt(i)))
+
+    // W1. Examine each non-spacing mark (NSM) in the level run, and
+    // change the type of the NSM to the type of the previous
+    // character. If the NSM is at the start of the level run, it will
+    // get the type of sor.
+    for (let i = 0, prev = outerType; i < len; ++i) {
+      let type = types[i]
+      if (type == "m") types[i] = prev
+      else prev = type
+    }
+
+    // W2. Search backwards from each instance of a European number
+    // until the first strong type (R, L, AL, or sor) is found. If an
+    // AL is found, change the type of the European number to Arabic
+    // number.
+    // W3. Change all ALs to R.
+    for (let i = 0, cur = outerType; i < len; ++i) {
+      let type = types[i]
+      if (type == "1" && cur == "r") types[i] = "n"
+      else if (isStrong.test(type)) { cur = type; if (type == "r") types[i] = "R" }
+    }
+
+    // W4. A single European separator between two European numbers
+    // changes to a European number. A single common separator between
+    // two numbers of the same type changes to that type.
+    for (let i = 1, prev = types[0]; i < len - 1; ++i) {
+      let type = types[i]
+      if (type == "+" && prev == "1" && types[i+1] == "1") types[i] = "1"
+      else if (type == "," && prev == types[i+1] &&
+               (prev == "1" || prev == "n")) types[i] = prev
+      prev = type
+    }
+
+    // W5. A sequence of European terminators adjacent to European
+    // numbers changes to all European numbers.
+    // W6. Otherwise, separators and terminators change to Other
+    // Neutral.
+    for (let i = 0; i < len; ++i) {
+      let type = types[i]
+      if (type == ",") types[i] = "N"
+      else if (type == "%") {
+        let end
+        for (end = i + 1; end < len && types[end] == "%"; ++end) {}
+        let replace = (i && types[i-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"
+        for (let j = i; j < end; ++j) types[j] = replace
+        i = end - 1
+      }
+    }
+
+    // W7. Search backwards from each instance of a European number
+    // until the first strong type (R, L, or sor) is found. If an L is
+    // found, then change the type of the European number to L.
+    for (let i = 0, cur = outerType; i < len; ++i) {
+      let type = types[i]
+      if (cur == "L" && type == "1") types[i] = "L"
+      else if (isStrong.test(type)) cur = type
+    }
+
+    // N1. A sequence of neutrals takes the direction of the
+    // surrounding strong text if the text on both sides has the same
+    // direction. European and Arabic numbers act as if they were R in
+    // terms of their influence on neutrals. Start-of-level-run (sor)
+    // and end-of-level-run (eor) are used at level run boundaries.
+    // N2. Any remaining neutrals take the embedding direction.
+    for (let i = 0; i < len; ++i) {
+      if (isNeutral.test(types[i])) {
+        let end
+        for (end = i + 1; end < len && isNeutral.test(types[end]); ++end) {}
+        let before = (i ? types[i-1] : outerType) == "L"
+        let after = (end < len ? types[end] : outerType) == "L"
+        let replace = before == after ? (before ? "L" : "R") : outerType
+        for (let j = i; j < end; ++j) types[j] = replace
+        i = end - 1
+      }
+    }
+
+    // Here we depart from the documented algorithm, in order to avoid
+    // building up an actual levels array. Since there are only three
+    // levels (0, 1, 2) in an implementation that doesn't take
+    // explicit embedding into account, we can build up the order on
+    // the fly, without following the level-based algorithm.
+    let order = [], m
+    for (let i = 0; i < len;) {
+      if (countsAsLeft.test(types[i])) {
+        let start = i
+        for (++i; i < len && countsAsLeft.test(types[i]); ++i) {}
+        order.push(new BidiSpan(0, start, i))
+      } else {
+        let pos = i, at = order.length, isRTL = direction == "rtl" ? 1 : 0
+        for (++i; i < len && types[i] != "L"; ++i) {}
+        for (let j = pos; j < i;) {
+          if (countsAsNum.test(types[j])) {
+            if (pos < j) { order.splice(at, 0, new BidiSpan(1, pos, j)); at += isRTL }
+            let nstart = j
+            for (++j; j < i && countsAsNum.test(types[j]); ++j) {}
+            order.splice(at, 0, new BidiSpan(2, nstart, j))
+            at += isRTL
+            pos = j
+          } else ++j
+        }
+        if (pos < i) order.splice(at, 0, new BidiSpan(1, pos, i))
+      }
+    }
+    if (direction == "ltr") {
+      if (order[0].level == 1 && (m = str.match(/^\s+/))) {
+        order[0].from = m[0].length
+        order.unshift(new BidiSpan(0, 0, m[0].length))
+      }
+      if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
+        lst(order).to -= m[0].length
+        order.push(new BidiSpan(0, len - m[0].length, len))
+      }
+    }
+
+    return direction == "rtl" ? order.reverse() : order
+  }
+})()
+
+// Get the bidi ordering for the given line (and cache it). Returns
+// false for lines that are fully left-to-right, and an array of
+// BidiSpan objects otherwise.
+export function getOrder(line, direction) {
+  let order = line.order
+  if (order == null) order = line.order = bidiOrdering(line.text, direction)
+  return order
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/browser.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+// Kludges for bugs and behavior differences that can't be feature
+// detected are enabled based on userAgent etc sniffing.
+let userAgent = navigator.userAgent
+let platform = navigator.platform
+
+export let gecko = /gecko\/\d/i.test(userAgent)
+let ie_upto10 = /MSIE \d/.test(userAgent)
+let ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
+let edge = /Edge\/(\d+)/.exec(userAgent)
+export let ie = ie_upto10 || ie_11up || edge
+export let ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
+export let webkit = !edge && /WebKit\//.test(userAgent)
+let qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
+export let chrome = !edge && /Chrome\/(\d+)/.exec(userAgent)
+export let chrome_version = chrome && +chrome[1]
+export let presto = /Opera\//.test(userAgent)
+export let safari = /Apple Computer/.test(navigator.vendor)
+export let mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
+export let phantom = /PhantomJS/.test(userAgent)
+
+export let ios = safari && (/Mobile\/\w+/.test(userAgent) || navigator.maxTouchPoints > 2)
+export let android = /Android/.test(userAgent)
+// This is woefully incomplete. Suggestions for alternative methods welcome.
+export let mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
+export let mac = ios || /Mac/.test(platform)
+export let chromeOS = /\bCrOS\b/.test(userAgent)
+export let windows = /win/i.test(platform)
+
+let presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
+if (presto_version) presto_version = Number(presto_version[1])
+if (presto_version && presto_version >= 15) { presto = false; webkit = true }
+// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
+export let flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
+export let captureRightClick = gecko || (ie && ie_version >= 9)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/dom.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,111 @@
+import { ie, ios } from "./browser.js"
+
+export function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
+
+export let rmClass = function(node, cls) {
+  let current = node.className
+  let match = classTest(cls).exec(current)
+  if (match) {
+    let after = current.slice(match.index + match[0].length)
+    node.className = current.slice(0, match.index) + (after ? match[1] + after : "")
+  }
+}
+
+export function removeChildren(e) {
+  for (let count = e.childNodes.length; count > 0; --count)
+    e.removeChild(e.firstChild)
+  return e
+}
+
+export function removeChildrenAndAdd(parent, e) {
+  return removeChildren(parent).appendChild(e)
+}
+
+export function elt(tag, content, className, style) {
+  let e = document.createElement(tag)
+  if (className) e.className = className
+  if (style) e.style.cssText = style
+  if (typeof content == "string") e.appendChild(document.createTextNode(content))
+  else if (content) for (let i = 0; i < content.length; ++i) e.appendChild(content[i])
+  return e
+}
+// wrapper for elt, which removes the elt from the accessibility tree
+export function eltP(tag, content, className, style) {
+  let e = elt(tag, content, className, style)
+  e.setAttribute("role", "presentation")
+  return e
+}
+
+export let range
+if (document.createRange) range = function(node, start, end, endNode) {
+  let r = document.createRange()
+  r.setEnd(endNode || node, end)
+  r.setStart(node, start)
+  return r
+}
+else range = function(node, start, end) {
+  let r = document.body.createTextRange()
+  try { r.moveToElementText(node.parentNode) }
+  catch(e) { return r }
+  r.collapse(true)
+  r.moveEnd("character", end)
+  r.moveStart("character", start)
+  return r
+}
+
+export function contains(parent, child) {
+  if (child.nodeType == 3) // Android browser always returns false when child is a textnode
+    child = child.parentNode
+  if (parent.contains)
+    return parent.contains(child)
+  do {
+    if (child.nodeType == 11) child = child.host
+    if (child == parent) return true
+  } while (child = child.parentNode)
+}
+
+export function activeElt(rootNode) {
+  // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
+  // IE < 10 will throw when accessed while the page is loading or in an iframe.
+  // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
+  let doc = rootNode.ownerDocument || rootNode
+  let activeElement
+  try {
+    activeElement = rootNode.activeElement
+  } catch(e) {
+    activeElement = doc.body || null
+  }
+  while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
+    activeElement = activeElement.shadowRoot.activeElement
+  return activeElement
+}
+
+export function addClass(node, cls) {
+  let current = node.className
+  if (!classTest(cls).test(current)) node.className += (current ? " " : "") + cls
+}
+export function joinClasses(a, b) {
+  let as = a.split(" ")
+  for (let i = 0; i < as.length; i++)
+    if (as[i] && !classTest(as[i]).test(b)) b += " " + as[i]
+  return b
+}
+
+export let selectInput = function(node) { node.select() }
+if (ios) // Mobile Safari apparently has a bug where select() is broken.
+  selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length }
+else if (ie) // Suppress mysterious IE10 errors
+  selectInput = function(node) { try { node.select() } catch(_e) {} }
+
+export function doc(cm) { return cm.display.wrapper.ownerDocument }
+
+export function root(cm) {
+  return rootNode(cm.display.wrapper)
+}
+
+export function rootNode(element) {
+  // Detect modern browsers (2017+).
+  return element.getRootNode ? element.getRootNode() : element.ownerDocument
+}
+
+export function win(cm) { return doc(cm).defaultView }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/event.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,103 @@
+import { mac } from "./browser.js"
+import { indexOf } from "./misc.js"
+
+// EVENT HANDLING
+
+// Lightweight event framework. on/off also work on DOM nodes,
+// registering native DOM handlers.
+
+const noHandlers = []
+
+export let on = function(emitter, type, f) {
+  if (emitter.addEventListener) {
+    emitter.addEventListener(type, f, false)
+  } else if (emitter.attachEvent) {
+    emitter.attachEvent("on" + type, f)
+  } else {
+    let map = emitter._handlers || (emitter._handlers = {})
+    map[type] = (map[type] || noHandlers).concat(f)
+  }
+}
+
+export function getHandlers(emitter, type) {
+  return emitter._handlers && emitter._handlers[type] || noHandlers
+}
+
+export function off(emitter, type, f) {
+  if (emitter.removeEventListener) {
+    emitter.removeEventListener(type, f, false)
+  } else if (emitter.detachEvent) {
+    emitter.detachEvent("on" + type, f)
+  } else {
+    let map = emitter._handlers, arr = map && map[type]
+    if (arr) {
+      let index = indexOf(arr, f)
+      if (index > -1)
+        map[type] = arr.slice(0, index).concat(arr.slice(index + 1))
+    }
+  }
+}
+
+export function signal(emitter, type /*, values...*/) {
+  let handlers = getHandlers(emitter, type)
+  if (!handlers.length) return
+  let args = Array.prototype.slice.call(arguments, 2)
+  for (let i = 0; i < handlers.length; ++i) handlers[i].apply(null, args)
+}
+
+// The DOM events that CodeMirror handles can be overridden by
+// registering a (non-DOM) handler on the editor for the event name,
+// and preventDefault-ing the event in that handler.
+export function signalDOMEvent(cm, e, override) {
+  if (typeof e == "string")
+    e = {type: e, preventDefault: function() { this.defaultPrevented = true }}
+  signal(cm, override || e.type, cm, e)
+  return e_defaultPrevented(e) || e.codemirrorIgnore
+}
+
+export function signalCursorActivity(cm) {
+  let arr = cm._handlers && cm._handlers.cursorActivity
+  if (!arr) return
+  let set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])
+  for (let i = 0; i < arr.length; ++i) if (indexOf(set, arr[i]) == -1)
+    set.push(arr[i])
+}
+
+export function hasHandler(emitter, type) {
+  return getHandlers(emitter, type).length > 0
+}
+
+// Add on and off methods to a constructor's prototype, to make
+// registering events on such objects more convenient.
+export function eventMixin(ctor) {
+  ctor.prototype.on = function(type, f) {on(this, type, f)}
+  ctor.prototype.off = function(type, f) {off(this, type, f)}
+}
+
+// Due to the fact that we still support jurassic IE versions, some
+// compatibility wrappers are needed.
+
+export function e_preventDefault(e) {
+  if (e.preventDefault) e.preventDefault()
+  else e.returnValue = false
+}
+export function e_stopPropagation(e) {
+  if (e.stopPropagation) e.stopPropagation()
+  else e.cancelBubble = true
+}
+export function e_defaultPrevented(e) {
+  return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
+}
+export function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)}
+
+export function e_target(e) {return e.target || e.srcElement}
+export function e_button(e) {
+  let b = e.which
+  if (b == null) {
+    if (e.button & 1) b = 1
+    else if (e.button & 2) b = 3
+    else if (e.button & 4) b = 2
+  }
+  if (mac && e.ctrlKey && b == 1) b = 3
+  return b
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/feature_detection.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,84 @@
+import { elt, range, removeChildren, removeChildrenAndAdd } from "./dom.js"
+import { ie, ie_version } from "./browser.js"
+
+// Detect drag-and-drop
+export let dragAndDrop = function() {
+  // There is *some* kind of drag-and-drop support in IE6-8, but I
+  // couldn't get it to work yet.
+  if (ie && ie_version < 9) return false
+  let div = elt('div')
+  return "draggable" in div || "dragDrop" in div
+}()
+
+let zwspSupported
+export function zeroWidthElement(measure) {
+  if (zwspSupported == null) {
+    let test = elt("span", "\u200b")
+    removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
+    if (measure.firstChild.offsetHeight != 0)
+      zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8)
+  }
+  let node = zwspSupported ? elt("span", "\u200b") :
+    elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
+  node.setAttribute("cm-text", "")
+  return node
+}
+
+// Feature-detect IE's crummy client rect reporting for bidi text
+let badBidiRects
+export function hasBadBidiRects(measure) {
+  if (badBidiRects != null) return badBidiRects
+  let txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"))
+  let r0 = range(txt, 0, 1).getBoundingClientRect()
+  let r1 = range(txt, 1, 2).getBoundingClientRect()
+  removeChildren(measure)
+  if (!r0 || r0.left == r0.right) return false // Safari returns null in some cases (#2780)
+  return badBidiRects = (r1.right - r0.right < 3)
+}
+
+// See if "".split is the broken IE version, if so, provide an
+// alternative way to split lines.
+export let splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? string => {
+  let pos = 0, result = [], l = string.length
+  while (pos <= l) {
+    let nl = string.indexOf("\n", pos)
+    if (nl == -1) nl = string.length
+    let line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl)
+    let rt = line.indexOf("\r")
+    if (rt != -1) {
+      result.push(line.slice(0, rt))
+      pos += rt + 1
+    } else {
+      result.push(line)
+      pos = nl + 1
+    }
+  }
+  return result
+} : string => string.split(/\r\n?|\n/)
+
+export let hasSelection = window.getSelection ? te => {
+  try { return te.selectionStart != te.selectionEnd }
+  catch(e) { return false }
+} : te => {
+  let range
+  try {range = te.ownerDocument.selection.createRange()}
+  catch(e) {}
+  if (!range || range.parentElement() != te) return false
+  return range.compareEndPoints("StartToEnd", range) != 0
+}
+
+export let hasCopyEvent = (() => {
+  let e = elt("div")
+  if ("oncopy" in e) return true
+  e.setAttribute("oncopy", "return;")
+  return typeof e.oncopy == "function"
+})()
+
+let badZoomedRects = null
+export function hasBadZoomedRects(measure) {
+  if (badZoomedRects != null) return badZoomedRects
+  let node = removeChildrenAndAdd(measure, elt("span", "x"))
+  let normal = node.getBoundingClientRect()
+  let fromRange = range(node, 0, 1).getBoundingClientRect()
+  return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/misc.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,168 @@
+export function bind(f) {
+  let args = Array.prototype.slice.call(arguments, 1)
+  return function(){return f.apply(null, args)}
+}
+
+export function copyObj(obj, target, overwrite) {
+  if (!target) target = {}
+  for (let prop in obj)
+    if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
+      target[prop] = obj[prop]
+  return target
+}
+
+// Counts the column offset in a string, taking tabs into account.
+// Used mostly to find indentation.
+export function countColumn(string, end, tabSize, startIndex, startValue) {
+  if (end == null) {
+    end = string.search(/[^\s\u00a0]/)
+    if (end == -1) end = string.length
+  }
+  for (let i = startIndex || 0, n = startValue || 0;;) {
+    let nextTab = string.indexOf("\t", i)
+    if (nextTab < 0 || nextTab >= end)
+      return n + (end - i)
+    n += nextTab - i
+    n += tabSize - (n % tabSize)
+    i = nextTab + 1
+  }
+}
+
+export class Delayed {
+  constructor() {
+    this.id = null
+    this.f = null
+    this.time = 0
+    this.handler = bind(this.onTimeout, this)
+  }
+  onTimeout(self) {
+    self.id = 0
+    if (self.time <= +new Date) {
+      self.f()
+    } else {
+      setTimeout(self.handler, self.time - +new Date)
+    }
+  }
+  set(ms, f) {
+    this.f = f
+    const time = +new Date + ms
+    if (!this.id || time < this.time) {
+      clearTimeout(this.id)
+      this.id = setTimeout(this.handler, ms)
+      this.time = time
+    }
+  }
+}
+
+export function indexOf(array, elt) {
+  for (let i = 0; i < array.length; ++i)
+    if (array[i] == elt) return i
+  return -1
+}
+
+// Number of pixels added to scroller and sizer to hide scrollbar
+export let scrollerGap = 50
+
+// Returned or thrown by various protocols to signal 'I'm not
+// handling this'.
+export let Pass = {toString: function(){return "CodeMirror.Pass"}}
+
+// Reused option objects for setSelection & friends
+export let sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"}
+
+// The inverse of countColumn -- find the offset that corresponds to
+// a particular column.
+export function findColumn(string, goal, tabSize) {
+  for (let pos = 0, col = 0;;) {
+    let nextTab = string.indexOf("\t", pos)
+    if (nextTab == -1) nextTab = string.length
+    let skipped = nextTab - pos
+    if (nextTab == string.length || col + skipped >= goal)
+      return pos + Math.min(skipped, goal - col)
+    col += nextTab - pos
+    col += tabSize - (col % tabSize)
+    pos = nextTab + 1
+    if (col >= goal) return pos
+  }
+}
+
+let spaceStrs = [""]
+export function spaceStr(n) {
+  while (spaceStrs.length <= n)
+    spaceStrs.push(lst(spaceStrs) + " ")
+  return spaceStrs[n]
+}
+
+export function lst(arr) { return arr[arr.length-1] }
+
+export function map(array, f) {
+  let out = []
+  for (let i = 0; i < array.length; i++) out[i] = f(array[i], i)
+  return out
+}
+
+export function insertSorted(array, value, score) {
+  let pos = 0, priority = score(value)
+  while (pos < array.length && score(array[pos]) <= priority) pos++
+  array.splice(pos, 0, value)
+}
+
+function nothing() {}
+
+export function createObj(base, props) {
+  let inst
+  if (Object.create) {
+    inst = Object.create(base)
+  } else {
+    nothing.prototype = base
+    inst = new nothing()
+  }
+  if (props) copyObj(props, inst)
+  return inst
+}
+
+let nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
+export function isWordCharBasic(ch) {
+  return /\w/.test(ch) || ch > "\x80" &&
+    (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
+}
+export function isWordChar(ch, helper) {
+  if (!helper) return isWordCharBasic(ch)
+  if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) return true
+  return helper.test(ch)
+}
+
+export function isEmpty(obj) {
+  for (let n in obj) if (obj.hasOwnProperty(n) && obj[n]) return false
+  return true
+}
+
+// Extending unicode characters. A series of a non-extending char +
+// any number of extending chars is treated as a single unit as far
+// as editing and measuring is concerned. This is not fully correct,
+// since some scripts/fonts/browsers also treat other configurations
+// of code points as a group.
+let extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/
+export function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
+
+// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
+export function skipExtendingChars(str, pos, dir) {
+  while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) pos += dir
+  return pos
+}
+
+// Returns the value from the range [`from`; `to`] that satisfies
+// `pred` and is closest to `from`. Assumes that at least `to`
+// satisfies `pred`. Supports `from` being greater than `to`.
+export function findFirst(pred, from, to) {
+  // At any point we are certain `to` satisfies `pred`, don't know
+  // whether `from` does.
+  let dir = from > to ? -1 : 1
+  for (;;) {
+    if (from == to) return from
+    let midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF)
+    if (mid == from) return pred(mid) ? from : to
+    if (pred(mid)) to = mid
+    else from = mid + dir
+  }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/src/util/operation_group.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,72 @@
+import { getHandlers } from "./event.js"
+
+let operationGroup = null
+
+export function pushOperation(op) {
+  if (operationGroup) {
+    operationGroup.ops.push(op)
+  } else {
+    op.ownsGroup = operationGroup = {
+      ops: [op],
+      delayedCallbacks: []
+    }
+  }
+}
+
+function fireCallbacksForOps(group) {
+  // Calls delayed callbacks and cursorActivity handlers until no
+  // new ones appear
+  let callbacks = group.delayedCallbacks, i = 0
+  do {
+    for (; i < callbacks.length; i++)
+      callbacks[i].call(null)
+    for (let j = 0; j < group.ops.length; j++) {
+      let op = group.ops[j]
+      if (op.cursorActivityHandlers)
+        while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
+          op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm)
+    }
+  } while (i < callbacks.length)
+}
+
+export function finishOperation(op, endCb) {
+  let group = op.ownsGroup
+  if (!group) return
+
+  try { fireCallbacksForOps(group) }
+  finally {
+    operationGroup = null
+    endCb(group)
+  }
+}
+
+let orphanDelayedCallbacks = null
+
+// Often, we want to signal events at a point where we are in the
+// middle of some work, but don't want the handler to start calling
+// other methods on the editor, which might be in an inconsistent
+// state or simply not expect any other events to happen.
+// signalLater looks whether there are any handlers, and schedules
+// them to be executed when the last operation ends, or, if no
+// operation is active, when a timeout fires.
+export function signalLater(emitter, type /*, values...*/) {
+  let arr = getHandlers(emitter, type)
+  if (!arr.length) return
+  let args = Array.prototype.slice.call(arguments, 2), list
+  if (operationGroup) {
+    list = operationGroup.delayedCallbacks
+  } else if (orphanDelayedCallbacks) {
+    list = orphanDelayedCallbacks
+  } else {
+    list = orphanDelayedCallbacks = []
+    setTimeout(fireOrphanDelayed, 0)
+  }
+  for (let i = 0; i < arr.length; ++i)
+    list.push(() => arr[i].apply(null, args))
+}
+
+function fireOrphanDelayed() {
+  let delayed = orphanDelayedCallbacks
+  orphanDelayedCallbacks = null
+  for (let i = 0; i < delayed.length; ++i) delayed[i]()
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/annotatescrollbar.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,55 @@
+namespace = "annotatescrollbar_";
+
+(function () {
+  function test(name, run, content, query, expected) {
+    return testCM(name, function (cm) {
+      var annotation = cm.annotateScrollbar({
+        listenForChanges: false,
+        className: "CodeMirror-search-match"
+      });
+      var matches = [];
+      var cursor = cm.getSearchCursor(query, CodeMirror.Pos(0, 0));
+      while (cursor.findNext()) {
+        var match = {
+          from: cursor.from(),
+          to: cursor.to()
+        };
+        matches.push(match)
+      }
+
+      if (run) run(cm);
+
+      cm.display.barWidth = 5;
+      annotation.update(matches);
+
+      var annotations = cm.getWrapperElement().getElementsByClassName(annotation.options.className);
+      eq(annotations.length, expected, "Expected " + expected + " annotations on the scrollbar.")
+    }, {
+      value: content,
+      mode: "javascript",
+      foldOptions: {
+        rangeFinder: CodeMirror.fold.brace
+      }
+    });
+  }
+
+  function doFold(cm) {
+    cm.foldCode(cm.getCursor());
+  }
+  var simpleProg = "function foo() {\n\n  return \"foo\";\n\n}\n\nfoo();\n";
+  var consecutiveLineMatches = "function foo() {\n  return \"foo\";\n}\nfoo();\n";
+  var singleLineMatches = "function foo() { return \"foo\"; }foo();\n";
+
+  // Base case - expect 3 matches and 3 annotations
+  test("simple", null, simpleProg, "foo", 3);
+  // Consecutive line matches are combines into a single annotation - expect 3 matches and 2 annotations
+  test("combineConsecutiveLine", null, consecutiveLineMatches, "foo", 2);
+  // Matches on a single line get a single annotation - expect 3 matches and 1 annotation
+  test("combineSingleLine", null, singleLineMatches, "foo", 1);
+  // Matches within a fold are annotated on the folded line - expect 3 matches and 2 annotations
+  test("simpleFold", doFold, simpleProg, "foo", 2);
+  // Combination of combineConsecutiveLine and simpleFold cases - expect 3 matches and 1 annotation
+  test("foldedMatch", doFold, consecutiveLineMatches, "foo", 1);
+  // Hidden matches within a fold are annotated on the folded line - expect 1 match and 1 annotation
+  test("hiddenMatch", doFold, simpleProg, "return", 1);
+})();
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/comment_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,135 @@
+namespace = "comment_";
+
+(function() {
+  function test(name, mode, run, before, after) {
+    return testCM(name, function(cm) {
+      run(cm);
+      eq(cm.getValue(), after);
+    }, {value: before, mode: mode});
+  }
+
+  var simpleProg = "function foo() {\n  return bar;\n}";
+  var inlineBlock = "foo(/* bar */ true);";
+  var inlineBlocks = "foo(/* bar */ true, /* baz */ false);";
+  var multiLineInlineBlock = ["above();", "foo(/* bar */ true);", "below();"];
+
+  test("block", "javascript", function(cm) {
+    cm.blockComment(Pos(0, 3), Pos(3, 0), {blockCommentLead: " *"});
+  }, simpleProg + "\n", "/* function foo() {\n *   return bar;\n * }\n */");
+
+  test("blockToggle", "javascript", function(cm) {
+    cm.blockComment(Pos(0, 3), Pos(2, 0), {blockCommentLead: " *"});
+    cm.uncomment(Pos(0, 3), Pos(2, 0), {blockCommentLead: " *"});
+  }, simpleProg, simpleProg);
+
+  test("blockToggle2", "javascript", function(cm) {
+    cm.setCursor({line: 0, ch: 7 /* inside the block comment */});
+    cm.execCommand("toggleComment");
+  }, inlineBlock, "foo(bar true);");
+
+  // This test should work but currently fails.
+  // test("blockToggle3", "javascript", function(cm) {
+  //   cm.setCursor({line: 0, ch: 7 /* inside the first block comment */});
+  //   cm.execCommand("toggleComment");
+  // }, inlineBlocks, "foo(bar true, /* baz */ false);");
+
+  test("line", "javascript", function(cm) {
+    cm.lineComment(Pos(1, 1), Pos(1, 1));
+  }, simpleProg, "function foo() {\n//   return bar;\n}");
+
+  test("lineToggle", "javascript", function(cm) {
+    cm.lineComment(Pos(0, 0), Pos(2, 1));
+    cm.uncomment(Pos(0, 0), Pos(2, 1));
+  }, simpleProg, simpleProg);
+
+  test("fallbackToBlock", "css", function(cm) {
+    cm.lineComment(Pos(0, 0), Pos(2, 1));
+  }, "html {\n  border: none;\n}", "/* html {\n  border: none;\n} */");
+
+  test("fallbackToLine", "ruby", function(cm) {
+    cm.blockComment(Pos(0, 0), Pos(1));
+  }, "def blah()\n  return hah\n", "# def blah()\n#   return hah\n");
+
+  test("ignoreExternalBlockComments", "javascript", function(cm) {
+    cm.execCommand("toggleComment");
+  }, inlineBlocks, "// " + inlineBlocks);
+
+  test("ignoreExternalBlockComments2", "javascript", function(cm) {
+    cm.setCursor({line: 0, ch: null /* eol */});
+    cm.execCommand("toggleComment");
+  }, inlineBlocks, "// " + inlineBlocks);
+
+  test("ignoreExternalBlockCommentsMultiLineAbove", "javascript", function(cm) {
+    cm.setSelection({line: 0, ch: 0}, {line: 1, ch: 1});
+    cm.execCommand("toggleComment");
+  }, multiLineInlineBlock.join("\n"), ["// " + multiLineInlineBlock[0],
+                                       "// " + multiLineInlineBlock[1],
+                                       multiLineInlineBlock[2]].join("\n"));
+
+  test("ignoreExternalBlockCommentsMultiLineBelow", "javascript", function(cm) {
+    cm.setSelection({line: 1, ch: 13 /* after end of block comment */}, {line: 2, ch: 1});
+    cm.execCommand("toggleComment");
+  }, multiLineInlineBlock.join("\n"), [multiLineInlineBlock[0],
+                                       "// " + multiLineInlineBlock[1],
+                                       "// " + multiLineInlineBlock[2]].join("\n"));
+
+  test("commentRange", "javascript", function(cm) {
+    cm.blockComment(Pos(1, 2), Pos(1, 13), {fullLines: false});
+  }, simpleProg, "function foo() {\n  /*return bar;*/\n}");
+
+  test("indented", "javascript", function(cm) {
+    cm.lineComment(Pos(1, 0), Pos(2), {indent: true});
+  }, simpleProg, "function foo() {\n//   return bar;\n// }");
+
+  test("emptyIndentedLine", "javascript", function(cm) {
+    cm.lineComment(Pos(1, 2), Pos(1, 2), {indent: true});
+  }, "function foo() {\n  \n}", "function foo() {\n  // \n}");
+
+  test("singleEmptyLine", "javascript", function(cm) {
+    cm.setCursor(1);
+    cm.execCommand("toggleComment");
+  }, "a;\n\nb;", "a;\n// \nb;");
+
+  test("dontMessWithStrings", "javascript", function(cm) {
+    cm.execCommand("toggleComment");
+  }, "console.log(\"/*string*/\");", "// console.log(\"/*string*/\");");
+
+  test("dontMessWithStrings2", "javascript", function(cm) {
+    cm.execCommand("toggleComment");
+  }, "console.log(\"// string\");", "// console.log(\"// string\");");
+
+  test("dontMessWithStrings3", "javascript", function(cm) {
+    cm.execCommand("toggleComment");
+  }, "// console.log(\"// string\");", "console.log(\"// string\");");
+
+  test("includeLastLine", "javascript", function(cm) {
+    cm.execCommand("selectAll")
+    cm.execCommand("toggleComment")
+  }, "// foo\n// bar\nbaz", "// // foo\n// // bar\n// baz")
+
+  test("uncommentWithTrailingBlockEnd", "xml", function(cm) {
+    cm.execCommand("toggleComment")
+  }, "<!-- foo --> -->", "foo -->")
+
+  test("dontCommentInComment", "xml", function(cm) {
+    cm.setCursor(1, 0)
+    cm.execCommand("toggleComment")
+  }, "<!-- foo\nbar -->", "<!-- foo\nbar -->")
+  
+  test("toggleWithMultipleInnerComments", "javascript", function(cm) {
+    cm.execCommand("selectAll")
+    cm.execCommand("toggleComment")
+  }, "/* foo */\na\n/* bar */\nb", "// /* foo */\n// a\n// /* bar */\n// b")
+  
+  var before = 'console.log("//string gets corrupted.");';
+  var after  = '// console.log("//string gets corrupted.");';
+  test("toggleWithStringContainingComment1", "javascript", function(cm) {
+    cm.setCursor({line: 0, ch: 16 /* after // inside string */});
+    cm.execCommand("toggleComment");
+  }, before, after)
+  test("toggleWithStringContainingComment2", "javascript", function(cm) {
+    cm.setCursor({line: 0, ch: 16 /* after // inside string */});
+    cm.execCommand("toggleComment");
+    cm.execCommand("toggleComment");
+  }, before, before)
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/contenteditable_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,110 @@
+(function() {
+  "use strict";
+
+  namespace = "contenteditable_";
+  var Pos = CodeMirror.Pos
+
+  function findTextNode(dom, text) {
+    if (dom instanceof CodeMirror) dom = dom.getInputField()
+    if (dom.nodeType == 1) {
+      for (var ch = dom.firstChild; ch; ch = ch.nextSibling) {
+        var found = findTextNode(ch, text)
+        if (found) return found
+      }
+    } else if (dom.nodeType == 3 && dom.nodeValue == text) {
+      return dom
+    }
+  }
+
+  function lineElt(node) {
+    for (;;) {
+      var parent = node.parentNode
+      if (/CodeMirror-code/.test(parent.className)) return node
+      node = parent
+    }
+  }
+
+  testCM("insert_text", function(cm) {
+    findTextNode(cm, "foobar").nodeValue = "foo bar"
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "foo bar")
+  }, {inputStyle: "contenteditable", value: "foobar"})
+
+  testCM("split_line", function(cm) {
+    cm.setSelection(Pos(2, 3))
+    var node = findTextNode(cm, "foobar")
+    node.nodeValue = "foo"
+    var lineNode = lineElt(node)
+    lineNode.parentNode.insertBefore(document.createElement("pre"), lineNode.nextSibling).textContent = "bar"
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "one\ntwo\nfoo\nbar\nthree\nfour\n")
+  }, {inputStyle: "contenteditable", value: "one\ntwo\nfoobar\nthree\nfour\n"})
+
+  testCM("join_line", function(cm) {
+    cm.setSelection(Pos(2, 3))
+    var node = findTextNode(cm, "foo")
+    node.nodeValue = "foobar"
+    var lineNode = lineElt(node)
+    lineNode.parentNode.removeChild(lineNode.nextSibling)
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "one\ntwo\nfoobar\nthree\nfour\n")
+  }, {inputStyle: "contenteditable", value: "one\ntwo\nfoo\nbar\nthree\nfour\n"})
+
+  testCM("delete_multiple", function(cm) {
+    cm.setSelection(Pos(1, 3), Pos(4, 0))
+    var text = findTextNode(cm, "two"), startLine = lineElt(text)
+    for (var i = 0; i < 3; i++)
+      startLine.parentNode.removeChild(startLine.nextSibling)
+    text.nodeValue = "twothree"
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "one\ntwothree\nfour\n")
+  }, {inputStyle: "contenteditable", value: "one\ntwo\nfoo\nbar\nthree\nfour\n"})
+
+  testCM("ambiguous_diff_middle", function(cm) {
+    cm.setSelection(Pos(0, 2))
+    findTextNode(cm, "baah").nodeValue = "baaah"
+    cm.display.input.updateFromDOM()
+    eqCharPos(cm.getCursor(), Pos(0, 3))
+  }, {inputStyle: "contenteditable", value: "baah"})
+
+  testCM("ambiguous_diff_start", function(cm) {
+    cm.setSelection(Pos(0, 1))
+    findTextNode(cm, "baah").nodeValue = "baaah"
+    cm.display.input.updateFromDOM()
+    eqCharPos(cm.getCursor(), Pos(0, 2))
+  }, {inputStyle: "contenteditable", value: "baah"})
+
+  testCM("ambiguous_diff_end", function(cm) {
+    cm.setSelection(Pos(0, 3))
+    findTextNode(cm, "baah").nodeValue = "baaah"
+    cm.display.input.updateFromDOM()
+    eqCharPos(cm.getCursor(), Pos(0, 4))
+  }, {inputStyle: "contenteditable", value: "baah"})
+
+  testCM("force_redraw", function(cm) {
+    findTextNode(cm, "foo").parentNode.appendChild(document.createElement("hr")).className = "inserted"
+    cm.display.input.updateFromDOM()
+    eq(byClassName(cm.getInputField(), "inserted").length, 0)
+  }, {inputStyle: "contenteditable", value: "foo"})
+
+  testCM("type_on_empty_line", function(cm) {
+    cm.setSelection(Pos(1, 0))
+    findTextNode(cm, "\u200b").nodeValue += "hello"
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "foo\nhello\nbar")
+  }, {inputStyle: "contenteditable", value: "foo\n\nbar"})
+
+  testCM("type_after_empty_line", function(cm) {
+    cm.setSelection(Pos(2, 0))
+    findTextNode(cm, "bar").nodeValue = "hellobar"
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "foo\n\nhellobar")
+  }, {inputStyle: "contenteditable", value: "foo\n\nbar"})
+
+  testCM("type_before_empty_line", function(cm) {
+    cm.setSelection(Pos(0, 3))
+    findTextNode(cm, "foo").nodeValue = "foohello"
+    cm.display.input.updateFromDOM()
+    eq(cm.getValue(), "foohello\n\nbar")
+  }, {inputStyle: "contenteditable", value: "foo\n\nbar"})
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/doc_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,371 @@
+(function() {
+  // A minilanguage for instantiating linked CodeMirror instances and Docs
+  function instantiateSpec(spec, place, opts) {
+    var names = {}, pos = 0, l = spec.length, editors = [];
+    while (spec) {
+      var m = spec.match(/^(\w+)(\*?)(?:='([^\']*)'|<(~?)(\w+)(?:\/(\d+)-(\d+))?)\s*/);
+      var name = m[1], isDoc = m[2], cur;
+      if (m[3]) {
+        cur = isDoc ? CodeMirror.Doc(m[3]) : CodeMirror(place, clone(opts, {value: m[3]}));
+      } else {
+        var other = m[5];
+        if (!names.hasOwnProperty(other)) {
+          names[other] = editors.length;
+          editors.push(CodeMirror(place, opts));
+        }
+        var doc = editors[names[other]].linkedDoc({
+          sharedHist: !m[4],
+          from: m[6] ? Number(m[6]) : null,
+          to: m[7] ? Number(m[7]) : null
+        });
+        cur = isDoc ? doc : CodeMirror(place, clone(opts, {value: doc}));
+      }
+      names[name] = editors.length;
+      editors.push(cur);
+      spec = spec.slice(m[0].length);
+    }
+    return editors;
+  }
+
+  function clone(obj, props) {
+    if (!obj) return;
+    clone.prototype = obj;
+    var inst = new clone();
+    if (props) for (var n in props) if (props.hasOwnProperty(n))
+      inst[n] = props[n];
+    return inst;
+  }
+
+  function eqAll(val) {
+    var end = arguments.length, msg = null;
+    if (typeof arguments[end-1] == "string")
+      msg = arguments[--end];
+    if (i == end) throw new Error("No editors provided to eqAll");
+    for (var i = 1; i < end; ++i)
+      eq(arguments[i].getValue(), val, msg)
+  }
+
+  function testDoc(name, spec, run, opts, expectFail) {
+    if (!opts) opts = {};
+
+    return test("doc_" + name, function() {
+      var place = document.getElementById("testground");
+      var editors = instantiateSpec(spec, place, opts);
+      var successful = false;
+
+      try {
+        run.apply(null, editors);
+        successful = true;
+      } finally {
+        if (!successful || verbose) {
+          place.style.visibility = "visible";
+        } else {
+          for (var i = 0; i < editors.length; ++i)
+            if (editors[i] instanceof CodeMirror)
+              place.removeChild(editors[i].getWrapperElement());
+        }
+      }
+    }, expectFail);
+  }
+
+  var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
+
+  function testBasic(a, b) {
+    eqAll("x", a, b);
+    a.setValue("hey");
+    eqAll("hey", a, b);
+    b.setValue("wow");
+    eqAll("wow", a, b);
+    a.replaceRange("u\nv\nw", Pos(0, 3));
+    b.replaceRange("i", Pos(0, 4));
+    b.replaceRange("j", Pos(2, 1));
+    eqAll("wowui\nv\nwj", a, b);
+  }
+
+  testDoc("basic", "A='x' B<A", testBasic);
+  testDoc("basicSeparate", "A='x' B<~A", testBasic);
+
+  testDoc("sharedHist", "A='ab\ncd\nef' B<A", function(a, b) {
+    a.replaceRange("x", Pos(0));
+    b.replaceRange("y", Pos(1));
+    a.replaceRange("z", Pos(2));
+    eqAll("abx\ncdy\nefz", a, b);
+    a.undo();
+    a.undo();
+    eqAll("abx\ncd\nef", a, b);
+    a.redo();
+    eqAll("abx\ncdy\nef", a, b);
+    b.redo();
+    eqAll("abx\ncdy\nefz", a, b);
+    a.undo(); b.undo(); a.undo(); a.undo();
+    eqAll("ab\ncd\nef", a, b);
+  }, null, ie_lt8);
+
+  testDoc("undoIntact", "A='ab\ncd\nef' B<~A", function(a, b) {
+    a.replaceRange("x", Pos(0));
+    b.replaceRange("y", Pos(1));
+    a.replaceRange("z", Pos(2));
+    a.replaceRange("q", Pos(0));
+    eqAll("abxq\ncdy\nefz", a, b);
+    a.undo();
+    a.undo();
+    eqAll("abx\ncdy\nef", a, b);
+    b.undo();
+    eqAll("abx\ncd\nef", a, b);
+    a.redo();
+    eqAll("abx\ncd\nefz", a, b);
+    a.redo();
+    eqAll("abxq\ncd\nefz", a, b);
+    a.undo(); a.undo(); a.undo(); a.undo();
+    eqAll("ab\ncd\nef", a, b);
+    b.redo();
+    eqAll("ab\ncdy\nef", a, b);
+  });
+
+  testDoc("undoConflict", "A='ab\ncd\nef' B<~A", function(a, b) {
+    a.replaceRange("x", Pos(0));
+    a.replaceRange("z", Pos(2));
+    // This should clear the first undo event in a, but not the second
+    b.replaceRange("y", Pos(0));
+    a.undo(); a.undo();
+    eqAll("abxy\ncd\nef", a, b);
+    a.replaceRange("u", Pos(2));
+    a.replaceRange("v", Pos(0));
+    // This should clear both events in a
+    b.replaceRange("w", Pos(0));
+    a.undo(); a.undo();
+    eqAll("abxyvw\ncd\nefu", a, b);
+  });
+
+  testDoc("doubleRebase", "A='ab\ncd\nef\ng' B<~A C<B", function(a, b, c) {
+    c.replaceRange("u", Pos(3));
+    a.replaceRange("", Pos(0, 0), Pos(1, 0));
+    c.undo();
+    eqAll("cd\nef\ng", a, b, c);
+  });
+
+  testDoc("undoUpdate", "A='ab\ncd\nef' B<~A", function(a, b) {
+    a.replaceRange("x", Pos(2));
+    b.replaceRange("u\nv\nw\n", Pos(0, 0));
+    a.undo();
+    eqAll("u\nv\nw\nab\ncd\nef", a, b);
+    a.redo();
+    eqAll("u\nv\nw\nab\ncd\nefx", a, b);
+    a.undo();
+    eqAll("u\nv\nw\nab\ncd\nef", a, b);
+    b.undo();
+    a.redo();
+    eqAll("ab\ncd\nefx", a, b);
+    a.undo();
+    eqAll("ab\ncd\nef", a, b);
+  });
+
+  testDoc("undoKeepRanges", "A='abcdefg' B<A", function(a, b) {
+    var m = a.markText(Pos(0, 1), Pos(0, 3), {className: "foo"});
+    b.replaceRange("x", Pos(0, 0));
+    eqCharPos(m.find().from, Pos(0, 2));
+    b.replaceRange("yzzy", Pos(0, 1), Pos(0));
+    eq(m.find(), null);
+    b.undo();
+    eqCharPos(m.find().from, Pos(0, 2));
+    b.undo();
+    eqCharPos(m.find().from, Pos(0, 1));
+  });
+
+  testDoc("longChain", "A='uv' B<A C<B D<C", function(a, b, c, d) {
+    a.replaceSelection("X");
+    eqAll("Xuv", a, b, c, d);
+    d.replaceRange("Y", Pos(0));
+    eqAll("XuvY", a, b, c, d);
+  });
+
+  testDoc("broadCast", "B<A C<A D<A E<A", function(a, b, c, d, e) {
+    b.setValue("uu");
+    eqAll("uu", a, b, c, d, e);
+    a.replaceRange("v", Pos(0, 1));
+    eqAll("uvu", a, b, c, d, e);
+  });
+
+  // A and B share a history, C and D share a separate one
+  testDoc("islands", "A='x\ny\nz' B<A C<~A D<C", function(a, b, c, d) {
+    a.replaceRange("u", Pos(0));
+    d.replaceRange("v", Pos(2));
+    b.undo();
+    eqAll("x\ny\nzv", a, b, c, d);
+    c.undo();
+    eqAll("x\ny\nz", a, b, c, d);
+    a.redo();
+    eqAll("xu\ny\nz", a, b, c, d);
+    d.redo();
+    eqAll("xu\ny\nzv", a, b, c, d);
+  });
+
+  testDoc("unlink", "B<A C<A D<B", function(a, b, c, d) {
+    a.setValue("hi");
+    b.unlinkDoc(a);
+    d.setValue("aye");
+    eqAll("hi", a, c);
+    eqAll("aye", b, d);
+    a.setValue("oo");
+    eqAll("oo", a, c);
+    eqAll("aye", b, d);
+  });
+
+  testDoc("bareDoc", "A*='foo' B*<A C<B", function(a, b, c) {
+    is(a instanceof CodeMirror.Doc);
+    is(b instanceof CodeMirror.Doc);
+    is(c instanceof CodeMirror);
+    eqAll("foo", a, b, c);
+    a.replaceRange("hey", Pos(0, 0), Pos(0));
+    c.replaceRange("!", Pos(0));
+    eqAll("hey!", a, b, c);
+    b.unlinkDoc(a);
+    b.setValue("x");
+    eqAll("x", b, c);
+    eqAll("hey!", a);
+  });
+
+  testDoc("swapDoc", "A='a' B*='b' C<A", function(a, b, c) {
+    var d = a.swapDoc(b);
+    d.setValue("x");
+    eqAll("x", c, d);
+    eqAll("b", a, b);
+  });
+
+  testDoc("docKeepsScroll", "A='x' B*='y'", function(a, b) {
+    addDoc(a, 200, 200);
+    a.scrollIntoView(Pos(199, 200));
+    var c = a.swapDoc(b);
+    a.swapDoc(c);
+    var pos = a.getScrollInfo();
+    is(pos.left > 0, "not at left");
+    is(pos.top > 0, "not at top");
+  });
+
+  testDoc("copyDoc", "A='u'", function(a) {
+    var copy = a.getDoc().copy(true);
+    a.setValue("foo");
+    copy.setValue("bar");
+    var old = a.swapDoc(copy);
+    eq(a.getValue(), "bar");
+    a.undo();
+    eq(a.getValue(), "u");
+    a.swapDoc(old);
+    eq(a.getValue(), "foo");
+    eq(old.historySize().undo, 1);
+    eq(old.copy(false).historySize().undo, 0);
+  });
+
+  testDoc("docKeepsMode", "A='1+1'", function(a) {
+    var other = CodeMirror.Doc("hi", "text/x-markdown");
+    a.setOption("mode", "text/javascript");
+    var old = a.swapDoc(other);
+    eq(a.getOption("mode"), "text/x-markdown");
+    eq(a.getMode().name, "markdown");
+    a.swapDoc(old);
+    eq(a.getOption("mode"), "text/javascript");
+    eq(a.getMode().name, "javascript");
+  });
+
+  testDoc("subview", "A='1\n2\n3\n4\n5' B<~A/1-3", function(a, b) {
+    eq(b.getValue(), "2\n3");
+    eq(b.firstLine(), 1);
+    b.setCursor(Pos(4));
+    eqCharPos(b.getCursor(), Pos(2, 1));
+    a.replaceRange("-1\n0\n", Pos(0, 0));
+    eq(b.firstLine(), 3);
+    eqCharPos(b.getCursor(), Pos(4, 1));
+    a.undo();
+    eqCharPos(b.getCursor(), Pos(2, 1));
+    b.replaceRange("oyoy\n", Pos(2, 0));
+    eq(a.getValue(), "1\n2\noyoy\n3\n4\n5");
+    b.undo();
+    eq(a.getValue(), "1\n2\n3\n4\n5");
+  });
+
+  testDoc("subviewEditOnBoundary", "A='11\n22\n33\n44\n55' B<~A/1-4", function(a, b) {
+    a.replaceRange("x\nyy\nz", Pos(0, 1), Pos(2, 1));
+    eq(b.firstLine(), 2);
+    eq(b.lineCount(), 2);
+    eq(b.getValue(), "z3\n44");
+    a.replaceRange("q\nrr\ns", Pos(3, 1), Pos(4, 1));
+    eq(b.firstLine(), 2);
+    eq(b.getValue(), "z3\n4q");
+    eq(a.getValue(), "1x\nyy\nz3\n4q\nrr\ns5");
+    a.execCommand("selectAll");
+    a.replaceSelection("!");
+    eqAll("!", a, b);
+  });
+
+
+  testDoc("sharedMarker", "A='ab\ncd\nef\ngh' B<A C<~A/1-2", function(a, b, c) {
+    var mark = b.markText(Pos(0, 1), Pos(3, 1),
+                          {className: "cm-searching", shared: true});
+    var found = a.findMarksAt(Pos(0, 2));
+    eq(found.length, 1);
+    eq(found[0], mark);
+    eq(c.findMarksAt(Pos(1, 1)).length, 1);
+    eqCharPos(mark.find().from, Pos(0, 1));
+    eqCharPos(mark.find().to, Pos(3, 1));
+    b.replaceRange("x\ny\n", Pos(0, 0));
+    eqCharPos(mark.find().from, Pos(2, 1));
+    eqCharPos(mark.find().to, Pos(5, 1));
+    var cleared = 0;
+    CodeMirror.on(mark, "clear", function() {++cleared;});
+    b.operation(function(){mark.clear();});
+    eq(a.findMarksAt(Pos(3, 1)).length, 0);
+    eq(b.findMarksAt(Pos(3, 1)).length, 0);
+    eq(c.findMarksAt(Pos(3, 1)).length, 0);
+    eq(mark.find(), null);
+    eq(cleared, 1);
+  });
+
+  testDoc("sharedMarkerCopy", "A='abcde'", function(a) {
+    var shared = a.markText(Pos(0, 1), Pos(0, 3), {shared: true});
+    var b = a.linkedDoc();
+    var found = b.findMarksAt(Pos(0, 2));
+    eq(found.length, 1);
+    eq(found[0], shared);
+    shared.clear();
+    eq(b.findMarksAt(Pos(0, 2)), 0);
+  });
+
+  testDoc("sharedMarkerDetach", "A='abcde' B<A C<B", function(a, b, c) {
+    var shared = a.markText(Pos(0, 1), Pos(0, 3), {shared: true});
+    a.unlinkDoc(b);
+    var inB = b.findMarksAt(Pos(0, 2));
+    eq(inB.length, 1);
+    is(inB[0] != shared);
+    var inC = c.findMarksAt(Pos(0, 2));
+    eq(inC.length, 1);
+    is(inC[0] != shared);
+    inC[0].clear();
+    is(shared.find());
+  });
+
+  testDoc("sharedBookmark", "A='ab\ncd\nef\ngh' B<A C<~A/1-2", function(a, b, c) {
+    var mark = b.setBookmark(Pos(1, 1), {shared: true});
+    var found = a.findMarksAt(Pos(1, 1));
+    eq(found.length, 1);
+    eq(found[0], mark);
+    eq(c.findMarksAt(Pos(1, 1)).length, 1);
+    eqCharPos(mark.find(), Pos(1, 1));
+    b.replaceRange("x\ny\n", Pos(0, 0));
+    eqCharPos(mark.find(), Pos(3, 1));
+    var cleared = 0;
+    CodeMirror.on(mark, "clear", function() {++cleared;});
+    b.operation(function() {mark.clear();});
+    eq(a.findMarks(Pos(0, 0), Pos(5)).length, 0);
+    eq(b.findMarks(Pos(0, 0), Pos(5)).length, 0);
+    eq(c.findMarks(Pos(0, 0), Pos(5)).length, 0);
+    eq(mark.find(), null);
+    eq(cleared, 1);
+  });
+
+  testDoc("undoInSubview", "A='line 0\nline 1\nline 2\nline 3\nline 4' B<A/1-4", function(a, b) {
+    b.replaceRange("x", Pos(2, 0));
+    a.undo();
+    eq(a.getValue(), "line 0\nline 1\nline 2\nline 3\nline 4");
+    eq(b.getValue(), "line 1\nline 2\nline 3");
+  });
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/driver.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,144 @@
+var tests = [], filters = [], nameCounts = {};
+
+function Failure(why) {this.message = why;}
+Failure.prototype.toString = function() { return this.message; };
+
+function indexOf(collection, elt) {
+  if (collection.indexOf) return collection.indexOf(elt);
+  for (var i = 0, e = collection.length; i < e; ++i)
+    if (collection[i] == elt) return i;
+  return -1;
+}
+
+function test(name, run, expectedFail) {
+  // Force unique names
+  if (nameCounts[name] == undefined){
+    nameCounts[name] = 2;
+  } else { 
+    // Append number if not first test with this name.
+    name = name + '_' + (nameCounts[name]++);
+  }
+  // Add test
+  tests.push({name: name, func: run, expectedFail: expectedFail});
+  return name;
+}
+var namespace = "";
+function testCM(name, run, opts, expectedFail) {
+  return test(namespace + name, function() {
+    var place = document.getElementById("testground"), cm = window.cm = CodeMirror(place, opts);
+    var successful = false;
+    try {
+      run(cm);
+      successful = true;
+    } finally {
+      if (!successful || verbose) {
+        place.style.visibility = "visible";
+      } else {
+        place.removeChild(cm.getWrapperElement());
+      }
+    }
+  }, expectedFail);
+}
+
+function runTests(callback) {
+  var totalTime = 0;
+  function step(i) {
+    for (;;) {
+      if (i === tests.length) {
+        running = false;
+        return callback("done");
+      }
+      var test = tests[i], skip = false;
+      if (filters.length) {
+        skip = true;
+        for (var j = 0; j < filters.length; j++)
+          if (test.name.match(filters[j])) skip = false;
+      }
+      if (skip) {
+        callback("skipped", test.name, message);
+        i++;
+      } else {
+        break;
+      }
+    }
+    var expFail = test.expectedFail, startTime = +new Date, threw = false;
+    try {
+      var message = test.func();
+    } catch(e) {
+      threw = true;
+      if (expFail) callback("expected", test.name);
+      else if (e instanceof Failure) callback("fail", test.name, e.message);
+      else {
+        var pos = /(?:\bat |@).*?([^\/:]+):(\d+)/.exec(e.stack);
+        if (pos) console["log"](e.stack);
+        callback("error", test.name, e.toString() + (pos ? " (" + pos[1] + ":" + pos[2] + ")" : ""));
+      }
+    }
+    if (!threw) {
+      if (expFail) callback("fail", test.name, message || "expected failure, but passed");
+      else callback("ok", test.name, message);
+    }
+    if (!quit) { // Run next test
+      var delay = 0;
+      totalTime += (+new Date) - startTime;
+      if (totalTime > 500){
+        totalTime = 0;
+        delay = 50;
+      }
+      setTimeout(function(){step(i + 1);}, delay);
+    } else { // Quit tests
+      running = false;
+      return null;
+    }
+  }
+  step(0);
+}
+
+function label(str, msg) {
+  if (msg) return str + " (" + msg + ")";
+  return str;
+}
+function eq(a, b, msg) {
+  if (a != b) throw new Failure(label(a + " != " + b, msg));
+}
+function notEq(a, b, msg) {
+  if (a == b) throw new Failure(label(a + " == " + b, msg));
+}
+function near(a, b, margin, msg) {
+  if (Math.abs(a - b) > margin)
+    throw new Failure(label(a + " is not close to " + b + " (" + margin + ")", msg));
+}
+function eqCharPos(a, b, msg) {
+  function str(p) { return "{line:" + p.line + ",ch:" + p.ch + ",sticky:" + p.sticky + "}"; }
+  if (a == b) return;
+  if (a == null) throw new Failure(label("comparing null to " + str(b), msg));
+  if (b == null) throw new Failure(label("comparing " + str(a) + " to null", msg));
+  if (a.line != b.line || a.ch != b.ch) throw new Failure(label(str(a) + " != " + str(b), msg));
+}
+function eqCursorPos(a, b, msg) {
+  eqCharPos(a, b, msg);
+  if (a) eq(a.sticky, b.sticky, msg ? msg + ' (sticky)' : 'sticky');
+}
+function is(a, msg) {
+  if (!a) throw new Failure(label("assertion failed", msg));
+}
+
+function countTests() {
+  if (!filters.length) return tests.length;
+  var sum = 0;
+  for (var i = 0; i < tests.length; ++i) {
+    var name = tests[i].name;
+    for (var j = 0; j < filters.length; j++) {
+      if (name.match(filters[j])) {
+        ++sum;
+        break;
+      }
+    }
+  }
+  return sum;
+}
+
+function parseTestFilter(s) {
+  if (/_\*$/.test(s)) return new RegExp("^" + s.slice(0, s.length - 2), "i");
+  else return new RegExp(s, "i");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/emacs_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,158 @@
+(function() {
+  "use strict";
+
+  var Pos = CodeMirror.Pos;
+  namespace = "emacs_";
+
+  var eventCache = {};
+  function fakeEvent(keyName) {
+    var event = eventCache[key];
+    if (event) return event;
+
+    var ctrl, shift, alt;
+    var key = keyName.replace(/\w+-/g, function(type) {
+      if (type == "Ctrl-") ctrl = true;
+      else if (type == "Alt-") alt = true;
+      else if (type == "Shift-") shift = true;
+      return "";
+    });
+    var code;
+    for (var c in CodeMirror.keyNames)
+      if (CodeMirror.keyNames[c] == key) { code = c; break; }
+    if (code == null) throw new Error("Unknown key: " + key);
+
+    return eventCache[keyName] = {
+      type: "keydown", keyCode: code, ctrlKey: ctrl, shiftKey: shift, altKey: alt,
+      preventDefault: function(){}, stopPropagation: function(){}
+    };
+  }
+
+  function sim(name, start /*, actions... */) {
+    var keys = Array.prototype.slice.call(arguments, 2);
+    testCM(name, function(cm) {
+      for (var i = 0; i < keys.length; ++i) {
+        var cur = keys[i];
+        if (cur instanceof Pos) cm.setCursor(cur);
+        else if (cur.call) cur(cm);
+        else cm.triggerOnKeyDown(fakeEvent(cur));
+      }
+    }, {keyMap: "emacs", value: start, mode: "javascript"});
+  }
+
+  function dialog(answer) { return function(cm) { cm.openDialog = function(_, cb) { cb(answer); }; }; }
+
+  function at(line, ch, sticky) { return function(cm) { eqCursorPos(cm.getCursor(), Pos(line, ch, sticky)); }; }
+  function txt(str) { return function(cm) { eq(cm.getValue(), str); }; }
+
+  sim("motionHSimple", "abc", "Ctrl-F", "Ctrl-F", "Ctrl-B", at(0, 1, "after"));
+  sim("motionHMulti", "abcde",
+      "Ctrl-4", "Ctrl-F", at(0, 4, "before"), "Ctrl--", "Ctrl-2", "Ctrl-F", at(0, 2, "after"),
+      "Ctrl-5", "Ctrl-B", at(0, 0, "after"));
+
+  sim("motionHWord", "abc. def ghi",
+      "Alt-F", at(0, 3, "before"), "Alt-F", at(0, 8, "before"),
+      "Ctrl-B", "Alt-B", at(0, 5, "after"), "Alt-B", at(0, 0, "after"));
+  sim("motionHWordMulti", "abc. def ghi ",
+      "Ctrl-3", "Alt-F", at(0, 12, "before"), "Ctrl-2", "Alt-B", at(0, 5, "after"),
+      "Ctrl--", "Alt-B", at(0, 8, "before"));
+
+  sim("motionVSimple", "a\nb\nc\n", "Ctrl-N", "Ctrl-N", "Ctrl-P", at(1, 0, "after"));
+  sim("motionVMulti", "a\nb\nc\nd\ne\n",
+      "Ctrl-2", "Ctrl-N", at(2, 0, "after"), "Ctrl-F", "Ctrl--", "Ctrl-N", at(1, 1, "before"),
+      "Ctrl--", "Ctrl-3", "Ctrl-P", at(4, 1, "before"));
+
+  sim("killYank", "abc\ndef\nghi",
+      "Ctrl-F", "Ctrl-Space", "Ctrl-N", "Ctrl-N", "Ctrl-W", "Ctrl-E", "Ctrl-Y",
+      txt("ahibc\ndef\ng"));
+  sim("killRing", "abcdef",
+      "Ctrl-Space", "Ctrl-F", "Ctrl-W", "Ctrl-Space", "Ctrl-F", "Ctrl-W",
+      "Ctrl-Y", "Alt-Y",
+      txt("acdef"));
+  sim("copyYank", "abcd",
+      "Ctrl-Space", "Ctrl-E", "Alt-W", "Ctrl-Y",
+      txt("abcdabcd"));
+
+  sim("killLineSimple", "foo\nbar", "Ctrl-F", "Ctrl-K", txt("f\nbar"));
+  sim("killLineEmptyLine", "foo\n  \nbar", "Ctrl-N", "Ctrl-K", txt("foo\nbar"));
+  sim("killLineMulti", "foo\nbar\nbaz",
+      "Ctrl-F", "Ctrl-F", "Ctrl-K", "Ctrl-K", "Ctrl-K", "Ctrl-A", "Ctrl-Y",
+      txt("o\nbarfo\nbaz"));
+
+  sim("moveByParagraph", "abc\ndef\n\n\nhij\nklm\n\n",
+      "Ctrl-F", "Ctrl-Down", at(2, 0), "Ctrl-Down", at(6, 0),
+      "Ctrl-N", "Ctrl-Up", at(3, 0), "Ctrl-Up", at(0, 0),
+      Pos(1, 2), "Ctrl-Down", at(2, 0), Pos(4, 2), "Ctrl-Up", at(3, 0));
+  sim("moveByParagraphMulti", "abc\n\ndef\n\nhij\n\nklm",
+      "Ctrl-U", "2", "Ctrl-Down", at(3, 0),
+      "Shift-Alt-.", "Ctrl-3", "Ctrl-Up", at(1, 0));
+
+  sim("moveBySentence", "sentence one! sentence\ntwo\n\nparagraph two",
+      "Alt-E", at(0, 13), "Alt-E", at(1, 3), "Ctrl-F", "Alt-A", at(0, 13));
+
+  sim("moveByExpr", "function foo(a, b) {}",
+      "Ctrl-Alt-F", at(0, 8), "Ctrl-Alt-F", at(0, 12), "Ctrl-Alt-F", at(0, 18),
+      "Ctrl-Alt-B", at(0, 12), "Ctrl-Alt-B", at(0, 9));
+  sim("moveByExprMulti", "foo bar baz bug",
+      "Ctrl-2", "Ctrl-Alt-F", at(0, 7),
+      "Ctrl--", "Ctrl-Alt-F", at(0, 4),
+      "Ctrl--", "Ctrl-2", "Ctrl-Alt-B", at(0, 11));
+  sim("delExpr", "var x = [\n  a,\n  b\n  c\n];",
+      Pos(0, 8), "Ctrl-Alt-K", txt("var x = ;"), "Ctrl-/",
+      Pos(4, 1), "Ctrl-Alt-Backspace", txt("var x = ;"));
+  sim("delExprMulti", "foo bar baz",
+      "Ctrl-2", "Ctrl-Alt-K", txt(" baz"),
+      "Ctrl-/", "Ctrl-E", "Ctrl-2", "Ctrl-Alt-Backspace", txt("foo "));
+
+  sim("justOneSpace", "hi      bye  ",
+      Pos(0, 4), "Alt-Space", txt("hi bye  "),
+      Pos(0, 4), "Alt-Space", txt("hi b ye  "),
+      "Ctrl-A", "Alt-Space", "Ctrl-E", "Alt-Space", txt(" hi b ye "));
+
+  sim("openLine", "foo bar", "Alt-F", "Ctrl-O", txt("foo\n bar"))
+
+  sim("transposeChar", "abcd\ne",
+      "Ctrl-F", "Ctrl-T", "Ctrl-T", txt("bcad\ne"), at(0, 3),
+      "Ctrl-F", "Ctrl-T", "Ctrl-T", "Ctrl-T", txt("bcda\ne"), at(0, 4),
+      "Ctrl-F", "Ctrl-T", txt("bcde\na"), at(1, 1));
+
+  sim("manipWordCase", "foo BAR bAZ",
+      "Alt-C", "Alt-L", "Alt-U", txt("Foo bar BAZ"),
+      "Ctrl-A", "Alt-U", "Alt-L", "Alt-C", txt("FOO bar Baz"));
+  sim("manipWordCaseMulti", "foo Bar bAz",
+      "Ctrl-2", "Alt-U", txt("FOO BAR bAz"),
+      "Ctrl-A", "Ctrl-3", "Alt-C", txt("Foo Bar Baz"));
+
+  sim("upExpr", "foo {\n  bar[];\n  baz(blah);\n}",
+      Pos(2, 7), "Ctrl-Alt-U", at(2, 5), "Ctrl-Alt-U", at(0, 4));
+  sim("transposeExpr", "do foo[bar] dah",
+      Pos(0, 6), "Ctrl-Alt-T", txt("do [bar]foo dah"));
+
+  sim("clearMark", "abcde", Pos(0, 2), "Ctrl-Space", "Ctrl-F", "Ctrl-F",
+      "Ctrl-G", "Ctrl-W", txt("abcde"));
+
+  sim("delRegion", "abcde", "Ctrl-Space", "Ctrl-F", "Ctrl-F", "Delete", txt("cde"));
+  sim("backspaceRegion", "abcde", "Ctrl-Space", "Ctrl-F", "Ctrl-F", "Backspace", txt("cde"));
+
+  sim("backspaceDoesntAddToRing", "foobar", "Ctrl-F", "Ctrl-F", "Ctrl-F", "Ctrl-K", "Backspace", "Backspace", "Ctrl-Y", txt("fbar"));
+
+  sim("gotoLine", "0\n1\n2\n3", dialog("3"), "Alt-G", "G", at(2, 0));
+  sim("gotoInvalidLineFloat", "0\n1\n2\n3", dialog("2.2"), "Alt-G", "G", at(0, 0));
+
+  testCM("gotoDialogTemplate", function(cm) {
+    cm.openDialog = function(template, cb) {
+      var input = template.querySelector("input");
+      eq(template.textContent, "Goto line: ");
+      eq(input.tagName, "INPUT");
+    };
+    cm.triggerOnKeyDown(fakeEvent("Alt-G"));
+    cm.triggerOnKeyDown(fakeEvent("G"));
+  }, {value: "", keyMap: "emacs"});
+
+  testCM("save", function(cm) {
+    var saved = false;
+    CodeMirror.commands.save = function(cm) { saved = cm.getValue(); };
+    cm.triggerOnKeyDown(fakeEvent("Ctrl-X"));
+    cm.triggerOnKeyDown(fakeEvent("Ctrl-S"));
+    is(saved, "hi");
+  }, {value: "hi", keyMap: "emacs"});
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/html-hint-test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,83 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var Pos = CodeMirror.Pos;
+
+  namespace = "html-hint_";
+
+  testData =[
+    {
+      name: "html-element",
+      value: "<htm",
+      list: ["<html"]
+    },
+    {
+      name: "element-close",
+      value: "<a href='#a'>\n</",
+      list: ["</a>"]
+    },
+    {
+      name: "linkref-attribute",
+      value: "<link hreflang='z",
+      from: Pos(0,"<link hreflang=".length),
+      list: ["'zh'","'za'","'zu'"]
+    },
+    {
+      name: "html-completion",
+      value: "<html>\n",
+      list: ["<head","<body","</html>"]
+    }
+  ];
+
+  function escapeHtmlList(o) {
+    return '<code>' +
+      JSON.stringify(o.list,null,2)
+      .replace(/</g, "&lt;")
+      .replace(/>/g, "&gt;") +
+      '</code>'
+  }
+
+  function test(name, spec) {
+    testCM(name, function(cm) {
+      cm.setValue(spec.value);
+      cm.setCursor(spec.cursor);
+      var completion = CodeMirror.hint.html(cm);
+      if (!deepCompare(completion.list, spec.list))
+        throw new Failure("Wrong completion results. Got" +
+          escapeHtmlList(completion) +" but expected" +
+          escapeHtmlList(spec));
+      eqCharPos(completion.from, spec.from,'from-failed');
+      eqCharPos(completion.to, spec.to, 'to-failed');
+    }, {
+      value: spec.value,
+      mode: spec.mode || "text/html"
+    });
+  }
+
+  testData.forEach(function (value) {
+    // Use sane defaults
+    var lines = value.value.split(/\n/);
+    value.to = value.pos || Pos(lines.length-1, lines[lines.length-1].length);
+    value.from = value.from || Pos(lines.length-1,0);
+    value.cursor = value.cursor || value.to;
+    var name = value.name ||value.value;
+    test(name,value)
+  });
+
+  function deepCompare(a, b) {
+    if (a === b) return true;
+    if (!(a && typeof a === "object") ||
+        !(b && typeof b === "object")) return false;
+    var array = a instanceof Array
+    if ((b instanceof Array) !== array) return false;
+    if (array) {
+      if (a.length !== b.length) return false;
+      for (var i = 0; i < a.length; i++) if (!deepCompare(a[i], b[i])) return false
+    } else {
+      for (var p in a) if (!(p in b) || !deepCompare(a[p], b[p])) return false;
+      for (var p in b) if (!(p in a)) return false
+    }
+    return true
+  }
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/index.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,290 @@
+<!doctype html>
+
+<meta charset="utf-8"/>
+<title>CodeMirror: Test Suite</title>
+<link rel=stylesheet href="../doc/docs.css">
+
+<link rel="stylesheet" href="../lib/codemirror.css">
+<link rel="stylesheet" href="mode_test.css">
+<script>
+  var errored = []
+  window.onerror = function(e) { errored.push(e) }
+</script>
+<script src="../doc/activebookmark.js"></script>
+<script src="../lib/codemirror.js"></script>
+<script src="../mode/meta.js"></script>
+<script src="../addon/mode/overlay.js"></script>
+<script src="../addon/mode/multiplex.js"></script>
+<script src="../addon/search/searchcursor.js"></script>
+<script src="../addon/dialog/dialog.js"></script>
+<script src="../addon/edit/matchbrackets.js"></script>
+<script src="../addon/hint/sql-hint.js"></script>
+<script src="../addon/hint/xml-hint.js"></script>
+<script src="../addon/hint/html-hint.js"></script>
+<script src="../addon/comment/comment.js"></script>
+<script src="../addon/mode/simple.js"></script>
+<script src="../mode/css/css.js"></script>
+<script src="../mode/clike/clike.js"></script>
+<!-- clike must be after css or vim and sublime tests will fail -->
+<script src="../mode/clojure/clojure.js"></script>
+<script src="../mode/cypher/cypher.js"></script>
+<script src="../mode/d/d.js"></script>
+<script src="../mode/dockerfile/dockerfile.js"></script>
+<script src="../mode/gfm/gfm.js"></script>
+<script src="../mode/haml/haml.js"></script>
+<script src="../mode/htmlmixed/htmlmixed.js"></script>
+<script src="../mode/javascript/javascript.js"></script>
+<script src="../mode/jsx/jsx.js"></script>
+<script src="../mode/markdown/markdown.js"></script>
+<script src="../mode/php/php.js"></script>
+<script src="../mode/python/python.js"></script>
+<script src="../mode/powershell/powershell.js"></script>
+<script src="../mode/ruby/ruby.js"></script>
+<script src="../mode/sass/sass.js"></script>
+<script src="../mode/shell/shell.js"></script>
+<script src="../mode/slim/slim.js"></script>
+<script src="../mode/soy/soy.js"></script>
+<script src="../mode/sql/sql.js"></script>
+<script src="../mode/stex/stex.js"></script>
+<script src="../mode/swift/swift.js"></script>
+<script src="../mode/textile/textile.js"></script>
+<script src="../mode/verilog/verilog.js"></script>
+<script src="../mode/xml/xml.js"></script>
+<script src="../mode/xquery/xquery.js"></script>
+<script src="../keymap/emacs.js"></script>
+<script src="../keymap/sublime.js"></script>
+<script src="../keymap/vim.js"></script>
+<script src="../mode/rust/rust.js"></script>
+<script src="../mode/mscgen/mscgen.js"></script>
+<script src="../mode/dylan/dylan.js"></script>
+<script src="../mode/wast/wast.js"></script>
+
+<style>
+  .ok { color: #090; }
+  .fail { color: #e00; }
+  .error { color: #c90; }
+  .done { font-weight: bold; }
+  #progress {
+  background: #45d;
+  color: white;
+  text-shadow: 0 0 1px #45d, 0 0 2px #45d, 0 0 3px #45d;
+  font-weight: bold;
+  white-space: pre;
+  }
+  #testground {
+  visibility: hidden;
+  }
+  #testground.offscreen {
+  visibility: visible;
+  position: absolute;
+  left: -10000px;
+  top: -10000px;
+  }
+  .CodeMirror { border: 1px solid black; }
+</style>
+
+<div id=nav>
+  <a href="https://codemirror.net/5"><h1>CodeMirror</h1><img id=logo src="../doc/logo.png"></a>
+
+  <ul>
+    <li><a href="../index.html">Home</a>
+    <li><a href="../doc/manual.html">Manual</a>
+    <li><a href="https://github.com/codemirror/codemirror5">Code</a>
+  </ul>
+  <ul>
+    <li><a class=active href="#">Test suite</a>
+  </ul>
+</div>
+
+<article>
+  <h2>Test Suite</h2>
+
+    <p>A limited set of programmatic sanity tests for CodeMirror.</p>
+
+    <div style="border: 1px solid black; padding: 1px; max-width: 700px;">
+      <div style="width: 0px;" id=progress><div style="padding: 3px;">Ran <span id="progress_ran">0</span><span id="progress_total"> of 0</span> tests</div></div>
+    </div>
+    <p id=status>Please enable JavaScript...</p>
+    <div id=output></div>
+
+    <div id=testground></div>
+
+    <script src="driver.js"></script>
+    <script src="test.js"></script>
+    <script src="doc_test.js"></script>
+    <script src="multi_test.js"></script>
+    <script src="contenteditable_test.js"></script>
+    <script src="scroll_test.js"></script>
+    <script src="comment_test.js"></script>
+    <script src="search_test.js"></script>
+    <script src="mode_test.js"></script>
+
+    <script src="../mode/clike/test.js"></script>
+    <script src="../mode/clojure/test.js"></script>
+    <script src="../mode/css/test.js"></script>
+    <script src="../mode/css/gss_test.js"></script>
+    <script src="../mode/css/scss_test.js"></script>
+    <script src="../mode/css/less_test.js"></script>
+    <script src="../mode/cypher/test.js"></script>
+    <script src="../mode/d/test.js"></script>
+    <script src="../mode/dockerfile/test.js"></script>
+    <script src="../mode/gfm/test.js"></script>
+    <script src="../mode/haml/test.js"></script>
+    <script src="../mode/javascript/test.js"></script>
+    <script src="../mode/jsx/test.js"></script>
+    <script src="../mode/markdown/test.js"></script>
+    <script src="../mode/php/test.js"></script>
+    <script src="../mode/powershell/test.js"></script>
+    <script src="../mode/ruby/test.js"></script>
+    <script src="../mode/sass/test.js"></script>
+    <script src="../mode/shell/test.js"></script>
+    <script src="../mode/slim/test.js"></script>
+    <script src="../mode/soy/test.js"></script>
+    <script src="../mode/stex/test.js"></script>
+    <script src="../mode/swift/test.js"></script>
+    <script src="../mode/textile/test.js"></script>
+    <script src="../mode/verilog/test.js"></script>
+    <script src="../mode/xml/test.js"></script>
+    <script src="../mode/xquery/test.js"></script>
+    <script src="../mode/python/test.js"></script>
+    <script src="../mode/rust/test.js"></script>
+    <script src="../mode/wast/test.js"></script>
+    <script src="../mode/mscgen/mscgen_test.js"></script>
+    <script src="../mode/mscgen/xu_test.js"></script>
+    <script src="../mode/mscgen/msgenny_test.js"></script>
+    <script src="../mode/dylan/test.js"></script>
+    <script src="../addon/mode/multiplex_test.js"></script>
+    <script src="../addon/fold/foldcode.js"></script>
+    <script src="../addon/fold/brace-fold.js"></script>
+    <script src="../addon/fold/xml-fold.js"></script>
+    <script src="../addon/scroll/annotatescrollbar.js"></script>
+
+    <script src="emacs_test.js"></script>
+    <script src="sql-hint-test.js"></script>
+    <script src="sublime_test.js"></script>
+    <script src="html-hint-test.js"></script>
+    <script src="annotatescrollbar.js"></script>
+    <script>
+      window.onload = runHarness;
+      CodeMirror.on(window, 'hashchange', runHarness);
+
+      function esc(str) {
+        return str.replace(/[<&]/, function(ch) { return ch == "<" ? "&lt;" : "&amp;"; });
+      }
+
+      var output = document.getElementById("output"),
+          progress = document.getElementById("progress"),
+          progressRan = document.getElementById("progress_ran").childNodes[0],
+          progressTotal = document.getElementById("progress_total").childNodes[0];
+      var count = 0,
+          failed = 0,
+          skipped = 0,
+          bad = "",
+          running = false, // Flag that states tests are running
+          quit = false, // Flag to quit tests ASAP
+          verbose = false, // Adds message for *every* test to output
+          done = false
+
+      function runHarness(){
+        if (running) {
+          quit = true;
+          setStatus("Restarting tests...", '', true);
+          setTimeout(function(){ runHarness(); }, 500);
+          return;
+        }
+        filters = [];
+        verbose = false;
+        if (window.location.hash.substr(1)){
+          var strings = window.location.hash.substr(1).split(",");
+          while (strings.length) {
+            var s = strings.shift();
+            if (s === "verbose")
+              verbose = true;
+            else
+              filters.push(parseTestFilter(decodeURIComponent(s)));
+          }
+        }
+        quit = false;
+        running = true;
+        setStatus("Loading tests...");
+        count = 0;
+        failed = 0;
+        done = false;
+        skipped = 0;
+        bad = "";
+        totalTests = countTests();
+        progressTotal.nodeValue = " of " + totalTests;
+        progressRan.nodeValue = count;
+        output.innerHTML = '';
+        document.getElementById("testground").innerHTML = "<form>" +
+          "<textarea id=\"code\" name=\"code\"></textarea>" +
+          "<input type=submit value=ok name=submit>" +
+          "</form>";
+        runTests(displayTest);
+      }
+
+      function setStatus(message, className, force){
+        if (quit && !force) return;
+        if (!message) throw("must provide message");
+        var status = document.getElementById("status").childNodes[0];
+        status.nodeValue = message;
+        status.parentNode.className = className;
+      }
+      function addOutput(name, className, code){
+        var newOutput = document.createElement("dl");
+        var newTitle = document.createElement("dt");
+        newTitle.className = className;
+        newTitle.appendChild(document.createTextNode(name));
+        newOutput.appendChild(newTitle);
+        var newMessage = document.createElement("dd");
+        newMessage.innerHTML = code;
+        newOutput.appendChild(newTitle);
+        newOutput.appendChild(newMessage);
+        output.appendChild(newOutput);
+      }
+      function displayTest(type, name, customMessage) {
+        var message = "???";
+        if (type != "done" && type != "skipped") ++count;
+        progress.style.width = (count * (progress.parentNode.clientWidth - 2) / (totalTests || 1)) + "px";
+        progressRan.nodeValue = count;
+        if (type == "ok") {
+          message = "Test '" + name + "' passed";
+          if (!verbose) customMessage = false;
+        } else if (type == "skipped") {
+          message = "Test '" + name + "' skipped";
+          ++skipped;
+          if (!verbose) customMessage = false;
+        } else if (type == "expected") {
+          message = "Test '" + name + "' failed as expected";
+          if (!verbose) customMessage = false;
+        } else if (type == "error" || type == "fail") {
+          ++failed;
+          message = "Test '" + name + "' failed";
+        } else if (type == "done") {
+          if (failed) {
+            type += " fail";
+            message = failed + " failure" + (failed > 1 ? "s" : "");
+          } else if (count < totalTests) {
+            failed = totalTests - count;
+            type += " fail";
+            message = failed + " failure" + (failed > 1 ? "s" : "");
+          } else {
+            type += " ok";
+            message = "All passed"
+            if (skipped) {
+              message += " (" + skipped + " skipped)";
+            }
+          }
+          done = true
+          progressTotal.nodeValue = '';
+          customMessage = true; // Hack to avoid adding to output
+        }
+        if (verbose && !customMessage)  customMessage = message;
+        setStatus(message, type);
+        if (customMessage && customMessage.length > 0) {
+          addOutput(name, type, customMessage);
+        }
+      }
+    </script>
+
+</article>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/lint.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,21 @@
+var blint = require("blint");
+
+["mode", "lib", "addon", "keymap"].forEach(function(dir) {
+  blint.checkDir(dir, {
+    browser: true,
+    allowedGlobals: ["CodeMirror", "define", "test", "requirejs", "globalThis", "WeakSet"],
+    ecmaVersion: 5,
+    tabs: dir == "lib"
+  });
+});
+
+["src"].forEach(function(dir) {
+  blint.checkDir(dir, {
+    browser: true,
+    allowedGlobals: ["WeakSet"],
+    ecmaVersion: 6,
+    semicolons: false
+  });
+});
+
+module.exports = {ok: blint.success()};
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/mode_test.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+.mt-output .mt-token {
+  border: 1px solid #ddd;
+  white-space: pre;
+  font-family: "Consolas", monospace;
+  text-align: center;
+}
+
+.mt-output .mt-style {
+  font-size: x-small;
+}
+
+.mt-output .mt-state {
+  font-size: x-small;
+  vertical-align: top;
+}
+
+.mt-output .mt-state-row {
+  display: none;
+}
+
+.mt-state-unhide .mt-output .mt-state-row {
+  display: table-row;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/mode_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,193 @@
+/**
+ * Helper to test CodeMirror highlighting modes. It pretty prints output of the
+ * highlighter and can check against expected styles.
+ *
+ * Mode tests are registered by calling test.mode(testName, mode,
+ * tokens), where mode is a mode object as returned by
+ * CodeMirror.getMode, and tokens is an array of lines that make up
+ * the test.
+ *
+ * These lines are strings, in which styled stretches of code are
+ * enclosed in brackets `[]`, and prefixed by their style. For
+ * example, `[keyword if]`. Brackets in the code itself must be
+ * duplicated to prevent them from being interpreted as token
+ * boundaries. For example `a[[i]]` for `a[i]`. If a token has
+ * multiple styles, the styles must be separated by ampersands, for
+ * example `[tag&error </hmtl>]`.
+ *
+ * See the test.js files in the css, markdown, gfm, and stex mode
+ * directories for examples.
+ */
+(function() {
+  function findSingle(str, pos, ch) {
+    for (;;) {
+      var found = str.indexOf(ch, pos);
+      if (found == -1) return null;
+      if (str.charAt(found + 1) != ch) return found;
+      pos = found + 2;
+    }
+  }
+
+  var styleName = /[\w&-_]+/g;
+  function parseTokens(strs) {
+    var tokens = [], plain = "";
+    for (var i = 0; i < strs.length; ++i) {
+      if (i) plain += "\n";
+      var str = strs[i], pos = 0;
+      while (pos < str.length) {
+        var style = null, text;
+        if (str.charAt(pos) == "[" && str.charAt(pos+1) != "[") {
+          styleName.lastIndex = pos + 1;
+          var m = styleName.exec(str);
+          style = m[0].replace(/&/g, " ");
+          var textStart = pos + style.length + 2;
+          var end = findSingle(str, textStart, "]");
+          if (end == null) throw new Error("Unterminated token at " + pos + " in '" + str + "'" + style);
+          text = str.slice(textStart, end);
+          pos = end + 1;
+        } else {
+          var end = findSingle(str, pos, "[");
+          if (end == null) end = str.length;
+          text = str.slice(pos, end);
+          pos = end;
+        }
+        text = text.replace(/\[\[|\]\]/g, function(s) {return s.charAt(0);});
+        tokens.push({style: style, text: text});
+        plain += text;
+      }
+    }
+    return {tokens: tokens, plain: plain};
+  }
+
+  test.mode = function(name, mode, tokens, modeName) {
+    var data = parseTokens(tokens);
+    return test((modeName || mode.name) + "_" + name, function() {
+      return compare(data.plain, data.tokens, mode);
+    });
+  };
+
+  function esc(str) {
+    return str.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#039;");
+  }
+
+  function compare(text, expected, mode) {
+
+    var expectedOutput = [];
+    for (var i = 0; i < expected.length; ++i) {
+      var sty = expected[i].style;
+      if (sty && sty.indexOf(" ")) sty = sty.split(' ').sort().join(' ');
+      expectedOutput.push({style: sty, text: expected[i].text});
+    }
+
+    var observedOutput = highlight(text, mode);
+
+    var s = "";
+    var diff = highlightOutputsDifferent(expectedOutput, observedOutput);
+    if (diff != null) {
+      s += '<div class="mt-test mt-fail">';
+      s +=   '<pre>' + esc(text) + '</pre>';
+      s +=   '<div class="cm-s-default">';
+      s += 'expected:';
+      s +=   prettyPrintOutputTable(expectedOutput, diff);
+      s += 'observed: [<a onclick="this.parentElement.className+=\' mt-state-unhide\'">display states</a>]';
+      s +=   prettyPrintOutputTable(observedOutput, diff);
+      s +=   '</div>';
+      s += '</div>';
+    }
+    if (observedOutput.indentFailures) {
+      for (var i = 0; i < observedOutput.indentFailures.length; i++)
+        s += "<div class='mt-test mt-fail'>" + esc(observedOutput.indentFailures[i]) + "</div>";
+    }
+    if (s) throw new Failure(s);
+  }
+
+  function stringify(obj) {
+    function replacer(key, obj) {
+      if (typeof obj == "function") {
+        var m = obj.toString().match(/function\s*[^\s(]*/);
+        return m ? m[0] : "function";
+      }
+      return obj;
+    }
+    if (window.JSON && JSON.stringify)
+      return JSON.stringify(obj, replacer, 2);
+    return "[unsupported]";  // Fail safely if no native JSON.
+  }
+
+  function highlight(string, mode) {
+    var state = mode.startState();
+
+    var lines = string.replace(/\r\n/g,'\n').split('\n');
+    var st = [], pos = 0;
+    for (var i = 0; i < lines.length; ++i) {
+      var line = lines[i], newLine = true;
+      if (mode.indent) {
+        var ws = line.match(/^\s*/)[0];
+        var indent = mode.indent(state, line.slice(ws.length), line);
+        if (indent != CodeMirror.Pass && indent != ws.length)
+          (st.indentFailures || (st.indentFailures = [])).push(
+            "Indentation of line " + (i + 1) + " is " + indent + " (expected " + ws.length + ")");
+      }
+      var stream = new CodeMirror.StringStream(line, 4, {
+        lookAhead: function(n) { return lines[i + n] }
+      });
+      if (line == "" && mode.blankLine) mode.blankLine(state);
+      /* Start copied code from CodeMirror.highlight */
+      while (!stream.eol()) {
+        for (var j = 0; j < 10 && stream.start >= stream.pos; j++)
+          var compare = mode.token(stream, state);
+        if (j == 10)
+          throw new Failure("Failed to advance the stream." + stream.string + " " + stream.pos);
+        var substr = stream.current();
+        if (compare && compare.indexOf(" ") > -1) compare = compare.split(' ').sort().join(' ');
+        stream.start = stream.pos;
+        if (pos && st[pos-1].style == compare && !newLine) {
+          st[pos-1].text += substr;
+        } else if (substr) {
+          st[pos++] = {style: compare, text: substr, state: stringify(state)};
+        }
+        // Give up when line is ridiculously long
+        if (stream.pos > 5000) {
+          st[pos++] = {style: null, text: this.text.slice(stream.pos)};
+          break;
+        }
+        newLine = false;
+      }
+    }
+
+    return st;
+  }
+
+  function highlightOutputsDifferent(o1, o2) {
+    var minLen = Math.min(o1.length, o2.length);
+    for (var i = 0; i < minLen; ++i)
+      if (o1[i].style != o2[i].style || o1[i].text != o2[i].text) return i;
+    if (o1.length > minLen || o2.length > minLen) return minLen;
+  }
+
+  function prettyPrintOutputTable(output, diffAt) {
+    var s = '<table class="mt-output">';
+    s += '<tr>';
+    for (var i = 0; i < output.length; ++i) {
+      var style = output[i].style, val = output[i].text;
+      s +=
+      '<td class="mt-token"' + (i == diffAt ? " style='background: pink'" : "") + '>' +
+        '<span class="cm-' + esc(String(style)) + '">' +
+        esc(val.replace(/ /g,'\xb7')) +  // · MIDDLE DOT
+        '</span>' +
+        '</td>';
+    }
+    s += '</tr><tr>';
+    for (var i = 0; i < output.length; ++i) {
+      s += '<td class="mt-style"><span>' + (output[i].style || null) + '</span></td>';
+    }
+    if(output[0].state) {
+      s += '</tr><tr class="mt-state-row" title="State AFTER each token">';
+      for (var i = 0; i < output.length; ++i) {
+        s += '<td class="mt-state"><pre>' + esc(output[i].state) + '</pre></td>';
+      }
+    }
+    s += '</tr></table>';
+    return s;
+  }
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/multi_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,295 @@
+(function() {
+  namespace = "multi_";
+
+  function hasSelections(cm) {
+    var sels = cm.listSelections();
+    var given = (arguments.length - 1) / 4;
+    if (sels.length != given)
+      throw new Failure("expected " + given + " selections, found " + sels.length);
+    for (var i = 0, p = 1; i < given; i++, p += 4) {
+      var anchor = Pos(arguments[p], arguments[p + 1]);
+      var head = Pos(arguments[p + 2], arguments[p + 3]);
+      eqCharPos(sels[i].anchor, anchor, "anchor of selection " + i);
+      eqCharPos(sels[i].head, head, "head of selection " + i);
+    }
+  }
+  function hasCursors(cm) {
+    var sels = cm.listSelections();
+    var given = (arguments.length - 1) / 2;
+    if (sels.length != given)
+      throw new Failure("expected " + given + " selections, found " + sels.length);
+    for (var i = 0, p = 1; i < given; i++, p += 2) {
+      eqCursorPos(sels[i].anchor, sels[i].head, "something selected for " + i);
+      var head = Pos(arguments[p], arguments[p + 1]);
+      eqCharPos(sels[i].head, head, "selection " + i);
+    }
+  }
+
+  testCM("getSelection", function(cm) {
+    select(cm, {anchor: Pos(0, 0), head: Pos(1, 2)}, {anchor: Pos(2, 2), head: Pos(2, 0)});
+    eq(cm.getSelection(), "1234\n56\n90");
+    eq(cm.getSelection(false).join("|"), "1234|56|90");
+    eq(cm.getSelections().join("|"), "1234\n56|90");
+  }, {value: "1234\n5678\n90"});
+
+  testCM("setSelection", function(cm) {
+    select(cm, Pos(3, 0), Pos(0, 0), {anchor: Pos(2, 5), head: Pos(1, 0)});
+    hasSelections(cm, 0, 0, 0, 0,
+                  2, 5, 1, 0,
+                  3, 0, 3, 0);
+    cm.setSelection(Pos(1, 2), Pos(1, 1));
+    hasSelections(cm, 1, 2, 1, 1);
+    select(cm, {anchor: Pos(1, 1), head: Pos(2, 4)},
+           {anchor: Pos(0, 0), head: Pos(1, 3)},
+           Pos(3, 0), Pos(2, 2));
+    hasSelections(cm, 0, 0, 2, 4,
+                  3, 0, 3, 0);
+    cm.setSelections([{anchor: Pos(0, 1), head: Pos(0, 2)},
+                      {anchor: Pos(1, 1), head: Pos(1, 2)},
+                      {anchor: Pos(2, 1), head: Pos(2, 2)}], 1);
+    eqCharPos(cm.getCursor("head"), Pos(1, 2));
+    eqCharPos(cm.getCursor("anchor"), Pos(1, 1));
+    eqCharPos(cm.getCursor("from"), Pos(1, 1));
+    eqCharPos(cm.getCursor("to"), Pos(1, 2));
+    cm.setCursor(Pos(1, 1));
+    hasCursors(cm, 1, 1);
+  }, {value: "abcde\nabcde\nabcde\n"});
+
+  testCM("somethingSelected", function(cm) {
+    select(cm, Pos(0, 1), {anchor: Pos(0, 3), head: Pos(0, 5)});
+    eq(cm.somethingSelected(), true);
+    select(cm, Pos(0, 1), Pos(0, 3), Pos(0, 5));
+    eq(cm.somethingSelected(), false);
+  }, {value: "123456789"});
+
+  testCM("extendSelection", function(cm) {
+    select(cm, Pos(0, 1), Pos(1, 1), Pos(2, 1));
+    cm.setExtending(true);
+    cm.extendSelections([Pos(0, 2), Pos(1, 0), Pos(2, 3)]);
+    hasSelections(cm, 0, 1, 0, 2,
+                  1, 1, 1, 0,
+                  2, 1, 2, 3);
+    cm.extendSelection(Pos(2, 4), Pos(2, 0));
+    hasSelections(cm, 2, 4, 2, 0);
+  }, {value: "1234\n1234\n1234"});
+
+  testCM("addSelection", function(cm) {
+    select(cm, Pos(0, 1), Pos(1, 1));
+    cm.addSelection(Pos(0, 0), Pos(0, 4));
+    hasSelections(cm, 0, 0, 0, 4,
+                  1, 1, 1, 1);
+    cm.addSelection(Pos(2, 2));
+    hasSelections(cm, 0, 0, 0, 4,
+                  1, 1, 1, 1,
+                  2, 2, 2, 2);
+  }, {value: "1234\n1234\n1234"});
+
+  testCM("replaceSelection", function(cm) {
+    var selections = [{anchor: Pos(0, 0), head: Pos(0, 1)},
+                      {anchor: Pos(0, 2), head: Pos(0, 3)},
+                      {anchor: Pos(0, 4), head: Pos(0, 5)},
+                      {anchor: Pos(2, 1), head: Pos(2, 4)},
+                      {anchor: Pos(2, 5), head: Pos(2, 6)}];
+    var val = "123456\n123456\n123456";
+    cm.setValue(val);
+    cm.setSelections(selections);
+    cm.replaceSelection("ab", "around");
+    eq(cm.getValue(), "ab2ab4ab6\n123456\n1ab5ab");
+    hasSelections(cm, 0, 0, 0, 2,
+                  0, 3, 0, 5,
+                  0, 6, 0, 8,
+                  2, 1, 2, 3,
+                  2, 4, 2, 6);
+    cm.setValue(val);
+    cm.setSelections(selections);
+    cm.replaceSelection("", "around");
+    eq(cm.getValue(), "246\n123456\n15");
+    hasSelections(cm, 0, 0, 0, 0,
+                  0, 1, 0, 1,
+                  0, 2, 0, 2,
+                  2, 1, 2, 1,
+                  2, 2, 2, 2);
+    cm.setValue(val);
+    cm.setSelections(selections);
+    cm.replaceSelection("X\nY\nZ", "around");
+    hasSelections(cm, 0, 0, 2, 1,
+                  2, 2, 4, 1,
+                  4, 2, 6, 1,
+                  8, 1, 10, 1,
+                  10, 2, 12, 1);
+    cm.replaceSelection("a", "around");
+    hasSelections(cm, 0, 0, 0, 1,
+                  0, 2, 0, 3,
+                  0, 4, 0, 5,
+                  2, 1, 2, 2,
+                  2, 3, 2, 4);
+    cm.replaceSelection("xy", "start");
+    hasSelections(cm, 0, 0, 0, 0,
+                  0, 3, 0, 3,
+                  0, 6, 0, 6,
+                  2, 1, 2, 1,
+                  2, 4, 2, 4);
+    cm.replaceSelection("z\nf");
+    hasSelections(cm, 1, 1, 1, 1,
+                  2, 1, 2, 1,
+                  3, 1, 3, 1,
+                  6, 1, 6, 1,
+                  7, 1, 7, 1);
+    eq(cm.getValue(), "z\nfxy2z\nfxy4z\nfxy6\n123456\n1z\nfxy5z\nfxy");
+  });
+
+  function select(cm) {
+    var sels = [];
+    for (var i = 1; i < arguments.length; i++) {
+      var arg = arguments[i];
+      if (arg.head) sels.push(arg);
+      else sels.push({head: arg, anchor: arg});
+    }
+    cm.setSelections(sels, sels.length - 1);
+  }
+
+  testCM("indentSelection", function(cm) {
+    select(cm, Pos(0, 1), Pos(1, 1));
+    cm.indentSelection(4);
+    eq(cm.getValue(), "    foo\n    bar\nbaz");
+
+    select(cm, Pos(0, 2), Pos(0, 3), Pos(0, 4));
+    cm.indentSelection(-2);
+    eq(cm.getValue(), "  foo\n    bar\nbaz");
+
+    select(cm, {anchor: Pos(0, 0), head: Pos(1, 2)},
+           {anchor: Pos(1, 3), head: Pos(2, 0)});
+    cm.indentSelection(-2);
+    eq(cm.getValue(), "foo\n  bar\nbaz");
+  }, {value: "foo\nbar\nbaz"});
+
+  testCM("killLine", function(cm) {
+    select(cm, Pos(0, 1), Pos(0, 2), Pos(1, 1));
+    cm.execCommand("killLine");
+    eq(cm.getValue(), "f\nb\nbaz");
+    cm.execCommand("killLine");
+    eq(cm.getValue(), "fbbaz");
+    cm.setValue("foo\nbar\nbaz");
+    select(cm, Pos(0, 1), {anchor: Pos(0, 2), head: Pos(2, 1)});
+    cm.execCommand("killLine");
+    eq(cm.getValue(), "faz");
+  }, {value: "foo\nbar\nbaz"});
+
+  testCM("deleteLine", function(cm) {
+    select(cm, Pos(0, 0),
+           {head: Pos(0, 1), anchor: Pos(2, 0)},
+           Pos(4, 0));
+    cm.execCommand("deleteLine");
+    eq(cm.getValue(), "4\n6\n7");
+    select(cm, Pos(2, 1));
+    cm.execCommand("deleteLine");
+    eq(cm.getValue(), "4\n6\n");
+  }, {value: "1\n2\n3\n4\n5\n6\n7"});
+
+  testCM("deleteH", function(cm) {
+    select(cm, Pos(0, 4), {anchor: Pos(1, 4), head: Pos(1, 5)});
+    cm.execCommand("delWordAfter");
+    eq(cm.getValue(), "foo bar baz\nabc ef ghi\n");
+    cm.execCommand("delWordAfter");
+    eq(cm.getValue(), "foo  baz\nabc  ghi\n");
+    cm.execCommand("delCharBefore");
+    cm.execCommand("delCharBefore");
+    eq(cm.getValue(), "fo baz\nab ghi\n");
+    select(cm, Pos(0, 3), Pos(0, 4), Pos(0, 5));
+    cm.execCommand("delWordAfter");
+    eq(cm.getValue(), "fo \nab ghi\n");
+  }, {value: "foo bar baz\nabc def ghi\n"});
+
+  testCM("goLineStart", function(cm) {
+    select(cm, Pos(0, 2), Pos(0, 3), Pos(1, 1));
+    cm.execCommand("goLineStart");
+    hasCursors(cm, 0, 0, 1, 0);
+    select(cm, Pos(1, 1), Pos(0, 1));
+    cm.setExtending(true);
+    cm.execCommand("goLineStart");
+    hasSelections(cm, 0, 1, 0, 0,
+                  1, 1, 1, 0);
+  }, {value: "foo\nbar\nbaz"});
+
+  testCM("moveV", function(cm) {
+    select(cm, Pos(0, 2), Pos(1, 2));
+    cm.execCommand("goLineDown");
+    hasCursors(cm, 1, 2, 2, 2);
+    cm.execCommand("goLineUp");
+    hasCursors(cm, 0, 2, 1, 2);
+    cm.execCommand("goLineUp");
+    hasCursors(cm, 0, 0, 0, 2);
+    cm.execCommand("goLineUp");
+    hasCursors(cm, 0, 0);
+    select(cm, Pos(0, 2), Pos(1, 2));
+    cm.setExtending(true);
+    cm.execCommand("goLineDown");
+    hasSelections(cm, 0, 2, 2, 2);
+  }, {value: "12345\n12345\n12345"});
+
+  testCM("moveH", function(cm) {
+    select(cm, Pos(0, 1), Pos(0, 3), Pos(0, 5), Pos(2, 3));
+    cm.execCommand("goCharRight");
+    hasCursors(cm, 0, 2, 0, 4, 1, 0, 2, 4);
+    cm.execCommand("goCharLeft");
+    hasCursors(cm, 0, 1, 0, 3, 0, 5, 2, 3);
+    for (var i = 0; i < 15; i++)
+      cm.execCommand("goCharRight");
+    hasCursors(cm, 2, 4, 2, 5);
+  }, {value: "12345\n12345\n12345"});
+
+  testCM("newlineAndIndent", function(cm) {
+    select(cm, Pos(0, 5), Pos(1, 5));
+    cm.execCommand("newlineAndIndent");
+    hasCursors(cm, 1, 2, 3, 2);
+    eq(cm.getValue(), "x = [\n  1];\ny = [\n  2];");
+    cm.undo();
+    eq(cm.getValue(), "x = [1];\ny = [2];");
+    hasCursors(cm, 0, 5, 1, 5);
+    select(cm, Pos(0, 5), Pos(0, 6));
+    cm.execCommand("newlineAndIndent");
+    hasCursors(cm, 1, 2, 2, 0);
+    eq(cm.getValue(), "x = [\n  1\n];\ny = [2];");
+  }, {value: "x = [1];\ny = [2];", mode: "javascript"});
+
+  testCM("goDocStartEnd", function(cm) {
+    select(cm, Pos(0, 1), Pos(1, 1));
+    cm.execCommand("goDocStart");
+    hasCursors(cm, 0, 0);
+    select(cm, Pos(0, 1), Pos(1, 1));
+    cm.execCommand("goDocEnd");
+    hasCursors(cm, 1, 3);
+    select(cm, Pos(0, 1), Pos(1, 1));
+    cm.setExtending(true);
+    cm.execCommand("goDocEnd");
+    hasSelections(cm, 1, 1, 1, 3);
+  }, {value: "abc\ndef"});
+
+  testCM("selectionHistory", function(cm) {
+    for (var i = 0; i < 3; ++i)
+      cm.addSelection(Pos(0, i * 2), Pos(0, i * 2 + 1));
+    cm.execCommand("undoSelection");
+    eq(cm.getSelection(), "1\n2");
+    cm.execCommand("undoSelection");
+    eq(cm.getSelection(), "1");
+    cm.execCommand("undoSelection");
+    eq(cm.getSelection(), "");
+    eqCharPos(cm.getCursor(), Pos(0, 0));
+    cm.execCommand("redoSelection");
+    eq(cm.getSelection(), "1");
+    cm.execCommand("redoSelection");
+    eq(cm.getSelection(), "1\n2");
+    cm.execCommand("redoSelection");
+    eq(cm.getSelection(), "1\n2\n3");
+  }, {value: "1 2 3"});
+
+  testCM("selectionsMayTouch", function(cm) {
+    select(cm, Pos(0, 0), Pos(0, 2))
+    cm.setExtending(true);
+    cm.extendSelections([Pos(0, 2), Pos(0, 4)])
+    hasSelections(cm, 0, 0, 0, 2,
+                  0, 2, 0, 4)
+    cm.extendSelections([Pos(0, 3), Pos(0, 4)])
+    hasSelections(cm, 0, 0, 0, 4)
+  }, {selectionsMayTouch: true, value: "1234"})
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/run.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,41 @@
+#!/usr/bin/env node
+
+var lint = require("./lint");
+
+var files = new (require('node-static').Server)();
+
+var server = require('http').createServer(function (req, res) {
+  req.addListener('end', function () {
+    files.serve(req, res, function (err/*, result */) {
+      if (err) {
+        console.error(err);
+        process.exit(1);
+      }
+    });
+  }).resume();
+}).addListener('error', function (err) {
+  throw err;
+}).listen(3000,(async () => {
+  const puppeteer = require('puppeteer');
+  const browser = await puppeteer.launch({args: ["--no-sandbox", "--disable-setuid-sandbox"]})
+  const page = await browser.newPage()
+  page.on('console', msg => console.log("console:", msg.text()))
+  page.on('dialog', async dialog => {
+    console.log(dialog.message())
+    await dialog.dismiss()
+  })
+  page.evaluateOnNewDocument(() => window.automatedTests = true)
+  await page.goto('http://localhost:3000/test/index.html#' + (process.argv[2] || ""))
+  while(1) {
+    if (await page.evaluate(() => window.done)) break
+    await sleep(200)
+  }
+  let [failed, errors] = await page.evaluate(() => [window.failed, window.errored])
+  for (let error of errors) console.log(error)
+  console.log(await page.evaluate(() => document.getElementById('output').innerText + "\n" +
+                                          document.getElementById('status').innerText))
+  process.exit(failed > 0 || errors.length || !lint.ok ? 1 : 0)
+  await browser.close()
+})())
+
+function sleep(n) { return new Promise(acc => setTimeout(acc, n)) }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/scroll_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,126 @@
+(function() {
+  "use strict";
+
+  namespace = "scroll_";
+
+  testCM("bars_hidden", function(cm) {
+    for (var i = 0;; i++) {
+      var wrapBox = cm.getWrapperElement().getBoundingClientRect();
+      var scrollBox = cm.getScrollerElement().getBoundingClientRect();
+      is(wrapBox.bottom < scrollBox.bottom - 10);
+      is(wrapBox.right < scrollBox.right - 10);
+      if (i == 1) break;
+      cm.getWrapperElement().style.height = "auto";
+      cm.refresh();
+    }
+  });
+  
+  function barH(cm) { return byClassName(cm.getWrapperElement(), "CodeMirror-hscrollbar")[0]; }
+  function barV(cm) { return byClassName(cm.getWrapperElement(), "CodeMirror-vscrollbar")[0]; }
+
+  function displayBottom(cm, scrollbar) {
+    if (scrollbar && cm.display.scroller.offsetHeight > cm.display.scroller.clientHeight)
+      return barH(cm).getBoundingClientRect().top;
+    else
+      return cm.getWrapperElement().getBoundingClientRect().bottom - 1;
+  }
+
+  function displayRight(cm, scrollbar) {
+    if (scrollbar && cm.display.scroller.offsetWidth > cm.display.scroller.clientWidth)
+      return barV(cm).getBoundingClientRect().left;
+    else
+      return cm.getWrapperElement().getBoundingClientRect().right - 1;
+  }
+
+  function testMovedownFixed(cm, hScroll) {
+    cm.setSize("100px", "100px");
+    if (hScroll) cm.setValue(new Array(100).join("x"));
+    var bottom = displayBottom(cm, hScroll);
+    for (var i = 0; i < 30; i++) {
+      cm.replaceSelection("x\n");
+      var cursorBottom = cm.cursorCoords(null, "window").bottom;
+      is(cursorBottom <= bottom);
+    }
+    is(cursorBottom >= bottom - 5);
+  }
+
+  testCM("movedown_fixed", function(cm) {testMovedownFixed(cm, false);});
+  testCM("movedown_hscroll_fixed", function(cm) {testMovedownFixed(cm, true);});
+
+  function testMovedownResize(cm, hScroll) {
+    cm.getWrapperElement().style.height = "auto";
+    if (hScroll) cm.setValue(new Array(100).join("x"));
+    cm.refresh();
+    for (var i = 0; i < 30; i++) {
+      cm.replaceSelection("x\n");
+      var bottom = displayBottom(cm, hScroll);
+      var cursorBottom = cm.cursorCoords(null, "window").bottom;
+      is(cursorBottom <= bottom);
+      is(cursorBottom >= bottom - 5);
+    }
+  }
+
+  testCM("movedown_resize", function(cm) {testMovedownResize(cm, false);});
+  testCM("movedown_hscroll_resize", function(cm) {testMovedownResize(cm, true);});
+
+  function testMoveright(cm, wrap, scroll) {
+    cm.setSize("100px", "100px");
+    if (wrap) cm.setOption("lineWrapping", true);
+    if (scroll) {
+      cm.setValue("\n" + new Array(100).join("x\n"));
+      cm.setCursor(Pos(0, 0));
+    }
+    var right = displayRight(cm, scroll);
+    for (var i = 0; i < 10; i++) {
+      cm.replaceSelection("xxxxxxxxxx");
+      var cursorRight = cm.cursorCoords(null, "window").right;
+      is(cursorRight < right);
+    }
+    if (!wrap) is(cursorRight > right - 20);
+  }
+
+  testCM("moveright", function(cm) {testMoveright(cm, false, false);});
+  testCM("moveright_wrap", function(cm) {testMoveright(cm, true, false);});
+  testCM("moveright_scroll", function(cm) {testMoveright(cm, false, true);});
+  testCM("moveright_scroll_wrap", function(cm) {testMoveright(cm, true, true);});
+
+  testCM("suddenly_wide", function(cm) {
+    addDoc(cm, 100, 100);
+    cm.replaceSelection(new Array(600).join("l ") + "\n");
+    cm.execCommand("goLineUp");
+    cm.execCommand("goLineEnd");
+    is(barH(cm).scrollLeft > cm.getScrollerElement().scrollLeft - 1);
+  });
+
+  testCM("wrap_changes_height", function(cm) {
+    var line = new Array(20).join("a ") + "\n";
+    cm.setValue(new Array(20).join(line));
+    var box = cm.getWrapperElement().getBoundingClientRect();
+    cm.setSize(cm.cursorCoords(Pos(0), "window").right - box.left + 2,
+               cm.cursorCoords(Pos(19, 0), "window").bottom - box.top + 2);
+    cm.setCursor(Pos(19, 0));
+    cm.replaceSelection("\n");
+    is(cm.cursorCoords(null, "window").bottom < displayBottom(cm, false));
+  }, {lineWrapping: true});
+
+  testCM("height_auto_with_gutter_expect_no_scroll_after_line_delete", function(cm) {
+    cm.setSize(null, "auto");
+    cm.setValue("x\n");
+    cm.execCommand("goDocEnd");
+    cm.execCommand("delCharBefore");
+    eq(cm.getScrollInfo().top, 0);
+    cm.scrollTo(null, 10);
+    is(cm.getScrollInfo().top < 5);
+  }, {lineNumbers: true});
+
+  testCM("bidi_ensureCursorVisible", function(cm) {
+    cm.setValue("<dd>وضع الاستخدام. عندما لا تعطى، وهذا الافتراضي إلى الطريقة الاولى\n");
+    cm.execCommand("goLineStart");
+    eq(cm.getScrollInfo().left, 0);
+    cm.execCommand("goCharRight");
+    cm.execCommand("goCharRight");
+    cm.execCommand("goCharRight");
+    eqCursorPos(cm.getCursor(), Pos(0, 3, "before"));
+    eq(cm.getScrollInfo().left, 0);
+  }, {lineWrapping: false});
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/search_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,91 @@
+(function() {
+  "use strict";
+
+  function run(doc, query, options) {
+    var cursor = doc.getSearchCursor(query, null, options);
+    for (var i = 3; i < arguments.length; i += 4) {
+      var found = cursor.findNext();
+      is(found, "not enough results (forward)");
+      eqCharPos(Pos(arguments[i], arguments[i + 1]), cursor.from(), "from, forward, " + (i - 3) / 4);
+      eqCharPos(Pos(arguments[i + 2], arguments[i + 3]), cursor.to(), "to, forward, " + (i - 3) / 4);
+    }
+    is(!cursor.findNext(), "too many matches (forward)");
+    for (var i = arguments.length - 4; i >= 3; i -= 4) {
+      var found = cursor.findPrevious();
+      is(found, "not enough results (backwards)");
+      eqCharPos(Pos(arguments[i], arguments[i + 1]), cursor.from(), "from, backwards, " + (i - 3) / 4);
+      eqCharPos(Pos(arguments[i + 2], arguments[i + 3]), cursor.to(), "to, backwards, " + (i - 3) / 4);
+    }
+    is(!cursor.findPrevious(), "too many matches (backwards)");
+  }
+
+  function test(name, f) { window.test("search_" + name, f) }
+
+  test("simple", function() {
+    var doc = new CodeMirror.Doc("abcdefg\nabcdefg")
+    run(doc, "cde", false, 0, 2, 0, 5, 1, 2, 1, 5);
+  });
+
+  test("multiline", function() {
+    var doc = new CodeMirror.Doc("hallo\na\nb\ngoodbye")
+    run(doc, "llo\na\nb\ngoo", false, 0, 2, 3, 3);
+    run(doc, "blah\na\nb\nhall", false);
+    run(doc, "bye\nx\neye", false);
+  });
+
+  test("regexp", function() {
+    var doc = new CodeMirror.Doc("abcde\nabcde")
+    run(doc, /bcd/, false, 0, 1, 0, 4, 1, 1, 1, 4);
+    run(doc, /BCD/, false);
+    run(doc, /BCD/i, false, 0, 1, 0, 4, 1, 1, 1, 4);
+  });
+
+  test("regexpMultiline", function() {
+    var doc = new CodeMirror.Doc("fom fom\nbar\nbaz")
+    run(doc, /fo[^]*az/, {multiline: true}, 0, 0, 2, 3)
+    run(doc, /[oa][^u]/, {multiline: true}, 0, 1, 0, 3, 0, 5, 0, 7, 1, 1, 1, 3, 2, 1, 2, 3)
+    run(doc, /[a][^u]{2}/, {multiline: true}, 1, 1, 2, 0)
+  })
+
+  test("insensitive", function() {
+    var doc = new CodeMirror.Doc("hallo\nHALLO\noink\nhAllO")
+    run(doc, "All", false, 3, 1, 3, 4);
+    run(doc, "All", true, 0, 1, 0, 4, 1, 1, 1, 4, 3, 1, 3, 4);
+  });
+
+  test("multilineInsensitive", function() {
+    var doc = new CodeMirror.Doc("zie ginds komT\nDe Stoomboot\nuit Spanje weer aan")
+    run(doc, "komt\nde stoomboot\nuit", false);
+    run(doc, "komt\nde stoomboot\nuit", {caseFold: true}, 0, 10, 2, 3);
+    run(doc, "kOMt\ndE stOOmboot\nuiT", {caseFold: true}, 0, 10, 2, 3);
+  });
+
+  test("multilineInsensitiveSlow", function() {
+    var text = ""
+    for (var i = 0; i < 1000; i++) text += "foo\nbar\n"
+    var doc = new CodeMirror.Doc("find\nme\n" + text + "find\nme\n")
+    var t0 = +new Date
+    run(doc, /find\nme/, {multiline: true}, 0, 0, 1, 2, 2002, 0, 2003, 2)
+    is(+new Date - t0 < 100)
+  })
+
+  test("expandingCaseFold", function() {
+    var doc = new CodeMirror.Doc("<b>İİ İİ</b>\n<b>uu uu</b>")
+    run(doc, "</b>", true, 0, 8, 0, 12, 1, 8, 1, 12);
+    run(doc, "İİ", true, 0, 3, 0, 5, 0, 6, 0, 8);
+  });
+
+  test("normalize", function() {
+    if (!String.prototype.normalize) return
+    var doc = new CodeMirror.Doc("yılbaşı\n수 있을까\nLe taux d'humidité à London")
+    run(doc, "s", false, 0, 5, 0, 6)
+    run(doc, "이", false, 1, 2, 1, 3)
+    run(doc, "a", false, 0, 4, 0, 5, 2, 4, 2, 5, 2, 19, 2, 20)
+  })
+
+  test("endOfLine", function() {
+    var doc = new CodeMirror.Doc("bbcdb\nabcd\nbbcdb\nabcd")
+    run(doc, /[^b]$/, {multiline: true}, 1, 3, 1, 4, 3, 3, 3, 4)
+    run(doc, /b$/, false, 0, 4, 0, 5, 2, 4, 2, 5)
+  })
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/sql-hint-test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,301 @@
+// CodeMirror, copyright (c) by Marijn Haverbeke and others
+// Distributed under an MIT license: https://codemirror.net/5/LICENSE
+
+(function() {
+  var Pos = CodeMirror.Pos;
+
+  var simpleTables = {
+    "users": ["name", "score", "birthDate"],
+    "xcountries": ["name", "population", "size"]
+  };
+
+  var schemaTables = {
+    "schema.users": ["name", "score", "birthDate"],
+    "schema.countries": ["name", "population", "size"]
+  };
+
+  var displayTextTables = [{
+    text: "mytable",
+    displayText: "mytable | The main table",
+    columns: [{text: "id", displayText: "id | Unique ID"},
+              {text: "name", displayText: "name | The name"}]
+  }];
+
+  var displayTextTablesWithDefault = [
+    {
+      text: "Api__TokenAliases",
+      columns: [
+        {
+          text: "token",
+          displayText: "token | varchar(255) | Primary",
+          columnName: "token",
+          columnHint: "varchar(255) | Primary"
+        },
+        {
+          text: "alias",
+          displayText: "alias | varchar(255) | Primary",
+          columnName: "alias",
+          columnHint: "varchar(255) | Primary"
+        }
+      ]
+    },
+    {
+      text: "mytable",
+      columns: [
+        { text: "id", displayText: "id | Unique ID" },
+        { text: "name", displayText: "name | The name" }
+      ]
+    }
+  ];
+
+  namespace = "sql-hint_";
+
+  function test(name, spec) {
+    testCM(name, function(cm) {
+      cm.setValue(spec.value);
+      cm.setCursor(spec.cursor);
+      var completion = CodeMirror.hint.sql(cm, {
+        tables: spec.tables,
+        defaultTable: spec.defaultTable,
+        disableKeywords: spec.disableKeywords
+      });
+      if (!deepCompare(completion.list, spec.list))
+        throw new Failure("Wrong completion results " + JSON.stringify(completion.list) + " vs " + JSON.stringify(spec.list));
+      eqCharPos(completion.from, spec.from);
+      eqCharPos(completion.to, spec.to);
+    }, {
+      value: spec.value,
+      mode: spec.mode || "text/x-mysql"
+    });
+  }
+
+  test("keywords", {
+    value: "SEL",
+    cursor: Pos(0, 3),
+    list: [{"text":"SELECT","className":"CodeMirror-hint-keyword"}],
+    from: Pos(0, 0),
+    to: Pos(0, 3)
+  });
+
+  test("keywords_disabled", {
+    value: "SEL",
+    cursor: Pos(0, 3),
+    disableKeywords: true,
+    list: [],
+    from: Pos(0, 0),
+    to: Pos(0, 3)
+  });
+
+  test("from", {
+    value: "SELECT * fr",
+    cursor: Pos(0, 11),
+    list: [{"text":"FROM","className":"CodeMirror-hint-keyword"}],
+    from: Pos(0, 9),
+    to: Pos(0, 11)
+  });
+
+  test("table", {
+    value: "SELECT xc",
+    cursor: Pos(0, 9),
+    tables: simpleTables,
+    list: [{"text":"xcountries","className":"CodeMirror-hint-table"}],
+    from: Pos(0, 7),
+    to: Pos(0, 9)
+  });
+
+  test("columns", {
+    value: "SELECT users.",
+    cursor: Pos(0, 13),
+    tables: simpleTables,
+    list: ["users.name", "users.score", "users.birthDate"],
+    from: Pos(0, 7),
+    to: Pos(0, 13)
+  });
+
+  test("singlecolumn", {
+    value: "SELECT users.na",
+    cursor: Pos(0, 15),
+    tables: simpleTables,
+    list: ["users.name"],
+    from: Pos(0, 7),
+    to: Pos(0, 15)
+  });
+
+  test("quoted", {
+    value: "SELECT `users`.`na",
+    cursor: Pos(0, 18),
+    tables: simpleTables,
+    list: ["`users`.`name`"],
+    from: Pos(0, 7),
+    to: Pos(0, 18)
+  });
+
+  test("doublequoted", {
+    value: "SELECT \"users\".\"na",
+    cursor: Pos(0, 18),
+    tables: simpleTables,
+    list: ["\"users\".\"name\""],
+    from: Pos(0, 7),
+    to: Pos(0, 18),
+    mode: "text/x-sqlite"
+  });
+
+  test("quotedcolumn", {
+    value: "SELECT users.`na",
+    cursor: Pos(0, 16),
+    tables: simpleTables,
+    list: ["`users`.`name`"],
+    from: Pos(0, 7),
+    to: Pos(0, 16)
+  });
+
+  test("doublequotedcolumn", {
+    value: "SELECT users.\"na",
+    cursor: Pos(0, 16),
+    tables: simpleTables,
+    list: ["\"users\".\"name\""],
+    from: Pos(0, 7),
+    to: Pos(0, 16),
+    mode: "text/x-sqlite"
+  });
+
+  test("schema", {
+    value: "SELECT schem",
+    cursor: Pos(0, 12),
+    tables: schemaTables,
+    list: [{"text":"schema.users","className":"CodeMirror-hint-table"},
+        {"text":"schema.countries","className":"CodeMirror-hint-table"},
+        {"text":"SCHEMA","className":"CodeMirror-hint-keyword"},
+        {"text":"SCHEMA_NAME","className":"CodeMirror-hint-keyword"},
+        {"text":"SCHEMAS","className":"CodeMirror-hint-keyword"}],
+    from: Pos(0, 7),
+    to: Pos(0, 12)
+  });
+
+  test("schemaquoted", {
+    value: "SELECT `sch",
+    cursor: Pos(0, 11),
+    tables: schemaTables,
+    list: ["`schema`.`users`", "`schema`.`countries`"],
+    from: Pos(0, 7),
+    to: Pos(0, 11)
+  });
+
+  test("schemadoublequoted", {
+    value: "SELECT \"sch",
+    cursor: Pos(0, 11),
+    tables: schemaTables,
+    list: ["\"schema\".\"users\"", "\"schema\".\"countries\""],
+    from: Pos(0, 7),
+    to: Pos(0, 11),
+    mode: "text/x-sqlite"
+  });
+
+  test("schemacolumn", {
+    value: "SELECT schema.users.",
+    cursor: Pos(0, 20),
+    tables: schemaTables,
+    list: ["schema.users.name",
+           "schema.users.score",
+           "schema.users.birthDate"],
+    from: Pos(0, 7),
+    to: Pos(0, 20)
+  });
+
+  test("schemacolumnquoted", {
+    value: "SELECT `schema`.`users`.",
+    cursor: Pos(0, 24),
+    tables: schemaTables,
+    list: ["`schema`.`users`.`name`",
+           "`schema`.`users`.`score`",
+           "`schema`.`users`.`birthDate`"],
+    from: Pos(0, 7),
+    to: Pos(0, 24)
+  });
+
+  test("schemacolumndoublequoted", {
+    value: "SELECT \"schema\".\"users\".",
+    cursor: Pos(0, 24),
+    tables: schemaTables,
+    list: ["\"schema\".\"users\".\"name\"",
+           "\"schema\".\"users\".\"score\"",
+           "\"schema\".\"users\".\"birthDate\""],
+    from: Pos(0, 7),
+    to: Pos(0, 24),
+    mode: "text/x-sqlite"
+  });
+
+  test("displayText_default_table", {
+    value: "SELECT a",
+    cursor: Pos(0, 8),
+    disableKeywords: true,
+    defaultTable: "Api__TokenAliases",
+    tables: displayTextTablesWithDefault,
+    list: [
+      {
+        text: "alias",
+        displayText: "alias | varchar(255) | Primary",
+        columnName: "alias",
+        columnHint: "varchar(255) | Primary",
+        className: "CodeMirror-hint-table CodeMirror-hint-default-table"
+      },
+      { text: "Api__TokenAliases", className: "CodeMirror-hint-table" }
+    ],
+    from: Pos(0, 7),
+    to: Pos(0, 8)
+  });
+
+  test("displayText_table", {
+    value: "SELECT myt",
+    cursor: Pos(0, 10),
+    tables: displayTextTables,
+    list: [{text: "mytable", displayText: "mytable | The main table", "className":"CodeMirror-hint-table"}],
+    from: Pos(0, 7),
+    to: Pos(0, 10)
+  });
+
+  test("displayText_column", {
+    value: "SELECT mytable.",
+    cursor: Pos(0, 15),
+    tables: displayTextTables,
+    list: [{text: "mytable.id", displayText: "id | Unique ID"},
+           {text: "mytable.name", displayText: "name | The name"}],
+    from: Pos(0, 7),
+    to: Pos(0, 15)
+  });
+
+  test("alias_complete", {
+    value: "SELECT t. FROM users t",
+    cursor: Pos(0, 9),
+    tables: simpleTables,
+    list: ["t.name", "t.score", "t.birthDate"],
+    from: Pos(0, 7),
+    to: Pos(0, 9)
+  });
+
+  test("alias_complete_with_displayText", {
+    value: "SELECT t. FROM mytable t",
+    cursor: Pos(0, 9),
+    tables: displayTextTables,
+    list: [{text: "t.id", displayText: "id | Unique ID"},
+           {text: "t.name", displayText: "name | The name"}],
+    from: Pos(0, 7),
+    to: Pos(0, 9)
+  })
+
+  function deepCompare(a, b) {
+    if (a === b) return true
+    if (!(a && typeof a == "object") ||
+        !(b && typeof b == "object")) return false
+    var array = Array.isArray(a)
+    if (Array.isArray(b) != array) return false
+    if (array) {
+      if (a.length != b.length) return false
+      for (var i = 0; i < a.length; i++) if (!deepCompare(a[i], b[i])) return false
+    } else {
+      for (var p in a) if (!(p in b) || !deepCompare(a[p], b[p])) return false
+      for (var p in b) if (!(p in a)) return false
+    }
+    return true
+  }
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/sublime_test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,295 @@
+(function() {
+  "use strict";
+  
+  var Pos = CodeMirror.Pos;
+  namespace = "sublime_";
+
+  function stTest(name) {
+    var actions = Array.prototype.slice.call(arguments, 1);
+    testCM(name, function(cm) {
+      for (var i = 0; i < actions.length; i++) {
+        var action = actions[i];
+        if (typeof action == "string" && i == 0)
+          cm.setValue(action);
+        else if (typeof action == "string")
+          cm.execCommand(action);
+        else if (action instanceof Pos)
+          cm.setCursor(action);
+        else
+          action(cm);
+      }
+    });
+  }
+
+  function at(line, ch, msg) {
+    return function(cm) {
+      eq(cm.listSelections().length, 1);
+      eqCursorPos(cm.getCursor("head"), Pos(line, ch), msg);
+      eqCursorPos(cm.getCursor("anchor"), Pos(line, ch), msg);
+    };
+  }
+
+  function val(content, msg) {
+    return function(cm) { eq(cm.getValue(), content, msg); };
+  }
+
+  function argsToRanges(args) {
+    if (args.length % 4) throw new Error("Wrong number of arguments for ranges.");
+    var ranges = [];
+    for (var i = 0; i < args.length; i += 4)
+      ranges.push({anchor: Pos(args[i], args[i + 1]),
+                   head: Pos(args[i + 2], args[i + 3])});
+    return ranges;
+  }
+
+  function setSel() {
+    var ranges = argsToRanges(arguments);
+    return function(cm) { cm.setSelections(ranges, 0); };
+  }
+
+  function hasSel() {
+    var ranges = argsToRanges(arguments);
+    return function(cm) {
+      var sels = cm.listSelections();
+      if (sels.length != ranges.length)
+        throw new Failure("Expected " + ranges.length + " selections, but found " + sels.length);
+      for (var i = 0; i < sels.length; i++) {
+        eqCharPos(sels[i].anchor, ranges[i].anchor, "anchor " + i);
+        eqCharPos(sels[i].head, ranges[i].head, "head " + i);
+      }
+    };
+  }
+
+  stTest("bySubword", "the foo_bar DooDahBah \n a FOOBar",
+         "goSubwordLeft", at(0, 0),
+         "goSubwordRight", at(0, 3),
+         "goSubwordRight", at(0, 7),
+         "goSubwordRight", at(0, 11),
+         "goSubwordRight", at(0, 15),
+         "goSubwordRight", at(0, 18),
+         "goSubwordRight", at(0, 21),
+         "goSubwordRight", at(0, 22),
+         "goSubwordRight", at(1, 0),
+         "goSubwordRight", at(1, 2),
+         "goSubwordRight", at(1, 6),
+         "goSubwordRight", at(1, 9),
+         "goSubwordLeft", at(1, 6),
+         "goSubwordLeft", at(1, 3),
+         "goSubwordLeft", at(1, 1),
+         "goSubwordLeft", at(1, 0),
+         "goSubwordLeft", at(0, 22),
+         "goSubwordLeft", at(0, 18),
+         "goSubwordLeft", at(0, 15),
+         "goSubwordLeft", at(0, 12),
+         "goSubwordLeft", at(0, 8),
+         "goSubwordLeft", at(0, 4),
+         "goSubwordLeft", at(0, 0));
+
+  stTest("splitSelectionByLine", "abc\ndef\nghi",
+         setSel(0, 1, 2, 2),
+         "splitSelectionByLine",
+         hasSel(0, 1, 0, 3,
+                1, 0, 1, 3,
+                2, 0, 2, 2));
+
+  stTest("splitSelectionByLineMulti", "abc\ndef\nghi\njkl",
+         setSel(0, 1, 1, 1,
+                1, 2, 3, 2,
+                3, 3, 3, 3),
+         "splitSelectionByLine",
+         hasSel(0, 1, 0, 3,
+                1, 0, 1, 1,
+                1, 2, 1, 3,
+                2, 0, 2, 3,
+                3, 0, 3, 2,
+                3, 3, 3, 3));
+
+  stTest("selectLine", "abc\ndef\nghi",
+         setSel(0, 1, 0, 1,
+                2, 0, 2, 1),
+         "selectLine",
+         hasSel(0, 0, 1, 0,
+                2, 0, 2, 3),
+         setSel(0, 1, 1, 0),
+         "selectLine",
+         hasSel(0, 0, 2, 0));
+
+  stTest("insertLineAfter", "abcde\nfghijkl\nmn",
+         setSel(0, 1, 0, 1,
+                0, 3, 0, 3,
+                1, 2, 1, 2,
+                1, 3, 1, 5), "insertLineAfter",
+         hasSel(1, 0, 1, 0,
+                3, 0, 3, 0), val("abcde\n\nfghijkl\n\nmn"));
+
+  stTest("insertLineBefore", "abcde\nfghijkl\nmn",
+         setSel(0, 1, 0, 1,
+                0, 3, 0, 3,
+                1, 2, 1, 2,
+                1, 3, 1, 5), "insertLineBefore",
+         hasSel(0, 0, 0, 0,
+                2, 0, 2, 0), val("\nabcde\n\nfghijkl\nmn"));
+
+  stTest("skipAndSelectNextOccurrence", "a foo bar\nfoobar foo",
+         setSel(0, 2, 0, 5), "skipAndSelectNextOccurrence", hasSel(1, 0, 1, 3),
+         "skipAndSelectNextOccurrence",  hasSel(1, 7, 1, 10),
+         "skipAndSelectNextOccurrence",  hasSel(0, 2, 0, 5),
+         Pos(0, 3), "skipAndSelectNextOccurrence", hasSel(0, 2, 0, 5),
+         "skipAndSelectNextOccurrence", hasSel(1, 7, 1, 10),
+         setSel(0, 6, 0, 9), "skipAndSelectNextOccurrence", hasSel(1, 3, 1, 6));
+
+  stTest("selectNextOccurrence", "a foo bar\nfoobar foo",
+         setSel(0, 2, 0, 5),
+         "selectNextOccurrence", hasSel(0, 2, 0, 5,
+                                        1, 0, 1, 3),
+         "selectNextOccurrence", hasSel(0, 2, 0, 5,
+                                        1, 0, 1, 3,
+                                        1, 7, 1, 10),
+         "selectNextOccurrence", hasSel(0, 2, 0, 5,
+                                        1, 0, 1, 3,
+                                        1, 7, 1, 10),
+         Pos(0, 3), "selectNextOccurrence", hasSel(0, 2, 0, 5),
+         "selectNextOccurrence", hasSel(0, 2, 0, 5,
+                                        1, 7, 1, 10),
+         setSel(0, 6, 0, 9),
+         "selectNextOccurrence", hasSel(0, 6, 0, 9,
+                                        1, 3, 1, 6));
+
+  stTest("selectScope", "foo(a) {\n  bar[1, 2];\n}",
+         "selectScope", hasSel(0, 0, 2, 1),
+         Pos(0, 4), "selectScope", hasSel(0, 4, 0, 5),
+         Pos(0, 5), "selectScope", hasSel(0, 4, 0, 5),
+         Pos(0, 6), "selectScope", hasSel(0, 0, 2, 1),
+         Pos(0, 8), "selectScope", hasSel(0, 8, 2, 0),
+         Pos(1, 2), "selectScope", hasSel(0, 8, 2, 0),
+         Pos(1, 6), "selectScope", hasSel(1, 6, 1, 10),
+         Pos(1, 9), "selectScope", hasSel(1, 6, 1, 10),
+         "selectScope", hasSel(0, 8, 2, 0),
+         "selectScope", hasSel(0, 0, 2, 1));
+
+  stTest("goToBracket", "foo(a) {\n  bar[1, 2];\n}",
+         Pos(0, 0), "goToBracket", at(0, 0),
+         Pos(0, 4), "goToBracket", at(0, 5), "goToBracket", at(0, 4),
+         Pos(0, 8), "goToBracket", at(2, 0), "goToBracket", at(0, 8),
+         Pos(1, 2), "goToBracket", at(2, 0),
+         Pos(1, 7), "goToBracket", at(1, 10), "goToBracket", at(1, 6));
+
+  stTest("swapLine", "1\n2\n3---\n4\n5",
+         "swapLineDown", val("2\n1\n3---\n4\n5"),
+         "swapLineUp", val("1\n2\n3---\n4\n5"),
+         "swapLineUp", val("1\n2\n3---\n4\n5"),
+         Pos(4, 1), "swapLineDown", val("1\n2\n3---\n4\n5"),
+         setSel(0, 1, 0, 1,
+                1, 0, 2, 0,
+                2, 2, 2, 2),
+         "swapLineDown", val("4\n1\n2\n3---\n5"),
+         hasSel(1, 1, 1, 1,
+                2, 0, 3, 0,
+                3, 2, 3, 2),
+         "swapLineUp", val("1\n2\n3---\n4\n5"),
+         hasSel(0, 1, 0, 1,
+                1, 0, 2, 0,
+                2, 2, 2, 2));
+
+  stTest("swapLineEmptyBottomSel", "1\n2\n3",
+         setSel(0, 1, 1, 0),
+         "swapLineDown", val("2\n1\n3"), hasSel(1, 1, 2, 0),
+         "swapLineUp", val("1\n2\n3"), hasSel(0, 1, 1, 0),
+         "swapLineUp", val("1\n2\n3"), hasSel(0, 0, 0, 0));
+
+  stTest("swapLineUpFromEnd", "a\nb\nc",
+         Pos(2, 1), "swapLineUp",
+         hasSel(1, 1, 1, 1), val("a\nc\nb"));
+
+  stTest("joinLines", "abc\ndef\nghi\njkl",
+         "joinLines", val("abc def\nghi\njkl"), at(0, 4),
+         "undo",
+         setSel(0, 2, 1, 1), "joinLines",
+         val("abc def ghi\njkl"), hasSel(0, 2, 0, 8),
+         "undo",
+         setSel(0, 1, 0, 1,
+                1, 1, 1, 1,
+                3, 1, 3, 1), "joinLines",
+         val("abc def ghi\njkl"), hasSel(0, 4, 0, 4,
+                                         0, 8, 0, 8,
+                                         1, 3, 1, 3));
+
+  stTest("duplicateLine", "abc\ndef\nghi",
+         Pos(1, 0), "duplicateLine", val("abc\ndef\ndef\nghi"), at(2, 0),
+         "undo",
+         setSel(0, 1, 0, 1,
+                1, 1, 1, 1,
+                2, 1, 2, 1), "duplicateLine",
+         val("abc\nabc\ndef\ndef\nghi\nghi"), hasSel(1, 1, 1, 1,
+                                                     3, 1, 3, 1,
+                                                     5, 1, 5, 1));
+  stTest("duplicateLineSelection", "abcdef",
+         setSel(0, 1, 0, 1,
+                0, 2, 0, 4,
+                0, 5, 0, 5),
+         "duplicateLine",
+         val("abcdef\nabcdcdef\nabcdcdef"), hasSel(2, 1, 2, 1,
+                                                   2, 4, 2, 6,
+                                                   2, 7, 2, 7));
+
+  stTest("sortLines", "c\nb\na\nC\nB\nA",
+         "sortLines", val("A\nB\nC\na\nb\nc"),
+         "undo",
+         setSel(0, 0, 2, 0,
+                3, 0, 5, 0),
+         "sortLines", val("b\nc\na\nB\nC\nA"),
+         hasSel(0, 0, 2, 0,
+                3, 0, 5, 0),
+         "undo",
+         setSel(1, 0, 5, 0), "sortLinesInsensitive", val("c\na\nB\nb\nC\nA"));
+
+  stTest("bookmarks", "abc\ndef\nghi\njkl",
+         Pos(0, 1), "toggleBookmark",
+         setSel(1, 1, 1, 2), "toggleBookmark",
+         setSel(2, 1, 2, 2), "toggleBookmark",
+         "nextBookmark", hasSel(0, 1, 0, 1),
+         "nextBookmark", hasSel(1, 1, 1, 2),
+         "nextBookmark", hasSel(2, 1, 2, 2),
+         "prevBookmark", hasSel(1, 1, 1, 2),
+         "prevBookmark", hasSel(0, 1, 0, 1),
+         "prevBookmark", hasSel(2, 1, 2, 2),
+         "prevBookmark", hasSel(1, 1, 1, 2),
+         "toggleBookmark",
+         "prevBookmark", hasSel(2, 1, 2, 2),
+         "prevBookmark", hasSel(0, 1, 0, 1),
+         "selectBookmarks", hasSel(0, 1, 0, 1,
+                                   2, 1, 2, 2),
+         "clearBookmarks",
+         Pos(0, 0), "selectBookmarks", at(0, 0));
+
+  stTest("smartBackspace", "  foo\n    bar",
+         setSel(0, 2, 0, 2, 1, 4, 1, 4, 1, 6, 1, 6), "smartBackspace",
+         val("foo\n  br"))
+
+  stTest("upAndDowncaseAtCursor", "abc\ndef  x\nghI",
+         setSel(0, 1, 0, 3,
+                1, 1, 1, 1,
+                1, 4, 1, 4), "upcaseAtCursor",
+         val("aBC\nDEF  x\nghI"), hasSel(0, 1, 0, 3,
+                                         1, 3, 1, 3,
+                                         1, 4, 1, 4),
+         "downcaseAtCursor",
+         val("abc\ndef  x\nghI"), hasSel(0, 1, 0, 3,
+                                         1, 3, 1, 3,
+                                         1, 4, 1, 4));
+
+  stTest("mark", "abc\ndef\nghi",
+         Pos(1, 1), "setSublimeMark",
+         Pos(2, 1), "selectToSublimeMark", hasSel(2, 1, 1, 1),
+         Pos(0, 1), "swapWithSublimeMark", at(1, 1), "swapWithSublimeMark", at(0, 1),
+         "deleteToSublimeMark", val("aef\nghi"),
+         "sublimeYank", val("abc\ndef\nghi"), at(1, 1));
+
+  stTest("findUnder", "foo foobar  a",
+         "findUnder", hasSel(0, 4, 0, 7),
+         "findUnder", hasSel(0, 0, 0, 3),
+         "findUnderPrevious", hasSel(0, 4, 0, 7),
+         "findUnderPrevious", hasSel(0, 0, 0, 3),
+         Pos(0, 4), "findUnder", hasSel(0, 4, 0, 10),
+         Pos(0, 11), "findUnder", hasSel(0, 11, 0, 11));
+})();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/test/test.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,2678 @@
+var Pos = CodeMirror.Pos;
+
+CodeMirror.defaults.rtlMoveVisually = true;
+
+function forEach(arr, f) {
+  for (var i = 0, e = arr.length; i < e; ++i) f(arr[i], i);
+}
+
+function addDoc(cm, width, height) {
+  var content = [], line = "";
+  for (var i = 0; i < width; ++i) line += "x";
+  for (var i = 0; i < height; ++i) content.push(line);
+  cm.setValue(content.join("\n"));
+}
+
+function byClassName(elt, cls) {
+  if (elt.getElementsByClassName) return elt.getElementsByClassName(cls);
+  var found = [], re = new RegExp("\\b" + cls + "\\b");
+  function search(elt) {
+    if (elt.nodeType == 3) return;
+    if (re.test(elt.className)) found.push(elt);
+    for (var i = 0, e = elt.childNodes.length; i < e; ++i)
+      search(elt.childNodes[i]);
+  }
+  search(elt);
+  return found;
+}
+
+var ie_lt8 = /MSIE [1-7]\b/.test(navigator.userAgent);
+var ie_lt9 = /MSIE [1-8]\b/.test(navigator.userAgent);
+var mac = /Mac/.test(navigator.platform);
+var opera = /Opera\/\./.test(navigator.userAgent);
+var opera_version = opera && navigator.userAgent.match(/Version\/(\d+\.\d+)/);
+if (opera_version) opera_version = Number(opera_version);
+var opera_lt10 = opera && (!opera_version || opera_version < 10);
+
+namespace = "core_";
+
+test("core_fromTextArea", function() {
+  var te = document.getElementById("code");
+  te.value = "CONTENT";
+  var cm = CodeMirror.fromTextArea(te);
+  is(!te.offsetHeight);
+  eq(cm.getValue(), "CONTENT");
+  cm.setValue("foo\nbar");
+  eq(cm.getValue(), "foo\nbar");
+  cm.save();
+  is(/^foo\r?\nbar$/.test(te.value));
+  cm.setValue("xxx");
+  cm.toTextArea();
+  is(te.offsetHeight);
+  eq(te.value, "xxx");
+});
+
+testCM("getRange", function(cm) {
+  eq(cm.getLine(0), "1234");
+  eq(cm.getLine(1), "5678");
+  eq(cm.getLine(2), null);
+  eq(cm.getLine(-1), null);
+  eq(cm.getRange(Pos(0, 0), Pos(0, 3)), "123");
+  eq(cm.getRange(Pos(0, -1), Pos(0, 200)), "1234");
+  eq(cm.getRange(Pos(0, 2), Pos(1, 2)), "34\n56");
+  eq(cm.getRange(Pos(1, 2), Pos(100, 0)), "78");
+}, {value: "1234\n5678"});
+
+testCM("replaceRange", function(cm) {
+  eq(cm.getValue(), "");
+  cm.replaceRange("foo\n", Pos(0, 0));
+  eq(cm.getValue(), "foo\n");
+  cm.replaceRange("a\nb", Pos(0, 1));
+  eq(cm.getValue(), "fa\nboo\n");
+  eq(cm.lineCount(), 3);
+  cm.replaceRange("xyzzy", Pos(0, 0), Pos(1, 1));
+  eq(cm.getValue(), "xyzzyoo\n");
+  cm.replaceRange("abc", Pos(0, 0), Pos(10, 0));
+  eq(cm.getValue(), "abc");
+  eq(cm.lineCount(), 1);
+});
+
+testCM("selection", function(cm) {
+  cm.setSelection(Pos(0, 4), Pos(2, 2));
+  is(cm.somethingSelected());
+  eq(cm.getSelection(), "11\n222222\n33");
+  eqCursorPos(cm.getCursor(false), Pos(2, 2));
+  eqCursorPos(cm.getCursor(true), Pos(0, 4));
+  cm.setSelection(Pos(1, 0));
+  is(!cm.somethingSelected());
+  eq(cm.getSelection(), "");
+  eqCursorPos(cm.getCursor(true), Pos(1, 0));
+  cm.replaceSelection("abc", "around");
+  eq(cm.getSelection(), "abc");
+  eq(cm.getValue(), "111111\nabc222222\n333333");
+  cm.replaceSelection("def", "end");
+  eq(cm.getSelection(), "");
+  eqCursorPos(cm.getCursor(true), Pos(1, 3));
+  cm.setCursor(Pos(2, 1));
+  eqCursorPos(cm.getCursor(true), Pos(2, 1));
+  cm.setCursor(1, 2);
+  eqCursorPos(cm.getCursor(true), Pos(1, 2));
+}, {value: "111111\n222222\n333333"});
+
+testCM("extendSelection", function(cm) {
+  cm.setExtending(true);
+  addDoc(cm, 10, 10);
+  cm.setSelection(Pos(3, 5));
+  eqCursorPos(cm.getCursor("head"), Pos(3, 5));
+  eqCursorPos(cm.getCursor("anchor"), Pos(3, 5));
+  cm.setSelection(Pos(2, 5), Pos(5, 5));
+  eqCursorPos(cm.getCursor("head"), Pos(5, 5));
+  eqCursorPos(cm.getCursor("anchor"), Pos(2, 5));
+  eqCursorPos(cm.getCursor("start"), Pos(2, 5));
+  eqCursorPos(cm.getCursor("end"), Pos(5, 5));
+  cm.setSelection(Pos(5, 5), Pos(2, 5));
+  eqCursorPos(cm.getCursor("head"), Pos(2, 5));
+  eqCursorPos(cm.getCursor("anchor"), Pos(5, 5));
+  eqCursorPos(cm.getCursor("start"), Pos(2, 5));
+  eqCursorPos(cm.getCursor("end"), Pos(5, 5));
+  cm.extendSelection(Pos(3, 2));
+  eqCursorPos(cm.getCursor("head"), Pos(3, 2));
+  eqCursorPos(cm.getCursor("anchor"), Pos(5, 5));
+  cm.extendSelection(Pos(6, 2));
+  eqCursorPos(cm.getCursor("head"), Pos(6, 2));
+  eqCursorPos(cm.getCursor("anchor"), Pos(5, 5));
+  cm.extendSelection(Pos(6, 3), Pos(6, 4));
+  eqCursorPos(cm.getCursor("head"), Pos(6, 4));
+  eqCursorPos(cm.getCursor("anchor"), Pos(5, 5));
+  cm.extendSelection(Pos(0, 3), Pos(0, 4));
+  eqCursorPos(cm.getCursor("head"), Pos(0, 3));
+  eqCursorPos(cm.getCursor("anchor"), Pos(5, 5));
+  cm.extendSelection(Pos(4, 5), Pos(6, 5));
+  eqCursorPos(cm.getCursor("head"), Pos(6, 5));
+  eqCursorPos(cm.getCursor("anchor"), Pos(4, 5));
+  cm.setExtending(false);
+  cm.extendSelection(Pos(0, 3), Pos(0, 4));
+  eqCursorPos(cm.getCursor("head"), Pos(0, 3));
+  eqCursorPos(cm.getCursor("anchor"), Pos(0, 4));
+});
+
+testCM("lines", function(cm) {
+  eq(cm.getLine(0), "111111");
+  eq(cm.getLine(1), "222222");
+  eq(cm.getLine(-1), null);
+  cm.replaceRange("", Pos(1, 0), Pos(2, 0))
+  cm.replaceRange("abc", Pos(1, 0), Pos(1));
+  eq(cm.getValue(), "111111\nabc");
+}, {value: "111111\n222222\n333333"});
+
+testCM("indent", function(cm) {
+  cm.indentLine(1);
+  eq(cm.getLine(1), "   blah();");
+  cm.setOption("indentUnit", 8);
+  cm.indentLine(1);
+  eq(cm.getLine(1), "\tblah();");
+  cm.setOption("indentUnit", 10);
+  cm.setOption("tabSize", 4);
+  cm.indentLine(1);
+  eq(cm.getLine(1), "\t\t  blah();");
+}, {value: "if (x) {\nblah();\n}", indentUnit: 3, indentWithTabs: true, tabSize: 8});
+
+testCM("indentByNumber", function(cm) {
+  cm.indentLine(0, 2);
+  eq(cm.getLine(0), "  foo");
+  cm.indentLine(0, -200);
+  eq(cm.getLine(0), "foo");
+  cm.setSelection(Pos(0, 0), Pos(1, 2));
+  cm.indentSelection(3);
+  eq(cm.getValue(), "   foo\n   bar\nbaz");
+}, {value: "foo\nbar\nbaz"});
+
+test("core_defaults", function() {
+  var defsCopy = {}, defs = CodeMirror.defaults;
+  for (var opt in defs) defsCopy[opt] = defs[opt];
+  defs.indentUnit = 5;
+  defs.value = "uu";
+  defs.indentWithTabs = true;
+  defs.tabindex = 55;
+  var place = document.getElementById("testground"), cm = CodeMirror(place);
+  try {
+    eq(cm.getOption("indentUnit"), 5);
+    cm.setOption("indentUnit", 10);
+    eq(defs.indentUnit, 5);
+    eq(cm.getValue(), "uu");
+    eq(cm.getOption("indentWithTabs"), true);
+    eq(cm.getInputField().tabIndex, 55);
+  }
+  finally {
+    for (var opt in defsCopy) defs[opt] = defsCopy[opt];
+    place.removeChild(cm.getWrapperElement());
+  }
+});
+
+testCM("lineInfo", function(cm) {
+  eq(cm.lineInfo(-1), null);
+  var mark = document.createElement("span");
+  var lh = cm.setGutterMarker(1, "FOO", mark);
+  var info = cm.lineInfo(1);
+  eq(info.text, "222222");
+  eq(info.gutterMarkers.FOO, mark);
+  eq(info.line, 1);
+  eq(cm.lineInfo(2).gutterMarkers, null);
+  cm.setGutterMarker(lh, "FOO", null);
+  eq(cm.lineInfo(1).gutterMarkers, null);
+  cm.setGutterMarker(1, "FOO", mark);
+  cm.setGutterMarker(0, "FOO", mark);
+  cm.clearGutter("FOO");
+  eq(cm.lineInfo(0).gutterMarkers, null);
+  eq(cm.lineInfo(1).gutterMarkers, null);
+}, {value: "111111\n222222\n333333"});
+
+testCM("coords", function(cm) {
+  cm.setSize(null, 100);
+  addDoc(cm, 32, 200);
+  var top = cm.charCoords(Pos(0, 0));
+  var bot = cm.charCoords(Pos(200, 30));
+  is(top.left < bot.left);
+  is(top.top < bot.top);
+  is(top.top < top.bottom);
+  cm.scrollTo(null, 100);
+  var top2 = cm.charCoords(Pos(0, 0));
+  is(top.top > top2.top);
+  eq(top.left, top2.left);
+});
+
+testCM("coordsChar", function(cm) {
+  addDoc(cm, 35, 70);
+  for (var i = 0; i < 2; ++i) {
+    var sys = i ? "local" : "page";
+    for (var ch = 0; ch <= 35; ch += 5) {
+      for (var line = 0; line < 70; line += 5) {
+        cm.setCursor(line, ch);
+        var coords = cm.charCoords(Pos(line, ch), sys);
+        var pos = cm.coordsChar({left: coords.left + 1, top: coords.top + 1}, sys);
+        eqCharPos(pos, Pos(line, ch));
+      }
+    }
+  }
+}, {lineNumbers: true});
+
+testCM("coordsCharBidi", function(cm) {
+  addDoc(cm, 35, 70);
+  // Put an rtl character into each line to trigger the bidi code path in coordsChar
+  cm.setValue(cm.getValue().replace(/\bx/g, 'و'))
+  for (var i = 0; i < 2; ++i) {
+    var sys = i ? "local" : "page";
+    for (var ch = 2; ch <= 35; ch += 5) {
+      for (var line = 0; line < 70; line += 5) {
+        cm.setCursor(line, ch);
+        var coords = cm.charCoords(Pos(line, ch), sys);
+        var pos = cm.coordsChar({left: coords.left + 1, top: coords.top + 1}, sys);
+        eqCharPos(pos, Pos(line, ch));
+      }
+    }
+  }
+}, {lineNumbers: true});
+
+testCM("badBidiOptimization", function(cm) {
+  if (window.automatedTests) return
+  var coords = cm.charCoords(Pos(0, 34))
+  eqCharPos(cm.coordsChar({left: coords.right, top: coords.top + 2}), Pos(0, 34))
+}, {value: "----------<p class=\"title\">هل يمكنك اختيار مستوى قسط التأمين الذي ترغب بدفعه؟</p>"})
+
+testCM("posFromIndex", function(cm) {
+  cm.setValue(
+    "This function should\n" +
+    "convert a zero based index\n" +
+    "to line and ch."
+  );
+
+  var examples = [
+    { index: -1, line: 0, ch: 0  }, // <- Tests clipping
+    { index: 0,  line: 0, ch: 0  },
+    { index: 10, line: 0, ch: 10 },
+    { index: 39, line: 1, ch: 18 },
+    { index: 55, line: 2, ch: 7  },
+    { index: 63, line: 2, ch: 15 },
+    { index: 64, line: 2, ch: 15 }  // <- Tests clipping
+  ];
+
+  for (var i = 0; i < examples.length; i++) {
+    var example = examples[i];
+    var pos = cm.posFromIndex(example.index);
+    eq(pos.line, example.line);
+    eq(pos.ch, example.ch);
+    if (example.index >= 0 && example.index < 64)
+      eq(cm.indexFromPos(pos), example.index);
+  }
+});
+
+testCM("undo", function(cm) {
+  cm.replaceRange("def", Pos(0, 0), Pos(0));
+  eq(cm.historySize().undo, 1);
+  cm.undo();
+  eq(cm.getValue(), "abc");
+  eq(cm.historySize().undo, 0);
+  eq(cm.historySize().redo, 1);
+  cm.redo();
+  eq(cm.getValue(), "def");
+  eq(cm.historySize().undo, 1);
+  eq(cm.historySize().redo, 0);
+  cm.setValue("1\n\n\n2");
+  cm.clearHistory();
+  eq(cm.historySize().undo, 0);
+  for (var i = 0; i < 20; ++i) {
+    cm.replaceRange("a", Pos(0, 0));
+    cm.replaceRange("b", Pos(3, 0));
+  }
+  eq(cm.historySize().undo, 40);
+  for (var i = 0; i < 40; ++i)
+    cm.undo();
+  eq(cm.historySize().redo, 40);
+  eq(cm.getValue(), "1\n\n\n2");
+}, {value: "abc"});
+
+testCM("undoDepth", function(cm) {
+  cm.replaceRange("d", Pos(0));
+  cm.replaceRange("e", Pos(0));
+  cm.replaceRange("f", Pos(0));
+  cm.undo(); cm.undo(); cm.undo();
+  eq(cm.getValue(), "abcd");
+}, {value: "abc", undoDepth: 4});
+
+testCM("undoDoesntClearValue", function(cm) {
+  cm.undo();
+  eq(cm.getValue(), "x");
+}, {value: "x"});
+
+testCM("undoMultiLine", function(cm) {
+  cm.operation(function() {
+    cm.replaceRange("x", Pos(0, 0));
+    cm.replaceRange("y", Pos(1, 0));
+  });
+  cm.undo();
+  eq(cm.getValue(), "abc\ndef\nghi");
+  cm.operation(function() {
+    cm.replaceRange("y", Pos(1, 0));
+    cm.replaceRange("x", Pos(0, 0));
+  });
+  cm.undo();
+  eq(cm.getValue(), "abc\ndef\nghi");
+  cm.operation(function() {
+    cm.replaceRange("y", Pos(2, 0));
+    cm.replaceRange("x", Pos(1, 0));
+    cm.replaceRange("z", Pos(2, 0));
+  });
+  cm.undo();
+  eq(cm.getValue(), "abc\ndef\nghi", 3);
+}, {value: "abc\ndef\nghi"});
+
+testCM("undoComposite", function(cm) {
+  cm.replaceRange("y", Pos(1));
+  cm.operation(function() {
+    cm.replaceRange("x", Pos(0));
+    cm.replaceRange("z", Pos(2));
+  });
+  eq(cm.getValue(), "ax\nby\ncz\n");
+  cm.undo();
+  eq(cm.getValue(), "a\nby\nc\n");
+  cm.undo();
+  eq(cm.getValue(), "a\nb\nc\n");
+  cm.redo(); cm.redo();
+  eq(cm.getValue(), "ax\nby\ncz\n");
+}, {value: "a\nb\nc\n"});
+
+testCM("undoSelection", function(cm) {
+  cm.setSelection(Pos(0, 2), Pos(0, 4));
+  cm.replaceSelection("");
+  cm.setCursor(Pos(1, 0));
+  cm.undo();
+  eqCursorPos(cm.getCursor(true), Pos(0, 2));
+  eqCursorPos(cm.getCursor(false), Pos(0, 4));
+  cm.setCursor(Pos(1, 0));
+  cm.redo();
+  eqCursorPos(cm.getCursor(true), Pos(0, 2));
+  eqCursorPos(cm.getCursor(false), Pos(0, 2));
+}, {value: "abcdefgh\n"});
+
+testCM("undoSelectionAsBefore", function(cm) {
+  cm.replaceSelection("abc", "around");
+  cm.undo();
+  cm.redo();
+  eq(cm.getSelection(), "abc");
+});
+
+testCM("selectionChangeConfusesHistory", function(cm) {
+  cm.replaceSelection("abc", null, "dontmerge");
+  cm.operation(function() {
+    cm.setCursor(Pos(0, 0));
+    cm.replaceSelection("abc", null, "dontmerge");
+  });
+  eq(cm.historySize().undo, 2);
+});
+
+testCM("markTextSingleLine", function(cm) {
+  forEach([{a: 0, b: 1, c: "", f: 2, t: 5},
+           {a: 0, b: 4, c: "", f: 0, t: 2},
+           {a: 1, b: 2, c: "x", f: 3, t: 6},
+           {a: 4, b: 5, c: "", f: 3, t: 5},
+           {a: 4, b: 5, c: "xx", f: 3, t: 7},
+           {a: 2, b: 5, c: "", f: 2, t: 3},
+           {a: 2, b: 5, c: "abcd", f: 6, t: 7},
+           {a: 2, b: 6, c: "x", f: null, t: null},
+           {a: 3, b: 6, c: "", f: null, t: null},
+           {a: 0, b: 9, c: "hallo", f: null, t: null},
+           {a: 4, b: 6, c: "x", f: 3, t: 4},
+           {a: 4, b: 8, c: "", f: 3, t: 4},
+           {a: 6, b: 6, c: "a", f: 3, t: 6},
+           {a: 8, b: 9, c: "", f: 3, t: 6}], function(test) {
+    cm.setValue("1234567890");
+    var r = cm.markText(Pos(0, 3), Pos(0, 6), {className: "foo"});
+    cm.replaceRange(test.c, Pos(0, test.a), Pos(0, test.b));
+    var f = r.find();
+    eq(f && f.from.ch, test.f); eq(f && f.to.ch, test.t);
+  });
+});
+
+testCM("markTextMultiLine", function(cm) {
+  function p(v) { return v && Pos(v[0], v[1]); }
+  forEach([{a: [0, 0], b: [0, 5], c: "", f: [0, 0], t: [2, 5]},
+           {a: [0, 0], b: [0, 5], c: "foo\n", f: [1, 0], t: [3, 5]},
+           {a: [0, 1], b: [0, 10], c: "", f: [0, 1], t: [2, 5]},
+           {a: [0, 5], b: [0, 6], c: "x", f: [0, 6], t: [2, 5]},
+           {a: [0, 0], b: [1, 0], c: "", f: [0, 0], t: [1, 5]},
+           {a: [0, 6], b: [2, 4], c: "", f: [0, 5], t: [0, 7]},
+           {a: [0, 6], b: [2, 4], c: "aa", f: [0, 5], t: [0, 9]},
+           {a: [1, 2], b: [1, 8], c: "", f: [0, 5], t: [2, 5]},
+           {a: [0, 5], b: [2, 5], c: "xx", f: null, t: null},
+           {a: [0, 0], b: [2, 10], c: "x", f: null, t: null},
+           {a: [1, 5], b: [2, 5], c: "", f: [0, 5], t: [1, 5]},
+           {a: [2, 0], b: [2, 3], c: "", f: [0, 5], t: [2, 2]},
+           {a: [2, 5], b: [3, 0], c: "a\nb", f: [0, 5], t: [2, 5]},
+           {a: [2, 3], b: [3, 0], c: "x", f: [0, 5], t: [2, 3]},
+           {a: [1, 1], b: [1, 9], c: "1\n2\n3", f: [0, 5], t: [4, 5]}], function(test) {
+    cm.setValue("aaaaaaaaaa\nbbbbbbbbbb\ncccccccccc\ndddddddd\n");
+    var r = cm.markText(Pos(0, 5), Pos(2, 5),
+                        {className: "CodeMirror-matchingbracket"});
+    cm.replaceRange(test.c, p(test.a), p(test.b));
+    var f = r.find();
+    eqCursorPos(f && f.from, p(test.f)); eqCursorPos(f && f.to, p(test.t));
+  });
+});
+
+testCM("markTextUndo", function(cm) {
+  var marker1, marker2, bookmark;
+  marker1 = cm.markText(Pos(0, 1), Pos(0, 3),
+                        {className: "CodeMirror-matchingbracket"});
+  marker2 = cm.markText(Pos(0, 0), Pos(2, 1),
+                        {className: "CodeMirror-matchingbracket"});
+  bookmark = cm.setBookmark(Pos(1, 5));
+  cm.operation(function(){
+    cm.replaceRange("foo", Pos(0, 2));
+    cm.replaceRange("bar\nbaz\nbug\n", Pos(2, 0), Pos(3, 0));
+  });
+  var v1 = cm.getValue();
+  cm.setValue("");
+  eq(marker1.find(), null); eq(marker2.find(), null); eq(bookmark.find(), null);
+  cm.undo();
+  eqCursorPos(bookmark.find(), Pos(1, 5), "still there");
+  cm.undo();
+  var m1Pos = marker1.find(), m2Pos = marker2.find();
+  eqCursorPos(m1Pos.from, Pos(0, 1)); eqCursorPos(m1Pos.to, Pos(0, 3));
+  eqCursorPos(m2Pos.from, Pos(0, 0)); eqCursorPos(m2Pos.to, Pos(2, 1));
+  eqCursorPos(bookmark.find(), Pos(1, 5));
+  cm.redo(); cm.redo();
+  eq(bookmark.find(), null);
+  cm.undo();
+  eqCursorPos(bookmark.find(), Pos(1, 5));
+  eq(cm.getValue(), v1);
+}, {value: "1234\n56789\n00\n"});
+
+testCM("markTextStayGone", function(cm) {
+  var m1 = cm.markText(Pos(0, 0), Pos(0, 1));
+  cm.replaceRange("hi", Pos(0, 2));
+  m1.clear();
+  cm.undo();
+  eq(m1.find(), null);
+}, {value: "hello"});
+
+testCM("markTextAllowEmpty", function(cm) {
+  var m1 = cm.markText(Pos(0, 1), Pos(0, 2), {clearWhenEmpty: false});
+  is(m1.find());
+  cm.replaceRange("x", Pos(0, 0));
+  is(m1.find());
+  cm.replaceRange("y", Pos(0, 2));
+  is(m1.find());
+  cm.replaceRange("z", Pos(0, 3), Pos(0, 4));
+  is(!m1.find());
+  var m2 = cm.markText(Pos(0, 1), Pos(0, 2), {clearWhenEmpty: false,
+                                              inclusiveLeft: true,
+                                              inclusiveRight: true});
+  cm.replaceRange("q", Pos(0, 1), Pos(0, 2));
+  is(m2.find());
+  cm.replaceRange("", Pos(0, 0), Pos(0, 3));
+  is(!m2.find());
+  var m3 = cm.markText(Pos(0, 1), Pos(0, 1), {clearWhenEmpty: false});
+  cm.replaceRange("a", Pos(0, 3));
+  is(m3.find());
+  cm.replaceRange("b", Pos(0, 1));
+  is(!m3.find());
+}, {value: "abcde"});
+
+testCM("markTextStacked", function(cm) {
+  var m1 = cm.markText(Pos(0, 0), Pos(0, 0), {clearWhenEmpty: false});
+  var m2 = cm.markText(Pos(0, 0), Pos(0, 0), {clearWhenEmpty: false});
+  cm.replaceRange("B", Pos(0, 1));
+  is(m1.find() && m2.find());
+}, {value: "A"});
+
+testCM("undoPreservesNewMarks", function(cm) {
+  cm.markText(Pos(0, 3), Pos(0, 4));
+  cm.markText(Pos(1, 1), Pos(1, 3));
+  cm.replaceRange("", Pos(0, 3), Pos(3, 1));
+  var mBefore = cm.markText(Pos(0, 0), Pos(0, 1));
+  var mAfter = cm.markText(Pos(0, 5), Pos(0, 6));
+  var mAround = cm.markText(Pos(0, 2), Pos(0, 4));
+  cm.undo();
+  eqCursorPos(mBefore.find().from, Pos(0, 0));
+  eqCursorPos(mBefore.find().to, Pos(0, 1));
+  eqCursorPos(mAfter.find().from, Pos(3, 3));
+  eqCursorPos(mAfter.find().to, Pos(3, 4));
+  eqCursorPos(mAround.find().from, Pos(0, 2));
+  eqCursorPos(mAround.find().to, Pos(3, 2));
+  var found = cm.findMarksAt(Pos(2, 2));
+  eq(found.length, 1);
+  eq(found[0], mAround);
+}, {value: "aaaa\nbbbb\ncccc\ndddd"});
+
+testCM("markClearBetween", function(cm) {
+  cm.setValue("aaa\nbbb\nccc\nddd\n");
+  cm.markText(Pos(0, 0), Pos(2));
+  cm.replaceRange("aaa\nbbb\nccc", Pos(0, 0), Pos(2));
+  eq(cm.findMarksAt(Pos(1, 1)).length, 0);
+});
+
+testCM("findMarksMiddle", function(cm) {
+  var mark = cm.markText(Pos(1, 1), Pos(3, 1));
+  var found = cm.findMarks(Pos(2, 1), Pos(2, 2));
+  eq(found.length, 1);
+  eq(found[0], mark);
+}, {value: "line 0\nline 1\nline 2\nline 3"});
+
+testCM("deleteSpanCollapsedInclusiveLeft", function(cm) {
+  var from = Pos(1, 0), to = Pos(1, 1);
+  var m = cm.markText(from, to, {collapsed: true, inclusiveLeft: true});
+  // Delete collapsed span.
+  cm.replaceRange("", from, to);
+}, {value: "abc\nX\ndef"});
+
+testCM("markTextCSS", function(cm) {
+  function present() {
+    var spans = cm.display.lineDiv.getElementsByTagName("span");
+    for (var i = 0; i < spans.length; i++)
+      if (spans[i].style.color && spans[i].textContent == "cdef") return true;
+  }
+  var m = cm.markText(Pos(0, 2), Pos(0, 6), {css: "color: cyan"});
+  is(present());
+  m.clear();
+  is(!present());
+}, {value: "abcdefgh"});
+
+testCM("markTextWithAttributes", function(cm) {
+  function present() {
+    var spans = cm.display.lineDiv.getElementsByTagName("span");
+    for (var i = 0; i < spans.length; i++)
+      if (spans[i].getAttribute("label") == "label" && spans[i].textContent == "cdef") return true;
+  }
+  var m = cm.markText(Pos(0, 2), Pos(0, 6), {attributes: {label: "label"}});
+  is(present());
+  m.clear();
+  is(!present());
+}, {value: "abcdefgh"});
+
+testCM("bookmark", function(cm) {
+  function p(v) { return v && Pos(v[0], v[1]); }
+  forEach([{a: [1, 0], b: [1, 1], c: "", d: [1, 4]},
+           {a: [1, 1], b: [1, 1], c: "xx", d: [1, 7]},
+           {a: [1, 4], b: [1, 5], c: "ab", d: [1, 6]},
+           {a: [1, 4], b: [1, 6], c: "", d: null},
+           {a: [1, 5], b: [1, 6], c: "abc", d: [1, 5]},
+           {a: [1, 6], b: [1, 8], c: "", d: [1, 5]},
+           {a: [1, 4], b: [1, 4], c: "\n\n", d: [3, 1]},
+           {bm: [1, 9], a: [1, 1], b: [1, 1], c: "\n", d: [2, 8]}], function(test) {
+    cm.setValue("1234567890\n1234567890\n1234567890");
+    var b = cm.setBookmark(p(test.bm) || Pos(1, 5));
+    cm.replaceRange(test.c, p(test.a), p(test.b));
+    eqCursorPos(b.find(), p(test.d));
+  });
+});
+
+testCM("bookmarkInsertLeft", function(cm) {
+  var br = cm.setBookmark(Pos(0, 2), {insertLeft: false});
+  var bl = cm.setBookmark(Pos(0, 2), {insertLeft: true});
+  cm.setCursor(Pos(0, 2));
+  cm.replaceSelection("hi");
+  eqCursorPos(br.find(), Pos(0, 2));
+  eqCursorPos(bl.find(), Pos(0, 4));
+  cm.replaceRange("", Pos(0, 4), Pos(0, 5));
+  cm.replaceRange("", Pos(0, 2), Pos(0, 4));
+  cm.replaceRange("", Pos(0, 1), Pos(0, 2));
+  // Verify that deleting next to bookmarks doesn't kill them
+  eqCursorPos(br.find(), Pos(0, 1));
+  eqCursorPos(bl.find(), Pos(0, 1));
+}, {value: "abcdef"});
+
+testCM("bookmarkCursor", function(cm) {
+  var pos01 = cm.cursorCoords(Pos(0, 1)), pos11 = cm.cursorCoords(Pos(1, 1)),
+      pos20 = cm.cursorCoords(Pos(2, 0)), pos30 = cm.cursorCoords(Pos(3, 0)),
+      pos41 = cm.cursorCoords(Pos(4, 1));
+  cm.setBookmark(Pos(0, 1), {widget: document.createTextNode("←"), insertLeft: true});
+  cm.setBookmark(Pos(2, 0), {widget: document.createTextNode("←"), insertLeft: true});
+  cm.setBookmark(Pos(1, 1), {widget: document.createTextNode("→")});
+  cm.setBookmark(Pos(3, 0), {widget: document.createTextNode("→")});
+  var new01 = cm.cursorCoords(Pos(0, 1)), new11 = cm.cursorCoords(Pos(1, 1)),
+      new20 = cm.cursorCoords(Pos(2, 0)), new30 = cm.cursorCoords(Pos(3, 0));
+  near(new01.left, pos01.left, 1);
+  near(new01.top, pos01.top, 1);
+  is(new11.left > pos11.left, "at right, middle of line");
+  near(new11.top == pos11.top, 1);
+  near(new20.left, pos20.left, 1);
+  near(new20.top, pos20.top, 1);
+  is(new30.left > pos30.left, "at right, empty line");
+  near(new30.top, pos30, 1);
+  cm.setBookmark(Pos(4, 0), {widget: document.createTextNode("→")});
+  is(cm.cursorCoords(Pos(4, 1)).left > pos41.left, "single-char bug");
+}, {value: "foo\nbar\n\n\nx\ny"});
+
+testCM("multiBookmarkCursor", function(cm) {
+  var ms = [], m;
+  function add(insertLeft) {
+    for (var i = 0; i < 3; ++i) {
+      var node = document.createElement("span");
+      node.innerHTML = "X";
+      ms.push(cm.setBookmark(Pos(0, 1), {widget: node, insertLeft: insertLeft}));
+    }
+  }
+  var base1 = cm.cursorCoords(Pos(0, 1)).left, base4 = cm.cursorCoords(Pos(0, 4)).left;
+  add(true);
+  near(base1, cm.cursorCoords(Pos(0, 1)).left, 1);
+  while (m = ms.pop()) m.clear();
+  add(false);
+  near(base4, cm.cursorCoords(Pos(0, 1)).left, 1);
+}, {value: "abcdefg"});
+
+testCM("getAllMarks", function(cm) {
+  addDoc(cm, 10, 10);
+  var m1 = cm.setBookmark(Pos(0, 2));
+  var m2 = cm.markText(Pos(0, 2), Pos(3, 2));
+  var m3 = cm.markText(Pos(1, 2), Pos(1, 8));
+  var m4 = cm.markText(Pos(8, 0), Pos(9, 0));
+  eq(cm.getAllMarks().length, 4);
+  m1.clear();
+  m3.clear();
+  eq(cm.getAllMarks().length, 2);
+});
+
+testCM("setValueClears", function(cm) {
+  cm.addLineClass(0, "wrap", "foo");
+  var mark = cm.markText(Pos(0, 0), Pos(1, 1), {inclusiveLeft: true, inclusiveRight: true});
+  cm.setValue("foo");
+  is(!cm.lineInfo(0).wrapClass);
+  is(!mark.find());
+}, {value: "a\nb"});
+
+testCM("bug577", function(cm) {
+  cm.setValue("a\nb");
+  cm.clearHistory();
+  cm.setValue("fooooo");
+  cm.undo();
+});
+
+testCM("scrollSnap", function(cm) {
+  cm.setSize(100, 100);
+  addDoc(cm, 200, 200);
+  cm.setCursor(Pos(100, 180));
+  var info = cm.getScrollInfo();
+  is(info.left > 0 && info.top > 0);
+  cm.setCursor(Pos(0, 0));
+  info = cm.getScrollInfo();
+  is(info.left == 0 && info.top == 0, "scrolled clean to top");
+  cm.setCursor(Pos(100, 180));
+  cm.setCursor(Pos(199, 0));
+  info = cm.getScrollInfo();
+  is(info.left == 0 && info.top + 2 > info.height - cm.getScrollerElement().clientHeight, "scrolled clean to bottom");
+});
+
+testCM("scrollIntoView", function(cm) {
+  function test(line, ch, msg) {
+    var pos = Pos(line, ch);
+    cm.scrollIntoView(pos);
+    var outer = cm.getWrapperElement().getBoundingClientRect();
+    var box = cm.charCoords(pos, "window");
+    is(box.left >= outer.left, msg + " (left)");
+    is(box.right <= outer.right, msg + " (right)");
+    is(box.top >= outer.top, msg + " (top)");
+    is(box.bottom <= outer.bottom, msg + " (bottom)");
+  }
+  addDoc(cm, 200, 200);
+  test(199, 199, "bottom right");
+  test(0, 0, "top left");
+  test(100, 100, "center");
+  test(199, 0, "bottom left");
+  test(0, 199, "top right");
+  test(100, 100, "center again");
+});
+
+testCM("scrollBackAndForth", function(cm) {
+  addDoc(cm, 1, 200);
+  cm.operation(function() {
+    cm.scrollIntoView(Pos(199, 0));
+    cm.scrollIntoView(Pos(4, 0));
+  });
+  is(cm.getScrollInfo().top > 0);
+});
+
+testCM("selectAllNoScroll", function(cm) {
+  addDoc(cm, 1, 200);
+  cm.execCommand("selectAll");
+  eq(cm.getScrollInfo().top, 0);
+  cm.setCursor(199);
+  cm.execCommand("selectAll");
+  is(cm.getScrollInfo().top > 0);
+});
+
+testCM("selectionPos", function(cm) {
+  if (cm.getOption("inputStyle") != "textarea") return;
+  cm.setSize(100, 100);
+  addDoc(cm, 200, 100);
+  cm.setSelection(Pos(1, 100), Pos(98, 100));
+  var lineWidth = cm.charCoords(Pos(0, 200), "local").left;
+  var lineHeight = (cm.charCoords(Pos(99)).top - cm.charCoords(Pos(0)).top) / 100;
+  cm.scrollTo(0, 0);
+  var selElt = byClassName(cm.getWrapperElement(), "CodeMirror-selected");
+  var outer = cm.getWrapperElement().getBoundingClientRect();
+  var sawMiddle, sawTop, sawBottom;
+  for (var i = 0, e = selElt.length; i < e; ++i) {
+    var box = selElt[i].getBoundingClientRect();
+    var atLeft = box.left - outer.left < 30;
+    var width = box.right - box.left;
+    var atRight = box.right - outer.left > .8 * lineWidth;
+    if (atLeft && atRight) {
+      sawMiddle = true;
+      is(box.bottom - box.top > 90 * lineHeight, "middle high");
+      is(width > .9 * lineWidth, "middle wide");
+    } else {
+      is(width > .4 * lineWidth, "top/bot wide enough");
+      is(width < .6 * lineWidth, "top/bot slim enough");
+      if (atLeft) {
+        sawBottom = true;
+        is(box.top - outer.top > 96 * lineHeight, "bot below");
+      } else if (atRight) {
+        sawTop = true;
+        is(box.top - outer.top < 2.1 * lineHeight, "top above");
+      }
+    }
+  }
+  is(sawTop && sawBottom && sawMiddle, "all parts");
+}, null);
+
+testCM("restoreHistory", function(cm) {
+  cm.setValue("abc\ndef");
+  cm.replaceRange("hello", Pos(1, 0), Pos(1));
+  cm.replaceRange("goop", Pos(0, 0), Pos(0));
+  cm.undo();
+  var storedVal = cm.getValue(), storedHist = cm.getHistory();
+  if (window.JSON) storedHist = JSON.parse(JSON.stringify(storedHist));
+  eq(storedVal, "abc\nhello");
+  cm.setValue("");
+  cm.clearHistory();
+  eq(cm.historySize().undo, 0);
+  cm.setValue(storedVal);
+  cm.setHistory(storedHist);
+  cm.redo();
+  eq(cm.getValue(), "goop\nhello");
+  cm.undo(); cm.undo();
+  eq(cm.getValue(), "abc\ndef");
+});
+
+testCM("doubleScrollbar", function(cm) {
+  var dummy = document.body.appendChild(document.createElement("p"));
+  dummy.style.cssText = "height: 50px; overflow: scroll; width: 50px";
+  var scrollbarWidth = dummy.offsetWidth + 1 - dummy.clientWidth;
+  document.body.removeChild(dummy);
+  if (scrollbarWidth < 2) return;
+  cm.setSize(null, 100);
+  addDoc(cm, 1, 300);
+  var wrap = cm.getWrapperElement();
+  is(wrap.offsetWidth - byClassName(wrap, "CodeMirror-lines")[0].offsetWidth <= scrollbarWidth * 1.5);
+});
+
+testCM("weirdLinebreaks", function(cm) {
+  cm.setValue("foo\nbar\rbaz\r\nquux\n\rplop");
+  is(cm.getValue(), "foo\nbar\nbaz\nquux\n\nplop");
+  is(cm.lineCount(), 6);
+  cm.setValue("\n\n");
+  is(cm.lineCount(), 3);
+});
+
+testCM("setSize", function(cm) {
+  cm.setSize(100, 100);
+  var wrap = cm.getWrapperElement();
+  is(wrap.offsetWidth, 100);
+  is(wrap.offsetHeight, 100);
+  cm.setSize("100%", "3em");
+  is(wrap.style.width, "100%");
+  is(wrap.style.height, "3em");
+  cm.setSize(null, 40);
+  is(wrap.style.width, "100%");
+  is(wrap.style.height, "40px");
+});
+
+function foldLines(cm, start, end, autoClear) {
+  return cm.markText(Pos(start, 0), Pos(end - 1), {
+    inclusiveLeft: true,
+    inclusiveRight: true,
+    collapsed: true,
+    clearOnEnter: autoClear
+  });
+}
+
+testCM("collapsedLines", function(cm) {
+  addDoc(cm, 4, 10);
+  var range = foldLines(cm, 4, 5), cleared = 0;
+  CodeMirror.on(range, "clear", function() {cleared++;});
+  cm.setCursor(Pos(3, 0));
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(5, 0));
+  cm.replaceRange("abcdefg", Pos(3, 0), Pos(3));
+  cm.setCursor(Pos(3, 6));
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(5, 4));
+  cm.replaceRange("ab", Pos(3, 0), Pos(3));
+  cm.setCursor(Pos(3, 2));
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(5, 2));
+  cm.operation(function() {range.clear(); range.clear();});
+  eq(cleared, 1);
+});
+
+testCM("collapsedRangeCoordsChar", function(cm) {
+  var pos_1_3 = cm.charCoords(Pos(1, 3));
+  pos_1_3.left += 2; pos_1_3.top += 2;
+  var opts = {collapsed: true, inclusiveLeft: true, inclusiveRight: true};
+  var m1 = cm.markText(Pos(0, 0), Pos(2, 0), opts);
+  eqCharPos(cm.coordsChar(pos_1_3), Pos(3, 3));
+  m1.clear();
+  var m1 = cm.markText(Pos(0, 0), Pos(1, 1), {collapsed: true, inclusiveLeft: true});
+  var m2 = cm.markText(Pos(1, 1), Pos(2, 0), {collapsed: true, inclusiveRight: true});
+  eqCharPos(cm.coordsChar(pos_1_3), Pos(3, 3));
+  m1.clear(); m2.clear();
+  var m1 = cm.markText(Pos(0, 0), Pos(1, 6), opts);
+  eqCharPos(cm.coordsChar(pos_1_3), Pos(3, 3));
+}, {value: "123456\nabcdef\nghijkl\nmnopqr\n"});
+
+testCM("collapsedRangeBetweenLinesSelected", function(cm) {
+  if (cm.getOption("inputStyle") != "textarea") return;
+  var widget = document.createElement("span");
+  widget.textContent = "\u2194";
+  cm.markText(Pos(0, 3), Pos(1, 0), {replacedWith: widget});
+  cm.setSelection(Pos(0, 3), Pos(1, 0));
+  var selElts = byClassName(cm.getWrapperElement(), "CodeMirror-selected");
+  for (var i = 0, w = 0; i < selElts.length; i++)
+    w += selElts[i].offsetWidth;
+  is(w > 0);
+}, {value: "one\ntwo"});
+
+testCM("randomCollapsedRanges", function(cm) {
+  addDoc(cm, 20, 500);
+  cm.operation(function() {
+    for (var i = 0; i < 200; i++) {
+      var start = Pos(Math.floor(Math.random() * 500), Math.floor(Math.random() * 20));
+      if (i % 4)
+        try { cm.markText(start, Pos(start.line + 2, 1), {collapsed: true}); }
+        catch(e) { if (!/overlapping/.test(String(e))) throw e; }
+      else
+        cm.markText(start, Pos(start.line, start.ch + 4), {"className": "foo"});
+    }
+  });
+});
+
+testCM("hiddenLinesAutoUnfold", function(cm) {
+  var range = foldLines(cm, 1, 3, true), cleared = 0;
+  CodeMirror.on(range, "clear", function() {cleared++;});
+  cm.setCursor(Pos(3, 0));
+  eq(cleared, 0);
+  cm.execCommand("goCharLeft");
+  eq(cleared, 1);
+  range = foldLines(cm, 1, 3, true);
+  CodeMirror.on(range, "clear", function() {cleared++;});
+  eqCursorPos(cm.getCursor(), Pos(3, 0));
+  cm.setCursor(Pos(0, 3));
+  cm.execCommand("goCharRight");
+  eq(cleared, 2);
+}, {value: "abc\ndef\nghi\njkl"});
+
+testCM("hiddenLinesSelectAll", function(cm) {  // Issue #484
+  addDoc(cm, 4, 20);
+  foldLines(cm, 0, 10);
+  foldLines(cm, 11, 20);
+  CodeMirror.commands.selectAll(cm);
+  eqCursorPos(cm.getCursor(true), Pos(10, 0));
+  eqCursorPos(cm.getCursor(false), Pos(10, 4));
+});
+
+testCM("clickFold", function(cm) { // Issue #5392
+  cm.setValue("foo { bar }")
+  var widget = document.createElement("span")
+  widget.textContent = "<>"
+  cm.markText(Pos(0, 5), Pos(0, 10), {replacedWith: widget})
+  var after = cm.charCoords(Pos(0, 10))
+  var foundOn = cm.coordsChar({left: after.left - 1, top: after.top + 4})
+  is(foundOn.ch <= 5 || foundOn.ch >= 10, "Position is not inside the folded range")
+})
+
+testCM("everythingFolded", function(cm) {
+  addDoc(cm, 2, 2);
+  function enterPress() {
+    cm.triggerOnKeyDown({type: "keydown", keyCode: 13, preventDefault: function(){}, stopPropagation: function(){}});
+  }
+  var fold = foldLines(cm, 0, 2);
+  enterPress();
+  eq(cm.getValue(), "xx\nxx");
+  fold.clear();
+  fold = foldLines(cm, 0, 2, true);
+  eq(fold.find(), null);
+  enterPress();
+  eq(cm.getValue(), "\nxx\nxx");
+});
+
+testCM("structuredFold", function(cm) {
+  addDoc(cm, 4, 8);
+  var range = cm.markText(Pos(1, 2), Pos(6, 2), {
+    replacedWith: document.createTextNode("Q")
+  });
+  cm.setCursor(0, 3);
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(6, 2));
+  CodeMirror.commands.goCharLeft(cm);
+  eqCharPos(cm.getCursor(), Pos(1, 2));
+  CodeMirror.commands.delCharAfter(cm);
+  eq(cm.getValue(), "xxxx\nxxxx\nxxxx");
+  addDoc(cm, 4, 8);
+  range = cm.markText(Pos(1, 2), Pos(6, 2), {
+    replacedWith: document.createTextNode("M"),
+    clearOnEnter: true
+  });
+  var cleared = 0;
+  CodeMirror.on(range, "clear", function(){++cleared;});
+  cm.setCursor(0, 3);
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(6, 2));
+  CodeMirror.commands.goCharLeft(cm);
+  eqCharPos(cm.getCursor(), Pos(6, 1));
+  eq(cleared, 1);
+  range.clear();
+  eq(cleared, 1);
+  range = cm.markText(Pos(1, 2), Pos(6, 2), {
+    replacedWith: document.createTextNode("Q"),
+    clearOnEnter: true
+  });
+  range.clear();
+  cm.setCursor(1, 2);
+  CodeMirror.commands.goCharRight(cm);
+  eqCharPos(cm.getCursor(), Pos(1, 3));
+  range = cm.markText(Pos(2, 0), Pos(4, 4), {
+    replacedWith: document.createTextNode("M")
+  });
+  cm.setCursor(1, 0);
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(2, 0));
+}, null);
+
+testCM("nestedFold", function(cm) {
+  addDoc(cm, 10, 3);
+  function fold(ll, cl, lr, cr) {
+    return cm.markText(Pos(ll, cl), Pos(lr, cr), {collapsed: true});
+  }
+  var inner1 = fold(0, 6, 1, 3), inner2 = fold(0, 2, 1, 8), outer = fold(0, 1, 2, 3), inner0 = fold(0, 5, 0, 6);
+  cm.setCursor(0, 1);
+  CodeMirror.commands.goCharRight(cm);
+  eqCursorPos(cm.getCursor(), Pos(2, 3));
+  inner0.clear();
+  CodeMirror.commands.goCharLeft(cm);
+  eqCursorPos(cm.getCursor(), Pos(0, 1));
+  outer.clear();
+  CodeMirror.commands.goCharRight(cm);
+  eqCursorPos(cm.getCursor(), Pos(0, 2, "before"));
+  CodeMirror.commands.goCharRight(cm);
+  eqCursorPos(cm.getCursor(), Pos(1, 8));
+  inner2.clear();
+  CodeMirror.commands.goCharLeft(cm);
+  eqCursorPos(cm.getCursor(), Pos(1, 7, "after"));
+  cm.setCursor(0, 5);
+  CodeMirror.commands.goCharRight(cm);
+  eqCursorPos(cm.getCursor(), Pos(0, 6, "before"));
+  CodeMirror.commands.goCharRight(cm);
+  eqCursorPos(cm.getCursor(), Pos(1, 3));
+});
+
+testCM("badNestedFold", function(cm) {
+  addDoc(cm, 4, 4);
+  cm.markText(Pos(0, 2), Pos(3, 2), {collapsed: true});
+  var caught;
+  try {cm.markText(Pos(0, 1), Pos(0, 3), {collapsed: true});}
+  catch(e) {caught = e;}
+  is(caught instanceof Error, "no error");
+  is(/overlap/i.test(caught.message), "wrong error");
+});
+
+testCM("nestedFoldOnSide", function(cm) {
+  var m1 = cm.markText(Pos(0, 1), Pos(2, 1), {collapsed: true, inclusiveRight: true});
+  var m2 = cm.markText(Pos(0, 1), Pos(0, 2), {collapsed: true});
+  cm.markText(Pos(0, 1), Pos(0, 2), {collapsed: true}).clear();
+  try { cm.markText(Pos(0, 1), Pos(0, 2), {collapsed: true, inclusiveLeft: true}); }
+  catch(e) { var caught = e; }
+  is(caught && /overlap/i.test(caught.message));
+  var m3 = cm.markText(Pos(2, 0), Pos(2, 1), {collapsed: true});
+  var m4 = cm.markText(Pos(2, 0), Pos(2, 1), {collapse: true, inclusiveRight: true});
+  m1.clear(); m4.clear();
+  m1 = cm.markText(Pos(0, 1), Pos(2, 1), {collapsed: true});
+  cm.markText(Pos(2, 0), Pos(2, 1), {collapsed: true}).clear();
+  try { cm.markText(Pos(2, 0), Pos(2, 1), {collapsed: true, inclusiveRight: true}); }
+  catch(e) { var caught = e; }
+  is(caught && /overlap/i.test(caught.message));
+}, {value: "ab\ncd\ef"});
+
+testCM("editInFold", function(cm) {
+  addDoc(cm, 4, 6);
+  var m = cm.markText(Pos(1, 2), Pos(3, 2), {collapsed: true});
+  cm.replaceRange("", Pos(0, 0), Pos(1, 3));
+  cm.replaceRange("", Pos(2, 1), Pos(3, 3));
+  cm.replaceRange("a\nb\nc\nd", Pos(0, 1), Pos(1, 0));
+  cm.cursorCoords(Pos(0, 0));
+});
+
+testCM("wrappingInlineWidget", function(cm) {
+  cm.setSize("11em");
+  var w = document.createElement("span");
+  w.style.color = "red";
+  w.innerHTML = "one two three four";
+  cm.markText(Pos(0, 6), Pos(0, 9), {replacedWith: w});
+  var cur0 = cm.cursorCoords(Pos(0, 0)), cur1 = cm.cursorCoords(Pos(0, 10));
+  is(cur0.top < cur1.top);
+  is(cur0.bottom < cur1.bottom);
+  var curL = cm.cursorCoords(Pos(0, 6)), curR = cm.cursorCoords(Pos(0, 9));
+  eq(curL.top, cur0.top);
+  eq(curL.bottom, cur0.bottom);
+  eq(curR.top, cur1.top);
+  eq(curR.bottom, cur1.bottom);
+  cm.replaceRange("", Pos(0, 9), Pos(0));
+  curR = cm.cursorCoords(Pos(0, 9));
+  eq(curR.top, cur1.top);
+  eq(curR.bottom, cur1.bottom);
+}, {value: "1 2 3 xxx 4", lineWrapping: true});
+
+testCM("showEmptyWidgetSpan", function(cm) {
+  var marker = cm.markText(Pos(0, 2), Pos(0, 2), {
+    clearWhenEmpty: false,
+    replacedWith: document.createTextNode("X")
+  });
+  var text = cm.display.view[0].text;
+  eq(text.textContent || text.innerText, "abXc");
+}, {value: "abc"});
+
+testCM("changedInlineWidget", function(cm) {
+  cm.setSize("10em");
+  var w = document.createElement("span");
+  w.innerHTML = "x";
+  var m = cm.markText(Pos(0, 4), Pos(0, 5), {replacedWith: w});
+  w.innerHTML = "and now the widget is really really long all of a sudden and a scrollbar is needed";
+  m.changed();
+  var hScroll = byClassName(cm.getWrapperElement(), "CodeMirror-hscrollbar")[0];
+  is(hScroll.scrollWidth > hScroll.clientWidth);
+}, {value: "hello there"});
+
+testCM("changedBookmark", function(cm) {
+  cm.setSize("10em");
+  var w = document.createElement("span");
+  w.innerHTML = "x";
+  var m = cm.setBookmark(Pos(0, 4), {widget: w});
+  w.innerHTML = "and now the widget is really really long all of a sudden and a scrollbar is needed";
+  m.changed();
+  var hScroll = byClassName(cm.getWrapperElement(), "CodeMirror-hscrollbar")[0];
+  is(hScroll.scrollWidth > hScroll.clientWidth);
+}, {value: "abcdefg"});
+
+testCM("inlineWidget", function(cm) {
+  var w = cm.setBookmark(Pos(0, 2), {widget: document.createTextNode("uu")});
+  cm.setCursor(0, 2);
+  CodeMirror.commands.goLineDown(cm);
+  eqCharPos(cm.getCursor(), Pos(1, 4));
+  cm.setCursor(0, 2);
+  cm.replaceSelection("hi");
+  eqCharPos(w.find(), Pos(0, 2));
+  cm.setCursor(0, 1);
+  cm.replaceSelection("ay");
+  eqCharPos(w.find(), Pos(0, 4));
+  eq(cm.getLine(0), "uayuhiuu");
+}, {value: "uuuu\nuuuuuu"});
+
+testCM("wrappingAndResizing", function(cm) {
+  cm.setSize(null, "auto");
+  cm.setOption("lineWrapping", true);
+  var wrap = cm.getWrapperElement(), h0 = wrap.offsetHeight;
+  var doc = "xxx xxx xxx xxx xxx";
+  cm.setValue(doc);
+  for (var step = 10, w = cm.charCoords(Pos(0, 18), "div").right;; w += step) {
+    cm.setSize(w);
+    if (wrap.offsetHeight <= h0 * (opera_lt10 ? 1.2 : 1.5)) {
+      if (step == 10) { w -= 10; step = 1; }
+      else break;
+    }
+  }
+  // Ensure that putting the cursor at the end of the maximally long
+  // line doesn't cause wrapping to happen.
+  cm.setCursor(Pos(0, doc.length));
+  eq(wrap.offsetHeight, h0);
+  cm.replaceSelection("x");
+  is(wrap.offsetHeight > h0, "wrapping happens");
+  // Now add a max-height and, in a document consisting of
+  // almost-wrapped lines, go over it so that a scrollbar appears.
+  cm.setValue(doc + "\n" + doc + "\n");
+  cm.getScrollerElement().style.maxHeight = "100px";
+  cm.replaceRange("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n!\n", Pos(2, 0));
+  forEach([Pos(0, doc.length), Pos(0, doc.length - 1),
+           Pos(0, 0), Pos(1, doc.length), Pos(1, doc.length - 1)],
+          function(pos) {
+    var coords = cm.charCoords(pos);
+    eqCharPos(pos, cm.coordsChar({left: coords.left + 2, top: coords.top + 5}));
+  });
+}, null, ie_lt8);
+
+testCM("measureEndOfLine", function(cm) {
+  cm.setSize(null, "auto");
+  var inner = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild;
+  var lh = inner.offsetHeight;
+  for (var step = 10, w = cm.charCoords(Pos(0, 7), "div").right;; w += step) {
+    cm.setSize(w);
+    if (inner.offsetHeight < 2.5 * lh) {
+      if (step == 10) { w -= 10; step = 1; }
+      else break;
+    }
+  }
+  cm.setValue(cm.getValue() + "\n\n");
+  var endPos = cm.charCoords(Pos(0, 18), "local");
+  is(endPos.top > lh * .8, "not at top");
+  is(endPos.left > w - 20, "at right");
+  endPos = cm.charCoords(Pos(0, 18));
+  eqCursorPos(cm.coordsChar({left: endPos.left, top: endPos.top + 5}), Pos(0, 18, "before"));
+
+  var wrapPos = cm.cursorCoords(Pos(0, 9, "before"));
+  is(wrapPos.top < endPos.top, "wrapPos is actually in first line");
+  eqCursorPos(cm.coordsChar({left: wrapPos.left + 10, top: wrapPos.top}), Pos(0, 9, "before"));
+}, {mode: "text/html", value: "<!-- foo barrr -->", lineWrapping: true}, ie_lt8 || opera_lt10);
+
+testCM("measureWrappedEndOfLine", function(cm) {
+  cm.setSize(null, "auto");
+  var inner = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild;
+  var lh = inner.offsetHeight;
+  for (var step = 10, w = cm.charCoords(Pos(0, 7), "div").right;; w += step) {
+    cm.setSize(w);
+    if (inner.offsetHeight < 2.5 * lh) {
+      if (step == 10) { w -= 10; step = 1; }
+      else break;
+    }
+  }
+  for (var i = 0; i < 3; ++i) {
+    var endPos = cm.charCoords(Pos(0, 12)); // Next-to-last since last would wrap (#1862)
+    endPos.left += w; // Add width of editor just to be sure that we are behind last character
+    eqCursorPos(cm.coordsChar(endPos), Pos(0, 13, "before"));
+    endPos.left += w * 100;
+    eqCursorPos(cm.coordsChar(endPos), Pos(0, 13, "before"));
+    cm.setValue("0123456789abcابجابجابجابج");
+    if (i == 1) {
+      var node = document.createElement("div");
+      node.innerHTML = "hi"; node.style.height = "30px";
+      cm.addLineWidget(0, node, {above: true});
+    }
+  }
+}, {mode: "text/html", value: "0123456789abcde0123456789", lineWrapping: true}, ie_lt8 || opera_lt10);
+
+testCM("measureEndOfLineBidi", function(cm) {
+  eqCursorPos(cm.coordsChar({left: 5000, top: cm.charCoords(Pos(0, 0)).top}), Pos(0, 8, "after"))
+}, {value: "إإإإuuuuإإإإ"})
+
+testCM("measureWrappedBidiLevel2", function(cm) {
+  cm.setSize(cm.charCoords(Pos(0, 6), "editor").right + 60)
+  var c9 = cm.charCoords(Pos(0, 9))
+  eqCharPos(cm.coordsChar({left: c9.right - 1, top: c9.top + 1}), Pos(0, 9))
+}, {value: "foobar إإ إإ إإ إإ 555 بببببب", lineWrapping: true})
+
+testCM("measureWrappedBeginOfLine", function(cm) {
+  cm.setSize(null, "auto");
+  var inner = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild;
+  var lh = inner.offsetHeight;
+  for (var step = 10, w = cm.charCoords(Pos(0, 7), "div").right;; w += step) {
+    cm.setSize(w);
+    if (inner.offsetHeight < 2.5 * lh) {
+      if (step == 10) { w -= 10; step = 1; }
+      else break;
+    }
+  }
+  var beginOfSecondLine = Pos(0, 13, "after");
+  for (var i = 0; i < 2; ++i) {
+    var beginPos = cm.charCoords(Pos(0, 0));
+    beginPos.left -= w;
+    eqCursorPos(cm.coordsChar(beginPos), Pos(0, 0, "after"));
+    beginPos = cm.cursorCoords(beginOfSecondLine);
+    beginPos.left = 0;
+    eqCursorPos(cm.coordsChar(beginPos), beginOfSecondLine);
+    cm.setValue("0123456789abcابجابجابجابج");
+    beginOfSecondLine = Pos(0, 25, "before");
+  }
+}, {mode: "text/html", value: "0123456789abcde0123456789", lineWrapping: true});
+
+testCM("scrollVerticallyAndHorizontally", function(cm) {
+  if (cm.getOption("inputStyle") != "textarea") return;
+  cm.setSize(100, 100);
+  addDoc(cm, 40, 40);
+  cm.setCursor(39);
+  var wrap = cm.getWrapperElement(), bar = byClassName(wrap, "CodeMirror-vscrollbar")[0];
+  is(bar.offsetHeight < wrap.offsetHeight, "vertical scrollbar limited by horizontal one");
+  var cursorBox = byClassName(wrap, "CodeMirror-cursor")[0].getBoundingClientRect();
+  var editorBox = wrap.getBoundingClientRect();
+  is(cursorBox.bottom < editorBox.top + cm.getScrollerElement().clientHeight,
+     "bottom line visible");
+}, {lineNumbers: true});
+
+testCM("moveVstuck", function(cm) {
+  var lines = byClassName(cm.getWrapperElement(), "CodeMirror-lines")[0].firstChild, h0 = lines.offsetHeight;
+  var val = "fooooooooooooooooooooooooo baaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaar\n";
+  cm.setValue(val);
+  for (var w = cm.charCoords(Pos(0, 26), "div").right * 2.8;; w += 5) {
+    cm.setSize(w);
+    if (lines.offsetHeight <= 3.5 * h0) break;
+  }
+  cm.setCursor(Pos(0, val.length - 1));
+  cm.moveV(-1, "line");
+  eqCursorPos(cm.getCursor(), Pos(0, 27, "before"));
+  is(cm.cursorCoords(null, "local").top < h0, "cursor is in first visual line");
+}, {lineWrapping: true}, ie_lt8 || opera_lt10);
+
+testCM("collapseOnMove", function(cm) {
+  cm.setSelection(Pos(0, 1), Pos(2, 4));
+  cm.execCommand("goLineUp");
+  is(!cm.somethingSelected());
+  eqCharPos(cm.getCursor(), Pos(0, 1));
+  cm.setSelection(Pos(0, 1), Pos(2, 4));
+  cm.execCommand("goPageDown");
+  is(!cm.somethingSelected());
+  eqCharPos(cm.getCursor(), Pos(2, 4));
+  cm.execCommand("goLineUp");
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(0, 4));
+  cm.setSelection(Pos(0, 1), Pos(2, 4));
+  cm.execCommand("goCharLeft");
+  is(!cm.somethingSelected());
+  eqCharPos(cm.getCursor(), Pos(0, 1));
+}, {value: "aaaaa\nb\nccccc"});
+
+testCM("clickTab", function(cm) {
+  var p0 = cm.charCoords(Pos(0, 0));
+  eqCharPos(cm.coordsChar({left: p0.left + 5, top: p0.top + 5}), Pos(0, 0));
+  eqCharPos(cm.coordsChar({left: p0.right - 5, top: p0.top + 5}), Pos(0, 1));
+}, {value: "\t\n\n", lineWrapping: true, tabSize: 8});
+
+testCM("verticalScroll", function(cm) {
+  cm.setSize(100, 200);
+  cm.setValue("foo\nbar\nbaz\n");
+  var sc = cm.getScrollerElement(), baseWidth = sc.scrollWidth;
+  cm.replaceRange("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah", Pos(0, 0), Pos(0));
+  is(sc.scrollWidth > baseWidth, "scrollbar present");
+  cm.replaceRange("foo", Pos(0, 0), Pos(0));
+  eq(sc.scrollWidth, baseWidth, "scrollbar gone");
+  cm.replaceRange("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah", Pos(0, 0), Pos(0));
+  cm.replaceRange("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbh", Pos(1, 0), Pos(1));
+  is(sc.scrollWidth > baseWidth, "present again");
+  var curWidth = sc.scrollWidth;
+  cm.replaceRange("foo", Pos(0, 0), Pos(0));
+  is(sc.scrollWidth < curWidth, "scrollbar smaller");
+  is(sc.scrollWidth > baseWidth, "but still present");
+});
+
+testCM("extraKeys", function(cm) {
+  var outcome;
+  function fakeKey(expected, code, props) {
+    if (typeof code == "string") code = code.charCodeAt(0);
+    var e = {type: "keydown", keyCode: code, preventDefault: function(){}, stopPropagation: function(){}};
+    if (props) for (var n in props) e[n] = props[n];
+    outcome = null;
+    cm.triggerOnKeyDown(e);
+    eq(outcome, expected);
+  }
+  CodeMirror.commands.testCommand = function() {outcome = "tc";};
+  CodeMirror.commands.goTestCommand = function() {outcome = "gtc";};
+  cm.setOption("extraKeys", {"Shift-X": function() {outcome = "sx";},
+                             "X": function() {outcome = "x";},
+                             "Ctrl-Alt-U": function() {outcome = "cau";},
+                             "End": "testCommand",
+                             "Home": "goTestCommand",
+                             "Tab": false});
+  fakeKey(null, "U");
+  fakeKey("cau", "U", {ctrlKey: true, altKey: true});
+  fakeKey(null, "U", {shiftKey: true, ctrlKey: true, altKey: true});
+  fakeKey("x", "X");
+  fakeKey("sx", "X", {shiftKey: true});
+  fakeKey("tc", 35);
+  fakeKey(null, 35, {shiftKey: true});
+  fakeKey("gtc", 36);
+  fakeKey("gtc", 36, {shiftKey: true});
+  fakeKey(null, 9);
+}, null, window.opera && mac);
+
+testCM("wordMovementCommands", function(cm) {
+  cm.execCommand("goWordLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 7, "before"));
+  cm.execCommand("goWordLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 5, "after"));
+  cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 12, "before"));
+  cm.execCommand("goWordLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 9, "after"));
+  cm.execCommand("goWordRight"); cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 24, "before"));
+  cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 9, "before"));
+  cm.execCommand("goWordRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 13, "before"));
+  cm.execCommand("goWordRight"); cm.execCommand("goWordRight");
+  eqCharPos(cm.getCursor(), Pos(2, 0));
+}, {value: "this is (the) firstline.\na foo12\u00e9\u00f8\u00d7bar\n"});
+
+testCM("groupMovementCommands", function(cm) {
+  cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 4, "before"));
+  cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 7, "before"));
+  cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 10, "before"));
+  cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 7, "after"));
+  cm.execCommand("goGroupRight"); cm.execCommand("goGroupRight"); cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 15, "before"));
+  cm.setCursor(Pos(0, 17));
+  cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 16, "after"));
+  cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 14, "after"));
+  cm.execCommand("goGroupRight"); cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 20, "before"));
+  cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 0, "after"));
+  cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 2, "before"));
+  cm.execCommand("goGroupRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 5, "before"));
+  cm.execCommand("goGroupLeft"); cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(1, 0, "after"));
+  cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 20, "after"));
+  cm.execCommand("goGroupLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 16, "after"));
+}, {value: "booo ba---quux. ffff\n  abc d"});
+
+testCM("groupsAndWhitespace", function(cm) {
+  var positions = [Pos(0, 0), Pos(0, 2), Pos(0, 5), Pos(0, 9), Pos(0, 11),
+                   Pos(1, 0), Pos(1, 2), Pos(1, 5)];
+  for (var i = 1; i < positions.length; i++) {
+    cm.execCommand("goGroupRight");
+    eqCharPos(cm.getCursor(), positions[i]);
+  }
+  for (var i = positions.length - 2; i >= 0; i--) {
+    cm.execCommand("goGroupLeft");
+    eqCharPos(cm.getCursor(), i == 2 ? Pos(0, 6, "before") : positions[i]);
+  }
+}, {value: "  foo +++  \n  bar"});
+
+testCM("charMovementCommands", function(cm) {
+  cm.execCommand("goCharLeft"); cm.execCommand("goColumnLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goCharRight"); cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 2, "before"));
+  cm.setCursor(Pos(1, 0));
+  cm.execCommand("goColumnLeft");
+  eqCursorPos(cm.getCursor(), Pos(1, 0));
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 5, "before"));
+  cm.execCommand("goColumnRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 5, "before"));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 0, "after"));
+  cm.execCommand("goLineEnd");
+  eqCursorPos(cm.getCursor(), Pos(1, 5, "before"));
+  cm.execCommand("goLineStartSmart");
+  eqCursorPos(cm.getCursor(), Pos(1, 1, "after"));
+  cm.execCommand("goLineStartSmart");
+  eqCursorPos(cm.getCursor(), Pos(1, 0, "after"));
+  cm.setCursor(Pos(2, 0));
+  cm.execCommand("goCharRight"); cm.execCommand("goColumnRight");
+  eqCursorPos(cm.getCursor(), Pos(2, 0));
+}, {value: "line1\n ine2\n"});
+
+testCM("verticalMovementCommands", function(cm) {
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(1, 0));
+  cm.setCursor(Pos(1, 12));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(2, 5));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(3, 0));
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(2, 5));
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(1, 12));
+  cm.execCommand("goPageDown");
+  eqCharPos(cm.getCursor(), Pos(5, 0));
+  cm.execCommand("goPageDown"); cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(5, 0));
+  cm.execCommand("goPageUp");
+  eqCharPos(cm.getCursor(), Pos(0, 0));
+}, {value: "line1\nlong long line2\nline3\n\nline5\n"});
+
+testCM("verticalMovementCommandsWrapping", function(cm) {
+  cm.setSize(120);
+  cm.setCursor(Pos(0, 5));
+  cm.execCommand("goLineDown");
+  eq(cm.getCursor().line, 0);
+  is(cm.getCursor().ch > 5, "moved beyond wrap");
+  for (var i = 0; ; ++i) {
+    is(i < 20, "no endless loop");
+    cm.execCommand("goLineDown");
+    var cur = cm.getCursor();
+    if (cur.line == 1) eq(cur.ch, 5);
+    if (cur.line == 2) { eq(cur.ch, 1); break; }
+  }
+}, {value: "a very long line that wraps around somehow so that we can test cursor movement\nshortone\nk",
+    lineWrapping: true});
+
+testCM("verticalMovementCommandsSingleLine", function(cm) {
+  cm.display.wrapper.style.height = "auto";
+  cm.refresh();
+  cm.execCommand("goLineUp");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goLineDown");
+  eqCursorPos(cm.getCursor(), Pos(0, 11));
+  cm.setCursor(Pos(0, 5));
+  cm.execCommand("goLineDown");
+  eqCursorPos(cm.getCursor(), Pos(0, 11));
+  cm.execCommand("goLineDown");
+  eqCursorPos(cm.getCursor(), Pos(0, 11));
+  cm.execCommand("goLineUp");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goLineUp");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goPageDown");
+  eqCursorPos(cm.getCursor(), Pos(0, 11));
+  cm.execCommand("goPageDown"); cm.execCommand("goLineDown");
+  eqCursorPos(cm.getCursor(), Pos(0, 11));
+  cm.execCommand("goPageUp");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.setCursor(Pos(0, 5));
+  cm.execCommand("goPageUp");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.setCursor(Pos(0, 5));
+  cm.execCommand("goPageDown");
+  eqCursorPos(cm.getCursor(), Pos(0, 11));
+}, {value: "single line"});
+
+
+testCM("rtlMovement", function(cm) {
+  if (cm.getOption("inputStyle") != "textarea") return;
+  forEach(["خحج", "خحabcخحج", "abخحخحجcd", "abخde", "abخح2342خ1حج", "خ1ح2خح3حxج",
+           "خحcd", "1خحcd", "abcdeح1ج", "خمرحبها مها!", "foobarر", "خ ة ق",
+           "<img src=\"/בדיקה3.jpg\">", "يتم السحب في 05 فبراير 2014"], function(line) {
+    cm.setValue(line + "\n"); cm.execCommand("goLineStart");
+    var cursors = byClassName(cm.getWrapperElement(), "CodeMirror-cursors")[0];
+    var cursor = cursors.firstChild;
+    var prevX = cursor.offsetLeft, prevY = cursor.offsetTop;
+    for (var i = 0; i <= line.length; ++i) {
+      cm.execCommand("goCharRight");
+      cursor = cursors.firstChild;
+      if (i == line.length) is(cursor.offsetTop > prevY, "next line");
+      else is(cursor.offsetLeft > prevX, "moved right");
+      prevX = cursor.offsetLeft; prevY = cursor.offsetTop;
+    }
+    cm.setCursor(0, 0); cm.execCommand("goLineEnd");
+    prevX = cursors.firstChild.offsetLeft;
+    for (var i = 0; i < line.length; ++i) {
+      cm.execCommand("goCharLeft");
+      cursor = cursors.firstChild;
+      is(cursor.offsetLeft < prevX, "moved left");
+      prevX = cursor.offsetLeft;
+    }
+  });
+}, null, ie_lt9);
+
+// Verify that updating a line clears its bidi ordering
+testCM("bidiUpdate", function(cm) {
+  cm.setCursor(Pos(0, 2, "before"));
+  cm.replaceSelection("خحج", "start");
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 6, "before"));
+}, {value: "abcd\n"});
+
+testCM("movebyTextUnit", function(cm) {
+  cm.setValue("בְּרֵאשִ\nééé́\n");
+  cm.execCommand("goLineStart");
+  for (var i = 0; i < 4; ++i) cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 0, "after"));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 0, "after"));
+  cm.execCommand("goCharRight");
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 4, "before"));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(1, 7, "before"));
+});
+
+testCM("lineChangeEvents", function(cm) {
+  addDoc(cm, 3, 5);
+  var log = [], want = ["ch 0", "ch 1", "del 2", "ch 0", "ch 0", "del 1", "del 3", "del 4"];
+  for (var i = 0; i < 5; ++i) {
+    CodeMirror.on(cm.getLineHandle(i), "delete", function(i) {
+      return function() {log.push("del " + i);};
+    }(i));
+    CodeMirror.on(cm.getLineHandle(i), "change", function(i) {
+      return function() {log.push("ch " + i);};
+    }(i));
+  }
+  cm.replaceRange("x", Pos(0, 1));
+  cm.replaceRange("xy", Pos(1, 1), Pos(2));
+  cm.replaceRange("foo\nbar", Pos(0, 1));
+  cm.replaceRange("", Pos(0, 0), Pos(cm.lineCount()));
+  eq(log.length, want.length, "same length");
+  for (var i = 0; i < log.length; ++i)
+    eq(log[i], want[i]);
+});
+
+testCM("scrollEntirelyToRight", function(cm) {
+  if (cm.getOption("inputStyle") != "textarea") return;
+  addDoc(cm, 500, 2);
+  cm.setCursor(Pos(0, 500));
+  var wrap = cm.getWrapperElement(), cur = byClassName(wrap, "CodeMirror-cursor")[0];
+  is(wrap.getBoundingClientRect().right > cur.getBoundingClientRect().left);
+});
+
+testCM("lineWidgets", function(cm) {
+  addDoc(cm, 500, 3);
+  var last = cm.charCoords(Pos(2, 0));
+  var node = document.createElement("div");
+  node.innerHTML = "hi";
+  var widget = cm.addLineWidget(1, node);
+  is(last.top < cm.charCoords(Pos(2, 0)).top, "took up space");
+  cm.setCursor(Pos(1, 1));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(2, 1));
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(1, 1));
+});
+
+testCM("lineWidgetFocus", function(cm) {
+  var place = document.getElementById("testground");
+  place.className = "offscreen";
+  try {
+    addDoc(cm, 500, 10);
+    var node = document.createElement("input");
+    var widget = cm.addLineWidget(1, node);
+    node.focus();
+    eq(document.activeElement, node);
+    cm.replaceRange("new stuff", Pos(1, 0));
+    eq(document.activeElement, node);
+  } finally {
+    place.className = "";
+  }
+});
+
+testCM("lineWidgetCautiousRedraw", function(cm) {
+  var node = document.createElement("div");
+  node.innerHTML = "hahah";
+  var w = cm.addLineWidget(0, node);
+  var redrawn = false;
+  w.on("redraw", function() { redrawn = true; });
+  cm.replaceSelection("0");
+  is(!redrawn);
+}, {value: "123\n456"});
+
+
+var knownScrollbarWidth;
+function scrollbarWidth(measure) {
+  if (knownScrollbarWidth != null) return knownScrollbarWidth;
+  var div = document.createElement('div');
+  div.style.cssText = "width: 50px; height: 50px; overflow-x: scroll";
+  document.body.appendChild(div);
+  knownScrollbarWidth = div.offsetHeight - div.clientHeight;
+  document.body.removeChild(div);
+  return knownScrollbarWidth || 0;
+}
+
+testCM("lineWidgetChanged", function(cm) {
+  addDoc(cm, 2, 300);
+  var halfScrollbarWidth = scrollbarWidth(cm.display.measure)/2;
+  cm.setOption('lineNumbers', true);
+  cm.setSize(600, cm.defaultTextHeight() * 50);
+  cm.scrollTo(null, cm.heightAtLine(125, "local"));
+
+  var expectedWidgetHeight = 60;
+  var expectedLinesInWidget = 3;
+  function w() {
+    var node = document.createElement("div");
+    // we use these children with just under half width of the line to check measurements are made with correct width
+    // when placed in the measure div.
+    // If the widget is measured at a width much narrower than it is displayed at, the underHalf children will span two lines and break the test.
+    // If the widget is measured at a width much wider than it is displayed at, the overHalf children will combine and break the test.
+    // Note that this test only checks widgets where coverGutter is true, because these require extra styling to get the width right.
+    // It may also be worthwhile to check this for non-coverGutter widgets.
+    // Visually:
+    // Good:
+    // | ------------- display width ------------- |
+    // | ------- widget-width when measured ------ |
+    // | | -- under-half -- | | -- under-half -- | |
+    // | | --- over-half --- |                     |
+    // | | --- over-half --- |                     |
+    // Height: measured as 3 lines, same as it will be when actually displayed
+
+    // Bad (too narrow):
+    // | ------------- display width ------------- |
+    // | ------ widget-width when measured ----- |  < -- uh oh
+    // | | -- under-half -- |                    |
+    // | | -- under-half -- |                    |  < -- when measured, shoved to next line
+    // | | --- over-half --- |                   |
+    // | | --- over-half --- |                   |
+    // Height: measured as 4 lines, more than expected . Will be displayed as 3 lines!
+
+    // Bad (too wide):
+    // | ------------- display width ------------- |
+    // | -------- widget-width when measured ------- | < -- uh oh
+    // | | -- under-half -- | | -- under-half -- |   |
+    // | | --- over-half --- | | --- over-half --- | | < -- when measured, combined on one line
+    // Height: measured as 2 lines, less than expected. Will be displayed as 3 lines!
+
+    var barelyUnderHalfWidthHtml = '<div style="display: inline-block; height: 1px; width: '+(285 - halfScrollbarWidth)+'px;"></div>';
+    var barelyOverHalfWidthHtml = '<div style="display: inline-block; height: 1px; width: '+(305 - halfScrollbarWidth)+'px;"></div>';
+    node.innerHTML = new Array(3).join(barelyUnderHalfWidthHtml) + new Array(3).join(barelyOverHalfWidthHtml);
+    node.style.cssText = "background: yellow;font-size:0;line-height: " + (expectedWidgetHeight/expectedLinesInWidget) + "px;";
+    return node;
+  }
+  var info0 = cm.getScrollInfo();
+  var w0 = cm.addLineWidget(0, w(), { coverGutter: true });
+  var w150 = cm.addLineWidget(150, w(), { coverGutter: true });
+  var w300 = cm.addLineWidget(300, w(), { coverGutter: true });
+  var info1 = cm.getScrollInfo();
+  eq(info0.height + (3 * expectedWidgetHeight), info1.height);
+  eq(info0.top + expectedWidgetHeight, info1.top);
+  expectedWidgetHeight = 12;
+  w0.node.style.lineHeight = w150.node.style.lineHeight = w300.node.style.lineHeight = (expectedWidgetHeight/expectedLinesInWidget) + "px";
+  w0.changed(); w150.changed(); w300.changed();
+  var info2 = cm.getScrollInfo();
+  eq(info0.height + (3 * expectedWidgetHeight), info2.height);
+  eq(info0.top + expectedWidgetHeight, info2.top);
+});
+
+testCM("lineWidgetIssue5486", function(cm) {
+  // [prepare]
+  // 2nd line is combined to 1st line due to markText
+  // 2nd line has a lineWidget below
+
+  cm.setValue("Lorem\nIpsue\nDollar")
+
+  var el = document.createElement('div')
+  el.style.height='50px'
+  el.textContent = '[[LINE WIDGET]]'
+  
+  var lineWidget = cm.addLineWidget(1, el, {
+    above: false,
+    coverGutter: false,
+    noHScroll: false,
+    showIfHidden: false,
+  })
+  
+  var marker = document.createElement('span')
+  marker.textContent = '[--]'
+  
+  cm.markText({line:0, ch: 1}, {line:1, ch: 4}, {
+    replacedWith: marker
+  })
+
+  // before resizing the lineWidget, measure 3rd line position
+
+  var measure_1 = Math.round(cm.charCoords({line:2, ch:0}).top)
+  
+  // resize lineWidget, height + 50 px
+
+  el.style.height='100px'
+  el.textContent += "\nlineWidget size changed.\nTry moving cursor to line 3?"
+  
+  lineWidget.changed()
+
+  // re-measure 3rd line position
+  var measure_2 = Math.round(cm.charCoords({line:2, ch:0}).top)
+  eq(measure_2, measure_1 + 50)
+
+  // (extra test)
+  //
+  // add char to the right of the folded marker
+  // and re-measure 3rd line position
+
+  cm.replaceRange('-', {line:1, ch: 5})
+  var measure_3 = Math.round(cm.charCoords({line:2, ch:0}).top)
+  eq(measure_3, measure_2)
+});
+
+testCM("getLineNumber", function(cm) {
+  addDoc(cm, 2, 20);
+  var h1 = cm.getLineHandle(1);
+  eq(cm.getLineNumber(h1), 1);
+  cm.replaceRange("hi\nbye\n", Pos(0, 0));
+  eq(cm.getLineNumber(h1), 3);
+  cm.setValue("");
+  eq(cm.getLineNumber(h1), null);
+});
+
+testCM("jumpTheGap", function(cm) {
+  var longLine = "abcdef ghiklmnop qrstuvw xyz ";
+  longLine += longLine; longLine += longLine; longLine += longLine;
+  cm.replaceRange(longLine, Pos(2, 0), Pos(2));
+  cm.setSize("200px", null);
+  cm.getWrapperElement().style.lineHeight = 2;
+  cm.refresh();
+  cm.setCursor(Pos(0, 1));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(1, 1));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(2, 1));
+  cm.execCommand("goLineDown");
+  eq(cm.getCursor().line, 2);
+  is(cm.getCursor().ch > 1);
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(2, 1));
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(1, 1));
+  var node = document.createElement("div");
+  node.innerHTML = "hi"; node.style.height = "30px";
+  cm.addLineWidget(0, node);
+  cm.addLineWidget(1, node.cloneNode(true), {above: true});
+  cm.setCursor(Pos(0, 2));
+  cm.execCommand("goLineDown");
+  eqCharPos(cm.getCursor(), Pos(1, 2));
+  cm.execCommand("goLineUp");
+  eqCharPos(cm.getCursor(), Pos(0, 2));
+}, {lineWrapping: true, value: "abc\ndef\nghi\njkl\n"});
+
+testCM("addLineClass", function(cm) {
+  function cls(line, text, bg, wrap, gutter) {
+    var i = cm.lineInfo(line);
+    eq(i.textClass, text);
+    eq(i.bgClass, bg);
+    eq(i.wrapClass, wrap);
+    if (typeof i.handle.gutterClass !== 'undefined') {
+        eq(i.handle.gutterClass, gutter);
+    }
+  }
+  cm.addLineClass(0, "text", "foo");
+  cm.addLineClass(0, "text", "bar");
+  cm.addLineClass(1, "background", "baz");
+  cm.addLineClass(1, "wrap", "foo");
+  cm.addLineClass(1, "gutter", "gutter-class");
+  cls(0, "foo bar", null, null, null);
+  cls(1, null, "baz", "foo", "gutter-class");
+  var lines = cm.display.lineDiv;
+  eq(byClassName(lines, "foo").length, 2);
+  eq(byClassName(lines, "bar").length, 1);
+  eq(byClassName(lines, "baz").length, 1);
+  eq(byClassName(lines, "gutter-class").length, 2); // Gutter classes are reflected in 2 nodes
+  cm.removeLineClass(0, "text", "foo");
+  cls(0, "bar", null, null, null);
+  cm.removeLineClass(0, "text", "foo");
+  cls(0, "bar", null, null, null);
+  cm.removeLineClass(0, "text", "bar");
+  cls(0, null, null, null);
+
+  cm.addLineClass(1, "wrap", "quux");
+  cls(1, null, "baz", "foo quux", "gutter-class");
+  cm.removeLineClass(1, "wrap");
+  cls(1, null, "baz", null, "gutter-class");
+  cm.removeLineClass(1, "gutter", "gutter-class");
+  eq(byClassName(lines, "gutter-class").length, 0);
+  cls(1, null, "baz", null, null);
+
+  cm.addLineClass(1, "gutter", "gutter-class");
+  cls(1, null, "baz", null, "gutter-class");
+  cm.removeLineClass(1, "gutter", "gutter-class");
+  cls(1, null, "baz", null, null);
+
+}, {value: "hohoho\n", lineNumbers: true});
+
+testCM("atomicMarker", function(cm) {
+  addDoc(cm, 10, 10);
+
+  function atom(ll, cl, lr, cr, li, ri, ls, rs) {
+    var options = {
+      atomic: true,
+      inclusiveLeft: li,
+      inclusiveRight: ri
+    };
+
+    if (ls === true || ls === false) options.selectLeft = ls;
+    if (rs === true || rs === false) options.selectRight = rs;
+
+    return cm.markText(Pos(ll, cl), Pos(lr, cr), options);
+  }
+
+  // Can cursor to the left and right of a normal marker by jumping across it
+  var m = atom(0, 1, 0, 5);
+  cm.setCursor(Pos(0, 1));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 5));
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 1));
+  m.clear();
+
+  // Can't cursor to the left of a marker when inclusiveLeft=true
+  m = atom(0, 0, 0, 5, true);
+  eqCursorPos(cm.getCursor(), Pos(0, 5), "pushed out");
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 5));
+  m.clear();
+
+  // Can't cursor to the left of a marker when inclusiveLeft=false and selectLeft=false
+  m = atom(0, 0, 0, 5, false, false, false);
+  cm.setCursor(Pos(0, 5));
+  eqCursorPos(cm.getCursor(), Pos(0, 5), "pushed out");
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 5));
+  m.clear();
+
+  // Can cursor to the left of a marker when inclusiveLeft=false and selectLeft=True
+  m = atom(0, 0, 0, 5, false, false, true);
+  cm.setCursor(Pos(0, 5));
+  eqCursorPos(cm.getCursor(), Pos(0, 5), "pushed out");
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  m.clear();
+
+  // Can't cursor to the right of a marker when inclusiveRight=true
+  m = atom(0, 0, 0, 5, false, true);
+  cm.setCursor(Pos(0, 0));
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 6));
+  m.clear();
+
+  // Can't cursor to the right of a marker when inclusiveRight=false and selectRight=false
+  m = atom(0, 0, 0, 5, false, false, true, false);
+  cm.setCursor(Pos(0, 0));
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 6));
+  m.clear();
+
+  // Can cursor to the right of a marker when inclusiveRight=false and selectRight=True
+  m = atom(0, 0, 0, 5, false, false, true, true);
+  cm.setCursor(Pos(0, 0));
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(0, 5));
+  m.clear();
+
+  // Can't cursor to the right of a multiline marker when inclusiveRight=true
+  m = atom(8, 4, 9, 10, false, true);
+  cm.setCursor(Pos(9, 8));
+  eqCursorPos(cm.getCursor(), Pos(8, 4), "set");
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(8, 4), "char right");
+  cm.execCommand("goLineDown");
+  eqCursorPos(cm.getCursor(), Pos(8, 4), "line down");
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(8, 3, "after"));
+  m.clear();
+
+  // Cursor jumps across a multiline atomic marker,
+  // and backspace deletes the entire marker
+  m = atom(1, 1, 3, 8);
+  cm.setCursor(Pos(0, 0));
+  cm.setCursor(Pos(2, 0));
+  eqCursorPos(cm.getCursor(), Pos(3, 8));
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(1, 1));
+  cm.execCommand("goCharRight");
+  eqCursorPos(cm.getCursor(), Pos(3, 8));
+  cm.execCommand("goLineUp");
+  eqCursorPos(cm.getCursor(), Pos(1, 1));
+  cm.execCommand("goLineDown");
+  eqCursorPos(cm.getCursor(), Pos(3, 8));
+  cm.execCommand("delCharBefore");
+  eq(cm.getValue().length, 80, "del chunk");
+  m.clear();
+  addDoc(cm, 10, 10);
+
+  // Delete before an atomic marker deletes the entire marker
+  m = atom(3, 0, 5, 5);
+  cm.setCursor(Pos(3, 0));
+  cm.execCommand("delWordAfter");
+  eq(cm.getValue().length, 82, "del chunk");
+  m.clear();
+  addDoc(cm, 10, 10);
+});
+
+testCM("selectionBias", function(cm) {
+  cm.markText(Pos(0, 1), Pos(0, 3), {atomic: true});
+  cm.setCursor(Pos(0, 2));
+  eqCursorPos(cm.getCursor(), Pos(0, 1));
+  cm.setCursor(Pos(0, 2));
+  eqCursorPos(cm.getCursor(), Pos(0, 3));
+  cm.setCursor(Pos(0, 2));
+  eqCursorPos(cm.getCursor(), Pos(0, 1));
+  cm.setCursor(Pos(0, 2), null, {bias: -1});
+  eqCursorPos(cm.getCursor(), Pos(0, 1));
+  cm.setCursor(Pos(0, 4));
+  cm.setCursor(Pos(0, 2), null, {bias: 1});
+  eqCursorPos(cm.getCursor(), Pos(0, 3));
+}, {value: "12345"});
+
+testCM("selectionHomeEnd", function(cm) {
+  cm.markText(Pos(1, 0), Pos(1, 1), {atomic: true, inclusiveLeft: true});
+  cm.markText(Pos(1, 3), Pos(1, 4), {atomic: true, inclusiveRight: true});
+  cm.setCursor(Pos(1, 2));
+  cm.execCommand("goLineStart");
+  eqCursorPos(cm.getCursor(), Pos(1, 1));
+  cm.execCommand("goLineEnd");
+  eqCursorPos(cm.getCursor(), Pos(1, 3));
+}, {value: "ab\ncdef\ngh"});
+
+testCM("readOnlyMarker", function(cm) {
+  function mark(ll, cl, lr, cr, at) {
+    return cm.markText(Pos(ll, cl), Pos(lr, cr),
+                       {readOnly: true, atomic: at});
+  }
+  var m = mark(0, 1, 0, 4);
+  cm.setCursor(Pos(0, 2));
+  cm.replaceSelection("hi", "end");
+  eqCursorPos(cm.getCursor(), Pos(0, 2));
+  eq(cm.getLine(0), "abcde");
+  cm.execCommand("selectAll");
+  cm.replaceSelection("oops", "around");
+  eq(cm.getValue(), "oopsbcd");
+  cm.undo();
+  eqCursorPos(m.find().from, Pos(0, 1));
+  eqCursorPos(m.find().to, Pos(0, 4));
+  m.clear();
+  cm.setCursor(Pos(0, 2));
+  cm.replaceSelection("hi", "around");
+  eq(cm.getLine(0), "abhicde");
+  eqCursorPos(cm.getCursor(), Pos(0, 4));
+  m = mark(0, 2, 2, 2, true);
+  cm.setSelection(Pos(1, 1), Pos(2, 4));
+  cm.replaceSelection("t", "end");
+  eqCursorPos(cm.getCursor(), Pos(2, 3));
+  eq(cm.getLine(2), "klto");
+  cm.execCommand("goCharLeft");
+  cm.execCommand("goCharLeft");
+  eqCursorPos(cm.getCursor(), Pos(0, 2));
+  cm.setSelection(Pos(0, 1), Pos(0, 3));
+  cm.replaceSelection("xx", "around");
+  eqCursorPos(cm.getCursor(), Pos(0, 3));
+  eq(cm.getLine(0), "axxhicde");
+}, {value: "abcde\nfghij\nklmno\n"});
+
+testCM("dirtyBit", function(cm) {
+  eq(cm.isClean(), true);
+  cm.replaceSelection("boo", null, "test");
+  eq(cm.isClean(), false);
+  cm.undo();
+  eq(cm.isClean(), true);
+  cm.replaceSelection("boo", null, "test");
+  cm.replaceSelection("baz", null, "test");
+  cm.undo();
+  eq(cm.isClean(), false);
+  cm.markClean();
+  eq(cm.isClean(), true);
+  cm.undo();
+  eq(cm.isClean(), false);
+  cm.redo();
+  eq(cm.isClean(), true);
+});
+
+testCM("changeGeneration", function(cm) {
+  cm.replaceSelection("x");
+  var softGen = cm.changeGeneration();
+  cm.replaceSelection("x");
+  cm.undo();
+  eq(cm.getValue(), "");
+  is(!cm.isClean(softGen));
+  cm.replaceSelection("x");
+  var hardGen = cm.changeGeneration(true);
+  cm.replaceSelection("x");
+  cm.undo();
+  eq(cm.getValue(), "x");
+  is(cm.isClean(hardGen));
+});
+
+testCM("addKeyMap", function(cm) {
+  function sendKey(code) {
+    cm.triggerOnKeyDown({type: "keydown", keyCode: code,
+                         preventDefault: function(){}, stopPropagation: function(){}});
+  }
+
+  sendKey(39);
+  eqCursorPos(cm.getCursor(), Pos(0, 1, "before"));
+  var test = 0;
+  var map1 = {Right: function() { ++test; }}, map2 = {Right: function() { test += 10; }}
+  cm.addKeyMap(map1);
+  sendKey(39);
+  eqCursorPos(cm.getCursor(), Pos(0, 1, "before"));
+  eq(test, 1);
+  cm.addKeyMap(map2, true);
+  sendKey(39);
+  eq(test, 2);
+  cm.removeKeyMap(map1);
+  sendKey(39);
+  eq(test, 12);
+  cm.removeKeyMap(map2);
+  sendKey(39);
+  eq(test, 12);
+  eqCursorPos(cm.getCursor(), Pos(0, 2, "before"));
+  cm.addKeyMap({Right: function() { test = 55; }, name: "mymap"});
+  sendKey(39);
+  eq(test, 55);
+  cm.removeKeyMap("mymap");
+  sendKey(39);
+  eqCursorPos(cm.getCursor(), Pos(0, 3, "before"));
+}, {value: "abc"});
+
+function mouseDown(cm, button, pos, mods) {
+  var coords = cm.charCoords(pos, "window")
+  var event = {type: "mousedown",
+               preventDefault: Math.min,
+               which: button,
+               target: cm.display.lineDiv,
+               clientX: coords.left, clientY: coords.top}
+  if (mods) for (var prop in mods) event[prop] = mods[prop]
+  cm.triggerOnMouseDown(event)
+}
+
+testCM("mouseBinding", function(cm) {
+  var fired = []
+  cm.addKeyMap({
+    "Shift-LeftClick": function(_cm, pos) {
+      eqCharPos(pos, Pos(1, 2))
+      fired.push("a")
+    },
+    "Shift-LeftDoubleClick": function() { fired.push("b") },
+    "Shift-LeftTripleClick": function() { fired.push("c") }
+  })
+
+  function send(button, mods) { mouseDown(cm, button, Pos(1, 2), mods) }
+  send(1, {shiftKey: true})
+  send(1, {shiftKey: true})
+  send(1, {shiftKey: true})
+  send(1, {})
+  send(2, {ctrlKey: true})
+  send(2, {ctrlKey: true})
+  eq(fired.join(" "), "a b c")
+}, {value: "foo\nbar\nbaz"})
+
+testCM("configureMouse", function(cm) {
+  cm.setOption("configureMouse", function() { return {unit: "word"} })
+  mouseDown(cm, 1, Pos(0, 5))
+  eqCharPos(cm.getCursor("from"), Pos(0, 4))
+  eqCharPos(cm.getCursor("to"), Pos(0, 7))
+  cm.setOption("configureMouse", function() { return {extend: true} })
+  mouseDown(cm, 1, Pos(0, 0))
+  eqCharPos(cm.getCursor("from"), Pos(0, 0))
+  eqCharPos(cm.getCursor("to"), Pos(0, 4))
+}, {value: "foo bar baz"})
+
+testCM("findPosH", function(cm) {
+  forEach([{from: Pos(0, 0), to: Pos(0, 1, "before"), by: 1},
+           {from: Pos(0, 0), to: Pos(0, 0), by: -1, hitSide: true},
+           {from: Pos(0, 0), to: Pos(0, 4, "before"), by: 1, unit: "word"},
+           {from: Pos(0, 0), to: Pos(0, 8, "before"), by: 2, unit: "word"},
+           {from: Pos(0, 0), to: Pos(2, 0, "after"), by: 20, unit: "word", hitSide: true},
+           {from: Pos(0, 7), to: Pos(0, 5, "after"), by: -1, unit: "word"},
+           {from: Pos(0, 4), to: Pos(0, 8, "before"), by: 1, unit: "word"},
+           {from: Pos(1, 0), to: Pos(1, 18, "before"), by: 3, unit: "word"},
+           {from: Pos(1, 22), to: Pos(1, 5, "after"), by: -3, unit: "word"},
+           {from: Pos(1, 15), to: Pos(1, 10, "after"), by: -5},
+           {from: Pos(1, 15), to: Pos(1, 10, "after"), by: -5, unit: "column"},
+           {from: Pos(1, 15), to: Pos(1, 0, "after"), by: -50, unit: "column", hitSide: true},
+           {from: Pos(1, 15), to: Pos(1, 24, "before"), by: 50, unit: "column", hitSide: true},
+           {from: Pos(1, 15), to: Pos(2, 0, "after"), by: 50, hitSide: true}], function(t) {
+    var r = cm.findPosH(t.from, t.by, t.unit || "char");
+    eqCursorPos(r, t.to);
+    eq(!!r.hitSide, !!t.hitSide);
+  });
+}, {value: "line one\nline two.something.other\n"});
+
+testCM("beforeChange", function(cm) {
+  cm.on("beforeChange", function(cm, change) {
+    var text = [];
+    for (var i = 0; i < change.text.length; ++i)
+      text.push(change.text[i].replace(/\s/g, "_"));
+    change.update(null, null, text);
+  });
+  cm.setValue("hello, i am a\nnew document\n");
+  eq(cm.getValue(), "hello,_i_am_a\nnew_document\n");
+  CodeMirror.on(cm.getDoc(), "beforeChange", function(doc, change) {
+    if (change.from.line == 0) change.cancel();
+  });
+  cm.setValue("oops"); // Canceled
+  eq(cm.getValue(), "hello,_i_am_a\nnew_document\n");
+  cm.replaceRange("hey hey hey", Pos(1, 0), Pos(2, 0));
+  eq(cm.getValue(), "hello,_i_am_a\nhey_hey_hey");
+}, {value: "abcdefghijk"});
+
+testCM("beforeChangeUndo", function(cm) {
+  cm.replaceRange("hi", Pos(0, 0), Pos(0));
+  cm.replaceRange("bye", Pos(0, 0), Pos(0));
+  eq(cm.historySize().undo, 2);
+  cm.on("beforeChange", function(cm, change) {
+    is(!change.update);
+    change.cancel();
+  });
+  cm.undo();
+  eq(cm.historySize().undo, 0);
+  eq(cm.getValue(), "bye\ntwo");
+}, {value: "one\ntwo"});
+
+testCM("beforeSelectionChange", function(cm) {
+  function notAtEnd(cm, pos) {
+    var len = cm.getLine(pos.line).length;
+    if (!len || pos.ch == len) return Pos(pos.line, pos.ch - 1);
+    return pos;
+  }
+  cm.on("beforeSelectionChange", function(cm, obj) {
+    obj.update([{anchor: notAtEnd(cm, obj.ranges[0].anchor),
+                 head: notAtEnd(cm, obj.ranges[0].head)}]);
+  });
+
+  addDoc(cm, 10, 10);
+  cm.execCommand("goLineEnd");
+  eqCursorPos(cm.getCursor(), Pos(0, 9));
+  cm.execCommand("selectAll");
+  eqCursorPos(cm.getCursor("start"), Pos(0, 0));
+  eqCursorPos(cm.getCursor("end"), Pos(9, 9));
+});
+
+testCM("change_removedText", function(cm) {
+  cm.setValue("abc\ndef");
+
+  var removedText = [];
+  cm.on("change", function(cm, change) {
+    removedText.push(change.removed);
+  });
+
+  cm.operation(function() {
+    cm.replaceRange("xyz", Pos(0, 0), Pos(1,1));
+    cm.replaceRange("123", Pos(0,0));
+  });
+
+  eq(removedText.length, 2);
+  eq(removedText[0].join("\n"), "abc\nd");
+  eq(removedText[1].join("\n"), "");
+
+  var removedText = [];
+  cm.undo();
+  eq(removedText.length, 2);
+  eq(removedText[0].join("\n"), "123");
+  eq(removedText[1].join("\n"), "xyz");
+
+  var removedText = [];
+  cm.redo();
+  eq(removedText.length, 2);
+  eq(removedText[0].join("\n"), "abc\nd");
+  eq(removedText[1].join("\n"), "");
+});
+
+testCM("lineStyleFromMode", function(cm) {
+  CodeMirror.defineMode("test_mode", function() {
+    return {token: function(stream) {
+      if (stream.match(/^\[[^\]]*\]/)) return "  line-brackets  ";
+      if (stream.match(/^\([^\)]*\)/)) return "  line-background-parens  ";
+      if (stream.match(/^<[^>]*>/)) return "  span  line-line  line-background-bg  ";
+      stream.match(/^\s+|^\S+/);
+    }};
+  });
+  cm.setOption("mode", "test_mode");
+  var bracketElts = byClassName(cm.getWrapperElement(), "brackets");
+  eq(bracketElts.length, 1, "brackets count");
+  eq(bracketElts[0].nodeName, "PRE");
+  is(!/brackets.*brackets/.test(bracketElts[0].className));
+  var parenElts = byClassName(cm.getWrapperElement(), "parens");
+  eq(parenElts.length, 1, "parens count");
+  eq(parenElts[0].nodeName, "DIV");
+  is(!/parens.*parens/.test(parenElts[0].className));
+  eq(parenElts[0].parentElement.nodeName, "DIV");
+
+  is(byClassName(cm.getWrapperElement(), "bg").length > 0);
+  is(byClassName(cm.getWrapperElement(), "line").length > 0);
+  var spanElts = byClassName(cm.getWrapperElement(), "cm-span");
+  eq(spanElts.length, 2);
+  is(/^\s*cm-span\s*$/.test(spanElts[0].className));
+}, {value: "line1: [br] [br]\nline2: (par) (par)\nline3: <tag> <tag>"});
+
+testCM("lineStyleFromBlankLine", function(cm) {
+  CodeMirror.defineMode("lineStyleFromBlankLine_mode", function() {
+    return {token: function(stream) { stream.skipToEnd(); return "comment"; },
+            blankLine: function() { return "line-blank"; }};
+  });
+  cm.setOption("mode", "lineStyleFromBlankLine_mode");
+  var blankElts = byClassName(cm.getWrapperElement(), "blank");
+  eq(blankElts.length, 1);
+  eq(blankElts[0].nodeName, "PRE");
+  cm.replaceRange("x", Pos(1, 0));
+  blankElts = byClassName(cm.getWrapperElement(), "blank");
+  eq(blankElts.length, 0);
+}, {value: "foo\n\nbar"});
+
+CodeMirror.registerHelper("xxx", "a", "A");
+CodeMirror.registerHelper("xxx", "b", "B");
+CodeMirror.defineMode("yyy", function() {
+  return {
+    token: function(stream) { stream.skipToEnd(); },
+    xxx: ["a", "b", "q"]
+  };
+});
+CodeMirror.registerGlobalHelper("xxx", "c", function(m) { return m.enableC; }, "C");
+
+testCM("helpers", function(cm) {
+  cm.setOption("mode", "yyy");
+  eq(cm.getHelpers(Pos(0, 0), "xxx").join("/"), "A/B");
+  cm.setOption("mode", {name: "yyy", modeProps: {xxx: "b", enableC: true}});
+  eq(cm.getHelpers(Pos(0, 0), "xxx").join("/"), "B/C");
+  cm.setOption("mode", "javascript");
+  eq(cm.getHelpers(Pos(0, 0), "xxx").join("/"), "");
+});
+
+testCM("selectionHistory", function(cm) {
+  for (var i = 0; i < 3; i++) {
+    cm.setExtending(true);
+    cm.execCommand("goCharRight");
+    cm.setExtending(false);
+    cm.execCommand("goCharRight");
+    cm.execCommand("goCharRight");
+  }
+  cm.execCommand("undoSelection");
+  eq(cm.getSelection(), "c");
+  cm.execCommand("undoSelection");
+  eq(cm.getSelection(), "");
+  eqCursorPos(cm.getCursor(), Pos(0, 4, "before"));
+  cm.execCommand("undoSelection");
+  eq(cm.getSelection(), "b");
+  cm.execCommand("redoSelection");
+  eq(cm.getSelection(), "");
+  eqCursorPos(cm.getCursor(), Pos(0, 4, "before"));
+  cm.execCommand("redoSelection");
+  eq(cm.getSelection(), "c");
+  cm.execCommand("redoSelection");
+  eq(cm.getSelection(), "");
+  eqCursorPos(cm.getCursor(), Pos(0, 6, "before"));
+}, {value: "a b c d"});
+
+testCM("selectionChangeReducesRedo", function(cm) {
+  cm.replaceSelection("X");
+  cm.execCommand("goCharRight");
+  cm.undoSelection();
+  cm.execCommand("selectAll");
+  cm.undoSelection();
+  eq(cm.getValue(), "Xabc");
+  eqCursorPos(cm.getCursor(), Pos(0, 1));
+  cm.undoSelection();
+  eq(cm.getValue(), "abc");
+}, {value: "abc"});
+
+testCM("selectionHistoryNonOverlapping", function(cm) {
+  cm.setSelection(Pos(0, 0), Pos(0, 1));
+  cm.setSelection(Pos(0, 2), Pos(0, 3));
+  cm.execCommand("undoSelection");
+  eqCursorPos(cm.getCursor("anchor"), Pos(0, 0));
+  eqCursorPos(cm.getCursor("head"), Pos(0, 1));
+}, {value: "1234"});
+
+testCM("cursorMotionSplitsHistory", function(cm) {
+  cm.replaceSelection("a");
+  cm.execCommand("goCharRight");
+  cm.replaceSelection("b");
+  cm.replaceSelection("c");
+  cm.undo();
+  eq(cm.getValue(), "a1234");
+  eqCursorPos(cm.getCursor(), Pos(0, 2, "before"));
+  cm.undo();
+  eq(cm.getValue(), "1234");
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+}, {value: "1234"});
+
+testCM("selChangeInOperationDoesNotSplit", function(cm) {
+  for (var i = 0; i < 4; i++) {
+    cm.operation(function() {
+      cm.replaceSelection("x");
+      cm.setCursor(Pos(0, cm.getCursor().ch - 1));
+    });
+  }
+  eqCursorPos(cm.getCursor(), Pos(0, 0));
+  eq(cm.getValue(), "xxxxa");
+  cm.undo();
+  eq(cm.getValue(), "a");
+}, {value: "a"});
+
+testCM("alwaysMergeSelEventWithChangeOrigin", function(cm) {
+  cm.replaceSelection("U", null, "foo");
+  cm.setSelection(Pos(0, 0), Pos(0, 1), {origin: "foo"});
+  cm.undoSelection();
+  eq(cm.getValue(), "a");
+  cm.replaceSelection("V", null, "foo");
+  cm.setSelection(Pos(0, 0), Pos(0, 1), {origin: "bar"});
+  cm.undoSelection();
+  eq(cm.getValue(), "Va");
+}, {value: "a"});
+
+testCM("getTokenAt", function(cm) {
+  var tokPlus = cm.getTokenAt(Pos(0, 2));
+  eq(tokPlus.type, "operator");
+  eq(tokPlus.string, "+");
+  var toks = cm.getLineTokens(0);
+  eq(toks.length, 3);
+  forEach([["number", "1"], ["operator", "+"], ["number", "2"]], function(expect, i) {
+    eq(toks[i].type, expect[0]);
+    eq(toks[i].string, expect[1]);
+  });
+}, {value: "1+2", mode: "javascript"});
+
+testCM("getTokenTypeAt", function(cm) {
+  eq(cm.getTokenTypeAt(Pos(0, 0)), "number");
+  eq(cm.getTokenTypeAt(Pos(0, 6)), "string");
+  cm.addOverlay({
+    token: function(stream) {
+      if (stream.match("foo")) return "foo";
+      else stream.next();
+    }
+  });
+  eq(byClassName(cm.getWrapperElement(), "cm-foo").length, 1);
+  eq(cm.getTokenTypeAt(Pos(0, 6)), "string");
+}, {value: "1 + 'foo'", mode: "javascript"});
+
+testCM("addOverlay", function(cm) {
+  cm.addOverlay({
+    token: function(stream) {
+      var base = stream.baseToken()
+      if (!/comment/.test(base.type) && stream.match(/\d+/)) return "x"
+      stream.next()
+    }
+  })
+  var x = byClassName(cm.getWrapperElement(), "cm-x")
+  is(x.length, 1)
+  is(x[0].textContent, "233")
+  cm.replaceRange("", Pos(0, 4), Pos(0, 6))
+  is(byClassName(cm.getWrapperElement(), "cm-x").length, 2)
+}, {value: "foo /* 100 */\nbar + 233;\nbaz", mode: "javascript"})
+
+testCM("resizeLineWidget", function(cm) {
+  addDoc(cm, 200, 3);
+  var widget = document.createElement("pre");
+  widget.innerHTML = "imwidget";
+  widget.style.background = "yellow";
+  cm.addLineWidget(1, widget, {noHScroll: true});
+  cm.setSize(40);
+  is(widget.parentNode.offsetWidth < 42);
+});
+
+testCM("combinedOperations", function(cm) {
+  var place = document.getElementById("testground");
+  var other = CodeMirror(place, {value: "123"});
+  try {
+    cm.operation(function() {
+      cm.addLineClass(0, "wrap", "foo");
+      other.addLineClass(0, "wrap", "foo");
+    });
+    eq(byClassName(cm.getWrapperElement(), "foo").length, 1);
+    eq(byClassName(other.getWrapperElement(), "foo").length, 1);
+    cm.operation(function() {
+      cm.removeLineClass(0, "wrap", "foo");
+      other.removeLineClass(0, "wrap", "foo");
+    });
+    eq(byClassName(cm.getWrapperElement(), "foo").length, 0);
+    eq(byClassName(other.getWrapperElement(), "foo").length, 0);
+  } finally {
+    place.removeChild(other.getWrapperElement());
+  }
+}, {value: "abc"});
+
+testCM("eventOrder", function(cm) {
+  var seen = [];
+  cm.on("change", function() {
+    if (!seen.length) cm.replaceSelection(".");
+    seen.push("change");
+  });
+  cm.on("cursorActivity", function() {
+    cm.replaceSelection("!");
+    seen.push("activity");
+  });
+  cm.replaceSelection("/");
+  eq(seen.join(","), "change,change,activity,change");
+});
+
+testCM("splitSpaces_nonspecial", function(cm) {
+  eq(byClassName(cm.getWrapperElement(), "cm-invalidchar").length, 0);
+}, {
+  specialChars: /[\u00a0]/,
+  value: "spaces ->            <- between"
+});
+
+test("core_rmClass", function() {
+  var node = document.createElement("div");
+  node.className = "foo-bar baz-quux yadda";
+  CodeMirror.rmClass(node, "quux");
+  eq(node.className, "foo-bar baz-quux yadda");
+  CodeMirror.rmClass(node, "baz-quux");
+  eq(node.className, "foo-bar yadda");
+  CodeMirror.rmClass(node, "yadda");
+  eq(node.className, "foo-bar");
+  CodeMirror.rmClass(node, "foo-bar");
+  eq(node.className, "");
+  node.className = " foo ";
+  CodeMirror.rmClass(node, "foo");
+  eq(node.className, "");
+});
+
+test("core_addClass", function() {
+  var node = document.createElement("div");
+  CodeMirror.addClass(node, "a");
+  eq(node.className, "a");
+  CodeMirror.addClass(node, "a");
+  eq(node.className, "a");
+  CodeMirror.addClass(node, "b");
+  eq(node.className, "a b");
+  CodeMirror.addClass(node, "a");
+  CodeMirror.addClass(node, "b");
+  eq(node.className, "a b");
+});
+
+testCM("lineSeparator", function(cm) {
+  eq(cm.lineCount(), 3);
+  eq(cm.getLine(1), "bar\r");
+  eq(cm.getLine(2), "baz\rquux");
+  cm.setOption("lineSeparator", "\r");
+  eq(cm.lineCount(), 5);
+  eq(cm.getLine(4), "quux");
+  eq(cm.getValue(), "foo\rbar\r\rbaz\rquux");
+  eq(cm.getValue("\n"), "foo\nbar\n\nbaz\nquux");
+  cm.setOption("lineSeparator", null);
+  cm.setValue("foo\nbar\r\nbaz\rquux");
+  eq(cm.lineCount(), 4);
+}, {value: "foo\nbar\r\nbaz\rquux",
+    lineSeparator: "\n"});
+
+var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/
+var getChar = function (noExtending) { var res; do {res = String.fromCharCode(Math.floor(Math.random()*0x8ac)); } while ([0x90].indexOf(res.charCodeAt(0)) != -1 || (noExtending && extendingChars.test(res))); return res }
+var getString = function (n) { var res = getChar(true); while (--n > 0) res += getChar(); return res }
+
+function makeItWrapAfter(cm, pos) {
+  var firstLineTop = cm.cursorCoords(Pos(0, 0)).top;
+  for(var w = 0, posTop; posTop != firstLineTop; ++w) {
+    cm.setSize(w);
+    posTop = cm.charCoords(pos).top;
+  }
+}
+
+function countIf(arr, f) {
+  var result = 0
+  for (var i = 0; i < arr.length; i++) if (f[arr[i]]) result++
+  return result
+}
+
+function testMoveBidi(str) {
+  testCM("move_bidi_" + str, function(cm) {
+    if (cm.getOption("inputStyle") != "textarea" || !cm.getOption("rtlMoveVisually")) return;
+    cm.getScrollerElement().style.fontFamily = "monospace";
+    makeItWrapAfter(cm, Pos(0, 5));
+
+    var steps = str.length - countIf(str.split(""), function(ch) { return extendingChars.test(ch) });
+    var lineBreaks = {}
+    lineBreaks[6 - countIf(str.substr(0, 5).split(""), function(ch) { return extendingChars.test(ch) })] = 'w';
+    if (str.indexOf("\n") != -1) {
+      lineBreaks[steps - 2] = 'n';
+    }
+
+    // Make sure we are at the visual beginning of the first line
+    cm.execCommand("goLineStart");
+
+    var prevCoords = cm.cursorCoords(), coords;
+    for(var i = 0; i < steps; ++i) {
+      cm.execCommand("goCharRight");
+      coords = cm.cursorCoords();
+      if ((i >= 10 && i <= 12) && !lineBreaks[i] && coords.left < prevCoords.left && coords.top > prevCoords.top) {
+        // The first line wraps twice
+        lineBreaks[i] = 'w';
+      }
+      if (!lineBreaks[i]) {
+        is(coords.left > prevCoords.left, "In step " + i + ", cursor didn't move right");
+        eq(coords.top, prevCoords.top, "In step " + i + ", cursor moved out of line");
+      } else {
+        is(coords.left < prevCoords.left, i);
+        is(coords.top > prevCoords.top, i);
+      }
+      prevCoords = coords;
+    }
+
+    cm.execCommand("goCharRight");
+    coords = cm.cursorCoords();
+    eq(coords.left, prevCoords.left, "Moving " + steps + " steps right didn't reach the end");
+    eq(coords.top, prevCoords.top, "Moving " + steps + " steps right didn't reach the end");
+
+    for(i = steps - 1; i >= 0; --i) {
+      cm.execCommand("goCharLeft");
+      coords = cm.cursorCoords();
+      if (!(lineBreaks[i] == 'n' || lineBreaks[i + 1] == 'w')) {
+        is(coords.left < prevCoords.left, "In step " + i + ", cursor didn't move left");
+        eq(coords.top, prevCoords.top, "In step " + i + ", cursor is not at the same line anymore");
+      } else {
+        is(coords.left > prevCoords.left, i);
+        is(coords.top < prevCoords.top, i);
+      }
+      prevCoords = coords;
+    }
+
+    cm.execCommand("goCharLeft");
+    coords = cm.cursorCoords();
+    eq(coords.left, prevCoords.left, "Moving " + steps + " steps left didn't reach the beginning");
+    eq(coords.top, prevCoords.top, "Moving " + steps + " steps left didn't reach the beginning");
+  }, {value: str, lineWrapping: true})
+};
+
+function testMoveEndBidi(str) {
+  testCM("move_end_bidi_" + str, function(cm) {
+    cm.getScrollerElement().style.fontFamily = "monospace";
+    makeItWrapAfter(cm, Pos(0, 5));
+
+    cm.execCommand("goLineStart");
+    var pos = cm.doc.getCursor();
+    cm.execCommand("goCharLeft");
+    eqCursorPos(pos, cm.doc.getCursor());
+
+    cm.execCommand("goLineEnd");
+    pos = cm.doc.getCursor();
+    cm.execCommand("goColumnRight");
+    eqCursorPos(pos, cm.doc.getCursor());
+  }, {value: str, lineWrapping: true})
+};
+
+var bidiTests = [];
+
+// We don't correctly implement L1 UBA
+// See https://bugzilla.mozilla.org/show_bug.cgi?id=1331501
+// and https://bugs.chromium.org/p/chromium/issues/detail?id=673405
+/*
+bidiTests.push("Say ا ب جabj\nS");
+bidiTests.push("Sayyy ا ا ب ج");
+*/
+
+bidiTests.push("Όȝǝڪȉۥ״ۺ׆ɀҩۏ\nҳ");
+if (!window.automatedTests) bidiTests.push("ŌӰтقȤ؁ƥ؅٣ĎȺ١\nϚ");
+bidiTests.push("ٻоҤѕѽΩ־؉ïίքdz\nٵ");
+bidiTests.push("؅؁ĆՕƿɁǞϮؠȩóć\nď");
+bidiTests.push("RŨďңŪzϢŎƏԖڇڦ\nӈ");
+bidiTests.push("ό׊۷٢ԜһОצЉيčǟ\nѩ");
+bidiTests.push("ۑÚҳҕڬġڹհяųKV\nr");
+bidiTests.push("źڻғúہ4ם1Ƞc1a\nԁ");
+bidiTests.push("ҒȨҟփƞ٦ԓȦڰғâƥ\nڤ");
+bidiTests.push("ϖسՉȏŧΔԛdžĎӟیڡ\nέ");
+bidiTests.push("۹ؼL۵ĺȧКԙػא7״\nم");
+bidiTests.push("ن (ي)\u2009أقواس"); // thin space to throw off Firefox 51's broken white-space compressing behavior
+
+bidiTests.push("քմѧǮßپüŢҍҞўڳ\nӧ");
+
+//bidiTests.push("Count ١ ٢ ٣ ٤");
+//bidiTests.push("ӣאƦϰ؊ȓېÛوը٬ز\nϪ");
+//bidiTests.push("ҾճٳџIՖӻ٥׭֐؜ڏ\nێ");
+//bidiTests.push("ҬÓФ؜ڂį٦Ͽɓڐͳٵ\nՈ");
+//bidiTests.push("aѴNijȻهˇ҃ڱӧǻֵ\na");
+//bidiTests.push(" a٧ا٢ ب جa\nS");
+
+for (var i = 0; i < bidiTests.length; ++i) {
+  testMoveBidi(bidiTests[i]);
+  testMoveEndBidi(bidiTests[i]);
+}
+
+/*
+for (var i = 0; i < 5; ++i) {
+  testMoveBidi(getString(12) + "\n" + getString(1));
+}
+*/
+
+function testCoordsWrappedBidi(str) {
+  testCM("coords_wrapped_bidi_" + str, function(cm) {
+    cm.getScrollerElement().style.fontFamily = "monospace";
+    makeItWrapAfter(cm, Pos(0, 5));
+
+    // Make sure we are at the visual beginning of the first line
+    var pos = Pos(0, 0), lastPos;
+    cm.doc.setCursor(pos);
+    do {
+      lastPos = pos;
+      cm.execCommand("goCharLeft");
+      pos = cm.doc.getCursor();
+    } while (pos != lastPos)
+
+    var top = cm.charCoords(Pos(0, 0)).top, lastTop;
+    for (var i = 1; i < str.length; ++i) {
+      lastTop = top;
+      top = cm.charCoords(Pos(0, i)).top;
+      is(top >= lastTop);
+    }
+  }, {value: str, lineWrapping: true})
+};
+
+testCoordsWrappedBidi("Count ١ ٢ ٣ ٤");
+/*
+for (var i = 0; i < 5; ++i) {
+  testCoordsWrappedBidi(getString(50));
+}
+*/
+
+testCM("rtl_wrapped_selection", function(cm) {
+  cm.setSelection(Pos(0, 10), Pos(0, 190))
+  is(byClassName(cm.getWrapperElement(), "CodeMirror-selected").length >= 3)
+}, {value: new Array(10).join(" فتي تم تضمينها فتي تم"), lineWrapping: true})
+
+testCM("bidi_wrapped_selection", function(cm) {
+  cm.setSize(cm.charCoords(Pos(0, 10), "editor").left)
+  cm.setSelection(Pos(0, 37), Pos(0, 80))
+  var blocks = byClassName(cm.getWrapperElement(), "CodeMirror-selected")
+  is(blocks.length >= 2)
+  is(blocks.length <= 3)
+  var boxTop = blocks[0].getBoundingClientRect(), boxBot = blocks[blocks.length - 1].getBoundingClientRect()
+  is(boxTop.left > cm.charCoords(Pos(0, 1)).right)
+  is(boxBot.right < cm.charCoords(Pos(0, cm.getLine(0).length - 2)).left)
+}, {value: "<p>مفتي11 تم تضمينهفتي تم تضمينها فتي تفتي تم تضمينها فتي تفتي تم تضمينها فتي تفتي تم تضمينها فتي تا فت10ي ت</p>", lineWrapping: true})
+
+testCM("delete_wrapped", function(cm) {
+  makeItWrapAfter(cm, Pos(0, 2));
+  cm.doc.setCursor(Pos(0, 3, "after"));
+  cm.deleteH(-1, "char");
+  eq(cm.getLine(0), "1245");
+}, {value: "12345", lineWrapping: true})
+
+testCM("issue_4878", function(cm) {
+  if (window.automatedTests) return
+  cm.setCursor(Pos(1, 12, "after"));
+  cm.moveH(-1, "char");
+  eqCursorPos(cm.getCursor(), Pos(0, 113, "before"));
+}, {value: "  في تطبيق السمات مرة واحدة https://github.com/codemirror/CodeMirror/issues/4878#issuecomment-330550964على سبيل المثال <code>\"foo bar\"</code>\n" +
+"  سيتم تعيين", direction: "rtl", lineWrapping: true});
+
+CodeMirror.defineMode("lookahead_mode", function() {
+  // Colors text as atom if the line two lines down has an x in it
+  return {
+    token: function(stream) {
+      stream.skipToEnd()
+      return /x/.test(stream.lookAhead(2)) ? "atom" : null
+    }
+  }
+})
+
+testCM("mode_lookahead", function(cm) {
+  eq(cm.getTokenAt(Pos(0, 1)).type, "atom")
+  eq(cm.getTokenAt(Pos(1, 1)).type, "atom")
+  eq(cm.getTokenAt(Pos(2, 1)).type, null)
+  cm.replaceRange("\n", Pos(2, 0))
+  eq(cm.getTokenAt(Pos(0, 1)).type, null)
+  eq(cm.getTokenAt(Pos(1, 1)).type, "atom")
+}, {value: "foo\na\nx\nx\n", mode: "lookahead_mode"})
+
+testCM("should have translate=no attribute", function(cm) {
+  eq(cm.getWrapperElement().getAttribute("translate"), "no")
+}, {})
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/3024-day.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,41 @@
+/*
+
+    Name:       3024 day
+    Author:     Jan T. Sott (http://github.com/idleberg)
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-3024-day.CodeMirror { background: #f7f7f7; color: #3a3432; }
+.cm-s-3024-day div.CodeMirror-selected { background: #d6d5d4; }
+
+.cm-s-3024-day .CodeMirror-line::selection, .cm-s-3024-day .CodeMirror-line > span::selection, .cm-s-3024-day .CodeMirror-line > span > span::selection { background: #d6d5d4; }
+.cm-s-3024-day .CodeMirror-line::-moz-selection, .cm-s-3024-day .CodeMirror-line > span::-moz-selection, .cm-s-3024-day .CodeMirror-line > span > span::selection { background: #d9d9d9; }
+
+.cm-s-3024-day .CodeMirror-gutters { background: #f7f7f7; border-right: 0px; }
+.cm-s-3024-day .CodeMirror-guttermarker { color: #db2d20; }
+.cm-s-3024-day .CodeMirror-guttermarker-subtle { color: #807d7c; }
+.cm-s-3024-day .CodeMirror-linenumber { color: #807d7c; }
+
+.cm-s-3024-day .CodeMirror-cursor { border-left: 1px solid #5c5855; }
+
+.cm-s-3024-day span.cm-comment { color: #cdab53; }
+.cm-s-3024-day span.cm-atom { color: #a16a94; }
+.cm-s-3024-day span.cm-number { color: #a16a94; }
+
+.cm-s-3024-day span.cm-property, .cm-s-3024-day span.cm-attribute { color: #01a252; }
+.cm-s-3024-day span.cm-keyword { color: #db2d20; }
+.cm-s-3024-day span.cm-string { color: #fded02; }
+
+.cm-s-3024-day span.cm-variable { color: #01a252; }
+.cm-s-3024-day span.cm-variable-2 { color: #01a0e4; }
+.cm-s-3024-day span.cm-def { color: #e8bbd0; }
+.cm-s-3024-day span.cm-bracket { color: #3a3432; }
+.cm-s-3024-day span.cm-tag { color: #db2d20; }
+.cm-s-3024-day span.cm-link { color: #a16a94; }
+.cm-s-3024-day span.cm-error { background: #db2d20; color: #5c5855; }
+
+.cm-s-3024-day .CodeMirror-activeline-background { background: #e8f2ff; }
+.cm-s-3024-day .CodeMirror-matchingbracket { text-decoration: underline; color: #a16a94 !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/3024-night.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,39 @@
+/*
+
+    Name:       3024 night
+    Author:     Jan T. Sott (http://github.com/idleberg)
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-3024-night.CodeMirror { background: #090300; color: #d6d5d4; }
+.cm-s-3024-night div.CodeMirror-selected { background: #3a3432; }
+.cm-s-3024-night .CodeMirror-line::selection, .cm-s-3024-night .CodeMirror-line > span::selection, .cm-s-3024-night .CodeMirror-line > span > span::selection { background: rgba(58, 52, 50, .99); }
+.cm-s-3024-night .CodeMirror-line::-moz-selection, .cm-s-3024-night .CodeMirror-line > span::-moz-selection, .cm-s-3024-night .CodeMirror-line > span > span::-moz-selection { background: rgba(58, 52, 50, .99); }
+.cm-s-3024-night .CodeMirror-gutters { background: #090300; border-right: 0px; }
+.cm-s-3024-night .CodeMirror-guttermarker { color: #db2d20; }
+.cm-s-3024-night .CodeMirror-guttermarker-subtle { color: #5c5855; }
+.cm-s-3024-night .CodeMirror-linenumber { color: #5c5855; }
+
+.cm-s-3024-night .CodeMirror-cursor { border-left: 1px solid #807d7c; }
+
+.cm-s-3024-night span.cm-comment { color: #cdab53; }
+.cm-s-3024-night span.cm-atom { color: #a16a94; }
+.cm-s-3024-night span.cm-number { color: #a16a94; }
+
+.cm-s-3024-night span.cm-property, .cm-s-3024-night span.cm-attribute { color: #01a252; }
+.cm-s-3024-night span.cm-keyword { color: #db2d20; }
+.cm-s-3024-night span.cm-string { color: #fded02; }
+
+.cm-s-3024-night span.cm-variable { color: #01a252; }
+.cm-s-3024-night span.cm-variable-2 { color: #01a0e4; }
+.cm-s-3024-night span.cm-def { color: #e8bbd0; }
+.cm-s-3024-night span.cm-bracket { color: #d6d5d4; }
+.cm-s-3024-night span.cm-tag { color: #db2d20; }
+.cm-s-3024-night span.cm-link { color: #a16a94; }
+.cm-s-3024-night span.cm-error { background: #db2d20; color: #807d7c; }
+
+.cm-s-3024-night .CodeMirror-activeline-background { background: #2F2F2F; }
+.cm-s-3024-night .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/abbott.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,268 @@
+/*
+ * abbott.css
+ * A warm, dark theme for prose and code, with pastels and pretty greens.
+ *
+ * Ported from abbott.vim (https://github.com/bcat/abbott.vim) version 2.1.
+ * Original design and CodeMirror port by Jonathan Rascher.
+ *
+ * This theme shares the following color palette with the Vim color scheme.
+ *
+ * Brown shades:
+ *   bistre: #231c14
+ *   chocolate: #3c3022
+ *   cocoa: #745d42
+ *   vanilla_cream: #fef3b4
+ *
+ * Red shades:
+ *   crimson: #d80450
+ *   cinnabar: #f63f05
+ *
+ * Green shades:
+ *   dark_olive: #273900
+ *   forest_green: #24a507
+ *   chartreuse: #a0ea00
+ *   pastel_chartreuse: #d8ff84
+ *
+ * Yellow shades:
+ *   marigold: #fbb32f
+ *   lemon_meringue: #fbec5d
+ *
+ * Blue shades:
+ *   cornflower_blue: #3f91f1
+ *   periwinkle_blue: #8ccdf0
+ *
+ * Magenta shades:
+ *   french_pink: #ec6c99
+ *   lavender: #e6a2f3
+ *
+ * Cyan shades:
+ *   zomp: #39a78d
+ *   seafoam_green: #00ff7f
+ */
+
+/* Style the UI: */
+
+/* Equivalent to Vim's Normal group. */
+.cm-s-abbott.CodeMirror {
+  background: #231c14 /* bistre */;
+  color: #d8ff84 /* pastel_chartreuse */;
+}
+
+/* Roughly equivalent to Vim's LineNr group. */
+.cm-s-abbott .CodeMirror-gutters {
+  background: #231c14 /* bistre */;
+  border: none;
+}
+.cm-s-abbott .CodeMirror-linenumber { color: #fbec5d /* lemon_meringue */; }
+
+.cm-s-abbott .CodeMirror-guttermarker { color: #f63f05 /* cinnabar */; }
+
+/* Roughly equivalent to Vim's FoldColumn group. */
+.cm-s-abbott .CodeMirror-guttermarker-subtle { color: #fbb32f /* marigold */; }
+
+/*
+ * Roughly equivalent to Vim's CursorColumn group. (We use a brighter color
+ * since Vim's cursorcolumn option highlights a whole column, whereas
+ * CodeMirror's rule just highlights a thin line.)
+ */
+.cm-s-abbott .CodeMirror-ruler { border-color: #745d42 /* cocoa */; }
+
+/* Equivalent to Vim's Cursor group in insert mode. */
+.cm-s-abbott .CodeMirror-cursor { border-color: #a0ea00 /* chartreuse */; }
+
+/* Equivalent to Vim's Cursor group in normal mode. */
+.cm-s-abbott.cm-fat-cursor .CodeMirror-cursor,
+.cm-s-abbott .cm-animate-fat-cursor {
+  /*
+   * CodeMirror doesn't allow changing the foreground color of the character
+   * under the cursor, so we can't use a reverse video effect for the cursor.
+   * Instead, make it semitransparent.
+   */
+  background: rgba(160, 234, 0, 0.5) /* chartreuse */;
+}
+.cm-s-abbott.cm-fat-cursor .CodeMirror-cursors {
+  /*
+   * Boost the z-index so the fat cursor shows up on top of text and
+   * matchingbracket/matchingtag highlights.
+   */
+  z-index: 3;
+}
+
+/* Equivalent to Vim's Cursor group in replace mode. */
+.cm-s-abbott .CodeMirror-overwrite .CodeMirror-cursor {
+  border-bottom: 1px solid #a0ea00 /* chartreuse */;
+  border-left: none;
+  width: auto;
+}
+
+/* Roughly equivalent to Vim's CursorIM group. */
+.cm-s-abbott .CodeMirror-secondarycursor {
+  border-color: #00ff7f /* seafoam_green */;
+}
+
+/* Roughly equivalent to Vim's Visual group. */
+.cm-s-abbott .CodeMirror-selected,
+.cm-s-abbott.CodeMirror-focused .CodeMirror-selected {
+  background: #273900 /* dark_olive */;
+}
+.cm-s-abbott .CodeMirror-line::selection,
+.cm-s-abbott .CodeMirror-line > span::selection,
+.cm-s-abbott .CodeMirror-line > span > span::selection {
+  background: #273900 /* dark_olive */;
+}
+.cm-s-abbott .CodeMirror-line::-moz-selection,
+.cm-s-abbott .CodeMirror-line > span::-moz-selection,
+.cm-s-abbott .CodeMirror-line > span > span::-moz-selection {
+  background: #273900 /* dark_olive */;
+}
+
+/* Roughly equivalent to Vim's SpecialKey group. */
+.cm-s-abbott .cm-tab { color: #00ff7f /* seafoam_green */; }
+
+/* Equivalent to Vim's Search group. */
+.cm-s-abbott .cm-searching {
+  background: #fef3b4 /* vanilla_cream */ !important;
+  color: #231c14 /* bistre */ !important;
+}
+
+/* Style syntax highlighting modes: */
+
+/* Equivalent to Vim's Comment group. */
+.cm-s-abbott span.cm-comment {
+  color: #fbb32f /* marigold */;
+  font-style: italic;
+}
+
+/* Equivalent to Vim's String group. */
+.cm-s-abbott span.cm-string,
+.cm-s-abbott span.cm-string-2 {
+  color: #e6a2f3 /* lavender */;
+}
+
+/* Equivalent to Vim's Constant group. */
+.cm-s-abbott span.cm-number,
+.cm-s-abbott span.cm-string.cm-url { color: #f63f05 /* cinnabar */; }
+
+/* Roughly equivalent to Vim's SpecialKey group. */
+.cm-s-abbott span.cm-invalidchar { color: #00ff7f /* seafoam_green */; }
+
+/* Equivalent to Vim's Special group. */
+.cm-s-abbott span.cm-atom { color: #fef3b4 /* vanilla_cream */; }
+
+/* Equivalent to Vim's Delimiter group. */
+.cm-s-abbott span.cm-bracket,
+.cm-s-abbott span.cm-punctuation {
+  color: #fef3b4 /* vanilla_cream */;
+}
+
+/* Equivalent Vim's Operator group. */
+.cm-s-abbott span.cm-operator { font-weight: bold; }
+
+/* Roughly equivalent to Vim's Identifier group. */
+.cm-s-abbott span.cm-def,
+.cm-s-abbott span.cm-variable,
+.cm-s-abbott span.cm-variable-2,
+.cm-s-abbott span.cm-variable-3 {
+  color: #8ccdf0 /* periwinkle_blue */;
+}
+
+/* Roughly equivalent to Vim's Function group. */
+.cm-s-abbott span.cm-builtin,
+.cm-s-abbott span.cm-property,
+.cm-s-abbott span.cm-qualifier {
+  color: #3f91f1 /* cornflower_blue */;
+}
+
+/* Equivalent to Vim's Type group. */
+.cm-s-abbott span.cm-type { color: #24a507 /* forest_green */; }
+
+/* Equivalent to Vim's Keyword group. */
+.cm-s-abbott span.cm-keyword {
+  color: #d80450 /* crimson */;
+  font-weight: bold;
+}
+
+/* Equivalent to Vim's PreProc group. */
+.cm-s-abbott span.cm-meta { color: #ec6c99 /* french_pink */; }
+
+/* Equivalent to Vim's htmlTagName group (linked to Statement). */
+.cm-s-abbott span.cm-tag {
+  color: #d80450 /* crimson */;
+  font-weight: bold;
+}
+
+/* Equivalent to Vim's htmlArg group (linked to Type). */
+.cm-s-abbott span.cm-attribute { color: #24a507 /* forest_green */; }
+
+/* Equivalent to Vim's htmlH1, markdownH1, etc. groups (linked to Title). */
+.cm-s-abbott span.cm-header {
+  color: #d80450 /* crimson */;
+  font-weight: bold;
+}
+
+/* Equivalent to Vim's markdownRule group (linked to PreProc). */
+.cm-s-abbott span.cm-hr { color: #ec6c99 /* french_pink */; }
+
+/* Roughly equivalent to Vim's Underlined group. */
+.cm-s-abbott span.cm-link { color: #e6a2f3 /* lavender */; }
+
+/* Equivalent to Vim's diffRemoved group. */
+.cm-s-abbott span.cm-negative {
+  background: #d80450 /* crimson */;
+  color: #231c14 /* bistre */;
+}
+
+/* Equivalent to Vim's diffAdded group. */
+.cm-s-abbott span.cm-positive {
+  background: #a0ea00 /* chartreuse */;
+  color: #231c14 /* bistre */;
+  font-weight: bold;
+}
+
+/* Equivalent to Vim's Error group. */
+.cm-s-abbott span.cm-error {
+  background: #d80450 /* crimson */;
+  color: #231c14 /* bistre */;
+}
+
+/* Style addons: */
+
+/* Equivalent to Vim's MatchParen group. */
+.cm-s-abbott span.CodeMirror-matchingbracket {
+  background: #745d42 /* cocoa */ !important;
+  color: #231c14 /* bistre */ !important;
+  font-weight: bold;
+}
+
+/*
+ * Roughly equivalent to Vim's Error group. (Vim doesn't seem to have a direct
+ * equivalent in its own matchparen plugin, but many syntax highlighting plugins
+ * mark mismatched brackets as Error.)
+ */
+.cm-s-abbott span.CodeMirror-nonmatchingbracket {
+  background: #d80450 /* crimson */ !important;
+  color: #231c14 /* bistre */ !important;
+}
+
+.cm-s-abbott .CodeMirror-matchingtag,
+.cm-s-abbott .cm-matchhighlight {
+  outline: 1px solid #39a78d /* zomp */;
+}
+
+/* Equivalent to Vim's CursorLine group. */
+.cm-s-abbott .CodeMirror-activeline-background,
+.cm-s-abbott .CodeMirror-activeline-gutter {
+  background: #3c3022 /* chocolate */;
+}
+
+/* Equivalent to Vim's CursorLineNr group. */
+.cm-s-abbott .CodeMirror-activeline-gutter .CodeMirror-linenumber {
+  color: #d8ff84 /* pastel_chartreuse */;
+  font-weight: bold;
+}
+
+/* Roughly equivalent to Vim's Folded group. */
+.cm-s-abbott .CodeMirror-foldmarker {
+  color: #f63f05 /* cinnabar */;
+  text-shadow: none;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/abcdef.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,32 @@
+.cm-s-abcdef.CodeMirror { background: #0f0f0f; color: #defdef; }
+.cm-s-abcdef div.CodeMirror-selected { background: #515151; }
+.cm-s-abcdef .CodeMirror-line::selection, .cm-s-abcdef .CodeMirror-line > span::selection, .cm-s-abcdef .CodeMirror-line > span > span::selection { background: rgba(56, 56, 56, 0.99); }
+.cm-s-abcdef .CodeMirror-line::-moz-selection, .cm-s-abcdef .CodeMirror-line > span::-moz-selection, .cm-s-abcdef .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 56, 56, 0.99); }
+.cm-s-abcdef .CodeMirror-gutters { background: #555; border-right: 2px solid #314151; }
+.cm-s-abcdef .CodeMirror-guttermarker { color: #222; }
+.cm-s-abcdef .CodeMirror-guttermarker-subtle { color: azure; }
+.cm-s-abcdef .CodeMirror-linenumber { color: #FFFFFF; }
+.cm-s-abcdef .CodeMirror-cursor { border-left: 1px solid #00FF00; }
+
+.cm-s-abcdef span.cm-keyword { color: darkgoldenrod; font-weight: bold; }
+.cm-s-abcdef span.cm-atom { color: #77F; }
+.cm-s-abcdef span.cm-number { color: violet; }
+.cm-s-abcdef span.cm-def { color: #fffabc; }
+.cm-s-abcdef span.cm-variable { color: #abcdef; }
+.cm-s-abcdef span.cm-variable-2 { color: #cacbcc; }
+.cm-s-abcdef span.cm-variable-3, .cm-s-abcdef span.cm-type { color: #def; }
+.cm-s-abcdef span.cm-property { color: #fedcba; }
+.cm-s-abcdef span.cm-operator { color: #ff0; }
+.cm-s-abcdef span.cm-comment { color: #7a7b7c; font-style: italic;}
+.cm-s-abcdef span.cm-string { color: #2b4; }
+.cm-s-abcdef span.cm-meta { color: #C9F; }
+.cm-s-abcdef span.cm-qualifier { color: #FFF700; }
+.cm-s-abcdef span.cm-builtin { color: #30aabc; }
+.cm-s-abcdef span.cm-bracket { color: #8a8a8a; }
+.cm-s-abcdef span.cm-tag { color: #FFDD44; }
+.cm-s-abcdef span.cm-attribute { color: #DDFF00; }
+.cm-s-abcdef span.cm-error { color: #FF0000; }
+.cm-s-abcdef span.cm-header { color: aquamarine; font-weight: bold; }
+.cm-s-abcdef span.cm-link { color: blueviolet; }
+
+.cm-s-abcdef .CodeMirror-activeline-background { background: #314151; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/ambiance-mobile.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,5 @@
+.cm-s-ambiance.CodeMirror {
+  -webkit-box-shadow: none;
+  -moz-box-shadow: none;
+  box-shadow: none;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/ambiance.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,74 @@
+/* ambiance theme for codemirror */
+
+/* Color scheme */
+
+.cm-s-ambiance .cm-header { color: blue; }
+.cm-s-ambiance .cm-quote { color: #24C2C7; }
+
+.cm-s-ambiance .cm-keyword { color: #cda869; }
+.cm-s-ambiance .cm-atom { color: #CF7EA9; }
+.cm-s-ambiance .cm-number { color: #78CF8A; }
+.cm-s-ambiance .cm-def { color: #aac6e3; }
+.cm-s-ambiance .cm-variable { color: #ffb795; }
+.cm-s-ambiance .cm-variable-2 { color: #eed1b3; }
+.cm-s-ambiance .cm-variable-3, .cm-s-ambiance .cm-type { color: #faded3; }
+.cm-s-ambiance .cm-property { color: #eed1b3; }
+.cm-s-ambiance .cm-operator { color: #fa8d6a; }
+.cm-s-ambiance .cm-comment { color: #555; font-style:italic; }
+.cm-s-ambiance .cm-string { color: #8f9d6a; }
+.cm-s-ambiance .cm-string-2 { color: #9d937c; }
+.cm-s-ambiance .cm-meta { color: #D2A8A1; }
+.cm-s-ambiance .cm-qualifier { color: yellow; }
+.cm-s-ambiance .cm-builtin { color: #9999cc; }
+.cm-s-ambiance .cm-bracket { color: #24C2C7; }
+.cm-s-ambiance .cm-tag { color: #fee4ff; }
+.cm-s-ambiance .cm-attribute { color: #9B859D; }
+.cm-s-ambiance .cm-hr { color: pink; }
+.cm-s-ambiance .cm-link { color: #F4C20B; }
+.cm-s-ambiance .cm-special { color: #FF9D00; }
+.cm-s-ambiance .cm-error { color: #AF2018; }
+
+.cm-s-ambiance .CodeMirror-matchingbracket { color: #0f0; }
+.cm-s-ambiance .CodeMirror-nonmatchingbracket { color: #f22; }
+
+.cm-s-ambiance div.CodeMirror-selected { background: rgba(255, 255, 255, 0.15); }
+.cm-s-ambiance.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
+.cm-s-ambiance .CodeMirror-line::selection, .cm-s-ambiance .CodeMirror-line > span::selection, .cm-s-ambiance .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); }
+.cm-s-ambiance .CodeMirror-line::-moz-selection, .cm-s-ambiance .CodeMirror-line > span::-moz-selection, .cm-s-ambiance .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); }
+
+/* Editor styling */
+
+.cm-s-ambiance.CodeMirror {
+  line-height: 1.40em;
+  color: #E6E1DC;
+  background-color: #202020;
+  -webkit-box-shadow: inset 0 0 10px black;
+  -moz-box-shadow: inset 0 0 10px black;
+  box-shadow: inset 0 0 10px black;
+}
+
+.cm-s-ambiance .CodeMirror-gutters {
+  background: #3D3D3D;
+  border-right: 1px solid #4D4D4D;
+  box-shadow: 0 10px 20px black;
+}
+
+.cm-s-ambiance .CodeMirror-linenumber {
+  text-shadow: 0px 1px 1px #4d4d4d;
+  color: #111;
+  padding: 0 5px;
+}
+
+.cm-s-ambiance .CodeMirror-guttermarker { color: #aaa; }
+.cm-s-ambiance .CodeMirror-guttermarker-subtle { color: #111; }
+
+.cm-s-ambiance .CodeMirror-cursor { border-left: 1px solid #7991E8; }
+
+.cm-s-ambiance .CodeMirror-activeline-background {
+  background: none repeat scroll 0% 0% rgba(255, 255, 255, 0.031);
+}
+
+.cm-s-ambiance.CodeMirror,
+.cm-s-ambiance .CodeMirror-gutters {
+  background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAQAAAAHUWYVAABFFUlEQVQYGbzBCeDVU/74/6fj9HIcx/FRHx9JCFmzMyGRURhLZIkUsoeRfUjS2FNDtr6WkMhO9sm+S8maJfu+Jcsg+/o/c+Z4z/t97/vezy3z+z8ekGlnYICG/o7gdk+wmSHZ1z4pJItqapjoKXWahm8NmV6eOTbWUOp6/6a/XIg6GQqmenJ2lDHyvCFZ2cBDbmtHA043VFhHwXxClWmeYAdLhV00Bd85go8VmaFCkbVkzlQENzfBDZ5gtN7HwF0KDrTwJ0dypSOzpaKCMwQHKTIreYIxlmhXTzTWkVm+LTynZhiSBT3RZQ7aGfjGEd3qyXQ1FDymqbKxpspERQN2MiRjNZlFFQXfCNFm9nM1zpAsoYjmtRTc5ajwuaXc5xrWskT97RaKzAGe5ARHhVUsDbjKklziiX5WROcJwSNCNI+9w1Jwv4Zb2r7lCMZ4oq5C0EdTx+2GzNuKpJ+iFf38JEWkHJn9DNF7mmBDITrWEg0VWL3pHU20tSZnuqWu+R3BtYa8XxV1HO7GyD32UkOpL/yDloINFTmvtId+nmAjxRw40VMwVKiwrKLE4bK5UOVntYwhOcSSXKrJHKPJedocpGjVz/ZMIbnYUPB10/eKCrs5apqpgVmWzBYWpmtKHecJPjaUuEgRDDaU0oZghCJ6zNMQ5ZhDYx05r5v2muQdM0EILtXUsaKiQX9WMEUotagQzFbUNN6NUPC2nm5pxEWGCjMc3GdJHjSU2kORLK/JGSrkfGEIjncU/CYUnOipoYemwj8tST9NsJmB7TUVXtbUtXATJVZXBMvYeTXJfobgJUPmGMP/yFaWonaa6BcFO3nqcIqCozSZoZoSr1g4zJOzuyGnxTEX3lUEJ7WcZgme8ddaWvWJo2AJR9DZU3CUIbhCSG6ybSwN6qtJVnCU2svDTP2ZInOw2cBTrqtQahtNZn9NcJ4l2NaSmSkkP1noZWnVwkLmdUPOwLZEwy2Z3S3R+4rIG9hcbpPXHFVWcQdZkn2FOta3cKWQnNRC5g1LsJah4GCzSVsKnCOY5OAFRTBekyyryeyilhFKva75r4Mc0aWanGEaThcy31s439KKxTzJYY5WTHPU1FtIHjQU3Oip4xlNzj/lBw23dYZVliQa7WAXf4shetcQfatI+jWRDBPmyNeW6A1P5kdDgyYJlba0BIM8BZu1JfrFwItyjcAMR3K0BWOIrtMEXyhyrlVEx3ui5dUBjmB/Q3CXW85R4mBD0s7B+4q5tKUjOlb9qqmhi5AZ6GFIC5HXtOobdYGlVdMVbNJ8toNTFcHxnoL+muBagcctjWnbNMuR00uI7nQESwg5q2qqrKWIfrNUmeQocY6HuyxJV02wj36w00yhpmUFenv4p6fUkZYqLyuinx2RGOjhCXYyJF84oiU00YMOOhhquNdfbOB7gU88pY4xJO8LVdp6/q2voeB4R04vIdhSE40xZObx1HGGJ/ja0LBthFInKaLPPFzuCaYaoj8JjPME8yoyxo6zlBqkiUZYgq00OYMswbWO5NGmq+xhipxHLRW29ARjNKXO0wRnear8XSg4XFPLKEPUS1GqvyLwiuBUoa7zpZ0l5xxFwWmWZC1H5h5FwU8eQ7K+g8UcVY6TMQreVQT/8uQ8Z+ALIXnSEa2pYZQneE9RZbSBNYXfWYJzW/h/4j4Dp1tYVcFIC5019Vyi4ThPqSFCzjGWaHQTBU8q6vrVwgxP9Lkm840imWKpcLCjYTtrKuwvsKSnrvHCXGkSMk9p6lhckfRpIeis+N2PiszT+mFLspyGleUhDwcLrZqmyeylxwjBcKHEapqkmyangyLZRVOijwOtCY5SsG5zL0OwlCJ4y5KznF3EUNDDrinwiyLZRzOXtlBbK5ITHFGLp8Q0R6ab6mS7enI2cFrxOyHvOCFaT1HThS1krjCwqWeurCkk+willhCC+RSZnRXBiZaC5RXRIZYKp2lyfrHwiKPKR0JDzrdU2EFgpidawlFDR6FgXUMNa+g1FY3bUQh2cLCwosRdnuQTS/S+JVrGLeWIvtQUvONJxlqSQYYKpwoN2kaocLjdVsis4Mk80ESF2YpSkzwldjHkjFCUutI/r+EHDU8oCs6yzL3PhWiEooZdFMkymlas4AcI3KmoMMNSQ3tHzjGWCrcJJdYyZC7QFGwjRL9p+MrRkAGWzIaWCn9W0F3TsK01c2ZvQw0byvxuQU0r1lM0qJO7wW0kRIMdDTtXEdzi4VIh+EoIHm0mWtAtpCixlabgn83fKTI7anJe9ST7WIK1DMGpQmYeA58ImV6ezOGOzK2Kgq01pd60cKWiUi9Lievb/0vIDPHQ05Kzt4ddPckQBQtoaurjyHnek/nKzpQLrVgKPjIkh2v4uyezpv+Xoo7fPFXaGFp1vaLKxQ4uUpQQS5VuQs7BCq4xRJv7fwpVvvFEB3j+620haOuocqMhWd6TTPAEx+mdFNGHdranFe95WrWmIvlY4F1Dle2ECgc6cto7SryuqGGGha0tFQ5V53migUKmg6XKAo4qS3mik+0OZpAhOLeZKicacgaYcyx5hypYQE02ZA4xi/pNhOQxR4klNKyqacj+mpxnLTnnGSo85++3ZCZq6lrZkXlGEX3o+C9FieccJbZWVFjC0Yo1FZnJhoYMFoI1hEZ9r6hwg75HwzBNhbZCdJEfJwTPGzJvaKImw1yYX1HDAmpXR+ZJQ/SmgqMNVQb5vgamGwLtt7VwvP7Qk1xpiM5x5Cyv93E06MZmgs0Nya2azIKOYKCGBQQW97RmhKNKF02JZqHEJ4o58qp7X5EcZmc56trXEqzjCBZ1MFGR87Ql2tSTs6CGxS05PTzRQorkbw7aKoKXFDXsYW42VJih/q+FP2BdTzDTwVqOYB13liM50vG7wy28qagyuIXMeQI/Oqq8bcn5wJI50xH00CRntyfpL1T4hydYpoXgNiFzoIUTDZnLNRzh4TBHwbYGDvZkxmlyJloyr6tRihpeUG94GnKtIznREF0tzJG/OOr73JBcrSh1k6WuTprgLU+mnSGnv6Zge0NNz+kTDdH8nuAuTdJDCNb21LCiIuqlYbqGzT3RAoZofQfjFazkqeNWdYaGvYTM001EW2oKPvVk1ldUGSgUtHFwjKM1h9jnFcmy5lChoLNaQMGGDsYbKixlaMBmmsx1QjCfflwTfO/gckW0ruZ3jugKR3R5W9hGUWqCgxuFgsuaCHorotGKzGaeZB9DMsaTnKCpMtwTvOzhYk0rdrArKCqcaWmVk1+F372ur1YkKxgatI8Qfe1gIX9wE9FgS8ESmuABIXnRUbCapcKe+nO7slClSZFzpV/LkLncEb1qiO42fS3R855Su2mCLh62t1SYZZYVmKwIHjREF2uihTzB20JOkz7dkxzYQnK0UOU494wh+VWRc6Un2kpTaVgLDFEkJ/uhzRcI0YKGgpGWOlocBU/a4fKoJ/pEaNV6jip3+Es9VXY078rGnmAdf7t9ylPXS34RBSuYPs1UecZTU78WanhBCHpZ5sAoTz0LGZKjPf9TRypqWEiTvOFglL1fCEY3wY/++rbk7C8bWebA6p6om6PgOL2kp44TFJlVNBXae2rqqdZztOJpT87GQsE9jqCPIe9VReZuQ/CIgacsyZdCpIScSYqcZk8r+nsyCzhyfhOqHGOIvrLknC8wTpFcaYiGC/RU1NRbUeUpocQOnkRpGOrIOcNRx+1uA0UrzhSSt+VyS3SJpnFWkzNDqOFGIWcfR86DnmARTQ1HKIL33ExPiemeOhYSSjzlSUZZuE4TveoJLnBUOFof6KiysCbnAEcZgcUNTDOwkqWu3RWtmGpZwlHhJENdZ3miGz0lJlsKnjbwqSHQjpxnFDlTLLwqJPMZMjd7KrzkSG7VsxXBZE+F8YZkb01Oe00yyRK9psh5SYh29ySPKBo2ylNht7ZkZnsKenjKNJu9PNEyZpaCHv4Kt6RQsLvAVp7M9kIimmCUwGeWqLMmGuIotYMmWNpSahkhZw9FqZsVnKJhsjAHvtHMsTM9fCI06Dx/u3vfUXCqfsKRc4oFY2jMsoo/7DJDwZ1CsIKnJu+J9ldkpmiCxQx1rWjI+T9FwcWWzOuaYH0Hj7klNRVWEQpmaqosakiGNTFHdjS/qnUdmf0NJW5xsL0HhimCCZZSRzmSPTXJQ4aaztAwtZnoabebJ+htCaZ7Cm535ByoqXKbX1WRc4Eh2MkRXWzImVc96Cj4VdOKVxR84VdQsIUM8Psoou2byVHyZFuq7O8otbSQ2UAoeEWTudATLGSpZzVLlXVkPU2Jc+27lsw2jmg5T5VhbeE3BT083K9WsTTkFU/Osi0rC5lRlpwRHUiesNS0sOvmqGML1aRbPAxTJD9ZKtxuob+hhl8cwYGWpJ8nub7t5p6coYbMovZ1BTdaKn1jYD6h4GFDNFyT/Kqe1XCXphXHOKLZmuRSRdBPEfVUXQzJm5YGPGGJdvAEr7hHNdGZnuBvrpciGmopOLf5N0uVMy0FfYToJk90uUCbJupaVpO53UJXR2bVpoU00V2KOo4zMFrBd0Jtz2pa0clT5Q5L8IpQ177mWQejPMEJhuQjS10ref6HHjdEhy1P1EYR7GtO0uSsKJQYLiTnG1rVScj5lyazpqWGl5uBbRWl7m6ixGOOnEsMJR7z8J0n6KMnCdxhiNYQCoZ6CmYLnO8omC3MkW3bktlPmEt/VQQHejL3+dOE5FlPdK/Mq8hZxxJtLyRrepLThYKbLZxkSb5W52vYxNOaOxUF0yxMUPwBTYqCzy01XayYK0sJyWBLqX0MwU5CzoymRzV0EjjeUeLgDpTo6ij42ZAzvD01dHUUTPLU96MdLbBME8nFBn7zJCMtJcZokn8YoqU0FS5WFKyniHobguMcmW8N0XkWZjkyN3hqOMtS08r+/xTBwpZSZ3qiVRX8SzMHHjfUNFjgHEPmY9PL3ykEzxkSre/1ZD6z/NuznuB0RcE1TWTm9zRgfUWVJiG6yrzgmWPXC8EAR4Wxhlad0ZbgQyEz3pG5RVEwwDJH2mgKpjcTiCOzn1lfUWANFbZ2BA8balnEweJC9J0iuaeZoI+ippFCztEKVvckR2iice1JvhVytrQwUAZpgsubCPaU7xUe9vWnaOpaSBEspalykhC9bUlOMpT42ZHca6hyrqKmw/wMR8H5ZmdFoBVJb03O4UL0tSNnvIeRmkrLWqrs78gcrEn2tpcboh0UPOW3UUR9PMk4T4nnNKWmCjlrefhCwxRNztfmIQVdDElvS4m1/WuOujoZCs5XVOjtKPGokJzsYCtFYoWonSPT21DheU/wWhM19FcElwqNGOsp9Q8N/cwXaiND1MmeL1Q5XROtYYgGeFq1aTMsoMmcrKjQrOFQTQ1fmBYhmW6o8Jkjc7iDJRTBIo5kgJD5yMEYA3srCg7VFKwiVJkmRCc5ohGOKhsYMn/XBLdo5taZjlb9YAlGWRimqbCsoY7HFAXLa5I1HPRxMMsQDHFkWtRNniqT9UEeNjcE7RUlrCJ4R2CSJuqlKHWvJXjAUNcITYkenuBRB84TbeepcqTj3zZyFJzgYQdHnqfgI0ddUwS6GqWpsKWhjq9cV0vBAEMN2znq+EBfIWT+pClYw5xsTlJU6GeIBsjGmmANTzJZiIYpgrM0Oa8ZMjd7NP87jxhqGOhJlnQtjuQpB+8aEE00wZFznSJPyHxgH3HkPOsJFvYk8zqCHzTs1BYOa4J3PFU+UVRZxlHDM4YavlNUuMoRveiZA2d7grMNc2g+RbSCEKzmgYsUmWmazFJyoiOZ4KnyhKOGRzWJa0+moyV4TVHDzn51Awtqaphfk/lRQ08FX1iiqxTB/kLwd0VynKfEvI6cd4XMV5bMhZ7gZUWVzYQ6Nm2BYzxJbw3bGthEUUMfgbGeorae6DxHtJoZ6alhZ0+ytiVoK1R4z5PTrOECT/SugseEOlb1MMNR4VRNcJy+V1Hg9ONClSZFZjdHlc6W6FBLdJja2MC5hhpu0DBYEY1TFGwiFAxRRCsYkiM9JRb0JNMVkW6CZYT/2EiTGWmo8k+h4FhDNE7BvppoTSFnmCV5xZKzvcCdDo7VVPnIU+I+Rc68juApC90MwcFCsJ5hDqxgScYKreruyQwTqrzoqDCmhWi4IbhB0Yrt3RGa6GfDv52rKXWhh28dyZaWUvcZeMTBaZoSGyiCtRU5J8iviioHaErs7Jkj61syVzTTgOcUOQ8buFBTYWdL5g3T4qlpe0+wvD63heAXRfCCIed9RbCsp2CiI7raUOYOTU13N8PNHvpaGvayo4a3LLT1lDrVEPT2zLUlheB1R+ZTRfKWJ+dcocLJfi11vyJ51lLqJ0WD7tRwryezjiV5W28uJO9qykzX8JDe2lHl/9oyBwa2UMfOngpXCixvKdXTk3wrsKmiVYdZIqsoWEERjbcUNDuiaQomGoIbFdEHmsyWnuR+IeriKDVLnlawlyNHKwKlSU631PKep8J4Q+ayjkSLKYLhalNHlYvttb6fHm0p6OApsZ4l2VfdqZkjuysy6ysKLlckf1KUutCTs39bmCgEyyoasIWlVaMF7mgmWtBT8Kol5xpH9IGllo8cJdopcvZ2sImlDmMIbtDk3KIpeNiS08lQw11NFPTwVFlPP6pJ2gvRfI7gQUfmNAtf6Gs0wQxDsKGlVBdF8rCa3jzdwMaGHOsItrZk7hAyOzpK9VS06j5F49b0VNGOOfKs3lDToMsMBe9ZWtHFEgxTJLs7qrygKZjUnmCYoeAqeU6jqWuLJup4WghOdvCYJnrSkSzoyRkm5M2StQwVltPkfCAk58tET/CSg+8MUecmotMEnhBKfWBIZsg2ihruMJQaoIm+tkTLKEqspMh00w95gvFCQRtDwTT1gVDDSEVdlwqZfxoQRbK0g+tbiBZxzKlpnpypejdDwTaeOvorMk/IJE10h9CqRe28hhLbe0pMsdSwv4ZbhKivo2BjDWfL8UKJgeavwlwb5KlwhyE4u4XkGE2ytZCznKLCDZZq42VzT8HLCrpruFbIfOIINmh/qCdZ1ZBc65kLHR1Bkyf5zn6pN3SvGKIlFNGplhrO9QSXanLOMQTLCa0YJCRrCZm/CZmrLTm7WzCK4GJDiWUdFeYx1LCFg3NMd0XmCuF3Y5rITLDUsYS9zoHVzwnJoYpSTQoObyEzr4cFBNqYTopoaU/wkyLZ2lPhX/5Y95ulxGTV7KjhWrOZgl8MyUUafjYraNjNU1N3IWcjT5WzWqjwtoarHSUObGYO3GCJZpsBlnJGPd6ZYLyl1GdCA2625IwwJDP8GUKymbzuyPlZlvTUsaUh5zFDhRWFzPKKZLAlWdcQbObgF9tOqOsmB1dqcqYJmWstFbZRRI9poolmqiLnU0POvxScpah2iSL5UJNzgScY5+AuIbpO0YD3NCW+dLMszFSdFCWGqG6eVq2uYVNDdICGD6W7EPRWZEY5gpsE9rUkS3mijzzJnm6UpUFXG1hCUeVoS5WfNcFpblELL2qqrCvMvRfd45oalvKU2tiQ6ePJOVMRXase9iTtLJztPxJKLWpo2CRDcJwn2sWSLKIO1WQWNTCvpVUvOZhgSC40JD0dOctaSqzkCRbXsKlb11Oip6PCJ0IwSJM31j3akRxlP7Rwn6aGaUL0qiLnJkvB3xWZ2+Q1TfCwpQH3G0o92UzmX4o/oJNQMMSQc547wVHhdk+VCw01DFYEnTxzZKAm74QmeNNR1w6WzEhNK15VJzuCdxQ53dRUDws5KvwgBMOEgpcVNe0hZI6RXT1Jd0cyj5nsaEAHgVmGaJIlWdsc5Ui2ElrRR6jrRAttNMEAIWrTDFubkZaok7/AkzfIwfuWVq0jHzuCK4QabtLUMVPB3kJ0oyHTSVFlqMALilJf2Rf8k5aaHtMfayocLBS8L89oKoxpJvnAkDPa0qp5DAUTHKWmCcnthlou8iCKaFFLHWcINd1nyIwXqrSxMNmSs6KmoL2QrKuWtlQ5V0120xQ5vRyZS1rgFkWwhiOwiuQbR0OOVhQM9iS3tiXp4RawRPMp5tDletOOBL95MpM01dZTBM9pkn5qF010rIeHFcFZhmSGpYpTsI6nwhqe5C9ynhlpp5ophuRb6WcJFldkVnVEwwxVfrVkvnWUuNLCg5bgboFHPDlDPDmnK7hUrWiIbjadDclujlZcaokOFup4Ri1kacV6jmrrK1hN9bGwpKEBQ4Q6DvIUXOmo6U5LqQM6EPyiKNjVkPnJkDPNEaxhiFay5ExW1NXVUGqcpYYdPcGiCq7z/TSlbhL4pplWXKd7NZO5QQFrefhRQW/NHOsqcIglc4UhWklR8K0QzbAw08CBDnpbgqXdeD/QUsM4RZXDFBW6WJKe/mFPdH0LtBgiq57wFLzlyQzz82qYx5D5WJP5yVJDW01BfyHnS6HKO/reZqId1WGa4Hkh2kWodJ8i6KoIPlAj2hPt76CzXsVR6koPRzWTfKqIentatYpQw2me4AA3y1Kind3SwoOKZDcFXTwl9tWU6mfgRk9d71sKtlNwrjnYw5tC5n5LdKiGry3JKNlHEd3oaMCFHrazBPMp/uNJ+V7IudcSbeOIdjUEdwl0VHCOZo5t6YluEuaC9mQeMgSfOyKnYGFHcIeQ84yQWbuJYJpZw5CzglDH7gKnWqqM9ZTaXcN0TeYhR84eQtJT76JJ1lREe7WnnvsMmRc9FQ7SBBM9mV3lCUdmHk/S2RAMt0QjFNFqQpWjDPQ01DXWUdDBkXziKPjGEP3VP+zIWU2t7im41FOloyWzn/L6dkUy3VLDaZ6appgDLHPjJEsyvJngWEPUyVBiAaHCTEXwrLvSEbV1e1gKJniicWorC1MUrVjB3uDhJE/wgSOzk1DXpk0k73qCM8xw2UvD5kJmDUfOomqMpWCkJRlvKXGmoeBm18USjVIk04SClxTB6YrgLAPLWYK9HLUt5cmc0vYES8GnTeRc6skZbQkWdxRsIcyBRzx1DbTk9FbU0caTPOgJHhJKnOGIVhQqvKmo0llRw9sabrZkDtdg3PqaKi9oatjY8B+G371paMg6+mZFNNtQ04mWBq3rYLOmtWWQp8KJnpy9DdFensyjdqZ+yY40VJlH8wcdLzC8PZnvHMFUTZUrDTkLyQaGus5X5LzpYAf3i+e/ZlhqGqWhh6Ou6xTR9Z6oi5AZZtp7Mj2EEm8oSpxiYZCHU/1fbGdNNNRRoZMhmilEb2gqHOEJDtXkHK/JnG6IrvbPCwV3NhONVdS1thBMs1T4QOBcTWa2IzhMk2nW5Kyn9tXUtpv9RsG2msxk+ZsQzRQacJncpgke0+T8y5Fzj8BiGo7XlJjaTIlpQs7KFjpqGnKuoyEPeIKnFMkZHvopgh81ySxNFWvJWcKRs70j2FOT012IllEEO1n4pD1513Yg2ssQPOThOkvyrqHUdEXOSEsihmBbTbKX1kLBPWqWkLOqJbjB3GBIZmoa8qWl4CG/iZ7oiA72ZL7TJNeZUY7kFQftDcHHluBzRbCegzMtrRjVQpX2lgoPKKLJAkcbMl01XK2p7yhL8pCBbQ3BN2avJgKvttcrWDK3CiUOVxQ8ZP+pqXKyIxnmBymCg5vJjNfkPK4+c8cIfK8ocVt7kmfd/I5SR1hKvCzUtb+lhgc00ZaO6CyhIQP1Uv4yIZjload72PXX0OIJvnFU+0Zf6MhsJwTfW0r0UwQfW4LNLZl5HK261JCZ4qnBaAreVAS3WrjV0LBnNDUNNDToCEeFfwgcb4gOEqLRhirWkexrCEYKVV711DLYEE1XBEsp5tpTGjorkomKYF9FDXv7fR3BGwbettSxnyL53MBPjsxDZjMh+VUW9NRxq1DhVk+FSxQcaGjV9Pawv6eGByw5qzoy7xk4RsOShqjJwWKe/1pEEfzkobeD/dQJmpqedcyBTy2sr4nGNRH0c0SPWTLrqAc0OQcb/gemKgqucQT7ySWKCn2EUotoCvpZct7RO2sy/QW0IWcXd7pQRQyZVwT2USRO87uhjioTLKV2brpMUcMQRbKH/N2T+UlTpaMls6cmc6CCNy3JdYYSUzzJQ4oSD3oKLncULOiJvjBEC2oqnCJkJluCYy2ZQ5so9YYlZ1VLlQU1mXEW1jZERwj/MUSRc24TdexlqLKfQBtDTScJUV8FszXBEY5ktpD5Ur9hYB4Nb1iikw3JoYpkKX+RodRKFt53MMuRnKSpY31PwYaGaILh3wxJGz9TkTPEETxoCWZrgvOlmyMzxFEwVJE5xZKzvyJ4WxEc16Gd4Xe3Weq4XH2jKRikqOkGQ87hQnC7wBmGYLAnesX3M+S87eFATauuN+Qcrh7xIxXJbUIdMw3JGE3ylCWzrieaqCn4zhGM19TQ3z1oH1AX+pWEqIc7wNGAkULBo/ZxRaV9NNyh4Br3rCHZzbzmSfawBL0dNRwpW1kK9mxPXR9povcdrGSZK9c2k0xwFGzjuniCtRSZCZ6ccZ7gaktmgAOtKbG/JnOkJrjcQTdFMsxRQ2cLY3WTIrlCw1eWKn8R6pvt4GFDso3QoL4a3nLk3G6JrtME3dSenpx7PNFTmga0EaJTLQ061sEeQoWXhSo9LTXsaSjoJQRXeZLtDclbCrYzfzHHeaKjHCVOUkQHO3JeEepr56mhiyaYYKjjNU+Fed1wS5VlhWSqI/hYUdDOkaxiKehoyOnrCV5yBHtbWFqTHCCwtpDcYolesVR5yUzTZBb3RNMd0d6WP+SvhuBmRcGxnuQzT95IC285cr41cLGQ6aJJhmi4TMGempxeimBRQw1tFKV+8jd6KuzoSTqqDxzRtpZkurvKEHxlqXKRIjjfUNNXQsNOsRScoWFLT+YeRZVD3GRN0MdQcKqQjHDMrdGGVu3iYJpQx3WGUvfbmxwFfR20WBq0oYY7LMFhhgYtr8jpaEnaOzjawWWaTP8mMr0t/EPDPoqcnxTBI5o58L7uoWnMrpoqPwgVrlAUWE+V+TQl9rawoyP6QGAlQw2TPRX+YSkxyBC8Z6jhHkXBgQL7WII3DVFnRfCrBfxewv9D6xsyjys4VkhWb9pUU627JllV0YDNHMku/ldNMMXDEo4aFnAkk4U6frNEU4XgZUPmEKHUl44KrzmYamjAbh0JFvGnaTLPu1s9jPCwjFpYiN7z1DTOk/nc07CfDFzmCf7i+bfNHXhDtLeBXzTBT5rkMvWOIxpl4EMh2LGJBu2syDnAEx2naEhHDWMMzPZEhygyS1mS5RTJr5ZkoKbEUoYqr2kqdDUE8ztK7OaIntJkFrIECwv8LJTaVx5XJE86go8dFeZ3FN3rjabCAYpoYEeC9zzJVULBbmZhDyd7ko09ydpNZ3nm2Kee4FPPXHnYEF1nqOFEC08LUVcDvYXkJHW8gTaKCk9YGOeIJhqiE4ToPEepdp7IWFjdwnWaufGMwJJCMtUTTBBK9BGCOy2tGGrJTHIwyEOzp6aPzNMOtlZkDvcEWpP5SVNhfkvDxhmSazTJXYrM9U1E0xwFVwqZQwzJxw6+kGGGUj2FglGGmnb1/G51udRSMNlTw6GGnCcUwVcOpmsqTHa06o72sw1RL02p9z0VbnMLOaIX3QKaYKSCFQzBKEUNHTSc48k53RH9wxGMtpQa5KjjW0W0n6XCCCG4yxNNdhQ4R4l1Ff+2sSd6UFHiIEOyqqFgT01mEUMD+joy75jPhOA+oVVLm309FR4yVOlp4RhLiScNmSmaYF5Pw0STrOIoWMSR2UkRXOMp+M4SHW8o8Zoi6OZgjKOaFar8zZDzkWzvKOjkKBjmCXby8JahhjXULY4KlzgKLvAwxVGhvyd4zxB1d9T0piazmKLCVZY5sKiD0y2ZSYrkUEPUbIk+dlQ4SJHTR50k1DPaUWIdTZW9NJwnJMOECgd7ou/MnppMJ02O1VT4Wsh85MnZzcFTngpXGKo84qmwgKbCL/orR/SzJ2crA+t6Mp94KvxJUeIbT3CQu1uIdlQEOzlKfS3UMcrTiFmOuroocrZrT2AcmamOKg8YomeEKm/rlT2sociMaybaUlFhuqHCM2qIJ+rg4EcDFymiDSxzaHdPcpE62pD5kyM5SBMoA1PaUtfIthS85ig1VPiPPYXgYEMNk4Qq7TXBgo7oT57gPUdwgCHzhIVFPFU6OYJzHAX9m5oNrVjeE61miDrqQ4VSa1oiURTsKHC0IfjNwU2WzK6eqK8jWln4g15TVBnqmDteCJ501PGAocJhhqjZdtBEB6lnhLreFJKxmlKbeGrqLiSThVIbCdGzloasa6lpMQXHCME2boLpJgT7yWaemu6wBONbqGNVRS0PKIL7LckbjmQtR7K8I5qtqel+T/ChJTNIKLjdUMNIRyvOEko9YYl2cwQveBikCNawJKcLBbc7+JM92mysNvd/Fqp8a0k6CNEe7cnZrxlW0wQXaXjaktnRwNOGZKYiONwS7a1JVheq3WgJHlQUGKHKmp4KAxXR/ULURcNgoa4zhKSLpZR3kxRRb0NmD0OFn+UCS7CzI1nbP6+o4x47QZE5xRCt3ZagnYcvmpYQktXdk5YKXTzBC57kKEe0VVuiSYqapssMS3C9p2CKkHOg8B8Pa8p5atrIw3qezIWanMGa5HRDNF6RM9wcacl0N+Q8Z8hsIkSnaIIdHRUOEebAPy1zbCkhM062FCJtif7PU+UtoVXzWKqM1PxXO8cfdruhFQ/a6x3JKYagvVDhQEtNiyiiSQ7OsuRsZUku0CRNDs4Sog6KKjsZgk2bYJqijgsEenoKeniinRXBn/U3lgpPdyDZynQx8IiioMnCep5Ky8mjGs6Wty0l1hUQTcNWswS3WRp2kCNZwJG8omG8JphPUaFbC8lEfabwP7VtM9yoaNCAjpR41VNhrD9LkbN722v0CoZMByFzhaW+MyzRYEWFDQwN2M4/JiT76PuljT3VU/A36eaIThb+R9oZGOAJ9tewkgGvqOMNRWYjT/Cwu99Q8LqDE4TgbLWxJ1jaDDAERsFOFrobgjUsBScaguXU8kKm2RL19tRypSHnHNlHiIZqgufs4opgQdVdwxBNNFBR6kVFqb8ogimOzB6a6HTzrlDHEpYaxjiiA4TMQobkDg2vejjfwJGWmnbVFAw3H3hq2NyQfG7hz4aC+w3BbwbesG0swYayvpAs6++Ri1Vfzx93mFChvyN5xVHTS+0p9aqCAxyZ6ZacZyw5+7uuQkFPR9DDk9NOiE7X1PCYJVjVUqq7JlrHwWALF5nfHNGjApdpqgzx5OwilDhCiDYTgnc9waGW4BdLNNUQvOtpzDOWHDH8D7TR/A/85KljEQu3NREc4Pl/6B1Hhc8Umb5CsKMmGC9EPcxoT2amwHNCmeOEnOPbklnMkbOgIvO5UMOpQrS9UGVdt6iH/fURjhI/WOpaW9OKLYRod6HCUEdOX000wpDZQ6hwg6LgZfOqo1RfT/CrJzjekXOGhpc1VW71ZLbXyyp+93ILbC1kPtIEYx0FIx1VDrLoVzXRKRYWk809yYlC9ImcrinxtabKnzRJk3lAU1OLEN1j2zrYzr2myHRXJFf4h4QKT1qSTzTB5+ZNTzTRkAxX8FcLV2uS8eoQQ2aAkFzvCM72sJIcJET3WPjRk5wi32uSS9rfZajpWEvj9hW42F4o5NytSXYy8IKHay10VYdrcl4SkqscrXpMwyGOgtkajheSxdQqmpxP1L3t4R5PqasFnrQEjytq6qgp9Y09Qx9o4S1FzhUCn1kyHSzBWLemoSGvOqLNhZyBjmCaAUYpMgt4Ck7wBBMMwWKWgjsUwTaGVsxWC1mYoKiyqqeGKYqonSIRQ3KIkHO0pmAxTdBHkbOvfllfr+AA+7gnc50huVKYK393FOyg7rbPO/izI7hE4CnHHHnJ0ogNPRUGeUpsrZZTBJcrovUcJe51BPsr6GkJdhCCsZ6aTtMEb2pqWkqeVtDXE/QVggsU/Nl86d9RMF3DxvZTA58agu810RWawCiSzzXBeU3MMW9oyJUedvNEvQyNu1f10BSMddR1vaLCYpYa/mGocLSiYDcLbQz8aMn5iyF4xBNMs1P0QEOV7o5gaWGuzSeLue4tt3ro7y4Tgm4G/mopdZgl6q0o6KzJWE3mMksNr3r+a6CbT8g5wZNzT9O7fi/zpaOmnz3BRoqos+tv9zMbdpxsqDBOEewtJLt7cg5wtKKbvldpSzRRCD43VFheCI7yZLppggMVBS/KMAdHODJvOwq2NQSbKKKPLdFWQs7Fqo+mpl01JXYRgq8dnGLhTiFzqmWsUMdpllZdbKlyvSdYxhI9YghOtxR8LgSLWHK62mGGVoxzBE8LNWzqH9CUesQzFy5RQzTc56mhi6fgXEWwpKfE5Z7M05ZgZUPmo6auiv8YKzDYwWBLMErIbKHJvOwIrvEdhOBcQ9JdU1NHQ7CXn2XIDFBKU2WAgcX9UAUzDXWd5alwuyJ41Z9rjKLCL4aCp4WarhPm2rH+SaHUYE001JDZ2ZAzXPjdMpZWvC9wmqIB2lLhQ01D5jO06hghWMndbM7yRJMsoCj1vYbnFQVrW9jak3OlEJ3s/96+p33dEPRV5GxiqaGjIthUU6FFEZyqCa5qJrpBdzSw95IUnOPIrCUUjRZQFrbw5PR0R1qiYx3cb6nrWUMrBmmiBQxVHtTew5ICP/ip6g4hed/Akob/32wvBHsIOX83cI8hGeNeNPCIkPmXe8fPKx84OMSRM1MTdXSwjCZ4S30jVGhvqTRak/OVhgGazHuOCud5onEO1lJr6ecVyaOK6H7zqlBlIaHE0oroCgfvGJIdPcmfLNGLjpz7hZwZQpUbFME0A1cIJa7VNORkgfsMBatbKgwwJM9bSvQXeNOvbIjelg6WWvo5kvbKaJJNHexkKNHL9xRyFlH8Ti2riB5wVPhUk7nGkJnoCe428LR/wRGdYIlmWebCyxou1rCk4g/ShugBDX0V0ZQWkh0dOVsagkM0yV6OoLd5ye+pRlsCr0n+KiQrGuq5yJDzrTAXHtLUMduTDBVKrSm3eHL+6ijxhFDX9Z5gVU/wliHYTMiMFpKLNMEywu80wd3meoFmt6VbRMPenhrOc6DVe4pgXU8DnnHakLOIIrlF4FZPIw6R+zxBP0dyq6OOZ4Q5sLKCcz084ok+VsMMyQhNZmmBgX5xIXOEJTmi7VsGTvMTNdHHhpzdbE8Du2oKxgvBqQKdDDnTFOylCFaxR1syz2iqrOI/FEpNc3C6f11/7+ASS6l2inq2ciTrCCzgyemrCL5SVPjQkdPZUmGy2c9Sw9FtR1sS30RmsKPCS4rkIC/2U0MduwucYolGaPjKEyhzmiPYXagyWbYz8LWBDdzRimAXzxx4z8K9hpzlhLq+NiQ97HuKorMUfK/OVvC2JfiHUPCQI/q7J2gjK+tTDNxkCc4TMssqCs4TGtLVwQihyoAWgj9bosU80XGW6Ac9TJGziaUh5+hnFcHOnlaM1iRn29NaqGENTTTSUHCH2tWTeV0osUhH6psuVLjRUmGWhm6OZEshGeNowABHcJ2Bpy2ZszRcKkRXd2QuKVEeXnbfaEq825FguqfgfE2whlChSRMdron+LATTPQ2Z369t4B9C5gs/ylzv+CMmepIDPclFQl13W0rspPd1JOcbghGOEutqCv5qacURQl3dDKyvyJlqKXGPgcM9FfawJAMVmdcspcYKOZc4GjDYkFlK05olNMHyHn4zFNykyOxt99RkHlfwmiHo60l2EKI+mhreEKp080Tbug08BVPcgoqC5zWt+NLDTZ7oNSF51N1qie7Va3uCCwyZbkINf/NED6jzOsBdZjFN8oqG3wxVunqCSYYKf3EdhJyf9YWGf7tRU2oH3VHgPr1fe5J9hOgHd7xQ0y7qBwXr23aGErP0cm64JVjZwsOGqL+mhNgZmhJLW2oY4UhedsyBgzrCKrq7BmcpNVhR6jBPq64Vgi+kn6XE68pp8J5/+0wRHGOpsKenQn9DZntPzjRLZpDAdD2fnSgkG9tmIXnUwQ6WVighs7Yi2MxQ0N3CqYaCXkJ0oyOztMDJjmSSpcpvlrk0RMMOjmArQ04PRV1DO1FwhCVaUVPpKUM03JK5SxPsIWRu8/CGHi8UHChiqGFDTbSRJWeYUDDcH6vJWUxR4k1FXbMUwV6e4AJFXS8oMqsZKqzvYQ9DDQdZckY4aGsIhtlubbd2r3j4QBMoTamdPZk7O/Bf62lacZwneNjQoGcdVU7zJOd7ghsUHOkosagic6cnWc8+4gg285R6zZP5s1/LUbCKIznTwK36PkdwlOrl4U1LwfdCCa+IrvFkmgw1PCAUXKWo0sURXWcI2muKJlgyFzhynCY4RBOsqCjoI1R5zREco0n2Vt09BQtYSizgKNHfUmUrQ5UOCh51BFcLmY7umhYqXKQomOop8bUnWNNQcIiBcYaC6xzMNOS8JQQfeqKBmmglB+97ok/lfk3ygaHSyZaCRTzRxQo6GzLfa2jWBPepw+UmT7SQEJyiyRkhBLMVOfcoMjcK0eZChfUNzFAUzCsEN5vP/X1uP/n/aoMX+K+nw/Hjr/9xOo7j7Pju61tLcgvJpTWXNbfN5jLpi6VfCOviTktKlFusQixdEKWmEBUKNaIpjZRSSOXSgzaaKLdabrm1/9nZ+/f+vd/vz/v9+Xy+zZ7PRorYoZqyLrCwQdEAixxVOEXNNnjX2nUSRlkqGmWowk8lxR50JPy9Bo6qJXaXwNvREBvnThPEPrewryLhcAnj5WE15Fqi8W7R1sAuEu86S4ENikItFN4xkv9Af4nXSnUVcLiA9xzesFpivRRVeFKtsMRaKBhuSbjOELnAUtlSQUpXgdfB4Z1oSbnFEetbQ0IrAe+Y+pqnDcEJFj6S8LDZzZHwY4e3XONNlARraomNEt2bkvGsosA3ioyHm+6jCMbI59wqt4eeara28IzEmyPgoRaUOEDhTVdEJhmCoTWfC0p8aNkCp0oYqih2iqGi4yXeMkOsn4LdLLnmKfh/YogjNsPebeFGR4m9BJHLzB61XQ3BtpISfS2FugsK9FAtLWX1dCRcrCnUp44CNzuCowUZmxSRgYaE6Za0W2u/E7CVXCiI/UOR8aAm1+OSyE3mOUcwyc1zBBeoX1kiKy0Zfxck1Gsyulti11i83QTBF5Kg3pDQThFMVHiPSlK+0cSedng/VaS8bOZbtsBcTcZAR8JP5KeqQ1OYKAi20njdNNRpgnsU//K+JnaXJaGTomr7aYIphoRn9aeShJWKEq9LcozSF7QleEfDI5LYm5bgVkFkRwVDBCVu0DDIkGupo8TZBq+/pMQURYErJQmPKGKjNDkWOLx7Jd5QizdUweIaKrlP7SwJDhZvONjLkOsBBX9UpGxnydhXkfBLQ8IxgojQbLFnJf81JytSljclYYyEFyx0kVBvKWOFJmONpshGAcsduQY5giVNCV51eOdJYo/pLhbvM0uDHSevNKRcrKZIqnCtJeEsO95RoqcgGK4ocZcho1tTYtcZvH41pNQ7vA0WrhIfOSraIIntIAi+NXWCErdbkvrWwjRLrt0NKUdL6KSOscTOdMSOUtBHwL6OLA0vNSdynaWQEnCpIvKaIrJJEbvHkmuNhn6OjM8VkSGSqn1uYJCGHnq9I3aLhNME3t6GjIkO7xrNFumpyTNX/NrwX7CrIRiqqWijI9JO4d1iieykyfiposQIQ8YjjsjlBh6oHWbwRjgYJQn2NgSnNycmJAk3NiXhx44Sxykihxm8ybUwT1OVKySc7vi3OXVkdBJ4AyXBeksDXG0IhgtYY0lY5ahCD0ehborIk5aUWRJviMA7Xt5kyRjonrXENkm8yYqgs8VzgrJmClK20uMM3jRJ0FiQICQF9hdETlLQWRIb5ki6WDfWRPobvO6a4GP5mcOrNzDFELtTkONLh9dXE8xypEg7z8A9jkhrQ6Fhjlg/QVktJXxt4WXzT/03Q8IaQWSqIuEvloQ2mqC9Jfi7wRul4RX3pSPlzpoVlmCtI2jvKHCFhjcM3sN6lqF6HxnKelLjXWbwrpR4xzuCrTUZx2qq9oAh8p6ixCUGr78g8oyjRAtB5CZFwi80VerVpI0h+IeBxa6Zg6kWvpDHaioYYuEsRbDC3eOmC2JvGYLeioxGknL2UATNJN6hmtj1DlpLvDVmocYbrGCVJKOrg4X6DgddLA203BKMFngdJJFtFd7vJLm6KEpc5yjQrkk7M80SGe34X24nSex1Ra5Omgb71JKyg8SrU3i/kARKwWpH0kOGhKkObyfd0ZGjvyXlAkVZ4xRbYJ2irFMkFY1SwyWxr2oo4zlNiV+7zmaweFpT4kR3kaDAFW6xpSqzJay05FtYR4HmZhc9UxKbbfF2V8RG1MBmSaE+kmC6JnaRXK9gsiXhJHl/U0qM0WTcbyhwkYIvFGwjSbjfwhiJt8ZSQU+Bd5+marPMOkVkD0muxYLIfEuhh60x/J92itguihJSEMySVPQnTewnEm+620rTQEMsOfo4/kP/0ARvWjitlpSX7GxBgcMEsd3EEeYWvdytd+Saawi6aCIj1CkGb6Aj9rwhx16Cf3vAwFy5pyLhVonXzy51FDpdEblbkdJbUcEPDEFzQ8qNmhzzLTmmKWKbFCXeEuRabp6rxbvAtLF442QjQ+wEA9eL1xSR7Q0JXzlSHjJ4exq89yR0laScJ/FW6z4a73pFMEfDiRZvuvijIt86RaSFOl01riV2mD1UEvxGk/Geg5aWwGki1zgKPG9J2U8PEg8qYvMsZeytiTRXBMslCU8JSlxi8EabjwUldlDNLfzTUmCgxWsjqWCOHavYAqsknKFIO0yQ61VL5AVFxk6WhEaCAkdJgt9aSkzXlKNX2jEa79waYuc7gq0N3GDJGCBhoiTXUEPsdknCUE1CK0fwsiaylSF2uiDyO4XX3pFhNd7R4itFGc0k/ElBZwWvq+GC6szVeEoS/MZ+qylwpKNKv9Z469UOjqCjwlusicyTxG6VpNxcQ8IncoR4RhLbR+NdpGGmJWOcIzJGUuKPGpQg8rrG21dOMqQssJQ4RxH5jaUqnZuQ0F4Q+cjxLwPtpZbIAk3QTJHQWBE5S1BokoVtDd6lhqr9UpHSUxMcIYl9pojsb8h4SBOsMQcqvOWC2E8EVehqiJ1hrrAEbQxeK0NGZ0Gkq+guSRgniM23bIHVkqwx4hiHd7smaOyglyIyQuM978j4VS08J/A2G1KeMBRo4fBaSNhKUEZfQewVQ/C1I+MgfbEleEzCUw7mKXI0M3hd1EESVji8x5uQ41nxs1q4RMJCCXs7Iq9acpxn22oSDnQ/sJTxsCbHIYZiLyhY05TY0ZLIOQrGaSJDDN4t8pVaIrsqqFdEegtizc1iTew5Q4ayBDMUsQMkXocaYkc0hZua412siZ1rSXlR460zRJ5SlHGe5j801RLMlJTxtaOM3Q1pvxJ45zUlWFD7rsAbpfEm1JHxG0eh8w2R7QQVzBUw28FhFp5QZzq8t2rx2joqulYTWSuJdTYfWwqMFMcovFmSyJPNyLhE4E10pHzYjOC3huArRa571ZsGajQpQx38SBP5pyZB6lMU3khDnp0MBV51BE9o2E+TY5Ml2E8S7C0o6w1xvCZjf0HkVEHCzFoyNmqC+9wdcqN+Tp7jSDheE9ws8Y5V0NJCn2bk2tqSY4okdrEhx1iDN8cSudwepWmAGXKcJXK65H9to8jYQRH7SBF01ESUJdd0TayVInaWhLkOjlXE5irKGOnI6GSWGCJa482zBI9rCr0jyTVcEuzriC1vcr6mwFGSiqy5zMwxBH/TJHwjSPhL8+01kaaSUuMFKTcLEvaUePcrSmwn8DZrgikWb7CGPxkSjhQwrRk57tctmxLsb9sZvL9LSlyuSLlWkqOjwduo8b6Uv1DkmudIeFF2dHCgxVtk8dpIvHpBxhEOdhKk7OLIUSdJ+cSRY57B+0DgGUUlNfpthTfGkauzxrvTsUUaCVhlKeteTXCoJDCa2NOKhOmC4G1H8JBd4OBZReSRGkqcb/CO1PyLJTLB4j1q8JYaIutEjSLX8YKM+a6phdMsdLFUoV5RTm9JSkuDN8WcIon0NZMNZWh1q8C7SJEwV5HxrmnnTrf3KoJBlmCYI2ilSLlfEvlE4011NNgjgthzEua0oKK7JLE7HZHlEl60BLMVFewg4EWNt0ThrVNEVkkiTwpKXSWJzdRENgvKGq4IhjsiezgSFtsfCUq8qki5S1LRQeYQQ4nemmCkImWMw3tFUoUBZk4NOeZYEp4XRKTGa6wJjrWNHBVJR4m3FCnbuD6aak2WsMTh3SZImGCIPKNgsDpVwnsa70K31lCFJZYcwwSMFcQulGTsZuEaSdBXkPGZhu0FsdUO73RHjq8MPGGIfaGIbVTk6iuI3GFgucHrIQkmWSJdBd7BBu+uOryWAhY7+Lki9rK5wtEQzWwvtbqGhIMFwWRJsElsY4m9IIg9L6lCX0VklaPAYkfkZEGDnOWowlBJjtMUkcGK4Lg6EtoZInMUBVYLgn0UsdmCyCz7gIGHFfk+k1QwTh5We7A9x+IdJ6CvIkEagms0hR50eH9UnTQJ+2oiKyVlLFUE+8gBGu8MQ3CppUHesnjTHN4QB/UGPhCTHLFPHMFrCqa73gqObUJGa03wgbhHkrCfpEpzNLE7JDS25FMKhlhKKWKfCgqstLCPu1zBXy0J2ztwjtixBu8UTRn9LVtkmCN2iyFhtME70JHRQ1KVZXqKI/KNIKYMCYs1GUMEKbM1bKOI9LDXC7zbHS+bt+1MTWS9odA9DtrYtpbImQJ2VHh/lisEwaHqUk1kjKTAKknkBEXkbkdMGwq0dnhzLJF3NJH3JVwrqOB4Sca2hti75nmJN0WzxS6UxDYoEpxpa4htVlRjkYE7DZGzJVU72uC9IyhQL4i8YfGWSYLLNcHXloyz7QhNifmKSE9JgfGmuyLhc403Xm9vqcp6gXe3xuuv8F6VJNxkyTHEkHG2g0aKXL0MsXc1bGfgas2//dCONXiNLCX+5mB7eZIl1kHh7ajwpikyzlUUWOVOsjSQlsS+M0R+pPje/dzBXRZGO0rMtgQrLLG9VSu9n6CMXS3BhwYmSoIBhsjNBmZbgusE9BCPCP5triU4VhNbJfE+swSP27aayE8tuTpYYjtrYjMVGZdp2NpS1s6aBnKSHDsbKuplKbHM4a0wMFd/5/DmGyKrJSUaW4IBrqUhx0vyfzTBBLPIUcnZdrAkNsKR0sWRspumSns6Ch0v/qqIbBYUWKvPU/CFoyrDJGwSNFhbA/MlzKqjrO80hRbpKx0Jewsi/STftwGSlKc1JZyAzx05dhLEdnfQvhZOqiHWWEAHC7+30FuRcZUgaO5gpaIK+xsiHRUsqaPElTV40xQZQ107Q9BZE1nryDVGU9ZSQ47bmhBpLcYpUt7S+xuK/FiT8qKjwXYw5ypS2iuCv7q1gtgjhuBuB8LCFY5cUuCNtsQOFcT+4Ih9JX+k8Ea6v0iCIRZOtCT0Et00JW5UeC85Cg0ScK0k411HcG1zKtre3SeITBRk7WfwDhEvaYLTHP9le0m8By0JDwn4TlLW/aJOvGHxdjYUes+ScZigCkYQdNdEOhkiezgShqkx8ueKjI8lDfK2oNiOFvrZH1hS+tk7NV7nOmLHicGWEgubkXKdwdtZknCLJXaCpkrjZBtLZFsDP9CdxWsSr05Sxl6CMmoFbCOgryX40uDtamB7SVmXW4Ihlgpmq+00tBKUUa83WbjLUNkzDmY7cow1JDygyPGlhgGKYKz4vcV7QBNbJIgM11TUqZaMdwTeSguH6rOaw1JRKzaaGyxVm2EJ/uCIrVWUcZUkcp2grMsEjK+DMwS59jQk3Kd6SEq1d0S6uVmO4Bc1lDXTUcHjluCXEq+1OlBDj1pi9zgiXxnKuE0SqTXwhqbETW6RggMEnGl/q49UT2iCzgJvRwVXS2K/d6+ZkyUl7jawSVLit46EwxVljDZwoSQ20sDBihztHfk2yA8NVZghiXwrYHQdfKAOtzsayjhY9bY0yE2CWEeJ9xfzO423xhL5syS2TFJofO2pboHob0nY4GiAgRrvGQEDa/FWSsoaaYl0syRsEt3kWoH3B01shCXhTUWe9w3Bt44SC9QCh3eShQctwbaK2ApLroGCMlZrYqvlY3qYhM0aXpFkPOuoqJ3Dm6fxXrGwVF9gCWZagjPqznfkuMKQ8DPTQRO8ZqG1hPGKEm9IgpGW4DZDgTNriTxvFiq+Lz+0cKfp4wj6OCK9JSnzNSn9LFU7UhKZZMnYwcJ8s8yRsECScK4j5UOB95HFO0CzhY4xJxuCix0lDlEUeMdS6EZBkTsUkZ4K74dugyTXS7aNgL8aqjDfkCE0ZbwkCXpaWCKhl8P7VD5jxykivSyxyZrYERbe168LYu9ZYh86IkscgVLE7tWPKmJv11CgoyJltMEbrohtVAQfO4ImltiHEroYEs7RxAarVpY8AwXMcMReFOTYWe5iiLRQxJ5Q8DtJ8LQhWOhIeFESPGsILhbNDRljNbHzNRlTFbk2S3L0NOS6V1KFJYKUbSTcIIhM0wQ/s2TM0SRMNcQmSap3jCH4yhJZKSkwyRHpYYgsFeQ4U7xoCB7VVOExhXepo9ABBsYbvGWKXPME3lyH95YioZ0gssQRWWbI+FaSMkXijZXwgiTlYdPdkNLaETxlyDVIwqeaEus0aTcYcg0RVOkpR3CSJqIddK+90JCxzsDVloyrFd5ZAr4TBKfaWa6boEA7C7s6EpYaeFPjveooY72mjIccLHJ9HUwVlDhKkmutJDJBwnp1rvulJZggKDRfbXAkvC/4l3ozQOG9a8lxjx0i7nV4jSXc7vhe3OwIxjgSHjdEhhsif9YkPGlus3iLFDnWOFhtCZbJg0UbQcIaR67JjthoCyMEZRwhiXWyxO5QxI6w5NhT4U1WsJvDO60J34fW9hwzwlKij6ZAW9ne4L0s8C6XeBMEkd/LQy1VucBRot6QMlbivaBhoBgjqGiCJNhsqVp/S2SsG6DIONCR0dXhvWbJ+MRRZJkkuEjgDXJjFQW6SSL7GXK8Z2CZg7cVsbWGoKmEpzQ5elpiy8Ryg7dMkLLUEauzeO86CuwlSOlgYLojZWeJ9xM3S1PWfEfKl5ISLQ0MEKR8YOB2QfCxJBjrKPCN4f9MkaSsqoVXJBmP7EpFZ9UQfOoOFwSzBN4MQ8LsGrymlipcJQhmy0GaQjPqCHaXRwuCZwRbqK2Fg9wlClZqYicrIgMdZfxTQ0c7TBIbrChxmuzoKG8XRaSrIhhiyNFJkrC7oIAWMEOQa5aBekPCRknCo4IKPrYkvCDI8aYmY7WFtprgekcJZ3oLIqssCSMtFbQTJKwXYy3BY5oCh2iKPCpJOE+zRdpYgi6O2KmOAgvVCYaU4ySRek1sgyFhJ403QFHiVEmJHwtybO1gs8Hr5+BETQX3War0qZngYGgtVZtoqd6vFSk/UwdZElYqyjrF4HXUeFspIi9IGKf4j92pKGAdCYMVsbcV3kRF0N+R8LUd5PCsIGWoxDtBkCI0nKofdJQxT+LtZflvuc8Q3CjwWkq8KwUpHzkK/NmSsclCL0nseQdj5FRH5CNHSgtLiW80Of5HU9Hhlsga9bnBq3fEVltKfO5IaSTmGjjc4J0otcP7QsJUSQM8pEj5/wCuUuC2DWz8AAAAAElFTkSuQmCC");
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/ayu-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+/* Based on https://github.com/dempfi/ayu */
+
+.cm-s-ayu-dark.CodeMirror { background: #0a0e14; color: #b3b1ad; }
+.cm-s-ayu-dark div.CodeMirror-selected { background: #273747; }
+.cm-s-ayu-dark .CodeMirror-line::selection, .cm-s-ayu-dark .CodeMirror-line > span::selection, .cm-s-ayu-dark .CodeMirror-line > span > span::selection { background: rgba(39, 55, 71, 99); }
+.cm-s-ayu-dark .CodeMirror-line::-moz-selection, .cm-s-ayu-dark .CodeMirror-line > span::-moz-selection, .cm-s-ayu-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(39, 55, 71, 99); }
+.cm-s-ayu-dark .CodeMirror-gutters { background: #0a0e14; border-right: 0px; }
+.cm-s-ayu-dark .CodeMirror-guttermarker { color: white; }
+.cm-s-ayu-dark .CodeMirror-guttermarker-subtle { color: #3d424d; }
+.cm-s-ayu-dark .CodeMirror-linenumber { color: #3d424d; }
+.cm-s-ayu-dark .CodeMirror-cursor { border-left: 1px solid #e6b450; }
+.cm-s-ayu-dark.cm-fat-cursor .CodeMirror-cursor { background-color: #a2a8a175 !important; }
+.cm-s-ayu-dark .cm-animate-fat-cursor { background-color: #a2a8a175 !important; }
+
+.cm-s-ayu-dark span.cm-comment { color: #626a73; }
+.cm-s-ayu-dark span.cm-atom { color: #ae81ff; }
+.cm-s-ayu-dark span.cm-number { color: #e6b450; }
+
+.cm-s-ayu-dark span.cm-comment.cm-attribute { color: #ffb454; }
+.cm-s-ayu-dark span.cm-comment.cm-def { color: rgba(57, 186, 230, 80); }
+.cm-s-ayu-dark span.cm-comment.cm-tag { color: #39bae6; }
+.cm-s-ayu-dark span.cm-comment.cm-type { color: #5998a6; }
+
+.cm-s-ayu-dark span.cm-property, .cm-s-ayu-dark span.cm-attribute { color: #ffb454; }  
+.cm-s-ayu-dark span.cm-keyword { color: #ff8f40; } 
+.cm-s-ayu-dark span.cm-builtin { color: #e6b450; }
+.cm-s-ayu-dark span.cm-string { color: #c2d94c; }
+
+.cm-s-ayu-dark span.cm-variable { color: #b3b1ad; }
+.cm-s-ayu-dark span.cm-variable-2 { color: #f07178; }
+.cm-s-ayu-dark span.cm-variable-3 { color: #39bae6; }
+.cm-s-ayu-dark span.cm-type { color: #ff8f40; }
+.cm-s-ayu-dark span.cm-def { color: #ffee99; }
+.cm-s-ayu-dark span.cm-bracket { color: #f8f8f2; }
+.cm-s-ayu-dark span.cm-tag { color: rgba(57, 186, 230, 80); }
+.cm-s-ayu-dark span.cm-header { color: #c2d94c; }
+.cm-s-ayu-dark span.cm-link { color: #39bae6; }
+.cm-s-ayu-dark span.cm-error { color: #ff3333; } 
+
+.cm-s-ayu-dark .CodeMirror-activeline-background { background: #01060e; }
+.cm-s-ayu-dark .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/ayu-mirage.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,45 @@
+/* Based on https://github.com/dempfi/ayu */
+
+.cm-s-ayu-mirage.CodeMirror { background: #1f2430; color: #cbccc6; }
+.cm-s-ayu-mirage div.CodeMirror-selected { background: #34455a; }
+.cm-s-ayu-mirage .CodeMirror-line::selection, .cm-s-ayu-mirage .CodeMirror-line > span::selection, .cm-s-ayu-mirage .CodeMirror-line > span > span::selection { background: #34455a; }
+.cm-s-ayu-mirage .CodeMirror-line::-moz-selection, .cm-s-ayu-mirage .CodeMirror-line > span::-moz-selection, .cm-s-ayu-mirage .CodeMirror-line > span > span::-moz-selection { background: rgba(25, 30, 42, 99); }
+.cm-s-ayu-mirage .CodeMirror-gutters { background: #1f2430; border-right: 0px; }
+.cm-s-ayu-mirage .CodeMirror-guttermarker { color: white; }
+.cm-s-ayu-mirage .CodeMirror-guttermarker-subtle { color:  rgba(112, 122, 140, 66); }
+.cm-s-ayu-mirage .CodeMirror-linenumber { color: rgba(61, 66, 77, 99); }
+.cm-s-ayu-mirage .CodeMirror-cursor { border-left: 1px solid #ffcc66;  }
+.cm-s-ayu-mirage.cm-fat-cursor .CodeMirror-cursor {background-color: #a2a8a175 !important;}
+.cm-s-ayu-mirage .cm-animate-fat-cursor { background-color: #a2a8a175 !important; }
+
+.cm-s-ayu-mirage span.cm-comment { color: #5c6773; font-style:italic; }
+.cm-s-ayu-mirage span.cm-atom { color: #ae81ff; }
+.cm-s-ayu-mirage span.cm-number { color: #ffcc66; }
+
+.cm-s-ayu-mirage span.cm-comment.cm-attribute { color: #ffd580; }
+.cm-s-ayu-mirage span.cm-comment.cm-def { color: #d4bfff; }
+.cm-s-ayu-mirage span.cm-comment.cm-tag { color: #5ccfe6; }
+.cm-s-ayu-mirage span.cm-comment.cm-type { color: #5998a6; }
+
+.cm-s-ayu-mirage span.cm-property { color: #f29e74; }
+.cm-s-ayu-mirage span.cm-attribute { color: #ffd580; }  
+.cm-s-ayu-mirage span.cm-keyword { color: #ffa759; } 
+.cm-s-ayu-mirage span.cm-builtin { color: #ffcc66; }
+.cm-s-ayu-mirage span.cm-string { color: #bae67e; }
+
+.cm-s-ayu-mirage span.cm-variable { color: #cbccc6; }
+.cm-s-ayu-mirage span.cm-variable-2 { color: #f28779; }
+.cm-s-ayu-mirage span.cm-variable-3 { color: #5ccfe6; }
+.cm-s-ayu-mirage span.cm-type { color: #ffa759; }
+.cm-s-ayu-mirage span.cm-def { color: #ffd580; }
+.cm-s-ayu-mirage span.cm-bracket { color: rgba(92, 207, 230, 80); }
+.cm-s-ayu-mirage span.cm-tag { color: #5ccfe6; }
+.cm-s-ayu-mirage span.cm-header { color: #bae67e; }
+.cm-s-ayu-mirage span.cm-link { color: #5ccfe6; }
+.cm-s-ayu-mirage span.cm-error { color: #ff3333; } 
+
+.cm-s-ayu-mirage .CodeMirror-activeline-background { background: #191e2a; }
+.cm-s-ayu-mirage .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/base16-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,40 @@
+/*
+
+    Name:       Base16 Default Dark
+    Author:     Chris Kempson (http://chriskempson.com)
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-base16-dark.CodeMirror { background: #151515; color: #e0e0e0; }
+.cm-s-base16-dark div.CodeMirror-selected { background: #303030; }
+.cm-s-base16-dark .CodeMirror-line::selection, .cm-s-base16-dark .CodeMirror-line > span::selection, .cm-s-base16-dark .CodeMirror-line > span > span::selection { background: rgba(48, 48, 48, .99); }
+.cm-s-base16-dark .CodeMirror-line::-moz-selection, .cm-s-base16-dark .CodeMirror-line > span::-moz-selection, .cm-s-base16-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(48, 48, 48, .99); }
+.cm-s-base16-dark .CodeMirror-gutters { background: #151515; border-right: 0px; }
+.cm-s-base16-dark .CodeMirror-guttermarker { color: #ac4142; }
+.cm-s-base16-dark .CodeMirror-guttermarker-subtle { color: #505050; }
+.cm-s-base16-dark .CodeMirror-linenumber { color: #505050; }
+.cm-s-base16-dark .CodeMirror-cursor { border-left: 1px solid #b0b0b0; }
+.cm-s-base16-dark.cm-fat-cursor .CodeMirror-cursor { background-color: #8e8d8875 !important; }
+.cm-s-base16-dark .cm-animate-fat-cursor { background-color: #8e8d8875 !important; }
+
+.cm-s-base16-dark span.cm-comment { color: #8f5536; }
+.cm-s-base16-dark span.cm-atom { color: #aa759f; }
+.cm-s-base16-dark span.cm-number { color: #aa759f; }
+
+.cm-s-base16-dark span.cm-property, .cm-s-base16-dark span.cm-attribute { color: #90a959; }
+.cm-s-base16-dark span.cm-keyword { color: #ac4142; }
+.cm-s-base16-dark span.cm-string { color: #f4bf75; }
+
+.cm-s-base16-dark span.cm-variable { color: #90a959; }
+.cm-s-base16-dark span.cm-variable-2 { color: #6a9fb5; }
+.cm-s-base16-dark span.cm-def { color: #d28445; }
+.cm-s-base16-dark span.cm-bracket { color: #e0e0e0; }
+.cm-s-base16-dark span.cm-tag { color: #ac4142; }
+.cm-s-base16-dark span.cm-link { color: #aa759f; }
+.cm-s-base16-dark span.cm-error { background: #ac4142; color: #b0b0b0; }
+
+.cm-s-base16-dark .CodeMirror-activeline-background { background: #202020; }
+.cm-s-base16-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/base16-light.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,38 @@
+/*
+
+    Name:       Base16 Default Light
+    Author:     Chris Kempson (http://chriskempson.com)
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-base16-light.CodeMirror { background: #f5f5f5; color: #202020; }
+.cm-s-base16-light div.CodeMirror-selected { background: #e0e0e0; }
+.cm-s-base16-light .CodeMirror-line::selection, .cm-s-base16-light .CodeMirror-line > span::selection, .cm-s-base16-light .CodeMirror-line > span > span::selection { background: #e0e0e0; }
+.cm-s-base16-light .CodeMirror-line::-moz-selection, .cm-s-base16-light .CodeMirror-line > span::-moz-selection, .cm-s-base16-light .CodeMirror-line > span > span::-moz-selection { background: #e0e0e0; }
+.cm-s-base16-light .CodeMirror-gutters { background: #f5f5f5; border-right: 0px; }
+.cm-s-base16-light .CodeMirror-guttermarker { color: #ac4142; }
+.cm-s-base16-light .CodeMirror-guttermarker-subtle { color: #b0b0b0; }
+.cm-s-base16-light .CodeMirror-linenumber { color: #b0b0b0; }
+.cm-s-base16-light .CodeMirror-cursor { border-left: 1px solid #505050; }
+
+.cm-s-base16-light span.cm-comment { color: #8f5536; }
+.cm-s-base16-light span.cm-atom { color: #aa759f; }
+.cm-s-base16-light span.cm-number { color: #aa759f; }
+
+.cm-s-base16-light span.cm-property, .cm-s-base16-light span.cm-attribute { color: #90a959; }
+.cm-s-base16-light span.cm-keyword { color: #ac4142; }
+.cm-s-base16-light span.cm-string { color: #f4bf75; }
+
+.cm-s-base16-light span.cm-variable { color: #90a959; }
+.cm-s-base16-light span.cm-variable-2 { color: #6a9fb5; }
+.cm-s-base16-light span.cm-def { color: #d28445; }
+.cm-s-base16-light span.cm-bracket { color: #202020; }
+.cm-s-base16-light span.cm-tag { color: #ac4142; }
+.cm-s-base16-light span.cm-link { color: #aa759f; }
+.cm-s-base16-light span.cm-error { background: #ac4142; color: #505050; }
+
+.cm-s-base16-light .CodeMirror-activeline-background { background: #DDDCDC; }
+.cm-s-base16-light .CodeMirror-matchingbracket { color: #f5f5f5 !important; background-color: #6A9FB5 !important}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/bespin.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+/*
+
+    Name:       Bespin
+    Author:     Mozilla / Jan T. Sott
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-bespin.CodeMirror {background: #28211c; color: #9d9b97;}
+.cm-s-bespin div.CodeMirror-selected {background: #59554f !important;}
+.cm-s-bespin .CodeMirror-gutters {background: #28211c; border-right: 0px;}
+.cm-s-bespin .CodeMirror-linenumber {color: #666666;}
+.cm-s-bespin .CodeMirror-cursor {border-left: 1px solid #797977 !important;}
+
+.cm-s-bespin span.cm-comment {color: #937121;}
+.cm-s-bespin span.cm-atom {color: #9b859d;}
+.cm-s-bespin span.cm-number {color: #9b859d;}
+
+.cm-s-bespin span.cm-property, .cm-s-bespin span.cm-attribute {color: #54be0d;}
+.cm-s-bespin span.cm-keyword {color: #cf6a4c;}
+.cm-s-bespin span.cm-string {color: #f9ee98;}
+
+.cm-s-bespin span.cm-variable {color: #54be0d;}
+.cm-s-bespin span.cm-variable-2 {color: #5ea6ea;}
+.cm-s-bespin span.cm-def {color: #cf7d34;}
+.cm-s-bespin span.cm-error {background: #cf6a4c; color: #797977;}
+.cm-s-bespin span.cm-bracket {color: #9d9b97;}
+.cm-s-bespin span.cm-tag {color: #cf6a4c;}
+.cm-s-bespin span.cm-link {color: #9b859d;}
+
+.cm-s-bespin .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
+.cm-s-bespin .CodeMirror-activeline-background { background: #404040; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/blackboard.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,32 @@
+/* Port of TextMate's Blackboard theme */
+
+.cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; }
+.cm-s-blackboard div.CodeMirror-selected { background: #253B76; }
+.cm-s-blackboard .CodeMirror-line::selection, .cm-s-blackboard .CodeMirror-line > span::selection, .cm-s-blackboard .CodeMirror-line > span > span::selection { background: rgba(37, 59, 118, .99); }
+.cm-s-blackboard .CodeMirror-line::-moz-selection, .cm-s-blackboard .CodeMirror-line > span::-moz-selection, .cm-s-blackboard .CodeMirror-line > span > span::-moz-selection { background: rgba(37, 59, 118, .99); }
+.cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; }
+.cm-s-blackboard .CodeMirror-guttermarker { color: #FBDE2D; }
+.cm-s-blackboard .CodeMirror-guttermarker-subtle { color: #888; }
+.cm-s-blackboard .CodeMirror-linenumber { color: #888; }
+.cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7; }
+
+.cm-s-blackboard .cm-keyword { color: #FBDE2D; }
+.cm-s-blackboard .cm-atom { color: #D8FA3C; }
+.cm-s-blackboard .cm-number { color: #D8FA3C; }
+.cm-s-blackboard .cm-def { color: #8DA6CE; }
+.cm-s-blackboard .cm-variable { color: #FF6400; }
+.cm-s-blackboard .cm-operator { color: #FBDE2D; }
+.cm-s-blackboard .cm-comment { color: #AEAEAE; }
+.cm-s-blackboard .cm-string { color: #61CE3C; }
+.cm-s-blackboard .cm-string-2 { color: #61CE3C; }
+.cm-s-blackboard .cm-meta { color: #D8FA3C; }
+.cm-s-blackboard .cm-builtin { color: #8DA6CE; }
+.cm-s-blackboard .cm-tag { color: #8DA6CE; }
+.cm-s-blackboard .cm-attribute { color: #8DA6CE; }
+.cm-s-blackboard .cm-header { color: #FF6400; }
+.cm-s-blackboard .cm-hr { color: #AEAEAE; }
+.cm-s-blackboard .cm-link { color: #8DA6CE; }
+.cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; }
+
+.cm-s-blackboard .CodeMirror-activeline-background { background: #3C3636; }
+.cm-s-blackboard .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/cobalt.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,25 @@
+.cm-s-cobalt.CodeMirror { background: #002240; color: white; }
+.cm-s-cobalt div.CodeMirror-selected { background: #b36539; }
+.cm-s-cobalt .CodeMirror-line::selection, .cm-s-cobalt .CodeMirror-line > span::selection, .cm-s-cobalt .CodeMirror-line > span > span::selection { background: rgba(179, 101, 57, .99); }
+.cm-s-cobalt .CodeMirror-line::-moz-selection, .cm-s-cobalt .CodeMirror-line > span::-moz-selection, .cm-s-cobalt .CodeMirror-line > span > span::-moz-selection { background: rgba(179, 101, 57, .99); }
+.cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
+.cm-s-cobalt .CodeMirror-guttermarker { color: #ffee80; }
+.cm-s-cobalt .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; }
+.cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-cobalt span.cm-comment { color: #08f; }
+.cm-s-cobalt span.cm-atom { color: #845dc4; }
+.cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
+.cm-s-cobalt span.cm-keyword { color: #ffee80; }
+.cm-s-cobalt span.cm-string { color: #3ad900; }
+.cm-s-cobalt span.cm-meta { color: #ff9d00; }
+.cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
+.cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def, .cm-s-cobalt .cm-type { color: white; }
+.cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
+.cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
+.cm-s-cobalt span.cm-link { color: #845dc4; }
+.cm-s-cobalt span.cm-error { color: #9d1e15; }
+
+.cm-s-cobalt .CodeMirror-activeline-background { background: #002D57; }
+.cm-s-cobalt .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/colorforth.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,33 @@
+.cm-s-colorforth.CodeMirror { background: #000000; color: #f8f8f8; }
+.cm-s-colorforth .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
+.cm-s-colorforth .CodeMirror-guttermarker { color: #FFBD40; }
+.cm-s-colorforth .CodeMirror-guttermarker-subtle { color: #78846f; }
+.cm-s-colorforth .CodeMirror-linenumber { color: #bababa; }
+.cm-s-colorforth .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-colorforth span.cm-comment     { color: #ededed; }
+.cm-s-colorforth span.cm-def         { color: #ff1c1c; font-weight:bold; }
+.cm-s-colorforth span.cm-keyword     { color: #ffd900; }
+.cm-s-colorforth span.cm-builtin     { color: #00d95a; }
+.cm-s-colorforth span.cm-variable    { color: #73ff00; }
+.cm-s-colorforth span.cm-string      { color: #007bff; }
+.cm-s-colorforth span.cm-number      { color: #00c4ff; }
+.cm-s-colorforth span.cm-atom        { color: #606060; }
+
+.cm-s-colorforth span.cm-variable-2  { color: #EEE; }
+.cm-s-colorforth span.cm-variable-3, .cm-s-colorforth span.cm-type { color: #DDD; }
+.cm-s-colorforth span.cm-property    {}
+.cm-s-colorforth span.cm-operator    {}
+
+.cm-s-colorforth span.cm-meta        { color: yellow; }
+.cm-s-colorforth span.cm-qualifier   { color: #FFF700; }
+.cm-s-colorforth span.cm-bracket     { color: #cc7; }
+.cm-s-colorforth span.cm-tag         { color: #FFBD40; }
+.cm-s-colorforth span.cm-attribute   { color: #FFF700; }
+.cm-s-colorforth span.cm-error       { color: #f00; }
+
+.cm-s-colorforth div.CodeMirror-selected { background: #333d53; }
+
+.cm-s-colorforth span.cm-compilation { background: rgba(255, 255, 255, 0.12); }
+
+.cm-s-colorforth .CodeMirror-activeline-background { background: #253540; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/darcula.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,53 @@
+/**
+    Name: IntelliJ IDEA darcula theme
+    From IntelliJ IDEA by JetBrains
+ */
+
+.cm-s-darcula  { font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif;}
+.cm-s-darcula.CodeMirror { background: #2B2B2B; color: #A9B7C6; }
+
+.cm-s-darcula span.cm-meta { color: #BBB529; }
+.cm-s-darcula span.cm-number { color: #6897BB; }
+.cm-s-darcula span.cm-keyword { color: #CC7832; line-height: 1em; font-weight: bold; }
+.cm-s-darcula span.cm-def { color: #A9B7C6; font-style: italic; }
+.cm-s-darcula span.cm-variable { color: #A9B7C6; }
+.cm-s-darcula span.cm-variable-2 { color: #A9B7C6; }
+.cm-s-darcula span.cm-variable-3 { color: #9876AA; }
+.cm-s-darcula span.cm-type { color: #AABBCC; font-weight: bold; }
+.cm-s-darcula span.cm-property { color: #FFC66D; }
+.cm-s-darcula span.cm-operator { color: #A9B7C6; }
+.cm-s-darcula span.cm-string { color: #6A8759; }
+.cm-s-darcula span.cm-string-2 { color: #6A8759; }
+.cm-s-darcula span.cm-comment { color: #61A151; font-style: italic; }
+.cm-s-darcula span.cm-link { color: #CC7832; }
+.cm-s-darcula span.cm-atom { color: #CC7832; }
+.cm-s-darcula span.cm-error { color: #BC3F3C; }
+.cm-s-darcula span.cm-tag { color: #629755; font-weight: bold; font-style: italic; text-decoration: underline; }
+.cm-s-darcula span.cm-attribute { color: #6897bb; }
+.cm-s-darcula span.cm-qualifier { color: #6A8759; }
+.cm-s-darcula span.cm-bracket { color: #A9B7C6; }
+.cm-s-darcula span.cm-builtin { color: #FF9E59; }
+.cm-s-darcula span.cm-special { color: #FF9E59; }
+.cm-s-darcula span.cm-matchhighlight { color: #FFFFFF; background-color: rgba(50, 89, 48, .7); font-weight: normal;}
+.cm-s-darcula span.cm-searching { color: #FFFFFF; background-color: rgba(61, 115, 59, .7); font-weight: normal;}
+
+.cm-s-darcula .CodeMirror-cursor { border-left: 1px solid #A9B7C6; }
+.cm-s-darcula .CodeMirror-activeline-background { background: #323232; }
+.cm-s-darcula .CodeMirror-gutters { background: #313335; border-right: 1px solid #313335; }
+.cm-s-darcula .CodeMirror-guttermarker { color: #FFEE80; }
+.cm-s-darcula .CodeMirror-guttermarker-subtle { color: #D0D0D0; }
+.cm-s-darcula .CodeMirrir-linenumber { color: #606366; }
+.cm-s-darcula .CodeMirror-matchingbracket { background-color: #3B514D; color: #FFEF28 !important; font-weight: bold; }
+
+.cm-s-darcula div.CodeMirror-selected { background: #214283; }
+
+.CodeMirror-hints.darcula {
+  font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
+  color: #9C9E9E;
+  background-color: #3B3E3F !important;
+}
+
+.CodeMirror-hints.darcula .CodeMirror-hint-active {
+  background-color: #494D4E !important;
+  color: #9C9E9E !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/dracula.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,40 @@
+/*
+
+    Name:       dracula
+    Author:     Michael Kaminsky (http://github.com/mkaminsky11)
+
+    Original dracula color scheme by Zeno Rocha (https://github.com/zenorocha/dracula-theme)
+
+*/
+
+
+.cm-s-dracula.CodeMirror, .cm-s-dracula .CodeMirror-gutters {
+  background-color: #282a36 !important;
+  color: #f8f8f2 !important;
+  border: none;
+}
+.cm-s-dracula .CodeMirror-gutters { color: #282a36; }
+.cm-s-dracula .CodeMirror-cursor { border-left: solid thin #f8f8f0; }
+.cm-s-dracula .CodeMirror-linenumber { color: #6D8A88; }
+.cm-s-dracula .CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
+.cm-s-dracula .CodeMirror-line::selection, .cm-s-dracula .CodeMirror-line > span::selection, .cm-s-dracula .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); }
+.cm-s-dracula .CodeMirror-line::-moz-selection, .cm-s-dracula .CodeMirror-line > span::-moz-selection, .cm-s-dracula .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); }
+.cm-s-dracula span.cm-comment { color: #6272a4; }
+.cm-s-dracula span.cm-string, .cm-s-dracula span.cm-string-2 { color: #f1fa8c; }
+.cm-s-dracula span.cm-number { color: #bd93f9; }
+.cm-s-dracula span.cm-variable { color: #50fa7b; }
+.cm-s-dracula span.cm-variable-2 { color: white; }
+.cm-s-dracula span.cm-def { color: #50fa7b; }
+.cm-s-dracula span.cm-operator { color: #ff79c6; }
+.cm-s-dracula span.cm-keyword { color: #ff79c6; }
+.cm-s-dracula span.cm-atom { color: #bd93f9; }
+.cm-s-dracula span.cm-meta { color: #f8f8f2; }
+.cm-s-dracula span.cm-tag { color: #ff79c6; }
+.cm-s-dracula span.cm-attribute { color: #50fa7b; }
+.cm-s-dracula span.cm-qualifier { color: #50fa7b; }
+.cm-s-dracula span.cm-property { color: #66d9ef; }
+.cm-s-dracula span.cm-builtin { color: #50fa7b; }
+.cm-s-dracula span.cm-variable-3, .cm-s-dracula span.cm-type { color: #ffb86c; }
+
+.cm-s-dracula .CodeMirror-activeline-background { background: rgba(255,255,255,0.1); }
+.cm-s-dracula .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/duotone-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,35 @@
+/*
+Name:   DuoTone-Dark
+Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
+
+CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/)
+*/
+
+.cm-s-duotone-dark.CodeMirror { background: #2a2734; color: #6c6783; }
+.cm-s-duotone-dark div.CodeMirror-selected { background: #545167!important; }
+.cm-s-duotone-dark .CodeMirror-gutters { background: #2a2734; border-right: 0px; }
+.cm-s-duotone-dark .CodeMirror-linenumber { color: #545167; }
+
+/* begin cursor */
+.cm-s-duotone-dark .CodeMirror-cursor { border-left: 1px solid #ffad5c; /* border-left: 1px solid #ffad5c80; */ border-right: .5em solid #ffad5c; /* border-right: .5em solid #ffad5c80; */ opacity: .5; }
+.cm-s-duotone-dark .CodeMirror-activeline-background { background: #363342; /* background: #36334280;  */ opacity: .5;}
+.cm-s-duotone-dark .cm-fat-cursor .CodeMirror-cursor { background: #ffad5c; /* background: #ffad5c80; */ opacity: .5;}
+/* end cursor */
+
+.cm-s-duotone-dark span.cm-atom, .cm-s-duotone-dark span.cm-number, .cm-s-duotone-dark span.cm-keyword, .cm-s-duotone-dark span.cm-variable, .cm-s-duotone-dark span.cm-attribute, .cm-s-duotone-dark span.cm-quote, .cm-s-duotone-dark span.cm-hr, .cm-s-duotone-dark span.cm-link { color: #ffcc99; }
+
+.cm-s-duotone-dark span.cm-property { color: #9a86fd; }
+.cm-s-duotone-dark span.cm-punctuation, .cm-s-duotone-dark span.cm-unit, .cm-s-duotone-dark span.cm-negative { color: #e09142; }
+.cm-s-duotone-dark span.cm-string { color: #ffb870; }
+.cm-s-duotone-dark span.cm-operator { color: #ffad5c; }
+.cm-s-duotone-dark span.cm-positive { color: #6a51e6; }
+
+.cm-s-duotone-dark span.cm-variable-2, .cm-s-duotone-dark span.cm-variable-3, .cm-s-duotone-dark span.cm-type, .cm-s-duotone-dark span.cm-string-2, .cm-s-duotone-dark span.cm-url { color: #7a63ee; }
+.cm-s-duotone-dark span.cm-def, .cm-s-duotone-dark span.cm-tag, .cm-s-duotone-dark span.cm-builtin, .cm-s-duotone-dark span.cm-qualifier, .cm-s-duotone-dark span.cm-header, .cm-s-duotone-dark span.cm-em { color: #eeebff; }
+.cm-s-duotone-dark span.cm-bracket, .cm-s-duotone-dark span.cm-comment { color: #a7a5b2; }
+
+/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */
+.cm-s-duotone-dark span.cm-error, .cm-s-duotone-dark span.cm-invalidchar { color: #f00; }
+
+.cm-s-duotone-dark span.cm-header { font-weight: normal; }
+.cm-s-duotone-dark .CodeMirror-matchingbracket { text-decoration: underline; color: #eeebff !important; } 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/duotone-light.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,36 @@
+/*
+Name:   DuoTone-Light
+Author: by Bram de Haan, adapted from DuoTone themes by Simurai (http://simurai.com/projects/2016/01/01/duotone-themes)
+
+CodeMirror template by Jan T. Sott (https://github.com/idleberg), adapted by Bram de Haan (https://github.com/atelierbram/)
+*/
+
+.cm-s-duotone-light.CodeMirror { background: #faf8f5; color: #b29762; }
+.cm-s-duotone-light div.CodeMirror-selected { background: #e3dcce !important; }
+.cm-s-duotone-light .CodeMirror-gutters { background: #faf8f5; border-right: 0px; }
+.cm-s-duotone-light .CodeMirror-linenumber { color: #cdc4b1; }
+
+/* begin cursor */
+.cm-s-duotone-light .CodeMirror-cursor { border-left: 1px solid #93abdc; /* border-left: 1px solid #93abdc80; */ border-right: .5em solid #93abdc; /* border-right: .5em solid #93abdc80; */ opacity: .5; }
+.cm-s-duotone-light .CodeMirror-activeline-background { background: #e3dcce;  /* background: #e3dcce80; */ opacity: .5; }
+.cm-s-duotone-light .cm-fat-cursor .CodeMirror-cursor { background: #93abdc; /* #93abdc80; */ opacity: .5; }
+/* end cursor */
+
+.cm-s-duotone-light span.cm-atom, .cm-s-duotone-light span.cm-number, .cm-s-duotone-light span.cm-keyword, .cm-s-duotone-light span.cm-variable, .cm-s-duotone-light span.cm-attribute, .cm-s-duotone-light span.cm-quote, .cm-s-duotone-light-light span.cm-hr, .cm-s-duotone-light-light span.cm-link { color: #063289; }
+
+.cm-s-duotone-light span.cm-property { color: #b29762; }
+.cm-s-duotone-light span.cm-punctuation, .cm-s-duotone-light span.cm-unit, .cm-s-duotone-light span.cm-negative { color: #063289; }
+.cm-s-duotone-light span.cm-string, .cm-s-duotone-light span.cm-operator { color: #1659df; }
+.cm-s-duotone-light span.cm-positive { color: #896724; }
+
+.cm-s-duotone-light span.cm-variable-2, .cm-s-duotone-light span.cm-variable-3, .cm-s-duotone-light span.cm-type, .cm-s-duotone-light span.cm-string-2, .cm-s-duotone-light span.cm-url { color: #896724; }
+.cm-s-duotone-light span.cm-def, .cm-s-duotone-light span.cm-tag, .cm-s-duotone-light span.cm-builtin, .cm-s-duotone-light span.cm-qualifier, .cm-s-duotone-light span.cm-header, .cm-s-duotone-light span.cm-em { color: #2d2006; }
+.cm-s-duotone-light span.cm-bracket, .cm-s-duotone-light span.cm-comment { color: #6f6e6a; }
+
+/* using #f00 red for errors, don't think any of the colorscheme variables will stand out enough, ... maybe by giving it a background-color ... */
+/* .cm-s-duotone-light span.cm-error { background: #896724; color: #728fcb; } */
+.cm-s-duotone-light span.cm-error, .cm-s-duotone-light span.cm-invalidchar { color: #f00; }
+
+.cm-s-duotone-light span.cm-header { font-weight: normal; }
+.cm-s-duotone-light .CodeMirror-matchingbracket { text-decoration: underline; color: #faf8f5 !important; }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/eclipse.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+.cm-s-eclipse span.cm-meta { color: #FF1717; }
+.cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; }
+.cm-s-eclipse span.cm-atom { color: #219; }
+.cm-s-eclipse span.cm-number { color: #164; }
+.cm-s-eclipse span.cm-def { color: #00f; }
+.cm-s-eclipse span.cm-variable { color: black; }
+.cm-s-eclipse span.cm-variable-2 { color: #0000C0; }
+.cm-s-eclipse span.cm-variable-3, .cm-s-eclipse span.cm-type { color: #0000C0; }
+.cm-s-eclipse span.cm-property { color: black; }
+.cm-s-eclipse span.cm-operator { color: black; }
+.cm-s-eclipse span.cm-comment { color: #3F7F5F; }
+.cm-s-eclipse span.cm-string { color: #2A00FF; }
+.cm-s-eclipse span.cm-string-2 { color: #f50; }
+.cm-s-eclipse span.cm-qualifier { color: #555; }
+.cm-s-eclipse span.cm-builtin { color: #30a; }
+.cm-s-eclipse span.cm-bracket { color: #cc7; }
+.cm-s-eclipse span.cm-tag { color: #170; }
+.cm-s-eclipse span.cm-attribute { color: #00c; }
+.cm-s-eclipse span.cm-link { color: #219; }
+.cm-s-eclipse span.cm-error { color: #f00; }
+
+.cm-s-eclipse .CodeMirror-activeline-background { background: #e8f2ff; }
+.cm-s-eclipse .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/elegant.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,13 @@
+.cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom { color: #762; }
+.cm-s-elegant span.cm-comment { color: #262; font-style: italic; line-height: 1em; }
+.cm-s-elegant span.cm-meta { color: #555; font-style: italic; line-height: 1em; }
+.cm-s-elegant span.cm-variable { color: black; }
+.cm-s-elegant span.cm-variable-2 { color: #b11; }
+.cm-s-elegant span.cm-qualifier { color: #555; }
+.cm-s-elegant span.cm-keyword { color: #730; }
+.cm-s-elegant span.cm-builtin { color: #30a; }
+.cm-s-elegant span.cm-link { color: #762; }
+.cm-s-elegant span.cm-error { background-color: #fdd; }
+
+.cm-s-elegant .CodeMirror-activeline-background { background: #e8f2ff; }
+.cm-s-elegant .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/erlang-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+.cm-s-erlang-dark.CodeMirror { background: #002240; color: white; }
+.cm-s-erlang-dark div.CodeMirror-selected { background: #b36539; }
+.cm-s-erlang-dark .CodeMirror-line::selection, .cm-s-erlang-dark .CodeMirror-line > span::selection, .cm-s-erlang-dark .CodeMirror-line > span > span::selection { background: rgba(179, 101, 57, .99); }
+.cm-s-erlang-dark .CodeMirror-line::-moz-selection, .cm-s-erlang-dark .CodeMirror-line > span::-moz-selection, .cm-s-erlang-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(179, 101, 57, .99); }
+.cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
+.cm-s-erlang-dark .CodeMirror-guttermarker { color: white; }
+.cm-s-erlang-dark .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; }
+.cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-erlang-dark span.cm-quote      { color: #ccc; }
+.cm-s-erlang-dark span.cm-atom       { color: #f133f1; }
+.cm-s-erlang-dark span.cm-attribute  { color: #ff80e1; }
+.cm-s-erlang-dark span.cm-bracket    { color: #ff9d00; }
+.cm-s-erlang-dark span.cm-builtin    { color: #eaa; }
+.cm-s-erlang-dark span.cm-comment    { color: #77f; }
+.cm-s-erlang-dark span.cm-def        { color: #e7a; }
+.cm-s-erlang-dark span.cm-keyword    { color: #ffee80; }
+.cm-s-erlang-dark span.cm-meta       { color: #50fefe; }
+.cm-s-erlang-dark span.cm-number     { color: #ffd0d0; }
+.cm-s-erlang-dark span.cm-operator   { color: #d55; }
+.cm-s-erlang-dark span.cm-property   { color: #ccc; }
+.cm-s-erlang-dark span.cm-qualifier  { color: #ccc; }
+.cm-s-erlang-dark span.cm-special    { color: #ffbbbb; }
+.cm-s-erlang-dark span.cm-string     { color: #3ad900; }
+.cm-s-erlang-dark span.cm-string-2   { color: #ccc; }
+.cm-s-erlang-dark span.cm-tag        { color: #9effff; }
+.cm-s-erlang-dark span.cm-variable   { color: #50fe50; }
+.cm-s-erlang-dark span.cm-variable-2 { color: #e0e; }
+.cm-s-erlang-dark span.cm-variable-3, .cm-s-erlang-dark span.cm-type { color: #ccc; }
+.cm-s-erlang-dark span.cm-error      { color: #9d1e15; }
+
+.cm-s-erlang-dark .CodeMirror-activeline-background { background: #013461; }
+.cm-s-erlang-dark .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/gruvbox-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,39 @@
+/*
+
+    Name:       gruvbox-dark
+    Author:     kRkk (https://github.com/krkk)
+
+    Original gruvbox color scheme by Pavel Pertsev (https://github.com/morhetz/gruvbox)
+
+*/
+
+.cm-s-gruvbox-dark.CodeMirror, .cm-s-gruvbox-dark .CodeMirror-gutters { background-color: #282828; color: #bdae93; }
+.cm-s-gruvbox-dark .CodeMirror-gutters {background: #282828; border-right: 0px;}
+.cm-s-gruvbox-dark .CodeMirror-linenumber {color: #7c6f64;}
+.cm-s-gruvbox-dark .CodeMirror-cursor { border-left: 1px solid #ebdbb2; }
+.cm-s-gruvbox-dark.cm-fat-cursor .CodeMirror-cursor { background-color: #8e8d8875 !important; }
+.cm-s-gruvbox-dark .cm-animate-fat-cursor { background-color: #8e8d8875 !important; }
+.cm-s-gruvbox-dark div.CodeMirror-selected { background: #928374; }
+.cm-s-gruvbox-dark span.cm-meta { color: #83a598; }
+
+.cm-s-gruvbox-dark span.cm-comment { color: #928374; }
+.cm-s-gruvbox-dark span.cm-number, span.cm-atom { color: #d3869b; }
+.cm-s-gruvbox-dark span.cm-keyword { color: #f84934; }
+
+.cm-s-gruvbox-dark span.cm-variable { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-variable-2 { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-variable-3, .cm-s-gruvbox-dark span.cm-type { color: #fabd2f; }
+.cm-s-gruvbox-dark span.cm-operator { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-callee { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-def { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-property { color: #ebdbb2; }
+.cm-s-gruvbox-dark span.cm-string { color: #b8bb26; }
+.cm-s-gruvbox-dark span.cm-string-2 { color: #8ec07c; }
+.cm-s-gruvbox-dark span.cm-qualifier { color: #8ec07c; }
+.cm-s-gruvbox-dark span.cm-attribute { color: #8ec07c; }
+
+.cm-s-gruvbox-dark .CodeMirror-activeline-background { background: #3c3836; }
+.cm-s-gruvbox-dark .CodeMirror-matchingbracket { background: #928374; color:#282828 !important; }
+
+.cm-s-gruvbox-dark span.cm-builtin { color: #fe8019; }
+.cm-s-gruvbox-dark span.cm-tag { color: #fe8019; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/hopscotch.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+/*
+
+    Name:       Hopscotch
+    Author:     Jan T. Sott
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-hopscotch.CodeMirror {background: #322931; color: #d5d3d5;}
+.cm-s-hopscotch div.CodeMirror-selected {background: #433b42 !important;}
+.cm-s-hopscotch .CodeMirror-gutters {background: #322931; border-right: 0px;}
+.cm-s-hopscotch .CodeMirror-linenumber {color: #797379;}
+.cm-s-hopscotch .CodeMirror-cursor {border-left: 1px solid #989498 !important;}
+
+.cm-s-hopscotch span.cm-comment {color: #b33508;}
+.cm-s-hopscotch span.cm-atom {color: #c85e7c;}
+.cm-s-hopscotch span.cm-number {color: #c85e7c;}
+
+.cm-s-hopscotch span.cm-property, .cm-s-hopscotch span.cm-attribute {color: #8fc13e;}
+.cm-s-hopscotch span.cm-keyword {color: #dd464c;}
+.cm-s-hopscotch span.cm-string {color: #fdcc59;}
+
+.cm-s-hopscotch span.cm-variable {color: #8fc13e;}
+.cm-s-hopscotch span.cm-variable-2 {color: #1290bf;}
+.cm-s-hopscotch span.cm-def {color: #fd8b19;}
+.cm-s-hopscotch span.cm-error {background: #dd464c; color: #989498;}
+.cm-s-hopscotch span.cm-bracket {color: #d5d3d5;}
+.cm-s-hopscotch span.cm-tag {color: #dd464c;}
+.cm-s-hopscotch span.cm-link {color: #c85e7c;}
+
+.cm-s-hopscotch .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
+.cm-s-hopscotch .CodeMirror-activeline-background { background: #302020; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/icecoder.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,43 @@
+/*
+ICEcoder default theme by Matt Pass, used in code editor available at https://icecoder.net
+*/
+
+.cm-s-icecoder { color: #666; background: #1d1d1b; }
+
+.cm-s-icecoder span.cm-keyword { color: #eee; font-weight:bold; }  /* off-white 1 */
+.cm-s-icecoder span.cm-atom { color: #e1c76e; }                    /* yellow */
+.cm-s-icecoder span.cm-number { color: #6cb5d9; }                  /* blue */
+.cm-s-icecoder span.cm-def { color: #b9ca4a; }                     /* green */
+
+.cm-s-icecoder span.cm-variable { color: #6cb5d9; }                /* blue */
+.cm-s-icecoder span.cm-variable-2 { color: #cc1e5c; }              /* pink */
+.cm-s-icecoder span.cm-variable-3, .cm-s-icecoder span.cm-type { color: #f9602c; } /* orange */
+
+.cm-s-icecoder span.cm-property { color: #eee; }                   /* off-white 1 */
+.cm-s-icecoder span.cm-operator { color: #9179bb; }                /* purple */
+.cm-s-icecoder span.cm-comment { color: #97a3aa; }                 /* grey-blue */
+
+.cm-s-icecoder span.cm-string { color: #b9ca4a; }                  /* green */
+.cm-s-icecoder span.cm-string-2 { color: #6cb5d9; }                /* blue */
+
+.cm-s-icecoder span.cm-meta { color: #555; }                       /* grey */
+
+.cm-s-icecoder span.cm-qualifier { color: #555; }                  /* grey */
+.cm-s-icecoder span.cm-builtin { color: #214e7b; }                 /* bright blue */
+.cm-s-icecoder span.cm-bracket { color: #cc7; }                    /* grey-yellow */
+
+.cm-s-icecoder span.cm-tag { color: #e8e8e8; }                     /* off-white 2 */
+.cm-s-icecoder span.cm-attribute { color: #099; }                  /* teal */
+
+.cm-s-icecoder span.cm-header { color: #6a0d6a; }                  /* purple-pink */
+.cm-s-icecoder span.cm-quote { color: #186718; }                   /* dark green */
+.cm-s-icecoder span.cm-hr { color: #888; }                         /* mid-grey */
+.cm-s-icecoder span.cm-link { color: #e1c76e; }                    /* yellow */
+.cm-s-icecoder span.cm-error { color: #d00; }                      /* red */
+
+.cm-s-icecoder .CodeMirror-cursor { border-left: 1px solid white; }
+.cm-s-icecoder div.CodeMirror-selected { color: #fff; background: #037; }
+.cm-s-icecoder .CodeMirror-gutters { background: #1d1d1b; min-width: 41px; border-right: 0; }
+.cm-s-icecoder .CodeMirror-linenumber { color: #555; cursor: default; }
+.cm-s-icecoder .CodeMirror-matchingbracket { color: #fff !important; background: #555 !important; }
+.cm-s-icecoder .CodeMirror-activeline-background { background: #000; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/idea.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,42 @@
+/**
+    Name:       IDEA default theme
+    From IntelliJ IDEA by JetBrains
+ */
+
+.cm-s-idea span.cm-meta { color: #808000; }
+.cm-s-idea span.cm-number { color: #0000FF; }
+.cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; }
+.cm-s-idea span.cm-atom { font-weight: bold; color: #000080; }
+.cm-s-idea span.cm-def { color: #000000; }
+.cm-s-idea span.cm-variable { color: black; }
+.cm-s-idea span.cm-variable-2 { color: black; }
+.cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; }
+.cm-s-idea span.cm-property { color: black; }
+.cm-s-idea span.cm-operator { color: black; }
+.cm-s-idea span.cm-comment { color: #808080; }
+.cm-s-idea span.cm-string { color: #008000; }
+.cm-s-idea span.cm-string-2 { color: #008000; }
+.cm-s-idea span.cm-qualifier { color: #555; }
+.cm-s-idea span.cm-error { color: #FF0000; }
+.cm-s-idea span.cm-attribute { color: #0000FF; }
+.cm-s-idea span.cm-tag { color: #000080; }
+.cm-s-idea span.cm-link { color: #0000FF; }
+.cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; }
+
+.cm-s-idea span.cm-builtin { color: #30a; }
+.cm-s-idea span.cm-bracket { color: #cc7; }
+.cm-s-idea  { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;}
+
+
+.cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
+
+.CodeMirror-hints.idea {
+  font-family: Menlo, Monaco, Consolas, 'Courier New', monospace;
+  color: #616569;
+  background-color: #ebf3fd !important;
+}
+
+.CodeMirror-hints.idea .CodeMirror-hint-active {
+  background-color: #a2b8c9 !important;
+  color: #5c6065 !important;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/isotope.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+/*
+
+    Name:       Isotope
+    Author:     David Desandro / Jan T. Sott
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-isotope.CodeMirror {background: #000000; color: #e0e0e0;}
+.cm-s-isotope div.CodeMirror-selected {background: #404040 !important;}
+.cm-s-isotope .CodeMirror-gutters {background: #000000; border-right: 0px;}
+.cm-s-isotope .CodeMirror-linenumber {color: #808080;}
+.cm-s-isotope .CodeMirror-cursor {border-left: 1px solid #c0c0c0 !important;}
+
+.cm-s-isotope span.cm-comment {color: #3300ff;}
+.cm-s-isotope span.cm-atom {color: #cc00ff;}
+.cm-s-isotope span.cm-number {color: #cc00ff;}
+
+.cm-s-isotope span.cm-property, .cm-s-isotope span.cm-attribute {color: #33ff00;}
+.cm-s-isotope span.cm-keyword {color: #ff0000;}
+.cm-s-isotope span.cm-string {color: #ff0099;}
+
+.cm-s-isotope span.cm-variable {color: #33ff00;}
+.cm-s-isotope span.cm-variable-2 {color: #0066ff;}
+.cm-s-isotope span.cm-def {color: #ff9900;}
+.cm-s-isotope span.cm-error {background: #ff0000; color: #c0c0c0;}
+.cm-s-isotope span.cm-bracket {color: #e0e0e0;}
+.cm-s-isotope span.cm-tag {color: #ff0000;}
+.cm-s-isotope span.cm-link {color: #cc00ff;}
+
+.cm-s-isotope .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
+.cm-s-isotope .CodeMirror-activeline-background { background: #202020; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/juejin.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,30 @@
+.cm-s-juejin.CodeMirror {
+  background: #f8f9fa;
+}
+.cm-s-juejin .cm-header,
+.cm-s-juejin .cm-def {
+  color: #1ba2f0;
+}
+.cm-s-juejin .cm-comment {
+  color: #009e9d;
+}
+.cm-s-juejin .cm-quote,
+.cm-s-juejin .cm-link,
+.cm-s-juejin .cm-strong,
+.cm-s-juejin .cm-attribute {
+  color: #fd7741;
+}
+.cm-s-juejin .cm-url,
+.cm-s-juejin .cm-keyword,
+.cm-s-juejin .cm-builtin {
+  color: #bb51b8;
+}
+.cm-s-juejin .cm-hr {
+  color: #909090;
+}
+.cm-s-juejin .cm-tag {
+  color: #107000;
+}
+.cm-s-juejin .cm-variable-2 {
+  color: #0050a0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/lesser-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,47 @@
+/*
+http://lesscss.org/ dark theme
+Ported to CodeMirror by Peter Kroon
+*/
+.cm-s-lesser-dark {
+  line-height: 1.3em;
+}
+.cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; }
+.cm-s-lesser-dark div.CodeMirror-selected { background: #45443B; } /* 33322B*/
+.cm-s-lesser-dark .CodeMirror-line::selection, .cm-s-lesser-dark .CodeMirror-line > span::selection, .cm-s-lesser-dark .CodeMirror-line > span > span::selection { background: rgba(69, 68, 59, .99); }
+.cm-s-lesser-dark .CodeMirror-line::-moz-selection, .cm-s-lesser-dark .CodeMirror-line > span::-moz-selection, .cm-s-lesser-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(69, 68, 59, .99); }
+.cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white; }
+.cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/
+
+.cm-s-lesser-dark.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/
+
+.cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; }
+.cm-s-lesser-dark .CodeMirror-guttermarker { color: #599eff; }
+.cm-s-lesser-dark .CodeMirror-guttermarker-subtle { color: #777; }
+.cm-s-lesser-dark .CodeMirror-linenumber { color: #777; }
+
+.cm-s-lesser-dark span.cm-header { color: #a0a; }
+.cm-s-lesser-dark span.cm-quote { color: #090; }
+.cm-s-lesser-dark span.cm-keyword { color: #599eff; }
+.cm-s-lesser-dark span.cm-atom { color: #C2B470; }
+.cm-s-lesser-dark span.cm-number { color: #B35E4D; }
+.cm-s-lesser-dark span.cm-def { color: white; }
+.cm-s-lesser-dark span.cm-variable { color:#D9BF8C; }
+.cm-s-lesser-dark span.cm-variable-2 { color: #669199; }
+.cm-s-lesser-dark span.cm-variable-3, .cm-s-lesser-dark span.cm-type { color: white; }
+.cm-s-lesser-dark span.cm-property { color: #92A75C; }
+.cm-s-lesser-dark span.cm-operator { color: #92A75C; }
+.cm-s-lesser-dark span.cm-comment { color: #666; }
+.cm-s-lesser-dark span.cm-string { color: #BCD279; }
+.cm-s-lesser-dark span.cm-string-2 { color: #f50; }
+.cm-s-lesser-dark span.cm-meta { color: #738C73; }
+.cm-s-lesser-dark span.cm-qualifier { color: #555; }
+.cm-s-lesser-dark span.cm-builtin { color: #ff9e59; }
+.cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; }
+.cm-s-lesser-dark span.cm-tag { color: #669199; }
+.cm-s-lesser-dark span.cm-attribute { color: #81a4d5; }
+.cm-s-lesser-dark span.cm-hr { color: #999; }
+.cm-s-lesser-dark span.cm-link { color: #7070E6; }
+.cm-s-lesser-dark span.cm-error { color: #9d1e15; }
+
+.cm-s-lesser-dark .CodeMirror-activeline-background { background: #3C3A3A; }
+.cm-s-lesser-dark .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/liquibyte.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,95 @@
+.cm-s-liquibyte.CodeMirror {
+	background-color: #000;
+	color: #fff;
+	line-height: 1.2em;
+	font-size: 1em;
+}
+.cm-s-liquibyte .CodeMirror-focused .cm-matchhighlight {
+	text-decoration: underline;
+	text-decoration-color: #0f0;
+	text-decoration-style: wavy;
+}
+.cm-s-liquibyte .cm-trailingspace {
+	text-decoration: line-through;
+	text-decoration-color: #f00;
+	text-decoration-style: dotted;
+}
+.cm-s-liquibyte .cm-tab {
+	text-decoration: line-through;
+	text-decoration-color: #404040;
+	text-decoration-style: dotted;
+}
+.cm-s-liquibyte .CodeMirror-gutters { background-color: #262626; border-right: 1px solid #505050; padding-right: 0.8em; }
+.cm-s-liquibyte .CodeMirror-gutter-elt div { font-size: 1.2em; }
+.cm-s-liquibyte .CodeMirror-guttermarker {  }
+.cm-s-liquibyte .CodeMirror-guttermarker-subtle {  }
+.cm-s-liquibyte .CodeMirror-linenumber { color: #606060; padding-left: 0; }
+.cm-s-liquibyte .CodeMirror-cursor { border-left: 1px solid #eee; }
+
+.cm-s-liquibyte span.cm-comment     { color: #008000; }
+.cm-s-liquibyte span.cm-def         { color: #ffaf40; font-weight: bold; }
+.cm-s-liquibyte span.cm-keyword     { color: #c080ff; font-weight: bold; }
+.cm-s-liquibyte span.cm-builtin     { color: #ffaf40; font-weight: bold; }
+.cm-s-liquibyte span.cm-variable    { color: #5967ff; font-weight: bold; }
+.cm-s-liquibyte span.cm-string      { color: #ff8000; }
+.cm-s-liquibyte span.cm-number      { color: #0f0; font-weight: bold; }
+.cm-s-liquibyte span.cm-atom        { color: #bf3030; font-weight: bold; }
+
+.cm-s-liquibyte span.cm-variable-2  { color: #007f7f; font-weight: bold; }
+.cm-s-liquibyte span.cm-variable-3, .cm-s-liquibyte span.cm-type { color: #c080ff; font-weight: bold; }
+.cm-s-liquibyte span.cm-property    { color: #999; font-weight: bold; }
+.cm-s-liquibyte span.cm-operator    { color: #fff; }
+
+.cm-s-liquibyte span.cm-meta        { color: #0f0; }
+.cm-s-liquibyte span.cm-qualifier   { color: #fff700; font-weight: bold; }
+.cm-s-liquibyte span.cm-bracket     { color: #cc7; }
+.cm-s-liquibyte span.cm-tag         { color: #ff0; font-weight: bold; }
+.cm-s-liquibyte span.cm-attribute   { color: #c080ff; font-weight: bold; }
+.cm-s-liquibyte span.cm-error       { color: #f00; }
+
+.cm-s-liquibyte div.CodeMirror-selected { background-color: rgba(255, 0, 0, 0.25); }
+
+.cm-s-liquibyte span.cm-compilation { background-color: rgba(255, 255, 255, 0.12); }
+
+.cm-s-liquibyte .CodeMirror-activeline-background { background-color: rgba(0, 255, 0, 0.15); }
+
+/* Default styles for common addons */
+.cm-s-liquibyte .CodeMirror span.CodeMirror-matchingbracket { color: #0f0; font-weight: bold; }
+.cm-s-liquibyte .CodeMirror span.CodeMirror-nonmatchingbracket { color: #f00; font-weight: bold; }
+.CodeMirror-matchingtag { background-color: rgba(150, 255, 0, .3); }
+/* Scrollbars */
+/* Simple */
+.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div:hover, .cm-s-liquibyte div.CodeMirror-simplescroll-vertical div:hover {
+	background-color: rgba(80, 80, 80, .7);
+}
+.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div, .cm-s-liquibyte div.CodeMirror-simplescroll-vertical div {
+	background-color: rgba(80, 80, 80, .3);
+	border: 1px solid #404040;
+	border-radius: 5px;
+}
+.cm-s-liquibyte div.CodeMirror-simplescroll-vertical div {
+	border-top: 1px solid #404040;
+	border-bottom: 1px solid #404040;
+}
+.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal div {
+	border-left: 1px solid #404040;
+	border-right: 1px solid #404040;
+}
+.cm-s-liquibyte div.CodeMirror-simplescroll-vertical {
+	background-color: #262626;
+}
+.cm-s-liquibyte div.CodeMirror-simplescroll-horizontal {
+	background-color: #262626;
+	border-top: 1px solid #404040;
+}
+/* Overlay */
+.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div, div.CodeMirror-overlayscroll-vertical div {
+	background-color: #404040;
+	border-radius: 5px;
+}
+.cm-s-liquibyte div.CodeMirror-overlayscroll-vertical div {
+	border: 1px solid #404040;
+}
+.cm-s-liquibyte div.CodeMirror-overlayscroll-horizontal div {
+	border: 1px solid #404040;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/lucario.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,37 @@
+/*
+  Name:       lucario
+  Author:     Raphael Amorim
+
+  Original Lucario color scheme (https://github.com/raphamorim/lucario)
+*/
+
+.cm-s-lucario.CodeMirror, .cm-s-lucario .CodeMirror-gutters {
+  background-color: #2b3e50 !important;
+  color: #f8f8f2 !important;
+  border: none;
+}
+.cm-s-lucario .CodeMirror-gutters { color: #2b3e50; }
+.cm-s-lucario .CodeMirror-cursor { border-left: solid thin #E6C845; }
+.cm-s-lucario .CodeMirror-linenumber { color: #f8f8f2; }
+.cm-s-lucario .CodeMirror-selected { background: #243443; }
+.cm-s-lucario .CodeMirror-line::selection, .cm-s-lucario .CodeMirror-line > span::selection, .cm-s-lucario .CodeMirror-line > span > span::selection { background: #243443; }
+.cm-s-lucario .CodeMirror-line::-moz-selection, .cm-s-lucario .CodeMirror-line > span::-moz-selection, .cm-s-lucario .CodeMirror-line > span > span::-moz-selection { background: #243443; }
+.cm-s-lucario span.cm-comment { color: #5c98cd; }
+.cm-s-lucario span.cm-string, .cm-s-lucario span.cm-string-2 { color: #E6DB74; }
+.cm-s-lucario span.cm-number { color: #ca94ff; }
+.cm-s-lucario span.cm-variable { color: #f8f8f2; }
+.cm-s-lucario span.cm-variable-2 { color: #f8f8f2; }
+.cm-s-lucario span.cm-def { color: #72C05D; }
+.cm-s-lucario span.cm-operator { color: #66D9EF; }
+.cm-s-lucario span.cm-keyword { color: #ff6541; }
+.cm-s-lucario span.cm-atom { color: #bd93f9; }
+.cm-s-lucario span.cm-meta { color: #f8f8f2; }
+.cm-s-lucario span.cm-tag { color: #ff6541; }
+.cm-s-lucario span.cm-attribute { color: #66D9EF; }
+.cm-s-lucario span.cm-qualifier { color: #72C05D; }
+.cm-s-lucario span.cm-property { color: #f8f8f2; }
+.cm-s-lucario span.cm-builtin { color: #72C05D; }
+.cm-s-lucario span.cm-variable-3, .cm-s-lucario span.cm-type { color: #ffb86c; }
+
+.cm-s-lucario .CodeMirror-activeline-background { background: #243443; }
+.cm-s-lucario .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/material-darker.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,135 @@
+/*
+  Name:       material
+  Author:     Mattia Astorino (http://github.com/equinusocio)
+  Website:    https://material-theme.site/
+*/
+
+.cm-s-material-darker.CodeMirror {
+  background-color: #212121;
+  color: #EEFFFF;
+}
+
+.cm-s-material-darker .CodeMirror-gutters {
+  background: #212121;
+  color: #545454;
+  border: none;
+}
+
+.cm-s-material-darker .CodeMirror-guttermarker,
+.cm-s-material-darker .CodeMirror-guttermarker-subtle,
+.cm-s-material-darker .CodeMirror-linenumber {
+  color: #545454;
+}
+
+.cm-s-material-darker .CodeMirror-cursor {
+  border-left: 1px solid #FFCC00;
+}
+
+.cm-s-material-darker div.CodeMirror-selected {
+  background: rgba(97, 97, 97, 0.2);
+}
+
+.cm-s-material-darker.CodeMirror-focused div.CodeMirror-selected {
+  background: rgba(97, 97, 97, 0.2);
+}
+
+.cm-s-material-darker .CodeMirror-line::selection,
+.cm-s-material-darker .CodeMirror-line>span::selection,
+.cm-s-material-darker .CodeMirror-line>span>span::selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material-darker .CodeMirror-line::-moz-selection,
+.cm-s-material-darker .CodeMirror-line>span::-moz-selection,
+.cm-s-material-darker .CodeMirror-line>span>span::-moz-selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material-darker .CodeMirror-activeline-background {
+  background: rgba(0, 0, 0, 0.5);
+}
+
+.cm-s-material-darker .cm-keyword {
+  color: #C792EA;
+}
+
+.cm-s-material-darker .cm-operator {
+  color: #89DDFF;
+}
+
+.cm-s-material-darker .cm-variable-2 {
+  color: #EEFFFF;
+}
+
+.cm-s-material-darker .cm-variable-3,
+.cm-s-material-darker .cm-type {
+  color: #f07178;
+}
+
+.cm-s-material-darker .cm-builtin {
+  color: #FFCB6B;
+}
+
+.cm-s-material-darker .cm-atom {
+  color: #F78C6C;
+}
+
+.cm-s-material-darker .cm-number {
+  color: #FF5370;
+}
+
+.cm-s-material-darker .cm-def {
+  color: #82AAFF;
+}
+
+.cm-s-material-darker .cm-string {
+  color: #C3E88D;
+}
+
+.cm-s-material-darker .cm-string-2 {
+  color: #f07178;
+}
+
+.cm-s-material-darker .cm-comment {
+  color: #545454;
+}
+
+.cm-s-material-darker .cm-variable {
+  color: #f07178;
+}
+
+.cm-s-material-darker .cm-tag {
+  color: #FF5370;
+}
+
+.cm-s-material-darker .cm-meta {
+  color: #FFCB6B;
+}
+
+.cm-s-material-darker .cm-attribute {
+  color: #C792EA;
+}
+
+.cm-s-material-darker .cm-property {
+  color: #C792EA;
+}
+
+.cm-s-material-darker .cm-qualifier {
+  color: #DECB6B;
+}
+
+.cm-s-material-darker .cm-variable-3,
+.cm-s-material-darker .cm-type {
+  color: #DECB6B;
+}
+
+
+.cm-s-material-darker .cm-error {
+  color: rgba(255, 255, 255, 1.0);
+  background-color: #FF5370;
+}
+
+.cm-s-material-darker .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/material-ocean.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,141 @@
+/*
+  Name:       material
+  Author:     Mattia Astorino (http://github.com/equinusocio)
+  Website:    https://material-theme.site/
+*/
+
+.cm-s-material-ocean.CodeMirror {
+  background-color: #0F111A;
+  color: #8F93A2;
+}
+
+.cm-s-material-ocean .CodeMirror-gutters {
+  background: #0F111A;
+  color: #464B5D;
+  border: none;
+}
+
+.cm-s-material-ocean .CodeMirror-guttermarker,
+.cm-s-material-ocean .CodeMirror-guttermarker-subtle,
+.cm-s-material-ocean .CodeMirror-linenumber {
+  color: #464B5D;
+}
+
+.cm-s-material-ocean .CodeMirror-cursor {
+  border-left: 1px solid #FFCC00;
+}
+.cm-s-material-ocean.cm-fat-cursor .CodeMirror-cursor {
+  background-color: #a2a8a175 !important;
+}
+.cm-s-material-ocean .cm-animate-fat-cursor {
+  background-color: #a2a8a175 !important;
+}
+
+.cm-s-material-ocean div.CodeMirror-selected {
+  background: rgba(113, 124, 180, 0.2);
+}
+
+.cm-s-material-ocean.CodeMirror-focused div.CodeMirror-selected {
+  background: rgba(113, 124, 180, 0.2);
+}
+
+.cm-s-material-ocean .CodeMirror-line::selection,
+.cm-s-material-ocean .CodeMirror-line>span::selection,
+.cm-s-material-ocean .CodeMirror-line>span>span::selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material-ocean .CodeMirror-line::-moz-selection,
+.cm-s-material-ocean .CodeMirror-line>span::-moz-selection,
+.cm-s-material-ocean .CodeMirror-line>span>span::-moz-selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material-ocean .CodeMirror-activeline-background {
+  background: rgba(0, 0, 0, 0.5);
+}
+
+.cm-s-material-ocean .cm-keyword {
+  color: #C792EA;
+}
+
+.cm-s-material-ocean .cm-operator {
+  color: #89DDFF;
+}
+
+.cm-s-material-ocean .cm-variable-2 {
+  color: #EEFFFF;
+}
+
+.cm-s-material-ocean .cm-variable-3,
+.cm-s-material-ocean .cm-type {
+  color: #f07178;
+}
+
+.cm-s-material-ocean .cm-builtin {
+  color: #FFCB6B;
+}
+
+.cm-s-material-ocean .cm-atom {
+  color: #F78C6C;
+}
+
+.cm-s-material-ocean .cm-number {
+  color: #FF5370;
+}
+
+.cm-s-material-ocean .cm-def {
+  color: #82AAFF;
+}
+
+.cm-s-material-ocean .cm-string {
+  color: #C3E88D;
+}
+
+.cm-s-material-ocean .cm-string-2 {
+  color: #f07178;
+}
+
+.cm-s-material-ocean .cm-comment {
+  color: #464B5D;
+}
+
+.cm-s-material-ocean .cm-variable {
+  color: #f07178;
+}
+
+.cm-s-material-ocean .cm-tag {
+  color: #FF5370;
+}
+
+.cm-s-material-ocean .cm-meta {
+  color: #FFCB6B;
+}
+
+.cm-s-material-ocean .cm-attribute {
+  color: #C792EA;
+}
+
+.cm-s-material-ocean .cm-property {
+  color: #C792EA;
+}
+
+.cm-s-material-ocean .cm-qualifier {
+  color: #DECB6B;
+}
+
+.cm-s-material-ocean .cm-variable-3,
+.cm-s-material-ocean .cm-type {
+  color: #DECB6B;
+}
+
+
+.cm-s-material-ocean .cm-error {
+  color: rgba(255, 255, 255, 1.0);
+  background-color: #FF5370;
+}
+
+.cm-s-material-ocean .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/material-palenight.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,141 @@
+/*
+  Name:       material
+  Author:     Mattia Astorino (http://github.com/equinusocio)
+  Website:    https://material-theme.site/
+*/
+
+.cm-s-material-palenight.CodeMirror {
+  background-color: #292D3E;
+  color: #A6ACCD;
+}
+
+.cm-s-material-palenight .CodeMirror-gutters {
+  background: #292D3E;
+  color: #676E95;
+  border: none;
+}
+
+.cm-s-material-palenight .CodeMirror-guttermarker,
+.cm-s-material-palenight .CodeMirror-guttermarker-subtle,
+.cm-s-material-palenight .CodeMirror-linenumber {
+  color: #676E95;
+}
+
+.cm-s-material-palenight .CodeMirror-cursor {
+  border-left: 1px solid #FFCC00;
+}
+.cm-s-material-palenight.cm-fat-cursor .CodeMirror-cursor {
+  background-color: #607c8b80 !important;
+}
+.cm-s-material-palenight .cm-animate-fat-cursor {
+  background-color: #607c8b80 !important;
+}
+
+.cm-s-material-palenight div.CodeMirror-selected {
+  background: rgba(113, 124, 180, 0.2);
+}
+
+.cm-s-material-palenight.CodeMirror-focused div.CodeMirror-selected {
+  background: rgba(113, 124, 180, 0.2);
+}
+
+.cm-s-material-palenight .CodeMirror-line::selection,
+.cm-s-material-palenight .CodeMirror-line>span::selection,
+.cm-s-material-palenight .CodeMirror-line>span>span::selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material-palenight .CodeMirror-line::-moz-selection,
+.cm-s-material-palenight .CodeMirror-line>span::-moz-selection,
+.cm-s-material-palenight .CodeMirror-line>span>span::-moz-selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material-palenight .CodeMirror-activeline-background {
+  background: rgba(0, 0, 0, 0.5);
+}
+
+.cm-s-material-palenight .cm-keyword {
+  color: #C792EA;
+}
+
+.cm-s-material-palenight .cm-operator {
+  color: #89DDFF;
+}
+
+.cm-s-material-palenight .cm-variable-2 {
+  color: #EEFFFF;
+}
+
+.cm-s-material-palenight .cm-variable-3,
+.cm-s-material-palenight .cm-type {
+  color: #f07178;
+}
+
+.cm-s-material-palenight .cm-builtin {
+  color: #FFCB6B;
+}
+
+.cm-s-material-palenight .cm-atom {
+  color: #F78C6C;
+}
+
+.cm-s-material-palenight .cm-number {
+  color: #FF5370;
+}
+
+.cm-s-material-palenight .cm-def {
+  color: #82AAFF;
+}
+
+.cm-s-material-palenight .cm-string {
+  color: #C3E88D;
+}
+
+.cm-s-material-palenight .cm-string-2 {
+  color: #f07178;
+}
+
+.cm-s-material-palenight .cm-comment {
+  color: #676E95;
+}
+
+.cm-s-material-palenight .cm-variable {
+  color: #f07178;
+}
+
+.cm-s-material-palenight .cm-tag {
+  color: #FF5370;
+}
+
+.cm-s-material-palenight .cm-meta {
+  color: #FFCB6B;
+}
+
+.cm-s-material-palenight .cm-attribute {
+  color: #C792EA;
+}
+
+.cm-s-material-palenight .cm-property {
+  color: #C792EA;
+}
+
+.cm-s-material-palenight .cm-qualifier {
+  color: #DECB6B;
+}
+
+.cm-s-material-palenight .cm-variable-3,
+.cm-s-material-palenight .cm-type {
+  color: #DECB6B;
+}
+
+
+.cm-s-material-palenight .cm-error {
+  color: rgba(255, 255, 255, 1.0);
+  background-color: #FF5370;
+}
+
+.cm-s-material-palenight .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/material.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,141 @@
+/*
+  Name:       material
+  Author:     Mattia Astorino (http://github.com/equinusocio)
+  Website:    https://material-theme.site/
+*/
+
+.cm-s-material.CodeMirror {
+  background-color: #263238;
+  color: #EEFFFF;
+}
+
+.cm-s-material .CodeMirror-gutters {
+  background: #263238;
+  color: #546E7A;
+  border: none;
+}
+
+.cm-s-material .CodeMirror-guttermarker,
+.cm-s-material .CodeMirror-guttermarker-subtle,
+.cm-s-material .CodeMirror-linenumber {
+  color: #546E7A;
+}
+
+.cm-s-material .CodeMirror-cursor {
+  border-left: 1px solid #FFCC00;
+}
+.cm-s-material.cm-fat-cursor .CodeMirror-cursor {
+  background-color: #5d6d5c80 !important;
+}
+.cm-s-material .cm-animate-fat-cursor {
+  background-color: #5d6d5c80 !important;
+}
+
+.cm-s-material div.CodeMirror-selected {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material.CodeMirror-focused div.CodeMirror-selected {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material .CodeMirror-line::selection,
+.cm-s-material .CodeMirror-line>span::selection,
+.cm-s-material .CodeMirror-line>span>span::selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material .CodeMirror-line::-moz-selection,
+.cm-s-material .CodeMirror-line>span::-moz-selection,
+.cm-s-material .CodeMirror-line>span>span::-moz-selection {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-material .CodeMirror-activeline-background {
+  background: rgba(0, 0, 0, 0.5);
+}
+
+.cm-s-material .cm-keyword {
+  color: #C792EA;
+}
+
+.cm-s-material .cm-operator {
+  color: #89DDFF;
+}
+
+.cm-s-material .cm-variable-2 {
+  color: #EEFFFF;
+}
+
+.cm-s-material .cm-variable-3,
+.cm-s-material .cm-type {
+  color: #f07178;
+}
+
+.cm-s-material .cm-builtin {
+  color: #FFCB6B;
+}
+
+.cm-s-material .cm-atom {
+  color: #F78C6C;
+}
+
+.cm-s-material .cm-number {
+  color: #FF5370;
+}
+
+.cm-s-material .cm-def {
+  color: #82AAFF;
+}
+
+.cm-s-material .cm-string {
+  color: #C3E88D;
+}
+
+.cm-s-material .cm-string-2 {
+  color: #f07178;
+}
+
+.cm-s-material .cm-comment {
+  color: #546E7A;
+}
+
+.cm-s-material .cm-variable {
+  color: #f07178;
+}
+
+.cm-s-material .cm-tag {
+  color: #FF5370;
+}
+
+.cm-s-material .cm-meta {
+  color: #FFCB6B;
+}
+
+.cm-s-material .cm-attribute {
+  color: #C792EA;
+}
+
+.cm-s-material .cm-property {
+  color: #C792EA;
+}
+
+.cm-s-material .cm-qualifier {
+  color: #DECB6B;
+}
+
+.cm-s-material .cm-variable-3,
+.cm-s-material .cm-type {
+  color: #DECB6B;
+}
+
+
+.cm-s-material .cm-error {
+  color: rgba(255, 255, 255, 1.0);
+  background-color: #FF5370;
+}
+
+.cm-s-material .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/mbo.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,37 @@
+/****************************************************************/
+/*   Based on mbonaci's Brackets mbo theme                      */
+/*   https://github.com/mbonaci/global/blob/master/Mbo.tmTheme  */
+/*   Create your own: http://tmtheme-editor.herokuapp.com       */
+/****************************************************************/
+
+.cm-s-mbo.CodeMirror { background: #2c2c2c; color: #ffffec; }
+.cm-s-mbo div.CodeMirror-selected { background: #716C62; }
+.cm-s-mbo .CodeMirror-line::selection, .cm-s-mbo .CodeMirror-line > span::selection, .cm-s-mbo .CodeMirror-line > span > span::selection { background: rgba(113, 108, 98, .99); }
+.cm-s-mbo .CodeMirror-line::-moz-selection, .cm-s-mbo .CodeMirror-line > span::-moz-selection, .cm-s-mbo .CodeMirror-line > span > span::-moz-selection { background: rgba(113, 108, 98, .99); }
+.cm-s-mbo .CodeMirror-gutters { background: #4e4e4e; border-right: 0px; }
+.cm-s-mbo .CodeMirror-guttermarker { color: white; }
+.cm-s-mbo .CodeMirror-guttermarker-subtle { color: grey; }
+.cm-s-mbo .CodeMirror-linenumber { color: #dadada; }
+.cm-s-mbo .CodeMirror-cursor { border-left: 1px solid #ffffec; }
+
+.cm-s-mbo span.cm-comment { color: #95958a; }
+.cm-s-mbo span.cm-atom { color: #00a8c6; }
+.cm-s-mbo span.cm-number { color: #00a8c6; }
+
+.cm-s-mbo span.cm-property, .cm-s-mbo span.cm-attribute { color: #9ddfe9; }
+.cm-s-mbo span.cm-keyword { color: #ffb928; }
+.cm-s-mbo span.cm-string { color: #ffcf6c; }
+.cm-s-mbo span.cm-string.cm-property { color: #ffffec; }
+
+.cm-s-mbo span.cm-variable { color: #ffffec; }
+.cm-s-mbo span.cm-variable-2 { color: #00a8c6; }
+.cm-s-mbo span.cm-def { color: #ffffec; }
+.cm-s-mbo span.cm-bracket { color: #fffffc; font-weight: bold; }
+.cm-s-mbo span.cm-tag { color: #9ddfe9; }
+.cm-s-mbo span.cm-link { color: #f54b07; }
+.cm-s-mbo span.cm-error { border-bottom: #636363; color: #ffffec; }
+.cm-s-mbo span.cm-qualifier { color: #ffffec; }
+
+.cm-s-mbo .CodeMirror-activeline-background { background: #494b41; }
+.cm-s-mbo .CodeMirror-matchingbracket { color: #ffb928 !important; }
+.cm-s-mbo .CodeMirror-matchingtag { background: rgba(255, 255, 255, .37); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/mdn-like.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,46 @@
+/*
+  MDN-LIKE Theme - Mozilla
+  Ported to CodeMirror by Peter Kroon <plakroon@gmail.com>
+  Report bugs/issues here: https://github.com/codemirror/CodeMirror/issues
+  GitHub: @peterkroon
+
+  The mdn-like theme is inspired on the displayed code examples at: https://developer.mozilla.org/en-US/docs/Web/CSS/animation
+
+*/
+.cm-s-mdn-like.CodeMirror { color: #999; background-color: #fff; }
+.cm-s-mdn-like div.CodeMirror-selected { background: #cfc; }
+.cm-s-mdn-like .CodeMirror-line::selection, .cm-s-mdn-like .CodeMirror-line > span::selection, .cm-s-mdn-like .CodeMirror-line > span > span::selection { background: #cfc; }
+.cm-s-mdn-like .CodeMirror-line::-moz-selection, .cm-s-mdn-like .CodeMirror-line > span::-moz-selection, .cm-s-mdn-like .CodeMirror-line > span > span::-moz-selection { background: #cfc; }
+
+.cm-s-mdn-like .CodeMirror-gutters { background: #f8f8f8; border-left: 6px solid rgba(0,83,159,0.65); color: #333; }
+.cm-s-mdn-like .CodeMirror-linenumber { color: #aaa; padding-left: 8px; }
+.cm-s-mdn-like .CodeMirror-cursor { border-left: 2px solid #222; }
+
+.cm-s-mdn-like .cm-keyword { color: #6262FF; }
+.cm-s-mdn-like .cm-atom { color: #F90; }
+.cm-s-mdn-like .cm-number { color:  #ca7841; }
+.cm-s-mdn-like .cm-def { color: #8DA6CE; }
+.cm-s-mdn-like span.cm-variable-2, .cm-s-mdn-like span.cm-tag { color: #690; }
+.cm-s-mdn-like span.cm-variable-3, .cm-s-mdn-like span.cm-def, .cm-s-mdn-like span.cm-type { color: #07a; }
+
+.cm-s-mdn-like .cm-variable { color: #07a; }
+.cm-s-mdn-like .cm-property { color: #905; }
+.cm-s-mdn-like .cm-qualifier { color: #690; }
+
+.cm-s-mdn-like .cm-operator { color: #cda869; }
+.cm-s-mdn-like .cm-comment { color:#777; font-weight:normal; }
+.cm-s-mdn-like .cm-string { color:#07a; font-style:italic; }
+.cm-s-mdn-like .cm-string-2 { color:#bd6b18; } /*?*/
+.cm-s-mdn-like .cm-meta { color: #000; } /*?*/
+.cm-s-mdn-like .cm-builtin { color: #9B7536; } /*?*/
+.cm-s-mdn-like .cm-tag { color: #997643; }
+.cm-s-mdn-like .cm-attribute { color: #d6bb6d; } /*?*/
+.cm-s-mdn-like .cm-header { color: #FF6400; }
+.cm-s-mdn-like .cm-hr { color: #AEAEAE; }
+.cm-s-mdn-like .cm-link { color:#ad9361; font-style:italic; text-decoration:none; }
+.cm-s-mdn-like .cm-error { border-bottom: 1px solid red; }
+
+div.cm-s-mdn-like .CodeMirror-activeline-background { background: #efefff; }
+div.cm-s-mdn-like span.CodeMirror-matchingbracket { outline:1px solid grey; color: inherit; }
+
+.cm-s-mdn-like.CodeMirror { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFcAAAAyCAYAAAAp8UeFAAAHvklEQVR42s2b63bcNgyEQZCSHCdt2vd/0tWF7I+Q6XgMXiTtuvU5Pl57ZQKkKHzEAOtF5KeIJBGJ8uvL599FRFREZhFx8DeXv8trn68RuGaC8TRfo3SNp9dlDDHedyLyTUTeRWStXKPZrjtpZxaRw5hPqozRs1N8/enzIiQRWcCgy4MUA0f+XWliDhyL8Lfyvx7ei/Ae3iQFHyw7U/59pQVIMEEPEz0G7XiwdRjzSfC3UTtz9vchIntxvry5iMgfIhJoEflOz2CQr3F5h/HfeFe+GTdLaKcu9L8LTeQb/R/7GgbsfKedyNdoHsN31uRPWrfZ5wsj/NzzRQHuToIdU3ahwnsKPxXCjJITuOsi7XLc7SG/v5GdALs7wf8JjTFiB5+QvTEfRyGOfX3Lrx8wxyQi3sNq46O7QahQiCsRFgqddjBouVEHOKDgXAQHD9gJCr5sMKkEdjwsarG/ww3BMHBU7OBjXnzdyY7SfCxf5/z6ATccrwlKuwC/jhznnPF4CgVzhhVf4xp2EixcBActO75iZ8/fM9zAs2OMzKdslgXWJ9XG8PQoOAMA5fGcsvORgv0doBXyHrCwfLJAOwo71QLNkb8n2Pl6EWiR7OCibtkPaz4Kc/0NNAze2gju3zOwekALDaCFPI5vjPFmgGY5AZqyGEvH1x7QfIb8YtxMnA/b+QQ0aQDAwc6JMFg8CbQZ4qoYEEHbRwNojuK3EHwd7VALSgq+MNDKzfT58T8qdpADrgW0GmgcAS1lhzztJmkAzcPNOQbsWEALBDSlMKUG0Eq4CLAQWvEVQ9WU57gZJwZtgPO3r9oBTQ9WO8TjqXINx8R0EYpiZEUWOF3FxkbJkgU9B2f41YBrIj5ZfsQa0M5kTgiAAqM3ShXLgu8XMqcrQBvJ0CL5pnTsfMB13oB8athpAq2XOQmcGmoACCLydx7nToa23ATaSIY2ichfOdPTGxlasXMLaL0MLZAOwAKIM+y8CmicobGdCcbbK9DzN+yYGVoNNI5iUKTMyYOjPse4A8SM1MmcXgU0toOq1yO/v8FOxlASyc7TgeYaAMBJHcY1CcCwGI/TK4AmDbDyKYBBtFUkRwto8gygiQEaByFgJ00BH2M8JWwQS1nafDXQCidWyOI8AcjDCSjCLk8ngObuAm3JAHAdubAmOaK06V8MNEsKPJOhobSprwQa6gD7DclRQdqcwL4zxqgBrQcabUiBLclRDKAlWp+etPkBaNMA0AKlrHwTdEByZAA4GM+SNluSY6wAzcMNewxmgig5Ks0nkrSpBvSaQHMdKTBAnLojOdYyGpQ254602ZILPdTD1hdlggdIm74jbTp8vDwF5ZYUeLWGJpWsh6XNyXgcYwVoJQTEhhTYkxzZjiU5npU2TaB979TQehlaAVq4kaGpiPwwwLkYUuBbQwocyQTv1tA0+1UFWoJF3iv1oq+qoSk8EQdJmwHkziIF7oOZk14EGitibAdjLYYK78H5vZOhtWpoI0ATGHs0Q8OMb4Ey+2bU2UYztCtA0wFAs7TplGLRVQCcqaFdGSPCeTI1QNIC52iWNzof6Uib7xjEp07mNNoUYmVosVItHrHzRlLgBn9LFyRHaQCtVUMbtTNhoXWiTOO9k/V8BdAc1Oq0ArSQs6/5SU0hckNy9NnXqQY0PGYo5dWJ7nINaN6o958FWin27aBaWRka1r5myvLOAm0j30eBJqCxHLReVclxhxOEN2JfDWjxBtAC7MIH1fVaGdoOp4qJYDgKtKPSFNID2gSnGldrCqkFZ+5UeQXQBIRrSwocbdZYQT/2LwRahBPBXoHrB8nxaGROST62DKUbQOMMzZIC9abkuELfQzQALWTnDNAm8KHWFOJgJ5+SHIvTPcmx1xQyZRhNL5Qci689aXMEaN/uNIWkEwDAvFpOZmgsBaaGnbs1NPa1Jm32gBZAIh1pCtG7TSH4aE0y1uVY4uqoFPisGlpP2rSA5qTecWn5agK6BzSpgAyD+wFaqhnYoSZ1Vwr8CmlTQbrcO3ZaX0NAEyMbYaAlyquFoLKK3SPby9CeVUPThrSJmkCAE0CrKUQadi4DrdSlWhmah0YL9z9vClH59YGbHx1J8VZTyAjQepJjmXwAKTDQI3omc3p1U4gDUf6RfcdYfrUp5ClAi2J3Ba6UOXGo+K+bQrjjssitG2SJzshaLwMtXgRagUNpYYoVkMSBLM+9GGiJZMvduG6DRZ4qc04DMPtQQxOjEtACmhO7K1AbNbQDEggZyJwscFpAGwENhoBeUwh3bWolhe8BTYVKxQEWrSUn/uhcM5KhvUu/+eQu0Lzhi+VrK0PrZZNDQKs9cpYUuFYgMVpD4/NxenJTiMCNqdUEUf1qZWjppLT5qSkkUZbCwkbZMSuVnu80hfSkzRbQeqCZSAh6huR4VtoM2gHAlLf72smuWgE+VV7XpE25Ab2WFDgyhnSuKbs4GuGzCjR+tIoUuMFg3kgcWKLTwRqanJQ2W00hAsenfaApRC42hbCvK1SlE0HtE9BGgneJO+ELamitD1YjjOYnNYVcraGhtKkW0EqVVeDx733I2NH581k1NNxNLG0i0IJ8/NjVaOZ0tYZ2Vtr0Xv7tPV3hkWp9EFkgS/J0vosngTaSoaG06WHi+xObQkaAdlbanP8B2+2l0f90LmUAAAAASUVORK5CYII=); }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/midnight.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,39 @@
+/* Based on the theme at http://bonsaiden.github.com/JavaScript-Garden */
+
+/*<!--activeline-->*/
+.cm-s-midnight .CodeMirror-activeline-background { background: #253540; }
+
+.cm-s-midnight.CodeMirror {
+    background: #0F192A;
+    color: #D1EDFF;
+}
+
+.cm-s-midnight div.CodeMirror-selected { background: #314D67; }
+.cm-s-midnight .CodeMirror-line::selection, .cm-s-midnight .CodeMirror-line > span::selection, .cm-s-midnight .CodeMirror-line > span > span::selection { background: rgba(49, 77, 103, .99); }
+.cm-s-midnight .CodeMirror-line::-moz-selection, .cm-s-midnight .CodeMirror-line > span::-moz-selection, .cm-s-midnight .CodeMirror-line > span > span::-moz-selection { background: rgba(49, 77, 103, .99); }
+.cm-s-midnight .CodeMirror-gutters { background: #0F192A; border-right: 1px solid; }
+.cm-s-midnight .CodeMirror-guttermarker { color: white; }
+.cm-s-midnight .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-midnight .CodeMirror-linenumber { color: #D0D0D0; }
+.cm-s-midnight .CodeMirror-cursor { border-left: 1px solid #F8F8F0; }
+
+.cm-s-midnight span.cm-comment { color: #428BDD; }
+.cm-s-midnight span.cm-atom { color: #AE81FF; }
+.cm-s-midnight span.cm-number { color: #D1EDFF; }
+
+.cm-s-midnight span.cm-property, .cm-s-midnight span.cm-attribute { color: #A6E22E; }
+.cm-s-midnight span.cm-keyword { color: #E83737; }
+.cm-s-midnight span.cm-string { color: #1DC116; }
+
+.cm-s-midnight span.cm-variable { color: #FFAA3E; }
+.cm-s-midnight span.cm-variable-2 { color: #FFAA3E; }
+.cm-s-midnight span.cm-def { color: #4DD; }
+.cm-s-midnight span.cm-bracket { color: #D1EDFF; }
+.cm-s-midnight span.cm-tag { color: #449; }
+.cm-s-midnight span.cm-link { color: #AE81FF; }
+.cm-s-midnight span.cm-error { background: #F92672; color: #F8F8F0; }
+
+.cm-s-midnight .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/monokai.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,41 @@
+/* Based on Sublime Text's Monokai theme */
+
+.cm-s-monokai.CodeMirror { background: #272822; color: #f8f8f2; }
+.cm-s-monokai div.CodeMirror-selected { background: #49483E; }
+.cm-s-monokai .CodeMirror-line::selection, .cm-s-monokai .CodeMirror-line > span::selection, .cm-s-monokai .CodeMirror-line > span > span::selection { background: rgba(73, 72, 62, .99); }
+.cm-s-monokai .CodeMirror-line::-moz-selection, .cm-s-monokai .CodeMirror-line > span::-moz-selection, .cm-s-monokai .CodeMirror-line > span > span::-moz-selection { background: rgba(73, 72, 62, .99); }
+.cm-s-monokai .CodeMirror-gutters { background: #272822; border-right: 0px; }
+.cm-s-monokai .CodeMirror-guttermarker { color: white; }
+.cm-s-monokai .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-monokai .CodeMirror-linenumber { color: #d0d0d0; }
+.cm-s-monokai .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
+
+.cm-s-monokai span.cm-comment { color: #75715e; }
+.cm-s-monokai span.cm-atom { color: #ae81ff; }
+.cm-s-monokai span.cm-number { color: #ae81ff; }
+
+.cm-s-monokai span.cm-comment.cm-attribute { color: #97b757; }
+.cm-s-monokai span.cm-comment.cm-def { color: #bc9262; }
+.cm-s-monokai span.cm-comment.cm-tag { color: #bc6283; }
+.cm-s-monokai span.cm-comment.cm-type { color: #5998a6; }
+
+.cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute { color: #a6e22e; }
+.cm-s-monokai span.cm-keyword { color: #f92672; }
+.cm-s-monokai span.cm-builtin { color: #66d9ef; }
+.cm-s-monokai span.cm-string { color: #e6db74; }
+
+.cm-s-monokai span.cm-variable { color: #f8f8f2; }
+.cm-s-monokai span.cm-variable-2 { color: #9effff; }
+.cm-s-monokai span.cm-variable-3, .cm-s-monokai span.cm-type { color: #66d9ef; }
+.cm-s-monokai span.cm-def { color: #fd971f; }
+.cm-s-monokai span.cm-bracket { color: #f8f8f2; }
+.cm-s-monokai span.cm-tag { color: #f92672; }
+.cm-s-monokai span.cm-header { color: #ae81ff; }
+.cm-s-monokai span.cm-link { color: #ae81ff; }
+.cm-s-monokai span.cm-error { background: #f92672; color: #f8f8f0; }
+
+.cm-s-monokai .CodeMirror-activeline-background { background: #373831; }
+.cm-s-monokai .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/moxer.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,143 @@
+/*
+  Name:       Moxer Theme
+  Author:     Mattia Astorino (http://github.com/equinusocio)
+  Website:    https://github.com/moxer-theme/moxer-code
+*/
+
+.cm-s-moxer.CodeMirror {
+  background-color: #090A0F;
+  color: #8E95B4;
+  line-height: 1.8;
+}
+
+.cm-s-moxer .CodeMirror-gutters {
+  background: #090A0F;
+  color: #35394B;
+  border: none;
+}
+
+.cm-s-moxer .CodeMirror-guttermarker,
+.cm-s-moxer .CodeMirror-guttermarker-subtle,
+.cm-s-moxer .CodeMirror-linenumber {
+  color: #35394B;
+}
+
+
+.cm-s-moxer .CodeMirror-cursor {
+  border-left: 1px solid #FFCC00;
+}
+
+.cm-s-moxer div.CodeMirror-selected {
+  background: rgba(128, 203, 196, 0.2);
+}
+
+.cm-s-moxer.CodeMirror-focused div.CodeMirror-selected {
+  background: #212431;
+}
+
+.cm-s-moxer .CodeMirror-line::selection,
+.cm-s-moxer .CodeMirror-line>span::selection,
+.cm-s-moxer .CodeMirror-line>span>span::selection {
+  background: #212431;
+}
+
+.cm-s-moxer .CodeMirror-line::-moz-selection,
+.cm-s-moxer .CodeMirror-line>span::-moz-selection,
+.cm-s-moxer .CodeMirror-line>span>span::-moz-selection {
+  background: #212431;
+}
+
+.cm-s-moxer .CodeMirror-activeline-background,
+.cm-s-moxer .CodeMirror-activeline-gutter .CodeMirror-linenumber {
+  background: rgba(33, 36, 49, 0.5);
+}
+
+.cm-s-moxer .cm-keyword {
+  color: #D46C6C;
+}
+
+.cm-s-moxer .cm-operator {
+  color: #D46C6C;
+}
+
+.cm-s-moxer .cm-variable-2 {
+  color: #81C5DA;
+}
+
+
+.cm-s-moxer .cm-variable-3,
+.cm-s-moxer .cm-type {
+  color: #f07178;
+}
+
+.cm-s-moxer .cm-builtin {
+  color: #FFCB6B;
+}
+
+.cm-s-moxer .cm-atom {
+  color: #A99BE2;
+}
+
+.cm-s-moxer .cm-number {
+  color: #7CA4C0;
+}
+
+.cm-s-moxer .cm-def {
+  color: #F5DFA5;
+}
+
+.cm-s-moxer .CodeMirror-line .cm-def ~ .cm-def {
+  color: #81C5DA;
+}
+
+.cm-s-moxer .cm-string {
+  color: #B2E4AE;
+}
+
+.cm-s-moxer .cm-string-2 {
+  color: #f07178;
+}
+
+.cm-s-moxer .cm-comment {
+  color: #3F445A;
+}
+
+.cm-s-moxer .cm-variable {
+  color: #8E95B4;
+}
+
+.cm-s-moxer .cm-tag {
+  color: #FF5370;
+}
+
+.cm-s-moxer .cm-meta {
+  color: #FFCB6B;
+}
+
+.cm-s-moxer .cm-attribute {
+  color: #C792EA;
+}
+
+.cm-s-moxer .cm-property {
+  color: #81C5DA;
+}
+
+.cm-s-moxer .cm-qualifier {
+  color: #DECB6B;
+}
+
+.cm-s-moxer .cm-variable-3,
+.cm-s-moxer .cm-type {
+  color: #DECB6B;
+}
+
+
+.cm-s-moxer .cm-error {
+  color: rgba(255, 255, 255, 1.0);
+  background-color: #FF5370;
+}
+
+.cm-s-moxer .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/neat.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,12 @@
+.cm-s-neat span.cm-comment { color: #a86; }
+.cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; }
+.cm-s-neat span.cm-string { color: #a22; }
+.cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; }
+.cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; }
+.cm-s-neat span.cm-variable { color: black; }
+.cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
+.cm-s-neat span.cm-meta { color: #555; }
+.cm-s-neat span.cm-link { color: #3a3; }
+
+.cm-s-neat .CodeMirror-activeline-background { background: #e8f2ff; }
+.cm-s-neat .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/neo.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,43 @@
+/* neo theme for codemirror */
+
+/* Color scheme */
+
+.cm-s-neo.CodeMirror {
+  background-color:#ffffff;
+  color:#2e383c;
+  line-height:1.4375;
+}
+.cm-s-neo .cm-comment { color:#75787b; }
+.cm-s-neo .cm-keyword, .cm-s-neo .cm-property { color:#1d75b3; }
+.cm-s-neo .cm-atom,.cm-s-neo .cm-number { color:#75438a; }
+.cm-s-neo .cm-node,.cm-s-neo .cm-tag { color:#9c3328; }
+.cm-s-neo .cm-string { color:#b35e14; }
+.cm-s-neo .cm-variable,.cm-s-neo .cm-qualifier { color:#047d65; }
+
+
+/* Editor styling */
+
+.cm-s-neo pre {
+  padding:0;
+}
+
+.cm-s-neo .CodeMirror-gutters {
+  border:none;
+  border-right:10px solid transparent;
+  background-color:transparent;
+}
+
+.cm-s-neo .CodeMirror-linenumber {
+  padding:0;
+  color:#e0e2e5;
+}
+
+.cm-s-neo .CodeMirror-guttermarker { color: #1d75b3; }
+.cm-s-neo .CodeMirror-guttermarker-subtle { color: #e0e2e5; }
+
+.cm-s-neo .CodeMirror-cursor {
+  width: auto;
+  border: 0;
+  background: rgba(155,157,162,0.37);
+  z-index: 1;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/night.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,27 @@
+/* Loosely based on the Midnight Textmate theme */
+
+.cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; }
+.cm-s-night div.CodeMirror-selected { background: #447; }
+.cm-s-night .CodeMirror-line::selection, .cm-s-night .CodeMirror-line > span::selection, .cm-s-night .CodeMirror-line > span > span::selection { background: rgba(68, 68, 119, .99); }
+.cm-s-night .CodeMirror-line::-moz-selection, .cm-s-night .CodeMirror-line > span::-moz-selection, .cm-s-night .CodeMirror-line > span > span::-moz-selection { background: rgba(68, 68, 119, .99); }
+.cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
+.cm-s-night .CodeMirror-guttermarker { color: white; }
+.cm-s-night .CodeMirror-guttermarker-subtle { color: #bbb; }
+.cm-s-night .CodeMirror-linenumber { color: #f8f8f8; }
+.cm-s-night .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-night span.cm-comment { color: #8900d1; }
+.cm-s-night span.cm-atom { color: #845dc4; }
+.cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
+.cm-s-night span.cm-keyword { color: #599eff; }
+.cm-s-night span.cm-string { color: #37f14a; }
+.cm-s-night span.cm-meta { color: #7678e2; }
+.cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
+.cm-s-night span.cm-variable-3, .cm-s-night span.cm-def, .cm-s-night span.cm-type { color: white; }
+.cm-s-night span.cm-bracket { color: #8da6ce; }
+.cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
+.cm-s-night span.cm-link { color: #845dc4; }
+.cm-s-night span.cm-error { color: #9d1e15; }
+
+.cm-s-night .CodeMirror-activeline-background { background: #1C005A; }
+.cm-s-night .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/nord.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,42 @@
+/* Based on arcticicestudio's Nord theme */
+/* https://github.com/arcticicestudio/nord */
+
+.cm-s-nord.CodeMirror { background: #2e3440; color: #d8dee9; }
+.cm-s-nord div.CodeMirror-selected { background: #434c5e; }
+.cm-s-nord .CodeMirror-line::selection, .cm-s-nord .CodeMirror-line > span::selection, .cm-s-nord .CodeMirror-line > span > span::selection { background: #3b4252; }
+.cm-s-nord .CodeMirror-line::-moz-selection, .cm-s-nord .CodeMirror-line > span::-moz-selection, .cm-s-nord .CodeMirror-line > span > span::-moz-selection { background: #3b4252; }
+.cm-s-nord .CodeMirror-gutters { background: #2e3440; border-right: 0px; }
+.cm-s-nord .CodeMirror-guttermarker { color: #4c566a; }
+.cm-s-nord .CodeMirror-guttermarker-subtle { color: #4c566a; }
+.cm-s-nord .CodeMirror-linenumber { color: #4c566a; }
+.cm-s-nord .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
+
+.cm-s-nord span.cm-comment { color: #4c566a; }
+.cm-s-nord span.cm-atom { color: #b48ead; }
+.cm-s-nord span.cm-number { color: #b48ead; }
+
+.cm-s-nord span.cm-comment.cm-attribute { color: #97b757; }
+.cm-s-nord span.cm-comment.cm-def { color: #bc9262; }
+.cm-s-nord span.cm-comment.cm-tag { color: #bc6283; }
+.cm-s-nord span.cm-comment.cm-type { color: #5998a6; }
+
+.cm-s-nord span.cm-property, .cm-s-nord span.cm-attribute { color: #8FBCBB; }
+.cm-s-nord span.cm-keyword { color: #81A1C1; }
+.cm-s-nord span.cm-builtin { color: #81A1C1; }
+.cm-s-nord span.cm-string { color: #A3BE8C; }
+
+.cm-s-nord span.cm-variable { color: #d8dee9; }
+.cm-s-nord span.cm-variable-2 { color: #d8dee9; }
+.cm-s-nord span.cm-variable-3, .cm-s-nord span.cm-type { color: #d8dee9; }
+.cm-s-nord span.cm-def { color: #8FBCBB; }
+.cm-s-nord span.cm-bracket { color: #81A1C1; }
+.cm-s-nord span.cm-tag { color: #bf616a; }
+.cm-s-nord span.cm-header { color: #b48ead; }
+.cm-s-nord span.cm-link { color: #b48ead; }
+.cm-s-nord span.cm-error { background: #bf616a; color: #f8f8f0; }
+
+.cm-s-nord .CodeMirror-activeline-background { background: #3b4252; }
+.cm-s-nord .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/oceanic-next.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,46 @@
+/*
+
+    Name:       oceanic-next
+    Author:     Filype Pereira (https://github.com/fpereira1)
+
+    Original oceanic-next color scheme by Dmitri Voronianski (https://github.com/voronianski/oceanic-next-color-scheme)
+
+*/
+
+.cm-s-oceanic-next.CodeMirror { background: #304148; color: #f8f8f2; }
+.cm-s-oceanic-next div.CodeMirror-selected { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-line::selection, .cm-s-oceanic-next .CodeMirror-line > span::selection, .cm-s-oceanic-next .CodeMirror-line > span > span::selection { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-line::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span::-moz-selection, .cm-s-oceanic-next .CodeMirror-line > span > span::-moz-selection { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-gutters { background: #304148; border-right: 10px; }
+.cm-s-oceanic-next .CodeMirror-guttermarker { color: white; }
+.cm-s-oceanic-next .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-oceanic-next .CodeMirror-linenumber { color: #d0d0d0; }
+.cm-s-oceanic-next .CodeMirror-cursor { border-left: 1px solid #f8f8f0; }
+.cm-s-oceanic-next.cm-fat-cursor .CodeMirror-cursor { background-color: #a2a8a175 !important; }
+.cm-s-oceanic-next .cm-animate-fat-cursor { background-color: #a2a8a175 !important; }
+
+.cm-s-oceanic-next span.cm-comment { color: #65737E; }
+.cm-s-oceanic-next span.cm-atom { color: #C594C5; }
+.cm-s-oceanic-next span.cm-number { color: #F99157; }
+
+.cm-s-oceanic-next span.cm-property { color: #99C794; }
+.cm-s-oceanic-next span.cm-attribute,
+.cm-s-oceanic-next span.cm-keyword { color: #C594C5; }
+.cm-s-oceanic-next span.cm-builtin { color: #66d9ef; }
+.cm-s-oceanic-next span.cm-string { color: #99C794; }
+
+.cm-s-oceanic-next span.cm-variable,
+.cm-s-oceanic-next span.cm-variable-2,
+.cm-s-oceanic-next span.cm-variable-3 { color: #f8f8f2; }
+.cm-s-oceanic-next span.cm-def { color: #6699CC; }
+.cm-s-oceanic-next span.cm-bracket { color: #5FB3B3; }
+.cm-s-oceanic-next span.cm-tag { color: #C594C5; }
+.cm-s-oceanic-next span.cm-header { color: #C594C5; }
+.cm-s-oceanic-next span.cm-link { color: #C594C5; }
+.cm-s-oceanic-next span.cm-error { background: #C594C5; color: #f8f8f0; }
+
+.cm-s-oceanic-next .CodeMirror-activeline-background { background: rgba(101, 115, 126, 0.33); }
+.cm-s-oceanic-next .CodeMirror-matchingbracket {
+  text-decoration: underline;
+  color: white !important;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/panda-syntax.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,85 @@
+/*
+	Name:       Panda Syntax
+	Author:     Siamak Mokhtari (http://github.com/siamak/)
+	CodeMirror template by Siamak Mokhtari (https://github.com/siamak/atom-panda-syntax)
+*/
+.cm-s-panda-syntax {
+	background: #292A2B;
+	color: #E6E6E6;
+	line-height: 1.5;
+	font-family: 'Operator Mono', 'Source Code Pro', Menlo, Monaco, Consolas, Courier New, monospace;
+}
+.cm-s-panda-syntax .CodeMirror-cursor { border-color: #ff2c6d; }
+.cm-s-panda-syntax .CodeMirror-activeline-background {
+	background: rgba(99, 123, 156, 0.1);
+}
+.cm-s-panda-syntax .CodeMirror-selected {
+	background: #FFF;
+}
+.cm-s-panda-syntax .cm-comment {
+	font-style: italic;
+	color: #676B79;
+}
+.cm-s-panda-syntax .cm-operator {
+	color: #f3f3f3;
+}
+.cm-s-panda-syntax .cm-string {
+	color: #19F9D8;
+}
+.cm-s-panda-syntax .cm-string-2 {
+    color: #FFB86C;
+}
+
+.cm-s-panda-syntax .cm-tag {
+	color: #ff2c6d;
+}
+.cm-s-panda-syntax .cm-meta {
+	color: #b084eb;
+}
+
+.cm-s-panda-syntax .cm-number {
+	color: #FFB86C;
+}
+.cm-s-panda-syntax .cm-atom {
+	color: #ff2c6d;
+}
+.cm-s-panda-syntax .cm-keyword {
+	color: #FF75B5;
+}
+.cm-s-panda-syntax .cm-variable {
+	color: #ffb86c;
+}
+.cm-s-panda-syntax .cm-variable-2 {
+	color: #ff9ac1;
+}
+.cm-s-panda-syntax .cm-variable-3, .cm-s-panda-syntax .cm-type {
+	color: #ff9ac1;
+}
+
+.cm-s-panda-syntax .cm-def {
+	color: #e6e6e6;
+}
+.cm-s-panda-syntax .cm-property {
+	color: #f3f3f3;
+}
+.cm-s-panda-syntax .cm-unit {
+    color: #ffb86c;
+}
+
+.cm-s-panda-syntax .cm-attribute {
+    color: #ffb86c;
+}
+
+.cm-s-panda-syntax .CodeMirror-matchingbracket {
+    border-bottom: 1px dotted #19F9D8;
+    padding-bottom: 2px;
+    color: #e6e6e6;
+}
+.cm-s-panda-syntax .CodeMirror-gutters {
+    background: #292a2b;
+    border-right-color: rgba(255, 255, 255, 0.1);
+}
+.cm-s-panda-syntax .CodeMirror-linenumber {
+    color: #e6e6e6;
+    opacity: 0.6;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/paraiso-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,38 @@
+/*
+
+    Name:       Paraíso (Dark)
+    Author:     Jan T. Sott
+
+    Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
+    Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
+
+*/
+
+.cm-s-paraiso-dark.CodeMirror { background: #2f1e2e; color: #b9b6b0; }
+.cm-s-paraiso-dark div.CodeMirror-selected { background: #41323f; }
+.cm-s-paraiso-dark .CodeMirror-line::selection, .cm-s-paraiso-dark .CodeMirror-line > span::selection, .cm-s-paraiso-dark .CodeMirror-line > span > span::selection { background: rgba(65, 50, 63, .99); }
+.cm-s-paraiso-dark .CodeMirror-line::-moz-selection, .cm-s-paraiso-dark .CodeMirror-line > span::-moz-selection, .cm-s-paraiso-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(65, 50, 63, .99); }
+.cm-s-paraiso-dark .CodeMirror-gutters { background: #2f1e2e; border-right: 0px; }
+.cm-s-paraiso-dark .CodeMirror-guttermarker { color: #ef6155; }
+.cm-s-paraiso-dark .CodeMirror-guttermarker-subtle { color: #776e71; }
+.cm-s-paraiso-dark .CodeMirror-linenumber { color: #776e71; }
+.cm-s-paraiso-dark .CodeMirror-cursor { border-left: 1px solid #8d8687; }
+
+.cm-s-paraiso-dark span.cm-comment { color: #e96ba8; }
+.cm-s-paraiso-dark span.cm-atom { color: #815ba4; }
+.cm-s-paraiso-dark span.cm-number { color: #815ba4; }
+
+.cm-s-paraiso-dark span.cm-property, .cm-s-paraiso-dark span.cm-attribute { color: #48b685; }
+.cm-s-paraiso-dark span.cm-keyword { color: #ef6155; }
+.cm-s-paraiso-dark span.cm-string { color: #fec418; }
+
+.cm-s-paraiso-dark span.cm-variable { color: #48b685; }
+.cm-s-paraiso-dark span.cm-variable-2 { color: #06b6ef; }
+.cm-s-paraiso-dark span.cm-def { color: #f99b15; }
+.cm-s-paraiso-dark span.cm-bracket { color: #b9b6b0; }
+.cm-s-paraiso-dark span.cm-tag { color: #ef6155; }
+.cm-s-paraiso-dark span.cm-link { color: #815ba4; }
+.cm-s-paraiso-dark span.cm-error { background: #ef6155; color: #8d8687; }
+
+.cm-s-paraiso-dark .CodeMirror-activeline-background { background: #4D344A; }
+.cm-s-paraiso-dark .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/paraiso-light.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,38 @@
+/*
+
+    Name:       Paraíso (Light)
+    Author:     Jan T. Sott
+
+    Color scheme by Jan T. Sott (https://github.com/idleberg/Paraiso-CodeMirror)
+    Inspired by the art of Rubens LP (http://www.rubenslp.com.br)
+
+*/
+
+.cm-s-paraiso-light.CodeMirror { background: #e7e9db; color: #41323f; }
+.cm-s-paraiso-light div.CodeMirror-selected { background: #b9b6b0; }
+.cm-s-paraiso-light .CodeMirror-line::selection, .cm-s-paraiso-light .CodeMirror-line > span::selection, .cm-s-paraiso-light .CodeMirror-line > span > span::selection { background: #b9b6b0; }
+.cm-s-paraiso-light .CodeMirror-line::-moz-selection, .cm-s-paraiso-light .CodeMirror-line > span::-moz-selection, .cm-s-paraiso-light .CodeMirror-line > span > span::-moz-selection { background: #b9b6b0; }
+.cm-s-paraiso-light .CodeMirror-gutters { background: #e7e9db; border-right: 0px; }
+.cm-s-paraiso-light .CodeMirror-guttermarker { color: black; }
+.cm-s-paraiso-light .CodeMirror-guttermarker-subtle { color: #8d8687; }
+.cm-s-paraiso-light .CodeMirror-linenumber { color: #8d8687; }
+.cm-s-paraiso-light .CodeMirror-cursor { border-left: 1px solid #776e71; }
+
+.cm-s-paraiso-light span.cm-comment { color: #e96ba8; }
+.cm-s-paraiso-light span.cm-atom { color: #815ba4; }
+.cm-s-paraiso-light span.cm-number { color: #815ba4; }
+
+.cm-s-paraiso-light span.cm-property, .cm-s-paraiso-light span.cm-attribute { color: #48b685; }
+.cm-s-paraiso-light span.cm-keyword { color: #ef6155; }
+.cm-s-paraiso-light span.cm-string { color: #fec418; }
+
+.cm-s-paraiso-light span.cm-variable { color: #48b685; }
+.cm-s-paraiso-light span.cm-variable-2 { color: #06b6ef; }
+.cm-s-paraiso-light span.cm-def { color: #f99b15; }
+.cm-s-paraiso-light span.cm-bracket { color: #41323f; }
+.cm-s-paraiso-light span.cm-tag { color: #ef6155; }
+.cm-s-paraiso-light span.cm-link { color: #815ba4; }
+.cm-s-paraiso-light span.cm-error { background: #ef6155; color: #776e71; }
+
+.cm-s-paraiso-light .CodeMirror-activeline-background { background: #CFD1C4; }
+.cm-s-paraiso-light .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/pastel-on-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+/**
+ * Pastel On Dark theme ported from ACE editor
+ * @license MIT
+ * @copyright AtomicPages LLC 2014
+ * @author Dennis Thompson, AtomicPages LLC
+ * @version 1.1
+ * @source https://github.com/atomicpages/codemirror-pastel-on-dark-theme
+ */
+
+.cm-s-pastel-on-dark.CodeMirror {
+	background: #2c2827;
+	color: #8F938F;
+	line-height: 1.5;
+}
+.cm-s-pastel-on-dark div.CodeMirror-selected { background: rgba(221,240,255,0.2); }
+.cm-s-pastel-on-dark .CodeMirror-line::selection, .cm-s-pastel-on-dark .CodeMirror-line > span::selection, .cm-s-pastel-on-dark .CodeMirror-line > span > span::selection { background: rgba(221,240,255,0.2); }
+.cm-s-pastel-on-dark .CodeMirror-line::-moz-selection, .cm-s-pastel-on-dark .CodeMirror-line > span::-moz-selection, .cm-s-pastel-on-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(221,240,255,0.2); }
+
+.cm-s-pastel-on-dark .CodeMirror-gutters {
+	background: #34302f;
+	border-right: 0px;
+	padding: 0 3px;
+}
+.cm-s-pastel-on-dark .CodeMirror-guttermarker { color: white; }
+.cm-s-pastel-on-dark .CodeMirror-guttermarker-subtle { color: #8F938F; }
+.cm-s-pastel-on-dark .CodeMirror-linenumber { color: #8F938F; }
+.cm-s-pastel-on-dark .CodeMirror-cursor { border-left: 1px solid #A7A7A7; }
+.cm-s-pastel-on-dark span.cm-comment { color: #A6C6FF; }
+.cm-s-pastel-on-dark span.cm-atom { color: #DE8E30; }
+.cm-s-pastel-on-dark span.cm-number { color: #CCCCCC; }
+.cm-s-pastel-on-dark span.cm-property { color: #8F938F; }
+.cm-s-pastel-on-dark span.cm-attribute { color: #a6e22e; }
+.cm-s-pastel-on-dark span.cm-keyword { color: #AEB2F8; }
+.cm-s-pastel-on-dark span.cm-string { color: #66A968; }
+.cm-s-pastel-on-dark span.cm-variable { color: #AEB2F8; }
+.cm-s-pastel-on-dark span.cm-variable-2 { color: #BEBF55; }
+.cm-s-pastel-on-dark span.cm-variable-3, .cm-s-pastel-on-dark span.cm-type { color: #DE8E30; }
+.cm-s-pastel-on-dark span.cm-def { color: #757aD8; }
+.cm-s-pastel-on-dark span.cm-bracket { color: #f8f8f2; }
+.cm-s-pastel-on-dark span.cm-tag { color: #C1C144; }
+.cm-s-pastel-on-dark span.cm-link { color: #ae81ff; }
+.cm-s-pastel-on-dark span.cm-qualifier,.cm-s-pastel-on-dark span.cm-builtin { color: #C1C144; }
+.cm-s-pastel-on-dark span.cm-error {
+	background: #757aD8;
+	color: #f8f8f0;
+}
+.cm-s-pastel-on-dark .CodeMirror-activeline-background { background: rgba(255, 255, 255, 0.031); }
+.cm-s-pastel-on-dark .CodeMirror-matchingbracket {
+	border: 1px solid rgba(255,255,255,0.25);
+	color: #8F938F !important;
+	margin: -1px -1px 0 -1px;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/railscasts.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+/*
+
+    Name:       Railscasts
+    Author:     Ryan Bates (http://railscasts.com)
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-railscasts.CodeMirror {background: #2b2b2b; color: #f4f1ed;}
+.cm-s-railscasts div.CodeMirror-selected {background: #272935 !important;}
+.cm-s-railscasts .CodeMirror-gutters {background: #2b2b2b; border-right: 0px;}
+.cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;}
+.cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;}
+
+.cm-s-railscasts span.cm-comment {color: #bc9458;}
+.cm-s-railscasts span.cm-atom {color: #b6b3eb;}
+.cm-s-railscasts span.cm-number {color: #b6b3eb;}
+
+.cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;}
+.cm-s-railscasts span.cm-keyword {color: #da4939;}
+.cm-s-railscasts span.cm-string {color: #ffc66d;}
+
+.cm-s-railscasts span.cm-variable {color: #a5c261;}
+.cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;}
+.cm-s-railscasts span.cm-def {color: #cc7833;}
+.cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;}
+.cm-s-railscasts span.cm-bracket {color: #f4f1ed;}
+.cm-s-railscasts span.cm-tag {color: #da4939;}
+.cm-s-railscasts span.cm-link {color: #b6b3eb;}
+
+.cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;}
+.cm-s-railscasts .CodeMirror-activeline-background { background: #303040; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/rubyblue.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,25 @@
+.cm-s-rubyblue.CodeMirror { background: #112435; color: white; }
+.cm-s-rubyblue div.CodeMirror-selected { background: #38566F; }
+.cm-s-rubyblue .CodeMirror-line::selection, .cm-s-rubyblue .CodeMirror-line > span::selection, .cm-s-rubyblue .CodeMirror-line > span > span::selection { background: rgba(56, 86, 111, 0.99); }
+.cm-s-rubyblue .CodeMirror-line::-moz-selection, .cm-s-rubyblue .CodeMirror-line > span::-moz-selection, .cm-s-rubyblue .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 86, 111, 0.99); }
+.cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; }
+.cm-s-rubyblue .CodeMirror-guttermarker { color: white; }
+.cm-s-rubyblue .CodeMirror-guttermarker-subtle { color: #3E7087; }
+.cm-s-rubyblue .CodeMirror-linenumber { color: white; }
+.cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; }
+.cm-s-rubyblue span.cm-atom { color: #F4C20B; }
+.cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; }
+.cm-s-rubyblue span.cm-keyword { color: #F0F; }
+.cm-s-rubyblue span.cm-string { color: #F08047; }
+.cm-s-rubyblue span.cm-meta { color: #F0F; }
+.cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; }
+.cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def, .cm-s-rubyblue span.cm-type { color: white; }
+.cm-s-rubyblue span.cm-bracket { color: #F0F; }
+.cm-s-rubyblue span.cm-link { color: #F4C20B; }
+.cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; }
+.cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; }
+.cm-s-rubyblue span.cm-error { color: #AF2018; }
+
+.cm-s-rubyblue .CodeMirror-activeline-background { background: #173047; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/seti.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+/*
+
+    Name:       seti
+    Author:     Michael Kaminsky (http://github.com/mkaminsky11)
+
+    Original seti color scheme by Jesse Weed (https://github.com/jesseweed/seti-syntax)
+
+*/
+
+
+.cm-s-seti.CodeMirror {
+  background-color: #151718 !important;
+  color: #CFD2D1 !important;
+  border: none;
+}
+.cm-s-seti .CodeMirror-gutters {
+  color: #404b53;
+  background-color: #0E1112;
+  border: none;
+}
+.cm-s-seti .CodeMirror-cursor { border-left: solid thin #f8f8f0; }
+.cm-s-seti .CodeMirror-linenumber { color: #6D8A88; }
+.cm-s-seti.CodeMirror-focused div.CodeMirror-selected { background: rgba(255, 255, 255, 0.10); }
+.cm-s-seti .CodeMirror-line::selection, .cm-s-seti .CodeMirror-line > span::selection, .cm-s-seti .CodeMirror-line > span > span::selection { background: rgba(255, 255, 255, 0.10); }
+.cm-s-seti .CodeMirror-line::-moz-selection, .cm-s-seti .CodeMirror-line > span::-moz-selection, .cm-s-seti .CodeMirror-line > span > span::-moz-selection { background: rgba(255, 255, 255, 0.10); }
+.cm-s-seti span.cm-comment { color: #41535b; }
+.cm-s-seti span.cm-string, .cm-s-seti span.cm-string-2 { color: #55b5db; }
+.cm-s-seti span.cm-number { color: #cd3f45; }
+.cm-s-seti span.cm-variable { color: #55b5db; }
+.cm-s-seti span.cm-variable-2 { color: #a074c4; }
+.cm-s-seti span.cm-def { color: #55b5db; }
+.cm-s-seti span.cm-keyword { color: #ff79c6; }
+.cm-s-seti span.cm-operator { color: #9fca56; }
+.cm-s-seti span.cm-keyword { color: #e6cd69; }
+.cm-s-seti span.cm-atom { color: #cd3f45; }
+.cm-s-seti span.cm-meta { color: #55b5db; }
+.cm-s-seti span.cm-tag { color: #55b5db; }
+.cm-s-seti span.cm-attribute { color: #9fca56; }
+.cm-s-seti span.cm-qualifier { color: #9fca56; }
+.cm-s-seti span.cm-property { color: #a074c4; }
+.cm-s-seti span.cm-variable-3, .cm-s-seti span.cm-type { color: #9fca56; }
+.cm-s-seti span.cm-builtin { color: #9fca56; }
+.cm-s-seti .CodeMirror-activeline-background { background: #101213; }
+.cm-s-seti .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/shadowfox.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,52 @@
+/*
+
+    Name:       shadowfox
+    Author:     overdodactyl (http://github.com/overdodactyl)
+
+    Original shadowfox color scheme by Firefox
+
+*/
+
+.cm-s-shadowfox.CodeMirror { background: #2a2a2e; color: #b1b1b3; }
+.cm-s-shadowfox div.CodeMirror-selected { background: #353B48; }
+.cm-s-shadowfox .CodeMirror-line::selection, .cm-s-shadowfox .CodeMirror-line > span::selection, .cm-s-shadowfox .CodeMirror-line > span > span::selection { background: #353B48; }
+.cm-s-shadowfox .CodeMirror-line::-moz-selection, .cm-s-shadowfox .CodeMirror-line > span::-moz-selection, .cm-s-shadowfox .CodeMirror-line > span > span::-moz-selection { background: #353B48; }
+.cm-s-shadowfox .CodeMirror-gutters { background: #0c0c0d ; border-right: 1px solid #0c0c0d; }
+.cm-s-shadowfox .CodeMirror-guttermarker { color: #555; }
+.cm-s-shadowfox .CodeMirror-linenumber { color: #939393; }
+.cm-s-shadowfox .CodeMirror-cursor { border-left: 1px solid #fff; }
+
+.cm-s-shadowfox span.cm-comment { color: #939393; }
+.cm-s-shadowfox span.cm-atom { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-quote { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-builtin { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-attribute { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-keyword { color: #FF7DE9; }
+.cm-s-shadowfox span.cm-error { color: #FF7DE9; }
+
+.cm-s-shadowfox span.cm-number { color: #6B89FF; }
+.cm-s-shadowfox span.cm-string { color: #6B89FF; }
+.cm-s-shadowfox span.cm-string-2 { color: #6B89FF; }
+
+.cm-s-shadowfox span.cm-meta { color: #939393; }
+.cm-s-shadowfox span.cm-hr { color: #939393; }
+
+.cm-s-shadowfox span.cm-header { color: #75BFFF; }
+.cm-s-shadowfox span.cm-qualifier { color: #75BFFF; }
+.cm-s-shadowfox span.cm-variable-2 { color: #75BFFF; }
+
+.cm-s-shadowfox span.cm-property { color: #86DE74; }
+
+.cm-s-shadowfox span.cm-def { color: #75BFFF; }
+.cm-s-shadowfox span.cm-bracket { color: #75BFFF; }
+.cm-s-shadowfox span.cm-tag { color: #75BFFF; }
+.cm-s-shadowfox span.cm-link:visited { color: #75BFFF; }
+
+.cm-s-shadowfox span.cm-variable { color: #B98EFF; }
+.cm-s-shadowfox span.cm-variable-3 { color: #d7d7db; }
+.cm-s-shadowfox span.cm-link { color: #737373; }
+.cm-s-shadowfox span.cm-operator { color: #b1b1b3; }
+.cm-s-shadowfox span.cm-special { color: #d7d7db; }
+
+.cm-s-shadowfox .CodeMirror-activeline-background { background: rgba(185, 215, 253, .15) }
+.cm-s-shadowfox .CodeMirror-matchingbracket { outline: solid 1px rgba(255, 255, 255, .25); color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/solarized.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,165 @@
+/*
+Solarized theme for code-mirror
+http://ethanschoonover.com/solarized
+*/
+
+/*
+Solarized color palette
+http://ethanschoonover.com/solarized/img/solarized-palette.png
+*/
+
+.solarized.base03 { color: #002b36; }
+.solarized.base02 { color: #073642; }
+.solarized.base01 { color: #586e75; }
+.solarized.base00 { color: #657b83; }
+.solarized.base0 { color: #839496; }
+.solarized.base1 { color: #93a1a1; }
+.solarized.base2 { color: #eee8d5; }
+.solarized.base3  { color: #fdf6e3; }
+.solarized.solar-yellow  { color: #b58900; }
+.solarized.solar-orange  { color: #cb4b16; }
+.solarized.solar-red { color: #dc322f; }
+.solarized.solar-magenta { color: #d33682; }
+.solarized.solar-violet  { color: #6c71c4; }
+.solarized.solar-blue { color: #268bd2; }
+.solarized.solar-cyan { color: #2aa198; }
+.solarized.solar-green { color: #859900; }
+
+/* Color scheme for code-mirror */
+
+.cm-s-solarized {
+  line-height: 1.45em;
+  color-profile: sRGB;
+  rendering-intent: auto;
+}
+.cm-s-solarized.cm-s-dark {
+  color: #839496;
+  background-color: #002b36;
+}
+.cm-s-solarized.cm-s-light {
+  background-color: #fdf6e3;
+  color: #657b83;
+}
+
+.cm-s-solarized .CodeMirror-widget {
+  text-shadow: none;
+}
+
+.cm-s-solarized .cm-header { color: #586e75; }
+.cm-s-solarized .cm-quote { color: #93a1a1; }
+
+.cm-s-solarized .cm-keyword { color: #cb4b16; }
+.cm-s-solarized .cm-atom { color: #d33682; }
+.cm-s-solarized .cm-number { color: #d33682; }
+.cm-s-solarized .cm-def { color: #2aa198; }
+
+.cm-s-solarized .cm-variable { color: #839496; }
+.cm-s-solarized .cm-variable-2 { color: #b58900; }
+.cm-s-solarized .cm-variable-3, .cm-s-solarized .cm-type { color: #6c71c4; }
+
+.cm-s-solarized .cm-property { color: #2aa198; }
+.cm-s-solarized .cm-operator { color: #6c71c4; }
+
+.cm-s-solarized .cm-comment { color: #586e75; font-style:italic; }
+
+.cm-s-solarized .cm-string { color: #859900; }
+.cm-s-solarized .cm-string-2 { color: #b58900; }
+
+.cm-s-solarized .cm-meta { color: #859900; }
+.cm-s-solarized .cm-qualifier { color: #b58900; }
+.cm-s-solarized .cm-builtin { color: #d33682; }
+.cm-s-solarized .cm-bracket { color: #cb4b16; }
+.cm-s-solarized .CodeMirror-matchingbracket { color: #859900; }
+.cm-s-solarized .CodeMirror-nonmatchingbracket { color: #dc322f; }
+.cm-s-solarized .cm-tag { color: #93a1a1; }
+.cm-s-solarized .cm-attribute { color: #2aa198; }
+.cm-s-solarized .cm-hr {
+  color: transparent;
+  border-top: 1px solid #586e75;
+  display: block;
+}
+.cm-s-solarized .cm-link { color: #93a1a1; cursor: pointer; }
+.cm-s-solarized .cm-special { color: #6c71c4; }
+.cm-s-solarized .cm-em {
+  color: #999;
+  text-decoration: underline;
+  text-decoration-style: dotted;
+}
+.cm-s-solarized .cm-error,
+.cm-s-solarized .cm-invalidchar {
+  color: #586e75;
+  border-bottom: 1px dotted #dc322f;
+}
+
+.cm-s-solarized.cm-s-dark div.CodeMirror-selected { background: #073642; }
+.cm-s-solarized.cm-s-dark.CodeMirror ::selection { background: rgba(7, 54, 66, 0.99); }
+.cm-s-solarized.cm-s-dark .CodeMirror-line::-moz-selection, .cm-s-dark .CodeMirror-line > span::-moz-selection, .cm-s-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(7, 54, 66, 0.99); }
+
+.cm-s-solarized.cm-s-light div.CodeMirror-selected { background: #eee8d5; }
+.cm-s-solarized.cm-s-light .CodeMirror-line::selection, .cm-s-light .CodeMirror-line > span::selection, .cm-s-light .CodeMirror-line > span > span::selection { background: #eee8d5; }
+.cm-s-solarized.cm-s-light .CodeMirror-line::-moz-selection, .cm-s-light .CodeMirror-line > span::-moz-selection, .cm-s-light .CodeMirror-line > span > span::-moz-selection { background: #eee8d5; }
+
+/* Editor styling */
+
+
+
+/* Little shadow on the view-port of the buffer view */
+.cm-s-solarized.CodeMirror {
+  -moz-box-shadow: inset 7px 0 12px -6px #000;
+  -webkit-box-shadow: inset 7px 0 12px -6px #000;
+  box-shadow: inset 7px 0 12px -6px #000;
+}
+
+/* Remove gutter border */
+.cm-s-solarized .CodeMirror-gutters {
+  border-right: 0;
+}
+
+/* Gutter colors and line number styling based of color scheme (dark / light) */
+
+/* Dark */
+.cm-s-solarized.cm-s-dark .CodeMirror-gutters {
+  background-color: #073642;
+}
+
+.cm-s-solarized.cm-s-dark .CodeMirror-linenumber {
+  color: #586e75;
+}
+
+/* Light */
+.cm-s-solarized.cm-s-light .CodeMirror-gutters {
+  background-color: #eee8d5;
+}
+
+.cm-s-solarized.cm-s-light .CodeMirror-linenumber {
+  color: #839496;
+}
+
+/* Common */
+.cm-s-solarized .CodeMirror-linenumber {
+  padding: 0 5px;
+}
+.cm-s-solarized .CodeMirror-guttermarker-subtle { color: #586e75; }
+.cm-s-solarized.cm-s-dark .CodeMirror-guttermarker { color: #ddd; }
+.cm-s-solarized.cm-s-light .CodeMirror-guttermarker { color: #cb4b16; }
+
+.cm-s-solarized .CodeMirror-gutter .CodeMirror-gutter-text {
+  color: #586e75;
+}
+
+/* Cursor */
+.cm-s-solarized .CodeMirror-cursor { border-left: 1px solid #819090; }
+
+/* Fat cursor */
+.cm-s-solarized.cm-s-light.cm-fat-cursor .CodeMirror-cursor { background: #77ee77; }
+.cm-s-solarized.cm-s-light .cm-animate-fat-cursor { background-color: #77ee77; }
+.cm-s-solarized.cm-s-dark.cm-fat-cursor .CodeMirror-cursor { background: #586e75; }
+.cm-s-solarized.cm-s-dark .cm-animate-fat-cursor { background-color: #586e75; }
+
+/* Active line */
+.cm-s-solarized.cm-s-dark .CodeMirror-activeline-background {
+  background: rgba(255, 255, 255, 0.06);
+}
+.cm-s-solarized.cm-s-light .CodeMirror-activeline-background {
+  background: rgba(0, 0, 0, 0.06);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/ssms.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,16 @@
+.cm-s-ssms span.cm-keyword { color: blue; }
+.cm-s-ssms span.cm-comment { color: darkgreen; }
+.cm-s-ssms span.cm-string { color: red; }
+.cm-s-ssms span.cm-def { color: black; }
+.cm-s-ssms span.cm-variable { color: black; }
+.cm-s-ssms span.cm-variable-2 { color: black; }
+.cm-s-ssms span.cm-atom { color: darkgray; }
+.cm-s-ssms .CodeMirror-linenumber { color: teal; }
+.cm-s-ssms .CodeMirror-activeline-background { background: #ffffff; }
+.cm-s-ssms span.cm-string-2 { color: #FF00FF; }
+.cm-s-ssms span.cm-operator, 
+.cm-s-ssms span.cm-bracket, 
+.cm-s-ssms span.cm-punctuation { color: darkgray; }
+.cm-s-ssms .CodeMirror-gutters { border-right: 3px solid #ffee62; background-color: #ffffff; }
+.cm-s-ssms div.CodeMirror-selected { background: #ADD6FF; }
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/the-matrix.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,30 @@
+.cm-s-the-matrix.CodeMirror { background: #000000; color: #00FF00; }
+.cm-s-the-matrix div.CodeMirror-selected { background: #2D2D2D; }
+.cm-s-the-matrix .CodeMirror-line::selection, .cm-s-the-matrix .CodeMirror-line > span::selection, .cm-s-the-matrix .CodeMirror-line > span > span::selection { background: rgba(45, 45, 45, 0.99); }
+.cm-s-the-matrix .CodeMirror-line::-moz-selection, .cm-s-the-matrix .CodeMirror-line > span::-moz-selection, .cm-s-the-matrix .CodeMirror-line > span > span::-moz-selection { background: rgba(45, 45, 45, 0.99); }
+.cm-s-the-matrix .CodeMirror-gutters { background: #060; border-right: 2px solid #00FF00; }
+.cm-s-the-matrix .CodeMirror-guttermarker { color: #0f0; }
+.cm-s-the-matrix .CodeMirror-guttermarker-subtle { color: white; }
+.cm-s-the-matrix .CodeMirror-linenumber { color: #FFFFFF; }
+.cm-s-the-matrix .CodeMirror-cursor { border-left: 1px solid #00FF00; }
+
+.cm-s-the-matrix span.cm-keyword { color: #008803; font-weight: bold; }
+.cm-s-the-matrix span.cm-atom { color: #3FF; }
+.cm-s-the-matrix span.cm-number { color: #FFB94F; }
+.cm-s-the-matrix span.cm-def { color: #99C; }
+.cm-s-the-matrix span.cm-variable { color: #F6C; }
+.cm-s-the-matrix span.cm-variable-2 { color: #C6F; }
+.cm-s-the-matrix span.cm-variable-3, .cm-s-the-matrix span.cm-type { color: #96F; }
+.cm-s-the-matrix span.cm-property { color: #62FFA0; }
+.cm-s-the-matrix span.cm-operator { color: #999; }
+.cm-s-the-matrix span.cm-comment { color: #CCCCCC; }
+.cm-s-the-matrix span.cm-string { color: #39C; }
+.cm-s-the-matrix span.cm-meta { color: #C9F; }
+.cm-s-the-matrix span.cm-qualifier { color: #FFF700; }
+.cm-s-the-matrix span.cm-builtin { color: #30a; }
+.cm-s-the-matrix span.cm-bracket { color: #cc7; }
+.cm-s-the-matrix span.cm-tag { color: #FFBD40; }
+.cm-s-the-matrix span.cm-attribute { color: #FFF700; }
+.cm-s-the-matrix span.cm-error { color: #FF0000; }
+
+.cm-s-the-matrix .CodeMirror-activeline-background { background: #040; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/tomorrow-night-bright.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,35 @@
+/*
+
+    Name:       Tomorrow Night - Bright
+    Author:     Chris Kempson
+
+    Port done by Gerard Braad <me@gbraad.nl>
+
+*/
+
+.cm-s-tomorrow-night-bright.CodeMirror { background: #000000; color: #eaeaea; }
+.cm-s-tomorrow-night-bright div.CodeMirror-selected { background: #424242; }
+.cm-s-tomorrow-night-bright .CodeMirror-gutters { background: #000000; border-right: 0px; }
+.cm-s-tomorrow-night-bright .CodeMirror-guttermarker { color: #e78c45; }
+.cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { color: #777; }
+.cm-s-tomorrow-night-bright .CodeMirror-linenumber { color: #424242; }
+.cm-s-tomorrow-night-bright .CodeMirror-cursor { border-left: 1px solid #6A6A6A; }
+
+.cm-s-tomorrow-night-bright span.cm-comment { color: #d27b53; }
+.cm-s-tomorrow-night-bright span.cm-atom { color: #a16a94; }
+.cm-s-tomorrow-night-bright span.cm-number { color: #a16a94; }
+
+.cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute { color: #99cc99; }
+.cm-s-tomorrow-night-bright span.cm-keyword { color: #d54e53; }
+.cm-s-tomorrow-night-bright span.cm-string { color: #e7c547; }
+
+.cm-s-tomorrow-night-bright span.cm-variable { color: #b9ca4a; }
+.cm-s-tomorrow-night-bright span.cm-variable-2 { color: #7aa6da; }
+.cm-s-tomorrow-night-bright span.cm-def { color: #e78c45; }
+.cm-s-tomorrow-night-bright span.cm-bracket { color: #eaeaea; }
+.cm-s-tomorrow-night-bright span.cm-tag { color: #d54e53; }
+.cm-s-tomorrow-night-bright span.cm-link { color: #a16a94; }
+.cm-s-tomorrow-night-bright span.cm-error { background: #d54e53; color: #6A6A6A; }
+
+.cm-s-tomorrow-night-bright .CodeMirror-activeline-background { background: #2a2a2a; }
+.cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/tomorrow-night-eighties.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,38 @@
+/*
+
+    Name:       Tomorrow Night - Eighties
+    Author:     Chris Kempson
+
+    CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror)
+    Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16)
+
+*/
+
+.cm-s-tomorrow-night-eighties.CodeMirror { background: #000000; color: #CCCCCC; }
+.cm-s-tomorrow-night-eighties div.CodeMirror-selected { background: #2D2D2D; }
+.cm-s-tomorrow-night-eighties .CodeMirror-line::selection, .cm-s-tomorrow-night-eighties .CodeMirror-line > span::selection, .cm-s-tomorrow-night-eighties .CodeMirror-line > span > span::selection { background: rgba(45, 45, 45, 0.99); }
+.cm-s-tomorrow-night-eighties .CodeMirror-line::-moz-selection, .cm-s-tomorrow-night-eighties .CodeMirror-line > span::-moz-selection, .cm-s-tomorrow-night-eighties .CodeMirror-line > span > span::-moz-selection { background: rgba(45, 45, 45, 0.99); }
+.cm-s-tomorrow-night-eighties .CodeMirror-gutters { background: #000000; border-right: 0px; }
+.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker { color: #f2777a; }
+.cm-s-tomorrow-night-eighties .CodeMirror-guttermarker-subtle { color: #777; }
+.cm-s-tomorrow-night-eighties .CodeMirror-linenumber { color: #515151; }
+.cm-s-tomorrow-night-eighties .CodeMirror-cursor { border-left: 1px solid #6A6A6A; }
+
+.cm-s-tomorrow-night-eighties span.cm-comment { color: #d27b53; }
+.cm-s-tomorrow-night-eighties span.cm-atom { color: #a16a94; }
+.cm-s-tomorrow-night-eighties span.cm-number { color: #a16a94; }
+
+.cm-s-tomorrow-night-eighties span.cm-property, .cm-s-tomorrow-night-eighties span.cm-attribute { color: #99cc99; }
+.cm-s-tomorrow-night-eighties span.cm-keyword { color: #f2777a; }
+.cm-s-tomorrow-night-eighties span.cm-string { color: #ffcc66; }
+
+.cm-s-tomorrow-night-eighties span.cm-variable { color: #99cc99; }
+.cm-s-tomorrow-night-eighties span.cm-variable-2 { color: #6699cc; }
+.cm-s-tomorrow-night-eighties span.cm-def { color: #f99157; }
+.cm-s-tomorrow-night-eighties span.cm-bracket { color: #CCCCCC; }
+.cm-s-tomorrow-night-eighties span.cm-tag { color: #f2777a; }
+.cm-s-tomorrow-night-eighties span.cm-link { color: #a16a94; }
+.cm-s-tomorrow-night-eighties span.cm-error { background: #f2777a; color: #6A6A6A; }
+
+.cm-s-tomorrow-night-eighties .CodeMirror-activeline-background { background: #343600; }
+.cm-s-tomorrow-night-eighties .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/ttcn.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,64 @@
+.cm-s-ttcn .cm-quote { color: #090; }
+.cm-s-ttcn .cm-negative { color: #d44; }
+.cm-s-ttcn .cm-positive { color: #292; }
+.cm-s-ttcn .cm-header, .cm-strong { font-weight: bold; }
+.cm-s-ttcn .cm-em { font-style: italic; }
+.cm-s-ttcn .cm-link { text-decoration: underline; }
+.cm-s-ttcn .cm-strikethrough { text-decoration: line-through; }
+.cm-s-ttcn .cm-header { color: #00f; font-weight: bold; }
+
+.cm-s-ttcn .cm-atom { color: #219; }
+.cm-s-ttcn .cm-attribute { color: #00c; }
+.cm-s-ttcn .cm-bracket { color: #997; }
+.cm-s-ttcn .cm-comment { color: #333333; }
+.cm-s-ttcn .cm-def { color: #00f; }
+.cm-s-ttcn .cm-em { font-style: italic; }
+.cm-s-ttcn .cm-error { color: #f00; }
+.cm-s-ttcn .cm-hr { color: #999; }
+.cm-s-ttcn .cm-invalidchar { color: #f00; }
+.cm-s-ttcn .cm-keyword { font-weight:bold; }
+.cm-s-ttcn .cm-link { color: #00c; text-decoration: underline; }
+.cm-s-ttcn .cm-meta { color: #555; }
+.cm-s-ttcn .cm-negative { color: #d44; }
+.cm-s-ttcn .cm-positive { color: #292; }
+.cm-s-ttcn .cm-qualifier { color: #555; }
+.cm-s-ttcn .cm-strikethrough { text-decoration: line-through; }
+.cm-s-ttcn .cm-string { color: #006400; }
+.cm-s-ttcn .cm-string-2 { color: #f50; }
+.cm-s-ttcn .cm-strong { font-weight: bold; }
+.cm-s-ttcn .cm-tag { color: #170; }
+.cm-s-ttcn .cm-variable { color: #8B2252; }
+.cm-s-ttcn .cm-variable-2 { color: #05a; }
+.cm-s-ttcn .cm-variable-3, .cm-s-ttcn .cm-type { color: #085; }
+
+.cm-s-ttcn .cm-invalidchar { color: #f00; }
+
+/* ASN */
+.cm-s-ttcn .cm-accessTypes,
+.cm-s-ttcn .cm-compareTypes { color: #27408B; }
+.cm-s-ttcn .cm-cmipVerbs { color: #8B2252; }
+.cm-s-ttcn .cm-modifier { color:#D2691E; }
+.cm-s-ttcn .cm-status { color:#8B4545; }
+.cm-s-ttcn .cm-storage { color:#A020F0; }
+.cm-s-ttcn .cm-tags { color:#006400; }
+
+/* CFG */
+.cm-s-ttcn .cm-externalCommands { color: #8B4545; font-weight:bold; }
+.cm-s-ttcn .cm-fileNCtrlMaskOptions,
+.cm-s-ttcn .cm-sectionTitle { color: #2E8B57; font-weight:bold; }
+
+/* TTCN */
+.cm-s-ttcn .cm-booleanConsts,
+.cm-s-ttcn .cm-otherConsts,
+.cm-s-ttcn .cm-verdictConsts { color: #006400; }
+.cm-s-ttcn .cm-configOps,
+.cm-s-ttcn .cm-functionOps,
+.cm-s-ttcn .cm-portOps,
+.cm-s-ttcn .cm-sutOps,
+.cm-s-ttcn .cm-timerOps,
+.cm-s-ttcn .cm-verdictOps { color: #0000FF; }
+.cm-s-ttcn .cm-preprocessor,
+.cm-s-ttcn .cm-templateMatch,
+.cm-s-ttcn .cm-ttcn3Macros { color: #27408B; }
+.cm-s-ttcn .cm-types { color: #A52A2A; font-weight:bold; }
+.cm-s-ttcn .cm-visibilityModifiers { font-weight:bold; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/twilight.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,32 @@
+.cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/
+.cm-s-twilight div.CodeMirror-selected { background: #323232; } /**/
+.cm-s-twilight .CodeMirror-line::selection, .cm-s-twilight .CodeMirror-line > span::selection, .cm-s-twilight .CodeMirror-line > span > span::selection { background: rgba(50, 50, 50, 0.99); }
+.cm-s-twilight .CodeMirror-line::-moz-selection, .cm-s-twilight .CodeMirror-line > span::-moz-selection, .cm-s-twilight .CodeMirror-line > span > span::-moz-selection { background: rgba(50, 50, 50, 0.99); }
+
+.cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; }
+.cm-s-twilight .CodeMirror-guttermarker { color: white; }
+.cm-s-twilight .CodeMirror-guttermarker-subtle { color: #aaa; }
+.cm-s-twilight .CodeMirror-linenumber { color: #aaa; }
+.cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-twilight .cm-keyword { color: #f9ee98; } /**/
+.cm-s-twilight .cm-atom { color: #FC0; }
+.cm-s-twilight .cm-number { color:  #ca7841; } /**/
+.cm-s-twilight .cm-def { color: #8DA6CE; }
+.cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/
+.cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def, .cm-s-twilight span.cm-type { color: #607392; } /**/
+.cm-s-twilight .cm-operator { color: #cda869; } /**/
+.cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/
+.cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/
+.cm-s-twilight .cm-string-2 { color:#bd6b18; } /*?*/
+.cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/
+.cm-s-twilight .cm-builtin { color: #cda869; } /*?*/
+.cm-s-twilight .cm-tag { color: #997643; } /**/
+.cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/
+.cm-s-twilight .cm-header { color: #FF6400; }
+.cm-s-twilight .cm-hr { color: #AEAEAE; }
+.cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/
+.cm-s-twilight .cm-error { border-bottom: 1px solid red; }
+
+.cm-s-twilight .CodeMirror-activeline-background { background: #27282E; }
+.cm-s-twilight .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/vibrant-ink.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+/* Taken from the popular Visual Studio Vibrant Ink Schema */
+
+.cm-s-vibrant-ink.CodeMirror { background: black; color: white; }
+.cm-s-vibrant-ink div.CodeMirror-selected { background: #35493c; }
+.cm-s-vibrant-ink .CodeMirror-line::selection, .cm-s-vibrant-ink .CodeMirror-line > span::selection, .cm-s-vibrant-ink .CodeMirror-line > span > span::selection { background: rgba(53, 73, 60, 0.99); }
+.cm-s-vibrant-ink .CodeMirror-line::-moz-selection, .cm-s-vibrant-ink .CodeMirror-line > span::-moz-selection, .cm-s-vibrant-ink .CodeMirror-line > span > span::-moz-selection { background: rgba(53, 73, 60, 0.99); }
+
+.cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; }
+.cm-s-vibrant-ink .CodeMirror-guttermarker { color: white; }
+.cm-s-vibrant-ink .CodeMirror-guttermarker-subtle { color: #d0d0d0; }
+.cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; }
+.cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-vibrant-ink .cm-keyword { color: #CC7832; }
+.cm-s-vibrant-ink .cm-atom { color: #FC0; }
+.cm-s-vibrant-ink .cm-number { color:  #FFEE98; }
+.cm-s-vibrant-ink .cm-def { color: #8DA6CE; }
+.cm-s-vibrant-ink span.cm-variable-2, .cm-s-vibrant span.cm-tag { color: #FFC66D; }
+.cm-s-vibrant-ink span.cm-variable-3, .cm-s-vibrant span.cm-def, .cm-s-vibrant span.cm-type { color: #FFC66D; }
+.cm-s-vibrant-ink .cm-operator { color: #888; }
+.cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; }
+.cm-s-vibrant-ink .cm-string { color:  #A5C25C; }
+.cm-s-vibrant-ink .cm-string-2 { color: red; }
+.cm-s-vibrant-ink .cm-meta { color: #D8FA3C; }
+.cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; }
+.cm-s-vibrant-ink .cm-tag { color: #8DA6CE; }
+.cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; }
+.cm-s-vibrant-ink .cm-header { color: #FF6400; }
+.cm-s-vibrant-ink .cm-hr { color: #AEAEAE; }
+.cm-s-vibrant-ink .cm-link { color: #5656F3; }
+.cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; }
+
+.cm-s-vibrant-ink .CodeMirror-activeline-background { background: #27282E; }
+.cm-s-vibrant-ink .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/xq-dark.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,53 @@
+/*
+Copyright (C) 2011 by MarkLogic Corporation
+Author: Mike Brevoort <mike@brevoort.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+.cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; }
+.cm-s-xq-dark div.CodeMirror-selected { background: #27007A; }
+.cm-s-xq-dark .CodeMirror-line::selection, .cm-s-xq-dark .CodeMirror-line > span::selection, .cm-s-xq-dark .CodeMirror-line > span > span::selection { background: rgba(39, 0, 122, 0.99); }
+.cm-s-xq-dark .CodeMirror-line::-moz-selection, .cm-s-xq-dark .CodeMirror-line > span::-moz-selection, .cm-s-xq-dark .CodeMirror-line > span > span::-moz-selection { background: rgba(39, 0, 122, 0.99); }
+.cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; }
+.cm-s-xq-dark .CodeMirror-guttermarker { color: #FFBD40; }
+.cm-s-xq-dark .CodeMirror-guttermarker-subtle { color: #f8f8f8; }
+.cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; }
+.cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white; }
+
+.cm-s-xq-dark span.cm-keyword { color: #FFBD40; }
+.cm-s-xq-dark span.cm-atom { color: #6C8CD5; }
+.cm-s-xq-dark span.cm-number { color: #164; }
+.cm-s-xq-dark span.cm-def { color: #FFF; text-decoration:underline; }
+.cm-s-xq-dark span.cm-variable { color: #FFF; }
+.cm-s-xq-dark span.cm-variable-2 { color: #EEE; }
+.cm-s-xq-dark span.cm-variable-3, .cm-s-xq-dark span.cm-type { color: #DDD; }
+.cm-s-xq-dark span.cm-property {}
+.cm-s-xq-dark span.cm-operator {}
+.cm-s-xq-dark span.cm-comment { color: gray; }
+.cm-s-xq-dark span.cm-string { color: #9FEE00; }
+.cm-s-xq-dark span.cm-meta { color: yellow; }
+.cm-s-xq-dark span.cm-qualifier { color: #FFF700; }
+.cm-s-xq-dark span.cm-builtin { color: #30a; }
+.cm-s-xq-dark span.cm-bracket { color: #cc7; }
+.cm-s-xq-dark span.cm-tag { color: #FFBD40; }
+.cm-s-xq-dark span.cm-attribute { color: #FFF700; }
+.cm-s-xq-dark span.cm-error { color: #f00; }
+
+.cm-s-xq-dark .CodeMirror-activeline-background { background: #27282E; }
+.cm-s-xq-dark .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/xq-light.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,43 @@
+/*
+Copyright (C) 2011 by MarkLogic Corporation
+Author: Mike Brevoort <mike@brevoort.com>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+*/
+.cm-s-xq-light span.cm-keyword { line-height: 1em; font-weight: bold; color: #5A5CAD; }
+.cm-s-xq-light span.cm-atom { color: #6C8CD5; }
+.cm-s-xq-light span.cm-number { color: #164; }
+.cm-s-xq-light span.cm-def { text-decoration:underline; }
+.cm-s-xq-light span.cm-variable { color: black; }
+.cm-s-xq-light span.cm-variable-2 { color:black; }
+.cm-s-xq-light span.cm-variable-3, .cm-s-xq-light span.cm-type { color: black; }
+.cm-s-xq-light span.cm-property {}
+.cm-s-xq-light span.cm-operator {}
+.cm-s-xq-light span.cm-comment { color: #0080FF; font-style: italic; }
+.cm-s-xq-light span.cm-string { color: red; }
+.cm-s-xq-light span.cm-meta { color: yellow; }
+.cm-s-xq-light span.cm-qualifier { color: grey; }
+.cm-s-xq-light span.cm-builtin { color: #7EA656; }
+.cm-s-xq-light span.cm-bracket { color: #cc7; }
+.cm-s-xq-light span.cm-tag { color: #3F7F7F; }
+.cm-s-xq-light span.cm-attribute { color: #7F007F; }
+.cm-s-xq-light span.cm-error { color: #f00; }
+
+.cm-s-xq-light .CodeMirror-activeline-background { background: #e8f2ff; }
+.cm-s-xq-light .CodeMirror-matchingbracket { outline:1px solid grey;color:black !important;background:yellow; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/yeti.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,44 @@
+/*
+
+    Name:       yeti
+    Author:     Michael Kaminsky (http://github.com/mkaminsky11)
+
+    Original yeti color scheme by Jesse Weed (https://github.com/jesseweed/yeti-syntax)
+
+*/
+
+
+.cm-s-yeti.CodeMirror {
+  background-color: #ECEAE8 !important;
+  color: #d1c9c0 !important;
+  border: none;
+}
+
+.cm-s-yeti .CodeMirror-gutters {
+  color: #adaba6;
+  background-color: #E5E1DB;
+  border: none;
+}
+.cm-s-yeti .CodeMirror-cursor { border-left: solid thin #d1c9c0; }
+.cm-s-yeti .CodeMirror-linenumber { color: #adaba6; }
+.cm-s-yeti.CodeMirror-focused div.CodeMirror-selected { background: #DCD8D2; }
+.cm-s-yeti .CodeMirror-line::selection, .cm-s-yeti .CodeMirror-line > span::selection, .cm-s-yeti .CodeMirror-line > span > span::selection { background: #DCD8D2; }
+.cm-s-yeti .CodeMirror-line::-moz-selection, .cm-s-yeti .CodeMirror-line > span::-moz-selection, .cm-s-yeti .CodeMirror-line > span > span::-moz-selection { background: #DCD8D2; }
+.cm-s-yeti span.cm-comment { color: #d4c8be; }
+.cm-s-yeti span.cm-string, .cm-s-yeti span.cm-string-2 { color: #96c0d8; }
+.cm-s-yeti span.cm-number { color: #a074c4; }
+.cm-s-yeti span.cm-variable { color: #55b5db; }
+.cm-s-yeti span.cm-variable-2 { color: #a074c4; }
+.cm-s-yeti span.cm-def { color: #55b5db; }
+.cm-s-yeti span.cm-operator { color: #9fb96e; }
+.cm-s-yeti span.cm-keyword { color: #9fb96e; }
+.cm-s-yeti span.cm-atom { color: #a074c4; }
+.cm-s-yeti span.cm-meta { color: #96c0d8; }
+.cm-s-yeti span.cm-tag { color: #96c0d8; }
+.cm-s-yeti span.cm-attribute { color: #9fb96e; }
+.cm-s-yeti span.cm-qualifier { color: #96c0d8; }
+.cm-s-yeti span.cm-property { color: #a074c4; }
+.cm-s-yeti span.cm-builtin { color: #a074c4; }
+.cm-s-yeti span.cm-variable-3, .cm-s-yeti span.cm-type { color: #96c0d8; }
+.cm-s-yeti .CodeMirror-activeline-background { background: #E7E4E0; }
+.cm-s-yeti .CodeMirror-matchingbracket { text-decoration: underline; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/yonce.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,59 @@
+/*
+
+    Name:       yoncé
+    Author:     Thomas MacLean (http://github.com/thomasmaclean)
+
+    Original yoncé color scheme by Mina Markham (https://github.com/minamarkham)
+
+*/
+
+.cm-s-yonce.CodeMirror { background: #1C1C1C; color: #d4d4d4; } /**/
+.cm-s-yonce div.CodeMirror-selected { background: rgba(252, 69, 133, 0.478); } /**/
+.cm-s-yonce .CodeMirror-selectedtext,
+.cm-s-yonce .CodeMirror-selected,
+.cm-s-yonce .CodeMirror-line::selection,
+.cm-s-yonce .CodeMirror-line > span::selection,
+.cm-s-yonce .CodeMirror-line > span > span::selection,
+.cm-s-yonce .CodeMirror-line::-moz-selection,
+.cm-s-yonce .CodeMirror-line > span::-moz-selection,
+.cm-s-yonce .CodeMirror-line > span > span::-moz-selection { background: rgba(252, 67, 132, 0.47); }
+
+.cm-s-yonce.CodeMirror pre { padding-left: 0px; }
+.cm-s-yonce .CodeMirror-gutters {background: #1C1C1C; border-right: 0px;}
+.cm-s-yonce .CodeMirror-linenumber {color: #777777;  padding-right: 10px; }
+.cm-s-yonce .CodeMirror-activeline .CodeMirror-linenumber.CodeMirror-gutter-elt { background: #1C1C1C; color: #fc4384; }
+.cm-s-yonce .CodeMirror-linenumber { color: #777; }
+.cm-s-yonce .CodeMirror-cursor { border-left: 2px solid #FC4384; }
+.cm-s-yonce .cm-searching { background: rgba(243, 155, 53, .3) !important; outline: 1px solid #F39B35; }
+.cm-s-yonce .cm-searching.CodeMirror-selectedtext { background: rgba(243, 155, 53, .7) !important; color: white; }
+
+.cm-s-yonce .cm-keyword { color: #00A7AA; } /**/
+.cm-s-yonce .cm-atom { color: #F39B35; }
+.cm-s-yonce .cm-number, .cm-s-yonce span.cm-type { color:  #A06FCA; } /**/
+.cm-s-yonce .cm-def { color: #98E342; }
+.cm-s-yonce .cm-property,
+.cm-s-yonce span.cm-variable { color: #D4D4D4; font-style: italic; }
+.cm-s-yonce span.cm-variable-2 { color: #da7dae; font-style: italic; }
+.cm-s-yonce span.cm-variable-3 { color: #A06FCA; }
+.cm-s-yonce .cm-type.cm-def { color: #FC4384; font-style: normal; text-decoration: underline; }
+.cm-s-yonce .cm-property.cm-def { color: #FC4384; font-style: normal; }
+.cm-s-yonce .cm-callee { color: #FC4384; font-style: normal; }
+.cm-s-yonce .cm-operator { color: #FC4384; } /**/
+.cm-s-yonce .cm-qualifier,
+.cm-s-yonce .cm-tag { color: #FC4384; }
+.cm-s-yonce .cm-tag.cm-bracket { color: #D4D4D4; }
+.cm-s-yonce .cm-attribute { color: #A06FCA; }
+.cm-s-yonce .cm-comment { color:#696d70; font-style:italic; font-weight:normal; } /**/
+.cm-s-yonce .cm-comment.cm-tag { color: #FC4384 }
+.cm-s-yonce .cm-comment.cm-attribute { color: #D4D4D4; }
+.cm-s-yonce .cm-string { color:#E6DB74; } /**/
+.cm-s-yonce .cm-string-2 { color:#F39B35; } /*?*/
+.cm-s-yonce .cm-meta { color: #D4D4D4; background: inherit; }
+.cm-s-yonce .cm-builtin { color: #FC4384; } /*?*/
+.cm-s-yonce .cm-header { color: #da7dae; }
+.cm-s-yonce .cm-hr { color: #98E342; }
+.cm-s-yonce .cm-link { color:#696d70; font-style:italic; text-decoration:none; } /**/
+.cm-s-yonce .cm-error { border-bottom: 1px solid #C42412; }
+
+.cm-s-yonce .CodeMirror-activeline-background { background: #272727; }
+.cm-s-yonce .CodeMirror-matchingbracket { outline:1px solid grey; color:#D4D4D4 !important; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/lib/codemirror/theme/zenburn.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,37 @@
+/**
+ * "
+ *  Using Zenburn color palette from the Emacs Zenburn Theme
+ *  https://github.com/bbatsov/zenburn-emacs/blob/master/zenburn-theme.el
+ *
+ *  Also using parts of https://github.com/xavi/coderay-lighttable-theme
+ * "
+ * From: https://github.com/wisenomad/zenburn-lighttable-theme/blob/master/zenburn.css
+ */
+
+.cm-s-zenburn .CodeMirror-gutters { background: #3f3f3f !important; }
+.cm-s-zenburn .CodeMirror-foldgutter-open, .CodeMirror-foldgutter-folded { color: #999; }
+.cm-s-zenburn .CodeMirror-cursor { border-left: 1px solid white; }
+.cm-s-zenburn.CodeMirror { background-color: #3f3f3f; color: #dcdccc; }
+.cm-s-zenburn span.cm-builtin { color: #dcdccc; font-weight: bold; }
+.cm-s-zenburn span.cm-comment { color: #7f9f7f; }
+.cm-s-zenburn span.cm-keyword { color: #f0dfaf; font-weight: bold; }
+.cm-s-zenburn span.cm-atom { color: #bfebbf; }
+.cm-s-zenburn span.cm-def { color: #dcdccc; }
+.cm-s-zenburn span.cm-variable { color: #dfaf8f; }
+.cm-s-zenburn span.cm-variable-2 { color: #dcdccc; }
+.cm-s-zenburn span.cm-string { color: #cc9393; }
+.cm-s-zenburn span.cm-string-2 { color: #cc9393; }
+.cm-s-zenburn span.cm-number { color: #dcdccc; }
+.cm-s-zenburn span.cm-tag { color: #93e0e3; }
+.cm-s-zenburn span.cm-property { color: #dfaf8f; }
+.cm-s-zenburn span.cm-attribute { color: #dfaf8f; }
+.cm-s-zenburn span.cm-qualifier { color: #7cb8bb; }
+.cm-s-zenburn span.cm-meta { color: #f0dfaf; }
+.cm-s-zenburn span.cm-header { color: #f0efd0; }
+.cm-s-zenburn span.cm-operator { color: #f0efd0; }
+.cm-s-zenburn span.CodeMirror-matchingbracket { box-sizing: border-box; background: transparent; border-bottom: 1px solid; }
+.cm-s-zenburn span.CodeMirror-nonmatchingbracket { border-bottom: 1px solid; background: none; }
+.cm-s-zenburn .CodeMirror-activeline { background: #000000; }
+.cm-s-zenburn .CodeMirror-activeline-background { background: #000000; }
+.cm-s-zenburn div.CodeMirror-selected { background: #545454; }
+.cm-s-zenburn .CodeMirror-focused div.CodeMirror-selected { background: #4f4f4f; }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/css/prism.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,126 @@
+/* PrismJS 1.23.0
+https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+markup-templating+php */
+/**
+ * okaidia theme for JavaScript, CSS and HTML
+ * Loosely based on Monokai textmate theme by http://www.monokai.nl/
+ * @author ocodia
+ */
+
+code[class*="language-"],
+pre[class*="language-"] {
+    color: #f8f8f2;
+    background: none;
+    text-shadow: 0 1px rgba(0, 0, 0, 0.3);
+    font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
+    font-size: 1em;
+    text-align: left;
+    white-space: pre;
+    word-spacing: normal;
+    word-break: normal;
+    word-wrap: normal;
+    line-height: 1.5;
+
+    -moz-tab-size: 4;
+    -o-tab-size: 4;
+    tab-size: 4;
+
+    -webkit-hyphens: none;
+    -moz-hyphens: none;
+    -ms-hyphens: none;
+    hyphens: none;
+}
+
+/* Code blocks */
+pre[class*="language-"] {
+    padding: 1em;
+    margin: .5em 0;
+    overflow: auto;
+    border-radius: 0.3em;
+}
+
+:not(pre) > code[class*="language-"],
+pre[class*="language-"] {
+    background: #272822;
+}
+
+/* Inline code */
+:not(pre) > code[class*="language-"] {
+    padding: .1em;
+    border-radius: .3em;
+    white-space: normal;
+}
+
+.token.comment,
+.token.prolog,
+.token.doctype,
+.token.cdata {
+    color: #8292a2;
+}
+
+.token.punctuation {
+    color: #f8f8f2;
+}
+
+.token.namespace {
+    opacity: .7;
+}
+
+.token.property,
+.token.tag,
+.token.constant,
+.token.symbol,
+.token.deleted {
+    color: #f92672;
+}
+
+.token.boolean,
+.token.number {
+    color: #ae81ff;
+}
+
+.token.selector,
+.token.attr-name,
+.token.string,
+.token.char,
+.token.builtin,
+.token.inserted {
+    color: #a6e22e;
+}
+
+.token.operator,
+.token.entity,
+.token.url,
+.language-css .token.string,
+.style .token.string,
+.token.variable {
+    color: #f8f8f2;
+}
+
+.token.atrule,
+.token.attr-value,
+.token.function,
+.token.class-name {
+    color: #e6db74;
+}
+
+.token.keyword {
+    color: #66d9ef;
+}
+
+.token.regex,
+.token.important {
+    color: #fd971f;
+}
+
+.token.important,
+.token.bold {
+    font-weight: bold;
+}
+.token.italic {
+    font-style: italic;
+}
+
+.token.entity {
+    cursor: help;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/css/styles.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,811 @@
+body {
+    min-height: 100vh;
+    margin: 0;
+    font-size: 1rem;
+    font-family: var(--sans-serif);
+    font-weight: 400;
+    color: #111111;
+    text-align: left;
+    background-color: #f7f7f7;
+}
+
+:root {
+    --sans-serif: system-ui, sans-serif;
+    --monospace: "consolas", monospace;
+}
+:root {
+    scroll-behavior: smooth
+}
+
+*, 
+*::before,
+*::after {
+    box-sizing: border-box;
+}
+
+img, video {
+    max-width: 100%;
+    display: block;
+    height: auto;
+}
+
+/* Template Mini */
+body {
+    display: grid;
+    grid-template-areas:
+        "header"
+        "nav"
+        "main"
+        "footer";
+    grid-template-rows: 3.7rem auto 1fr auto;
+}
+
+header {
+    grid-area: header;
+    display: grid;
+    grid-template-columns: 1fr minmax(auto,80rem) 1fr;
+    min-width: 100%;
+    background-color: #ffffff;
+    position: fixed;
+    left: 0;
+    right: 0;
+    z-index: 999;
+    box-shadow: 0 2px 6px 0 #0000001f, inset 0 -1px 0 0 #dadce0;
+}
+@media (max-width: 767px) {
+    header {
+        column-gap: 0;
+    }
+}
+@media (min-width: 768px) {
+    header {
+        column-gap: 0.5rem;
+    }
+}
+
+.header-content {
+    grid-column: 2/3;
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: space-between;
+    position: relative;
+}
+.lrtop {
+    display: grid;
+    align-items: center;
+}
+.logo {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-50%, -50%);
+}
+.logo a {
+    text-decoration: none;
+    color: #222222;
+    font-size: 1.2rem;
+    line-height: 1;
+}
+
+
+
+/* Icon */
+.icons-container {
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: left;
+    align-items: center;
+    position: relative;
+    color: #111111;
+}
+@media (max-width: 767px) {
+    .icons-container {
+        margin-right: 0.3rem;
+    }
+}
+
+.icon-box {
+    position: relative;
+}
+@media (max-width: 374px) {
+    .icon-box {
+        width: 37px;
+        height: 37px;
+    }
+}
+@media (min-width: 375px) {
+    .icon-box {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+.icon-box a {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    padding: 0.3125rem;
+    z-index: 7;
+}
+.icon-box a:hover {
+    background-color: #eaeaea;
+    border-radius: 50%;
+    color: green;
+}
+
+
+/*Icon Phone*/
+.phone-number-container {
+    position: relative;
+    color: #111111;
+    height: 2.75rem;
+}
+
+.phone-number-container a {
+    padding: 0 3.5625rem 0 1rem;
+    height: 2.75rem;
+    margin-right: -2.75rem;
+    position: relative;
+    z-index: 10;
+    font-size: 1rem;
+    text-decoration: none;
+    color: #111111;
+    display: flex;
+    align-items: center;
+}
+.phone-number-container a:hover {
+    color: #1a73e8;
+}
+.phone-number-container:hover ~ .icon-box {
+    background-color: #f1f1f1;
+    border-radius: 50%;
+}
+
+@media (max-width: 768px) {
+    .phone-number-container {
+        display: none;
+    }
+}
+
+
+.icon-tg-box {
+    position: relative;
+}
+@media (max-width: 374px) {
+    .icon-tg-box {
+        width: 37px;
+        height: 37px;
+    }
+}
+@media (min-width: 375px) {
+    .icon-tg-box {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+.icon-tg-box a {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    padding: 0.3125rem;
+    z-index: 7;
+}
+.icon-tg-box a:hover {
+    background-color: #dff1ff;
+    border-radius: 50%;
+}
+
+
+
+
+.icon-whatsapp-box {
+    position: relative;
+}
+@media (max-width: 374px) {
+    .icon-whatsapp-box {
+        width: 37px;
+        height: 37px;
+    }
+}
+@media (min-width: 375px) {
+    .icon-whatsapp-box {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+.icon-whatsapp-box a {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    padding: 0.3125rem;
+    z-index: 7;
+}
+.icon-whatsapp-box a:hover {
+    background-color: #e0feff;
+    border-radius: 50%;
+}
+
+
+nav {
+    grid-area: nav;
+    display: grid;
+    background-color: #f7f7f7;
+    grid-template-areas: ". gnc .";
+    grid-template-columns: 1fr minmax(auto,80rem) 1fr;
+}
+/*Header Container*/
+nav ul {
+    grid-column: gnc;
+    margin: 0;
+    padding: 0;
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: space-evenly;
+}
+nav li {
+    list-style-type: none;
+}
+nav li a {
+    display: inline-block;
+    line-height: 0;
+    padding: 24px 10px 24px 10px;
+    font-size: 17px;
+    color: #000000;
+    text-decoration: none;
+}
+nav li a:hover {
+    color: #333333;
+}
+nav li.active a {
+    color: #1a73e8;
+}
+/* Active Mobile Display */
+@media (max-width: 768px) {
+    nav ul {
+        display: none;
+    }
+}
+
+
+
+main {
+    grid-area: main;
+    display: grid;
+    grid-template-columns: 1fr minmax(auto,40rem) 1fr;
+    row-gap: 1.4rem;
+    column-gap: 0.5rem;
+    padding-bottom: 3rem;
+    align-content: start;
+}
+main > * {
+    grid-column: 2/3;
+}
+main .ignorgap {
+    grid-column: 1/-1;
+    justify-self: center;
+    max-width: 40rem;
+    margin: 0 auto;
+}
+
+main .gap {
+    grid-column: 1/-1;
+    justify-self: center;
+    max-width: 40rem;
+}
+
+main .banner {
+    max-height: 380px;
+    object-fit: cover;
+    grid-column: 1/-1;
+    justify-self: center;
+}
+main h1 {
+    margin: 0;
+    padding: 0;
+    font-weight: 500;
+    line-height: 1;
+    font-size: calc(1.7rem + 0.7vw);
+    position: relative;
+    display: block;
+}
+main > h1:first-child {
+    margin-top: 2rem;
+}
+
+main h2, main h3, main h4, main h5, main h6 {
+    margin: 0;
+    padding: 0;
+    font-weight: 400;
+    line-height: 1;
+    position: relative;
+}
+main p  {
+    margin: 0;
+    padding: 0;
+    display: block;
+    line-height: 1.4;
+}
+main a  {
+    margin: 0;
+    padding: 0;
+    display: inline;
+    line-height: 1.4;
+    color: #007ce7;
+}
+main pre {
+    margin: 0;
+    width: 100%;
+    word-break: break-all;
+    line-height: 1.4em;
+    display: block;
+    padding: 0.7rem;
+    background-color: #eaeaea;
+}
+main code  {
+    background-color: #eaeaea;
+    font-family: var(--monospace);
+    white-space: pre-wrap;
+}
+main code p  {
+    padding: 0.3rem 0.7rem 0.3rem 0.7rem;
+    margin: -0.7rem -0.7rem 0.3rem -0.7rem;
+    background-color: lightgrey;
+}
+
+main img, main svg, main video, main audio, main source, main blockquote, main figure, main div, main iframe  {
+    margin: 0;
+    padding: 0;
+    position: relative;
+}
+figcaption {
+    text-align: center;
+    background-color: #0000003d;
+    padding: 0.1rem 0.7rem;
+}
+main .wide  {
+    grid-column: 1/-1;
+    justify-self: center;
+}
+
+main ul {
+    margin: 0;
+    padding: 0 0 0 1.2rem;
+    display: block;
+    line-height: 1.4;
+}
+main ol {
+    margin: 0;
+    padding: 0 0 0 1.2rem;
+    display: block;
+    line-height: 1.4;
+}
+
+main blockquote {
+    margin: 0;
+    padding: 0.5rem 0.7rem 0.5rem 0.7rem;
+    background-color: #eaeaea;
+    border-left: 2px solid #acacac;
+}
+main blockquote p {
+    margin-bottom: 0.7rem;
+}
+main blockquote p.author {
+    text-align: right;
+    padding-right: 1rem;
+}
+main blockquote p:last-child {
+    margin-bottom: 0;
+}
+
+main > video {
+    grid-column: 1/-1;
+    margin: 0 auto;
+    max-width: 100%;
+    height: auto;
+}
+
+footer {
+    grid-area: footer;
+    background-color: #111111;
+    display: grid;
+    grid-template-columns: 1fr minmax(auto,80rem) 1fr;
+    column-gap: 0.5rem;
+}
+
+
+.footer-content {
+    grid-column: 2/3;
+    padding: 1rem 0rem;
+    min-height: 3rem;
+    display: grid;
+    gap: 1rem;
+}
+@media (max-width: 374px) {
+    .footer-content {
+        grid-template-columns: 1fr;
+        grid-template-areas:
+            "left-footer"
+            "right-footer";
+    }
+}
+@media (min-width: 375px) {
+    .footer-content {
+        grid-template-columns: 1fr 0.4fr;
+        grid-template-areas:"left-footer right-footer";
+    }
+}
+.left-footer {
+    grid-area: left-footer;
+    display: grid;
+    row-gap: 0.7rem;
+}
+.right-footer {
+    grid-area: right-footer;
+    display: flex;
+    width: 100%;
+    padding: 0.3rem 0;
+    justify-content: center;
+    color: #eeeeee;
+}
+.right-footer div {
+    color: #eeeeee;
+}
+@media (min-width: 375px) {
+    .right-footer {
+        justify-content: flex-end;
+        padding: 0;
+    }
+}
+
+
+
+/*Footer Container*/
+footer ul {
+    display: grid;
+    margin: 0;
+    padding: 0;
+    row-gap: 0.4375rem;
+}
+footer li {
+    list-style-type: none;
+    margin: 0;
+    display: block;
+}
+footer li a {
+    line-height: 1.3;
+    color: #ffffff;
+    text-decoration: none;
+}
+footer li a:hover {
+    color: #ddeeff;
+}
+footer li.active a {
+    color: #ddeeff;
+}
+
+@media (min-width: 768px) {
+    footer ul {
+        display: flex;
+        flex-wrap: wrap;
+        justify-content: left;
+        column-gap: 0.9375rem;
+    }
+}
+
+.copyright {
+    margin: 0;
+    font-size: 0.93rem;
+    color: #cccccc;
+}
+.copyright a {
+    color: #00b8ff;
+    text-decoration: none;
+}
+.copyright a:hover {
+    color: #39c7ff;
+    text-decoration: none;
+}
+
+
+/* Mobile Menu */
+/* Icon Line */
+.button-mobimenu-container {
+    display: grid;
+    justify-content: center;
+    align-content: center;
+    position: relative;
+    width: 3.7rem;
+    height: 3.7rem;
+    cursor: pointer;
+}
+/* Active Mobile Display */
+
+.menu-icon {
+    width: 30px;
+    height: 14px;
+    position: relative;
+    z-index:7;
+}
+
+.menu-icon span {
+    display: block;
+    position: absolute;
+    left: 0;
+    width: 100%;
+    height: 3px;
+    transform: rotate(0);
+    transition: transform 0.1s ease;
+}
+.menu-icon span {
+    background-color: #0d93ff;
+}
+.menu-icon span.line-1 {
+    top: 0;
+}
+.menu-icon span.line-2 {
+    bottom: 0;
+}
+
+.mobile-menu-open .menu-icon span.line-1 {
+    top: 5px;
+    transform: rotate(45deg);
+
+}
+.mobile-menu-open .menu-icon span.line-2 {
+    top: 5px;
+    transform: rotate(-45deg);
+}
+
+/*Mobile Menu Container*/
+
+aside {
+    position: fixed;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    width: calc(100% - 4rem);
+    min-width: 16.875rem;
+    background-color: #ffffff;
+    z-index: 777;
+    transform: translate3d(-100%, 0, 0);
+    transition: opacity 0.25s ease, transform 0.25s ease;
+    padding: 3.7rem 0 0 0;
+    overflow-y: auto;
+    scrollbar-width: none; /*FireFox*/
+}
+.mobile-menu-open aside {
+    transform: translate3d(0, 0, 0);
+    transition: opacity 0.25s ease, transform 0.25s ease;
+}
+
+@media (min-width: 1024px) {
+    aside {
+        width: fit-content;
+        max-width: calc(100% - 4rem);
+    }
+}
+
+aside ul {
+    margin: 0;
+    padding: 0;
+}
+aside > ul {
+    padding-bottom: 1rem;
+}
+aside > ul:not(:first-child) {
+    padding-top: 1rem;
+}
+aside > ul:not(:last-child) {
+    border-bottom: 1px solid #ccc;
+}
+aside li {
+    list-style-type: none;
+    position: relative;
+}
+aside li a {
+    width: 100%;
+    display: block;
+    padding: 13px 17px;
+    color: #111111;
+    text-decoration: none;
+}
+aside li a:hover {
+    color: #1a73e8;
+    background-color: #f7f7f7;
+}
+aside li.active > a {
+    color: #1a73e8;
+    background-color: #f7f7f7;
+}
+
+ul.sub-menu {
+    margin: 0;
+    padding: 0;
+}
+
+aside ul > li > ul > li > a {
+    padding-left: 34px;
+}
+aside ul > li > ul > li > ul > li > a {
+    padding-left: 51px;
+}
+
+
+/*Mobile Menu Reset*/
+.bg-reset {
+    display: none;
+    width: 100%;
+    height: 100%;
+    visibility: visible;
+    position: fixed;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    z-index: 700;
+    opacity: 0.7;
+    background-color: #eeeeee;
+}
+.mobile-menu-open .bg-reset {
+    display: block;
+}
+
+
+/*Hot Info*/
+main .hot-scroll {
+    overflow: hidden;
+    grid-column: 1/-1;
+    background-color: #f1f1f1;
+    padding: 2rem 0;
+}
+
+main .hot-scroll ul {
+    display: flex;
+    gap: 1rem;
+    overflow-x: auto;
+    margin: 0;
+    padding: 1rem 0;
+    scroll-behavior: smooth;
+}
+main .hot-scroll ul li {
+    display: block;
+    flex: 0 0 240px;
+    background-color: #ffffff;
+    min-height: 12rem;
+    transition: all .5s ease;
+    border-radius: 0.3rem;
+    overflow: hidden;
+    border: 1px solid #dadada;
+    user-select: none;
+}
+
+main .hot-scroll ul li:hover {
+    box-shadow: 0 2px 6px 0 rgb(0 0 0 / 12%);
+}
+
+main .hot-scroll ul li:first-child {
+    margin-left: calc(50% - 140px);
+}
+@media (min-width: 375px) {
+    main .hot-scroll ul li {
+        flex: 0 0 280px;
+    }
+}
+@media (min-width: 600px) {
+    main .hot-scroll ul li:first-child {
+        margin-left: calc(50% - 290px);
+    }
+}
+@media (min-width: 1024px) {
+    main .hot-scroll ul li {
+        flex: 0 0 440px;
+    }
+    main .hot-scroll ul li:first-child {
+        margin-left: calc(50% - 470px);
+    }
+}
+
+
+main .hot-scroll img {
+    overflow: hidden;
+    max-height: 10rem;
+    object-fit: cover;
+    margin: 0;
+}
+main .hot-scroll .hot-news {
+    padding: 0.6rem 1rem 1.6rem 1rem;
+}
+main .hot-scroll .hot-news h2 {
+    padding: 0;
+    margin: 0 0 0.7rem 0;
+    font-weight: 400;
+    font-size: 1.4rem;
+    color: #111111;
+    display: block;
+    text-decoration: none;
+}
+main .hot-scroll .hot-news p {
+    font-weight: 400;
+    color: #111111;
+    display: block;
+    text-decoration: none;
+}
+main .hot-scroll ul li a {
+    text-decoration: none;
+}
+
+@media (min-width: 1024px) {
+    main .hot-scroll img {
+        max-height: 14rem;
+    }
+    main .hot-scroll .hot-news {
+        padding: 1rem 1.4rem 2rem 1.4rem;
+    }
+    main .hot-scroll .hot-news h2 {
+        font-size: 1.6rem;
+    }
+}
+
+/*ЮMoney*/
+.yoomoney-pay {
+    padding: 0.7rem 1.7rem;
+    border-radius: 0.3rem;
+    border: 0;
+    cursor: pointer; 
+    background-color: #8b3ffd;
+    font-size: 0.9rem;
+    transition: 0.3s;
+    color: #ffffff;
+}
+.yoomoney-pay:hover { 
+    background: #8b3ffd;
+    box-shadow: 0 0 0 0.2em #c3a4ff;
+}
+.yoomoney-form {
+    display: grid;
+    padding: 0.7rem 0.7rem;
+    border-radius: 0.3rem;
+    background-color: white;
+    box-shadow: 0px 3px 7px 0px #00000033;
+    column-gap: 0.7rem;
+}
+.yoomoney-form input[type='email'] {
+    width: 100%;
+    border: 1px solid #777777;
+    border-radius: 0.3rem;
+    padding: 0 0 0 0.5rem;
+    font-size: 1rem;
+    font-weight: 600;
+}
+@media (max-width: 375px) {
+    .yoomoney-form {
+        width: 100%;
+        grid-template-columns: auto;
+        row-gap: 1rem;
+    }
+    .yoomoney-form input[type='email'] {
+        height: 2.4rem;
+    }
+}
+@media (min-width: 376px) {
+    .yoomoney-form {
+        width: fit-content;
+        grid-template-columns: auto auto;
+    }
+}
+/* 
+ul a:not([href]) {
+    display: none;
+}
+ul a:not([href]) + ul {
+    display: none;
+}
+*/
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/js/prism.js	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,9 @@
+/* PrismJS 1.23.0
+https://prismjs.com/download.html#themes=prism-okaidia&languages=markup+css+clike+javascript+markup-templating+php */
+var _self="undefined"!=typeof window?window:"undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope?self:{},Prism=function(u){var c=/\blang(?:uage)?-([\w-]+)\b/i,n=0,e={},M={manual:u.Prism&&u.Prism.manual,disableWorkerMessageHandler:u.Prism&&u.Prism.disableWorkerMessageHandler,util:{encode:function e(n){return n instanceof W?new W(n.type,e(n.content),n.alias):Array.isArray(n)?n.map(e):n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/\u00a0/g," ")},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function t(e,r){var a,n;switch(r=r||{},M.util.type(e)){case"Object":if(n=M.util.objId(e),r[n])return r[n];for(var i in a={},r[n]=a,e)e.hasOwnProperty(i)&&(a[i]=t(e[i],r));return a;case"Array":return n=M.util.objId(e),r[n]?r[n]:(a=[],r[n]=a,e.forEach(function(e,n){a[n]=t(e,r)}),a);default:return e}},getLanguage:function(e){for(;e&&!c.test(e.className);)e=e.parentElement;return e?(e.className.match(c)||[,"none"])[1].toLowerCase():"none"},currentScript:function(){if("undefined"==typeof document)return null;if("currentScript"in document)return document.currentScript;try{throw new Error}catch(e){var n=(/at [^(\r\n]*\((.*):.+:.+\)$/i.exec(e.stack)||[])[1];if(n){var t=document.getElementsByTagName("script");for(var r in t)if(t[r].src==n)return t[r]}return null}},isActive:function(e,n,t){for(var r="no-"+n;e;){var a=e.classList;if(a.contains(n))return!0;if(a.contains(r))return!1;e=e.parentElement}return!!t}},languages:{plain:e,plaintext:e,text:e,txt:e,extend:function(e,n){var t=M.util.clone(M.languages[e]);for(var r in n)t[r]=n[r];return t},insertBefore:function(t,e,n,r){var a=(r=r||M.languages)[t],i={};for(var l in a)if(a.hasOwnProperty(l)){if(l==e)for(var o in n)n.hasOwnProperty(o)&&(i[o]=n[o]);n.hasOwnProperty(l)||(i[l]=a[l])}var s=r[t];return r[t]=i,M.languages.DFS(M.languages,function(e,n){n===s&&e!=t&&(this[e]=i)}),i},DFS:function e(n,t,r,a){a=a||{};var i=M.util.objId;for(var l in n)if(n.hasOwnProperty(l)){t.call(n,l,n[l],r||l);var o=n[l],s=M.util.type(o);"Object"!==s||a[i(o)]?"Array"!==s||a[i(o)]||(a[i(o)]=!0,e(o,t,l,a)):(a[i(o)]=!0,e(o,t,null,a))}}},plugins:{},highlightAll:function(e,n){M.highlightAllUnder(document,e,n)},highlightAllUnder:function(e,n,t){var r={callback:t,container:e,selector:'code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code'};M.hooks.run("before-highlightall",r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),M.hooks.run("before-all-elements-highlight",r);for(var a,i=0;a=r.elements[i++];)M.highlightElement(a,!0===n,r.callback)},highlightElement:function(e,n,t){var r=M.util.getLanguage(e),a=M.languages[r];e.className=e.className.replace(c,"").replace(/\s+/g," ")+" language-"+r;var i=e.parentElement;i&&"pre"===i.nodeName.toLowerCase()&&(i.className=i.className.replace(c,"").replace(/\s+/g," ")+" language-"+r);var l={element:e,language:r,grammar:a,code:e.textContent};function o(e){l.highlightedCode=e,M.hooks.run("before-insert",l),l.element.innerHTML=l.highlightedCode,M.hooks.run("after-highlight",l),M.hooks.run("complete",l),t&&t.call(l.element)}if(M.hooks.run("before-sanity-check",l),(i=l.element.parentElement)&&"pre"===i.nodeName.toLowerCase()&&!i.hasAttribute("tabindex")&&i.setAttribute("tabindex","0"),!l.code)return M.hooks.run("complete",l),void(t&&t.call(l.element));if(M.hooks.run("before-highlight",l),l.grammar)if(n&&u.Worker){var s=new Worker(M.filename);s.onmessage=function(e){o(e.data)},s.postMessage(JSON.stringify({language:l.language,code:l.code,immediateClose:!0}))}else o(M.highlight(l.code,l.grammar,l.language));else o(M.util.encode(l.code))},highlight:function(e,n,t){var r={code:e,grammar:n,language:t};return M.hooks.run("before-tokenize",r),r.tokens=M.tokenize(r.code,r.grammar),M.hooks.run("after-tokenize",r),W.stringify(M.util.encode(r.tokens),r.language)},tokenize:function(e,n){var t=n.rest;if(t){for(var r in t)n[r]=t[r];delete n.rest}var a=new i;return I(a,a.head,e),function e(n,t,r,a,i,l){for(var o in r)if(r.hasOwnProperty(o)&&r[o]){var s=r[o];s=Array.isArray(s)?s:[s];for(var u=0;u<s.length;++u){if(l&&l.cause==o+","+u)return;var c=s[u],g=c.inside,f=!!c.lookbehind,h=!!c.greedy,d=c.alias;if(h&&!c.pattern.global){var p=c.pattern.toString().match(/[imsuy]*$/)[0];c.pattern=RegExp(c.pattern.source,p+"g")}for(var v=c.pattern||c,m=a.next,y=i;m!==t.tail&&!(l&&y>=l.reach);y+=m.value.length,m=m.next){var b=m.value;if(t.length>n.length)return;if(!(b instanceof W)){var k,x=1;if(h){if(!(k=z(v,y,n,f)))break;var w=k.index,A=k.index+k[0].length,P=y;for(P+=m.value.length;P<=w;)m=m.next,P+=m.value.length;if(P-=m.value.length,y=P,m.value instanceof W)continue;for(var E=m;E!==t.tail&&(P<A||"string"==typeof E.value);E=E.next)x++,P+=E.value.length;x--,b=n.slice(y,P),k.index-=y}else if(!(k=z(v,0,b,f)))continue;var w=k.index,S=k[0],O=b.slice(0,w),L=b.slice(w+S.length),N=y+b.length;l&&N>l.reach&&(l.reach=N);var j=m.prev;O&&(j=I(t,j,O),y+=O.length),q(t,j,x);var C=new W(o,g?M.tokenize(S,g):S,d,S);if(m=I(t,j,C),L&&I(t,m,L),1<x){var _={cause:o+","+u,reach:N};e(n,t,r,m.prev,y,_),l&&_.reach>l.reach&&(l.reach=_.reach)}}}}}}(e,a,n,a.head,0),function(e){var n=[],t=e.head.next;for(;t!==e.tail;)n.push(t.value),t=t.next;return n}(a)},hooks:{all:{},add:function(e,n){var t=M.hooks.all;t[e]=t[e]||[],t[e].push(n)},run:function(e,n){var t=M.hooks.all[e];if(t&&t.length)for(var r,a=0;r=t[a++];)r(n)}},Token:W};function W(e,n,t,r){this.type=e,this.content=n,this.alias=t,this.length=0|(r||"").length}function z(e,n,t,r){e.lastIndex=n;var a=e.exec(t);if(a&&r&&a[1]){var i=a[1].length;a.index+=i,a[0]=a[0].slice(i)}return a}function i(){var e={value:null,prev:null,next:null},n={value:null,prev:e,next:null};e.next=n,this.head=e,this.tail=n,this.length=0}function I(e,n,t){var r=n.next,a={value:t,prev:n,next:r};return n.next=a,r.prev=a,e.length++,a}function q(e,n,t){for(var r=n.next,a=0;a<t&&r!==e.tail;a++)r=r.next;(n.next=r).prev=n,e.length-=a}if(u.Prism=M,W.stringify=function n(e,t){if("string"==typeof e)return e;if(Array.isArray(e)){var r="";return e.forEach(function(e){r+=n(e,t)}),r}var a={type:e.type,content:n(e.content,t),tag:"span",classes:["token",e.type],attributes:{},language:t},i=e.alias;i&&(Array.isArray(i)?Array.prototype.push.apply(a.classes,i):a.classes.push(i)),M.hooks.run("wrap",a);var l="";for(var o in a.attributes)l+=" "+o+'="'+(a.attributes[o]||"").replace(/"/g,"&quot;")+'"';return"<"+a.tag+' class="'+a.classes.join(" ")+'"'+l+">"+a.content+"</"+a.tag+">"},!u.document)return u.addEventListener&&(M.disableWorkerMessageHandler||u.addEventListener("message",function(e){var n=JSON.parse(e.data),t=n.language,r=n.code,a=n.immediateClose;u.postMessage(M.highlight(r,M.languages[t],t)),a&&u.close()},!1)),M;var t=M.util.currentScript();function r(){M.manual||M.highlightAll()}if(t&&(M.filename=t.src,t.hasAttribute("data-manual")&&(M.manual=!0)),!M.manual){var a=document.readyState;"loading"===a||"interactive"===a&&t&&t.defer?document.addEventListener("DOMContentLoaded",r):window.requestAnimationFrame?window.requestAnimationFrame(r):window.setTimeout(r,16)}return M}(_self);"undefined"!=typeof module&&module.exports&&(module.exports=Prism),"undefined"!=typeof global&&(global.Prism=Prism);
+Prism.languages.markup={comment:/<!--[\s\S]*?-->/,prolog:/<\?[\s\S]+?\?>/,doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/,name:/[^\s<>'"]+/}},cdata:/<!\[CDATA\[[\s\S]*?]]>/i,tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:"named-entity"},/&#x?[\da-f]{1,8};/i]},Prism.languages.markup.tag.inside["attr-value"].inside.entity=Prism.languages.markup.entity,Prism.languages.markup.doctype.inside["internal-subset"].inside=Prism.languages.markup,Prism.hooks.add("wrap",function(a){"entity"===a.type&&(a.attributes.title=a.content.replace(/&amp;/,"&"))}),Object.defineProperty(Prism.languages.markup.tag,"addInlined",{value:function(a,e){var s={};s["language-"+e]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:Prism.languages[e]},s.cdata=/^<!\[CDATA\[|\]\]>$/i;var t={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:s}};t["language-"+e]={pattern:/[\s\S]+/,inside:Prism.languages[e]};var n={};n[a]={pattern:RegExp("(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[^])*?(?=</__>)".replace(/__/g,function(){return a}),"i"),lookbehind:!0,greedy:!0,inside:t},Prism.languages.insertBefore("markup","cdata",n)}}),Object.defineProperty(Prism.languages.markup.tag,"addAttribute",{value:function(a,e){Prism.languages.markup.tag.inside["special-attr"].push({pattern:RegExp("(^|[\"'\\s])(?:"+a+")\\s*=\\s*(?:\"[^\"]*\"|'[^']*'|[^\\s'\">=]+(?=[\\s>]))","i"),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[e,"language-"+e],inside:Prism.languages[e]},punctuation:[{pattern:/^=/,alias:"attr-equals"},/"|'/]}}}})}}),Prism.languages.html=Prism.languages.markup,Prism.languages.mathml=Prism.languages.markup,Prism.languages.svg=Prism.languages.markup,Prism.languages.xml=Prism.languages.extend("markup",{}),Prism.languages.ssml=Prism.languages.xml,Prism.languages.atom=Prism.languages.xml,Prism.languages.rss=Prism.languages.xml;
+!function(s){var e=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;s.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:/@[\w-](?:[^;{\s]|\s+(?![\s{]))*(?:;|(?=\s*\{))/,inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:"selector"},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp("\\burl\\((?:"+e.source+"|(?:[^\\\\\r\n()\"']|\\\\[^])*)\\)","i"),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp("^"+e.source+"$"),alias:"url"}}},selector:{pattern:RegExp("(^|[{}\\s])[^{}\\s](?:[^{};\"'\\s]|\\s+(?![\\s{])|"+e.source+")*(?=\\s*\\{)"),lookbehind:!0},string:{pattern:e,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},s.languages.css.atrule.inside.rest=s.languages.css;var t=s.languages.markup;t&&(t.tag.addInlined("style","css"),t.tag.addAttribute("style","css"))}(Prism);
+Prism.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|interface|extends|implements|trait|instanceof|new)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:if|else|while|do|for|return|in|instanceof|function|new|try|throw|catch|finally|null|break|continue)\b/,boolean:/\b(?:true|false)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/};
+Prism.languages.javascript=Prism.languages.extend("clike",{"class-name":[Prism.languages.clike["class-name"],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:prototype|constructor))/,lookbehind:!0}],keyword:[{pattern:/((?:^|})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:/\b(?:(?:0[xX](?:[\dA-Fa-f](?:_[\dA-Fa-f])?)+|0[bB](?:[01](?:_[01])?)+|0[oO](?:[0-7](?:_[0-7])?)+)n?|(?:\d(?:_\d)?)+n|NaN|Infinity)\b|(?:\b(?:\d(?:_\d)?)+\.?(?:\d(?:_\d)?)*|\B\.(?:\d(?:_\d)?)+)(?:[Ee][+-]?(?:\d(?:_\d)?)+)?/,operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript["class-name"][0].pattern=/(\b(?:class|interface|extends|implements|instanceof|new)\s+)[\w.\\]+/,Prism.languages.insertBefore("javascript","keyword",{regex:{pattern:/((?:^|[^$\w\xA0-\uFFFF."'\])\s]|\b(?:return|yield))\s*)\/(?:\[(?:[^\]\\\r\n]|\\.)*]|\\.|[^/\\\[\r\n])+\/[dgimyus]{0,7}(?=(?:\s|\/\*(?:[^*]|\*(?!\/))*\*\/)*(?:$|[\r\n,.;:})\]]|\/\/))/,lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:"language-regex",inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:"function"},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore("javascript","string",{hashbang:{pattern:/^#!.*/,greedy:!0,alias:"comment"},"template-string":{pattern:/`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}|(?!\${)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:"string"},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})+}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\${|}$/,alias:"punctuation"},rest:Prism.languages.javascript}},string:/[\s\S]+/}}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined("script","javascript"),Prism.languages.markup.tag.addAttribute("on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)","javascript")),Prism.languages.js=Prism.languages.javascript;
+!function(h){function v(e,n){return"___"+e.toUpperCase()+n+"___"}Object.defineProperties(h.languages["markup-templating"]={},{buildPlaceholders:{value:function(a,r,e,o){if(a.language===r){var c=a.tokenStack=[];a.code=a.code.replace(e,function(e){if("function"==typeof o&&!o(e))return e;for(var n,t=c.length;-1!==a.code.indexOf(n=v(r,t));)++t;return c[t]=e,n}),a.grammar=h.languages.markup}}},tokenizePlaceholders:{value:function(p,k){if(p.language===k&&p.tokenStack){p.grammar=h.languages[k];var m=0,d=Object.keys(p.tokenStack);!function e(n){for(var t=0;t<n.length&&!(m>=d.length);t++){var a=n[t];if("string"==typeof a||a.content&&"string"==typeof a.content){var r=d[m],o=p.tokenStack[r],c="string"==typeof a?a:a.content,i=v(k,r),u=c.indexOf(i);if(-1<u){++m;var g=c.substring(0,u),l=new h.Token(k,h.tokenize(o,p.grammar),"language-"+k,o),s=c.substring(u+i.length),f=[];g&&f.push.apply(f,e([g])),f.push(l),s&&f.push.apply(f,e([s])),"string"==typeof a?n.splice.apply(n,[t,1].concat(f)):a.content=f}}else a.content&&e(a.content)}return n}(p.tokens)}}}})}(Prism);
+!function(a){var e=/\/\*[\s\S]*?\*\/|\/\/.*|#(?!\[).*/,t=[{pattern:/\b(?:false|true)\b/i,alias:"boolean"},{pattern:/(::\s*)\b[a-z_]\w*\b(?!\s*\()/i,greedy:!0,lookbehind:!0},{pattern:/(\b(?:case|const)\s+)\b[a-z_]\w*(?=\s*[;=])/i,greedy:!0,lookbehind:!0},/\b(?:null)\b/i,/\b[A-Z_][A-Z0-9_]*\b(?!\s*\()/],i=/\b0b[01]+(?:_[01]+)*\b|\b0o[0-7]+(?:_[0-7]+)*\b|\b0x[\da-f]+(?:_[\da-f]+)*\b|(?:\b\d+(?:_\d+)*\.?(?:\d+(?:_\d+)*)?|\B\.\d+)(?:e[+-]?\d+)?/i,n=/<?=>|\?\?=?|\.{3}|\??->|[!=]=?=?|::|\*\*=?|--|\+\+|&&|\|\||<<|>>|[?~]|[/^|%*&<>.+-]=?/,s=/[{}\[\](),:;]/;a.languages.php={delimiter:{pattern:/\?>$|^<\?(?:php(?=\s)|=)?/i,alias:"important"},comment:e,variable:/\$+(?:\w+\b|(?={))/i,package:{pattern:/(namespace\s+|use\s+(?:function\s+)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,lookbehind:!0,inside:{punctuation:/\\/}},"class-name-definition":{pattern:/(\b(?:class|enum|interface|trait)\s+)\b[a-z_]\w*(?!\\)\b/i,lookbehind:!0,alias:"class-name"},"function-definition":{pattern:/(\bfunction\s+)[a-z_]\w*(?=\s*\()/i,lookbehind:!0,alias:"function"},keyword:[{pattern:/(\(\s*)\b(?:bool|boolean|int|integer|float|string|object|array)\b(?=\s*\))/i,alias:"type-casting",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)\b(?:bool|int|float|string|object|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*[\w|]\|\s*)(?:null|false)\b(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|self|static|callable|iterable|(?:null|false)(?=\s*\|))\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?[\w|]\|\s*)(?:null|false)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/\b(?:bool|int|float|string|object|void|array(?!\s*\()|mixed|iterable|(?:null|false)(?=\s*\|))\b/i,alias:"type-declaration",greedy:!0},{pattern:/(\|\s*)(?:null|false)\b/i,alias:"type-declaration",greedy:!0,lookbehind:!0},{pattern:/\b(?:parent|self|static)(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(\byield\s+)from\b/i,lookbehind:!0},/\bclass\b/i,{pattern:/((?:^|[^\s>:]|(?:^|[^-])>|(?:^|[^:]):)\s*)\b(?:__halt_compiler|abstract|and|array|as|break|callable|case|catch|clone|const|continue|declare|default|die|do|echo|else|elseif|empty|enddeclare|endfor|endforeach|endif|endswitch|endwhile|enum|eval|exit|extends|final|finally|fn|for|foreach|function|global|goto|if|implements|include|include_once|instanceof|insteadof|interface|isset|list|namespace|match|new|or|parent|print|private|protected|public|require|require_once|return|self|static|switch|throw|trait|try|unset|use|var|while|xor|yield)\b/i,lookbehind:!0}],"argument-name":{pattern:/([(,]\s+)\b[a-z_]\w*(?=\s*:(?!:))/i,lookbehind:!0},"class-name":[{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self|\s+static))\s+|\bcatch\s*\()\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/(\|\s*)\b[a-z_]\w*(?!\\)\b/i,greedy:!0,lookbehind:!0},{pattern:/\b[a-z_]\w*(?!\\)\b(?=\s*\|)/i,greedy:!0},{pattern:/(\|\s*)(?:\\?\b[a-z_]\w*)+\b/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(?:\\?\b[a-z_]\w*)+\b(?=\s*\|)/i,alias:"class-name-fully-qualified",greedy:!0,inside:{punctuation:/\\/}},{pattern:/(\b(?:extends|implements|instanceof|new(?!\s+self\b|\s+static\b))\s+|\bcatch\s*\()(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:"class-name-fully-qualified",greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*\$)/i,alias:"type-declaration",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-declaration"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/\b[a-z_]\w*(?=\s*::)/i,alias:"static-context",greedy:!0},{pattern:/(?:\\?\b[a-z_]\w*)+(?=\s*::)/i,alias:["class-name-fully-qualified","static-context"],greedy:!0,inside:{punctuation:/\\/}},{pattern:/([(,?]\s*)[a-z_]\w*(?=\s*\$)/i,alias:"type-hint",greedy:!0,lookbehind:!0},{pattern:/([(,?]\s*)(?:\\?\b[a-z_]\w*)+(?=\s*\$)/i,alias:["class-name-fully-qualified","type-hint"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}},{pattern:/(\)\s*:\s*(?:\?\s*)?)\b[a-z_]\w*(?!\\)\b/i,alias:"return-type",greedy:!0,lookbehind:!0},{pattern:/(\)\s*:\s*(?:\?\s*)?)(?:\\?\b[a-z_]\w*)+\b(?!\\)/i,alias:["class-name-fully-qualified","return-type"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,function:{pattern:/(^|[^\\\w])\\?[a-z_](?:[\w\\]*\w)?(?=\s*\()/i,lookbehind:!0,inside:{punctuation:/\\/}},property:{pattern:/(->\s*)\w+/,lookbehind:!0},number:i,operator:n,punctuation:s};var l={pattern:/{\$(?:{(?:{[^{}]+}|[^{}]+)}|[^{}])+}|(^|[^\\{])\$+(?:\w+(?:\[[^\r\n\[\]]+\]|->\w+)?)/,lookbehind:!0,inside:a.languages.php},r=[{pattern:/<<<'([^']+)'[\r\n](?:.*[\r\n])*?\1;/,alias:"nowdoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<'[^']+'|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<'?|[';]$/}}}},{pattern:/<<<(?:"([^"]+)"[\r\n](?:.*[\r\n])*?\1;|([a-z_]\w*)[\r\n](?:.*[\r\n])*?\2;)/i,alias:"heredoc-string",greedy:!0,inside:{delimiter:{pattern:/^<<<(?:"[^"]+"|[a-z_]\w*)|[a-z_]\w*;$/i,alias:"symbol",inside:{punctuation:/^<<<"?|[";]$/}},interpolation:l}},{pattern:/`(?:\\[\s\S]|[^\\`])*`/,alias:"backtick-quoted-string",greedy:!0},{pattern:/'(?:\\[\s\S]|[^\\'])*'/,alias:"single-quoted-string",greedy:!0},{pattern:/"(?:\\[\s\S]|[^\\"])*"/,alias:"double-quoted-string",greedy:!0,inside:{interpolation:l}}];a.languages.insertBefore("php","variable",{string:r,attribute:{pattern:/#\[(?:[^"'\/#]|\/(?![*/])|\/\/.*$|#(?!\[).*$|\/\*(?:[^*]|\*(?!\/))*\*\/|"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*')+\](?=\s*[a-z$#])/im,greedy:!0,inside:{"attribute-content":{pattern:/^(#\[)[\s\S]+(?=]$)/,lookbehind:!0,inside:{comment:e,string:r,"attribute-class-name":[{pattern:/([^:]|^)\b[a-z_]\w*(?!\\)\b/i,alias:"class-name",greedy:!0,lookbehind:!0},{pattern:/([^:]|^)(?:\\?\b[a-z_]\w*)+/i,alias:["class-name","class-name-fully-qualified"],greedy:!0,lookbehind:!0,inside:{punctuation:/\\/}}],constant:t,number:i,operator:n,punctuation:s}},delimiter:{pattern:/^#\[|]$/,alias:"punctuation"}}}}),a.hooks.add("before-tokenize",function(e){if(/<\?/.test(e.code)){a.languages["markup-templating"].buildPlaceholders(e,"php",/<\?(?:[^"'/#]|\/(?![*/])|("|')(?:\\[\s\S]|(?!\1)[^\\])*\1|(?:\/\/|#(?!\[))(?:[^?\n\r]|\?(?!>))*(?=$|\?>|[\r\n])|#\[|\/\*(?:[^*]|\*(?!\/))*(?:\*\/|$))*?(?:\?>|$)/gi)}}),a.hooks.add("after-tokenize",function(e){a.languages["markup-templating"].tokenizePlaceholders(e,"php")})}(Prism);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/book.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,55 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>Книга</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+        <style>
+        </style>
+    </head>
+
+    <body>
+        <main>
+
+            <h1>Книга</h1>
+            
+            <h2>Введение</h2>
+
+            <p>Описание алгоритмов работы CMS, чтобы было понятно как писать код для нее и модифицировать.</p>
+
+            <h2>Настройки CMS</h2>
+
+            <p>
+                Все настройки хранятся в файле .cms/config.php.
+                Он создается при установке.
+                Для каждого модуля имеется отдельный подмассив с именем этого модуля.
+                Такой подход позволяет быстро их загружать, независимо от наличия соединения с базой данных.
+                Кроме того PHP умеет кешировать opcache.enable=1 в php.ini и файл находится в памяти в откомпилированном виде.
+                При сохранении его на диск вызывается функция opcache_invalidate()
+                которая заставит PHP перечитать файл при следующем его включении.
+            </p>
+
+            <h2>Структура папок</h2>
+
+            <p>
+                Все файлы CMS хранятся в папке .cms что позволяет в корне сайта размещать что угодно,
+                в том числе и сгенерированные страницы.
+                И последующее к ним обращение из браузера не запускает CMS.
+                Файлы отдаются с диска веб-сервером.
+            </p>
+            <p>
+                Файлы и папки начинающиеся на точку считаются скрытыми и прямой доступ к ним запрещен.
+                Но веб-сервер, через файл .htaccess, настраивается так, что всегда обращается к файлу .cms/index.php.
+                Если приходит запрос /mytpl/css/style.css, то идет попытка найти файл .cms/mytpl/css/style.css,
+                и если он есть то он копируется в корневую папку по пути указанному в запросе и отдается браузеру.
+                Если на диске уже имеется такой файл, то он не перезаписывается.
+                Единственная тут странность в том, что если файл был на диске, то такого запроса к CMS быть не может.
+            </p>
+        
+        </main>
+    <script src=/man/js/prism.js></script>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/codemirror.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,54 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>Справка по редактору Codemirror</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+        <style>
+            .codemirror-keys {
+                display: grid;
+                grid-template-columns: max-content  auto;
+                column-gap: 0.5cm;
+                row-gap: 0.3cm;
+            }
+            .codemirror-keys kbd {
+                display: inline-block;
+                background-color: white;
+                padding: 3px 7px 3px 7px;
+                border-radius: 2px;
+                border: 1px solid #7e7e7e;
+            }
+            .codemirror-keys > div > span {
+                display: inline-block;
+                padding: 3px 7px 3px 7px;
+                border-radius: 2px;
+                border: 1px solid transparent;
+            }
+
+        </style>
+    </head>
+
+    <body>
+        <main>
+
+            <h2>Codemirror</h2>
+
+            <p>Редактор текстов страниц называется Codemirror и ознакомиться с полным его функционалом можно в официальной документации <a target=_blank href="https://codemirror.net/5/doc/manual.html">https://codemirror.net/5/doc/manual.html</a></p>
+
+            <h2>Комбинации клавиш</h2>
+
+            <div class="codemirror-keys">
+                <div><kbd>Ctrl</kbd> + <kbd>F</kbd></div>                    <div><span>Поиск</span></div>
+                <div><kbd>Ctrl</kbd> + <kbd>G</kbd></div>                    <div><span>Искать следующее вхождение</span></div>
+                <div><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>G</kbd></div> <div><span>Искать предыдущее вхождение</span></div>
+                <div><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd></div> <div><span>Заменить</span></div>
+                <div><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>R</kbd></div> <div><span>Заменить все</span></div>
+            </div>
+
+        </main>
+        <script src=/man/js/prism.js></script>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/example.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,28 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>Заголовок вкладки</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+        <style>
+
+        </style>
+    </head>
+    <body>
+        <main>
+
+            <h1>Главный Заголовок</h1>
+            
+            <h2>Подзаголовок</h2>
+
+            <p>Пример кода</p>
+
+            <pre class=language-php><code></code></pre>
+
+        </main>
+        <script src=/man/js/prism.js></script>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/hint_css.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,49 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>CSS сниппеты</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+        <style>
+
+        </style>
+    </head>
+    <body>
+        <main>
+
+            <h2>Подключение шрифтов</h2>
+
+            <p>Если нижеприведенного кода мало, то больше опций можно найти в <a href="https://developer.mozilla.org/ru/docs/Web/CSS/@font-face" target=_blank>MDN</a>.</p>
+
+            <pre class=language-css><code>/* latin */
+@font-face {
+    font-family: 'Open Sans';
+    src: local("Open Sans"),
+         url(/template/open-sans-lat.woff) format('woff'),
+         url(/template/open-sans-lat.woff2) format('woff2');
+    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
+}
+
+/* cyrillic */
+@font-face {
+    font-family: 'Open Sans';
+    src: local("Open Sans"),
+         url(/template/open-sans-cyr.woff) format('woff'),
+         url(/template/open-sans-cyr.woff2) format('woff2');
+    unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
+}</code></pre>
+
+            <h2>Определение переменных</h2>
+
+            <pre class=language-css><code>:root {
+    --sans-serif: system-ui, sans-serif;
+    --monospace: "consolas", monospace;
+}</code></pre>
+
+        </main>
+        <script src=/man/js/prism.js></script>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/hint_html.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,26 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>HTML сниппеты</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+        <style>
+
+        </style>
+    </head>
+    <body>
+        <main>
+
+            <h2>Заголовок</h2>
+
+            <p>Пример кода</p>
+
+            <pre class=language-html><code></code></pre>
+
+        </main>
+        <script src=/man/js/prism.js></script>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/hint_php.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,34 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>PHP сниппеты</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+        <style>
+
+        </style>
+    </head>
+    <body>
+        <main>
+
+            <h2>Переключение шаблона по url страницы</h2>
+
+            <p>Внутри папки вашего текущего шаблона создайте файлик change_tpl.mod.php со следующим содержимым:</p>
+
+            <pre class=language-php><code>&lt;?php
+// Переключение шаблона в зависимости от url
+// Страница с url равным tpl_mini_tururu переключит на шаблон mini
+// Страница с url равным tpl_craft_tururu переключит на шаблон craft
+// где tururu - дополнительный адрес
+// чтобы можно было его применить к нескольким страницам
+// tpl_mini и tpl_mini_ тоже валидны
+$parts = explode( "_", $cms["url"]["path"] );
+if ( $parts[0] === "tpl" && isset( $parts[1] ) ) $cms["template"] = $parts[1];</code></pre>
+
+        </main>
+        <script src=/man/js/prism.js></script>
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/man/ru_RU.UTF-8/menu.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,54 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>Заготовки для шаблона</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="/man/css/prism.css">
+        <link rel="stylesheet" href="/man/css/styles.css">
+    </head>
+
+    <body>
+        <main>
+
+            <h2>Хуки</h2>
+
+            <p><code>menu_item_link</code> - замена пункта меню на момент когда сформирована ссылка.</p>
+            <p><code>menu_item</code> - пункт меню завернут в тег &lt;li> со ссылкой и подпунктами.</p>
+
+            <h2>Хук menu_item_link</h2>
+
+            <p>Модуль Меню позволяет изменить разметку пунктов меню благодаря хуку menu_item_link.
+            Он происходит после формирования ссылки. В переменную $cms помещаются данные.</p>
+
+<pre class="language-php"><code>$cms["menu.mod.php"]["item_link"] = array(
+    "link" => $link,
+    "has_submenu" => $has_submenu,
+);
+do_hook( "menu_item_link" );</code></pre>
+
+            <p>Создайте внутри вашего шаблона файл с именем tpl.mod.php с нижеприведенным содержимым.
+                По сути это модуль к CMS внутри вашего шаблона.
+            </p>
+
+<pre class="language-php"><code>hook_add_fn( "menu_item_link", "tpl_menu_item_link" );
+
+function tpl_menu_item_link() {
+    global $cms;
+
+    if ( $cms["menu.mod.php"]["item_link"]["has_submenu"] ) {
+        $cms["menu.mod.php"]["item_link"]["link"] = "
+            &lt;div class=plus>
+                {$cms['menu.mod.php']['item_link']['link']}
+                &lt;div class=icon>&lt;/div>
+            &lt;/div>";
+    }
+}</code></pre>
+
+            <p>При этом учитывайте что имя функции должно быть уникальным.</p>
+
+        </main>
+        <script src=/man/js/prism.js></script>
+    </body>
+</html>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/404.en_US.UTF-8.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,4 @@
+<main>
+    <h1 class="posttop">Error 404</h1>
+    <p>Perhaps the address is incorrectly typed, or such a page no longer exists, or perhaps never existed. </p>
+</main>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/404.ru_RU.UTF-8.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,4 @@
+<main>
+    <h1>Ошибка 404</h1>
+    <p>Возможно неправильно набран адрес или такой страницы больше не существует, а возможно, никогда не существовало.</p>
+</main>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/404.uk_UA.UTF-8.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,4 @@
+<main>
+    <h1>Помилка 404</h1>
+    <p>Можливо неправильно набраний адресу або такої сторінки більше не існує, а можливо, ніколи не існувало. </p>
+</main>
\ No newline at end of file
Binary file .cms/mini/banner.jpg has changed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/blog.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,90 @@
+<main>
+    <?php
+    $date = date( 'Y-m-d H:i:s' );
+    $q = "SELECT * FROM pages WHERE tpl = 'post' AND `created`<'{$date}' AND published ORDER BY `created` DESC";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+
+        $html = "";
+        $n = 12;
+
+        while ( $n-- > 0 && $page = mysqli_fetch_assoc( $res ) ) {
+
+            if ( preg_match( '/<img[^>]+data-preview[^>]*>/us', $page['text'], $m ) ) {
+                $preview_img = $m[0];
+            } else {
+                $preview_img = '';
+            }
+
+            if ( preg_match( '/^(.*)(<!--[\s]*preview-start[\s]*-->)(.*)(<!--[\s]*preview-end[\s]*-->)(.*)$/us', $page['text'], $m ) ) {
+                $preview = $m[3];
+            } else {
+                $preview = preg_replace( "/<h1>(.*?)<\/h1>/su", "", $page['text'] );
+                $preview = preg_replace( "/<style>(.*?)<\/style>/su", "", $preview );
+                $preview = trim( $preview );
+                $preview = mb_substr( strip_tags( $preview ), 0, 500 );
+                $preview = preg_replace( '/\s\S*$/u', ' ...', $preview );
+                $preview = "<p>{$preview}</p>";
+            }
+
+            $html .= "
+            <article data-date='{$page['created']}'>
+                {$preview_img}
+                <h2><a href='{$page['url']}' target=_blank>{$page['title']}</a></h2>
+                {$preview}
+            </article>
+            ";
+
+        }
+
+        echo $html;
+        // Показать кнопку "Загрузить еще" если есть посты
+        if ( $page = mysqli_fetch_assoc( $res ) ) {
+            $tpl = $cms["config"]["template.mod.php"]["template"];
+            echo "<button class=load-more>" . __( "load_more", $tpl ) . "</button>";
+        }
+
+    }
+?>
+<script>
+    document.addEventListener( "DOMContentLoaded", function( event ) {
+        let main = document.querySelector( "body > main" );
+        function load_more() {
+            let more = document.querySelector( `button[class="load-more"]` );
+            if ( more ) more.addEventListener( "click", function( el ) {
+                let last_el = this.previousElementSibling;
+                let last = last_el.getAttribute( "data-date" );
+                api( { last: last }, function( html ) {
+                    more.remove();
+                    main.insertAdjacentHTML( "beforeend", html );
+                    load_more();
+                } );
+            } );
+        }
+        load_more();
+
+        function api( data, rfn ) {
+            const formData = new FormData();
+            buildFormData( formData, data );
+            let ajax = new XMLHttpRequest();
+            ajax.addEventListener( "load", function( event ) {
+                rfn( event.target.responseText );
+            } );
+            ajax.addEventListener( "error", function( event ) {
+                console.log( event );
+            } );
+            ajax.open( "POST", "<?php echo $cms["base_path"]; ?>get_posts" );
+            ajax.send( formData );
+        }
+        function buildFormData( formData, data, parentKey ) {
+            if ( data && typeof data === 'object' && ! ( data instanceof Date ) && ! ( data instanceof File ) ) {
+                Object.keys( data ).forEach( key => {
+                    buildFormData( formData, data[key], parentKey ? `${parentKey}[${key}]` : key );
+                } );
+            } else {
+                const value = data == null ? '' : data;
+                formData.append( parentKey, value );
+            }
+        }
+    } );
+</script>
+</main>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/favicon.svg	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<svg id="s_1" data-name="s 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 332 332"><defs><style>.cls-1{fill:#534741;}</style></defs><path class="cls-1" d="M167,51A116,116,0,1,1,85,85a115.22,115.22,0,0,1,82-34m0-50A166,166,0,1,0,333,167,166,166,0,0,0,167,1Z" transform="translate(-1 -1)"/></svg>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/frontpage.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,18 @@
+<main>
+<?php
+    echo $cms["page"]["text"];
+
+    $date = date( 'Y-m-d H:i:s' );
+    $q = "SELECT * FROM pages WHERE tpl = 'post' AND `created` < '{$date}' ORDER BY id DESC LIMIT 6";
+
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+
+        while ( $page = mysqli_fetch_assoc( $res ) ) {
+
+            include( dirname( __FILE__ ) . "/page.teaser.php" );
+
+        }
+
+    }
+?>
+</main>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/html.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,173 @@
+<?php
+// Пример кода для мультиязычного сайта
+// switch ( substr( $cms["url"]["path"], 0, 3 ) ) {
+//     case "en/":
+//         $cms["config"]["lang"] = "en";
+//         $cms["config"]["locale"] = "en_US.UTF-8";
+//     break;
+//     case "ru/":
+//         $cms["config"]["lang"] = "ru";
+//         $cms["config"]["locale"] = "ru_RU.UTF-8";
+//     break;
+//     case "uk/":
+//         $cms["config"]["lang"] = "uk";
+//         $cms["config"]["locale"] = "uk_UA.UTF-8";
+//     break;
+// }
+?>
+<!doctype html>
+<html lang="<?php echo $cms["config"]["lang"]; ?>">
+<head>
+<meta charset="utf-8">
+<?php $rss_title = __( "tpl_rss_title", "rss.mod.php" ) . " {$cms['url']['host']}"; ?>
+<?php $rss_url = "{$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}rss.xml"; ?>
+<link rel="alternate" type="application/rss+xml" title="<?php echo $rss_title; ?>" href="<?php echo $rss_url; ?>">
+<?php if ( ! empty( $cms["page"]["seo_title"] ) ) { print "<title>{$cms["page"]["seo_title"]}</title>\n"; } elseif ( ! empty( $cms["page"]["title"] ) ) { print "<title>{$cms["page"]["title"]}</title>\n"; } ?>
+<meta name="viewport" content="width=device-width, initial-scale=1.0">
+<?php if ( ! empty( $cms["page"]["description"] ) ) { echo '<meta name="description" content="' . htmlspecialchars( $cms["page"]["description"] ) . "\">\n"; } ?>
+<link rel="icon" href="<?php echo $cms["base_path"] . $cms["template"]; ?>/favicon.svg" type="image/svg+xml">
+<style>
+<?php echo file_get_contents( dirname( __FILE__ ) . "/styles.css" ); ?>
+</style>
+</head>
+
+<?php
+    if ( empty( $cms["page"]["id"] ) ) {
+        $tpl_name = "page-404";
+        $id       = "page-404";
+    } else {
+        $tpl_name = str_replace( ".", "-", $cms["page"]["tpl"] );
+        $id       = $tpl_name . "-" . $cms["page"]["id"];
+    }
+?>
+<body id="<?php echo $id; ?>" class="<?php echo $tpl_name; ?>">
+     <header>
+        <div class="header-content">
+            <div class="lrtop">
+                <div class="button-mobimenu-container">
+                    <div class="menu-icon">
+                        <span class="line-1"></span>
+                        <span class="line-2"></span>
+                    </div>
+                </div>
+            </div>
+
+            <div class="logo">
+                <a href="<?php echo $cms["base_path"]; ?>">&lt;/mini&gt;</a>
+            </div>
+
+            <div class="lrtop">
+                <div class="icons-container">
+                    <div class="phone-number-container">
+                        <a title="Телефон" href="tel:+77777777777">+7 777 777 7777</a>
+                    </div>
+
+                    <div class="icon-box">
+                        <a href="tel:+77777777777" aria-label="Телефон"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 23.96 23.96"><defs><style>.a-phone{fill:none;stroke:#00ab00;stroke-miterlimit:10;stroke-width:1.7px;}.b-phone{fill:#00ab00;}</style></defs><circle class="a-phone" cx="11.98" cy="11.98" r="11.13"/><path class="b-phone" d="M5.23,15.65V17a1.46,1.46,0,0,0,1.52,1.37A12.41,12.41,0,0,0,18.41,6.75v-.1A1.46,1.46,0,0,0,17,5.23H15.7a1.46,1.46,0,0,0-1.43,1.3L14,8.37a1.49,1.49,0,0,0,.42,1.22l1.35,1.35a11.05,11.05,0,0,1-4.83,4.83L9.59,14.43A1.48,1.48,0,0,0,8.38,14l-1.86.21A1.47,1.47,0,0,0,5.23,15.65Z" transform="translate(0.15 0.15)"/></svg></a>
+                    </div>
+
+                    <div class="icon-whatsapp-box">
+                        <a title="WhatsApp" target="_blank" href="https://wa.me/+77777777777">
+                            <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 361.74"><defs><style>.a-whatsapp{fill:#25d366;fill-rule:evenodd;}</style></defs><path class="a-whatsapp" d="M307.55,52.57A178,178,0,0,0,180.76,0C82,0,1.54,80.4,1.5,179.24a179,179,0,0,0,23.93,89.6L0,361.74l95-24.93a179,179,0,0,0,85.66,21.82h.08c98.78,0,179.21-80.42,179.24-179.25A178.16,178.16,0,0,0,307.55,52.57ZM180.76,328.35h-.06a148.76,148.76,0,0,1-75.84-20.76l-5.44-3.23L43,319.15l15-55-3.54-5.64a148.59,148.59,0,0,1-22.77-79.29c0-82.14,66.86-149,149-149A149,149,0,0,1,329.74,179.36c0,82.15-66.87,149-149,149Zm81.72-111.57c-4.48-2.25-26.5-13.08-30.61-14.57s-7.09-2.24-10.07,2.24S210.23,219,207.62,222s-5.23,3.36-9.71,1.12-18.91-7-36-22.23c-13.31-11.88-22.3-26.54-24.91-31s-.28-6.92,2-9.14c2-2,4.48-5.23,6.72-7.85s3-4.48,4.48-7.47.75-5.6-.37-7.84S139.69,113.29,136,104.32c-3.63-8.73-7.33-7.54-10.07-7.69s-5.6-.15-8.59-.15a16.4,16.4,0,0,0-11.94,5.6c-4.11,4.49-15.68,15.32-15.68,37.36s16,43.35,18.29,46.34,31.58,48.22,76.51,67.63A260.34,260.34,0,0,0,210,262.85a61.27,61.27,0,0,0,28.21,1.77c8.61-1.29,26.5-10.83,30.23-21.29s3.73-19.44,2.61-21.3-4.1-3-8.58-5.24Z"/></svg></a>
+                    </div>
+
+                    <div class="icon-tg-box">
+                        <a title="Telegram" target="_blank" href="https://t.me/+77777777777"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1000 1000"><defs><style>.a-tg{fill:url(#a);}.b-tg{fill:#fff;fill-rule:evenodd;}</style><linearGradient id="a" x1="111.39" y1="888.11" x2="111.39" y2="887.12" gradientTransform="matrix(1000, 0, 0, -1000, -110889, 888111)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="#2aabee"/><stop offset="1" stop-color="#229ed9"/></linearGradient></defs><circle class="a-tg" cx="500" cy="500" r="500"/><path class="b-tg" d="M226.33,494.72Q445,399.47,517.92,369.12C656.77,311.37,685.63,301.33,704.43,301c4.14-.07,13.39,1,19.38,5.82,5.05,4.1,6.45,9.65,7.11,13.54a87.82,87.82,0,0,1,.84,19.68C724.23,419.1,691.68,611,675.11,699.52c-7,37.46-20.81,50-34.17,51.26-29,2.67-51.08-19.19-79.21-37.63-44-28.84-68.86-46.8-111.58-74.95-49.37-32.53-17.36-50.41,10.77-79.63,7.36-7.65,135.3-124,137.77-134.57.31-1.32.6-6.24-2.33-8.84s-7.23-1.71-10.35-1q-6.62,1.5-210.9,139.4-29.94,20.55-54.22,20c-17.86-.39-52.2-10.1-77.73-18.4-31.31-10.18-56.2-15.56-54-32.84Q190.83,508.84,226.33,494.72Z"/></svg></a>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </header>
+
+    <nav>
+        <?php
+        // Пример кода для мультиязычного сайта
+        // switch ( substr( $cms["url"]["path"], 0, 3 ) ) {
+        //     case "en/":
+        //         echo menu( "header_en" );
+        //     break;
+        //     case "ru/":
+        //         echo menu( "header_ru" );
+        //     break;
+        //     case "uk/":
+        //         echo menu( "header_uk" );
+        //     break;
+        //     default:
+        //         echo menu( "header" );
+        //     break;
+        // }
+        echo menu( "header" );
+        ?>
+    </nav>
+
+    <?php
+        $f = dirname( __FILE__ ) . "/{$cms['page']['tpl']}.php";
+        if ( $cms["status"] === "404" ) {
+            $text = "";
+            if ( isset( $cms["page"]["text"] ) )
+                $text = trim( preg_replace( "/<!--.*?-->/u", "", $cms["page"]["text"] ) );
+            if ( ! empty( $text ) && is_admin() ) {
+                if ( is_file( $f ) ) {
+                    include( $f );
+                }
+            } else {
+                $f404 = dirname( __FILE__ ) . "/404.{$cms['config']['locale']}.php";
+                if ( is_file( $f404 ) ) {
+                    include( $f404 );
+                } else {
+                    include( dirname( __FILE__ ) . "/404.en_US.UTF-8.php" );
+                }
+            }
+        } else {
+            if ( is_file( $f ) ) {
+                include( $f );
+            }
+        }
+    ?>
+
+    <footer>
+        <div class="footer-content">
+            <div class="left-footer">
+                <?php echo menu( "footer" ); ?>
+                <div class="copyright">Powered by <a target="_blank" href="https://coffee-cms.ru/">Coffee CMS</a></div>
+            </div>
+            <div class="right-footer">
+                <div><!--Your Code ;)--></div>
+            </div>
+        </div>
+    </footer>
+
+    <aside>
+        <?php echo menu( "side" ); ?>
+        <?php echo dyn_menu( "side" ); ?>
+    </aside>
+    <div class="bg-reset"></div>
+    
+    <script>
+        document.addEventListener( "DOMContentLoaded", function( event ) {
+            let toggle_btns = document.querySelectorAll( ".button-mobimenu-container, .bg-reset, aside li" );
+            toggle_btns.forEach( function( toggle_btn ) {
+                toggle_btn.addEventListener( "click", function() {
+                    document.body.classList.toggle( "mobile-menu-open" );
+                } );
+            } );
+        } );
+
+        document.querySelectorAll( "img.lbox" ).forEach( function( img ) {
+            img.addEventListener( "click", function () {
+                if ( document.querySelector( "#lbox-window" ) == null ) {
+                    let img = document.createElement( "img" );
+                    img.src = this.getAttribute( "src" );
+                    let div = document.createElement( "div" );
+                    div.id = "lbox-window";
+                    div.appendChild( img );
+                    document.body.appendChild( div );
+                    div.addEventListener( "click", function( e ) {
+                        this.remove();
+                    } );
+                }
+            } );
+        } );
+    </script>
+</body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/instruction.ru_RU.UTF-8.html	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,179 @@
+<!doctype html>
+<html lang="ru">
+
+    <head>
+        <meta charset="utf-8">
+        <title>Заготовки для шаблона</title>
+        <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
+        <link rel="stylesheet" href="styles.css">
+        <style>
+            /*Инструкция использует css стили темы сайта, а прописанные стили ниже дополняют оформление только для инструкции*/
+            body {grid-template-areas: unset; grid-template-rows: unset; align-content: start; padding: 0 0 2rem 0;}
+            main {grid-area: unset; padding: 0;}
+            main:first-child {padding-bottom: 2rem;}
+            main > h2 {margin-bottom: 1rem;}
+            main > p {margin-bottom: 0.5rem;}
+            [data-copy] {justify-self: center; padding: 0.4rem 0.7rem; min-width: 110px;}
+            pre {word-wrap: break-word; word-break: break-all; margin: 0;padding: 0.5rem;}
+            .block-code {display: grid; row-gap: 1rem; padding: 3rem 0; border-bottom: 1px solid #999999;}
+            body > main:first-child {border-bottom: 1px solid #999999; padding-top: 2rem;}
+            main .code {overflow-x: auto; background-color: white;}
+        </style>
+    </head>
+
+    <body>
+
+        <main>
+            <h2>Инструкция по шаблоу mini</h2>
+            <p>Ниже хранятся фрагменты кода для быстрого копирования и вставки. Вы можете дополнить эту инструкцию своими примерами кода через пункт Шаблон, отредактировав файл instruction.ru_RU.UTF-8.html. Но сначала сделайте копию шаблона, иначе из-за измененных файлов не сможете обновлять CMS.</p>
+            <p>Скопированный код вставьте в нужное место страницы, выделите его и выровняйте нажатием сочетания клавиш - [Shit] + [Tab].</p>
+
+            <h2>Как создать свой шаблон</h2>
+            <p>Шаблон mini - это простой стартовый шаблон. Он находится в папке .cms/mini/. Создайте копию этой папки, например, с названием .cms/mini2/, переключитесь на шаблон mini2 и уже в этой папке изменяйте файлы под себя. Если же вы будете править файлы в оригинальном шаблоне, то CMS потом не сможет обновиться, будет сообщать, что файлы изменены и поэтому она не хочет перезатирать ваши наработки.</p>
+            <h2>Блог</h2>
+            <p>С помощью шаблона mini можно создать блог с бесконечной подгружаемой лентой тизеров статей. Тизер переводится как "приманка", это часть статьи, не обязательно ее начало, которая интригует к прочтению всей статьи. Для этого нужно для одной из страниц, которая будет лентой, задать шаблон blog, а остальным страницам, которые будут статьями в блоге, задать шаблоны post. А внутри постов выделить тизеры с помощью открывающего и закрывающего html-комментария.</p>
+            <pre>&lt;!-- preview-start -->
+&lt;p>тут расположен текст тизера&lt;/p>
+&lt;p>можно с html-тегами, а можно и без&lt;/p>
+&lt;!-- preview-end --></pre>
+            <p>Но если не отметить тизер специально, то будут взяты первые 500 символов статьи, при этом очищается html-разметка. Старайтесь задавать тизеры вручную чтобы они выглядели красиво и заинтересовывали читателей.</p>
+            <h2>Главная</h2>
+            <p>Так же имеется шаблон frontpage, который как и blog выводит тизеры страниц с шаблоном post, но только последние 6 штук. Он подойдет для создания главной страницы которая не должна быть лентой. В этом шаблоне php-код сильно упрощен по сравнению с blog.</p>
+            <h2>Заготовки</h2>
+            <p>Ниже представлены заготовки, которые вы можете использовать для оформления страниц сайта. Выберите нужный вам блок и нажмите кнопку Копировать под ним. Затем вставьте скопированный блок в редактируемую страницу.</p>
+        </main>
+
+
+        <div class="block-code">
+            <main data-example=lbox-example>
+                <img class="lbox" alt="Баннер" src="/mini/banner.jpg" width="1920" height="700">
+            </main>
+            <button data-copy=lbox-example>Копировать</button>
+        </div>
+        
+
+
+        <div class="block-code">
+            <main data-example=banner>
+                <img class="banner" alt="Баннер" src="/mini/banner.jpg" width="1920" height="700">
+            </main>
+            <button data-copy=banner>Копировать</button>
+        </div>
+
+        
+        
+        <div class="block-code">
+            <main data-example=cite>
+                <blockquote>
+                    <p>Только работа дает ответы на все вопросы.</p>
+                    <p class="author">Николай Замяткин</p>
+                </blockquote>
+            </main>
+
+            <button data-copy=cite>Копировать</button>
+        </div>
+
+        <div class="block-code">
+            <main data-example=code>
+                <pre class="ignorgap"><code><p>Заголовок</p>&lt;?php
+$cms['modules']['test.mod.php'] = array(
+    'name'        =&gt; 'Test',
+    'description' =&gt; 'Test module',
+    'url_title'   =&gt; 'Module page',
+    'url_link'    =&gt; 'https://coffee-cms.com/modules/test/',
+    'author'      =&gt; 'Coffee CMS team',
+    'version'     =&gt; '20.04',
+    'files'       =&gt; array(
+        '.cms/mod/test.mod.php',
+    ),
+    'sort'        =&gt; 100,
+);</code></pre>
+            </main>
+
+            <button data-copy=code>Копировать</button>
+        </div>
+
+        
+        
+        <div class="block-code">
+            <main data-example=wpic1>
+                <p>Ниже пример картинки выходящей за ширину текста и описанием за счёт добавления класса wide тегу figure.</p>
+
+                <figure class="wide">
+                    <img alt="" src="/mini/banner.jpg" width="1920" height="700">
+                    <figcaption>Описание изображения</figcaption>
+                </figure>
+            </main>
+
+            <button data-copy=wpic1>Копировать</button>
+        </div>
+
+        <div class="block-code">
+            <main data-example=wpic2>
+                <p>Ниже пример картинки картинки выходящей за ширину текста за счёт добавления ей класса wide</p>
+
+                <img class="wide" alt=""src="/mini/banner.jpg" width="1920" height="700">
+            </main>
+
+            <button data-copy=wpic2>Копировать</button>
+        </div>
+
+
+        <script>
+            document.addEventListener( "DOMContentLoaded", function( event ) {
+
+                document.querySelectorAll( "[data-copy]" ).forEach( function( button ) {
+
+                    button.addEventListener( "click", function( e ) {
+
+                        let html  = document.querySelector( '[data-example="' + button.getAttribute( "data-copy" ) + '"]' ).innerHTML.trim();
+
+                        let textarea = document.querySelector( "[data-for-copy]" );
+                        textarea.style = ""; // делаем видимым чтобы работало копирование
+                        textarea.value = html;
+                        textarea.select();
+                        let ok = document.execCommand( "copy" );
+
+                        let old_text = button.textContent;
+                        if ( ok ) {
+                            button.textContent = "OK";
+                            setTimeout( function() {
+                                button.textContent = old_text;
+                            }, 1000 );
+                        } else {
+                            button.textContent = "Ошибка";
+                            setTimeout( function() {
+                                button.textContent = old_text;
+                            }, 1000 );
+                        }
+                        textarea.style.display = "none";
+
+                    } );
+
+                } );
+
+            } );
+
+            document.querySelectorAll( "img.lbox" ).forEach( function( img ) {
+                img.addEventListener( "click", function () {
+                    if ( document.querySelector( "#lbox-window" ) == null ) {
+                        let img = document.createElement( "img" );
+                        img.src = this.getAttribute( "src" );
+                        let div = document.createElement( "div" );
+                        div.id = "lbox-window";
+                        div.appendChild( img );
+                        document.body.appendChild( div );
+                        div.addEventListener( "click", function( e ) {
+                            this.remove();
+                        } );
+                    }
+                } );
+            } );
+        </script>
+
+        <div>
+            <textarea data-for-copy style="display: none;"></textarea>
+        </div>
+
+    </body>
+</html>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/page.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,3 @@
+<main>
+    <?php echo $cms["page"]["text"]; ?>
+</main>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/page.teaser.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,23 @@
+<?php
+
+if ( preg_match( '/<img[^>]+data-preview[^>]*>/us', $page['text'], $m ) ) {
+    $preview_img = $m[0];
+} else {
+    $preview_img = '';
+}
+
+if ( preg_match( '/^(.*)(<!--[\s]*preview-start[\s]*-->)(.*)(<!--[\s]*preview-end[\s]*-->)(.*)$/us', $page['text'], $m ) ) {
+    $preview = $m[3];
+} else {
+    $preview = preg_replace( "/<h1>(.*?)<\/h1>/u", "", $page['text'] );
+    $preview = mb_substr( trim( strip_tags( $preview ) ), 0, 500 );
+    $preview = preg_replace( '/\s\S*$/u', ' ...', $preview );
+    $preview = "<p>{$preview}</p>";
+}
+
+echo "
+<div class=teaser>
+<h2><a href='{$cms['base_path']}{$page['url']}'>{$page['title']}</a></h2>
+{$preview}
+</div>
+";
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/post.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,3 @@
+<main>
+    <?php echo $cms["page"]["text"]; ?>
+</main>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/styles.css	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,836 @@
+body {
+    min-height: 100vh;
+    margin: 0;
+    font-size: 1rem;
+    font-family: var(--sans-serif);
+    font-weight: 400;
+    color: #111111;
+    text-align: left;
+    background-color: #f7f7f7;
+}
+
+:root {
+    --sans-serif: system-ui, sans-serif;
+    --monospace: "consolas", monospace;
+}
+:root {
+    scroll-behavior: smooth
+}
+
+*, 
+*::before,
+*::after {
+    box-sizing: border-box;
+}
+
+img, video {
+    max-width: 100%;
+    display: block;
+    height: auto;
+}
+
+/* Template Mini */
+body {
+    display: grid;
+    grid-template-areas:
+        "header"
+        "nav"
+        "main"
+        "footer";
+    grid-template-rows: 3.7rem auto 1fr auto;
+}
+
+header {
+    grid-area: header;
+    display: grid;
+    grid-template-columns: 1fr minmax(auto,80rem) 1fr;
+    min-width: 100%;
+    background-color: #ffffff;
+    position: fixed;
+    left: 0;
+    right: 0;
+    z-index: 999;
+    box-shadow: 0 2px 6px 0 #0000001f, inset 0 -1px 0 0 #dadce0;
+}
+@media (max-width: 767px) {
+    header {
+        column-gap: 0;
+    }
+}
+@media (min-width: 768px) {
+    header {
+        column-gap: 0.5rem;
+    }
+}
+
+.header-content {
+    grid-column: 2/3;
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: space-between;
+    position: relative;
+}
+.lrtop {
+    display: grid;
+    align-items: center;
+}
+.logo {
+    position: absolute;
+    left: 50%;
+    top: 50%;
+    transform: translate(-50%, -50%);
+}
+.logo a {
+    text-decoration: none;
+    color: #222222;
+    font-size: 1.2rem;
+    line-height: 1;
+    font-family: var(--monospace);
+}
+
+
+
+/* Icon */
+.icons-container {
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: left;
+    align-items: center;
+    position: relative;
+    color: #111111;
+}
+@media (max-width: 767px) {
+    .icons-container {
+        margin-right: 0.3rem;
+    }
+}
+
+.icon-box {
+    position: relative;
+}
+@media (max-width: 374px) {
+    .icon-box {
+        width: 37px;
+        height: 37px;
+    }
+}
+@media (min-width: 375px) {
+    .icon-box {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+.icon-box a {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    padding: 0.3125rem;
+    z-index: 7;
+}
+.icon-box a:hover {
+    background-color: #eaeaea;
+    border-radius: 50%;
+    color: green;
+}
+
+
+/*Icon Phone*/
+.phone-number-container {
+    position: relative;
+    color: #111111;
+    height: 2.75rem;
+}
+
+.phone-number-container a {
+    padding: 0 3.5625rem 0 1rem;
+    height: 2.75rem;
+    margin-right: -2.75rem;
+    position: relative;
+    z-index: 10;
+    font-size: 1rem;
+    text-decoration: none;
+    color: #111111;
+    display: flex;
+    align-items: center;
+}
+.phone-number-container a:hover {
+    color: #1a73e8;
+}
+.phone-number-container:hover ~ .icon-box {
+    background-color: #f1f1f1;
+    border-radius: 50%;
+}
+
+@media (max-width: 768px) {
+    .phone-number-container {
+        display: none;
+    }
+}
+
+
+.icon-tg-box {
+    position: relative;
+}
+@media (max-width: 374px) {
+    .icon-tg-box {
+        width: 37px;
+        height: 37px;
+    }
+}
+@media (min-width: 375px) {
+    .icon-tg-box {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+.icon-tg-box a {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    padding: 0.3125rem;
+    z-index: 7;
+}
+.icon-tg-box a:hover {
+    background-color: #dff1ff;
+    border-radius: 50%;
+}
+
+
+
+
+.icon-whatsapp-box {
+    position: relative;
+}
+@media (max-width: 374px) {
+    .icon-whatsapp-box {
+        width: 37px;
+        height: 37px;
+    }
+}
+@media (min-width: 375px) {
+    .icon-whatsapp-box {
+        width: 44px;
+        height: 44px;
+    }
+}
+
+.icon-whatsapp-box a {
+    position: absolute;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    padding: 0.3125rem;
+    z-index: 7;
+}
+.icon-whatsapp-box a:hover {
+    background-color: #e0feff;
+    border-radius: 50%;
+}
+
+
+nav {
+    grid-area: nav;
+    display: grid;
+    background-color: #f7f7f7;
+    grid-template-areas: ". gnc .";
+    grid-template-columns: 1fr minmax(auto,80rem) 1fr;
+}
+/*Header Container*/
+nav ul {
+    grid-column: gnc;
+    margin: 0;
+    padding: 0;
+    display: grid;
+    grid-auto-flow: column;
+    justify-content: space-evenly;
+}
+nav li {
+    list-style-type: none;
+}
+nav li a {
+    display: inline-block;
+    line-height: 0;
+    padding: 24px 10px 24px 10px;
+    font-size: 17px;
+    color: #000000;
+    text-decoration: none;
+}
+nav li a:hover {
+    color: #333333;
+}
+nav li.active a {
+    color: #1a73e8;
+}
+/* Active Mobile Display */
+@media (max-width: 768px) {
+    nav ul {
+        display: none;
+    }
+}
+
+
+
+main {
+    grid-area: main;
+    display: grid;
+    grid-template-columns: 1fr minmax(auto,40rem) 1fr;
+    row-gap: 1.4rem;
+    column-gap: 0.5rem;
+    padding-bottom: 3rem;
+    align-content: start;
+}
+main > * {
+    grid-column: 2/3;
+}
+main .ignorgap {
+    grid-column: 1/-1;
+    justify-self: center;
+    max-width: 40rem;
+    margin: 0 auto;
+}
+
+main .gap {
+    grid-column: 1/-1;
+    justify-self: center;
+    max-width: 40rem;
+}
+
+main .banner {
+    max-height: 380px;
+    object-fit: cover;
+    grid-column: 1/-1;
+    justify-self: center;
+}
+main h1 {
+    margin: 0;
+    padding: 0;
+    font-weight: 500;
+    line-height: 1;
+    font-size: calc(1.7rem + 0.7vw);
+    position: relative;
+    display: block;
+}
+main > h1:first-child {
+    margin-top: 2rem;
+}
+
+main h2, main h3, main h4, main h5, main h6 {
+    margin: 0;
+    padding: 0;
+    font-weight: 400;
+    line-height: 1;
+    position: relative;
+}
+main p  {
+    margin: 0;
+    padding: 0;
+    display: block;
+    line-height: 1.4;
+}
+main a  {
+    margin: 0;
+    padding: 0;
+    display: inline;
+    line-height: 1.4;
+    color: #007ce7;
+}
+main pre {
+    margin: 0;
+    width: 100%;
+    word-break: break-all;
+    line-height: 1.4em;
+    display: block;
+    padding: 0.7rem;
+    background-color: #eaeaea;
+}
+main code  {
+    background-color: #eaeaea;
+    font-family: var(--monospace);
+    white-space: pre-wrap;
+}
+main p code  {
+    word-break: break-all;
+}
+main code p  {
+    padding: 0.3rem 0.7rem 0.3rem 0.7rem;
+    margin: -0.7rem -0.7rem 0.3rem -0.7rem;
+    background-color: lightgrey;
+}
+
+main img, main svg, main video, main audio, main source, main blockquote, main figure, main div, main iframe  {
+    margin: 0;
+    padding: 0;
+    position: relative;
+}
+figcaption {
+    text-align: center;
+    background-color: #0000003d;
+    padding: 0.1rem 0.7rem;
+}
+main .wide  {
+    grid-column: 1/-1;
+    justify-self: center;
+}
+
+main ul {
+    margin: 0;
+    padding: 0 0 0 1.2rem;
+    display: block;
+    line-height: 1.4;
+}
+main ol {
+    margin: 0;
+    padding: 0 0 0 1.2rem;
+    display: block;
+    line-height: 1.4;
+}
+
+main blockquote {
+    margin: 0;
+    padding: 0.5rem 0.7rem 0.5rem 0.7rem;
+    background-color: #eaeaea;
+    border-left: 2px solid #acacac;
+}
+main blockquote p {
+    margin-bottom: 0.7rem;
+}
+main blockquote p.author {
+    text-align: right;
+    padding-right: 1rem;
+}
+main blockquote p:last-child {
+    margin-bottom: 0;
+}
+
+main > video {
+    grid-column: 1/-1;
+    margin: 0 auto;
+    max-width: 100%;
+    height: auto;
+}
+
+footer {
+    grid-area: footer;
+    background-color: #111111;
+    display: grid;
+    grid-template-columns: 1fr minmax(auto,80rem) 1fr;
+    column-gap: 0.5rem;
+}
+
+
+.footer-content {
+    grid-column: 2/3;
+    padding: 1rem 0rem;
+    min-height: 3rem;
+    display: grid;
+    gap: 1rem;
+}
+@media (max-width: 374px) {
+    .footer-content {
+        grid-template-columns: 1fr;
+        grid-template-areas:
+            "left-footer"
+            "right-footer";
+    }
+}
+@media (min-width: 375px) {
+    .footer-content {
+        grid-template-columns: 1fr 0.4fr;
+        grid-template-areas:"left-footer right-footer";
+    }
+}
+.left-footer {
+    grid-area: left-footer;
+    display: grid;
+    row-gap: 0.7rem;
+}
+.right-footer {
+    grid-area: right-footer;
+    display: flex;
+    width: 100%;
+    padding: 0.3rem 0;
+    justify-content: center;
+    color: #eeeeee;
+}
+.right-footer div {
+    color: #eeeeee;
+}
+@media (min-width: 375px) {
+    .right-footer {
+        justify-content: flex-end;
+        padding: 0;
+    }
+}
+
+
+
+/*Footer Container*/
+footer ul {
+    display: grid;
+    margin: 0;
+    padding: 0;
+    row-gap: 0.4375rem;
+}
+footer li {
+    list-style-type: none;
+    margin: 0;
+    display: block;
+}
+footer li a {
+    line-height: 1.3;
+    color: #ffffff;
+    text-decoration: none;
+}
+footer li a:hover {
+    color: #ddeeff;
+}
+footer li.active a {
+    color: #ddeeff;
+}
+
+@media (min-width: 768px) {
+    footer ul {
+        display: flex;
+        flex-wrap: wrap;
+        justify-content: left;
+        column-gap: 0.9375rem;
+    }
+}
+
+.copyright {
+    margin: 0;
+    font-size: 0.93rem;
+    color: #cccccc;
+}
+.copyright a {
+    color: #00b8ff;
+    text-decoration: none;
+}
+.copyright a:hover {
+    color: #39c7ff;
+    text-decoration: none;
+}
+
+
+/* Mobile Menu */
+/* Icon Line */
+.button-mobimenu-container {
+    display: grid;
+    justify-content: center;
+    align-content: center;
+    position: relative;
+    width: 3.7rem;
+    height: 3.7rem;
+    cursor: pointer;
+}
+/* Active Mobile Display */
+
+.menu-icon {
+    width: 30px;
+    height: 14px;
+    position: relative;
+    z-index:7;
+}
+
+.menu-icon span {
+    display: block;
+    position: absolute;
+    left: 0;
+    width: 100%;
+    height: 3px;
+    transform: rotate(0);
+    transition: transform 0.1s ease;
+}
+.menu-icon span {
+    background-color: #0d93ff;
+}
+.menu-icon span.line-1 {
+    top: 0;
+}
+.menu-icon span.line-2 {
+    bottom: 0;
+}
+
+.mobile-menu-open .menu-icon span.line-1 {
+    top: 5px;
+    transform: rotate(45deg);
+
+}
+.mobile-menu-open .menu-icon span.line-2 {
+    top: 5px;
+    transform: rotate(-45deg);
+}
+
+/*Mobile Menu Container*/
+
+aside {
+    position: fixed;
+    top: 0;
+    bottom: 0;
+    left: 0;
+    width: calc(100% - 4rem);
+    min-width: 16.875rem;
+    background-color: #ffffff;
+    z-index: 777;
+    transform: translate3d(-100%, 0, 0);
+    transition: opacity 0.25s ease, transform 0.25s ease;
+    padding: 3.7rem 0 0 0;
+    overflow-y: auto;
+    scrollbar-width: none; /*FireFox*/
+}
+.mobile-menu-open aside {
+    transform: translate3d(0, 0, 0);
+    transition: opacity 0.25s ease, transform 0.25s ease;
+}
+
+@media (min-width: 1024px) {
+    aside {
+        width: fit-content;
+        max-width: calc(100% - 4rem);
+    }
+}
+
+aside ul {
+    margin: 0;
+    padding: 0;
+}
+aside > ul {
+    padding-bottom: 1rem;
+}
+aside > ul:not(:first-child) {
+    padding-top: 1rem;
+}
+aside > ul:not(:last-child) {
+    border-bottom: 1px solid #ccc;
+}
+aside li {
+    list-style-type: none;
+    position: relative;
+}
+aside li a {
+    width: 100%;
+    display: block;
+    padding: 13px 17px;
+    color: #111111;
+    text-decoration: none;
+}
+aside li a:hover {
+    color: #1a73e8;
+    background-color: #f7f7f7;
+}
+aside li.active > a {
+    color: #1a73e8;
+    background-color: #f7f7f7;
+}
+
+ul.sub-menu {
+    margin: 0;
+    padding: 0;
+}
+
+aside ul > li > ul > li > a {
+    padding-left: 34px;
+}
+aside ul > li > ul > li > ul > li > a {
+    padding-left: 51px;
+}
+
+
+/*Mobile Menu Reset*/
+.bg-reset {
+    display: none;
+    width: 100%;
+    height: 100%;
+    visibility: visible;
+    position: fixed;
+    left: 0;
+    right: 0;
+    top: 0;
+    bottom: 0;
+    z-index: 700;
+    opacity: 0.7;
+    background-color: #eeeeee;
+}
+.mobile-menu-open .bg-reset {
+    display: block;
+}
+
+
+/*Hot Info*/
+main .hot-scroll {
+    overflow: hidden;
+    grid-column: 1/-1;
+    background-color: #f1f1f1;
+    padding: 2rem 0;
+}
+
+main .hot-scroll ul {
+    display: flex;
+    gap: 1rem;
+    overflow-x: auto;
+    margin: 0;
+    padding: 1rem 0;
+    scroll-behavior: smooth;
+}
+main .hot-scroll ul li {
+    display: block;
+    flex: 0 0 240px;
+    background-color: #ffffff;
+    min-height: 12rem;
+    transition: all .5s ease;
+    border-radius: 0.3rem;
+    overflow: hidden;
+    border: 1px solid #dadada;
+    user-select: none;
+}
+
+main .hot-scroll ul li:hover {
+    box-shadow: 0 2px 6px 0 rgb(0 0 0 / 12%);
+}
+
+main .hot-scroll ul li:first-child {
+    margin-left: calc(50% - 140px);
+}
+@media (min-width: 375px) {
+    main .hot-scroll ul li {
+        flex: 0 0 280px;
+    }
+}
+@media (min-width: 600px) {
+    main .hot-scroll ul li:first-child {
+        margin-left: calc(50% - 290px);
+    }
+}
+@media (min-width: 1024px) {
+    main .hot-scroll ul li {
+        flex: 0 0 440px;
+    }
+    main .hot-scroll ul li:first-child {
+        margin-left: calc(50% - 470px);
+    }
+}
+
+
+main .hot-scroll img {
+    overflow: hidden;
+    max-height: 10rem;
+    object-fit: cover;
+    margin: 0;
+}
+main .hot-scroll .hot-news {
+    padding: 0.6rem 1rem 1.6rem 1rem;
+}
+main .hot-scroll .hot-news h2 {
+    padding: 0;
+    margin: 0 0 0.7rem 0;
+    font-weight: 400;
+    font-size: 1.4rem;
+    color: #111111;
+    display: block;
+    text-decoration: none;
+}
+main .hot-scroll .hot-news p {
+    font-weight: 400;
+    color: #111111;
+    display: block;
+    text-decoration: none;
+}
+main .hot-scroll ul li a {
+    text-decoration: none;
+}
+
+@media (min-width: 1024px) {
+    main .hot-scroll img {
+        max-height: 14rem;
+    }
+    main .hot-scroll .hot-news {
+        padding: 1rem 1.4rem 2rem 1.4rem;
+    }
+    main .hot-scroll .hot-news h2 {
+        font-size: 1.6rem;
+    }
+}
+
+/*ЮMoney*/
+.yoomoney-pay {
+    padding: 0.7rem 1.7rem;
+    border-radius: 0.3rem;
+    border: 0;
+    cursor: pointer; 
+    background-color: #8b3ffd;
+    font-size: 0.9rem;
+    transition: 0.3s;
+    color: #ffffff;
+}
+.yoomoney-pay:hover { 
+    background: #8b3ffd;
+    box-shadow: 0 0 0 0.2em #c3a4ff;
+}
+.yoomoney-form {
+    display: grid;
+    padding: 0.7rem 0.7rem;
+    border-radius: 0.3rem;
+    background-color: white;
+    box-shadow: 0px 3px 7px 0px #00000033;
+    column-gap: 0.7rem;
+}
+.yoomoney-form input[type='email'] {
+    width: 100%;
+    border: 1px solid #777777;
+    border-radius: 0.3rem;
+    padding: 0 0 0 0.5rem;
+    font-size: 1rem;
+    font-weight: 600;
+}
+@media (max-width: 375px) {
+    .yoomoney-form {
+        width: 100%;
+        grid-template-columns: auto;
+        row-gap: 1rem;
+    }
+    .yoomoney-form input[type='email'] {
+        height: 2.4rem;
+    }
+}
+@media (min-width: 376px) {
+    .yoomoney-form {
+        width: fit-content;
+        grid-template-columns: auto auto;
+    }
+}
+/* 
+ul a:not([href]) {
+    display: none;
+}
+ul a:not([href]) + ul {
+    display: none;
+}
+*/
+
+#lbox-window {
+	position: fixed;
+	z-index: 999;
+	cursor: pointer;
+	background-color: #000000dd;
+	display: grid;
+	height: 100vh;
+	width: 100vw;
+	grid-template-areas: "lightbox";
+}
+
+#lbox-window img, #lbox-window video, #lbox-window audio {
+	max-width: 100%;
+	max-height: 100%;
+	box-shadow: 0 3px 7px 0 #0000004d;
+	grid-area: lightbox;
+	align-self: center;
+	justify-self: center;
+	overflow: hidden;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/template.settings.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,96 @@
+<?php
+
+$tpl = $cms["config"]["template.mod.php"]["template"];
+
+// Translate
+$cms["lang"][$tpl]["ru_RU.UTF-8"] = array(
+    "Header"    => "Верхнее",
+    "Footer"    => "Нижнее",
+    "Side"      => "Боковое",
+    "Title"     => "Заголовок",
+    "Paragraph" => "Параграф",
+    "blog"      => "Блог",
+    "frontpage" => "Главная",
+    "page"      => "Страница",
+    "post"      => "Запись блога",
+);
+
+$cms["lang"][$tpl]["uk_UA.UTF-8"] = array(
+    "Header"    => "Верхнє",
+    "Footer"    => "Нижнє",
+    "Side"      => "Бічнє",
+    "Title"     => "Заголовок",
+    "Paragraph" => "Параграф",
+    "blog"      => "Блог",
+    "frontpage" => "Головна",
+    "page"      => "Сторінка",
+    "post"      => "Запис блогу",
+);
+
+// Эта справка вылезет только для шаблона mini.
+// Для копии шаблона она уже не появится.
+if ( $tpl === "mini" ) {
+    // en_US
+    $cms["lang"][$tpl]["en_US.UTF-8"]["help"] = "<p>By changing the \"mini\" template files you will not be able to update the CMS. If you want to update, copy the .cms/mini folder, switch to the template copy and edit the files.</p>";
+    // ru_RU
+    $cms["lang"][$tpl]["ru_RU.UTF-8"]["help"] = "<p>Изменив файлы шаблона mini вы не сможете обновить CMS. Если хотите обновляться, скопируйте папку .cms/mini, переключитесь на копию шаблона и редактируйте файлы.</p>";
+    // uk_UA
+    $cms["lang"][$tpl]["uk_UA.UTF-8"]["help"] = "<p>Змінивши файли шаблону mini, ви не зможете оновити CMS. Якщо хочете оновлюватися, скопіюйте папку .cms/mini, перейдіть на копію шаблону та редагуйте файли.</p>";
+}
+
+// Areas
+$cms["menu_areas"]["header"] = __( "Header",   $tpl );
+$cms["menu_areas"]["footer"] = __( "Footer",   $tpl );
+$cms["menu_areas"]["side"]   = __( "Side",     $tpl );
+
+$cms["menu_areas"]["header_en"] = "Header En";
+$cms["menu_areas"]["header_ru"] = "Header Ru";
+$cms["menu_areas"]["header_uk"] = "Header Uk";
+
+
+// Editable theme files
+$cms["templates"][$tpl]["files"] = array(
+    ".cms/{$tpl}/styles.css",
+    ".cms/{$tpl}/html.php",
+    ".cms/{$tpl}/page.php",
+    ".cms/{$tpl}/post.php",
+    ".cms/{$tpl}/blog.php",
+    ".cms/{$tpl}/frontpage.php",
+    ".cms/{$tpl}/page.teaser.php",
+    ".cms/{$tpl}/404.en_US.UTF-8.php",
+    ".cms/{$tpl}/404.ru_RU.UTF-8.php",
+    ".cms/{$tpl}/404.uk_UA.UTF-8.php",
+    ".cms/{$tpl}/instruction.ru_RU.UTF-8.html",
+    ".cms/{$tpl}/template.settings.php",
+    ".cms/{$tpl}/tpl.mod.php",
+);
+
+
+
+
+$title = __( "Title",     $tpl );
+$text  = __( "Paragraph", $tpl );
+
+$cms["templates"][$tpl]["page_templates"]["page"] = "<h1>{$title}</h1>
+
+<p>{$text}</p>
+";
+
+$cms["templates"][$tpl]["page_templates"]["post"] = "<h1>{$title}</h1>
+
+<!--preview-start-->
+
+<p>{$text}</p>
+
+<p>{$text}</p>
+
+<!--preview-end-->
+
+<p>{$text}</p>
+
+<p>{$text}</p>
+
+<p>{$text}</p>
+
+<p>{$text}</p>
+";
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mini/tpl.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,125 @@
+<?php
+
+// ru_RU.UTF-8:
+// Мини-модуль, встроенный в шаблон,
+// демонстрирующий поиск и пагинацию.
+
+$cms["urls"]["^{$cms['base_path']}search_by_tag$"] = "hook_search_by_tag";
+$cms["urls"]["^{$cms['base_path']}get_posts$"] = "hook_tpl_get_posts";
+
+hook_add_fn( "hook_search_by_tag", "tpl_search_by_tag_fn" );
+hook_add_fn( "menu_item_link", "tpl_menu_item_link" );
+hook_add_fn( "hook_tpl_get_posts", "tpl_get_posts" );
+
+$tpl = $cms["config"]["template.mod.php"]["template"];
+// Translate
+$cms["lang"][$tpl]["en_US.UTF-8"] = array(
+    "load_more" => "Load more",
+);
+$cms["lang"][$tpl]["ru_RU.UTF-8"] = array(
+    "load_more" => "Загрузить еще",
+);
+$cms["lang"][$tpl]["uk_UA.UTF-8"] = array(
+    "load_more" => "Завантажити ще",
+);
+
+// Делает дополнительную обертку пунктам меню имеющим подпункты
+// Как проверить:
+// 
+function tpl_menu_item_link() {
+    global $cms;
+
+    if ( $cms["menu.mod.php"]["item_link"]["has_submenu"] ) {
+        $cms["menu.mod.php"]["item_link"]["link"] = "
+            <div class=plus>
+                {$cms['menu.mod.php']['item_link']['link']}
+                <div class=icon></div>
+            </div>";
+    }
+}
+
+// Поиск по тегам
+// Как проверить:
+// Нигде не задействована
+function tpl_search_by_tag_fn() {
+    global $cms;
+    if ( ! empty( $_GET['tag'] ) ) {
+        $cms["page"]["title"] = "Поиск по тегу";
+        $cms["status"] = "200";
+        $cms["hooks"]["write"]["disabled"] = true;
+        $cms["hooks"]["hook_search_by_tag"]["next"] = "template";
+        $cms["page"]["text"] = "<h1>Статьи с тегом \"{$_GET['tag']}\"</h1>";
+        $cms["page"]["tpl"] = "page";
+        $cms["page"]["id"] = "search";
+
+        if ( cms_base_connect() ) {
+            $etag = mysqli_real_escape_string( $cms["base"], $_GET["tag"] );
+            $query = "SELECT * FROM pages WHERE tags LIKE '%{$etag}%' ORDER BY id DESC";
+
+            if ( $res = mysqli_query( $cms["base"], $query ) ) {
+                while ( $page = mysqli_fetch_assoc( $res ) ) {
+                    $cms["page"]["text"] .= "<a target=_blank href='{$cms['base_path']}{$page['url']}'>{$page['title']}</a>";
+                }
+            } else {
+                $cms["page"]["text"] .= "<p class=error>Ошибка выполнения запроса к базе данных.</p>";
+            }
+        } else {
+            $cms["page"]["text"] .= "<p class=error>Ошибка подключения к базе данных.</p>";
+        }
+    }
+}
+
+function tpl_get_posts() {
+    global $cms;
+
+    if ( ! empty( $_POST["last"] ) ) {
+        cms_base_connect();
+
+        $last = mysqli_real_escape_string( $cms["base"], $_POST["last"] );
+        $date = date( 'Y-m-d H:i:s' );
+        // `created`<'{$date}' все равно нужно чтобы не запрашивали будущие
+        $q = "SELECT * FROM pages WHERE tpl = 'post' AND `created`<'{$last}' AND `created`<'{$date}' AND published ORDER BY `created` DESC";
+        if ( $res = mysqli_query( $cms["base"], $q ) ) {
+
+            $html = "";
+            $n = 12;
+    
+            while ( $n-- > 0 && $page = mysqli_fetch_assoc( $res ) ) {
+    
+                if ( preg_match( '/<img[^>]+data-preview[^>]*>/us', $page['text'], $m ) ) {
+                    $preview_img = $m[0];
+                } else {
+                    $preview_img = '';
+                }
+    
+                if ( preg_match( '/^(.*)(<!--[\s]*preview-start[\s]*-->)(.*)(<!--[\s]*preview-end[\s]*-->)(.*)$/us', $page['text'], $m ) ) {
+                    $preview = $m[3];
+                } else {
+                    $preview = preg_replace( "/<h1>(.*?)<\/h1>/su", "", $page['text'] );
+                    $preview = preg_replace( "/<style>(.*?)<\/style>/su", "", $preview );
+                    $preview = trim( $preview );
+                    $preview = mb_substr( strip_tags( $preview ), 0, 500 );
+                    $preview = preg_replace( '/\s\S*$/u', ' ...', $preview );
+                    $preview = "<p>{$preview}</p>";
+                }
+    
+                $html .= "
+                <article data-date='{$page['created']}'>
+                    {$preview_img}
+                    <h2><a href='{$page['url']}' target=_blank>{$page['title']}</a></h2>
+                    {$preview}
+                </article>
+                ";
+    
+            }
+    
+            echo $html;
+            // Показать кнопку "Загрузить еще" если есть посты
+            if ( $page = mysqli_fetch_assoc( $res ) ) {
+                $tpl = $cms["config"]["template.mod.php"]["template"];
+                echo "<button class=load-more>" . __( "load_more", $tpl ) . "</button>";
+            }
+    
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/admin.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1417 @@
+<?php
+
+$cms["modules"]["admin.mod.php"] = array(
+    "name"        => "admin_module_name",
+    "description" => "admin_module_description",
+    "files"       => array(
+        ".cms/admin.cms/html.php",
+        ".cms/mod/admin.mod.php",
+        ".cms/js/admin.js",
+        ".cms/css/admin.css",
+        ".cms/lang/ru_RU.UTF-8/admin.mod.php",
+        ".cms/lang/en_US.UTF-8/admin.mod.php",
+        ".cms/lang/uk_UA.UTF-8/admin.mod.php",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["admin.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+
+    if ( ! empty( $cms["config"]["locale"] ) ) {
+        $translit = "{$cms['cms_dir']}/lang/{$cms['config']['locale']}/translit.php";
+        if ( is_file( $translit ) ) {
+            include_once( $translit );
+        }
+    }
+
+    // on install admin_url == base_path
+    if ( ! isset( $cms["config"]["admin.mod.php"]["admin_url"] ) ) {
+        $cms["config"]["admin.mod.php"]["admin_url"] = "";
+    }
+
+
+    if ( empty( $cms["config"]["admin.mod.php"]["api_url"] ) ) {
+        $cms["config"]["admin.mod.php"]["api_url"] = "api" . cms_uid();
+        //cms_save_config();
+    }
+
+    if ( empty( $cms["config"]["admin.mod.php"]["cron_url"] ) ) {
+        $cms["config"]["admin.mod.php"]["cron_url"] = "cron" . cms_uid();
+        //cms_save_config();
+    }
+
+    if ( ! empty( $cms["config"]["admin.mod.php"]["clear_cache"] ) ) {
+        hook_add_fn( "template",  "cms_admin_clear_cache", 4 );
+    }
+
+
+    $cms["urls"]["^{$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}$"] = "admin";
+
+    $cms["urls"]["^{$cms['base_path']}{$cms['config']['admin.mod.php']['api_url']}$"] = "api";
+
+    $cms["urls"]["^{$cms['base_path']}{$cms['config']['admin.mod.php']['cron_url']}$"] = "cron";
+
+    // Authorized admin and not authorized admin
+    if ( is_admin() ) {
+        hook_add_fn( "admin_header",  "cms_admin_admin_header" );
+        hook_add_fn( "api",           "cms_admin_api" );
+    }
+    hook_add_fn( "admin",         "cms_admin_admin", 9999 );
+
+}
+
+
+function cms_admin_clear_cache() {
+    global $cms;
+    header( "Clear-Site-Data: \"cache\"" );
+    unset( $cms["config"]["admin.mod.php"]["clear_cache"] );
+    cms_save_config();
+}
+
+
+function cms_admin_admin_header() {
+    global $cms;
+    echo "<script src='{$cms['base_path']}js/admin.js'></script>";
+}
+
+
+function is_admin() {
+    global $cms;
+    return isset( $_COOKIE["sess"] ) && isset( $cms["config"]["logged"][ $_COOKIE["sess"] ] );
+}
+
+
+// Боковое меню в админке
+function cms_admin_menu() {
+    global $cms;
+    
+    // Сохраненные настройки боковой панели: $cms["config"]["admin_sections"]
+    // Текущее состояние настроек формируемое динамически: $cms["admin_sections"]
+    if ( ! empty( $cms["config"]["admin_sections"] ) ) {
+        $cms["admin_sections"] = $cms["config"]["admin_sections"];
+    } else {
+        $cms["admin_sections"] = array();
+    }
+
+    // Настройки пунктов сохраняются в настройках модулей, а не в секции,
+    // чтобы отключение модуля прятало пункт из боковой панели
+    foreach( $cms["config"] as $mod => $mod_cfg ) {
+        if ( substr( $mod, -8, 8 ) === ".mod.php" && empty( $mod_cfg["disabled"] ) && isset( $mod_cfg["menu"] ) ) {
+            foreach( $mod_cfg["menu"] as $menu => $menu_cfg ) {
+                $section = $menu_cfg["section"];
+                $menu_cfg["module"] = $mod; // для последующей локализации
+                $cms["admin_sections"][$section]["items"][$menu] = $menu_cfg;
+
+                // Локализация заголовка секции
+                $locale = $cms["config"]["locale"];
+                if ( ! isset( $cms["admin_sections"][$section]["title"] ) && isset( $cms["lang"][$mod][$locale][$section] ) ) {
+                    $cms["admin_sections"][$section]["title"] = $cms["lang"][$mod][$locale][$section];
+                }
+
+                // default section sort
+                if ( isset( $menu_cfg["section_sort"] ) && ! isset( $cms["admin_sections"][$section]["sort"] ) ) {
+                    $cms["admin_sections"][$section]["sort"] = $menu_cfg["section_sort"];
+                }
+            }
+        }
+    }
+    // Затем эти данные используются в .cms/admin.cms/html.php
+
+    // Sort & Translate
+    $default_sort = array(
+        "content"    => 100,
+        "settings"   => 1000,
+    );
+    foreach( $cms["admin_sections"] as $section => $sec_conf ) {
+        // Сортировка. Установить порядковый номер если не установлен.
+        if ( ! isset( $cms["admin_sections"][$section]["sort"] ) ) {
+            if ( isset( $default_sort[$section] ) ) {
+                $cms["admin_sections"][$section]["sort"] = $default_sort[$section];
+            } else {
+                $cms["admin_sections"][$section]["sort"] = 500;
+            }
+        }
+
+        // translate
+        if ( ! isset( $cms["admin_sections"][$section]["title"] ) ) {
+            $cms["admin_sections"][$section]["title"] = __( $section );
+        }
+    }
+
+    // Sort sections
+    cms_asort( $cms["admin_sections"] );
+
+    // Sort items inside sections
+    foreach( $cms["admin_sections"] as $section_name => $section ) {
+        cms_asort( $cms["admin_sections"][$section_name]["items"] );
+    }
+}
+
+function cms_admin_admin() {
+    global $cms;
+    $cms["template"] = "admin.cms";
+    $cms["status"] = "200";
+    $cms["hooks"]["write"]["disabled"] = true;
+
+    // Not required code if not authorized
+    if ( ! is_admin() ) return;
+    
+    $conf = $cms["config"]["admin.mod.php"]["menu"]["auth"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    // Save settings
+    if ( ! empty( $_POST["change_admin_login"] ) ) {
+        $login     = trim( $_POST["admin_login"] );
+        $password  = trim( $_POST["admin_password"] );
+        $cms["config"]["admin.mod.php"]["admin_login"] = $login;
+        $cms["config"]["admin.mod.php"]["admin_password"] = $password;
+        $cms["config"]["admin.mod.php"]["admin_url"] = trim( $_POST["admin_url"] );
+        cms_save_config();
+        header( "Location: {$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}" );
+        $cms["hooks"]["admin"]["next"] = ""; // Предотвратить выдачу админки
+        return;
+    }
+
+    $rows = "";
+    foreach ( $cms["config"]["logged"] as $login => $attr ) {
+        if ( $login === $_COOKIE["sess"] ) {
+            $current = "class=current";
+        } else {
+            $current = "";
+        }
+        $rows .= "
+<div {$current}>
+    <div class=del-sess data-login='{$login}'></div>
+    <div class=date>{$attr['date']}</div>
+    <div class=ip>{$attr['ip']}</div>
+    <div class=agent>{$attr['user_agent']}</div>
+</div>";
+    }
+
+    $logouts = "";
+    if ( ! empty( $cms["config"]["logouted"] ) ) {
+        // Перебираем закрытые сессии в прямом порядки
+        // и очередную добавляем в начало списка,
+        // чтобы получить обратный порядок отображения.
+        foreach ( $cms["config"]["logouted"] as $attr ) {
+            $logouts = "
+<div>
+    <div></div>
+    <div class=date>{$attr['date']}</div>
+    <div class=ip>{$attr['ip']}</div>
+    <div class=agent>{$attr['user_agent']}</div>
+</div>
+{$logouts}";
+        }
+    }
+    
+    // Display settings
+    $tr_login     = __( "login_or_password" );
+    $tr_passw     = __( "password" );
+    $tr_set       = __( "set_password" );
+    $tr_current   = __( "current_logins" );
+    $tr_history   = __( "logins_history" );
+    $tr_admin_url = __( "admin_url" );
+    $form = "
+<form method=post>
+    <div class=admin-url>{$tr_admin_url}</div>
+    <input name=admin_url type=text value='{$cms['config']['admin.mod.php']['admin_url']}' autocomplete=off size=10>
+    <div class=login-title>{$tr_login}</div>
+    <input name=admin_login type=text value='{$cms['config']['admin.mod.php']['admin_login']}' autocomplete=off size=22>
+    <div class=passwd-title>{$tr_passw}</div>
+    <div class=password-widget>
+        <input name=admin_password type=password value='{$cms['config']['admin.mod.php']['admin_password']}' autocomplete=off size=10>
+        <div class=password-eye></div>
+    </div>
+    <div></div>
+    <button value=save name=change_admin_login>{$tr_set}</button>
+</form>
+
+<div class=current-sess>
+    <div class=table-title>{$tr_current}</div>
+    <div class=sess-table>{$rows}</div>
+</div>
+
+<div class=history-sess>
+    <div class=table-title>{$tr_history}</div>
+    <div class=sess-table>{$logouts}</div>
+</div>
+";
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["admin.mod.php"]["menu"]["auth"] ) ) {
+        $cms["config"]["admin.mod.php"]["menu"]["auth"] = array(
+            "title"    => "auth",
+            "sort"     => 10,
+            "section"  => "settings",
+        );
+        cms_save_config();
+    }
+    $cms["admin_pages"]["auth"] = $form;
+
+    }
+   
+    
+    $conf = $cms["config"]["admin.mod.php"]["menu"]["phpinfo"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    // PHP Info
+    if ( empty( $cms["config"]["admin.mod.php"]["menu"]["phpinfo"]["hide"] ) ) {
+        ob_start();
+        phpinfo();
+        preg_match( "/<body>(.+)<\/body>/us", ob_get_clean(), $m );
+        $page = $m[1];
+        // Create menu item if not exists
+        if ( empty( $cms["config"]["admin.mod.php"]["menu"]["phpinfo"] ) ) {
+            $cms["config"]["admin.mod.php"]["menu"]["phpinfo"] = array(
+                "title"    => "php_info",
+                "sort"     => 30,
+                "section"  => "settings",
+            );
+            cms_save_config();
+        }
+        $cms["admin_pages"]["phpinfo"] = $page;
+    }
+
+    }
+
+
+    // Modules List
+    $conf = $cms["config"]["admin.mod.php"]["menu"]["modules"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+        if ( empty( $cms["config"]["admin.mod.php"]["update"]["last_version"] ) ) {
+            $last_version = __( "unknown" );
+        } else {
+            $last_version = $cms["config"]["admin.mod.php"]["update"]["last_version"];
+            if ( $cms["kernel_compat"] !== $cms["config"]["admin.mod.php"]["update"]["compat"] ) {
+                $last_version .= ". " . __( "incompatible_v" );
+            }
+        }
+
+        if ( empty( $cms["config"]["admin.mod.php"]["last_check"] ) ) {
+            $last_check = __( "never" );
+        } else {
+            $last_check = date( "d.m.Y H:i", $cms["config"]["admin.mod.php"]["last_check"] );
+        }
+        if ( file_exists( $cms["cms_dir"] . "/man/" . $cms["config"]["locale"] . "/book.html" ) ) {
+            $book_href = $cms["base_path"] . "man/" . $cms["config"]["locale"] . "/book.html";
+            $book_link = "<a href={$book_href} target=_blank>" . __( "book" ) . "</a>";
+        } else {
+            $book_link = "";
+        }
+        $admin_menu = "
+        <div class=header>
+
+            <div class=update-window>
+                <div>" . __( "update_core" ) . "</div>
+                <div class=check-answer>
+                    <p>" . __( "current_v" ) . " {$cms['kernel_version']}</p>
+                    <p>" . __( "last_v" ) . " {$last_version}</p>
+                    <p>" . __( "checked" ) . " {$last_check}</p>
+                </div>
+                <div class=buttons>
+                    <button data-fn=cms_check_update>" . __( "check" ) . "</button>
+                    <button data-fn=cms_update>" . __( "update" ) . "</button>
+                    {$book_link}
+                    <button data-show-dev>" . __( "for_dev" ) . "</button>
+                </div>
+            </div>
+
+            <div class='dev-window developers_only'>
+                <div class=buttons>
+                    <button data-fn=cms_check_dev_update>" . __( "check_dev" ) . "</button>
+                    <button data-fn=cms_changed_files>" . __( "changed_files" ) . "</button>
+                    <button data-fn=create_zip style='display:none'>" . __( "create_zip" ) . "</button>
+                </div>
+            </div>
+
+            <div class=changed-files style='display:none'></div>
+
+            <div class=upload_dnd>
+                <input id=module-upload type=file name='myfile[]' multiple class=files>
+                " . __( "mod_install" ) . "
+            </div>
+        </div>
+        <div class=modules-grid>";
+
+        // Сортировка модулей
+        function modules_sort( $a, $b ) {
+            return ( $a["name"] < $b["name"] ) ? -1 : 1;
+        }
+        uasort( $cms["modules"], "modules_sort" );
+
+        $tr_on  = __( "mod_on" );
+        $tr_off = __( "mod_off" );
+        $tr_del = __( "mod_del" );
+        foreach( $cms["modules"] as $mod => $mod_cfg ) {
+            if ( ! empty( $cms["config"][$mod]["disabled"] ) ) {
+                $status = "disabled";
+                $tr_sw  = $tr_on;
+            } else {
+                $status = "enabled";
+                $tr_sw  = $tr_off;
+            }
+            if ( empty( $mod_cfg["version"] ) ) {
+                $mod_version = "";
+            } else {
+                $mod_version = "<div class=module-version>{$mod_cfg['version']}</div>";
+            }
+            // переводы имен модулей вынесены сюда чтобы не было варнингов при установке
+            $admin_menu .= "
+            <div class={$status} data-module={$mod}>
+                <div class=module-name>" . __( $mod_cfg['name'], $mod ) . "</div>
+                {$mod_version}
+                <div class=module-description>" . __( $mod_cfg['description'], $mod ) . "</div>
+                <a class=module-sw-btn>{$tr_sw}</a>
+                <a class=module-del-btn>{$tr_del}</a>
+            </div>";
+        }
+        $admin_menu .= "</div>";
+
+        // Create menu item if not exists
+        if ( empty( $cms["config"]["admin.mod.php"]["menu"]["modules"] ) ) {
+            $cms["config"]["admin.mod.php"]["menu"]["modules"] = array(
+                "title"    => "modules",
+                "sort"     => 50,
+                "section"  => "settings",
+            );
+            cms_save_config();
+        }
+        $cms["admin_pages"]["modules"] = $admin_menu;
+    }
+
+
+    // Admin
+
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["admin.mod.php"]["menu"]["admin_menu"] ) ) {
+        $cms["config"]["admin.mod.php"]["menu"]["admin_menu"] = array(
+            "title"    => "admin_module_name",
+            "sort"     => 40,
+            "section"  => "settings",
+        );
+        cms_save_config();
+    }
+    
+    cms_admin_menu();
+
+    $conf = $cms["config"]["admin.mod.php"]["menu"]["admin_menu"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    $tr_show          = __( "show" );
+    $tr_hide          = __( "hide" );
+    $tr_save          = __( "save" );
+    $tr_del_section   = __( "delete" );
+    $tr_reset         = __( "reset" );
+
+
+    $options = "";
+    foreach( $cms["admin_sections"] as $section_name => $section ) {
+        $options .= "<div class=option value='{$section_name}'>{$section["title"]}</div>";
+    }
+
+    // Admin Sections
+    $admin_menu = "
+<div class=main-main>
+    <div class=am-grid>";
+    foreach( $cms["admin_sections"] as $section_name => $section ) {
+        if ( empty( $section["hide"] ) ) {
+            $status = "showed";
+            $tr_sw  = $tr_hide;
+        } else {
+            $status = "hidden";
+            $tr_sw  = $tr_show;
+        }
+        $admin_menu .= "
+<div>
+    
+    <div class={$status} data-am-type=section data-am-item='{$section_name}'>
+        <input name=title type=text value='{$section['title']}'>
+        <input name=sort type=text value='{$section['sort']}'>
+        <div class=buttons>
+            <a data-am-save>{$tr_save}</a>
+            <a data-am-delete>{$tr_del_section}</a>
+            <a data-am-sw>{$tr_sw}</a>
+        </div>
+    </div>
+
+    <div class=items-grid data-am-childs='{$section_name}'>";
+
+        // Admin Items
+        if ( ! empty( $cms["admin_sections"][$section_name]["items"] ) )
+        foreach( $cms["admin_sections"][$section_name]["items"] as $iname => $item ) {
+            if ( empty( $item["hide"] ) ) {
+                $status = "showed";
+                $tr_sw  = $tr_hide;
+            } else {
+                $status = "hidden";
+                $tr_sw  = $tr_show;
+            }
+
+            $admin_menu .= "
+<div class={$status} data-am-type=item data-am-module={$item['module']} data-am-item={$iname}>
+    <div class=item-name>" . __( $item["title"], $item["module"] ) . "</div>
+    <input name=sort type=text value='{$item['sort']}'>
+    <div class=section-select-grid>
+        <div class=field-select data-section='{$section_name}'>
+            <div class=value>{$cms['admin_sections'][$section_name]['title']}</div>
+            <div class=icon></div>
+        </div>
+        <div class=field-options>
+            {$options}
+        </div>
+    </div>
+    <div class=buttons>
+        <a data-am-save>{$tr_save}</a>
+        <a data-am-save data-am-reset>{$tr_reset}</a>
+        <a data-am-sw>{$tr_sw}</a>
+    </div>
+</div>";
+        }
+
+        $admin_menu .= "
+    </div> <!-- class=status -->
+</div> <!-- class= -->";
+    }
+
+
+    $admin_menu .= "
+    </div> <!-- class=am-grid -->
+</div> <!-- class=main-main -->
+<div class=main-footer>
+    <div class=add-section>" . __( "add_section" ) . "</div>
+    <div class=reset-all>" . __( "reset_all" ) . "</div>
+</div>";
+
+    $cms["admin_pages"]["admin_menu"] = $admin_menu;
+
+    }
+
+}
+
+
+function cms_admin_api() {
+    global $cms;
+
+    // Cookie, Logout, Admin, Modules
+    if ( ! empty( $_POST["fn"] ) && is_admin() ) {
+        switch ( $_POST["fn"] ) {
+
+            case "logout":
+                $cms["status"] = "200";
+                if ( empty( $_POST["sess"] ) ) {
+                    if ( PHP_VERSION_ID < 70300 ) {
+                        setcookie( "sess", "", 365 * 24 * 60 * 60 );
+                    } else {
+                        setcookie( "sess", "", array( "SameSite" => "Lax", "expires" => time() + 365 * 24 * 60 * 60 ) );
+                    }
+                    $login  = $_COOKIE["sess"];
+                    $result = "refresh";
+                } else {
+                    $login = $_POST["sess"];
+                    if ( $_POST["sess"] === $_COOKIE["sess"] ) {
+                        $result = "refresh";
+                    } else {
+                        $result = "ok";
+                    }
+                }
+
+                if ( ! isset($cms["config"]["logouted"]) ) {
+                    $cms["config"]["logouted"] = array();
+                }
+                // Добавляем закрытую сессию в конец массива в историю
+                array_push( $cms["config"]["logouted"], $cms["config"]["logged"][$login] );
+                // Оставим только последние 10 выходов в истории
+                $cms["config"]["logouted"] = array_slice( $cms["config"]["logouted"], -10 );
+                unset( $cms["config"]["logged"][$login] );
+                cms_save_config();
+
+                echo( json_encode( array(
+                    "info_text"  => __( "logout_completed" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 5000,
+                    "result"     => $result,
+                ) ) );
+                return;
+            break;
+
+            case "admin_menu_save":
+                switch ( $_POST["type"] ) {
+                    case "section":
+                        if ( empty( $_POST["title"] ) ) {
+                            unset ( $cms["config"]["admin_sections"][ $_POST["item"] ]["title"] );
+                        } else {
+                            $cms["config"]["admin_sections"][ $_POST["item"] ]["title"] = $_POST["title"];
+                        }
+                        $n = (int) $_POST["sort"];
+                        if ( $n ) {
+                            $cms["config"]["admin_sections"][ $_POST["item"] ]["sort"]  = $n;
+                        } else {
+                            unset( $cms["config"]["admin_sections"][ $_POST["item"] ]["sort"] );
+                        }
+                    break;
+
+                    // Настройки пунктов сохраняются в настройках модулей, а не в секции
+                    case "item":
+                        if ( $_POST["reset"] === "true" ) {
+                            unset( $cms["config"][ $_POST["module"] ]["menu"][ $_POST["item"] ] );
+                        } else {
+                            $cms["config"][ $_POST["module"] ]["menu"][ $_POST["item"] ]["section"] = $_POST["section"];
+                            $cms["config"][ $_POST["module"] ]["menu"][ $_POST["item"] ]["sort"]    = (int) $_POST["sort"];
+                        }
+                    break;
+                }
+                cms_save_config();
+                echo( json_encode( array(
+                    "ok" => "true",
+                ) ) );
+                return;
+            break;
+
+            case "admin_menu_hide":
+                $hide = $_POST["hide"] === "true";
+                switch ( $_POST["type"] ) {
+                    case "section":
+                        $cms["config"]["admin_sections"][ $_POST["item"] ]["hide"] = $hide;
+                        break;
+                    case "item":
+                        $cms["config"][ $_POST["module"] ]["menu"][ $_POST["item"] ]["hide"] = $hide;
+                        break;
+                }
+                cms_save_config();
+                echo( json_encode( array(
+                    "ok" => "true",
+                ) ) );
+                return;
+            break;
+
+            case "admin_menu_add_section":
+                $n = 1;
+                while ( isset( $cms["config"]["admin_sections"]["section_".$n] ) ) {
+                    $n++;
+                }
+                $cms["config"]["admin_sections"]["section_".$n] = array(
+                    "title" => __( "add_section" ),
+                    "sort"  => 99,
+                );
+                cms_save_config();
+                echo( json_encode( array(
+                    "info_text"  => __( "section_added" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 3000,
+                ) ) );
+                return;
+            break;
+
+            case "admin_menu_del":
+                $cms["status"] = "200";
+                unset( $cms["config"]["admin_sections"][ $_POST["item"] ]);
+                cms_save_config();
+                echo( json_encode( array(
+                    "info_text"  => __( "deleted" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 1000,
+                ) ) );
+                return;
+            break;
+
+            case "module_disable":
+                if ( $_POST["module"] == "admin.mod.php" || $_POST["module"] == "template.mod.php" ) {
+                    echo( json_encode( array(
+                        "info_text"  => __( "not_disabled" ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+                if ( $_POST["disable"] === "true" ) {
+                    $cms["config"][$_POST["module"]]["disabled"] = true;
+                } else {
+                    unset( $cms["config"][$_POST["module"]]["disabled"] );
+                }
+                cms_save_config();
+                echo( json_encode( array(
+                    "ok"  => "true",
+                ) ) );
+                return;
+            break;
+
+            case "module_del":
+                $text = __( "delete_this_files" );
+                foreach( $cms["modules"][$_POST["module"]]["files"] as $file ) {
+                    $text .= "<br>{$file}";
+                }
+                echo( json_encode( array(
+                    "info_text"  => $text,
+                    "info_class" => "info-error",
+                    "info_time"  => 60000,
+                ) ) );
+                return;
+            break;
+
+            case "install_module":
+                $success = true;
+                foreach ( $_FILES["myfile"]["name"] as $n => $name ) {
+                    if ( $_FILES["myfile"]["error"][$n] ) {
+                        $success = false;
+                        $text = str_replace( "xxx", $name, __( "upload_error_xxx" ) );
+                        break;
+                    } else {
+                        // Unpack Module
+                        // Object Oriented Style for future compability with PHP 8
+                        $zip = new ZipArchive;
+                        $zip_file = $_FILES["myfile"]["tmp_name"][$n];
+                        if ( $zip->open( $zip_file ) === TRUE ) {
+                            $ok = $zip->extractTo( $cms["site_dir"] );
+                            $zip->close();
+                            if ( ! $ok ) {
+                                $success = false;
+                                $text = str_replace( "xxx", $name, __( "cant_extract_xxx" ) );
+                                break;
+                            } else {
+                                // Load modules
+                                // В одном zip может быть множество модулей
+                                foreach( glob( "{$cms['cms_dir']}/mod/*.mod.php" ) as $mod_file ) {
+                                    include_once( $mod_file );
+                                    $module_name = str_replace( ".mod.php", "", basename( $mod_file ) );
+                                    $sql_file = "{$cms['cms_dir']}/mod/{$module_name}.update.sql";
+                                    if ( is_file( $sql_file ) ) {
+                                        $q = file_get_contents( $sql_file );
+                                        $res = mysqli_multi_query( $cms["base"], $q );
+                                    }
+                                }
+
+                                do_hook( "create_tables" );
+
+                                $text = __( "install_success" );
+                            }
+                        } else {
+                            $success = false;
+                            $text = str_replace( "xxx", $name, __( "cant_open_zip_xxx" ) );
+                            break;
+                        }
+                    }
+                }
+
+                if ( $success ) {
+                    if ( function_exists( "cms_clear_cache" ) ) {
+                        cms_clear_cache();
+                    }
+                    $cms["config"]["admin.mod.php"]["clear_cache"] = true;
+                    cms_save_config();
+                    echo( json_encode( array(
+                        "info_text"  => $text,
+                        "info_class" => "info-success",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "info_text"  => $text,
+                        "info_class" => "info-error",
+                        "info_time"  => 10000,
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "no_translation":
+                if ( ! empty( $cms["config"]["debug"] ) ) {
+                    $new_debug = array(
+                        "translate to {$cms["config"]["locale"]}" => array(
+                            "{$_POST["module"]}:js" => $_POST["str"],
+                        ),
+                    );
+                    $debug_file = $cms["cms_dir"] . "/debug.log.php";
+                    if ( $handle = fopen( $debug_file, "r" ) ) {
+                        flock( $handle, LOCK_SH );
+                        include( $debug_file );
+                        $cms["debug"] = array_replace_recursive( $cms["debug"], $new_debug );
+                        flock( $handle, LOCK_UN );
+                        file_put_contents( $debug_file, '<?php $cms["debug"] = ' . var_export( $cms["debug"], true) . ";\n", LOCK_EX );
+                    } else {
+                        file_put_contents( $debug_file, '<?php $cms["debug"] = ' . var_export( $cms["debug"], true) . ";\n", LOCK_EX );
+                    }
+                }
+                echo( '{ "result": "ok" }' );
+                return;
+            break;
+
+            case "reset_admin_menu_items":
+                reset_admin_menu_items();
+                echo( json_encode( array(
+                    "info_text"  => __( "reset_all_ok" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 3000,
+                ) ) );
+                return;
+            break;
+
+            case "create_zip":
+                cms_update_create_zip();
+            break;
+
+            case "cms_check_update":
+                cms_update_check( "https://coffee-cms.ru/update.json" );
+            break;
+
+            case "cms_check_dev_update":
+                cms_update_check( "https://dev.coffee-cms.ru/update_dev.json" );
+            break;
+
+            case "cms_update":
+                cms_update_cms_update();
+            break;
+            
+            case "cms_changed_files":
+                cms_changed_files();
+            break;
+        }
+        
+    }
+}
+
+
+function reset_admin_menu_items() {
+    global $cms;
+    unset( $cms["config"]["admin_sections"] );
+    foreach( $cms["modules"] as $mod => $val ) {
+        if ( isset( $cms["config"][$mod]["menu"] ) ) {
+            unset( $cms["config"][$mod]["menu"] );
+        }
+    }
+    cms_save_config();
+}//unset( $cms["config"][ $_POST["module"] ]["menu"][ $_POST["item"] ] );
+
+
+function cms_update_create_filelist() {
+    global $cms;
+
+    $logs = "";
+
+    $queue = array(
+        "{$cms['site_dir']}/uploads/.keep",
+        "{$cms['site_dir']}/.htaccess",
+        "{$cms['site_dir']}/.nginx.conf",
+        "{$cms['site_dir']}/.cms/admin.cms",
+        "{$cms['site_dir']}/.cms/css/base.css",
+        "{$cms['site_dir']}/.cms/css/menu.css",
+        "{$cms['site_dir']}/.cms/css/pages.css",
+        "{$cms['site_dir']}/.cms/css/sitemap.css",
+        "{$cms['site_dir']}/.cms/css/rss.css",
+        "{$cms['site_dir']}/.cms/css/template.css",
+        "{$cms['site_dir']}/.cms/css/admin.css",
+        "{$cms['site_dir']}/.cms/filelist.php",
+        "{$cms['site_dir']}/.cms/img",
+        "{$cms['site_dir']}/.cms/js/admin.js",
+        "{$cms['site_dir']}/.cms/js/menu.js",
+        "{$cms['site_dir']}/.cms/js/pages.js",
+        "{$cms['site_dir']}/.cms/js/sitemap.js",
+        "{$cms['site_dir']}/.cms/js/rss.js",
+        "{$cms['site_dir']}/.cms/js/template.js",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/admin.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/base.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/menu.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/pages.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/sitemap.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/rss.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/template.mod.php",
+        "{$cms['site_dir']}/.cms/lang/ru_RU.UTF-8/translit.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/admin.mod.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/base.mod.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/menu.mod.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/pages.mod.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/sitemap.mod.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/rss.mod.php",
+        "{$cms['site_dir']}/.cms/lang/en_US.UTF-8/template.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/admin.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/base.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/menu.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/pages.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/sitemap.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/rss.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/template.mod.php",
+        "{$cms['site_dir']}/.cms/lang/uk_UA.UTF-8/translit.php",
+        
+        "{$cms['site_dir']}/.cms/lib/codemirror",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/book.html",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/codemirror.html",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/example.html",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/hint_css.html",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/hint_html.html",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/hint_php.html",
+        "{$cms['site_dir']}/.cms/man/ru_RU.UTF-8/menu.html",
+        "{$cms['site_dir']}/.cms/man/css/prism.css",
+        "{$cms['site_dir']}/.cms/man/css/styles.css",
+        "{$cms['site_dir']}/.cms/man/js/prism.js",
+
+        // Файлы шаблона
+        "{$cms['site_dir']}/.cms/mini/html.php",
+        "{$cms['site_dir']}/.cms/mini/404.en_US.UTF-8.php",
+        "{$cms['site_dir']}/.cms/mini/404.ru_RU.UTF-8.php",
+        "{$cms['site_dir']}/.cms/mini/404.uk_UA.UTF-8.php",
+        "{$cms['site_dir']}/.cms/mini/banner.jpg",
+        "{$cms['site_dir']}/.cms/mini/blog.php",
+        "{$cms['site_dir']}/.cms/mini/favicon.svg",
+        "{$cms['site_dir']}/.cms/mini/frontpage.php",
+        "{$cms['site_dir']}/.cms/mini/instruction.ru_RU.UTF-8.html",
+        "{$cms['site_dir']}/.cms/mini/page.php",
+        "{$cms['site_dir']}/.cms/mini/page.teaser.php",
+        "{$cms['site_dir']}/.cms/mini/post.php",
+        "{$cms['site_dir']}/.cms/mini/styles.css",
+        "{$cms['site_dir']}/.cms/mini/template.settings.php",
+        "{$cms['site_dir']}/.cms/mini/tpl.mod.php",
+        
+        "{$cms['site_dir']}/.cms/mod/admin.mod.php",
+        "{$cms['site_dir']}/.cms/mod/base.mod.php",
+        "{$cms['site_dir']}/.cms/mod/menu.mod.php",
+        "{$cms['site_dir']}/.cms/mod/pages.mod.php",
+        "{$cms['site_dir']}/.cms/mod/sitemap.mod.php",
+        "{$cms['site_dir']}/.cms/mod/rss.mod.php",
+        "{$cms['site_dir']}/.cms/mod/template.mod.php",
+        "{$cms['site_dir']}/.cms/index.fn.php",
+        "{$cms['site_dir']}/.cms/index.php",
+        "{$cms['site_dir']}/.cms/update.sql",
+        "{$cms['site_dir']}/.cms/update.php",
+        "{$cms['site_dir']}/.cms/.unlicense.txt",
+    );
+    $no_sha1 = array(
+        "{$cms['site_dir']}/.cms/filelist.php",
+    );
+    
+    $list  = array();
+
+    while ( $cur = array_shift( $queue ) ) {
+        if ( is_dir( $cur ) ) {
+            $queue = array_merge( $queue, glob( $cur . "/*" ) );
+        } elseif ( is_file( $cur ) ) {
+            if ( in_array( $cur, $no_sha1 ) ) {
+                $sha1 = "";
+                $size = "";
+            } else {
+                $sha1 = sha1_file( $cur );
+                $size = filesize( $cur );
+            }
+            $file = str_replace( "{$cms['site_dir']}/", "", $cur );
+            $list[$file] = array(
+                "sha1" => $sha1,
+                "size" => $size,
+            );
+        } else {
+            $logs .= "<p>" . __( "file_or_dir_not_exists" ) . " '{$cur}'</p>";
+        }
+    }
+
+    // Список файлов которые разрешено редактировать.
+    // И если они отредактированы, то не будут обновляться.
+    $allow_change = array(
+        ".htaccess",
+    );
+    
+    file_put_contents( "{$cms['cms_dir']}/filelist.php", 
+        "<?php\n\$allow_change = " . var_export( $allow_change, true ) . ";\n" .
+        '$list = ' . var_export( $list, true ) . ";\n"
+    );
+
+    $logs .= "<p>".__( "files" )." " . count( $list ) . "</p>";
+
+    return $logs;
+    
+}
+
+
+function cms_update_check( $url ) {
+    global $cms;
+
+    // prevent warning
+    if ( empty( $cms["config"]["admin.mod.php"]["last_check"] ) ) {
+        $cms["config"]["admin.mod.php"]["last_check"] = 0;
+    }
+
+    $t = time();
+    $dt = $t - $cms["config"]["admin.mod.php"]["last_check"];
+    $time_min = 1;
+    if ( $dt < $time_min * 60 ) {
+        $n = ceil( ( $time_min * 60 - $dt ) / 60 );
+        $msg = __( "try_later" );
+        $msg = str_replace( "xxx", $n, $msg );
+        echo( json_encode( array(
+            "info_text"  => $msg,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    if ( ! $update = file_get_contents( $url ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "cant_get" ) . " " . $url,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    if ( ! $update = json_decode( $update, true ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "json_error" ) . " " . $url,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    $cms["config"]["admin.mod.php"]["last_check"] = $t;
+    $cms["config"]["admin.mod.php"]["update"] = $update;
+    cms_save_config();
+
+    $last_check = date( "d.m.Y H:i", $cms["config"]["admin.mod.php"]["last_check"] );
+
+    $last_version = $cms["config"]["admin.mod.php"]["update"]["last_version"];
+
+    if ( $cms["kernel_compat"] !== $cms["config"]["admin.mod.php"]["update"]["compat"] ) {
+        $last_version .= ". " . __( "incompatible_v" );
+    }
+
+    $update_info  = "<p>" . __( "current_v" ) . " {$cms['kernel_version']}</p>";
+    $update_info .= "<p>" . __( "last_v" ) . " {$last_version}</p>";
+    $update_info .= "<p>" . __( "checked" ) . " {$last_check}</p>";
+
+    echo( json_encode( array(
+        "info_text"  => __( "last_v" ) . " {$last_version}",
+        "info_class" => "info-success",
+        "info_time"  => 5000,
+        "answer"     => $update_info,
+    ) ) );
+    return;
+
+}
+
+
+function cms_changed_files() {
+    global $cms;
+
+    $fl = "{$cms['cms_dir']}/filelist.php";
+    require( $fl );
+
+    $errors = array();
+    $max_errors = 100;
+
+    // Проверка файлов текущей версии
+    // по чексуммам и размерам
+    foreach( $list as $fn => $file ) {
+        $f = $cms["site_dir"] . "/" . $fn;
+        if ( ! is_file( $f ) ) {
+            if ( count( $errors ) >= $max_errors ) {
+                break;
+            } else {
+                array_push( $errors, __( "file_not_exists" ) . " " . $f );
+            }
+        }
+        $sha1 = sha1_file( $f );
+        $size = filesize( $f );
+        if ( ! empty( $file["sha1"] ) && ! empty( $file["size"] ) && is_file( $f ) ) {
+            if ( $file["sha1"] !== $sha1 || $file["size"] !== $size ) {
+                if ( ! in_array( $fn, $allow_change ) ) {
+                    if ( count( $errors ) >= $max_errors ) {
+                        break;
+                    } else {
+                        array_push( $errors, __( "file_changed" ) . " " . $f );
+                    }
+                }
+            }
+        }
+    }
+
+    // Возвращаем список недочетов
+    if ( count( $errors ) ) {
+        $files = implode( "<br>", $errors );
+    } else {
+        $files = __( "no_files_changed" );
+    }
+    echo( json_encode( array(
+        "answer"  => $files,
+    ) ) );
+    return;
+
+}
+
+function cms_update_cms_update() {
+    global $cms;
+
+    // Не проверялись обновления вообще
+    if ( empty( $cms["config"]["admin.mod.php"]["update"] ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "check_updates" ),
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    // Отсутствует файл со списком файлов
+    $fl = "{$cms['cms_dir']}/filelist.php";
+    if ( ! file_exists( $fl ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "file_list_missing" ) . " " . $fl,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+    
+    require( $fl );
+
+    $update = $cms["config"]["admin.mod.php"]["update"];
+
+    // Может нечего обновлять
+    if ( $update["last_version"] <= $cms["kernel_version"] ) {
+        echo( json_encode( array(
+            "info_text"  => __( "already_updated" ),
+            "info_class" => "info-success",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    // Может несовместимая версия
+    if ( $update["compat"] !== $cms["kernel_compat"] ) {
+        echo( json_encode( array(
+            "info_text"  => __( "impossible" ),
+            "info_class" => "info-error",
+            "info_time"  => 15000,
+        ) ) );
+        return;
+    }
+    
+    // Копить по 10 ошибок
+    // чтобы не мучить по одной
+    $errors = array();
+    $max_errors = 10;
+    
+    // Проверка файлов текущей версии
+    // по чексуммам и размерам
+    foreach( $list as $fn => $file ) {
+        $f = $cms["site_dir"] . "/" . $fn;
+        if ( ! is_file( $f ) ) {
+            if ( count( $errors ) >= $max_errors ) {
+                break;
+            } else {
+                array_push( $errors, __( "file_not_exists" ) . " " . $f );
+            }
+        }
+        $sha1 = sha1_file( $f );
+        $size = filesize( $f );
+        if ( ! empty( $file["sha1"] ) && ! empty( $file["size"] ) && is_file( $f ) ) {
+            if ( $file["sha1"] !== $sha1 || $file["size"] !== $size ) {
+                if ( ! in_array( $fn, $allow_change ) ) {
+                    if ( count( $errors ) >= $max_errors ) {
+                        break;
+                    } else {
+                        array_push( $errors, __( "file_changed" ) . " " . $f );
+                    }
+                }
+            }
+        }
+    }
+
+    // Возвращаем список недочетов
+    if ( count( $errors ) ) {
+        echo( json_encode( array(
+            "info_text"  => implode( "<br>", $errors ),
+            "info_class" => "info-error",
+            "info_time"  => 50000,
+        ) ) );
+        return;
+    }
+
+    // Check Rights
+    $rights = array();
+    foreach( $list as $fn => $file ) {
+        $file_path = $cms["site_dir"] . "/" . $fn;
+        $e = ! is_file( $file_path ) || ! is_writable( $file_path );
+        if ( $e ) {
+            if ( count( $rights ) >= $max_errors ) {
+                break;
+            } else {
+                array_push( $rights, $file_path );
+            }
+        }
+    }
+
+    // Возвращаем список недочетов
+    if ( count( $rights ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "update_error_rights" ) . "<br>" . implode( "<br>", $rights ),
+            "info_class" => "info-error",
+            "info_time"  => 50000,
+        ) ) );
+        return;
+    }
+
+    if ( empty( $cms["config"]["admin.mod.php"]["last_update"] ) ) {
+        $cms["config"]["admin.mod.php"]["last_update"] = 0;
+    }
+
+    $t = time();
+    $dt = $t - $cms["config"]["admin.mod.php"]["last_update"];
+    $time_min = 1;
+    if ( $dt < $time_min * 60 ) {
+        $n = ceil( ( $time_min * 60 - $dt ) / 60 );
+        $msg = __( "try_later" );
+        $msg = str_replace( "xxx", $n, $msg );
+        echo( json_encode( array(
+            "info_text"  => $msg,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    // Download New Version
+    if ( ! $content = file_get_contents( $update["download"] ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "download_error" ),
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+    $tmp = $cms["site_dir"] . "/.tmp";
+    if ( is_dir( $tmp ) ) {
+        recurse_rm( $tmp );
+    }
+    if ( ! mkdir( $tmp ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "cant_create_tmp_dir" ) . " " . $tmp,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+    $fn = preg_replace( "/.*\//u", "", $update["download"] );
+    $file = $tmp . "/" . $fn;
+    if ( ! file_put_contents( $file, $content ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "cant_write_file" ) . " " . $file,
+            "info_class" => "info-error",
+            "info_time"  => 50000,
+        ) ) );
+        return;
+    }
+
+    // Unpack New Version
+    // Object Oriented Style for future compability with PHP 8
+    $zip = new ZipArchive;
+    if ( $zip->open( $file ) === TRUE ) {
+        $ok = $zip->extractTo( $tmp );
+        $zip->close();
+        if ( ! $ok ) {
+            echo( json_encode( array(
+                "info_text"  => __( "cant_extract" ) . " " . $file,
+                "info_class" => "info-error",
+                "info_time"  => 5000,
+            ) ) );
+            return;
+        }
+    } else {
+        echo( json_encode( array(
+            "info_text"  => __( "cant_open_zip" ) . " " . $file,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    // Check New Version
+    $fl = "{$tmp}/.cms/filelist.php";
+    if ( ! is_file( $fl ) ) {
+        echo( json_encode( array(
+            "info_text"  => __( "file_list_missing" ) . " " . $fl,
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+    $oldlist = $list;
+    require( $fl );
+    foreach( $list as $fn => $file ) {
+        $f = $tmp . "/" . $fn;
+        if ( ! is_file( $f ) ) {
+            echo( json_encode( array(
+                "info_text"  => __( "file_not_exists" ) . " " . $f,
+                "info_class" => "info-error",
+                "info_time"  => 5000,
+            ) ) );
+            return;
+        }
+        $sha1 = sha1_file( $f );
+        $size = filesize( $f );
+        if ( ! empty( $file["sha1"] ) ) {
+            if ( $file["sha1"] !== $sha1 ) {
+                echo( json_encode( array(
+                    "info_text"  => __( "file_changed" ) . " " . $f,
+                    "info_class" => "info-error",
+                    "info_time"  => 5000,
+                ) ) );
+                return;
+            }
+        }
+        if ( ! empty( $file["size"] ) ) {
+            if ( $file["size"] !== $size ) {
+                echo( json_encode( array(
+                    "info_text"  => __( "file_changed" ) . " " . $f,
+                    "info_class" => "info-error",
+                    "info_time"  => 5000,
+                ) ) );
+                return;
+            }
+        }
+    }
+
+    // Удаление файлов текущей цмс
+    $removed = true;
+    foreach( $oldlist as $fn => $file ) {
+        $from = $cms["site_dir"] . "/" . $fn;
+        
+        if ( in_array( $fn, $allow_change ) and
+        sha1_file( $from ) !== $oldlist[$fn]["sha1"] ) {
+            // Если файл в списке разрешенных на изменение
+            // и sha1 не совпадает, то оставляем его не тронутым
+        } else {
+            $c = unlink( $from );
+            $removed = $removed && $c;
+        }
+        // try remove dir
+        $rdir = preg_replace( "/\/[^\/]+$/u", "", $from );
+        if ( is_dir_and_empty( $rdir ) ) {
+            rmdir( $rdir );
+        }
+    }
+
+    if ( ! $removed ) {
+        echo( json_encode( array(
+            "info_text"  => __( "update_error_remove" ),
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    // Перемещение новой версии в текущую
+    // Разрешенные измененные файлы не перезаписываются
+    $moved = true; // по умолчанию нет ошибок
+    foreach( $list as $file_name => $none ) {
+        $old_file_path = $cms["site_dir"] . "/" . $file_name;
+        if (
+            is_file( $old_file_path ) and
+            in_array( $file_name, $allow_change ) and
+            sha1_file( $old_file_path ) !== $oldlist[$file_name]["sha1"]
+        ) {
+            // Если файл в списке разрешенных на изменение
+            // и sha1 не совпадает, то оставляем его не тронутым
+        } else {
+            $from = $tmp . "/" . $file_name;
+            $to   = $cms["site_dir"] . "/" . $file_name;
+            $ndir = preg_replace( "/\/[^\/]+$/u", "", $to );
+            if ( ! is_dir( $ndir ) ) {
+                mkdir( $ndir, 0777, true );
+            }
+            $c = copy( $from, $to );
+            $moved = $moved && $c;
+        }
+    }
+
+    if ( ! $moved ) {
+        echo( json_encode( array(
+            "info_text"  => __( "update_error_move" ),
+            "info_class" => "info-error",
+            "info_time"  => 5000,
+        ) ) );
+        return;
+    }
+
+    recurse_rm( $tmp );
+
+    // Выполнить запросы в БД, находящиеся в файле update.sql
+    // Не будем обращать внимания на результат запроса,
+    // ведь если идет многократное обновление из dev-ветки,
+    // то скорее всего будут ошибки его выполнения.
+    $update_sql = "{$cms['cms_dir']}/update.sql";
+    $q = "";
+    if ( is_file( $update_sql ) ) {
+        $q = file_get_contents( $update_sql );
+    }
+    if ( $q ) {
+        cms_base_connect();
+        if ( $cms["base"] ) {
+            $res = mysqli_multi_query( $cms["base"], $q );
+        }
+    }
+
+    $cms["config"]["admin.mod.php"]["last_update"] = time();
+
+    // Обновить конфиг
+    $update_config = "{$cms['cms_dir']}/update.php";
+    if ( is_file( $update_config ) ) {
+        include( $update_config );
+    }
+
+    $cms["config"]["admin.mod.php"]["clear_cache"] = true;
+    cms_save_config();
+
+    cms_clear_cache();
+
+    echo( json_encode( array(
+        "info_text"  => __( "successfull_update" ),
+        "info_class" => "info-success",
+        "info_time"  => 5000,
+        "reload"     => true,
+    ) ) );
+    return;
+
+}
+
+
+function cms_update_create_zip() {
+    global $cms;
+    
+    // Данная функция сообщит об отсутствующих файлах
+    $files = cms_update_create_filelist();
+    
+    require( "{$cms['cms_dir']}/filelist.php" );
+    $zip = new ZipArchive();
+    $v = $cms['kernel_version'] . date( "_Y.m.d_Hi" );
+    $name = "coffee-cms-{$v}.zip";
+    $download_url = "{$cms['url']['scheme']}://{$cms['url']['host']}/{$name}";
+    $zipname = "{$cms["site_dir"]}/{$name}";
+
+    if ( $zip->open( $zipname, ZipArchive::CREATE ) !== true ) {
+        echo( json_encode( array(
+            "answer" => __( "cant_create_zip" ) . " {$zipname}",
+        ) ) );
+        return;
+    }
+
+    foreach( $list as $fn => $file ) {
+        $from = "{$cms['site_dir']}/{$fn}";
+        $zip->addFile( $from, $fn );
+    }
+
+    $zip->close();
+
+    file_put_contents( "{$cms["site_dir"]}/update_dev.json", json_encode( array( 
+        "last_version" => $v,
+        "compat"       => $cms["kernel_compat"],
+        "download"     => $download_url,
+    ) ) );
+
+    echo( json_encode( array(
+        "answer"     => $files . "<p>" . __( "archive_created" ) . ": <a href='{$download_url}'>{$download_url}</a></p>",
+    ) ) );
+    return;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/base.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,200 @@
+<?php
+
+$cms["modules"]["base.mod.php"] = array(
+    "name"          => "base_module_name",
+    "description"   => "base_module_description",
+    "files" => array(
+        ".cms/css/base.css",
+        ".cms/mod/base.mod.php",
+        ".cms/lang/ru_RU.UTF-8/base.mod.php",
+        ".cms/lang/en_US.UTF-8/base.mod.php",
+        ".cms/lang/uk_UA.UTF-8/base.mod.php",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["base.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+
+    // defautl settings
+    if ( ! isset( $cms["config"]["base.mod.php"]["host"] ) )
+        $cms["config"]["base.mod.php"]["host"] = "localhost";
+    if ( ! isset( $cms["config"]["base.mod.php"]["port"] ) )
+        $cms["config"]["base.mod.php"]["port"] = "3306";
+    if ( ! isset( $cms["config"]["base.mod.php"]["user"] ) )
+        $cms["config"]["base.mod.php"]["user"] = "";
+    if ( ! isset( $cms["config"]["base.mod.php"]["password"] ) )
+        $cms["config"]["base.mod.php"]["password"] = "";
+    if ( ! isset( $cms["config"]["base.mod.php"]["base"] ) )
+        $cms["config"]["base.mod.php"]["base"] = "";
+    
+    // если админ
+    if ( is_admin() ) {
+        hook_add_fn( "admin", "cms_base_admin" );
+        hook_add_fn( "admin_header", "cms_base_admin_header" );
+        hook_add_fn( "api", "cms_base_connect", 5 );
+    }
+    hook_add_fn( "query", "cms_base_connect", 5 );
+
+}
+
+function cms_base_connect() {
+    global $cms;
+
+    // Это если принудительно вызывают функцию
+    if ( ! empty( $cms["config"]["base.mod.php"]["disabled"] ) ) {
+        return false;
+    }
+
+    if ( ! empty( $cms["config"]["base.mod.php"]["user"] ) ) {
+        // return false on failure
+        mysqli_report( MYSQLI_REPORT_OFF ); // PHP >= 8.1 FIX https://php.watch/versions/8.1/mysqli-error-mode
+        $cms["base"] = mysqli_connect(
+            $cms["config"]["base.mod.php"]["host"],
+            $cms["config"]["base.mod.php"]["user"],
+            $cms["config"]["base.mod.php"]["password"],
+            $cms["config"]["base.mod.php"]["base"],
+            $cms["config"]["base.mod.php"]["port"]
+        );
+        // false and null
+        if ( $cms["base"] == false ) {
+            return false;
+        } else {
+            mysqli_query( $cms["base"], "SET NAMES utf8" ); // PHP-5.2
+            mysqli_set_charset( $cms["base"], "utf8mb4" );
+            return true;
+        }
+    } else {
+        return false;
+    }
+
+}
+
+function cms_base_admin_header() {
+    global $cms;
+    $conf = $cms["config"]["base.mod.php"]["menu"]["base"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+        echo "<link rel=stylesheet href='{$cms['base_path']}css/base.css'>";
+    }
+}
+
+function cms_base_admin() {
+    global $cms;
+
+    // Save settings
+    if ( ! empty( $_POST["save_base_config"] ) ) {
+        if ( $_POST["save_base_config"] === "create" ) {
+            mysqli_report( MYSQLI_REPORT_OFF ); // PHP >= 8.1 FIX https://php.watch/versions/8.1/mysqli-error-mode
+            $base = mysqli_connect( $_POST["host"], $_POST["admin_login"], $_POST["admin_password"], "mysql", $_POST["port"] );
+            if ( $base ) {
+                mysqli_query( $base, "CREATE DATABASE IF NOT EXISTS {$_POST['base']};" );
+                mysqli_query( $base, "CREATE USER IF NOT EXISTS '{$_POST['user']}'@'{$_POST['host']}' IDENTIFIED BY '{$_POST['password']}';" );
+                mysqli_query( $base, "GRANT ALL PRIVILEGES ON {$_POST['base']}.* TO '{$_POST['user']}'@'localhost';" );
+                mysqli_query( $base, "FLUSH PRIVILEGES;" );
+            }
+        }
+
+        $cms["config"]["base.mod.php"]["host"] = $_POST["host"];
+        $cms["config"]["base.mod.php"]["port"] = $_POST["port"];
+        $cms["config"]["base.mod.php"]["base"] = $_POST["base"];
+        $cms["config"]["base.mod.php"]["user"] = $_POST["user"];
+        $cms["config"]["base.mod.php"]["password"] = $_POST["password"];
+        unset( $cms["config"]["base.mod.php"]["menu"]["base"]["class"] );
+        cms_save_config();
+        if ( cms_base_connect() ) {
+            do_hook( "create_tables" );
+
+            // Выполнить запросы в БД, находящиеся в файле update.sql
+            $update_sql = "{$cms['cms_dir']}/update.sql";
+            $q = "";
+            if ( file_exists( $update_sql ) ) {
+                $q = file_get_contents( $update_sql );
+            }
+            if ( $q ) {
+                mysqli_multi_query( $cms["base"], $q );
+            }
+        }
+        $cms["status"] = "302";
+        header( "Location: {$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}" );
+        $cms["hooks"]["admin"]["next"] = ""; // Предотвратить выдачу админки
+        return;
+    }
+
+    $conf = $cms["config"]["base.mod.php"]["menu"]["base"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+        $e_host = htmlspecialchars( $cms['config']['base.mod.php']['host'] );
+        $e_port = htmlspecialchars( $cms['config']['base.mod.php']['port'] );
+        $e_base = htmlspecialchars( $cms['config']['base.mod.php']['base'] );
+        $e_user = htmlspecialchars( $cms['config']['base.mod.php']['user'] );
+        $e_password = htmlspecialchars( $cms['config']['base.mod.php']['password'] );
+        $page = "
+<div class=db-settings>
+    <form method=post>
+        <div class=basic>
+            <div>
+                <div>" . __( "server_address" ) . "</div>
+                <input name=host type=text value=\"{$e_host}\" placeholder=localhost>
+            </div>
+            <div>
+                <div>" . __( "server_port" ) . "</div>
+                <input name=port type=text value=\"{$e_port}\" placeholder=3306>
+            </div>
+            <div>
+                <div>" . __( "db_name" ) . "</div>
+                <input name=base type=text value=\"{$e_base}\">
+            </div>
+            <div>
+                <div>" . __( "db_user" ) . "</div>
+                <input name=user type=text value=\"{$e_user}\">
+            </div>
+            <div>
+                <div>" . __( "db_password" ) . "</div>
+                <div class=password-widget>
+                    <input name=password type=password value=\"{$e_password}\">
+                    <div class=password-eye></div>
+                </div>
+            </div>
+            <button name=save_base_config value=save>" . __( "save" ) . "</button>
+            <div class=pro-btn>PRO</div>
+        </div>
+
+        <div class=pro>
+            <div class=create>" . __( "create_db" ) . "</div>
+            <div>
+                <div>" . __( "admin_login" ) . "</div>
+                <input name=admin_login type=text value>
+            </div>
+            <div>
+                <div>" . __( "admin_passwd" ) . "</div>
+                <div class=password-widget>
+                    <input name=admin_password type=password value>
+                    <div class=password-eye></div>
+                </div>
+            </div>
+            <button name=save_base_config value=create>" . __( "create_btn" ) . "</button>
+        </div>
+    </form>
+</div>";
+
+        // Create menu item if not exists
+        if ( empty( $cms["config"]["base.mod.php"]["menu"]["base"] ) ) {
+            $cms["config"]["base.mod.php"]["menu"]["base"] = array(
+                "title"    => "base_module_name",
+                "sort"     => 20,
+                "section"  => "settings",
+            );
+            cms_save_config();
+        }
+
+        if ( cms_base_connect() === false ) {
+            $cms["config"]["base.mod.php"]["menu"]["base"]["class"] = "red";
+        }
+
+        $cms["admin_pages"]["base"] = $page;
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/menu.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,749 @@
+<?php
+
+$cms["modules"]["menu.mod.php"] = array(
+    "name"        => "menu_module_name",
+    "description" => "menu_module_description",
+    "files"       => array(
+        ".cms/mod/menu.mod.php",
+        ".cms/css/menu.css",
+        ".cms/js/menu.js",
+        ".cms/lang/ru_RU.UTF-8/menu.mod.php",
+        ".cms/lang/en_US.UTF-8/menu.mod.php",
+        ".cms/lang/uk_UA.UTF-8/menu.mod.php",
+        ".cms/man/ru_RU.UTF-8/menu.mod.php.html",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["menu.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+
+    if ( is_admin() ) {
+        hook_add_fn( "create_tables", "cms_menu_create_table" );
+        hook_add_fn( "admin",         "cms_menu_admin", 20 );
+        hook_add_fn( "admin_header",  "cms_menu_admin_header" );
+        hook_add_fn( "api",           "cms_menu_api", 20 );
+    }
+
+}
+
+function cms_menu_admin_header() {
+    global $cms;
+    $conf = $cms["config"]["menu.mod.php"]["menu"]["menu"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+        echo "<link rel=stylesheet href='{$cms['base_path']}css/menu.css'>";
+        echo "<script src='{$cms['base_path']}js/menu.js'></script>";
+    }
+}
+
+
+function cms_menu_api() {
+    global $cms;
+
+    if ( ! empty( $_POST["fn"] ) ) {
+        
+        switch ( $_POST["fn"] ) {
+
+            case "create_menu_item":
+
+                if ( empty( $cms["base"] ) ) {
+                    echo( json_encode( array(
+                        "info_text"  => __( "no_connect_db" ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+
+                $sort = 10;
+                // Пересортировываем имеющиеся
+                $pid = (int) $_POST["pid"];
+                $q = "SELECT mid FROM menu WHERE pid={$pid} ORDER BY `sort`";
+                if ( $r = mysqli_query( $cms["base"], $q ) ) {
+                    while ( $i = mysqli_fetch_assoc( $r ) ) {
+                        $q = "UPDATE menu SET `sort`={$sort} WHERE mid={$i['mid']}";
+                        mysqli_query( $cms["base"], $q );
+                        $sort += 10;
+                    }
+                }
+
+                $q = "INSERT INTO menu SET pid={$pid}, url='', sort={$sort}";
+                if ( $r = mysqli_query( $cms["base"], $q ) ) {
+                    $mid = mysqli_insert_id( $cms["base"] );
+                    echo( json_encode( array(
+                        "info_text"  => __( "created" ),
+                        "info_class" => "info-success",
+                        "info_time"  => 5000,
+                        "list"       => cms_menu_get_items_list(),
+                        "parents"    => cms_menu_get_parents_list(),
+                        "mid"        => $mid,
+                    ) ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "info_text"  => __( "sql_error" ) . mysqli_error( $cms["base"] ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "get_menu_items":
+
+                if ( empty( $cms["base"] ) ) {
+                    echo( json_encode( array(
+                        "info_text"  => __( "no_connect_db" ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+
+                echo( json_encode( array(
+                    "list"       => cms_menu_get_items_list(),
+                    "parents"    => cms_menu_get_parents_list(),
+                ) ) );
+                return;
+
+            break;
+
+            case "del_menu_item":
+
+                if ( $mid = (int) $_POST["mid"] ) {
+                    cms_menu_del( $mid );
+                    
+                    cms_clear_cache();
+                    
+                    echo( json_encode( array(
+                        "info_text"  => __( "deleted" ),
+                        "info_class" => "info-success",
+                        "info_time"  => 5000,
+                        "list"       => cms_menu_get_items_list(),
+                        "parents"    => cms_menu_get_parents_list(),
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "save_menu_item":
+                
+                $mid       = (int) $_POST["mid"];
+                $pid       = (int) $_POST["pid"];
+                $old_pid   = (int) $_POST["old_pid"];
+                $id        = (int) $_POST["id"];
+                $sort      = (int) $_POST["sort"];
+                $title     = mysqli_real_escape_string( $cms["base"], $_POST["title"] );
+                $tag_title = mysqli_real_escape_string( $cms["base"], $_POST["tag_title"] );
+                $classes   = mysqli_real_escape_string( $cms["base"], $_POST["classes"] );
+                $url       = mysqli_real_escape_string( $cms["base"], $_POST["url"] );
+                $area      = mysqli_real_escape_string( $cms["base"], $_POST["area"] );
+                if ( $_POST["target"] === "true" ) {
+                    $target_blank = 1;
+                } else {
+                    $target_blank = 0;
+                }
+
+                $q = "UPDATE menu SET
+                        pid={$pid},
+                        id={$id},
+                        sort={$sort},
+                        title='{$title}',
+                        tag_title='{$tag_title}',
+                        class='{$classes}',
+                        url='{$url}',
+                        area='{$area}',
+                        target_blank={$target_blank}
+                      WHERE mid={$mid}";
+                if ( $r = mysqli_query( $cms["base"], $q ) ) {
+
+                    cms_clear_cache();
+                    
+                    $r = array(
+                        "ok"         => "true",
+                        "info_text"  => __( "updated" ), // FIXME: never fire
+                        "info_class" => "info-success",
+                        "info_time"  => 5000,
+                        //"list"       => cms_menu_get_items_list(),
+                        "parents"    => cms_menu_get_parents_list(),
+                    );
+                    if ( $pid != $old_pid ) {
+                        $r["list"] = cms_menu_get_items_list();
+                    }
+                    echo ( json_encode( $r ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "ok"         => "false",
+                        "info_text"  => __( "update_properties_error" ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+
+            break;
+
+            case "get_search_pages_list":
+
+                if ( empty( $cms["base"] ) ) {
+                    echo( json_encode( array(
+                        "no_database"  => "<span class=no-database>" . __( "no_connect_db" ) . "</span>",
+                    ) ) );
+                    return;
+                }
+                
+                //$s = mysqli_real_escape_string( $cms["base"], $_POST["search"] );
+                //$s = str_replace( " ", "%", $s );
+                $s = preg_replace( "/\s/u", "", $_POST["search"] );
+                $s = preg_split( '//u', $s, -1, PREG_SPLIT_NO_EMPTY );
+                foreach( $s as $n => $ch ) {
+                    $s[$n] = mysqli_real_escape_string( $cms["base"], $ch );
+                }
+                $s = implode( "%", $s );
+                $html[] = array(
+                    "sort" => 2000000000,
+                    "html" => "<li data-id=0 data-url>" . __( "no_page" ) . "</li>"
+                );
+                // pages without blocks
+                $q = "SELECT id, title, url, pin FROM pages WHERE title LIKE '%{$s}%' OR url LIKE '%{$s}%' ORDER BY ( id + pin * 1000000000 ) DESC LIMIT 10";
+                if ( $res = mysqli_query( $cms["base"], $q ) ) {
+                    while ( $page = mysqli_fetch_assoc( $res ) ) {
+                        $title = htmlspecialchars( $page["title"] );
+                        $html[] = array(
+                            "sort" => $page["id"] + $page["pin"] * 1000000000,
+                            "html" => "<li data-id={$page['id']} data-url='{$page['url']}'>{$title}</li>"
+                        );
+                    }
+                }
+                // pages with blocks
+                $q = "SELECT id, title, url, pin FROM blocks_pages WHERE title LIKE '%{$s}%' OR url LIKE '%{$s}%' ORDER BY ( id + pin * 1000000000 ) DESC LIMIT 10";
+                if ( $res = mysqli_query( $cms["base"], $q ) ) {
+                    while ( $page = mysqli_fetch_assoc( $res ) ) {
+                        $title = htmlspecialchars( $page["title"] );
+                        $html[] = array(
+                            "sort" => $page["id"] + $page["pin"] * 1000000000,
+                            "html" => "<li data-id={$page['id']} data-url='{$page['url']}'>{$title}</li>"
+                        );
+                    }
+                }
+                cms_asort( $html );
+                $html = array_reverse( $html );
+                $list = "";
+                foreach( $html as $item ) {
+                    $list .= $item["html"];
+                }
+                echo( json_encode( array(
+                    "html" => $list,
+                ) ) );
+                return;
+            break;
+
+        }
+    }
+}
+
+function cms_menu_del( $mid ) {
+    global $cms;
+
+    // Recursively delete children items
+    $q = "SELECT mid FROM menu WHERE pid={$mid}";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $r = mysqli_fetch_assoc( $res ) ) {
+            cms_menu_del( $r["mid"] );
+        }
+    }
+    
+    mysqli_query( $cms["base"], "DELETE FROM menu WHERE mid=$mid" );
+
+}
+
+function cms_menu_get_items_list( $pid = 0 ) {
+    global $cms;
+
+    if ( empty( $cms["base"] ) ) {
+        echo( json_encode( array(
+            "no_database"  => "<span class=no-database>" . __( "no_connect_db" ) . "</span>",
+        ) ) );
+        return;
+    }
+
+    $list = "";
+
+    $q = "SELECT * FROM menu WHERE pid={$pid} ORDER BY sort, title";
+    if ( ! $res = mysqli_query( $cms["base"], $q ) ) {
+
+        return "<span class=no-tables>" . __( "no_tables_db" ) . "</span>";
+
+    } else {
+
+        // Read template settings
+        cms_template_load_settings();
+
+        // Menu Areas
+        $area_options   = "";
+        $tpl = $cms["config"]["template.mod.php"]["template"];
+        if ( isset( $cms["menu_areas"] ) ) {
+            foreach ( $cms["menu_areas"] as $area => $a ) {
+                //- удалить после перехода на $cms["menu_areas"]["header_en"] = "Header En";
+                if ( is_array( $a ) && isset( $a["title"] ) ) {
+                    $title = $a["title"];
+                } elseif ( is_string( $a ) ) {
+                    $title = $a;
+                }
+                $area_options .= "<div class=option value='{$area}'>{$title}</div>";
+            }
+        }
+
+        // Translations
+        $tr_title              = __( "title" );
+        $tr_area               = __( "area" );
+        $tr_no_area            = __( "no_area" );
+        $tr_classes            = __( "classes" );
+        $tr_sort               = __( "sort" );
+        $tr_save               = __( "save" );
+        $tr_delete             = __( "delete" );
+        $tr_append             = __( "append_item" );
+        $tr_prop               = __( "properties" );
+        $tr_parent             = __( "parent" );
+        $tr_no_parent          = __( "no_parent" );
+        $tr_placeholder        = __( "placeholder_hint" );
+        $tr_no_page            = __( "no_page" );
+        $tr_search             = __( "search" );
+        $tr_tag_title          = __( "hint" );
+        $tr_new_window         = __( "target_blank" );
+        $tr_page               = __( "page" );
+        $tr_page_deleted       = __( "deleted_page" );
+        $tr_menu_item          = __( "no_page" );
+
+        while ( $item = mysqli_fetch_assoc( $res ) ) {
+
+            // Children Items
+            $sublist = cms_menu_get_items_list( $item["mid"] );
+            if ( $sublist ) {
+                $sublist = "<div class=items-grid>{$sublist}</div>";
+            }
+
+            if ( $item["pid"] == 0 ) {
+
+                // area title
+                //- подправить после перехода на $cms["menu_areas"]["header_en"] = "Header En";
+                if ( empty( $item["area"] ) ) {
+                    $area_title = $tr_no_area;
+                } elseif ( isset( $cms["menu_areas"][ $item['area'] ] ) && is_string( $cms["menu_areas"][ $item['area'] ] ) ) {
+                    $area_title = $cms["menu_areas"][ $item['area'] ];
+                } elseif ( isset( $cms["menu_areas"][ $item['area'] ] ) && is_array( $cms["menu_areas"][ $item['area'] ] ) ) {
+                    $area_title = $cms["menu_areas"][ $item['area'] ]['title'];
+                } else {
+                    $area_title = $item['area'];
+                }
+
+                $list   .= "
+<div>
+
+    <div class=menu data-item={$item['mid']}>
+
+        <input name=title type=text value='{$item['title']}'>
+        <input name=sort type=text value='{$item['sort']}' data-sort='{$item['sort']}'>
+
+        <div class=menu-buttons>
+            <div class=prop>{$tr_prop}</div>
+            <div class=append>{$tr_append}</div>
+            <div class=save><span>{$tr_save}</span></div>
+            <div class=del>{$tr_delete}</div>
+        </div>
+
+        <div class=menu-prop>
+            <div class='area title'>{$tr_area}:</div>
+
+            <div class=area-select-grid>
+                <div class=field-select-menu data-menu-area='{$item['area']}'>
+                    <div class=value>{$area_title}</div>
+                    <div class=icon></div>
+                </div>
+                <div class=field-options>
+                    <div class=option value=''>{$tr_no_area}</div>
+                    {$area_options}
+                </div>
+            </div>
+
+            <div class='classes title'>{$tr_classes}:</div>
+            <input name=classes type=text value='{$item['class']}'>
+        </div>
+
+    </div>
+
+    {$sublist}
+
+</div>";
+
+            } else {
+                
+                $disabled_url = "disabled";
+
+                if ( $item["id"] === "0" ) {
+                    $item["select_title"] = $tr_no_page;
+                    $disabled_url = "";
+                    // free item
+                    if ( ! empty( $item["title"] ) ) {
+                        $item["link_title"] = $item["title"];
+                    } else {
+                        $item["link_title"] = $tr_menu_item;
+                    }
+                } else {
+                    // Дернуть модуль страниц и модуль страниц с блоками
+                    // чтобы предоставили информацию
+                    $cms["menu.mod.php"]["item"] = &$item;
+                    do_hook( "mod_menu_item" );
+
+                }
+
+                // Wrap title in URL
+                if ( $item["id"] === "0" && empty( $item['url'] ) ) {
+                    $link = "<a target=_blank>{$item["link_title"]}</a>";
+                } elseif ( $item["id"] === "0" && ! empty( $item['url'] ) ) {
+                    $link = "<a href='{$item['url']}' target=_blank>{$item["link_title"]}</a>";
+                } else {
+                    $link = "<a href='{$cms['base_path']}{$item['url']}' target=_blank>{$item["link_title"]}</a>";
+                }
+
+                // Checkbox "Open in new Tab"
+                if ( $item["target_blank"] ) {
+                    $checked = "checked";
+                } else {
+                    $checked = "";
+                }
+
+                $e_tag_title = htmlspecialchars( $item["tag_title"] );
+
+                $list .= "
+<div>
+
+    <div class=item data-item={$item['mid']}>
+
+        {$link}
+
+        <div class=menu-buttons>
+            <div class=prop>{$tr_prop}</div>
+            <div class=append>{$tr_append}</div>
+            <div class=save><span>{$tr_save}</span></div>
+            <div class=del>{$tr_delete}</div>
+        </div>
+
+        <div class=menu-prop>
+            <div class='title name'>{$tr_title}:</div>
+            <input name=title type=text value='{$item['title']}' placeholder='{$tr_placeholder}'>
+            <div class='sort title'>{$tr_sort}:</div>
+            <input name=sort type=text value='{$item['sort']}'>
+            <div class='parent title'>{$tr_parent}:</div>
+
+            <div class=parent-select-grid>
+                <div class=field-select data-parent='{$item['pid']}' data-old-parent='{$item['pid']}'>
+                    <div class=value></div>
+                    <div class=icon></div>
+                </div>
+                <div class=field-options>
+                    <div class=option value=0>{$tr_no_parent}</div>
+                </div>
+            </div>
+
+            <div class='classes title'>{$tr_classes}:</div>
+            <input name=classes type=text value='{$item['class']}'>
+            <div class='page title'>{$tr_page}:</div>
+            <div class=select-grid>
+                <div class=field-select name=id data-id={$item['id']} data-old-id={$item['id']}>
+                    <div class=value>{$item['select_title']}</div>
+                    <div class=icon></div>
+                </div>
+                <div class=field-options>
+                    <div class=select-dropdown>
+                        <div class=field-search>
+                            <input class=search-field type=text placeholder='{$tr_search}'>
+                        </div>
+                        <ul class=list-search>
+                            <li data-id=0 data-url>{$tr_no_page}</li>
+                        </ul>
+                    </div>
+                </div>
+            </div>
+            <div class='tag title'>{$tr_tag_title}:</div>
+            <input name=tag_title type=text value=\"{$e_tag_title}\">
+            <div class='url title'>URL:</div>
+            <div class=target-blank>
+                <input name=url type=text value='{$item['url']}' {$disabled_url}>
+                <input name=targetblank type=checkbox {$checked} title='{$tr_new_window}'>
+            </div>
+        </div>
+    </div>
+    
+    {$sublist}
+
+</div>";
+            }
+            
+        }
+    }
+    return $list;
+}
+
+function cms_menu_get_parents_list( $pid = 0, $lvl = 0 ) {
+    global $cms;
+    $parents = "";
+    if ( empty( $cms["base"] ) ) {
+        return "";
+    }
+    $q = "SELECT mid, pid, title, id FROM menu WHERE pid={$pid} ORDER BY sort";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $item = mysqli_fetch_assoc( $res ) ) {
+            if ( empty( $item["title"] ) and $item["id"] !== "0" ) {
+                $q = "SELECT title FROM pages WHERE id={$item['id']}";
+                if ( $res_page = mysqli_query( $cms["base"], $q ) and $page = mysqli_fetch_assoc( $res_page ) ) {
+                    $item["title"] = $page["title"];
+                } else {
+                    $item["title"] = __( "deleted_page" );
+                }
+            } elseif ( empty( $item["title"] ) ) {
+                $item["title"] = __( "no_page" );
+            }
+            $title = htmlspecialchars( $item["title"] );
+            $ident = str_repeat( "&emsp;", $lvl );
+            $parents .= "<div class=option value={$item['mid']}>{$ident}{$title}</div>";
+            $parents .= cms_menu_get_parents_list( $item["mid"], $lvl + 1 );
+        }
+    }
+    return $parents;
+}
+
+function cms_menu_admin() {
+    global $cms;
+
+    $conf = $cms["config"]["menu.mod.php"]["menu"]["menu"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    $page = "
+<div class=main-main>
+    <div class=menu-grid>
+    </div>
+</div>
+<div class=main-footer>
+    <a class=create data-item=0>" . __( "add_menu" ) . "</a>
+</div>";
+
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["menu.mod.php"]["menu"]["menu"] ) ) {
+        $cms["config"]["menu.mod.php"]["menu"]["menu"] = array(
+            "title"    => "menu_module_name",
+            "sort"     => 200,
+            "section"  => "content",
+        );
+        cms_save_config();
+    }
+
+    $cms["admin_pages"]["menu"] = $page;
+
+    }
+}
+
+function cms_menu_create_table() {
+    global $cms;
+
+    mysqli_query( $cms["base"], "
+    CREATE TABLE IF NOT EXISTS `menu` (
+        `mid` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+        `pid` int(11) DEFAULT 0,
+        `id` int(11) NOT NULL DEFAULT 0,
+        `title` varchar(255) NOT NULL DEFAULT '',
+        `tag_title` varchar(255) NOT NULL DEFAULT '',
+        `url` varchar(255) NOT NULL DEFAULT '',
+        `sort` int(11) NOT NULL DEFAULT 1000,
+        `class` varchar(255) NOT NULL DEFAULT '',
+        `area` varchar(32) NOT NULL DEFAULT '',
+        `target_blank` tinyint(1) NOT NULL DEFAULT 0,
+        UNIQUE KEY `mid` (`mid`)
+      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+    ");
+
+}
+
+// One or more Menus
+function menu( $area ) {
+    global $cms;
+    if ( empty( $cms["base"] ) ) { return ""; } // fix php 8.0
+    $area = mysqli_real_escape_string( $cms["base"], $area );
+    $q = "SELECT * FROM menu WHERE pid=0 AND area='{$area}' ORDER BY sort";
+    $html = "";
+    $cms["menu"] = array();
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $menu = mysqli_fetch_assoc( $res ) ) {
+            $cms["menu.mod.php"]["menu"] = $menu;
+            $html .= menu1( $menu["mid"] );
+        }
+    }
+    return $html;
+}
+
+
+function menu1( $pid = 0 ) {
+    global $cms;
+    
+    $html = "";
+    
+    $q = "SELECT * FROM menu WHERE pid={$pid} ORDER BY sort";
+    // Child Items
+    if ( $res2 = mysqli_query( $cms["base"], $q ) ) {
+        while ( $item = mysqli_fetch_assoc( $res2 ) ) {
+
+            // Совместимость с модулем блоков
+            $q_blocks = "SELECT * FROM blocks_pages WHERE id={$item['id']}";
+            $page = NULL;
+            if ( $res_b = mysqli_query( $cms["base"], $q_blocks ) ) {
+                $page = mysqli_fetch_assoc( $res_b );
+            }
+
+            // Если отработал модуль блоков, то не искать страницы
+            $q_pages = "SELECT * FROM pages WHERE id={$item['id']}";
+            if ( ! $page && $res_p = mysqli_query( $cms["base"], $q_pages ) ) {
+                $page = mysqli_fetch_assoc( $res_p );
+            }
+
+            if ( $item["id"] !== "0" ) {
+                $item["url"] = $cms["base_path"] . $page["url"];
+                if ( empty( $item["title"] ) ) {
+                    if ( empty( $page["title"] ) ) {
+                        $item["title"] = __( "deteled_page" );
+                    } else {
+                        $item["title"] = $page["title"];
+                    }
+                }
+            }
+
+            if ( isset( $cms["page"]["url"] ) && $item["url"] === $cms["base_path"] . $cms["page"]["url"] && !( $item["id"] === "0" && empty( $item['url'] ) ) ) {
+                $class = "active";
+            } else {
+                $class = "";
+            }
+            if ( $item["target_blank"] ) {
+                $target_blank = " target=_blank";
+            } else {
+                $target_blank = "";
+            }
+            if ( $item["tag_title"] ) {
+                $e_tag_title = htmlspecialchars( $item["tag_title"] );
+                $tag_title = " title=\"{$e_tag_title}\"";
+            } else {
+                $tag_title = "";
+            }
+
+            // submenu
+            $sub = menu1( $item["mid"] );
+            if ( ! empty( $sub ) ) {
+                $class .= " has-sub-menu";
+                $has_submenu = true;
+            } else {
+                $has_submenu = false;
+            }
+            if ( ! empty( $class ) || ! empty( $item["class"] ) ) {
+                $class = trim( "{$class} {$item['class']}" );
+            }
+            
+            // Формирование ссылки или span
+            if ( $item["id"] === "0" && empty( $item['url'] ) ) {
+                $link = "<a{$tag_title}>{$item['title']}</a>";
+            } elseif ( $item["id"] !== "0" && isset( $page["published"] ) && $page["published"] === "0" ) {
+                // снята с публикации
+                $link = "<a{$tag_title}>{$item['title']}</a>";
+                $class = trim( "{$class} unpublished" );
+            } else {
+                $link = "<a href='{$item['url']}'{$target_blank}{$tag_title}>{$item['title']}</a>";
+            }
+
+            
+            // Для хука
+            $cms["menu.mod.php"]["item_link"] = array(
+                "link" => $link,
+                "has_submenu" => $has_submenu,
+            );
+            do_hook( "menu_item_link" );
+
+
+            if ( empty( $sub ) && $item["id"] !== "0" && isset( $page["published"] ) &&  $page["published"] === "0" ) {
+                // Если нет дочерних и страница снята с публикации, то не добавлять
+                $item_html = "";
+            } else {
+                if ( ! empty( $class ) ) {
+                    $tag_class = " class='{$class}'";
+                } else {
+                    $tag_class = "";
+                }
+                $item_html = "<li{$tag_class}>{$cms["menu.mod.php"]["item_link"]["link"]}{$sub}</li>";
+            }
+
+
+            // Для хука
+            $cms["menu.mod.php"]["item"] = array(
+                "html" => $item_html,
+                "has_submenu" => $has_submenu,
+            );
+            do_hook( "menu_item" );
+            
+
+            $html .= $cms["menu.mod.php"]["item"]["html"];
+        }
+    }
+
+    $q = "SELECT * FROM menu WHERE mid={$pid}";
+    // If exists childs items
+    if ( ! empty( $html ) and $res = mysqli_query( $cms["base"], $q ) and $menu = mysqli_fetch_assoc( $res ) ) {
+        if ( ! empty( $menu["class"] ) && $menu["pid"] == 0 ) {
+            $class = " class='{$menu['class']}'";
+        } elseif ( $menu["pid"] != 0 ) {
+            $class = " class='sub-menu'";
+        } else {
+            $class = "";
+        }
+        $html = "<ul{$class}>{$html}</ul>";
+    }
+
+    return $html;
+}
+
+
+// Новое меню
+function dyn_menu( $area ) {
+    global $cms;
+
+    if ( empty( $cms["base"] ) ) { return ""; } // fix php 8.0
+//file_put_contents( __DIR__ . "/menu_export.php", "<?php\n" );
+    $cms["menu"] = array();
+    $area = mysqli_real_escape_string( $cms["base"], $area );
+    $q = "SELECT * FROM menu WHERE pid=0 AND area='{$area}' ORDER BY sort";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $menu = mysqli_fetch_assoc( $res ) ) {
+            $cms["menu"][ $menu["mid"] ] = $menu;
+            menu_get_items( $menu["mid"], $cms["menu"][ $menu["mid"] ] );
+        }
+    }
+    do_hook( "menu" );
+    
+//file_put_contents( __DIR__ . "/menu_export.php", "\$cms['menu'] = " . var_export( $cms["menu"], true ) . ";\n", FILE_APPEND );
+}
+
+
+function menu_get_items( $pid, &$items ) {
+    global $cms;
+    
+    $items["items"] = array();
+    $q = "SELECT * FROM menu WHERE pid={$pid} ORDER BY sort";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $item = mysqli_fetch_assoc( $res ) ) {
+            menu_get_items( $item["mid"], $item );
+            $items["items"][] = $item;
+        }
+    }
+    //file_put_contents( __DIR__ . "/menu_export.php", "\$a = " . var_export( $items, true ) . ";\n", FILE_APPEND );
+
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/pages.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1322 @@
+<?php
+
+$cms["modules"]["pages.mod.php"] = array(
+    "name"        => "pages_module_name",
+    "description" => "pages_module_description",
+    "files"       => array(
+        ".cms/mod/pages.mod.php",
+        ".cms/js/pages.js",
+        ".cms/css/pages.css",
+        ".cms/lang/ru_RU.UTF-8/pages.mod.php",
+        ".cms/lang/en_US.UTF-8/pages.mod.php",
+        ".cms/lang/uk_UA.UTF-8/pages.mod.php",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["pages.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+    
+    if ( is_admin() ) {
+        if ( empty( $_COOKIE["pages_pager"] ) ) {
+            if ( PHP_VERSION_ID < 70300 ) {
+                setcookie( "pages_pager", 100 );
+            } else {
+                setcookie( "pages_pager", 100, array( "SameSite" => "Lax" ) );
+            }
+        }
+        
+        hook_add_fn( "create_tables", "cms_pages_create_tables" );
+        hook_add_fn( "admin", "cms_pages_admin" );
+        hook_add_fn( "admin_header", "cms_pages_admin_header" );
+        hook_add_fn( "api", "cms_pages_api" );
+        hook_add_fn( "mod_menu_item", "cms_pages_menu_item" );
+    }
+    hook_add_fn( "query", "cms_pages_query" );
+    hook_add_fn( "menu", "cms_pages_menu" );
+
+}
+
+function cms_pages_menu_item() {
+    global $cms;
+    if ( empty( $cms["menu.mod.php"]["item"]["found"] ) ) {
+        $q = "SELECT id, title, url FROM pages WHERE id={$cms["menu.mod.php"]["item"]['id']}";
+        if ( $res_page = mysqli_query( $cms["base"], $q ) ) {
+            if ( $page = mysqli_fetch_assoc( $res_page ) ) {
+                $cms["menu.mod.php"]["item"]["link_title"] = $page["title"];
+                $cms["menu.mod.php"]["item"]["select_title"] = $page["title"];
+                $cms["menu.mod.php"]["item"]["url"] = $page["url"];
+                $cms["menu.mod.php"]["item"]["found"] = true;
+            } else {
+                $cms["menu.mod.php"]["item"]["link_title"] = __( "deleted_page" );
+                $cms["menu.mod.php"]["item"]["select_title"] = __( "deleted_page" );
+                $cms["menu.mod.php"]["item"]["found"] = false;
+            }
+        }
+    }
+}
+    
+function cms_pages_admin_header() {
+    global $cms;
+    $hide = true;
+    foreach ( $cms["config"]["pages.mod.php"]["menu"] as $menu ) {
+        $hide = $hide && ( ! empty( $menu["hide"] ) || ! empty( $cms["config"]["admin_sections"][ $menu["section"] ]["hide"] ) );
+    }
+    if ( ! $hide ) {
+    echo "<link rel=stylesheet href='{$cms['base_path']}css/pages.css'>";
+    echo "<link rel=stylesheet href='{$cms['base_path']}lib/codemirror/lib/codemirror.css'>";
+    echo "<link rel=stylesheet href='{$cms['base_path']}lib/codemirror/addon/hint/show-hint.css'>";
+    echo "<link rel=stylesheet href='{$cms['base_path']}lib/codemirror/addon/dialog/dialog.css'>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/lib/codemirror.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/hint/show-hint.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/hint/xml-hint.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/hint/html-hint.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/hint/javascript-hint.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/hint/anyword-hint.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/hint/css-hint.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/selection/active-line.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/search/search.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/search/searchcursor.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/search/jump-to-line.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/dialog/dialog.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/edit/matchbrackets.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/edit/matchtags.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/edit/closebrackets.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/edit/closetag.js'></script>";
+    #region folding
+    echo "<link rel=stylesheet href='{$cms['base_path']}lib/codemirror/addon/fold/foldgutter.css'>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/foldcode.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/foldgutter.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/brace-fold.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/xml-fold.js'></script>";
+    //echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/indent-fold.js'></script>";
+    //echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/markdown-fold.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/addon/fold/comment-fold.js'></script>";
+    #endregion
+    echo "<script src='{$cms['base_path']}lib/codemirror/mode/htmlmixed/htmlmixed.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/mode/xml/xml.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/mode/javascript/javascript.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/mode/css/css.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/mode/clike/clike.js'></script>";
+    echo "<script src='{$cms['base_path']}lib/codemirror/mode/php/php.js'></script>";
+    echo "<script src='{$cms['base_path']}js/pages.js'></script>";
+    }
+}
+
+
+function cms_pages_api() {
+    global $cms;
+    
+    if ( ! empty( $_POST["fn"] ) ) {
+        
+        switch ( $_POST["fn"] ) {
+
+            case "create_page":
+
+                if ( empty( $cms["base"] ) ) {
+                    echo( json_encode( array(
+                        "no_database"  => "<span class=no-database>" . __( "no_connect_db" ) . "</span>",
+                    ) ) );
+                    return;
+                }
+                
+                // Read template settings
+                cms_template_load_settings();
+
+                $tpl = "page";
+                
+                // Default text for new page from template
+                if ( ! empty( $cms["templates"][ $cms["template"] ]["page_templates"][$tpl] ) ) {
+                    $text = mysqli_real_escape_string( $cms["base"], $cms["templates"][ $cms["template"] ]["page_templates"][$tpl] );
+                } else {
+                    $text = "";
+                }
+                
+                $modified = number_format( microtime( true ), 6, ".", "" );
+                //$modified = 0; // Это позволит исключить новые страницы из RSS, но сортировка страниц в админке по этому полю
+                $created = date( "Y-m-d H:i:s", $modified );
+                
+                $q = "INSERT INTO pages SET created='{$created}', modified='{$modified}', tpl='{$tpl}', text='{$text}'";
+                if ( $r = mysqli_query( $cms["base"], $q ) ) {
+                    $id = mysqli_insert_id( $cms["base"] );
+                } else {
+                    echo( json_encode( array(
+                        "info_text"  => __( "error_creating_page" ) . mysqli_error( $cms["base"] ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+
+                // Create title, url and update in database
+                $title     = __( "page_default_title" );
+                $url       = "{$id}";
+                
+                // Если страница одна, то сделать ее главной
+                $q = "SELECT COUNT(*) FROM pages";
+                $res = mysqli_query( $cms["base"], $q );
+                $row = mysqli_fetch_assoc( $res );
+                $count = $row["COUNT(*)"];
+                if ( $count == 1 ) {
+                    $url = "";
+                    $title = __( "home_page" );
+                }
+                
+                $q = "UPDATE pages SET title='{$title}', url='{$url}' WHERE id={$id}";
+                if ( $r = mysqli_query( $cms["base"], $q ) ) {
+                    $_POST["where"] = "id={$id}";
+                    $r = cms_pages_get_pages_list();
+                    $r = array_merge( $r,
+                        array(
+                            "info_text"  => __( "page_created" ),
+                            "info_class" => "info-success",
+                            "info_time"  => 5000,
+                        )
+                    );
+                    echo( json_encode( $r ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "info_text"  => __( "error_creating_page" ) . mysqli_error( $cms["base"] ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "save_prop":
+
+                $_POST["url"] = trim( $_POST["url"] );
+                if ( substr( $_POST["url"], 0, 1 ) === "/" ) {
+                    $_POST["url"]  = substr( $_POST["url"], 1 );
+                }
+
+                // Read template settings
+                cms_template_load_settings();
+                
+                $id          = (int) $_POST["id"];
+                $title       = mysqli_real_escape_string( $cms["base"], $_POST["title"] );
+                $seo_title   = mysqli_real_escape_string( $cms["base"], $_POST["seo_title"] );
+                $description = mysqli_real_escape_string( $cms["base"], $_POST["description"] );
+                $tags        = mysqli_real_escape_string( $cms["base"], $_POST["tags"] );
+
+                // get page text
+                $q    = "SELECT `text` FROM `pages` WHERE `id`={$id}";
+                $r    = mysqli_query( $cms["base"], $q );
+                $row  = mysqli_fetch_assoc( $r );
+                $text = $row["text"];
+
+                $update_text = "";
+                // Default text for old_template
+                if ( ! empty( $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["old_template"] ] ) ) {
+                    $text2 = $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["old_template"] ];
+                } else {
+                    $text2 = "";
+                }
+
+                // Change template text
+                if ( $_POST["old_template"] !== $_POST["template"] and $text === $text2 ) {
+                    // Default text for template
+                    if ( ! empty( $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["template"] ] ) ) {
+                        $text = mysqli_real_escape_string( $cms["base"], $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["template"] ] );
+                        $update_text = ", `text`='{$text}'";
+                    }
+                }
+
+                $esc_url = mysqli_real_escape_string( $cms["base"], $_POST["url"] );
+
+                // Check dupl
+                if ( $r = mysqli_query( $cms["base"], "SELECT COUNT(*) FROM `pages` WHERE `url`='{$esc_url}' AND `id`<>{$id}" ) ) {
+                    if ( $cnt = mysqli_fetch_assoc( $r ) ) {
+                        if ( $cnt["COUNT(*)"] > 0 ) {
+                            $_POST["url"] = cms_uid();
+                            $esc_url = mysqli_real_escape_string( $cms["base"], $_POST["url"] );
+                        }
+                    }
+                }
+
+                if ( empty( $_POST["date"] ) ) { $_POST["date"] = "0000-00-00"; }
+                if ( empty( $_POST["time"] ) ) { $_POST["time"] = "00:00"; }
+                $created = mysqli_real_escape_string( $cms["base"], $_POST["date"] . " " . $_POST["time"] . ":00" );
+                $tpl = mysqli_real_escape_string( $cms["base"], $_POST["template"] );
+                $modified = str_replace( ",", ".", microtime( true ) );
+                $q = "UPDATE `pages` SET 
+                        `title`='{$title}', 
+                        `seo_title`='{$seo_title}', 
+                        `description`='{$description}', 
+                        `tags`='{$tags}', 
+                        `created`='{$created}',
+                        `modified`='{$modified}',
+                        `tpl`='{$tpl}', 
+                        `url`='{$esc_url}'
+                        {$update_text}
+                      WHERE id={$id}";
+
+                // clear cache before change url
+                if ( function_exists( "cms_clear_cache" ) ) {
+                    cms_clear_cache();
+                }
+                if ( $r = mysqli_query( $cms["base"], $q ) ) {
+                    if ( strtotime( $created ) > time() ) {
+                        $planned = true;
+                    } else {
+                        $planned = false;
+                    }
+                    $time = strtotime( $created );
+                    $created = date( "d.m.Y", $time )."<br>".date( "H:i", $time );
+
+                    $r = array(
+                        "info_text"   => __( "updated" ),
+                        "info_class"  => "info-success",
+                        "info_time"   => 1000,
+                        "title"       => htmlspecialchars( $_POST["title"] ),
+                        "url"         => $_POST["url"],
+                        "base_path"   => $cms["base_path"],
+                        "created"     => $created,
+                        "planned"     => $planned,
+                        "ok"          => "true",
+                    );
+                    if ( function_exists( "cms_sitemap_update" ) ) {
+                        cms_sitemap_update();
+                    }
+                    if ( function_exists( "cms_rss_update" ) ) {
+                        cms_rss_update();
+                    }
+
+                    // Если страница задействована в меню, то нужно сообщить,
+                    // что требуется перезагрузить страницу меню
+                    $q = "SELECT * FROM `menu` WHERE `id`={$id}";
+                    if ( mysqli_query( $cms["base"], $q ) and mysqli_affected_rows( $cms["base"] ) ) {
+                        $r["update_menu"] = "true";
+                    } else {
+                        $r["update_menu"] = "false";
+                    }
+
+                    echo( json_encode( $r ) );
+                    return;
+                }
+            break;
+
+            case "save_page":
+
+                $_POST["url"] = trim( $_POST["url"] );
+                if ( substr( $_POST["url"], 0, 1 ) === "/" && strlen( $_POST["url"] ) > 1 ) {
+                    $_POST["url"]  = substr( $_POST["url"], 1 );
+                }
+
+                // Read template settings
+                cms_template_load_settings();
+                
+                // hook for save page
+                do_hook( "save_page" );
+                
+                $id           = (int) $_POST["id"];
+                $old_modified = mysqli_real_escape_string( $cms["base"], $_POST["modified"] );
+                $modified     = number_format( microtime( true ), 6, ".", "" );
+                $text         = mysqli_real_escape_string( $cms["base"], $_POST["text"] );
+
+                // Default text for old_template
+                if ( ! empty( $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["old_template"] ] ) ) {
+                    $text2 = mysqli_real_escape_string( $cms["base"], $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["old_template"] ] );
+                } else {
+                    $text2 = "";
+                }
+
+                // Change template text
+                $new_text = "";
+                if ( $_POST["old_template"] !== $_POST["template"] and $text === $text2 ) {
+                    // Default text for template
+                    if ( ! empty( $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["template"] ] ) ) {
+                        $new_text = $cms["templates"][ $cms["template"] ]["page_templates"][ $_POST["template"] ];
+                        $text = mysqli_real_escape_string( $cms["base"], $new_text );
+                    }
+                }
+
+
+                $title       = mysqli_real_escape_string( $cms["base"], $_POST["title"] );
+                $seo_title   = mysqli_real_escape_string( $cms["base"], $_POST["seo_title"] );
+                $description = mysqli_real_escape_string( $cms["base"], $_POST["description"] );
+                $tags        = mysqli_real_escape_string( $cms["base"], $_POST["tags"] );
+
+                
+                $esc_url = mysqli_real_escape_string( $cms["base"], $_POST["url"] );
+
+                // Check dupl
+                if ( $r = mysqli_query( $cms["base"], "SELECT COUNT(*) FROM `pages` WHERE `url`='{$esc_url}' AND `id`<>{$id}" ) ) {
+                    if ( $cnt = mysqli_fetch_assoc( $r ) ) {
+                        if ( $cnt["COUNT(*)"] > 0 ) {
+                            $_POST["url"] = cms_uid();
+                            $esc_url = mysqli_real_escape_string( $cms["base"], $_POST["url"] );
+                        }
+                    }
+                }
+
+                if ( empty( $_POST["date"] ) ) { $_POST["date"] = "0000-00-00"; }
+                if ( empty( $_POST["time"] ) ) { $_POST["time"] = "00:00"; }
+                $created = mysqli_real_escape_string( $cms["base"], $_POST["date"] . " " . $_POST["time"] . ":00" );
+                $tpl = mysqli_real_escape_string( $cms["base"], $_POST["template"] );
+
+                $q = "UPDATE pages SET 
+                        text='{$text}', 
+                        modified={$modified},
+                        title='{$title}', 
+                        seo_title='{$seo_title}', 
+                        description='{$description}',
+                        tags='{$tags}',
+                        created='{$created}',
+                        tpl='{$tpl}', 
+                        url='{$esc_url}'
+                      WHERE id={$id} AND modified={$old_modified}";
+                
+                // clear cache before change url
+                if ( function_exists( "cms_clear_cache" ) ) {
+                    cms_clear_cache();
+                }
+
+                if ( mysqli_query( $cms["base"], $q ) ) {
+                    
+                    if ( ! mysqli_affected_rows( $cms["base"] ) ) {
+                        echo( json_encode( array(
+                            "ok"        => "false",
+                            "info_text" => __( "page_changed" ),
+                            "info_class" => "info-error",
+                            "info_time"  => 5000,
+                        ) ) );
+                        return;
+                    }
+
+                    // update sitemap and rss
+                    if ( function_exists( "cms_sitemap_update" ) ) {
+                        cms_sitemap_update();
+                    }
+                    if ( function_exists( "cms_rss_update" ) ) {
+                        cms_rss_update();
+                    }
+
+                    if ( strtotime( $created ) > time() ) {
+                        $planned = true;
+                    } else {
+                        $planned = false;
+                    }
+
+                    $r = array(
+                        "ok"          => "true",
+                        "info_text"   => __( "saved" ),
+                        "info_class"  => "info-success",
+                        "info_time"   => 5000,
+                        "modified"    => $modified,
+                        "planned"     => $planned,
+                        "title"       => htmlspecialchars( $_POST["title"] ),
+                        "url"         => $_POST["url"],
+                        "base_path"   => $cms["base_path"],
+                        "new_text"    => $new_text,
+                    );
+
+                    // Если страница задействована в меню, то нужно сообщить,
+                    // что требуется перезагрузить страницу меню
+                    $q = "SELECT * FROM `menu` WHERE `id`={$id}";
+                    if ( mysqli_query( $cms["base"], $q ) and mysqli_affected_rows( $cms["base"] ) ) {
+                        $r["update_menu"] = "true";
+                    } else {
+                        $r["update_menu"] = "false";
+                    }
+
+                    echo( json_encode( $r ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "ok"         => "false",
+                        "info_text"  => mysqli_error( $cms["base"] ),
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "page_pin":
+                $id  = (int) $_POST['id'];
+                $pin = (int) $_POST['pin'];
+                $q   = "UPDATE `pages` SET `pin`={$pin} WHERE `id`={$id}";
+                if ( $res = mysqli_query( $cms["base"], $q ) ) {
+                    echo( json_encode( array(
+                        "ok" => "true",
+                    ) ) );
+                    return;
+                }
+            break;
+            
+            case "page_publish":
+                $id        = (int) $_POST['id'];
+                $published = (int) $_POST['published'];
+                $q         = "UPDATE `pages` SET `published`={$published} WHERE `id`={$id}";
+                if ( $res = mysqli_query( $cms["base"], $q ) ) {
+                    echo( json_encode( array(
+                        "ok" => "true",
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "get_page":
+                if ( $id = (int) $_POST['id'] and $res = mysqli_query( $cms["base"], "SELECT * FROM `pages` WHERE `id`={$id}" ) ) {
+                    if ( $page = mysqli_fetch_assoc( $res ) ) {
+
+                        // date and time
+                        $date = date( "Y-m-d", strtotime( $page["created"] ) );
+                        $time = date( "H:i", strtotime( $page["created"] ) );
+
+                        // template
+                        $templates_list = array();
+                        $expr = "{$cms['cms_dir']}/{$cms['config']['template.mod.php']['template']}/*.php";
+                        foreach ( glob( $expr ) as $tpl ) {
+                            $name = preg_replace( "/.*\/([^\/]+)\.php/u", "$1", $tpl );
+                            if ( $name !== "html" && strpos( $name, "." ) === false ) {
+                                array_push( $templates_list, $name );
+                            }
+                        }
+
+                        cms_template_load_settings();
+                        $current_template = $cms["config"]["template.mod.php"]["template"];
+
+                        $template_options = "";
+                        foreach( $templates_list as $tpl ) {
+                            if ( $tpl !== $page['tpl'] ) {
+                                $template_options .= "<div class=option value='{$tpl}'>" . __( $tpl, $current_template ) . "</div>";
+                            }
+                        }
+                        // Добавляем текущий подшаблон страницы в список если его там нет.
+                        // Такое может быть если переключен главный шаблон.
+                        if ( ! in_array( $page['tpl'], $templates_list ) && ! empty( $page['tpl'] ) ) {
+                            $template_options .= "<div class=option value='{$page['tpl']}'>" . __( $page['tpl'], $current_template ) . "</div>";
+                        }
+
+                        
+                        // files
+                        $farr = array();
+                        foreach ( glob( "{$cms['site_dir']}/uploads/{$page['id']}/*", GLOB_NOSORT ) as $path ) {
+                            if ( is_file( $path ) ) {
+                                $farr[] = array( "path" => $path, "sort" => filemtime( $path ) );
+                            }
+                        }
+                        cms_asort( $farr );
+
+                        $flist = "";
+                        foreach ( $farr as $f ) {
+                            // cut path
+                            $path_name = str_replace( $_SERVER["DOCUMENT_ROOT"], "", $f["path"] );
+                            //$rel_path_name = str_replace( $cms['site_dir'], "$", $f["path"] );
+                            $name      = preg_replace( "/.*\//u", "", $path_name );
+                            $ext       = strtolower( preg_replace( "/.*\./u", ".", $path_name ) ); // .jpg
+                            // icon file
+                            if ( file_exists( "{$cms['cms_dir']}/img/icon{$ext}.svg" ) ) {
+                                $icon = "{$cms['base_path']}img/icon{$ext}.svg";
+                            } else {
+                                $icon = "{$cms['base_path']}img/icon.default.svg";
+                            }
+                            // no need icon for image
+                            switch ( $ext ) {
+                                case ".webp":
+                                case ".tiff":
+                                case ".jpeg":
+                                case ".jpg":
+                                case ".png":
+                                case ".svg":
+                                case ".gif":
+                                case ".bmp":
+                                case ".ico":
+                                    $size = getimagesize( $f["path"] );
+                                    if ( ! empty( $size[3] ) ) {
+                                        $size = $size[3];
+                                    } else {
+                                        $size = "";
+                                    }
+                                    // $upd = time();
+                                    // ?upd={$upd}
+                                    $flist = "<div class=file-block><div class=media-name>{$name}</div><img src='{$path_name}' data-src='{$path_name}' {$size}><input type=checkbox><div class=ext>{$ext}</div></div>{$flist}";
+                                break;
+                                
+                                default:
+                                    $flist = "<div class=file-block><div class=media-name>{$name}</div><img src='{$icon}' data-src='{$path_name}'><input type=checkbox><div class=ext>{$ext}</div></div>{$flist}";
+                                break;
+                            }
+                        }
+                        echo( json_encode( array(
+                            "result"    => "ok",
+                            "page"      => $page,
+                            "base_path" => $cms["base_path"],
+                            "flist"     => $flist,
+                            "date"      => $date,
+                            "time"      => $time,
+                            "options"   => $template_options,
+                            "option"    => $page['tpl'],
+                            "option_tr" => __( $page['tpl'], $current_template ),
+                        ) ) );
+                        return;
+                    }
+                }
+            break;
+
+            case "del_files":
+                foreach ( $_POST["flist"] as $path_name ) {
+                    $f = "{$_SERVER["DOCUMENT_ROOT"]}{$path_name}";
+                    if ( is_file( $f ) ) {
+                        unlink( $f );
+                    }
+                }
+                $dir = dirname( $f );
+                if ( is_dir_and_empty( $dir ) ) {
+                    rmdir( $dir );
+                }
+                echo( json_encode( array(
+                    "info_text"  => __( "files_deleted" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 5000,
+                ) ) );
+                return;
+            break;
+
+            case "get_pages_list":
+                echo( json_encode( cms_pages_get_pages_list() ) );
+                return;
+            break;
+
+            case "del_pages":
+                // Clear cache
+                if ( function_exists( "cms_clear_cache" ) ) {
+                    cms_clear_cache();
+                }
+                // Создание корзины
+                $trash = $cms["site_dir"] . "/uploads/.trash";
+                if ( ! is_dir( $trash ) ) {
+                    mkdir( $trash );
+                }
+                foreach( $_POST["ids"] as $id ) {
+                    if ( $id = (int) $id ) {
+                        // Вытаскивание и сохранение страницы
+                        $q = "SELECT * FROM pages WHERE `id`={$id}";
+                        $res = mysqli_query( $cms["base"], $q );
+                        $p = mysqli_fetch_assoc( $res );
+                        file_put_contents( "{$trash}/{$id}.txt", "url {$p['url']}\nid {$p['id']}\npin {$p['pin']}\npublished {$p['published']}\ncreated {$p['created']}\nmodified {$p['modified']}\ntpl {$p['tpl']}\ntitle {$p['title']}\nseo_title {$p['seo_title']}\ndescription {$p['description']}\ntags {$p['tags']}\ntext\n{$p['text']}\n" );
+
+                        // Delete page from base
+                        mysqli_query( $cms["base"], "DELETE FROM `pages` WHERE `id`={$id}" );
+
+                        // Перемещение файлов страницы
+                        $files_dir = "{$cms['site_dir']}/uploads/{$id}";
+                        if ( $files_dir ) {
+                            rename( $files_dir, "{$trash}/{$id}" );
+                        }
+                        // Delete page files
+                        /*
+                        foreach ( glob( "{$cms['site_dir']}/uploads/{$id}/*", GLOB_NOSORT ) as $f ) {
+                            if ( is_file( $f ) ) {
+                                unlink( $f );
+                            }
+                        }
+                        
+                        if ( isset( $f ) ) {
+                            $dir = dirname( $f );
+                            if ( is_dir_and_empty( $dir ) ) {
+                                rmdir( $dir );
+                            }
+                        }
+                        */
+
+                    }
+                }
+
+                // update sitemap and rss
+                if ( function_exists( "cms_sitemap_update" ) ) {
+                    cms_sitemap_update();
+                }
+                if ( function_exists( "cms_rss_update" ) ) {
+                    cms_rss_update();
+                }
+
+                // Если страницы задействованы в меню, то нужно сообщить,
+                // что требуется перезагрузить страницу меню
+                $q = "SELECT * FROM `menu` WHERE `id` IN ( " . implode( ",", $_POST["ids"] ) . " )";
+                if ( mysqli_query( $cms["base"], $q ) and mysqli_affected_rows( $cms["base"] ) ) {
+                    $update_menu = "true";
+                } else {
+                    $update_menu = "false";
+                }
+
+                echo( json_encode( array(
+                    "info_text"   => __( "pages_deleted" ),
+                    "info_class"  => "info-success",
+                    "info_time"   => 5000,
+                    "update_menu" => $update_menu,
+                ) ) );
+                return;
+            break;
+
+            case "upload_files":
+                $id   = (int) $_POST["id"];
+                $path = "{$cms['base_path']}uploads/{$id}";
+                $dir  = $_SERVER["DOCUMENT_ROOT"] . $path;
+                // create dir if not exists
+                if ( ! is_dir( $dir ) && ! mkdir( $dir, 0777, true ) ) {
+                    echo( json_encode( array(
+                        "info_text"  => __( "error_create_folder" ) . " " . $dir,
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+                $flist = "";
+                $success = true;
+                foreach ( $_FILES["myfile"]["name"] as $n => $name ) {
+                    if ( $_FILES["myfile"]["error"][$n] ) {
+                        $success = false;
+                        $text = __( "error_upload_file" ) . " \"{$name}\"";
+                        break;
+                    }
+                    // Транслит
+                    $ext  = strtolower( preg_replace( "/.*\./u", ".", $name ) );
+                    $name = substr( $name, 0, strlen( $name ) - strlen( $ext ) );
+                    $name = strtolower( cms_translit_file( $name ) );
+                    $name = "{$name}{$ext}";
+                    // Перемещение с заменой. Проверка на одинаковость и предупреждение об этом сделано на js
+                    if ( ! move_uploaded_file( $_FILES["myfile"]["tmp_name"][$n], "{$dir}/{$name}" ) ) {
+                        $success = false;
+                        $text = __( "file_move_error" ) . " \"{$dir}/{$name}\"";
+                        break;
+                    }
+                    if ( file_exists( "{$cms['cms_dir']}/img/icon{$ext}.svg" ) ) {
+                        $icon = "{$cms['base_path']}img/icon{$ext}.svg";
+                    } else {
+                        $icon = "{$cms['base_path']}img/icon.default.svg";
+                    }
+                    if ( $success ) {
+                        switch ( $ext ) {
+                            case ".webp":
+                            case ".tiff":
+                            case ".jpeg":
+                            case ".jpg":
+                            case ".png":
+                            case ".svg":
+                            case ".gif":
+                            case ".bmp":
+                            case ".ico":
+                                $size = getimagesize( "{$dir}/{$name}" );
+                                if ( ! empty( $size[3] ) ) {
+                                    $size = $size[3];
+                                } else {
+                                    $size = "";
+                                }
+                                $upd = time();
+                                $flist .= "<div class='file-block'><div class=media-name>{$name}</div><img src='{$path}/{$name}?upd={$upd}' data-src='{$path}/{$name}' {$size}><input type=checkbox><div class=ext>{$ext}</div></div>";
+                            break;
+                            
+                            default:
+                                $flist .= "<div class='file-block'><div class=media-name>{$name}</div><img src='{$icon}' data-src='{$path}/{$name}'><input type=checkbox><div class=ext>{$ext}</div></div>";
+                            break;
+                        }
+                        
+                    }
+                }
+
+                if ( $success ) {
+                    $text = __( "files_uploaded" );
+                    echo( json_encode( array(
+                        "info_text"  => $text,
+                        "info_class" => "info-success",
+                        "info_time"  => 5000,
+                        "flist"      => $flist,
+                    ) ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "info_text"  => $text,
+                        "info_class" => "info-error",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                }
+            break;
+
+            case "replace_in_pages":
+                $table  = mysqli_real_escape_string( $cms["base"], $_POST["table"] );
+                $id_col = mysqli_real_escape_string( $cms["base"], $_POST["id_col"] );
+                $column = mysqli_real_escape_string( $cms["base"], $_POST["column"] );
+                $q = "SELECT `{$id_col}`, `{$column}` FROM `{$table}`";
+                $t = trim( $_POST["search_regex"] );
+                if ( ! empty( $t ) ) {
+                    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+                        $regex = preg_replace( "/\//u", "\\/", $_POST["search_regex"] ); // Escape / for regexp
+                        while( $page = mysqli_fetch_assoc( $res ) ) {
+                            $new_text = preg_replace( "/{$regex}/u", $_POST["replace"], $page[$_POST["column"]] );
+                            $text = mysqli_real_escape_string( $cms["base"], $new_text );
+                            $id_val = $page[$_POST["id_col"]];
+                            $q = "UPDATE `{$table}` SET `{$column}`='{$text}' WHERE `{$id_col}`='{$id_val}'";
+                            mysqli_query( $cms["base"], $q );
+                        }
+                    }
+                }
+
+                echo( json_encode( array(
+                    "info_text"  => __( "replace_ok" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 5000,
+                ) ) );
+                return;
+            break;
+        }
+    }
+}
+
+// Create pages list
+// $_POST["where"] = "id=123"; нужно для момента создания страницы
+// $_POST["count"] = "1000";
+// $_POST["search"] = "test";
+// $_COOKIE["pages_pager"] = 10;
+function cms_pages_get_pages_list() {
+    global $cms;
+
+    if ( empty( $cms["base"] ) ) {
+        return array(
+            "no_database"  => "<span class=no-database>" . __( "no_connect_db" ) . "</span>",
+        );
+    }
+    
+    $templates_list = array();
+    $expr = "{$cms['cms_dir']}/{$cms['config']['template.mod.php']['template']}/*.php";
+    foreach ( glob( $expr ) as $tpl ) {
+        $name = preg_replace( "/.*\/([^\/]+)\.php/u", "$1", $tpl );
+        if ( $name !== "html" && strpos( $name, "." ) === false ) {
+            array_push( $templates_list, $name );
+        }
+    }
+
+    if ( ! empty( $_POST["where"] ) ) {
+        $where = $_POST["where"];
+    } else {
+        $where = "1";
+    }
+
+    if ( empty( $_COOKIE["pages_pager"] ) ) {
+        $pager = 100;
+    } else {
+        $pager = (int) $_COOKIE["pages_pager"];
+    }
+
+    if ( empty( $_POST["offset"] ) ) {
+        $_POST["offset"] = 0;
+    }
+    $offset = $_POST["offset"];
+
+    if ( ! empty( $_POST["count"] ) ) {
+        $pager = $_POST["count"];
+    }
+    $limit = "LIMIT {$offset}, {$pager}";
+
+    if ( ! empty( $_POST["search"] ) ) {
+
+        // Shift разбивает искомое на символы
+        if ( $_POST["Shift"] === "true" ) {
+            $s = preg_replace( "/\s/u", "", $_POST["search"] );
+            $s = preg_split( '//u', $s, -1, PREG_SPLIT_NO_EMPTY );
+            foreach( $s as $n => $ch ) {
+                $s[$n] = mysqli_real_escape_string( $cms["base"], $ch );
+            }
+            $s = implode( "%", $s );
+        } else {
+            $s = mysqli_real_escape_string( $cms["base"], $_POST["search"] );
+        }
+
+        // Ctrl ищет только по тексту
+        if ( $_POST["Ctrl"] === "true" ) {
+            $search = "( text LIKE '%{$s}%' )";
+        } else {
+            $search = "( title LIKE '%{$s}%' OR url LIKE '%{$s}%' OR tpl LIKE '%{$s}%' OR tags LIKE '%{$s}%' )";
+        }
+        
+        $q_count = "SELECT COUNT(*) FROM `pages` WHERE {$search}";
+    } else {
+        $search = "1";
+        $q_count = "SELECT COUNT(*) FROM `pages`";
+    }
+    // count pages
+    if ( ! $res = mysqli_query( $cms["base"], $q_count ) ) {
+        return array(
+            "no_database"  => "<span class=no-tables>" . __( "no_tables_db" ) . "</span>",
+        );
+    }
+    $res = mysqli_fetch_assoc( $res );
+    $count = $res["COUNT(*)"];
+
+    $pages = array();
+    $start = microtime( true );
+    $overload = false;
+    $q = "SELECT `id`, `published`, `pin`, `title`, `seo_title`, `description`, `created`, `url`, `tpl`, `tags`, `modified` FROM `pages` WHERE {$search} AND {$where} ORDER BY `pin` DESC, FROM_UNIXTIME( `modified` ) DESC {$limit}";
+    
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+
+        $tTitle           = __( "title" );
+        $tDescription     = __( "description" );
+        $tSeoTitle        = __( "seo_title" );
+        $tTemplate        = __( "template" );
+        $tPublished       = __( "published" );
+        $tUnPublished     = __( "unpublished" );
+        $tDate            = __( "date" );
+        $tTime            = __( "time" );
+        $tSave            = __( "save" );
+        $tProperties      = __( "properties" );
+        $tEdit            = __( "edit" );
+        $tr_pin           = __( "pin" );
+
+        cms_template_load_settings();
+        $current_template = $cms["config"]["template.mod.php"]["template"];
+        
+        while ( $page = mysqli_fetch_assoc( $res ) ) {
+            
+            $time = strtotime( $page["created"] );
+            if ( time() >= $time ) {
+                $date_class     = "past";
+            } else {
+                $date_class     = "future";
+            }
+            $created = date( "d.m.Y", $time ) . "<br>" . date( "H:i", $time );
+            $date    = date( "Y-m-d", $time );
+            $time    = date( "H:i", $time );
+
+            $template_options = "";
+            foreach( $templates_list as $tpl ) {
+                if ( $tpl !== $page['tpl'] ) {
+                    $template_options .= "<div class=option value='{$tpl}'>" . __( $tpl, $current_template ) . "</div>";
+                }
+            }
+            // Добавляем текущий подшаблон страницы в список если его там нет.
+            // Такое может быть если переключен главный шаблон.
+            if ( ! in_array( $page['tpl'], $templates_list ) && ! empty( $page['tpl'] ) ) {
+                $template_options .= "<div class=option value='{$page['tpl']}'>" . __( $page['tpl'], $current_template ) . "</div>";
+            }
+
+            if ( $page["published"] ) {
+                $tpub = $tPublished;
+            } else {
+                $tpub = $tUnPublished;
+            }
+
+            if ( $page["url"] == "" ) {
+                $class = "class=home";
+            } else {
+                $class = "";
+            }
+
+            if ( empty( $page["tpl"] ) ) {
+                $tpl_translated = __( "no_template" );
+            } else {
+                $tpl_translated = __( $page['tpl'], $current_template );
+            }
+
+            $html = "
+<div {$class} data-id={$page['id']} data-pin={$page['pin']} data-published={$page['published']}>
+
+    <a class=page-name href='{$cms['base_path']}{$page["url"]}' target=_blank title='id={$page['id']}'>{$page['title']}</a>
+    <div class=pin title='" . $tr_pin . "'></div>
+    <div class=published title='{$tpub}'></div>
+    <div class=page-buttons>
+        <div class=page-edit-btn>{$tEdit}</div>
+        <div class=page-prop-btn>{$tProperties}</div>
+        <div class=page-prop-save-btn>{$tSave}</div>
+    </div>
+    <div class='page-date {$date_class}'>{$created}</div>
+    <input type=checkbox>
+    
+    <div class=page-prop>
+
+        <div class='page title'>{$tTitle}:</div>
+        <input name=title type=text value='{$page['title']}'>
+
+        <div class='url title'>URL:</div>
+        <div class=url-input>
+            <input name=url type=text value='{$page['url']}' placeholder='" . __( "front_url" ) . "'>
+            <div class=url-translit title='" . __( "url_translit" ) . "'></div>
+        </div>
+
+        <div class='seo title'>{$tSeoTitle}:</div>
+        <input name=seo_title type=text value='{$page['seo_title']}'>
+
+        <div class='description title'>{$tDescription}:</div>
+        <textarea name=description rows=3>{$page['description']}</textarea>
+
+        <div class='template title'>{$tTemplate}:</div>
+        <div class=template-select-grid>
+            <div class=field-select data-template='{$page['tpl']}' data-old-template='{$page['tpl']}'>
+                <div class=value>{$tpl_translated}</div>
+                <div class=icon></div>
+            </div>
+            <div class=field-options>
+                {$template_options}
+            </div>
+        </div>
+
+        <div class='date title'>{$tDate}:</div>
+        <input name=date type=date value='{$date}'>
+        <div class='time title'>{$tTime}:</div>
+        <input name=time type=time value='{$time}'>
+
+        <div class='tags title'>" . __( "tags" ) . ":</div>
+        <textarea name=tags rows=3>" . htmlspecialchars( $page["tags"] ) . "</textarea>
+
+    </div>
+
+</div>";
+            array_push( $pages, array( "id" => (int) $page["id"], "html" => $html ) );
+            if ( microtime( true ) - $start > 1 ) {
+                $overload = true;
+                break;
+            }
+        }
+    }
+    if ( isset( $_POST["search"] ) ) {
+        $search = trim( $_POST["search"] );
+    } else {
+        $search = "";
+    }
+
+    return array(
+        "pages"    => $pages, 
+        "offset"   => $_POST["offset"], 
+        "count"    => $count, 
+        "overload" => $overload,
+        "search"   => $search,
+    );
+}
+
+
+function cms_pages_query() {
+    global $cms;
+    
+    // Skip SQL query if file exists
+    if ( is_file( $cms["cms_file"] ) ) {
+        return;
+    }
+    
+    // fix template warnings
+    $cms["page"]["id"] = 0;
+    $cms["page"]["tpl"] = "";
+    
+    if ( empty( $cms["base"] ) ) return; // fix 500 error
+    $url = mysqli_real_escape_string( $cms["base"], $cms["url"]["path"] );
+    if ( $res = mysqli_query( $cms["base"], "SELECT * FROM pages WHERE url = '{$url}' OR CONCAT( url, '/' ) = '{$url}' OR url = CONCAT( '{$url}', '/' )" ) ) {
+        if ( $page = mysqli_fetch_assoc( $res ) ) {
+            $cms["page"] = $page;
+            if ( $cms["page"]["created"] <= date( "Y-m-d H:i:s" ) && $cms["page"]["published"] ) {
+                $cms["status"] = "200";
+            } else {
+                $cms["status"] = "404"; // disable write to disk but echo if admin
+            }
+        }
+    }
+}
+
+function cms_pages_create_tables() {
+    global $cms;
+
+    mysqli_query( $cms["base"], "
+    CREATE TABLE IF NOT EXISTS `pages` (
+        `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+        `pin` tinyint(1) NOT NULL DEFAULT 0,
+        `published` tinyint(1) NOT NULL DEFAULT 1,
+        `created` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
+        `modified` double NOT NULL DEFAULT 0,
+        `tpl` varchar(64) DEFAULT NULL,
+        `title` varchar(255) DEFAULT NULL,
+        `seo_title` varchar(255) DEFAULT NULL,
+        `text` longtext DEFAULT NULL,
+        `url` varchar(255) DEFAULT NULL,
+        `description` varchar(2048) NOT NULL DEFAULT '',
+        `tags` varchar(2048) NOT NULL DEFAULT '',
+        UNIQUE KEY `id` (`id`)
+      ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
+    ");
+
+}
+
+
+function cms_pages_admin() {
+    global $cms;
+
+    $conf = $cms["config"]["pages.mod.php"]["menu"]["pages"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    // Read template settings
+    cms_template_load_settings();
+    
+    $tMaxUploadSize  = __( "max_size" ) . " " . number_format( file_upload_max_size(), 0, ".", " " ) . " " . __( "bytes" );
+
+    $help_file = "{$cms['config']['template.mod.php']['template']}/instruction.{$cms['config']['locale']}.html";
+    if ( is_file( "{$cms['cms_dir']}/{$help_file}" ) ) {
+        $help_blanks = "<a target=_blank href='{$cms['base_path']}{$help_file}'>" . __( "blanks" ) . "</a>";
+    } else {
+        $help_blanks = "";
+    }
+
+    $help_file = "man/{$cms['config']['locale']}/codemirror.html";
+    if ( is_file( "{$cms['cms_dir']}/{$help_file}" ) ) {
+        $help_codemirror = "<a target=_blank href='{$cms['base_path']}{$help_file}'>" . __( "codemirror" ) . "</a>";
+    } else {
+        $help_codemirror = "";
+    }
+
+    $files_panel = "
+<div class=mediateka-grid>
+    <div class=mediateka-files-hscroll>
+        <div class=mediateka-files-grid>
+            
+        </div>
+    </div>
+    
+    <div class=mediateka-buttons>
+        <div class=upload-files>
+            <input id=upload-btn type=file name='myfile[]' multiple class=inputfile title='{$tMaxUploadSize}'>
+            <label for=upload-btn title='{$tMaxUploadSize}'>" . __( "upload" ) . "</label>
+        </div>
+        <div class=link-file>
+            <span class=link-file-tag></span>
+            <span class=link-file-copy-btn>" . __( "copy" ) . "</span>
+        </div>
+        <div class='del-uploaded-files disabled'>" . __( "delete" ) . "</div>
+    </div>
+    
+</div>";
+
+    $buttons  = "<div class=save-page-button>" . __( "save" ) . "</div>";
+    $buttons .= "<div class=open-properties>" . __( "properties" ) . "</div>";
+    $buttons .= "<div class=open-mediateka>" . __( "mediateka" ) . "</div>";
+    $buttons .= "<div class=tags-helper>" . __( "tags" ) . "</div>";
+    $buttons .= "<div class=codemirror-replace>" . __( "replace" ) . "</div>";
+    $buttons .= $help_blanks;
+    $buttons .= $help_codemirror;
+
+    $page = "
+<div class=main-header>
+    
+    <div class=search-wrapper>
+        <input class=page-search type=text
+            placeholder='" . __( "search" ) . "'
+            title='" . __( "search_with_ctrl" ) . "'
+            autocomplete=off data-result-of=''>
+        <div class=reset></div>
+        <button class=page-search-button></button>
+    </div>
+
+    <div class=add-page-btn>
+        <div class=x1></div>
+        <div class=x2></div>
+        <div class=add-page-label>" . __( "add_page_title" ) . "</div>
+    </div>
+    
+    <div> </div>
+
+    <a class=del-pages-btn title='" . __( "delete_pages" ) . "'></a>
+    
+</div>
+
+<div class=main-main>
+    
+    <div class=pages-grid>
+    </div>
+    
+</div>
+
+<div class=main-footer>
+    <div class=pager></div>
+    <div class=counters>
+        <input class=loaded value=0 autocomplete=off data-offset=0>
+        <span>" . __( "of" ) . "</span>
+        <span class=count>0</span>
+    </div>
+</div>
+
+<div class='page-editor-bg hidden'>
+    <div class='page-editor-grid editor-grid'>
+
+        <div class=page-editor-header>
+            <div class=close-page-button></div>
+            <a data-page-title class=page-editor-title target=_blank></a>
+        </div>
+
+        <div class=page-editor-buttons>{$buttons}</div>
+        
+        <div class='page-properties hidden'>
+
+            <div class='page title'>" . __( "title" ) . ":</div>
+            <input name=title type=text>
+
+            <div class='url title'>URL:</div>
+            <div class=url-input>
+                <input name=url type=text placeholder='" . __( "front_url" ) . "'>
+                <div class=url-translit title='" . __( "url_translit" ) . "'></div>
+            </div>
+
+            <div class='seo title'>" . __( "seo_title" ) . ":</div>
+            <input name=seo_title type=text>
+
+            <div class='description title'>" . __( "description" ) . ":</div>
+            <textarea name=description rows=3></textarea>
+
+            <div class='template title'>" . __( "template" ) . ":</div>
+            <div class=template-select-grid>
+                <div class=field-select data-template data-old-template>
+                    <div class=value></div>
+                    <div class=icon></div>
+                </div>
+                <div class=field-options>
+                    
+                </div>
+            </div>
+
+            <div class='date title'>" . __( "date" ) . ":</div>
+            <input name=date type=date>
+            <div class='time title'>" . __( "time" ) . ":</div>
+            <input name=time type=time>
+
+            <div class='tags title'>" . __( "tags" ) . ":</div>
+            <textarea name=tags rows=3></textarea>
+
+        </div>
+
+        <div class='page-editor-panel hidden'>
+            <div class=upload-progress></div>
+            {$files_panel}
+        </div>
+
+        <div class=page-editor>
+            <textarea data-modified class=coffee-editorpage-area name=add_editorpage></textarea>
+        </div>
+
+        <div class=tags>
+            <div class=tags-grid>
+                <div data-type=wrap data-otag='<h1>' data-ctag='</h1>' data-len=4><span>" . __( "h1" ) . "</span> <span class=tag>&lt;h1></span></div>
+                <div data-type=wrap data-otag='<h2>' data-ctag='</h2>' data-len=4><span>" . __( "h1" ) . "</span> <span class=tag>&lt;h2></span></div>
+                <div data-type=wrap data-otag='<p>' data-ctag='</p>' data-len=3><span>" . __( "p" ) . "</span> <span class=tag>&lt;p></span></div>
+                <div data-type=wrap data-otag='<div>' data-ctag='</div>' data-len=5><span>" . __( "div" ) . "</span> <span class=tag>&lt;div></span></div>
+                <div data-type=wrap-a><span>" . __( "link" ) . "</span> <span class=tag>&lt;a></span></div>
+                <div data-type=wrap data-otag='<code>' data-ctag='</code>' data-len=6><span>" . __( "code" ) . "</span> <span class=tag>&lt;code></span></div>
+                <div data-type=wrap data-otag='<pre><code>' data-ctag='</code></pre>' data-len=11><span>" . __( "code" ) . "</span> <span class=tag>&lt;pre>&lt;code></span></div>
+                <div data-type=wrap data-otag='<span>' data-ctag='</span>' data-len=6><span>" . __( "span" ) . "</span> <span class=tag>&lt;span></span></div>
+                <div data-type=wrap data-otag='<blockquote>' data-ctag='</blockquote>' data-len=12><span>" . __( "cite" ) . "</span> <span class=tag>&lt;blockquote></span></div>
+                <div data-type=wrap-list data-tag=ul><span>" . __( "ul" ) . "</span> <span class=tag>&lt;ul></span></div>
+                <div data-type=wrap-list data-tag=ol><span>" . __( "ol" ) . "</span> <span class=tag>&lt;ol></span></div>
+                <div data-type=wrap data-otag='<li>' data-ctag='</li>' data-len=4><span>" . __( "li" ) . "</span> <span class=tag>&lt;li></span></div>
+                <div data-type=wrap data-otag='<figure>\n    ' data-ctag='\n    <figcaption></figcaption>\n</figure>' data-ch=4 data-line=1><span>" . __( "figure" ) . "</span> <span class=tag>&lt;figure></span></div>
+                <div data-type=wrap data-otag='<!-- ' data-ctag=' -->' data-len=5><span class=tag>&lt;!--</span>&nbsp;<span>" . __( "comment" ) . "</span>&nbsp;<span class=tag>--></span></div>
+                <div data-type=wrap data-otag='<b>' data-ctag='</b>' data-len=3><span>" . __( "bold" ) . "</span> <span class=tag>&lt;b></span></div>
+                <div data-type=wrap data-otag='<kbd>' data-ctag='</kbd>' data-len=5><span>" . __( "kbd" ) . "</span> <span class=tag>&lt;kbd></span></div>
+                <div data-type=wrap data-otag='<mark>' data-ctag='</mark>' data-len=6><span>" . __( "mark" ) . "</span> <span class=tag>&lt;mark></span></div>
+            </div>
+        </div>
+    </div>
+</div>";
+
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["pages.mod.php"]["menu"]["pages"] ) ) {
+        $cms["config"]["pages.mod.php"]["menu"]["pages"] = array(
+            "title"    => "pages_module_name",
+            "sort"     => 10,
+            "section"  => "content",
+        );
+        cms_save_config();
+    }
+
+    $cms["admin_pages"]["pages"] = $page;
+
+    }
+    
+    
+    
+    $conf = $cms["config"]["pages.mod.php"]["menu"]["pages-utils"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+    
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["pages.mod.php"]["menu"]["pages-utils"] ) ) {
+        $cms["config"]["pages.mod.php"]["menu"]["pages-utils"] = array(
+            "title"    => "pages_utils",
+            "sort"     => 15,
+            "section"  => "content",
+            "hide"     => true,
+        );
+        cms_save_config();
+    }
+
+
+    $page = "
+<div class=pages-utils-main>
+    <div class=replace-util>
+        <p>" . __( "replace_instruction" ) . "</p>
+        <div class=replace-inputs>
+            <div class=replace_table>
+                <div class=title>" . __( "replace_table" ) . "</div>
+                <input type=text name=table autocomplete=off value=pages>
+            </div>
+            <div class=stub></div>
+            <div class=replace_id_col>
+                <div class=title>" . __( "replace_id_col" ) . "</div>
+                <input type=text name=id_col autocomplete=off value=id>
+            </div>
+            <div class=replace_column>
+                <div class=title>" . __( "replace_column" ) . "</div>
+                <input type=text name=column autocomplete=off value=text>
+            </div>
+            <div class=regex>
+                <div class=title>" . __( "regex_title" ) . "</div>
+                <input type=text name=search_regex autocomplete=off>
+            </div>
+            <div class=replace>
+                <div class=title>" . __( "replace_title" ) . "</div>
+                <input type=text name=replace autocomplete=off>
+            </div>
+        </div>
+        <div class=replace-btn>" . __( "replace_btn" ) . "</div>
+    </div>
+</div>
+    ";
+
+    $cms["admin_pages"]["pages-utils"] = $page;
+    
+    }
+}
+
+
+function cms_pages_menu() {
+    global $cms;
+
+    foreach( $cms["menu"] as $id => $menu ) {
+        if ( is_array( $menu["items"] ) ) {
+            cms_pages_menu_items( $cms["menu"][$id]["items"] );
+        }
+    }
+}
+
+
+function cms_pages_menu_items( &$items ) {
+    global $cms;
+
+    foreach( $items as $id => $item ) {
+        if ( $item["id"] ) {
+            $q_pages = "SELECT * FROM pages WHERE id={$item['id']}";
+            if ( $res_p = mysqli_query( $cms["base"], $q_pages ) ) {
+                if ( $page = mysqli_fetch_assoc( $res_p ) ) {
+                    if ( empty( $items[$id]["title"] ) ) {
+                        $items[$id]["title"] = $page["title"];
+                    }
+                    $items[$id]["url"] = $page["url"];
+                } else {
+                    $items[$id]["title"] = __( "deteled_page" );
+                }
+            }
+        }
+        if ( is_array( $items[$id]["items"] ) ) {
+            cms_pages_menu_items( $items[$id]["items"] );
+        }
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/rss.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,288 @@
+<?php
+
+$cms["modules"]["rss.mod.php"] = array(
+    "name"        => "rss_module_name",
+    "description" => "rss_module_description",
+    "files"       => array(
+        ".cms/mod/rss.mod.php",
+        ".cms/js/rss.js",
+        ".cms/css/rss.css",
+        ".cms/lang/ru_RU.UTF-8/rss.mod.php",
+        ".cms/lang/en_US.UTF-8/rss.mod.php",
+        ".cms/lang/uk_UA.UTF-8/rss.mod.php",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["rss.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+
+    // Default Settings
+
+    if ( empty( $cms["config"]["rss.mod.php"]["update_interval"] ) ) {
+        $cms["config"]["rss.mod.php"]["update_interval"] = 60;
+    }
+
+    if ( empty( $cms["config"]["rss.mod.php"]["exclude"] ) ) {
+        $cms["config"]["rss.mod.php"]["exclude"] = "";
+    }
+
+    if ( empty( $cms["config"]["rss.mod.php"]["gen"] ) ) {
+        $cms["config"]["rss.mod.php"]["gen"] = "dynamic";
+    }
+
+    if ( empty( $cms["config"]["rss.mod.php"]["lastrun"] ) ) {
+        $cms["config"]["rss.mod.php"]["lastrun"] = "";
+    }
+
+    if ( is_admin() ) {
+        hook_add_fn( "admin",         "cms_rss_admin" );
+        hook_add_fn( "admin_header",  "cms_rss_admin_header" );
+    }
+
+    if ( $cms["config"]["rss.mod.php"]["gen"] === "static" ) {
+        hook_add_fn( "cron", "cms_rss_cron" );
+    }
+        
+    $cms["urls"]["^{$cms['base_path']}rss.xml$"] = "rss.xml";
+    hook_add_fn( "rss.xml", "cms_rss_xml" );
+
+    // Количество элементов в ленте
+    if ( empty( $cms["config"]["rss.mod.php"]["count"] ) ) {
+        $cms["config"]["rss.mod.php"]["count"] = 30;
+    }
+
+}
+
+
+function cms_rss_admin_header() {
+    global $cms;
+    $conf = $cms["config"]["rss.mod.php"]["menu"]["rss"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+        echo "<link rel=stylesheet href='{$cms['base_path']}css/rss.css'>";
+        echo "<script src='{$cms['base_path']}js/rss.js'></script>";
+    }
+}
+
+
+function cms_rss_cron() {
+    global $cms;
+    if ( $cms["config"]["rss.mod.php"]["lastrun"] < date( "Y-m-d H:i:s", time() - $cms["config"]["rss.mod.php"]["update_interval"] * 60) ) {
+        unlink( "{$cms['site_dir']}/rss.xml" );
+        $cms["config"]["rss.mod.php"]["lastrun"] = date( "Y-m-d H:i:s");
+        cms_save_config();
+    }
+}
+
+
+function cms_rss_xml() {
+    global $cms;
+    header( "Content-Type: application/xml;charset=UTF-8" );
+    $rss = cms_rss_generate();
+    echo $rss;
+    if ( $cms["config"]["rss.mod.php"]["gen"] === "static" ) {
+        file_put_contents( "{$cms['site_dir']}/rss.xml", $rss );
+    }
+}
+
+
+function cms_rss_update() {
+    global $cms;
+    // disable remove file
+    if ( ! empty( $cms["config"]["rss.mod.php"]["disabled"] ) ) {
+        return;
+    }
+
+    $file = "{$cms['site_dir']}/rss.xml";
+    if ( file_exists( $file ) ) unlink( $file );
+}
+
+
+function cms_rss_generate() {
+    global $cms;
+    if ( empty( $cms["base"] ) ) cms_base_connect();
+    if ( empty( $cms["base"] ) ) return;
+    if ( mysqli_connect_error() ) return;
+
+    $domain = "{$cms['url']['scheme']}://{$cms['url']['host']}";
+
+    $cms["rss"] = array();
+
+    $exclude = explode( "\n", $cms["config"]["rss.mod.php"]["exclude"] );
+    foreach( $exclude as $n => $link ) {
+        $t = trim( $link );
+        if ( empty( $t ) ) {
+            // delete empty lines
+            unset( $exclude[$n] );
+        }
+    }
+
+    $channel_title = "";
+    $channel_link = "";
+    $channel_description = "";
+    $date = date( "Y-m-d H:i:s" );
+    $n = 0;
+    $cms["rss_links"] = array();
+    $q = "SELECT `title`, `seo_title`, `url`, `created`, `modified`, `description`, `text`, `published` FROM `pages` WHERE `created`<='{$date}' AND `published` ORDER BY `created` DESC";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $page = mysqli_fetch_assoc( $res ) ) {
+            if ( $page["url"] === "" ) {
+                $channel_title = $page["title"];
+                $channel_link = $domain . $cms["base_path"];
+                $channel_description = $page["description"];
+            }
+            if ( ! in_array( $page["url"], $exclude ) && $n < $cms["config"]["rss.mod.php"]["count"] ) {
+                $sort = max( strtotime( $page["created"] ), (int) $page["modified"] );
+                $link = $domain . $cms["base_path"] . $page["url"];
+                if ( ! isset( $cms["rss_links"][$link] ) ) {
+
+                    // image
+                    $enclosure = "";
+                    if ( preg_match( '/<img[^>]+src=[\'"]([^\'"]+)[\'"][^>]*>/us', $page['text'], $m ) ) {
+                        $img = $m[1];
+                        $img_file = $cms["site_dir"] . $img;
+                        if ( is_file( $img_file ) ) {
+                            $mime = mime_content_type( $img_file );
+                            if ( substr( $img, 0, 4 ) !== "http" ) {
+                                if ( substr( $img, 0, 1 ) === "/" ) $img = substr( $img, 1 );
+                                $img = $domain . $cms["base_path"] . $img;
+                            }
+                            $enclosure = "<enclosure url='{$img}' type='{$mime}'/>";
+                        }
+                    }
+
+                    if ( ! empty( $page["seo_title"] ) ) {
+                        $page["title"] = $page["seo_title"];
+                    }
+                    $cms["rss_links"][$link] = true;
+                    $cms["rss"][] = array(
+                        "title"       => $page["title"],
+                        "link"        => $link,
+                        "description" => $page["description"],
+                        "guid"        => "{$page['modified']}",
+                        "sort"        => $sort,
+                        "enclosure"   => $enclosure,
+                    );
+                    $n++;
+                }
+            }
+        }
+    }
+
+    do_hook( "rss" );
+
+    cms_asort( $cms["rss"] );
+    $cms["rss"] = array_reverse( $cms["rss"] );
+
+    $content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+<rss version=\"2.0\">
+    
+    <channel>
+        <title>{$channel_title}</title>
+        <link>{$channel_link}</link>
+        <description>{$channel_description}</description>\n";
+    foreach( $cms["rss"] as $item ) {
+        $content .= "        <item>
+            <title>{$item['title']}</title>
+            <link>{$item['link']}</link>
+            <guid>{$item['guid']}</guid>
+            <description>{$item['description']}</description>
+            {$item['enclosure']}
+        </item>\n";
+    }
+    $content .= "   </channel>\n</rss>";
+    return $content;
+}
+
+
+function cms_rss_admin() {
+    global $cms;
+
+    $conf = $cms["config"]["rss.mod.php"]["menu"]["rss"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    // Save settings
+    if ( ! empty( $_POST["save_settings_rss"] ) ) {
+        $list = preg_split( "/\r\n|\n\r|\r|\n/u", $_POST["exclude"] );
+        $base_url = "{$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}";
+        foreach ( $list as $key => $value ) {
+            // remove domain
+            $list[$key] = trim( str_replace( $base_url, "", $value ) );
+            if ( substr( $list[$key], 0, 1 ) === "/" ) $list[$key] = substr( $list[$key], 1 );
+        }
+        $list = implode( "\n", $list );
+        $cms["config"]["rss.mod.php"]["gen"]             = $_POST["gen"];
+        $cms["config"]["rss.mod.php"]["exclude"]         = $list;
+        $cms["config"]["rss.mod.php"]["update_interval"] = (int) $_POST["update_interval"];
+        $cms["config"]["rss.mod.php"]["count"]           = (int) $_POST["count"];
+        cms_save_config();
+        if ( $cms["config"]["rss.mod.php"]["gen"] === "dynamic" ) {
+            unlink( "{$cms['site_dir']}/rss.xml" );
+        }
+        cms_rss_update();
+        header( "Location: {$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}" );
+        $cms["hooks"]["admin"]["next"] = ""; // Предотвратить выдачу админки
+        return;
+    }
+
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["rss.mod.php"]["menu"]["rss"] ) ) {
+        $cms["config"]["rss.mod.php"]["menu"]["rss"] = array(
+            "title"    => "rss_module_name",
+            "sort"     => 65,
+            "section"  => "settings",
+        );
+        cms_save_config();
+    }
+
+    $ch["static"] = "";
+    $ch["dynamic"] = "";
+    $ch[ $cms["config"]["rss.mod.php"]["gen"] ] = "checked";
+
+    $rss = "{$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}rss.xml";
+
+    $page = "
+<div class=rss>" . __( "view_rss" ) . " <a href='{$rss}' target=_blank>{$rss}</a></div>
+
+<form method=post>
+
+    <div class=xml-wrapper-hidden>
+        <div>" . __( "excluded_links" ) . "</div>
+        <textarea name=exclude rows=12 autocomplete=off>{$cms['config']['rss.mod.php']['exclude']}</textarea>
+        <div class=save_2_col>
+            <button name=save_settings_rss value=save>" . __( "save" ) . "</button>
+                <div class=select-dropdown>
+                    <div class=field-search>
+                        <input class=search-field autocomplete=off placeholder='" . __( "placeholder" ) . "'>
+                    </div>
+                    <ul class=list-search>
+                        
+                    </ul>
+                </div>
+        </div>
+    </div>
+
+    <div class=xml-static-dynamic>
+        <div>" . __( "rss_gen" ) . "</div>
+        <label><input name=gen type=radio value=dynamic {$ch['dynamic']}> " . __( "dynamic" ) . "</label>
+        <label><input name=gen type=radio value=static {$ch['static']}> " . __( "static" ) . "</label>
+        <p>" . __( "rss_items_count" ) . ": <input type=text name=count value={$cms['config']['rss.mod.php']['count']}></p>
+        <button name=save_settings_rss value=save>" . __( "save" ) . "</button>
+    </div>
+    <div class=xml-static-cron>
+        <div>" . __( "update_freq" ) . "</div>
+        <p>" . __( "static_freq" ) . " <input type=text name=update_interval value={$cms['config']['rss.mod.php']['update_interval']}> " . __( "minutes" ) . "</p>
+        <p>" . __( "url_for_cron" ) . ": {$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}{$cms['config']['admin.mod.php']['cron_url']}</p>
+        <button name=save_settings_rss value=save>" . __( "save" ) . "</button>
+    </div>
+</form>
+    ";
+
+    $cms["admin_pages"]["rss"] = $page;
+
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/sitemap.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,280 @@
+<?php
+
+$cms["modules"]["sitemap.mod.php"] = array(
+    "name"        => "sitemap_module_name",
+    "description" => "sitemap_module_description",
+    "files" => array(
+        ".cms/mod/sitemap.mod.php",
+        ".cms/css/sitemap.css",
+        ".cms/js/sitemap.js",
+        ".cms/lang/ru_RU.UTF-8/sitemap.mod.php",
+        ".cms/lang/en_US.UTF-8/sitemap.mod.php",
+        ".cms/lang/uk_UA.UTF-8/sitemap.mod.php",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["sitemap.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+
+    // Default Settings
+
+    if ( empty( $cms["config"]["sitemap.mod.php"]["update_interval"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["update_interval"] = 60;
+    }
+
+    if ( ! isset( $cms["config"]["sitemap.mod.php"]["exclude"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["exclude"] = "";
+    }
+    
+    if ( ! isset( $cms["config"]["sitemap.mod.php"]["domain"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["domain"] = "";
+    }
+
+    if ( ! isset( $cms["config"]["sitemap.mod.php"]["include"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["include"] = "";
+    }
+
+    if ( empty( $cms["config"]["sitemap.mod.php"]["gen"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["gen"] = "dynamic";
+    }
+
+    if ( ! isset( $cms["config"]["sitemap.mod.php"]["lastrun"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["lastrun"] = "";
+    }
+
+    if ( is_admin() ) {
+        hook_add_fn( "admin",         "cms_sitemap_admin" );
+        hook_add_fn( "admin_header",  "cms_sitemap_admin_header" );
+    }
+
+    if ( $cms["config"]["sitemap.mod.php"]["gen"] === "static" ) {
+        hook_add_fn( "cron", "cms_sitemap_cron" );
+    }
+        
+    $cms["urls"]["^{$cms['base_path']}sitemap.xml$"] = "sitemap.xml";
+    hook_add_fn( "sitemap.xml", "cms_sitemap_xml" );
+
+}
+
+function cms_sitemap_admin_header() {
+    global $cms;
+    $conf = $cms["config"]["sitemap.mod.php"]["menu"]["sitemap"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+        echo "<link rel=stylesheet href='{$cms['base_path']}css/sitemap.css'>";
+        echo "<script src='{$cms['base_path']}js/sitemap.js'></script>";
+    }
+}
+
+function cms_sitemap_cron() {
+    global $cms;
+    if ( $cms["config"]["sitemap.mod.php"]["lastrun"] < date( "Y-m-d H:i:s", time() - $cms["config"]["sitemap.mod.php"]["update_interval"] * 60) ) {
+        unlink( "{$cms['site_dir']}/sitemap.xml" );
+        $cms["config"]["sitemap.mod.php"]["lastrun"] = date( "Y-m-d H:i:s");
+        cms_save_config();
+    }
+}
+
+function cms_sitemap_xml() {
+    global $cms;
+    header( "Content-Type: text/xml" );
+    $sitemap = cms_sitemap_generate();
+    echo $sitemap;
+    if ( $cms["config"]["sitemap.mod.php"]["gen"] === "static" ) {
+        file_put_contents( "{$cms['site_dir']}/sitemap.xml", $sitemap );
+    }
+}
+
+function cms_sitemap_update() {
+    global $cms;
+    // disable remove file
+    if ( ! empty( $cms["config"]["sitemap.mod.php"]["disabled"] ) ) {
+        return;
+    }
+
+    $file = "{$cms['site_dir']}/sitemap.xml";
+    if ( file_exists( $file ) ) unlink( $file );
+}
+
+function cms_sitemap_generate() {
+    global $cms;
+    if ( empty( $cms["base"] ) ) cms_base_connect();
+    if ( empty( $cms["base"] ) ) return;
+    if ( mysqli_connect_error() ) return;
+
+    if ( $cms["config"]["sitemap.mod.php"]["gen"] === "static" && ! empty( $cms["config"]["sitemap.mod.php"]["domain"] ) ) {
+        $domain = $cms["config"]["sitemap.mod.php"]["domain"];
+    } else {
+        $domain = "{$cms['url']['scheme']}://{$cms['url']['host']}";
+    }
+
+    // Формат массива
+    // $cms["sitemap"]["https://site.com/link"] = array(
+    //      "lastmod" => "2022-08-27T21:25:17+03:00" || "",
+    //      "changefreq" => "weekly",
+    //      "priority"   => "0.8"
+    // );
+    $cms["sitemap"] = array();
+
+    $exclude = explode( "\n", $cms["config"]["sitemap.mod.php"]["exclude"] );
+    foreach( $exclude as $n => $link ) {
+        if ( empty( $link ) ) {
+            unset( $exclude[$n] );
+        }
+    }
+
+    $date = date( "Y-m-d H:i:s" );
+    $q = "SELECT `title`, `url`, `created`, `modified`, `published` FROM `pages` WHERE `created`<='{$date}' ORDER BY `created` DESC";
+    if ( $res = mysqli_query( $cms["base"], $q ) ) {
+        while ( $page = mysqli_fetch_assoc( $res ) ) {
+            if ( $page["published"] && ! in_array( $page["url"], $exclude ) ) {
+                if ( $modified = max( strtotime( $page["created"] ), (int) $page["modified"] ) ) {
+                    $modified = date( "c", $modified );
+                } else {
+                    $modified = "";
+                }
+                $link = $domain . $cms["base_path"] . $page["url"];
+                if ( ! isset( $cms["sitemap"][$link] ) ) {
+                    $cms["sitemap"][$link] = array( "lastmod" => $modified );
+                }
+            }
+        }
+    }
+
+    // Обязательные для включения ссылки
+    foreach( explode( "\n", $cms["config"]["sitemap.mod.php"]["include"] ) as $link ) {
+        $link = trim( $link );
+        if ( ! empty( $link ) ) {
+            $cms["sitemap"][$link] = array( "lastmod" => "" );
+        }
+    }
+
+    do_hook( "sitemap" );
+
+    // Генерация файла
+    $content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\n";
+    foreach( $cms["sitemap"] as $url => $attr ) {
+        if ( empty( $attr["lastmod"] ) ) {
+            $lastmod = "";
+        } else {
+            $lastmod = "<lastmod>{$attr['lastmod']}</lastmod>";
+        }
+        if ( empty( $attr["changefreq"] ) ) {
+            $changefreq = "";
+        } else {
+            $changefreq = "<changefreq>{$attr['changefreq']}</changefreq>";
+        }
+        if ( empty( $attr["priority"] ) ) {
+            $priority = "";
+        } else {
+            $priority = "<priority>{$attr['priority']}</priority>";
+        }
+        $content .= "<url><loc>{$url}</loc>{$lastmod}{$changefreq}{$priority}</url>\n";
+    }
+    $content .= "</urlset>";
+    return $content;
+}
+
+
+function cms_sitemap_admin() {
+    global $cms;
+
+    $conf = $cms["config"]["sitemap.mod.php"]["menu"]["sitemap"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    // Save settings
+    if ( ! empty( $_POST["save_settings_sitemap"] ) ) {
+        $list = preg_split( "/\r\n|\n\r|\r|\n/u", $_POST["exclude"] );
+        $base_url = "{$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}";
+        foreach ( $list as $key => $value ) {
+            // remove domain
+            $list[$key] = trim( str_replace( $base_url, "", $value ) );
+            if ( substr( $list[$key], 0, 1 ) === "/" ) $list[$key] = substr( $list[$key], 1 );
+        }
+        $list = implode( "\n", $list );
+        $cms["config"]["sitemap.mod.php"]["gen"]             = $_POST["gen"];
+        $cms["config"]["sitemap.mod.php"]["exclude"]         = $list;
+        $cms["config"]["sitemap.mod.php"]["include"]         = $_POST["include"];
+        $cms["config"]["sitemap.mod.php"]["domain"]          = rtrim( $_POST["domain"], "/" );
+        $cms["config"]["sitemap.mod.php"]["update_interval"] =  trim( $_POST["update_interval"] );
+        cms_save_config();
+        if ( $cms["config"]["sitemap.mod.php"]["gen"] === "dynamic" ) {
+            unlink( "{$cms['site_dir']}/sitemap.xml" );
+        }
+        cms_sitemap_update();
+        header( "Location: {$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}" );
+        $cms["hooks"]["admin"]["next"] = ""; // Предотвратить выдачу админки
+        return;
+    }
+
+    // Create menu item if not exists
+    if ( empty( $cms["config"]["sitemap.mod.php"]["menu"]["sitemap"] ) ) {
+        $cms["config"]["sitemap.mod.php"]["menu"]["sitemap"] = array(
+            "title"    => "sitemap_module_name",
+            "sort"     => 60,
+            "section"  => "settings",
+        );
+        cms_save_config();
+    }
+
+    $ch["static"] = "";
+    $ch["dynamic"] = "";
+    $ch[ $cms["config"]["sitemap.mod.php"]["gen"] ] = "checked";
+
+    $sitemap = "{$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}sitemap.xml";
+
+    $page = "
+<div class=sitemap>" . __( "view_sitemap" ) . " <a href='{$sitemap}' target=_blank>{$sitemap}</a></div>
+
+<form method=post>
+    <div class=xml-wrapper-hidden>
+        <div>" . __( "excluded_links" ) . "</div>
+        <textarea name=exclude rows=12 autocomplete=off>{$cms['config']['sitemap.mod.php']['exclude']}</textarea>
+        <div class=save_2_col>
+            <button name=save_settings_sitemap value=save>" . __( "save" ) . "</button>
+                <div class=select-dropdown>
+                    <div class=field-search>
+                        <input class=search-field autocomplete=off placeholder='" . __( "placeholder" ) . "'>
+                    </div>
+                    <ul class=list-search>
+                        
+                    </ul>
+                </div>
+        </div>
+    </div>
+    <div class=xml-wrapper-link>
+        <div>" . __( "included_links" ) . "</div>
+        <textarea name=include rows=12 autocomplete=off>{$cms['config']['sitemap.mod.php']['include']}</textarea>
+        <button name=save_settings_sitemap value=save>" . __( "save" ) . "</button>
+    </div>
+    <div class=xml-static-dynamic>
+        <div>" . __( "sitemap_gen" ) . "</div>
+        <label><input name=gen type=radio value=dynamic {$ch['dynamic']}> " . __( "dynamic" ) . "</label>
+        <label><input name=gen type=radio value=static {$ch['static']}> " . __( "static" ) . "</label>
+        <div> </div>
+        <div>" . __( "domain" ) . "</div>
+        <input type=text name=domain value='{$cms['config']['sitemap.mod.php']['domain']}' placeholder='http://example.com'>
+        <button name=save_settings_sitemap value=save>" . __( "save" ) . "</button>
+    </div>
+    <div class=xml-static-cron>
+        <div>" . __( "update_freq" ) . "</div>
+        <p>" . __( "static_freq" ) . " <input type=text name=update_interval value={$cms['config']['sitemap.mod.php']['update_interval']}> " . __( "minutes" ) . "</p>
+        <p>" . __( "url_for_cron" ) . ": {$cms['url']['scheme']}://{$cms['url']['host']}{$cms['base_path']}{$cms['config']['admin.mod.php']['cron_url']}</p>
+        <button name=save_settings_sitemap value=save>" . __( "save" ) . "</button>
+    </div>
+</form>
+
+<div class=sitemap-manual>
+    <div>" . __( "help" ) . "</div>
+    <p>" . __( "help_p1" ) . "</p>
+    <p>" . __( "help_p2" ) . "</p>
+</div>
+    ";
+
+    $cms["admin_pages"]["sitemap"] = $page;
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/mod/template.mod.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,531 @@
+<?php
+
+$cms["modules"]["template.mod.php"] = array(
+    "name"        => "template_module_name",
+    "description" => "template_module_description",
+    "files"       => array(
+        ".cms/mod/template.mod.php",
+        ".cms/css/template.css",
+        ".cms/js/template.js",
+        ".cms/lang/ru_RU.UTF-8/template.mod.php",
+        ".cms/lang/en_US.UTF-8/template.mod.php",
+        ".cms/lang/uk_UA.UTF-8/template.mod.php",
+    ),
+);
+
+// Return if module disabled
+if ( ! empty( $cms["config"]["template.mod.php"]["disabled"] ) ) {
+
+    return;
+
+} else {
+
+    // Install
+    if ( empty( $cms["config"]["template.mod.php"]["template"] ) ) {
+        $cms["config"]["template.mod.php"]["template"] = "mini";
+    }
+    if ( empty( $cms["config"]["template.mod.php"]["scripts"] ) ) {
+        $cms["config"]["template.mod.php"]["scripts"] = "";
+    }
+
+    $cms["template"] = $cms["config"]["template.mod.php"]["template"];
+
+    if ( ! isset( $cms["config"]["template.mod.php"]["disable_write_to_disk"] ) ) {
+        $cms["config"]["template.mod.php"]["disable_write_to_disk"] = true;
+    }
+    
+    if ( ! isset( $cms["config"]["template.mod.php"]["headers"] ) ) {
+        $cms["config"]["template.mod.php"]["headers"] = "cache-control: max-age=0";
+    }
+
+    if ( is_admin() ) {
+        hook_add_fn( "admin", "cms_template_admin" );
+        hook_add_fn( "admin_header",  "cms_template_admin_header" );
+        hook_add_fn( "api", "cms_template_api" );
+    }
+    // Вызов функции cms_template_template сделаем пораньше,
+    // чтобы в других модулях не нужно было ставить 20
+    hook_add_fn( "template", "cms_template_template", 5 );
+    hook_add_fn( "echo", "cms_template_echo" );
+    hook_add_fn( "write", "cms_template_write" );
+
+}
+
+function cms_template_admin_header() {
+    global $cms;
+    $conf = $cms["config"]["template.mod.php"]["menu"]["template"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+        echo "<link rel=stylesheet href='{$cms['base_path']}css/template.css'>";
+        echo "<script src='{$cms['base_path']}js/template.js'></script>";
+    }
+}
+
+function cms_template_admin() {
+    global $cms;
+
+    $conf = $cms["config"]["template.mod.php"]["menu"]["template"];
+    if ( empty( $conf["hide"] ) && empty( $cms["config"]["admin_sections"][ $conf["section"] ]["hide"] ) ) {
+
+    // Save settings
+    if ( ! empty( $_POST["save_template"] ) ) {
+        $cms["config"]["template.mod.php"]["template"] = $_POST["template"];
+        $cms["config"]["template.mod.php"]["disable_write_to_disk"] = empty( $_POST["enable_cache"] );
+        cms_save_config();
+        cms_clear_cache();
+        header( "Location: {$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}" );
+        $cms["hooks"]["admin"]["next"] = ""; // Предотвратить выдачу админки
+        return;
+    }
+    
+    // Save template headers
+    if ( ! empty( $_POST["save_template_headers"] ) ) {
+        $cms["config"]["template.mod.php"]["headers"] = $_POST["template_headers"];
+        cms_save_config();
+        header( "Location: {$cms['base_path']}{$cms['config']['admin.mod.php']['admin_url']}" );
+        $cms["hooks"]["admin"]["next"] = ""; // Предотвратить выдачу админки
+        return;
+    }
+
+    // Create menu item
+    if ( empty( $cms["config"]["template.mod.php"]["menu"]["template"] ) ) {
+        $cms["config"]["template.mod.php"]["menu"]["template"] = array(
+            "title"    => "template_module_name",
+            "sort"     => 70,
+            "section"  => "settings",
+        );
+        cms_save_config();
+    }
+
+    $options = "";
+    foreach( glob( "{$cms['cms_dir']}/*/html.php" ) as $path_html_php ) {
+        $template = preg_replace( "/.*\/([^\/]+)\/html\.php/u", "$1", $path_html_php );
+        if ( substr( $template, 0, 6 ) !== "admin." ) {
+            $options .= "<div class=option value='{$template}'>{$template}</div>";
+        }
+    }
+
+    cms_template_load_settings();
+    $template_files_title = "<div class=title>" . __( "editable_files" ) . "</div>";
+    $template_files = "";
+    if ( isset( $cms["templates"] ) && is_array( $cms["templates"] ) ) {
+        foreach( $cms["templates"][ $cms["config"]["template.mod.php"]["template"] ]["files"] as $file ) {
+            $template_files .= "<div class=file>{$file}</div>";
+        }
+    }
+    if ( empty( $template_files ) ) {
+        $template_files = "<div class=no-files>" . __( "no_editable_files" ) . "</div>";
+    }
+    
+    $tr_title   = __( "help" );
+    $tr_current = __( "current_template" );
+    $tr_save    = __( "save" );
+    $tr_upl     = __( "install_template" );
+    if ( $cms["config"]["template.mod.php"]["disable_write_to_disk"] ) {
+        $enable_cache = "";
+    } else {
+        $enable_cache = "checked";
+    }
+    $headers_title = __( "headers_title" );
+
+    // Справка для шаблона определяется в файле template.settings.php
+    $help = __( "help", $cms["config"]["template.mod.php"]["template"] );
+    if ( $help === "help" ) $help = "";
+
+    // Display settings
+    $page = "
+<div class=settings>
+    <div class=template-install>
+        <div class=upload_dnd>
+            <input id=template-upload type=file name='myfile[]' multiple class=files>
+            {$tr_upl}
+        </div>
+    </div>
+    <div class=template>
+        <form method=post>
+            <div>{$tr_current}</div>
+            <input name=template autocomplete=off type=hidden value='{$cms["config"]["template.mod.php"]["template"]}'>
+
+            <div class=template-select-grid>
+                <div class=field-select>
+                    <div class=value>{$cms["config"]["template.mod.php"]["template"]}</div>
+                    <div class=icon></div>
+                </div>
+                <div class=field-options>
+                    {$options}
+                </div>
+            </div>
+
+            <label>
+                <input type=checkbox name=enable_cache {$enable_cache}>
+                <span class=enable-cache>" . __( "enable_cache" ) . "</span>
+            </label>
+            
+            <button name=save_template value=save>{$tr_save}</button>
+        </form>
+    </div>
+    <form method=post class=template-headers>
+        <div class=template-headers-title>{$headers_title}</div>
+        <textarea name=template_headers>{$cms['config']['template.mod.php']['headers']}</textarea>
+        <button name=save_template_headers value=save>{$tr_save}</button>
+    </form>
+    <div class=template-manual>
+        <div>{$tr_title}</div>
+        {$help}
+    </div>
+    <div class=template-files>
+        {$template_files_title}
+        {$template_files}
+    </div>
+</div>
+
+<div class='template-editor-bg hidden'>
+    <div class=template-editor-grid>
+        <div class=template-editor-header>
+            <div class=close-template-button></div>
+            <div class=save-template-button></div>
+            <span class=template-editor-title></span>
+        </div>
+        <div class=template-editor>
+            <textarea></textarea>
+        </div>
+        <div class=snip-grid>
+            <div class=css>
+                <div data-type=snip data-otag='@media (min-width: px) and (max-width: px) {\n' data-ctag='\n}'>@media (min) and (max)</div>
+                <div data-type=snip data-otag='/* ' data-ctag=' */'>/* comment */</div>
+                <a href='{$cms['base_path']}man/{$cms['config']['locale']}/hint_css.html' target=_blank>" . __( "hint_css" ) . "</a>
+            </div>
+            <div class=php>
+                <a href='{$cms['base_path']}man/{$cms['config']['locale']}/hint_php.html' target=_blank>" . __( "hint_php" ) . "</a>
+            </div>
+            <div class=html>
+                <a href='{$cms['base_path']}man/{$cms['config']['locale']}/hint_html.html' target=_blank>" . __( "hint_html" ) . "</a>
+            </div>
+        </div>
+    </div>
+</div>
+";
+
+    $cms["admin_pages"]["template"] = $page;
+
+    }
+
+}
+
+// Load template settings
+function cms_template_load_settings() {
+    global $cms;
+    $settings = "{$cms['cms_dir']}/{$cms['config']['template.mod.php']['template']}/template.settings.php";
+    if ( file_exists( $settings ) ) {
+        include( $settings );
+    }
+}
+
+
+function cms_template_api() {
+    global $cms;
+    
+    if ( ! empty( $_POST["fn"] ) ) {
+        
+        switch ( $_POST["fn"] ) {
+
+            case "clear_cache":
+                cms_clear_cache();
+                echo( json_encode( array(
+                    "info_text"  => __( "cache_cleared" ),
+                    "info_class" => "info-success",
+                    "info_time"  => 5000,
+                ) ) );
+                return;
+            break;
+
+            case "get_template_file":
+                $file = file_get_contents( $cms["site_dir"] . "/" . $_POST["file"] );
+                if ( $file !== false ) {
+                    $ok = "true";
+                } else {
+                    $ok = "false";
+                }
+                echo( json_encode( array(
+                    "ok"   => $ok,
+                    "file" => $file,
+                ) ) );
+                return;
+            break;
+
+            case "save_template_file":
+                $file = file_put_contents( $cms["site_dir"] . "/" . $_POST["file"], $_POST["content"] );
+                if ( $file !== false ) {
+                    $ok    = "true";
+                    $msg   = __( "saved" );
+                    $class = "info-success";
+                } else {
+                    $ok    = "false";
+                    $msg   = __( "save_error" );
+                    $class = "info-error";
+                }
+                cms_clear_cache();
+                echo( json_encode( array(
+                    "ok"         => $ok,
+                    "info_text"  => $msg,
+                    "info_class" => $class,
+                    "info_time"  => 5000,
+                ) ) );
+                return;
+            break;
+
+            case "install_template":
+                $success = true;
+                //$text = "dev.coffee-cms.ru";
+                //if ( $cms["url"]["host"] !== $text )
+                foreach ( $_FILES["myfile"]["name"] as $n => $name ) {
+                    if ( $_FILES["myfile"]["error"][$n] ) {
+                        $success = false;
+                        $text = str_replace( "xxx", $name, __( "upload_error_xxx" ) );
+                        break;
+                    } else {
+                        // Unpack Template
+                        // Object Oriented Style for future compability with PHP 8
+                        $zip = new ZipArchive;
+                        if ( $zip->open( $_FILES["myfile"]["tmp_name"][$n] ) === TRUE ) {
+                            $zip->extractTo( $cms["site_dir"] );
+                            $zip->close();
+                            $text = __( "install_success" );
+                        } else {
+                            $success = false;
+                            $text = str_replace( "xxx", $name, __( "cant_unzip_xxx" ) );
+                            break;
+                        }
+                    }
+                }
+
+                if ( $success ) {
+                    echo( json_encode( array(
+                        "info_text"  => $text,
+                        "info_class" => "info-success",
+                        "info_time"  => 5000,
+                    ) ) );
+                    return;
+                } else {
+                    echo( json_encode( array(
+                        "info_text"  => $text,
+                        "info_class" => "info-error",
+                        "info_time"  => 10000,
+                    ) ) );
+                    return;
+                }
+            break;
+
+        }
+    }
+}
+
+
+function cms_template_template() {
+    global $cms;
+    if ( is_file( $cms["cms_file"] ) ) {
+        if ( substr( $cms["cms_file"], -4 ) === ".php" || strpos( substr( $cms["cms_file"], strlen( $cms["cms_dir"] ) ), "/." ) !== false ) {
+            $cms["status"]         = "404";
+        } else {
+            $cms["output"]["from"] = $cms["cms_file"];
+            $cms["output"]["to"]   = $cms["site_dir"] . "/" . $cms["url"]["path"];
+            $cms["status"]         = "200";
+        }
+    } else {
+        ob_start();
+        include( "{$cms['cms_dir']}/{$cms['template']}/html.php" );
+        $cms["output"] = ob_get_clean();
+    }
+}
+
+
+function cms_template_echo() {
+    global $cms;
+
+    $headers = array();
+    if ( substr( $cms["template"], 0, 6 ) !== "admin." ) {
+        $lines = explode( "\n", $cms["config"]["template.mod.php"]["headers"] );
+        foreach ( $lines as $line ) {
+            $line = trim( $line );
+            if ( ! empty( $line ) ) {
+                $headers[] = $line;
+            }
+        }
+    }
+
+    if ( is_array( $cms["output"] ) ) {
+        if ( $cms["status"] === "200" ) {
+            $types = array(
+                "css" => "text/css",
+                "js" => "application/javascript",
+                "svg" => "image/svg+xml",
+            );
+            $ext = preg_replace( "/.*\./u", "", $cms["output"]["to"] );
+            if ( isset( $types[$ext] ) ) {
+                $mime = $types[$ext];
+            } else {
+                $mime = "";
+            }
+            header( "Content-Type: {$mime}" );
+            header( "{$_SERVER['SERVER_PROTOCOL']} 200 OK" ); // fix server 404
+            foreach ( $headers as $header ) {
+                header( $header );
+            }
+            cms_readfile( $cms["output"]["from"], false );
+        } else {
+            header( "{$_SERVER['SERVER_PROTOCOL']} 404 Not Found" );
+        }
+    } else {
+        switch ( $cms["status"] ) {
+            case "200":
+                header( "{$_SERVER['SERVER_PROTOCOL']} 200 OK" ); // fix server 404
+                foreach ( $headers as $header ) {
+                    header( $header );
+                }
+                echo $cms["output"];
+            break;
+            case "404":
+                header( "{$_SERVER['SERVER_PROTOCOL']} 404 Not Found" );
+                echo $cms["output"];
+                // Для админа выводится текст страницы
+                // а для анонима сообщение что не найдена
+            break;
+            case "301":
+                header( "Location: {$cms['status_301_location']}", true, 301 );
+            break;
+            case "302":
+                header( "Location: {$cms['status_302_location']}", true, 302 );
+            break;
+        }
+    }
+}
+
+
+function cms_template_write() {
+    global $cms;
+
+    if ( ! empty( $cms["config"]["template.mod.php"]["disable_write_to_disk"] ) ) {
+        return;
+    }
+
+    if ( $cms["status"] !== "200" ) {
+        return;
+    }
+    
+    // write to disk
+    umask( 0 );
+
+    if ( is_array( $cms["output"] ) ) {
+        
+        $dirs = explode( "/", str_replace( $cms["site_dir"] . "/", "", $cms["output"]["to"] ) );
+        $dir  = $cms["site_dir"];
+        $file_name = array_pop( $dirs );
+        foreach ( $dirs as $path ) {
+            $dir .= "/" . $path;
+            if ( ! is_dir( $dir ) ) {
+                mkdir( $dir, 0777, false );
+            } elseif( is_file( $dir ) ) {
+                unlink( $dir );
+                mkdir( $dir, 0777, false );
+            }
+        }
+
+        if ( ! file_exists( $cms["output"]["to"] ) ) {
+            $tmp_name = $cms["site_dir"] . "/uploads/.tmp_" . cms_uid() . "_" . pathinfo( $cms["output"]["to"], PATHINFO_BASENAME );
+            copy( $cms["output"]["from"], $tmp_name );
+            rename( $tmp_name, $cms["output"]["to"] );
+        }
+
+    } else {
+
+        // create dirs
+        $dirs = explode( "/", $cms["url"]["path"] );
+        $dir  = $cms["site_dir"];
+        $file_name = array_pop( $dirs );
+        foreach ( $dirs as $path ) {
+            $dir .= "/" . $path;
+            if ( ! file_exists( $dir ) ) {
+                mkdir( $dir, 0777, false );
+            } elseif( is_file( $dir ) ) {
+                unlink( $dir );
+                mkdir( $dir, 0777, false );
+            }
+        }
+
+        if ( ! $file_name ) {
+            $file = $dir . "/index.html";
+        } else {
+            $file = $dir . "/" . $file_name;
+        }
+
+        if ( ! file_exists( $file ) ) {
+            $tmp_name = $cms["site_dir"] . "/uploads/.tmp_" . cms_uid() . "_" . pathinfo( $file, PATHINFO_BASENAME );
+            file_put_contents( $tmp_name, $cms["output"], LOCK_EX );
+            chmod( $tmp_name, 0666 );
+            rename( $tmp_name, $file );
+        }
+
+    }
+}
+
+
+function cms_clear_cache() {
+    global $cms;
+
+    do_hook( "clear_cache" );
+
+    // array for delete dirs
+    $dirs = array();
+
+    // search all pages in database
+    if ( ! empty( $cms["base"] ) ) {
+        if ( $res = mysqli_query( $cms["base"], "SELECT `url` FROM `pages`" ) ) {
+            while ( $page = mysqli_fetch_assoc( $res ) ) {
+                if ( $page["url"] === "/" ) $page["url"] = "";
+                $file = $cms["site_dir"] . "/" . $page["url"];
+                if ( substr( $file, -1 ) === "/" ) {
+                    $file .= "index.html";
+                } elseif ( is_dir( $file ) ) {
+                    // for
+                    // /parent/child
+                    // /parent
+                    $file .= "/index.html";
+                }
+                if ( is_file( $file ) ) unlink( $file );
+                // Add dirs to remove queue
+                $dir = "/" . $page["url"];
+                while ( $dir && $dir !== "/" && $dir !== "\\" ) {
+                    $new_dir = $cms["site_dir"] . $dir;
+                    if ( ! in_array( $new_dir, $dirs ) ) {
+                        $dirs[] = $new_dir;
+                    }
+                    $dir = dirname( $dir );
+                }
+            }
+        }
+    }
+
+    // delete template files
+    $queue[] = $cms["cms_dir"];
+    while ( $cur = array_shift( $queue ) ) {
+        if ( is_dir( $cur ) ) {
+            // add current dir to array for delete
+            array_push( $dirs, str_replace( ".cms/", "", $cur ) );
+            // search children files and dirs
+            $queue = array_merge( $queue, glob( $cur . "/*" ) );
+        } else {
+            $file = str_replace( ".cms/", "", $cur );
+            if ( is_file( $file ) ) unlink( $file );
+        }
+    }
+
+    // delete dirs
+    rsort( $dirs );
+    foreach ( $dirs as $dir ) {
+        if ( is_dir( $dir ) && $dir !== $cms["cms_dir"] && $dir !== $cms["site_dir"] ) {
+            if ( is_dir_and_empty( $dir ) ) {
+                rmdir( $dir );
+            }
+        }
+    }
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.cms/update.php	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,1 @@
+<?php
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.htaccess	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,108 @@
+# Блокировать атакующих
+#Deny from 192.168.0.1
+#Deny from 192.168.0.2
+
+# Редиректы страниц
+#Redirect 301 /old-url /new-url
+
+Options -Indexes
+
+DirectoryIndex index.html .cms/index.php
+
+<IfModule mod_rewrite.c>
+
+    RewriteEngine On
+    RewriteBase "/"
+
+    # domain.ru, www.domain.ru => domain.com
+    #RewriteCond %{HTTP_HOST} ^(www\.)?domain\.ru$ [NC]
+    #RewriteRule ^(.*)$ https://domain.com%{REQUEST_URI} [R=301,L]
+
+    # http => https
+    #RewriteCond %{HTTPS} off
+    #RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
+
+    # . => www
+    #RewriteCond %{HTTP_HOST} !^www\. [NC]
+    #RewriteRule ^ http%{ENV:protossl}://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
+    
+    # www => .
+    #RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
+    #RewriteRule ^ http%{ENV:protossl}://%1%{REQUEST_URI} [L,R=301]
+
+    # .hidden files
+    RewriteCond %{THE_REQUEST} "^(GET|POST|HEAD) (^|/)\.(.*) HTTP/[0-9.]+$"
+    RewriteRule ^ - [F]
+
+    # redirect /test/ to /test if file /test is exist
+    RewriteCond %{REQUEST_FILENAME} !-d
+    RewriteCond %{REQUEST_FILENAME} -f
+    RewriteCond %{REQUEST_URI} ^(.+)/$
+    RewriteRule ^(.+)/$ $1 [R=301,L]
+
+    #AcceptPathInfo Off
+    RewriteCond %{REQUEST_FILENAME} !-f
+    RewriteCond %{REQUEST_FILENAME} !-d
+    RewriteCond %{REQUEST_URI} !=/favicon.ico
+    RewriteRule ^(.*)$ .cms/index.php
+
+</IfModule>
+
+<IfModule mod_headers.c>
+
+    # 180 days
+    #Header set Cache-Control "max-age=15552000"
+    # Этот вариант закеширует вход в админку при установке CMS.
+    # Нужно быть готовым нажать F5 или раскомментировать после установки.
+    # Всему подряд добавлять кеширование только чтобы успокоить гугл-консоль - плохой вариант
+    # В админке, в Шаблоны, можно задать свои заголовки. Если там прописать
+    # cache-control: max-age=15552000
+    # то отдаваемые страницы получат этот заголовок, но админка и api-запросы
+    # будут отдаваться без этого заголовка.
+
+    # Нижеперечисленное подойдет если у вас нет nginx перед apache.
+    # Если же захотите кешировать все подряд и делать исключения через <If>,
+    # то убедитесь что админка и другие нужные api-запросы не получают
+    # заголовок Cache-Control
+    
+    # 180 days
+    #<FilesMatch "\.(jpg|jpeg|png|gif|webp|svg|qoi)$">
+    #    Header set Cache-Control "max-age=15552000"
+    #</FilesMatch>
+
+    # 180 days
+    #<FilesMatch "\.(js|css)$">
+    #    Header set Cache-Control "max-age=15552000"
+    #</FilesMatch>
+    
+</IfModule>
+
+#<IfModule mod_expires.c>
+#    ExpiresActive On
+#    ExpiresDefault "access plus 1 week"
+#</IfModule>
+#
+#<IfModule mod_deflate.c>
+#    SetOutputFilter DEFLATE
+#</IfModule>
+
+# Для отладки на хостингах
+# Если нет ошибок PHP в error.log
+# php_flag display_startup_errors off
+# php_flag display_errors off
+# php_flag html_errors off
+# php_flag log_errors on
+# php_flag ignore_repeated_errors off
+# php_flag ignore_repeated_source off
+# php_flag report_memleaks on
+# php_flag track_errors on
+# php_value docref_root 0
+# php_value docref_ext 0
+# php_value error_log /home/<u>/<user_name>/<user_name>.beget.tech/PHP_errors.log
+# php_value error_reporting 2047
+# php_value log_errors_max_len 0
+# <Files PHP_errors.log>
+#     Order allow,deny
+#     Deny from all
+#     Satisfy All
+# </Files>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.nginx.conf	Fri Oct 11 22:40:23 2024 +0000
@@ -0,0 +1,24 @@
+# Минимальный конфигурационный файл для nginx
+# Больше опций https://coffee-cms.ru/nastroyka-nginx-dlya-coffee-cms
+server {
+    server_name nginx.coffee-cms.ru;
+    listen 80;
+    root /var/www/nginx.coffee-cms.ru/html;
+    location / {
+        index index.html /.cms/index.php;
+        # чтобы страницы не скачивались как файлы:
+        default_type text/html;
+        try_files $uri $uri/ /.cms/index.php?$query_string;
+    }
+    location ~ \.php(/|$) {
+        try_files $uri $uri/ /.cms/index.php?$query_string;
+        fastcgi_split_path_info ^(.+\.php)(/.+)$;
+        fastcgi_pass unix:/run/php/php7.3-fpm.sock;
+        fastcgi_buffering off;
+        fastcgi_request_buffering off;
+        fastcgi_index index.php;
+        include fastcgi.conf;
+        fastcgi_param PATH_INFO $fastcgi_path_info;
+        expires off;
+    }
+}
\ No newline at end of file