From 0ff5e0e3b7775b24ff14f899905a29f4ce58a151 Mon Sep 17 00:00:00 2001 From: Joe Rhodes Date: Tue, 26 May 2020 13:30:07 -0400 Subject: [PATCH] pass header auth along; host debug as static by default as in a disconnected env --- docs/authorization.rst | 36 + graphene_django/forms/__init__.py | 2 +- graphene_django/forms/forms.py | 17 + graphene_django/settings.py | 5 +- .../static/graphiql/css/graphiql.css | 1609 +++++++++++++++++ .../static/graphiql/js/fetch.min.js | 8 + .../static/graphiql/js/graphiql.min.js | 1 + .../graphiql/js/react-dom.production.min.js | 220 +++ .../graphiql/js/react.production.min.js | 33 + graphene_django/templates/graphene/base.html | 30 + .../templates/graphene/graphiql.html | 42 +- .../templates/graphene/header_jwt_auth.html | 15 + graphene_django/tests/test_views.py | 2 +- graphene_django/views.py | 199 +- 14 files changed, 2146 insertions(+), 73 deletions(-) create mode 100755 graphene_django/static/graphiql/css/graphiql.css create mode 100755 graphene_django/static/graphiql/js/fetch.min.js create mode 100755 graphene_django/static/graphiql/js/graphiql.min.js create mode 100755 graphene_django/static/graphiql/js/react-dom.production.min.js create mode 100755 graphene_django/static/graphiql/js/react.production.min.js create mode 100755 graphene_django/templates/graphene/base.html create mode 100755 graphene_django/templates/graphene/header_jwt_auth.html diff --git a/docs/authorization.rst b/docs/authorization.rst index 63123b0..c43041d 100644 --- a/docs/authorization.rst +++ b/docs/authorization.rst @@ -185,3 +185,39 @@ For Django 2.0 and above: ] .. _LoginRequiredMixin: https://docs.djangoproject.com/en/1.10/topics/auth/default/#the-loginrequired-mixin + + +Passing around an AUTH token in the header (eg a JWT token) +------------------------------------------------------------ + +To restrict users from accessing the GraphQL API page, a standard AUTH token is passed around in the http META. This is a common pattern employed for an application spanning across several microservices, and this enables use of 'curl' with an existing query that has been wrapped with AUTH. The is passed along as META data in the section of the redered page. + +In order to make use of this mode of interacting with the PRIVATEGRAPHQL view, simply set 'grahiql_headers=True' in the main urls.py. +For Django 1.11: + +.. code:: python + + urlpatterns = [ + # some other urls + url(r'^graphql$', PrivateGraphQLView.as_view(graphiql_headers=True, schema=schema)), + ] + +For Django 2.0 and above: + +.. code:: python + + urlpatterns = [ + # some other urls + path('graphql', PrivateGraphQLView.as_view(graphiql_headers=True, schema=schema)), + ] + +Now upon navigating to the /graphql/ URL, the initial interaction is a
to collect the AUTH tocken to be used in graphiql. This AUTH token is passed along in the of the resulting graphiql session. + +Alternatively, the AUTH header can also be used in the 'curl' command in order to DEBUG the query with AUTH. + +For example: + +.. code-block:: bash + + $ curl -X POST "http://127.0.0.1:8000/graphql/" -H "accept: application/json" -H "Authorization: JWT #########" -d "query=?????" + diff --git a/graphene_django/forms/__init__.py b/graphene_django/forms/__init__.py index 066eec4..a217f40 100644 --- a/graphene_django/forms/__init__.py +++ b/graphene_django/forms/__init__.py @@ -1 +1 @@ -from .forms import GlobalIDFormField, GlobalIDMultipleChoiceField # noqa +from .forms import GlobalIDFormField, GlobalIDMultipleChoiceField, HeaderForm # noqa diff --git a/graphene_django/forms/forms.py b/graphene_django/forms/forms.py index 4b81859..9a34193 100644 --- a/graphene_django/forms/forms.py +++ b/graphene_django/forms/forms.py @@ -1,6 +1,7 @@ import binascii from django.core.exceptions import ValidationError +from django import forms from django.forms import CharField, Field, MultipleChoiceField from django.utils.translation import gettext_lazy as _ @@ -38,3 +39,19 @@ class GlobalIDMultipleChoiceField(MultipleChoiceField): # Clean will raise a validation error if there is a problem GlobalIDFormField().clean(value) return True + + +class HeaderForm(forms.Form): + # make a ChoiceField for 'JWT' and other methods -- use a widget? + headers = forms.CharField( + help_text="Enter auth method to be stored in the as HTTP_AUTHORIZATION", + initial="JWT ", + ) + + def clean_auth(self): + data = self.cleaned_data["headers"] + + # raise ValidationError() + + # Remember to always return the cleaned data. + return data diff --git a/graphene_django/settings.py b/graphene_django/settings.py index 666ad8a..8c205de 100644 --- a/graphene_django/settings.py +++ b/graphene_django/settings.py @@ -23,7 +23,7 @@ except ImportError: from django.utils import importlib # Will be removed in Django 1.9 -# Copied shamelessly from Django REST Framework +# Copied shamelessly from Django REST Framework -- make sure session now part of MIDDLEWARE for tests() DEFAULTS = { "SCHEMA": None, @@ -36,6 +36,7 @@ DEFAULTS = { # Max items returned in ConnectionFields / FilterConnectionFields "RELAY_CONNECTION_MAX_LIMIT": 100, "CAMELCASE_ERRORS": False, + "SOURCE": None, # Set to True to enable v3 naming convention for choice field Enum's "DJANGO_CHOICE_FIELD_ENUM_V3_NAMING": False, "DJANGO_CHOICE_FIELD_ENUM_CUSTOM_NAME": None, @@ -45,7 +46,7 @@ if settings.DEBUG: DEFAULTS["MIDDLEWARE"] += ("graphene_django.debug.DjangoDebugMiddleware",) # List of settings that may be in string import notation. -IMPORT_STRINGS = ("MIDDLEWARE", "SCHEMA") +IMPORT_STRINGS = ("MIDDLEWARE", "SCHEMA", "SOURCE") def perform_import(val, setting_name): diff --git a/graphene_django/static/graphiql/css/graphiql.css b/graphene_django/static/graphiql/css/graphiql.css new file mode 100755 index 0000000..919b4e9 --- /dev/null +++ b/graphene_django/static/graphiql/css/graphiql.css @@ -0,0 +1,1609 @@ +.graphiql-container, +.graphiql-container button, +.graphiql-container input { + color: #141823; + font-family: + system, + -apple-system, + 'San Francisco', + '.SFNSDisplay-Regular', + 'Segoe UI', + Segoe, + 'Segoe WP', + 'Helvetica Neue', + helvetica, + 'Lucida Grande', + arial, + sans-serif; + font-size: 14px; +} + +.graphiql-container { + display: flex; + flex-direction: row; + height: 100%; + margin: 0; + overflow: hidden; + width: 100%; +} + +.graphiql-container .editorWrap { + display: flex; + flex-direction: column; + flex: 1; + overflow-x: hidden; +} + +.graphiql-container .title { + font-size: 18px; +} + +.graphiql-container .title em { + font-family: georgia; + font-size: 19px; +} + +.graphiql-container .topBarWrap { + display: flex; + flex-direction: row; +} + +.graphiql-container .topBar { + align-items: center; + background: linear-gradient(#f7f7f7, #e2e2e2); + border-bottom: 1px solid #d0d0d0; + cursor: default; + display: flex; + flex-direction: row; + flex: 1; + height: 34px; + overflow-y: visible; + padding: 7px 14px 6px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .toolbar { + overflow-x: visible; + display: flex; +} + +.graphiql-container .docExplorerShow, +.graphiql-container .historyShow { + background: linear-gradient(#f7f7f7, #e2e2e2); + border-radius: 0; + border-bottom: 1px solid #d0d0d0; + border-right: none; + border-top: none; + color: #3B5998; + cursor: pointer; + font-size: 14px; + margin: 0; + outline: 0; + padding: 2px 20px 0 18px; +} + +.graphiql-container .docExplorerShow { + border-left: 1px solid rgba(0, 0, 0, 0.2); +} + +.graphiql-container .historyShow { + border-right: 1px solid rgba(0, 0, 0, 0.2); + border-left: 0; +} + +.graphiql-container .docExplorerShow:before { + border-left: 2px solid #3B5998; + border-top: 2px solid #3B5998; + content: ''; + display: inline-block; + height: 9px; + margin: 0 3px -1px 0; + position: relative; + -ms-transform: rotate(-45deg); + transform: rotate(-45deg); + width: 9px; +} + +.graphiql-container .editorBar { + display: flex; + flex-direction: row; + flex: 1; +} + +.graphiql-container .queryWrap { + display: flex; + flex-direction: column; + flex: 1; +} + +.graphiql-container .resultWrap { + border-left: solid 1px #e0e0e0; + display: flex; + flex-direction: column; + flex: 1; + position: relative; +} + +.graphiql-container .docExplorerWrap, +.graphiql-container .historyPaneWrap { + background: white; + box-shadow: 0 0 8px rgba(0, 0, 0, 0.15); + position: relative; + z-index: 3; +} + +.graphiql-container .historyPaneWrap { + min-width: 230px; + z-index: 5; +} + +.graphiql-container .docExplorerResizer { + cursor: col-resize; + height: 100%; + left: -5px; + position: absolute; + top: 0; + width: 10px; + z-index: 10; +} + +.graphiql-container .docExplorerHide { + cursor: pointer; + font-size: 18px; + margin: -7px -8px -6px 0; + padding: 18px 16px 15px 12px; +} + +.graphiql-container div .query-editor { + flex: 1; + position: relative; +} + +.graphiql-container .variable-editor { + display: flex; + flex-direction: column; + height: 30px; + position: relative; +} + +.graphiql-container .variable-editor-title { + background: #eeeeee; + border-bottom: 1px solid #d6d6d6; + border-top: 1px solid #e0e0e0; + color: #777; + font-variant: small-caps; + font-weight: bold; + letter-spacing: 1px; + line-height: 14px; + padding: 6px 0 8px 43px; + text-transform: lowercase; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .codemirrorWrap { + flex: 1; + height: 100%; + position: relative; +} + +.graphiql-container .result-window { + flex: 1; + height: 100%; + position: relative; +} + +.graphiql-container .footer { + background: #f6f7f8; + border-left: 1px solid #e0e0e0; + border-top: 1px solid #e0e0e0; + margin-left: 12px; + position: relative; +} + +.graphiql-container .footer:before { + background: #eeeeee; + bottom: 0; + content: " "; + left: -13px; + position: absolute; + top: -1px; + width: 12px; +} + +/* No `.graphiql-container` here so themes can overwrite */ +.result-window .CodeMirror { + background: #f6f7f8; +} + +.graphiql-container .result-window .CodeMirror-gutters { + background-color: #eeeeee; + border-color: #e0e0e0; + cursor: col-resize; +} + +.graphiql-container .result-window .CodeMirror-foldgutter, +.graphiql-container .result-window .CodeMirror-foldgutter-open:after, +.graphiql-container .result-window .CodeMirror-foldgutter-folded:after { + padding-left: 3px; +} + +.graphiql-container .toolbar-button { + background: #fdfdfd; + background: linear-gradient(#f9f9f9, #ececec); + border-radius: 3px; + box-shadow: + inset 0 0 0 1px rgba(0,0,0,0.20), + 0 1px 0 rgba(255,255,255, 0.7), + inset 0 1px #fff; + color: #555; + cursor: pointer; + display: inline-block; + margin: 0 5px; + padding: 3px 11px 5px; + text-decoration: none; + text-overflow: ellipsis; + white-space: nowrap; + max-width: 150px; +} + +.graphiql-container .toolbar-button:active { + background: linear-gradient(#ececec, #d5d5d5); + box-shadow: + 0 1px 0 rgba(255, 255, 255, 0.7), + inset 0 0 0 1px rgba(0,0,0,0.10), + inset 0 1px 1px 1px rgba(0, 0, 0, 0.12), + inset 0 0 5px rgba(0, 0, 0, 0.1); +} + +.graphiql-container .toolbar-button.error { + background: linear-gradient(#fdf3f3, #e6d6d7); + color: #b00; +} + +.graphiql-container .toolbar-button-group { + margin: 0 5px; + white-space: nowrap; +} + +.graphiql-container .toolbar-button-group > * { + margin: 0; +} + +.graphiql-container .toolbar-button-group > *:not(:last-child) { + border-top-right-radius: 0; + border-bottom-right-radius: 0; +} + +.graphiql-container .toolbar-button-group > *:not(:first-child) { + border-top-left-radius: 0; + border-bottom-left-radius: 0; + margin-left: -1px; +} + +.graphiql-container .execute-button-wrap { + height: 34px; + margin: 0 14px 0 28px; + position: relative; +} + +.graphiql-container .execute-button { + background: linear-gradient(#fdfdfd, #d2d3d6); + border-radius: 17px; + border: 1px solid rgba(0,0,0,0.25); + box-shadow: 0 1px 0 #fff; + cursor: pointer; + fill: #444; + height: 34px; + margin: 0; + padding: 0; + width: 34px; +} + +.graphiql-container .execute-button svg { + pointer-events: none; +} + +.graphiql-container .execute-button:active { + background: linear-gradient(#e6e6e6, #c3c3c3); + box-shadow: + 0 1px 0 #fff, + inset 0 0 2px rgba(0, 0, 0, 0.2), + inset 0 0 6px rgba(0, 0, 0, 0.1); +} + +.graphiql-container .execute-button:focus { + outline: 0; +} + +.graphiql-container .toolbar-menu, +.graphiql-container .toolbar-select { + position: relative; +} + +.graphiql-container .execute-options, +.graphiql-container .toolbar-menu-items, +.graphiql-container .toolbar-select-options { + background: #fff; + box-shadow: + 0 0 0 1px rgba(0,0,0,0.1), + 0 2px 4px rgba(0,0,0,0.25); + margin: 0; + padding: 6px 0; + position: absolute; + z-index: 100; +} + +.graphiql-container .execute-options { + min-width: 100px; + top: 37px; + left: -1px; +} + +.graphiql-container .toolbar-menu-items { + left: 1px; + margin-top: -1px; + min-width: 110%; + top: 100%; + visibility: hidden; +} + +.graphiql-container .toolbar-menu-items.open { + visibility: visible; +} + +.graphiql-container .toolbar-select-options { + left: 0; + min-width: 100%; + top: -5px; + visibility: hidden; +} + +.graphiql-container .toolbar-select-options.open { + visibility: visible; +} + +.graphiql-container .execute-options > li, +.graphiql-container .toolbar-menu-items > li, +.graphiql-container .toolbar-select-options > li { + cursor: pointer; + display: block; + margin: none; + max-width: 300px; + overflow: hidden; + padding: 2px 20px 4px 11px; + white-space: nowrap; +} + +.graphiql-container .execute-options > li.selected, +.graphiql-container .toolbar-menu-items > li.hover, +.graphiql-container .toolbar-menu-items > li:active, +.graphiql-container .toolbar-menu-items > li:hover, +.graphiql-container .toolbar-select-options > li.hover, +.graphiql-container .toolbar-select-options > li:active, +.graphiql-container .toolbar-select-options > li:hover, +.graphiql-container .history-contents > p:hover, +.graphiql-container .history-contents > p:active { + background: #e10098; + color: #fff; +} + +.graphiql-container .toolbar-select-options > li > svg { + display: inline; + fill: #666; + margin: 0 -6px 0 6px; + pointer-events: none; + vertical-align: middle; +} + +.graphiql-container .toolbar-select-options > li.hover > svg, +.graphiql-container .toolbar-select-options > li:active > svg, +.graphiql-container .toolbar-select-options > li:hover > svg { + fill: #fff; +} + +.graphiql-container .CodeMirror-scroll { + overflow-scrolling: touch; +} + +.graphiql-container .CodeMirror { + color: #141823; + font-family: + 'Consolas', + 'Inconsolata', + 'Droid Sans Mono', + 'Monaco', + monospace; + font-size: 13px; + height: 100%; + left: 0; + position: absolute; + top: 0; + width: 100%; +} + +.graphiql-container .CodeMirror-lines { + padding: 20px 0; +} + +.CodeMirror-hint-information .content { + box-orient: vertical; + color: #141823; + display: flex; + font-family: system, -apple-system, 'San Francisco', '.SFNSDisplay-Regular', 'Segoe UI', Segoe, 'Segoe WP', 'Helvetica Neue', helvetica, 'Lucida Grande', arial, sans-serif; + font-size: 13px; + line-clamp: 3; + line-height: 16px; + max-height: 48px; + overflow: hidden; + text-overflow: -o-ellipsis-lastline; +} + +.CodeMirror-hint-information .content p:first-child { + margin-top: 0; +} + +.CodeMirror-hint-information .content p:last-child { + margin-bottom: 0; +} + +.CodeMirror-hint-information .infoType { + color: #CA9800; + cursor: pointer; + display: inline; + margin-right: 0.5em; +} + +.autoInsertedLeaf.cm-property { + animation-duration: 6s; + animation-name: insertionFade; + border-bottom: 2px solid rgba(255, 255, 255, 0); + border-radius: 2px; + margin: -2px -4px -1px; + padding: 2px 4px 1px; +} + +@keyframes insertionFade { + from, to { + background: rgba(255, 255, 255, 0); + border-color: rgba(255, 255, 255, 0); + } + + 15%, 85% { + background: #fbffc9; + border-color: #f0f3c0; + } +} + +div.CodeMirror-lint-tooltip { + background-color: white; + border-radius: 2px; + border: 0; + color: #141823; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); + font-size: 13px; + line-height: 16px; + max-width: 430px; + opacity: 0; + padding: 8px 10px; + transition: opacity 0.15s; + white-space: pre-wrap; +} + +div.CodeMirror-lint-tooltip > * { + padding-left: 23px; +} + +div.CodeMirror-lint-tooltip > * + * { + margin-top: 12px; +} + +/* COLORS */ + +.graphiql-container .CodeMirror-foldmarker { + border-radius: 4px; + background: #08f; + background: linear-gradient(#43A8FF, #0F83E8); + box-shadow: + 0 1px 1px rgba(0, 0, 0, 0.2), + inset 0 0 0 1px rgba(0, 0, 0, 0.1); + color: white; + font-family: arial; + font-size: 12px; + line-height: 0; + margin: 0 3px; + padding: 0px 4px 1px; + text-shadow: 0 -1px rgba(0, 0, 0, 0.1); +} + +.graphiql-container div.CodeMirror span.CodeMirror-matchingbracket { + color: #555; + text-decoration: underline; +} + +.graphiql-container div.CodeMirror span.CodeMirror-nonmatchingbracket { + color: #f00; +} + +/* Comment */ +.cm-comment { + color: #999; +} + +/* Punctuation */ +.cm-punctuation { + color: #555; +} + +/* Keyword */ +.cm-keyword { + color: #B11A04; +} + +/* OperationName, FragmentName */ +.cm-def { + color: #D2054E; +} + +/* FieldName */ +.cm-property { + color: #1F61A0; +} + +/* FieldAlias */ +.cm-qualifier { + color: #1C92A9; +} + +/* ArgumentName and ObjectFieldName */ +.cm-attribute { + color: #8B2BB9; +} + +/* Number */ +.cm-number { + color: #2882F9; +} + +/* String */ +.cm-string { + color: #D64292; +} + +/* Boolean */ +.cm-builtin { + color: #D47509; +} + +/* EnumValue */ +.cm-string-2 { + color: #0B7FC7; +} + +/* Variable */ +.cm-variable { + color: #397D13; +} + +/* Directive */ +.cm-meta { + color: #B33086; +} + +/* Type */ +.cm-atom { + color: #CA9800; +} +/* BASICS */ + +.CodeMirror { + /* Set height, width, borders, and global font properties here */ + color: black; + font-family: monospace; + height: 300px; +} + +/* PADDING */ + +.CodeMirror-lines { + padding: 4px 0; /* Vertical padding around content */ +} +.CodeMirror pre { + padding: 0 4px; /* Horizontal padding of content */ +} + +.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + background-color: white; /* The little square between H and V scrollbars */ +} + +/* GUTTER */ + +.CodeMirror-gutters { + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; +} +.CodeMirror-linenumbers {} +.CodeMirror-linenumber { + color: #999; + min-width: 20px; + padding: 0 3px 0 5px; + text-align: right; + white-space: nowrap; +} + +.CodeMirror-guttermarker { color: black; } +.CodeMirror-guttermarker-subtle { color: #999; } + +/* CURSOR */ + +.CodeMirror .CodeMirror-cursor { + border-left: 1px solid black; +} +/* Shown when moving in bi-directional text */ +.CodeMirror div.CodeMirror-secondarycursor { + border-left: 1px solid silver; +} +.CodeMirror.cm-fat-cursor div.CodeMirror-cursor { + background: #7e7; + border: 0; + width: auto; +} +.CodeMirror.cm-fat-cursor div.CodeMirror-cursors { + z-index: 1; +} + +.cm-animate-fat-cursor { + animation: blink 1.06s steps(1) infinite; + border: 0; + width: auto; +} +@keyframes blink { + 0% { background: #7e7; } + 50% { background: none; } + 100% { background: #7e7; } +} + +/* Can style cursor different in overwrite (non-insert) mode */ +div.CodeMirror-overwrite div.CodeMirror-cursor {} + +.cm-tab { display: inline-block; text-decoration: inherit; } + +.CodeMirror-ruler { + border-left: 1px solid #ccc; + position: absolute; +} + +/* DEFAULT THEME */ + +.cm-s-default .cm-keyword {color: #708;} +.cm-s-default .cm-atom {color: #219;} +.cm-s-default .cm-number {color: #164;} +.cm-s-default .cm-def {color: #00f;} +.cm-s-default .cm-variable, +.cm-s-default .cm-punctuation, +.cm-s-default .cm-property, +.cm-s-default .cm-operator {} +.cm-s-default .cm-variable-2 {color: #05a;} +.cm-s-default .cm-variable-3 {color: #085;} +.cm-s-default .cm-comment {color: #a50;} +.cm-s-default .cm-string {color: #a11;} +.cm-s-default .cm-string-2 {color: #f50;} +.cm-s-default .cm-meta {color: #555;} +.cm-s-default .cm-qualifier {color: #555;} +.cm-s-default .cm-builtin {color: #30a;} +.cm-s-default .cm-bracket {color: #997;} +.cm-s-default .cm-tag {color: #170;} +.cm-s-default .cm-attribute {color: #00c;} +.cm-s-default .cm-header {color: blue;} +.cm-s-default .cm-quote {color: #090;} +.cm-s-default .cm-hr {color: #999;} +.cm-s-default .cm-link {color: #00c;} + +.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-error {color: #f00;} +.cm-invalidchar {color: #f00;} + +.CodeMirror-composing { border-bottom: 2px solid; } + +/* Default styles for common addons */ + +div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} +div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} +.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } +.CodeMirror-activeline-background {background: #e8f2ff;} + +/* STOP */ + +/* The rest of this file contains styles related to the mechanics of + the editor. You probably shouldn't touch them. */ + +.CodeMirror { + background: white; + overflow: hidden; + position: relative; +} + +.CodeMirror-scroll { + height: 100%; + /* 30px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -30px; margin-right: -30px; + outline: none; /* Prevent dragging from highlighting the element */ + overflow: scroll !important; /* Things will break if this is overridden */ + padding-bottom: 30px; + position: relative; +} +.CodeMirror-sizer { + border-right: 30px solid transparent; + position: relative; +} + +/* 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 { + display: none; + position: absolute; + z-index: 6; +} +.CodeMirror-vscrollbar { + overflow-x: hidden; + overflow-y: scroll; + right: 0; top: 0; +} +.CodeMirror-hscrollbar { + bottom: 0; left: 0; + overflow-x: scroll; + overflow-y: hidden; +} +.CodeMirror-scrollbar-filler { + right: 0; bottom: 0; +} +.CodeMirror-gutter-filler { + left: 0; bottom: 0; +} + +.CodeMirror-gutters { + min-height: 100%; + position: absolute; left: 0; top: 0; + z-index: 3; +} +.CodeMirror-gutter { + display: inline-block; + height: 100%; + margin-bottom: -30px; + vertical-align: top; + white-space: normal; + /* Hack to make IE7 behave */ + *zoom:1; + *display:inline; +} +.CodeMirror-gutter-wrapper { + background: none !important; + border: none !important; + position: absolute; + z-index: 4; +} +.CodeMirror-gutter-background { + position: absolute; + top: 0; bottom: 0; + z-index: 4; +} +.CodeMirror-gutter-elt { + cursor: default; + position: absolute; + z-index: 4; +} +.CodeMirror-gutter-wrapper { + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.CodeMirror-lines { + cursor: text; + min-height: 1px; /* prevents collapsing before first draw */ +} +.CodeMirror pre { + -webkit-tap-highlight-color: transparent; + /* Reset some styles that the rest of the page might have set */ + background: transparent; + border-radius: 0; + border-width: 0; + color: inherit; + font-family: inherit; + font-size: inherit; + font-variant-ligatures: none; + line-height: inherit; + margin: 0; + overflow: visible; + position: relative; + white-space: pre; + word-wrap: normal; + z-index: 2; +} +.CodeMirror-wrap pre { + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; +} + +.CodeMirror-linebackground { + position: absolute; + left: 0; right: 0; top: 0; bottom: 0; + z-index: 0; +} + +.CodeMirror-linewidget { + overflow: auto; + position: relative; + z-index: 2; +} + +.CodeMirror-widget {} + +.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 { + box-sizing: content-box; +} + +.CodeMirror-measure { + height: 0; + overflow: hidden; + position: absolute; + visibility: hidden; + width: 100%; +} + +.CodeMirror-cursor { position: absolute; } +.CodeMirror-measure pre { position: static; } + +div.CodeMirror-cursors { + position: relative; + visibility: hidden; + z-index: 3; +} +div.CodeMirror-dragcursors { + visibility: visible; +} + +.CodeMirror-focused div.CodeMirror-cursors { + visibility: visible; +} + +.CodeMirror-selected { background: #d9d9d9; } +.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } +.CodeMirror-crosshair { cursor: crosshair; } +.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } +.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } + +.cm-searching { + background: #ffa; + background: rgba(255, 255, 0, .4); +} + +/* IE7 hack to prevent it from returning funny offsetTops on the spans */ +.CodeMirror span { *vertical-align: text-bottom; } + +/* 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; } + +.CodeMirror-dialog { + background: inherit; + color: inherit; + left: 0; right: 0; + overflow: hidden; + padding: .1em .8em; + position: absolute; + z-index: 15; +} + +.CodeMirror-dialog-top { + border-bottom: 1px solid #eee; + top: 0; +} + +.CodeMirror-dialog-bottom { + border-top: 1px solid #eee; + bottom: 0; +} + +.CodeMirror-dialog input { + background: transparent; + border: 1px solid #d3d6db; + color: inherit; + font-family: monospace; + outline: none; + width: 20em; +} + +.CodeMirror-dialog button { + font-size: 70%; +} +.graphiql-container .doc-explorer { + background: white; +} + +.graphiql-container .doc-explorer-title-bar, +.graphiql-container .history-title-bar { + cursor: default; + display: flex; + height: 34px; + line-height: 14px; + padding: 8px 8px 5px; + position: relative; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .doc-explorer-title, +.graphiql-container .history-title { + flex: 1; + font-weight: bold; + overflow-x: hidden; + padding: 10px 0 10px 10px; + text-align: center; + text-overflow: ellipsis; + -webkit-user-select: text; + -moz-user-select: text; + -ms-user-select: text; + user-select: text; + white-space: nowrap; +} + +.graphiql-container .doc-explorer-back { + color: #3B5998; + cursor: pointer; + margin: -7px 0 -6px -8px; + overflow-x: hidden; + padding: 17px 12px 16px 16px; + text-overflow: ellipsis; + white-space: nowrap; +} + +.doc-explorer-narrow .doc-explorer-back { + width: 0; +} + +.graphiql-container .doc-explorer-back:before { + border-left: 2px solid #3B5998; + border-top: 2px solid #3B5998; + content: ''; + display: inline-block; + height: 9px; + margin: 0 3px -1px 0; + position: relative; + -ms-transform: rotate(-45deg); + transform: rotate(-45deg); + width: 9px; +} + +.graphiql-container .doc-explorer-rhs { + position: relative; +} + +.graphiql-container .doc-explorer-contents, +.graphiql-container .history-contents { + background-color: #ffffff; + border-top: 1px solid #d6d6d6; + bottom: 0; + left: 0; + overflow-y: auto; + padding: 20px 15px; + position: absolute; + right: 0; + top: 47px; +} + +.graphiql-container .doc-explorer-contents { + min-width: 300px; +} + +.graphiql-container .doc-type-description p:first-child , +.graphiql-container .doc-type-description blockquote:first-child { + margin-top: 0; +} + +.graphiql-container .doc-explorer-contents a { + cursor: pointer; + text-decoration: none; +} + +.graphiql-container .doc-explorer-contents a:hover { + text-decoration: underline; +} + +.graphiql-container .doc-value-description > :first-child { + margin-top: 4px; +} + +.graphiql-container .doc-value-description > :last-child { + margin-bottom: 4px; +} + +.graphiql-container .doc-category { + margin: 20px 0; +} + +.graphiql-container .doc-category-title { + border-bottom: 1px solid #e0e0e0; + color: #777; + cursor: default; + font-size: 14px; + font-variant: small-caps; + font-weight: bold; + letter-spacing: 1px; + margin: 0 -15px 10px 0; + padding: 10px 0; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .doc-category-item { + margin: 12px 0; + color: #555; +} + +.graphiql-container .keyword { + color: #B11A04; +} + +.graphiql-container .type-name { + color: #CA9800; +} + +.graphiql-container .field-name { + color: #1F61A0; +} + +.graphiql-container .field-short-description { + color: #999; + margin-left: 5px; + overflow: hidden; + text-overflow: ellipsis; +} + +.graphiql-container .enum-value { + color: #0B7FC7; +} + +.graphiql-container .arg-name { + color: #8B2BB9; +} + +.graphiql-container .arg { + display: block; + margin-left: 1em; +} + +.graphiql-container .arg:first-child:last-child, +.graphiql-container .arg:first-child:nth-last-child(2), +.graphiql-container .arg:first-child:nth-last-child(2) ~ .arg { + display: inherit; + margin: inherit; +} + +.graphiql-container .arg:first-child:nth-last-child(2):after { + content: ', '; +} + +.graphiql-container .arg-default-value { + color: #43A047; +} + +.graphiql-container .doc-deprecation { + background: #fffae8; + box-shadow: inset 0 0 1px #bfb063; + color: #867F70; + line-height: 16px; + margin: 8px -8px; + max-height: 80px; + overflow: hidden; + padding: 8px; + border-radius: 3px; +} + +.graphiql-container .doc-deprecation:before { + content: 'Deprecated:'; + color: #c79b2e; + cursor: default; + display: block; + font-size: 9px; + font-weight: bold; + letter-spacing: 1px; + line-height: 1; + padding-bottom: 5px; + text-transform: uppercase; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .doc-deprecation > :first-child { + margin-top: 0; +} + +.graphiql-container .doc-deprecation > :last-child { + margin-bottom: 0; +} + +.graphiql-container .show-btn { + -webkit-appearance: initial; + display: block; + border-radius: 3px; + border: solid 1px #ccc; + text-align: center; + padding: 8px 12px 10px; + width: 100%; + box-sizing: border-box; + background: #fbfcfc; + color: #555; + cursor: pointer; +} + +.graphiql-container .search-box { + border-bottom: 1px solid #d3d6db; + display: block; + font-size: 14px; + margin: -15px -15px 12px 0; + position: relative; +} + +.graphiql-container .search-box:before { + content: '\26b2'; + cursor: pointer; + display: block; + font-size: 24px; + position: absolute; + top: -2px; + -ms-transform: rotate(-45deg); + transform: rotate(-45deg); + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .search-box .search-box-clear { + background-color: #d0d0d0; + border-radius: 12px; + color: #fff; + cursor: pointer; + font-size: 11px; + padding: 1px 5px 2px; + position: absolute; + right: 3px; + top: 8px; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.graphiql-container .search-box .search-box-clear:hover { + background-color: #b9b9b9; +} + +.graphiql-container .search-box > input { + border: none; + box-sizing: border-box; + font-size: 14px; + outline: none; + padding: 6px 24px 8px 20px; + width: 100%; +} + +.graphiql-container .error-container { + font-weight: bold; + left: 0; + letter-spacing: 1px; + opacity: 0.5; + position: absolute; + right: 0; + text-align: center; + text-transform: uppercase; + top: 50%; + -ms-transform: translate(0, -50%); + transform: translate(0, -50%); +} +.CodeMirror-foldmarker { + color: blue; + cursor: pointer; + font-family: arial; + line-height: .3; + text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; +} +.CodeMirror-foldgutter { + width: .7em; +} +.CodeMirror-foldgutter-open, +.CodeMirror-foldgutter-folded { + cursor: pointer; +} +.CodeMirror-foldgutter-open:after { + content: "\25BE"; +} +.CodeMirror-foldgutter-folded:after { + content: "\25B8"; +} +.graphiql-container .history-contents, +.graphiql-container .history-contents input { + font-family: 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace; + padding: 0; +} + +.graphiql-container .history-contents p { + align-items: center; + display: flex; + font-size: 12px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + margin: 0; + padding: 8px; + border-bottom: 1px solid #e0e0e0; +} + +.graphiql-container .history-contents p.editable { + padding-bottom: 6px; + padding-top: 7px; +} + +.graphiql-container .history-contents input { + flex-grow: 1; + font-size: 12px; +} + +.graphiql-container .history-contents p:hover { + cursor: pointer; +} + +.graphiql-container .history-contents p span.history-label { + flex-grow: 1; + overflow: hidden; + text-overflow: ellipsis; +}.CodeMirror-info { + background: white; + border-radius: 2px; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); + box-sizing: border-box; + color: #555; + font-family: + system, + -apple-system, + 'San Francisco', + '.SFNSDisplay-Regular', + 'Segoe UI', + Segoe, + 'Segoe WP', + 'Helvetica Neue', + helvetica, + 'Lucida Grande', + arial, + sans-serif; + font-size: 13px; + line-height: 16px; + margin: 8px -8px; + max-width: 400px; + opacity: 0; + overflow: hidden; + padding: 8px 8px; + position: fixed; + transition: opacity 0.15s; + z-index: 50; +} + +.CodeMirror-info :first-child { + margin-top: 0; +} + +.CodeMirror-info :last-child { + margin-bottom: 0; +} + +.CodeMirror-info p { + margin: 1em 0; +} + +.CodeMirror-info .info-description { + color: #777; + line-height: 16px; + margin-top: 1em; + max-height: 80px; + overflow: hidden; +} + +.CodeMirror-info .info-deprecation { + background: #fffae8; + box-shadow: inset 0 1px 1px -1px #bfb063; + color: #867F70; + line-height: 16px; + margin: -8px; + margin-top: 8px; + max-height: 80px; + overflow: hidden; + padding: 8px; +} + +.CodeMirror-info .info-deprecation-label { + color: #c79b2e; + cursor: default; + display: block; + font-size: 9px; + font-weight: bold; + letter-spacing: 1px; + line-height: 1; + padding-bottom: 5px; + text-transform: uppercase; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.CodeMirror-info .info-deprecation-label + * { + margin-top: 0; +} + +.CodeMirror-info a { + text-decoration: none; +} + +.CodeMirror-info a:hover { + text-decoration: underline; +} + +.CodeMirror-info .type-name { + color: #CA9800; +} + +.CodeMirror-info .field-name { + color: #1F61A0; +} + +.CodeMirror-info .enum-value { + color: #0B7FC7; +} + +.CodeMirror-info .arg-name { + color: #8B2BB9; +} + +.CodeMirror-info .directive-name { + color: #B33086; +} +.CodeMirror-jump-token { + text-decoration: underline; + cursor: pointer; +} +/* The lint marker gutter */ +.CodeMirror-lint-markers { + width: 16px; +} + +.CodeMirror-lint-tooltip { + background-color: infobackground; + border-radius: 4px 4px 4px 4px; + border: 1px solid black; + color: infotext; + font-family: monospace; + font-size: 10pt; + max-width: 600px; + opacity: 0; + overflow: hidden; + padding: 2px 5px; + position: fixed; + transition: opacity .4s; + white-space: pre-wrap; + z-index: 100; +} + +.CodeMirror-lint-mark-error, .CodeMirror-lint-mark-warning { + background-position: left bottom; + background-repeat: repeat-x; +} + +.CodeMirror-lint-mark-error { + background-image: + url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJDw4cOCW1/KIAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAHElEQVQI12NggIL/DAz/GdA5/xkY/qPKMDAwAADLZwf5rvm+LQAAAABJRU5ErkJggg==") + ; +} + +.CodeMirror-lint-mark-warning { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAADCAYAAAC09K7GAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9sJFhQXEbhTg7YAAAAZdEVYdENvbW1lbnQAQ3JlYXRlZCB3aXRoIEdJTVBXgQ4XAAAAMklEQVQI12NkgIIvJ3QXMjAwdDN+OaEbysDA4MPAwNDNwMCwiOHLCd1zX07o6kBVGQEAKBANtobskNMAAAAASUVORK5CYII="); +} + +.CodeMirror-lint-marker-error, .CodeMirror-lint-marker-warning { + background-position: center center; + background-repeat: no-repeat; + cursor: pointer; + display: inline-block; + height: 16px; + position: relative; + vertical-align: middle; + width: 16px; +} + +.CodeMirror-lint-message-error, .CodeMirror-lint-message-warning { + background-position: top left; + background-repeat: no-repeat; + padding-left: 18px; +} + +.CodeMirror-lint-marker-error, .CodeMirror-lint-message-error { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAHlBMVEW7AAC7AACxAAC7AAC7AAAAAAC4AAC5AAD///+7AAAUdclpAAAABnRSTlMXnORSiwCK0ZKSAAAATUlEQVR42mWPOQ7AQAgDuQLx/z8csYRmPRIFIwRGnosRrpamvkKi0FTIiMASR3hhKW+hAN6/tIWhu9PDWiTGNEkTtIOucA5Oyr9ckPgAWm0GPBog6v4AAAAASUVORK5CYII="); +} + +.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-multiple { + background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAHCAMAAADzjKfhAAAACVBMVEUAAAAAAAC/v7914kyHAAAAAXRSTlMAQObYZgAAACNJREFUeNo1ioEJAAAIwmz/H90iFFSGJgFMe3gaLZ0od+9/AQZ0ADosbYraAAAAAElFTkSuQmCC"); + background-position: right bottom; + background-repeat: no-repeat; + width: 100%; height: 100%; +} +.graphiql-container .spinner-container { + height: 36px; + left: 50%; + position: absolute; + top: 50%; + -ms-transform: translate(-50%, -50%); + transform: translate(-50%, -50%); + width: 36px; + z-index: 10; +} + +.graphiql-container .spinner { + animation: rotation .6s infinite linear; + border-bottom: 6px solid rgba(150, 150, 150, .15); + border-left: 6px solid rgba(150, 150, 150, .15); + border-radius: 100%; + border-right: 6px solid rgba(150, 150, 150, .15); + border-top: 6px solid rgba(150, 150, 150, .8); + display: inline-block; + height: 24px; + position: absolute; + vertical-align: middle; + width: 24px; +} + +@keyframes rotation { + from { transform: rotate(0deg); } + to { transform: rotate(359deg); } +} +.CodeMirror-hints { + background: white; + box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45); + font-family: 'Consolas', 'Inconsolata', 'Droid Sans Mono', 'Monaco', monospace; + font-size: 13px; + list-style: none; + margin-left: -6px; + margin: 0; + max-height: 14.5em; + overflow-y: auto; + overflow: hidden; + padding: 0; + position: absolute; + z-index: 10; +} + +.CodeMirror-hint { + border-top: solid 1px #f7f7f7; + color: #141823; + cursor: pointer; + margin: 0; + max-width: 300px; + overflow: hidden; + padding: 2px 6px; + white-space: pre; +} + +li.CodeMirror-hint-active { + background-color: #08f; + border-top-color: white; + color: white; +} + +.CodeMirror-hint-information { + border-top: solid 1px #c0c0c0; + max-width: 300px; + padding: 4px 6px; + position: relative; + z-index: 1; +} + +.CodeMirror-hint-information:first-child { + border-bottom: solid 1px #c0c0c0; + border-top: none; + margin-bottom: -1px; +} + +.CodeMirror-hint-deprecation { + background: #fffae8; + box-shadow: inset 0 1px 1px -1px #bfb063; + color: #867F70; + font-family: + system, + -apple-system, + 'San Francisco', + '.SFNSDisplay-Regular', + 'Segoe UI', + Segoe, + 'Segoe WP', + 'Helvetica Neue', + helvetica, + 'Lucida Grande', + arial, + sans-serif; + font-size: 13px; + line-height: 16px; + margin-top: 4px; + max-height: 80px; + overflow: hidden; + padding: 6px; +} + +.CodeMirror-hint-deprecation .deprecation-label { + color: #c79b2e; + cursor: default; + display: block; + font-size: 9px; + font-weight: bold; + letter-spacing: 1px; + line-height: 1; + padding-bottom: 5px; + text-transform: uppercase; + -webkit-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} + +.CodeMirror-hint-deprecation .deprecation-label + * { + margin-top: 0; +} + +.CodeMirror-hint-deprecation :last-child { + margin-bottom: 0; +} diff --git a/graphene_django/static/graphiql/js/fetch.min.js b/graphene_django/static/graphiql/js/fetch.min.js new file mode 100755 index 0000000..c8f4d92 --- /dev/null +++ b/graphene_django/static/graphiql/js/fetch.min.js @@ -0,0 +1,8 @@ +/** + * Minified by jsDelivr using UglifyJS v3.4.0. + * Original file: /npm/whatwg-fetch@2.0.3/fetch.js + * + * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files + */ +!function(t){"use strict";if(!t.fetch){var e="URLSearchParams"in t,r="Symbol"in t&&"iterator"in Symbol,s="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),o="FormData"in t,n="ArrayBuffer"in t;if(n)var i=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],a=function(t){return t&&DataView.prototype.isPrototypeOf(t)},h=ArrayBuffer.isView||function(t){return t&&-1=minLine||(to.line>=minLine&&(to=Pos(minLine,0)),minLine=from.line,null==mode?mode=this.uncomment(from,to,options)?"un":(this.lineComment(from,to,options),"line"):"un"==mode?this.uncomment(from,to,options):this.lineComment(from,to,options))}}),CodeMirror.defineExtension("lineComment",function(from,to,options){options||(options=noOptions);var self=this,mode=getMode(self,from),firstLine=self.getLine(from.line);if(null!=firstLine&&!function(cm,pos,line){return/\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line,0)))&&!/^[\'\"\`]/.test(line)}(self,from,firstLine)){var commentString=options.lineComment||mode.lineComment;if(commentString){var end=Math.min(0!=to.ch||to.line==from.line?to.line+1:to.line,self.lastLine()+1),pad=null==options.padding?" ":options.padding,blankLines=options.commentBlankLines||from.line==to.line;self.operation(function(){if(options.indent){for(var baseString=null,i=from.line;iwhitespace.length)&&(baseString=whitespace)}for(i=from.line;iend||self.operation(function(){if(0!=options.fullLines){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(null!=lead)for(var i=from.line+1;i<=end;++i)i==end&&!lastLineHasText||self.replaceRange(lead+pad,Pos(i,0))}else self.replaceRange(endString,to),self.replaceRange(startString,from)})}}else(options.lineComment||mode.lineComment)&&0!=options.fullLines&&self.lineComment(from,to,options)}),CodeMirror.defineExtension("uncomment",function(from,to,options){options||(options=noOptions);var didSomething,self=this,mode=getMode(self,from),end=Math.min(0!=to.ch||to.line==from.line?to.line:to.line-1,self.lastLine()),start=Math.min(from.line,end),lineString=options.lineComment||mode.lineComment,lines=[],pad=null==options.padding?" ":options.padding;lineComment:if(lineString){for(var i=start;i<=end;++i){var line=self.getLine(i),found=line.indexOf(lineString);if(-1",triples:"",explode:"[]{}"},Pos=CodeMirror.Pos;function getOption(conf,name){return"pairs"==name&&"string"==typeof conf?conf:"object"==typeof conf&&null!=conf[name]?conf[name]:defaults[name]}CodeMirror.defineOption("autoCloseBrackets",!1,function(cm,val,old){old&&old!=CodeMirror.Init&&(cm.removeKeyMap(keyMap),cm.state.closeBrackets=null),val&&(ensureBound(getOption(val,"pairs")),cm.state.closeBrackets=val,cm.addKeyMap(keyMap))});var keyMap={Backspace:function(cm){var conf=getConfig(cm);if(!conf||cm.getOption("disableInput"))return CodeMirror.Pass;for(var pairs=getOption(conf,"pairs"),ranges=cm.listSelections(),i=0;i",")":"(<","[":"]>","]":"[<","{":"}>","}":"{<","<":">>",">":"<<"};function bracketRegex(config){return config&&config.bracketRegex||/[(){}[\]]/}function findMatchingBracket(cm,where,config){var line=cm.getLineHandle(where.line),pos=where.ch-1,afterCursor=config&&config.afterCursor;null==afterCursor&&(afterCursor=/(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className));var re=bracketRegex(config),match=!afterCursor&&0<=pos&&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&&0maxScanLen))for(lineNo==where.line&&(pos=where.ch-(dir<0?1:0));pos!=end;pos+=dir){var ch=line.charAt(pos);if(re.test(ch)&&(void 0===style||cm.getTokenTypeAt(Pos(lineNo,pos+1))==style)){var match=matching[ch];if(match&&">"==match.charAt(1)==0cm.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))),"keyword"!=start.type||"import"!=start.string)return null;for(var i=line,e=Math.min(cm.lastLine(),line+10);i<=e;++i){var semi=cm.getLine(i).indexOf(";");if(-1!=semi)return{startCh:start.end,end:CodeMirror.Pos(i,semi)}}}var prev,startLine=start.line,has=hasImport(startLine);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(null==next)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(linecm.lastLine())return null;var start=cm.getTokenAt(CodeMirror.Pos(line,1));return/\S/.test(start.string)||(start=cm.getTokenAt(CodeMirror.Pos(line,start.end+1))),"meta"==start.type&&"#include"==start.string.slice(0,8)?start.start+8:void 0}var startLine=start.line,has=hasInclude(startLine);if(null==has||null!=hasInclude(startLine-1))return null;for(var end=startLine;;){if(null==hasInclude(end+1))break;++end}return{from:CodeMirror.Pos(startLine,has+1),to:cm.clipPos(CodeMirror.Pos(end))}})})("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":15}],7:[function(require,module,exports){(function(CodeMirror){"use strict";function doFold(cm,pos,options,force){if(options&&options.call){var finder=options;options=null}else finder=getOption(cm,options,"rangeFinder");"number"==typeof pos&&(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.linecm.firstLine();)pos=CodeMirror.Pos(pos.line-1,0),range=getRange(!1);if(range&&!range.cleared&&"unfold"!==force){var myWidget=function(cm,options){var widget=getOption(cm,options,"widget");if("string"==typeof widget){var text=document.createTextNode(widget);(widget=document.createElement("span")).appendChild(text),widget.className="CodeMirror-foldmarker"}else widget&&(widget=widget.cloneNode(!0));return widget}(cm,options);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:!0});myRange.on("clear",function(from,to){CodeMirror.signal(cm,"unfold",cm,from,to)}),CodeMirror.signal(cm,"fold",cm,range.from,range.to)}}CodeMirror.newFoldFunction=function(rangeFinder,widget){return function(cm,pos){doFold(cm,pos,{rangeFinder:rangeFinder,widget:widget})}},CodeMirror.defineExtension("foldCode",function(pos,options,force){doFold(this,pos,options,force)}),CodeMirror.defineExtension("isFolded",function(pos){for(var marks=this.findMarksAt(pos),i=0;i=minSize&&(mark=marker(opts.indicatorOpen))}cm.setGutterMarker(line,opts.gutter,mark),++cur})}function updateInViewport(cm){var vp=cm.getViewport(),state=cm.state.foldGutter;state&&(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){var opts=state.options;if(gutter==opts.gutter){var folded=isFolded(cm,line);folded?folded.clear():cm.foldCode(Pos(line,0),opts.rangeFinder)}}}function onChange(cm){var state=cm.state.foldGutter;if(state){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){var opts=state.options;clearTimeout(state.changeUpdate),state.changeUpdate=setTimeout(function(){var vp=cm.getViewport();state.from==state.to||20state.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){var line=from.line;line>=state.from&&linehints.clientHeight+1,startScroll=cm.getScrollInfo();if(0winW&&(hints.style.width=winW-5+"px",overlapX-=box.right-box.left-winW),hints.style.left=(left=pos.left-overlapX-offsetLeft)+"px"),scrolls)for(var node=hints.firstChild;node;node=node.nextSibling)node.style.paddingRight=cm.display.nativeBarWidth+"px";cm.addKeyMap(this.keyMap=function(completion,handle){var baseMap={Up:function(){handle.moveFocus(-1)},Down:function(){handle.moveFocus(1)},PageUp:function(){handle.moveFocus(1-handle.menuSize(),!0)},PageDown:function(){handle.moveFocus(handle.menuSize()-1,!0)},Home:function(){handle.setFocus(0)},End:function(){handle.setFocus(handle.length-1)},Enter:handle.pick,Tab:handle.pick,Esc:handle.close};/Mac/.test(navigator.platform)&&(baseMap["Ctrl-P"]=function(){handle.moveFocus(-1)},baseMap["Ctrl-N"]=function(){handle.moveFocus(1)});var custom=completion.options.customKeys,ourMap=custom?{}:baseMap;function addBinding(key,val){var bound;bound="string"!=typeof val?function(cm){return val(cm,handle)}:baseMap.hasOwnProperty(val)?baseMap[val]:val,ourMap[key]=bound}if(custom)for(var key in custom)custom.hasOwnProperty(key)&&addBinding(key,custom[key]);var extra=completion.options.extraKeys;if(extra)for(var key in extra)extra.hasOwnProperty(key)&&addBinding(key,extra[key]);return ourMap}(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})),completion.options.closeOnUnfocus&&(cm.on("blur",this.onBlur=function(){closingOnBlur=setTimeout(function(){completion.close()},100)}),cm.on("focus",this.onFocus=function(){clearTimeout(closingOnBlur)}));return cm.on("scroll",this.onScroll=function(){var curScroll=cm.getScrollInfo(),editor=cm.getWrapperElement().getBoundingClientRect(),newTop=top+startScroll.top-curScroll.top,point=newTop-(parentWindow.pageYOffset||(ownerDocument.documentElement||ownerDocument.body).scrollTop);if(below||(point+=hints.offsetHeight),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);t&&null!=t.hintId&&(widget.changeActive(t.hintId),widget.pick())}),CodeMirror.on(hints,"click",function(e){var t=getHintElement(hints,e.target||e.srcElement);t&&null!=t.hintId&&(widget.changeActive(t.hintId),completion.options.completeOnSingleClick&&widget.pick())}),CodeMirror.on(hints,"mousedown",function(){setTimeout(function(){cm.focus()},20)}),CodeMirror.signal(data,"select",completions[this.selectedHint],hints.childNodes[this.selectedHint]),!0}function fetchHints(hint,cm,options,callback){if(hint.async)hint(cm,callback,options);else{var result=hint(cm,options);result&&result.then?result.then(callback):callback(result)}}Completion.prototype={close:function(){this.active()&&(this.cm.state.completionActive=null,this.tick=null,this.cm.off("cursorActivity",this.activityFunc),this.widget&&this.data&&CodeMirror.signal(this.data,"close"),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];completion.hint?completion.hint(this.cm,data,completion):this.cm.replaceRange(getText(completion),completion.from||data.from,completion.to||data.to,"complete"),CodeMirror.signal(data,"pick",completion),this.close()},cursorActivity:function(){this.debounce&&(cancelAnimationFrame(this.debounce),this.debounce=0);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=this.data.list.length?i=avoidWrap?this.data.list.length-1:0:i<0&&(i=avoidWrap?0:this.data.list.length-1),this.selectedHint!=i){var node=this.hints.childNodes[this.selectedHint];node&&(node.className=node.className.replace(" CodeMirror-hint-active","")),(node=this.hints.childNodes[this.selectedHint=i]).className+=" CodeMirror-hint-active",node.offsetTopthis.hints.scrollTop+this.hints.clientHeight&&(this.hints.scrollTop=node.offsetTop+node.offsetHeight-this.hints.clientHeight+3),CodeMirror.signal(this.data,"select",this.data.list[this.selectedHint],node)}},screenAmount:function(){return Math.floor(this.hints.clientHeight/this.hints.firstChild.offsetHeight)||1}},CodeMirror.registerHelper("hint","auto",{resolve:function(cm,pos){var words,helpers=cm.getHelpers(pos,"hint");if(helpers.length){var resolved=function(cm,callback,options){var app=function(cm,helpers){if(!cm.somethingSelected())return helpers;for(var result=[],i=0;i,]/,closeOnUnfocus:!0,completeOnSingleClick:!0,container:null,customKeys:null,extraKeys:null};CodeMirror.defineOption("hintOptions",null)})("object"==typeof exports&&"object"==typeof module?require("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":15}],10:[function(require,module,exports){(function(CodeMirror){"use strict";var GUTTER_ID="CodeMirror-lint-markers";function rm(elt){elt.parentNode&&elt.parentNode.removeChild(elt)}function showTooltipFor(e,content,node){var tooltip=function(e,content){var tt=document.createElement("div");function position(e){if(!tt.parentNode)return CodeMirror.off(document,"mousemove",position);tt.style.top=Math.max(0,e.clientY-tt.offsetHeight-5)+"px",tt.style.left=e.clientX+5+"px"}return tt.className="CodeMirror-lint-tooltip",tt.appendChild(content.cloneNode(!0)),document.body.appendChild(tt),CodeMirror.on(document,"mousemove",position),position(e),null!=tt.style.opacity&&(tt.style.opacity=1),tt}(e,content);function hide(){CodeMirror.off(node,"mouseout",hide),tooltip&&(function(tt){tt.parentNode&&(null==tt.style.opacity&&rm(tt),tt.style.opacity=0,setTimeout(function(){rm(tt)},600))}(tooltip),tooltip=null)}var poll=setInterval(function(){if(tooltip)for(var n=node;;n=n.parentNode){if(n&&11==n.nodeType&&(n=n.host),n==document.body)return;if(!n){hide();break}}if(!tooltip)return clearInterval(poll)},400);CodeMirror.on(node,"mouseout",hide)}function LintState(cm,options,hasGutter){this.marked=[],this.options=options,this.timeout=null,this.hasGutter=hasGutter,this.onMouseOver=function(e){!function(cm,e){var target=e.target||e.srcElement;if(!/\bCodeMirror-lint-mark-/.test(target.className))return;for(var box=target.getBoundingClientRect(),x=(box.left+box.right)/2,y=(box.top+box.bottom)/2,spans=cm.findMarksAt(cm.coordsChar({left:x,top:y},"client")),annotations=[],i=0;i '+cm.phrase("(Use line:column or scroll% syntax)")+""}(cm),cm.phrase("Jump to line:"),cur.line+1+":"+cur.ch,function(posStr){var match;if(posStr)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);/^[-+]/.test(match[1])&&(line=cur.line+line+1),cm.setCursor(line-1,cur.ch)}else(match=/^\s*\:?\s*([\+\-]?\d+)\s*/.exec(posStr))&&cm.setCursor(interpretLine(cm,match[1]),cur.ch)})},CodeMirror.keyMap.default["Alt-G"]="jumpToLine"},"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("../dialog/dialog")):mod(CodeMirror)},{"../../lib/codemirror":15,"../dialog/dialog":3}],12:[function(require,module,exports){var mod;mod=function(CodeMirror){"use strict";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"string"==typeof query&&query==query.toLowerCase()}function getSearchCursor(cm,query,pos){return cm.getSearchCursor(query,pos,{caseFold:queryCaseInsensitive(query),multiline:!0})}function dialog(cm,text,shortText,deflt,f){cm.openDialog?cm.openDialog(text,f,{value:deflt,selectValueOnOpen:!0}):f(prompt(shortText,deflt))}function parseString(string){return string.replace(/\\(.)/g,function(_,ch){return"n"==ch?"\n":"r"==ch?"\r":ch})}function parseQuery(query){var isRE=query.match(/^\/(.*)\/([a-z]*)$/);if(isRE)try{query=new RegExp(isRE[1],-1==isRE[2].indexOf("i")?"":"i")}catch(e){}else query=parseString(query);return("string"==typeof query?""==query:query.test(""))&&(query=/x^/),query}function startSearch(cm,state,query){state.queryText=query,state.query=parseQuery(query),cm.removeOverlay(state.overlay,queryCaseInsensitive(state.query)),state.overlay=function(query,caseInsensitive){return"string"==typeof query?query=new RegExp(query.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),caseInsensitive?"gi":"g"):query.global||(query=new RegExp(query.source,query.ignoreCase?"gi":"g")),{token:function(stream){query.lastIndex=stream.pos;var match=query.exec(stream.string);if(match&&match.index==stream.pos)return stream.pos+=match[0].length||1,"searching";match?stream.pos=match.index:stream.skipToEnd()}}}(state.query,queryCaseInsensitive(state.query)),cm.addOverlay(state.overlay),cm.showMatchesOnScrollbar&&(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&&"x^"==q.source&&(q=null),persistent&&cm.openDialog){var hiding=null,searchNext=function(query,event){CodeMirror.e_stop(event),query&&(query!=state.queryText&&(startSearch(cm,state,query),state.posFrom=state.posTo=cm.getCursor()),hiding&&(hiding.style.opacity=1),findNext(cm,event.shiftKey,function(_,to){var dialog;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)}))};!function(cm,text,deflt,onEnter,onKeyDown){cm.openDialog(text,onEnter,{value:deflt,selectValueOnOpen:!0,closeOnEnter:!1,onClose:function(){clearSearch(cm)},onKeyDown:onKeyDown})}(cm,getQueryDialog(cm),q,searchNext,function(event,query){var keyName=CodeMirror.keyName(event),extra=cm.getOption("extraKeys"),cmd=extra&&extra[keyName]||CodeMirror.keyMap[cm.getOption("keyMap")][keyName];"findNext"==cmd||"findPrev"==cmd||"findPersistentNext"==cmd||"findPersistentPrev"==cmd?(CodeMirror.e_stop(event),startSearch(cm,getSearchState(cm),query),cm.execCommand(cmd)):"find"!=cmd&&"findPersistent"!=cmd||(CodeMirror.e_stop(event),searchNext(query,event))}),immediate&&q&&(startSearch(cm,state,q),findNext(cm,rev))}else dialog(cm,getQueryDialog(cm),"Search for:",q,function(query){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),cursor=getSearchCursor(cm,state.query,rev?state.posFrom:state.posTo);(cursor.find(rev)||(cursor=getSearchCursor(cm,state.query,rev?CodeMirror.Pos(cm.lastLine()):CodeMirror.Pos(cm.firstLine(),0))).find(rev))&&(cm.setSelection(cursor.from(),cursor.to()),cm.scrollIntoView({from:cursor.from(),to:cursor.to()},20),state.posFrom=cursor.from(),state.posTo=cursor.to(),callback&&callback(cursor.from(),cursor.to()))})}function clearSearch(cm){cm.operation(function(){var state=getSearchState(cm);state.lastQuery=state.query,state.query&&(state.query=state.queryText=null,cm.removeOverlay(state.overlay),state.annotate&&(state.annotate.clear(),state.annotate=null))})}function getQueryDialog(cm){return''+cm.phrase("Search:")+' '+cm.phrase("(Use /re/ syntax for regexp search)")+""}function replaceAll(cm,query,text){cm.operation(function(){for(var cursor=getSearchCursor(cm,query);cursor.findNext();)if("string"!=typeof query){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")){var query=cm.getSelection()||getSearchState(cm).lastQuery,dialogText=''+(all?cm.phrase("Replace all:"):cm.phrase("Replace:"))+"";dialog(cm,dialogText+function(cm){return' '+cm.phrase("(Use /re/ syntax for regexp search)")+""}(cm),dialogText,query,function(query){query&&(query=parseQuery(query),dialog(cm,function(cm){return''+cm.phrase("With:")+' '}(cm),cm.phrase("Replace with:"),"",function(text){if(text=parseString(text),all)replaceAll(cm,query,text);else{clearSearch(cm);var cursor=getSearchCursor(cm,query,cm.getCursor("from")),advance=function(){var match,start=cursor.from();!(match=cursor.findNext())&&(cursor=getSearchCursor(cm,query),!(match=cursor.findNext())||start&&cursor.from().line==start.line&&cursor.from().ch==start.ch)||(cm.setSelection(cursor.from(),cursor.to()),cm.scrollIntoView({from:cursor.from(),to:cursor.to()}),function(cm,text,shortText,fs){cm.openConfirm?cm.openConfirm(text,fs):confirm(shortText)&&fs[0]()}(cm,function(cm){return''+cm.phrase("Replace?")+" "}(cm),cm.phrase("Replace?"),[function(){doReplace(match)},advance,function(){replaceAll(cm,query,text)}]))},doReplace=function(match){cursor.replace("string"==typeof query?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,!1,!0)},CodeMirror.commands.findPersistentNext=function(cm){doSearch(cm,!1,!0,!0)},CodeMirror.commands.findPersistentPrev=function(cm){doSearch(cm,!0,!0,!0)},CodeMirror.commands.findNext=doSearch,CodeMirror.commands.findPrev=function(cm){doSearch(cm,!0)},CodeMirror.commands.clearSearch=clearSearch,CodeMirror.commands.replace=replace,CodeMirror.commands.replaceAll=function(cm){replace(cm,!0)}},"object"==typeof exports&&"object"==typeof module?mod(require("../../lib/codemirror"),require("./searchcursor"),require("../dialog/dialog")):mod(CodeMirror)},{"../../lib/codemirror":15,"../dialog/dialog":3,"./searchcursor":13}],13:[function(require,module,exports){(function(CodeMirror){"use strict";var doFold,noFold,Pos=CodeMirror.Pos;function ensureFlags(regexp,flags){for(var current=function(regexp){var flags=regexp.flags;return null!=flags?flags:(regexp.ignoreCase?"i":"")+(regexp.global?"g":"")+(regexp.multiline?"m":"")}(regexp),target=current,i=0;i>1,len=foldFunc(orig.slice(0,mid)).length;if(len==pos)return mid;pos=line.length)return doc.clipPos(Pos(start.line+1,0));for(var type,state="start",pos=start.ch,e=dir<0?0:line.length,i=0;pos!=e;pos+=dir,i++){var next=line.charAt(dir<0?pos-1:pos),cat="_"!=next&&CodeMirror.isWordChar(next)?"w":"o";if("w"==cat&&next.toUpperCase()==next&&(cat="W"),"start"==state)"o"!=cat&&(state="in",type=cat);else if("in"==state&&type!=cat){if("w"==type&&"W"==cat&&dir<0&&pos--,"W"==type&&"w"==cat&&0=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;cm.getCursor().line<=visibleTopLine&&cm.execCommand("goLineDown")}cm.scrollTo(null,info.top+cm.defaultTextHeight())},cmds.splitSelectionByLine=function(cm){for(var ranges=cm.listSelections(),lineRanges=[],i=0;ifrom.line&&line==to.line&&0==to.ch||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:!1})},cmds.selectLine=function(cm){for(var ranges=cm.listSelections(),extended=[],i=0;icm.lastLine()?cm.replaceRange("\n"+line,Pos(cm.lastLine()),null,"+swapLine"):cm.replaceRange(line+"\n",Pos(to,0),null,"+swapLine")}cm.setSelections(newSels),cm.scrollIntoView()})},cmds.swapLineDown=function(cm){if(cm.isReadOnly())return CodeMirror.Pass;for(var ranges=cm.listSelections(),linesToMove=[],at=cm.lastLine()+1,i=ranges.length-1;0<=i;i--){var range=ranges[i],from=range.to().line+1,to=range.from().line;0!=range.to().ch||range.empty()||from--,fromch)return i;cur.to==ch&&(cur.from!=cur.to&&"before"==sticky?found=i:bidiOther=i),cur.from==ch&&(cur.from!=cur.to&&"before"!=sticky?found=i:bidiOther=i)}return null!=found?found:bidiOther}var lowTypes,arabicTypes,bidiRE,isNeutral,isStrong,countsAsLeft,countsAsNum,bidiOrdering=(lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN",arabicTypes="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111",bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/,function(str,direction){var outerType="ltr"==direction?"L":"R";if(0==str.length||"ltr"==direction&&!bidiRE.test(str))return!1;for(var code,len=str.length,types=[],i=0;i=doc.size)throw new Error("There is no line "+(n+doc.first)+" in the document.");for(var chunk=doc;!chunk.lines;)for(var i=0;;++i){var child=chunk.children[i],sz=child.chunkSize();if(n=doc.first&&llast?Pos(last,getLine(doc,last).text.length):function(pos,linelen){var ch=pos.ch;return null==ch||linelen=this.string.length},StringStream.prototype.sol=function(){return this.pos==this.lineStart},StringStream.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},StringStream.prototype.next=function(){if(this.posstart},StringStream.prototype.eatSpace=function(){for(var start=this.pos;/[\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(-1cm.options.maxHighlightLength&©State(cm.doc.mode,context.state),result=highlightLine(cm,line,context);resetState&&(context.state=resetState),line.stateAfter=context.save(!resetState),line.styles=result.styles,result.classes?line.styleClasses=result.classes:line.styleClasses&&(line.styleClasses=null),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,!0,n);var start=function(cm,n,precise){for(var minindent,minline,doc=cm.doc,lim=precise?-1:n-(cm.doc.mode.innerMode?1e3:100),search=n;limdoc.first&&getLine(doc,start-1).stateAfter,context=saved?Context.fromSaved(doc,saved,start):new Context(doc,startState(doc.mode),start);return 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&&posstream.start)return style}throw new Error("Mode "+mode.name+" failed to advance stream.")}Context.prototype.lookAhead=function(n){var line=this.doc.getLine(this.line+n);return null!=line&&n>this.maxLookAhead&&(this.maxLookAhead=n),line},Context.prototype.baseToken=function(n){if(!this.baseTokens)return null;for(;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++,0cm.options.maxHighlightLength?(flattenSpans=!1,forceToEnd&&processLine(cm,text,context,stream.pos),stream.pos=text.length,null):extractLineClasses(readToken(mode,stream,context.state,inner),lineClasses),inner){var mName=inner[0].name;mName&&(style="m-"+(style?mName+" "+style:mName))}if(!flattenSpans||curStyle!=style){for(;curStart=startCh:span.to>startCh);(nw||(nw=[])).push(new MarkedSpan(marker,span.from,endsAfter?null:span.to))}}return nw}(oldFirst,startCh,isInsert),last=function(old,endCh,isInsert){var nw;if(old)for(var i=0;i=endCh:span.to>endCh)||span.from==endCh&&"bookmark"==marker.type&&(!isInsert||span.marker.insertLeft)){var startsBefore=null==span.from||(marker.inclusiveLeft?span.from<=endCh:span.fromch)&&(!found||compareCollapsedMarkers(found,sp.marker)<0)&&(found=sp.marker)}return found}function conflictingCollapsedRange(doc,lineNo$$1,from,to,marker){var line=getLine(doc,lineNo$$1),sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;idoc.lastLine())return lineN;var merged,line=getLine(doc,lineN);if(!lineIsHidden(doc,line))return lineN;for(;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return lineNo(line)+1}function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;id.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)})}var Line=function(text,markedSpans,estimateHeight){this.text=text,attachMarkedSpans(this,markedSpans),this.height=estimateHeight?estimateHeight(this):1};function cleanUpLine(line){line.parent=null,detachMarkedSpans(line)}Line.prototype.lineNo=function(){return lineNo(this)},eventMixin(Line);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-$&"))}function buildLineContent(cm,lineView){var content=eltP("span",null,null,webkit?"padding-right: .1px":null),builder={pre:eltP("pre",[content],"CodeMirror-line"),content:content,col:0,pos:0,cm:cm,trailingSpace:!1,splitSpaces:cm.getOption("lineWrapping")};lineView.measure={};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,hasBadBidiRects(cm.display.measure)&&(order=getOrder(line,cm.doc.direction))&&(builder.addToken=buildTokenBadBidi(builder.addToken,order)),builder.map=[],insertLineContent(line,builder,getLineStyles(cm,line,lineView!=cm.display.externalMeasured&&lineNo(line))),line.styleClasses&&(line.styleClasses.bgClass&&(builder.bgClass=joinClasses(line.styleClasses.bgClass,builder.bgClass||"")),line.styleClasses.textClass&&(builder.textClass=joinClasses(line.styleClasses.textClass,builder.textClass||""))),0==builder.map.length&&builder.map.push(0,0,builder.content.appendChild(zeroWidthElement(cm.display.measure))),0==i?(lineView.measure.map=builder.map,lineView.measure.cache={}):((lineView.measure.maps||(lineView.measure.maps=[])).push(builder.map),(lineView.measure.caches||(lineView.measure.caches=[])).push({}))}if(webkit){var last=builder.content.lastChild;(/\bcm-tab\b/.test(last.className)||last.querySelector&&last.querySelector(".cm-tab"))&&(builder.content.className="cm-tab-wrap-hack")}return signal(cm,"renderLine",cm,lineView.line,builder.pre),builder.pre.className&&(builder.textClass=joinClasses(builder.pre.className,builder.textClass||"")),builder}function defaultSpecialCharPlaceholder(ch){var token=elt("span","•","cm-invalidchar");return token.title="\\u"+ch.charCodeAt(0).toString(16),token.setAttribute("aria-label",token.title),token}function buildToken(builder,text,style,startStyle,endStyle,css,attributes){if(text){var content,displayText=builder.splitSpaces?function(text,trailingBefore){if(1start&&part.from<=start);i++);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;widget&&builder.map.push(builder.pos,builder.pos+size,widget),!ignoreWidget&&builder.cm.display.input.needsContentAttribute&&(widget||(widget=builder.content.appendChild(document.createElement("span"))),widget.setAttribute("cm-marker",marker.id)),widget&&(builder.cm.display.input.setUneditable(widget),builder.content.appendChild(widget)),builder.pos+=size,builder.trailingSpace=!1}function insertLineContent(line,builder,styles){var spans=line.markedSpans,allText=line.text,at=0;if(spans)for(var style,css,spanStyle,spanEndStyle,spanStartStyle,collapsed,attributes,len=allText.length,pos=0,i=1,text="",nextChange=0;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=css="",collapsed=attributes=null,nextChange=1/0;for(var foundBookmarks=[],endStyles=void 0,j=0;jpos||m.collapsed&&sp.to==pos&&sp.from==pos)){if(null!=sp.to&&sp.to!=pos&&nextChange>sp.to&&(nextChange=sp.to,spanEndStyle=""),m.className&&(spanStyle+=" "+m.className),m.css&&(css=(css?css+";":"")+m.css),m.startStyle&&sp.from==pos&&(spanStartStyle+=" "+m.startStyle),m.endStyle&&sp.to==nextChange&&(endStyles||(endStyles=[])).push(m.endStyle,sp.to),m.title&&((attributes||(attributes={})).title=m.title),m.attributes)for(var attr in m.attributes)(attributes||(attributes={}))[attr]=m.attributes[attr];m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)&&(collapsed=sp)}else sp.from>pos&&nextChange>sp.from&&(nextChange=sp.from)}if(endStyles)for(var j$1=0;j$1lineN)return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:!0}}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}function findViewForLine(cm,lineN){if(lineN>=cm.display.viewFrom&&lineN=ext.lineN&&lineNch)&&(start=(end=mEnd-mStart)-1,mEnd<=ch&&(collapse="right")),null!=start){if(node=map$$1[i+2],mStart==mEnd&&bias==(node.insertLeft?"left":"right")&&(collapse=bias),"left"==bias&&0==start)for(;i&&map$$1[i-2]==map$$1[i-3]&&map$$1[i-1].insertLeft;)node=map$$1[2+(i-=3)],collapse="left";if("right"==bias&&start==mEnd-mStart)for(;i=lineObj.text.length?(ch=lineObj.text.length,sticky="before"):ch<=0&&(ch=0,sticky="after"),!order)return get("before"==sticky?ch-1:ch,"before"==sticky);function getBidi(ch,partPos,invert){return get(invert?ch-1:ch,1==order[partPos].level!=invert)}var partPos=getBidiPartAt(order,ch,sticky),other=bidiOther,val=getBidi(ch,partPos,"before"==sticky);return null!=other&&(val.other=getBidi(ch,other,"before"!=sticky)),val}function estimateCoords(cm,pos){var left=0;pos=clipPos(cm.doc,pos),cm.options.lineWrapping||(left=charWidth(cm.display)*pos.ch);var lineObj=getLine(cm.doc,pos.line),top=heightAtLine(lineObj)+paddingTop(cm.display);return{left:left,right:left,top:top,bottom:top+lineObj.height}}function PosWithInfo(line,ch,sticky,outside,xRel){var pos=Pos(line,ch,sticky);return pos.xRel=xRel,outside&&(pos.outside=!0),pos}function coordsChar(cm,x,y){var doc=cm.doc;if((y+=cm.display.viewOffset)<0)return PosWithInfo(doc.first,0,null,!0,-1);var lineN=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lasty},begin,end)}}function wrappedLineExtentChar(cm,lineObj,preparedMeasure,target){return preparedMeasure||(preparedMeasure=prepareMeasureForLine(cm,lineObj)),wrappedLineExtent(cm,lineObj,preparedMeasure,intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,target),"line").top)}function boxIsAfter(box,x,y,left){return!(box.bottom<=y)&&(box.top>y||(left?box.left:box.right)>x)}function coordsCharInner(cm,lineObj,lineNo$$1,x,y){y-=heightAtLine(lineObj);var preparedMeasure=prepareMeasureForLine(cm,lineObj),widgetHeight$$1=widgetTopHeight(lineObj),begin=0,end=lineObj.text.length,ltr=!0,order=getOrder(lineObj,cm.doc.direction);if(order){var part=(cm.options.lineWrapping?function(cm,lineObj,_lineNo,preparedMeasure,order,x,y){var ref=wrappedLineExtent(cm,lineObj,preparedMeasure,y),begin=ref.begin,end=ref.end;/\s/.test(lineObj.text.charAt(end-1))&&end--;for(var part=null,closestDist=null,i=0;i=end||p.to<=begin)){var ltr=1!=p.level,endX=measureCharPrepared(cm,preparedMeasure,ltr?Math.min(end,p.to)-1:Math.max(begin,p.from)).right,dist=endXend&&(part={from:part.from,to:end,level:part.level});return part}:function(cm,lineObj,lineNo$$1,preparedMeasure,order,x,y){var index=findFirst(function(i){var part=order[i],ltr=1!=part.level;return boxIsAfter(cursorCoords(cm,Pos(lineNo$$1,ltr?part.to:part.from,ltr?"before":"after"),"line",lineObj,preparedMeasure),x,y,!0)},0,order.length-1),part=order[index];if(0y&&(part=order[index-1])}return part})(cm,lineObj,lineNo$$1,preparedMeasure,order,x,y);begin=(ltr=1!=part.level)?part.from:part.to-1,end=ltr?part.to:part.from-1}var baseX,sticky,chAround=null,boxAround=null,ch=findFirst(function(ch){var box=measureCharPrepared(cm,preparedMeasure,ch);return box.top+=widgetHeight$$1,box.bottom+=widgetHeight$$1,!!boxIsAfter(box,x,y,!1)&&(box.top<=y&&box.left<=x&&(chAround=ch,boxAround=box),!0)},begin,end),outside=!1;if(boxAround){var atLeft=x-boxAround.left=coords.bottom}return PosWithInfo(lineNo$$1,ch=skipExtendingChars(lineObj.text,ch,1),sticky,outside,x-baseX)}function textHeight(display){if(null!=display.cachedTextHeight)return display.cachedTextHeight;if(null==measureText){measureText=elt("pre");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;return 3=cm.display.viewTo)return null;if((n-=cm.display.viewFrom)<0)return null;for(var view=cm.display.view,i=0;ifrom)&&(display.updateLineNumbers=from),cm.curOp.viewChanged=!0,from>=display.viewTo)sawCollapsedSpans&&visualLineNo(cm.doc,from)display.viewFrom?resetView(cm):(display.viewFrom+=lendiff,display.viewTo+=lendiff);else if(from<=display.viewFrom&&to>=display.viewTo)resetView(cm);else if(from<=display.viewFrom){var cut=viewCuttingPoint(cm,to,to+lendiff,1);cut?(display.view=display.view.slice(cut.index),display.viewFrom=cut.lineN,display.viewTo+=lendiff):resetView(cm)}else if(to>=display.viewTo){var cut$1=viewCuttingPoint(cm,from,from,-1);cut$1?(display.view=display.view.slice(0,cut$1.index),display.viewTo=cut$1.lineN):resetView(cm)}else{var cutTop=viewCuttingPoint(cm,from,from,-1),cutBot=viewCuttingPoint(cm,to,to+lendiff,1);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):resetView(cm)}var ext=display.externalMeasured;ext&&(to=ext.lineN&&line=display.viewTo)){var lineView=display.view[findViewIndex(cm,line)];if(null!=lineView.node){var arr=lineView.changes||(lineView.changes=[]);-1==indexOf(arr,type)&&arr.push(type)}}}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 diff,index=findViewIndex(cm,oldN),view=cm.display.view;if(!sawCollapsedSpans||newN==cm.doc.first+cm.doc.size)return{index:index,lineN:newN};for(var n=cm.display.viewFrom,i=0;i=cm.display.viewTo||range$$1.to().linefrom||from==to&&part.to==from)&&(f(Math.max(part.from,from),Math.min(part.to,to),1==part.level?"rtl":"ltr",i),found=!0)}found||f(from,to,"ltr")}(order,fromArg||0,null==toArg?lineLen:toArg,function(from,to,dir,i){var ltr="ltr"==dir,fromPos=coords(from,ltr?"left":"right"),toPos=coords(to-1,ltr?"right":"left"),openStart=null==fromArg&&0==from,openEnd=null==toArg&&to==lineLen,first=0==i,last=!order||i==order.length-1;if(toPos.top-fromPos.top<=3){var openRight=(docLTR?openEnd:openStart)&&last,left=(docLTR?openStart:openEnd)&&first?leftSide:(ltr?fromPos:toPos).left,right=openRight?rightSide:(ltr?toPos:fromPos).right;add(left,fromPos.top,right-left,fromPos.bottom)}else{var topLeft,topRight,botLeft,botRight;botRight=ltr?(topLeft=docLTR&&openStart&&first?leftSide:fromPos.left,topRight=docLTR?rightSide:wrapX(from,dir,"before"),botLeft=docLTR?leftSide:wrapX(to,dir,"after"),docLTR&&openEnd&&last?rightSide:toPos.right):(topLeft=docLTR?wrapX(from,dir,"before"):leftSide,topRight=!docLTR&&openStart&&first?rightSide:fromPos.right,botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left,docLTR?wrapX(to,dir,"after"):rightSide),add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom),fromPos.bottomcm.display.sizerWidth){var chWidth=Math.ceil(width/charWidth(cm.display));chWidth>cm.display.maxLineLength&&(cm.display.maxLineLength=chWidth,cm.display.maxLine=cur.line,cm.display.maxLineChanged=!0)}}}}function updateWidgetHeight(line){if(line.widgets)for(var i=0;i=to&&(from=lineAtHeight(doc,heightAtLine(getLine(doc,ensureTo))-display.wrapper.clientHeight),to=ensureTo)}return{from:from,to:Math.max(to,from+1)}}function calculateScrollPos(cm,rect){var display=cm.display,snapMargin=textHeight(cm.display);rect.top<0&&(rect.top=0);var screentop=cm.curOp&&null!=cm.curOp.scrollTop?cm.curOp.scrollTop:display.scroller.scrollTop,screen=displayHeight(cm),result={};rect.bottom-rect.top>screen&&(rect.bottom=rect.top+screen);var docBottom=cm.doc.height+paddingVert(display),atTop=rect.topdocBottom-snapMargin;if(rect.topscreentop+screen){var newTop=Math.min(rect.top,(atBottom?docBottom:rect.bottom)-screen);newTop!=screentop&&(result.scrollTop=newTop)}var screenleft=cm.curOp&&null!=cm.curOp.scrollLeft?cm.curOp.scrollLeft:display.scroller.scrollLeft,screenw=displayWidth(cm)-(cm.options.fixedGutter?display.gutters.offsetWidth:0),tooWide=rect.right-rect.left>screenw;return tooWide&&(rect.right=rect.left+screenw),rect.left<10?result.scrollLeft=0:rect.leftscreenw+screenleft-3&&(result.scrollLeft=rect.right+(tooWide?0:10)-screenw),result}function addToScrollTop(cm,top){null!=top&&(resolveScrollToPos(cm),cm.curOp.scrollTop=(null==cm.curOp.scrollTop?cm.doc.scrollTop:cm.curOp.scrollTop)+top)}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){null==x&&null==y||resolveScrollToPos(cm),null!=x&&(cm.curOp.scrollLeft=x),null!=y&&(cm.curOp.scrollTop=y)}function resolveScrollToPos(cm){var range$$1=cm.curOp.scrollToPos;range$$1&&(cm.curOp.scrollToPos=null,scrollToCoordsRange(cm,estimateCoords(cm,range$$1.from),estimateCoords(cm,range$$1.to),range$$1.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)}function updateScrollTop(cm,val){Math.abs(cm.doc.scrollTop-val)<2||(gecko||updateDisplaySimple(cm,{top:val}),setScrollTop(cm,val,!0),gecko&&updateDisplaySimple(cm),startWorker(cm,100))}function setScrollTop(cm,val,forceScroll){val=Math.min(cm.display.scroller.scrollHeight-cm.display.scroller.clientHeight,val),cm.display.scroller.scrollTop==val&&!forceScroll||(cm.doc.scrollTop=val,cm.display.scrollbars.setScrollTop(val),cm.display.scroller.scrollTop!=val&&(cm.display.scroller.scrollTop=val))}function setScrollLeft(cm,val,isScroller,forceScroll){val=Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth),(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2)&&!forceScroll||(cm.doc.scrollLeft=val,alignHorizontally(cm),cm.display.scroller.scrollLeft!=val&&(cm.display.scroller.scrollLeft=val),cm.display.scrollbars.setScrollLeft(val))}function measureForScrollbars(cm){var d=cm.display,gutterW=d.gutters.offsetWidth,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}}function NativeScrollbars(place,scroll,cm){this.cm=cm;var vert=this.vert=elt("div",[elt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),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(){vert.clientHeight&&scroll(vert.scrollTop,"vertical")}),on(horiz,"scroll",function(){horiz.clientWidth&&scroll(horiz.scrollLeft,"horizontal")}),this.checkedZeroWidth=!1,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,needsV=measure.scrollHeight>measure.clientHeight+1,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);this.vert.firstChild.style.height=Math.max(0,measure.scrollHeight-measure.clientHeight+totalHeight)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(needsH){this.horiz.style.display="block",this.horiz.style.right=needsV?sWidth+"px":"0",this.horiz.style.left=measure.barLeft+"px";var totalWidth=measure.viewWidth-measure.barLeft-(needsV?sWidth:0);this.horiz.firstChild.style.width=Math.max(0,measure.scrollWidth-measure.clientWidth+totalWidth)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&0=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_R2(op){var cm=op.cm,display=cm.display;op.updatedDisplay&&updateHeightsInViewport(cm),op.barMeasure=measureForScrollbars(cm),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))),(op.updatedDisplay||op.selectionChanged)&&(op.preparedSelection=display.input.prepareSelection())}function endOperation_W2(op){var cm=op.cm;null!=op.adjustWidthTo&&(cm.display.sizer.style.minWidth=op.adjustWidthTo+"px",op.maxScrollLeft(window.innerHeight||document.documentElement.clientHeight)&&(doScroll=!1),null!=doScroll&&!phantom){var scrollNode=elt("div","​",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)}}}(cm,function(cm,pos,end,margin){var rect;null==margin&&(margin=0),cm.options.lineWrapping||pos!=end||(end="before"==(pos=pos.ch?Pos(pos.line,"before"==pos.sticky?pos.ch-1:pos.ch,"after"):pos).sticky?Pos(pos.line,pos.ch+1,"before"):pos);for(var limit=0;limit<5;limit++){var changed=!1,coords=cursorCoords(cm,pos),endCoords=end&&end!=pos?cursorCoords(cm,end):coords,scrollPos=calculateScrollPos(cm,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}),startTop=cm.doc.scrollTop,startLeft=cm.doc.scrollLeft;if(null!=scrollPos.scrollTop&&(updateScrollTop(cm,scrollPos.scrollTop),1